msvcrt: Use intptr_t or size_t instead of long where appropriate.

This commit is contained in:
Alexandre Julliard 2008-12-11 21:01:38 +01:00
parent 33fa6c2e25
commit d8ab5a14aa
6 changed files with 42 additions and 42 deletions

View File

@ -201,7 +201,7 @@ int CDECL _chdrive(int newdrive)
* NOTES * NOTES
* See FindClose. * See FindClose.
*/ */
int CDECL MSVCRT__findclose(long hand) int CDECL MSVCRT__findclose(MSVCRT_intptr_t hand)
{ {
TRACE(":handle %ld\n",hand); TRACE(":handle %ld\n",hand);
if (!FindClose((HANDLE)hand)) if (!FindClose((HANDLE)hand))
@ -229,7 +229,7 @@ int CDECL MSVCRT__findclose(long hand)
* NOTES * NOTES
* See FindFirstFileA. * See FindFirstFileA.
*/ */
long CDECL MSVCRT__findfirst(const char * fspec, struct MSVCRT__finddata_t* ft) MSVCRT_intptr_t CDECL MSVCRT__findfirst(const char * fspec, struct MSVCRT__finddata_t* ft)
{ {
WIN32_FIND_DATAA find_data; WIN32_FIND_DATAA find_data;
HANDLE hfind; HANDLE hfind;
@ -242,7 +242,7 @@ long CDECL MSVCRT__findfirst(const char * fspec, struct MSVCRT__finddata_t* ft)
} }
msvcrt_fttofd(&find_data,ft); msvcrt_fttofd(&find_data,ft);
TRACE(":got handle %p\n",hfind); TRACE(":got handle %p\n",hfind);
return (long)hfind; return (MSVCRT_intptr_t)hfind;
} }
/********************************************************************* /*********************************************************************
@ -250,7 +250,7 @@ long CDECL MSVCRT__findfirst(const char * fspec, struct MSVCRT__finddata_t* ft)
* *
* Unicode version of _findfirst. * Unicode version of _findfirst.
*/ */
long CDECL MSVCRT__wfindfirst(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfinddata_t* ft) MSVCRT_intptr_t CDECL MSVCRT__wfindfirst(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfinddata_t* ft)
{ {
WIN32_FIND_DATAW find_data; WIN32_FIND_DATAW find_data;
HANDLE hfind; HANDLE hfind;
@ -263,7 +263,7 @@ long CDECL MSVCRT__wfindfirst(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfind
} }
msvcrt_wfttofd(&find_data,ft); msvcrt_wfttofd(&find_data,ft);
TRACE(":got handle %p\n",hfind); TRACE(":got handle %p\n",hfind);
return (long)hfind; return (MSVCRT_intptr_t)hfind;
} }
/********************************************************************* /*********************************************************************
@ -271,7 +271,7 @@ long CDECL MSVCRT__wfindfirst(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfind
* *
* 64-bit version of _findfirst. * 64-bit version of _findfirst.
*/ */
long CDECL MSVCRT__findfirsti64(const char * fspec, struct MSVCRT__finddatai64_t* ft) MSVCRT_intptr_t CDECL MSVCRT__findfirsti64(const char * fspec, struct MSVCRT__finddatai64_t* ft)
{ {
WIN32_FIND_DATAA find_data; WIN32_FIND_DATAA find_data;
HANDLE hfind; HANDLE hfind;
@ -284,7 +284,7 @@ long CDECL MSVCRT__findfirsti64(const char * fspec, struct MSVCRT__finddatai64_t
} }
msvcrt_fttofdi64(&find_data,ft); msvcrt_fttofdi64(&find_data,ft);
TRACE(":got handle %p\n",hfind); TRACE(":got handle %p\n",hfind);
return (long)hfind; return (MSVCRT_intptr_t)hfind;
} }
/********************************************************************* /*********************************************************************
@ -292,7 +292,7 @@ long CDECL MSVCRT__findfirsti64(const char * fspec, struct MSVCRT__finddatai64_t
* *
* Unicode version of _findfirsti64. * Unicode version of _findfirsti64.
*/ */
long CDECL MSVCRT__wfindfirsti64(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfinddatai64_t* ft) MSVCRT_intptr_t CDECL MSVCRT__wfindfirsti64(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfinddatai64_t* ft)
{ {
WIN32_FIND_DATAW find_data; WIN32_FIND_DATAW find_data;
HANDLE hfind; HANDLE hfind;
@ -305,7 +305,7 @@ long CDECL MSVCRT__wfindfirsti64(const MSVCRT_wchar_t * fspec, struct MSVCRT__wf
} }
msvcrt_wfttofdi64(&find_data,ft); msvcrt_wfttofdi64(&find_data,ft);
TRACE(":got handle %p\n",hfind); TRACE(":got handle %p\n",hfind);
return (long)hfind; return (MSVCRT_intptr_t)hfind;
} }
/********************************************************************* /*********************************************************************
@ -324,7 +324,7 @@ long CDECL MSVCRT__wfindfirsti64(const MSVCRT_wchar_t * fspec, struct MSVCRT__wf
* NOTES * NOTES
* See FindNextFileA. * See FindNextFileA.
*/ */
int CDECL MSVCRT__findnext(long hand, struct MSVCRT__finddata_t * ft) int CDECL MSVCRT__findnext(MSVCRT_intptr_t hand, struct MSVCRT__finddata_t * ft)
{ {
WIN32_FIND_DATAA find_data; WIN32_FIND_DATAA find_data;
@ -343,7 +343,7 @@ int CDECL MSVCRT__findnext(long hand, struct MSVCRT__finddata_t * ft)
* *
* Unicode version of _findnext. * Unicode version of _findnext.
*/ */
int CDECL MSVCRT__wfindnext(long hand, struct MSVCRT__wfinddata_t * ft) int CDECL MSVCRT__wfindnext(MSVCRT_intptr_t hand, struct MSVCRT__wfinddata_t * ft)
{ {
WIN32_FIND_DATAW find_data; WIN32_FIND_DATAW find_data;
@ -362,7 +362,7 @@ int CDECL MSVCRT__wfindnext(long hand, struct MSVCRT__wfinddata_t * ft)
* *
* 64-bit version of _findnext. * 64-bit version of _findnext.
*/ */
int CDECL MSVCRT__findnexti64(long hand, struct MSVCRT__finddatai64_t * ft) int CDECL MSVCRT__findnexti64(MSVCRT_intptr_t hand, struct MSVCRT__finddatai64_t * ft)
{ {
WIN32_FIND_DATAA find_data; WIN32_FIND_DATAA find_data;
@ -381,7 +381,7 @@ int CDECL MSVCRT__findnexti64(long hand, struct MSVCRT__finddatai64_t * ft)
* *
* Unicode version of _findnexti64. * Unicode version of _findnexti64.
*/ */
int CDECL MSVCRT__wfindnexti64(long hand, struct MSVCRT__wfinddatai64_t * ft) int CDECL MSVCRT__wfindnexti64(MSVCRT_intptr_t hand, struct MSVCRT__wfinddatai64_t * ft)
{ {
WIN32_FIND_DATAW find_data; WIN32_FIND_DATAW find_data;

View File

@ -1244,12 +1244,12 @@ int CDECL _futime(int fd, struct MSVCRT__utimbuf *t)
/********************************************************************* /*********************************************************************
* _get_osfhandle (MSVCRT.@) * _get_osfhandle (MSVCRT.@)
*/ */
long CDECL _get_osfhandle(int fd) MSVCRT_intptr_t CDECL _get_osfhandle(int fd)
{ {
HANDLE hand = msvcrt_fdtoh(fd); HANDLE hand = msvcrt_fdtoh(fd);
TRACE(":fd (%d) handle (%p)\n",fd,hand); TRACE(":fd (%d) handle (%p)\n",fd,hand);
return (long)hand; return (MSVCRT_intptr_t)hand;
} }
/********************************************************************* /*********************************************************************
@ -1599,7 +1599,7 @@ int CDECL _wcreat(const MSVCRT_wchar_t *path, int flags)
/********************************************************************* /*********************************************************************
* _open_osfhandle (MSVCRT.@) * _open_osfhandle (MSVCRT.@)
*/ */
int CDECL _open_osfhandle(long handle, int oflags) int CDECL _open_osfhandle(MSVCRT_intptr_t handle, int oflags)
{ {
int fd; int fd;

View File

@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
~(alignment - 1)) - offset)) ~(alignment - 1)) - offset))
typedef void (*MSVCRT_new_handler_func)(unsigned long size); typedef void (*MSVCRT_new_handler_func)(MSVCRT_size_t size);
static MSVCRT_new_handler_func MSVCRT_new_handler; static MSVCRT_new_handler_func MSVCRT_new_handler;
static int MSVCRT_new_mode; static int MSVCRT_new_mode;
@ -52,7 +52,7 @@ static MSVCRT_size_t MSVCRT_sbh_threshold = 0;
/********************************************************************* /*********************************************************************
* ??2@YAPAXI@Z (MSVCRT.@) * ??2@YAPAXI@Z (MSVCRT.@)
*/ */
void* CDECL MSVCRT_operator_new(unsigned long size) void* CDECL MSVCRT_operator_new(MSVCRT_size_t size)
{ {
void *retval = HeapAlloc(GetProcessHeap(), 0, size); void *retval = HeapAlloc(GetProcessHeap(), 0, size);
TRACE("(%ld) returning %p\n", size, retval); TRACE("(%ld) returning %p\n", size, retval);
@ -130,7 +130,7 @@ int CDECL MSVCRT__set_new_mode(int mode)
/********************************************************************* /*********************************************************************
* _callnewh (MSVCRT.@) * _callnewh (MSVCRT.@)
*/ */
int CDECL _callnewh(unsigned long size) int CDECL _callnewh(MSVCRT_size_t size)
{ {
if(MSVCRT_new_handler) if(MSVCRT_new_handler)
(*MSVCRT_new_handler)(size); (*MSVCRT_new_handler)(size);
@ -237,7 +237,7 @@ int CDECL _heapset(unsigned int value)
*/ */
int CDECL _heapadd(void* mem, MSVCRT_size_t size) int CDECL _heapadd(void* mem, MSVCRT_size_t size)
{ {
TRACE("(%p,%d) unsupported in Win32\n", mem,size); TRACE("(%p,%ld) unsupported in Win32\n", mem,size);
*MSVCRT__errno() = MSVCRT_ENOSYS; *MSVCRT__errno() = MSVCRT_ENOSYS;
return -1; return -1;
} }
@ -247,8 +247,8 @@ int CDECL _heapadd(void* mem, MSVCRT_size_t size)
*/ */
MSVCRT_size_t CDECL _msize(void* mem) MSVCRT_size_t CDECL _msize(void* mem)
{ {
long size = HeapSize(GetProcessHeap(),0,mem); MSVCRT_size_t size = HeapSize(GetProcessHeap(),0,mem);
if (size == -1) if (size == ~(MSVCRT_size_t)0)
{ {
WARN(":Probably called with non wine-allocated memory, ret = -1\n"); WARN(":Probably called with non wine-allocated memory, ret = -1\n");
/* At least the Win32 crtdll/msvcrt also return -1 in this case */ /* At least the Win32 crtdll/msvcrt also return -1 in this case */
@ -342,7 +342,7 @@ void CDECL _aligned_free(void *memblock)
void * CDECL _aligned_offset_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment, MSVCRT_size_t offset) void * CDECL _aligned_offset_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment, MSVCRT_size_t offset)
{ {
void *memblock, *temp, **saved; void *memblock, *temp, **saved;
TRACE("(%u, %u, %u)\n", size, alignment, offset); TRACE("(%lu, %lu, %lu)\n", size, alignment, offset);
/* alignment must be a power of 2 */ /* alignment must be a power of 2 */
if ((alignment & (alignment - 1)) != 0) if ((alignment & (alignment - 1)) != 0)
@ -384,7 +384,7 @@ void * CDECL _aligned_offset_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment,
*/ */
void * CDECL _aligned_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment) void * CDECL _aligned_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment)
{ {
TRACE("(%u, %u)\n", size, alignment); TRACE("(%lu, %lu)\n", size, alignment);
return _aligned_offset_malloc(size, alignment, 0); return _aligned_offset_malloc(size, alignment, 0);
} }
@ -396,7 +396,7 @@ void * CDECL _aligned_offset_realloc(void *memblock, MSVCRT_size_t size,
{ {
void * temp, **saved; void * temp, **saved;
MSVCRT_size_t old_padding, new_padding, old_size; MSVCRT_size_t old_padding, new_padding, old_size;
TRACE("(%p, %u, %u, %u)\n", memblock, size, alignment, offset); TRACE("(%p, %lu, %lu, %lu)\n", memblock, size, alignment, offset);
if (!memblock) if (!memblock)
return _aligned_offset_malloc(size, alignment, offset); return _aligned_offset_malloc(size, alignment, offset);
@ -508,6 +508,6 @@ void * CDECL _aligned_offset_realloc(void *memblock, MSVCRT_size_t size,
*/ */
void * CDECL _aligned_realloc(void *memblock, MSVCRT_size_t size, MSVCRT_size_t alignment) void * CDECL _aligned_realloc(void *memblock, MSVCRT_size_t size, MSVCRT_size_t alignment)
{ {
TRACE("(%p, %u, %u)\n", memblock, size, alignment); TRACE("(%p, %lu, %lu)\n", memblock, size, alignment);
return _aligned_offset_realloc(memblock, size, alignment, 0); return _aligned_offset_realloc(memblock, size, alignment, 0);
} }

View File

@ -51,9 +51,9 @@ typedef unsigned __int64 MSVCRT_size_t;
typedef __int64 MSVCRT_intptr_t; typedef __int64 MSVCRT_intptr_t;
typedef unsigned __int64 MSVCRT_uintptr_t; typedef unsigned __int64 MSVCRT_uintptr_t;
#else #else
typedef unsigned int MSVCRT_size_t; typedef unsigned long MSVCRT_size_t;
typedef int MSVCRT_intptr_t; typedef long MSVCRT_intptr_t;
typedef unsigned int MSVCRT_uintptr_t; typedef unsigned long MSVCRT_uintptr_t;
#endif #endif
typedef unsigned int MSVCRT__dev_t; typedef unsigned int MSVCRT__dev_t;
typedef int MSVCRT__off_t; typedef int MSVCRT__off_t;
@ -132,7 +132,7 @@ MSVCRT_wchar_t *msvcrt_wstrdupa(const char *);
*/ */
int __cdecl MSVCRT__set_new_mode(int mode); int __cdecl MSVCRT__set_new_mode(int mode);
void* __cdecl MSVCRT_operator_new(unsigned long size); void* __cdecl MSVCRT_operator_new(MSVCRT_size_t);
void __cdecl MSVCRT_operator_delete(void*); void __cdecl MSVCRT_operator_delete(void*);
typedef void* (*__cdecl malloc_func_t)(MSVCRT_size_t); typedef void* (*__cdecl malloc_func_t)(MSVCRT_size_t);

View File

@ -377,7 +377,7 @@ MSVCRT_size_t CDECL MSVCRT_wcsftime( MSVCRT_wchar_t *str, MSVCRT_size_t max,
char *s, *fmt; char *s, *fmt;
MSVCRT_size_t len; MSVCRT_size_t len;
TRACE("%p %d %s %p\n", str, max, debugstr_w(format), mstm ); TRACE("%p %ld %s %p\n", str, max, debugstr_w(format), mstm );
len = WideCharToMultiByte( CP_UNIXCP, 0, format, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_UNIXCP, 0, format, -1, NULL, 0, NULL, NULL );
if (!(fmt = MSVCRT_malloc( len ))) return 0; if (!(fmt = MSVCRT_malloc( len ))) return 0;

View File

@ -85,19 +85,19 @@ int _dup2(int,int);
int _eof(int); int _eof(int);
__int64 _filelengthi64(int); __int64 _filelengthi64(int);
long _filelength(int); long _filelength(int);
int _findclose(long); int _findclose(intptr_t);
long _findfirst(const char*,struct _finddata_t*); intptr_t _findfirst(const char*,struct _finddata_t*);
long _findfirsti64(const char*, struct _finddatai64_t*); intptr_t _findfirsti64(const char*, struct _finddatai64_t*);
int _findnext(long,struct _finddata_t*); int _findnext(intptr_t,struct _finddata_t*);
int _findnexti64(long, struct _finddatai64_t*); int _findnexti64(intptr_t, struct _finddatai64_t*);
long _get_osfhandle(int); intptr_t _get_osfhandle(int);
int _isatty(int); int _isatty(int);
int _locking(int,int,long); int _locking(int,int,long);
long _lseek(int,long,int); long _lseek(int,long,int);
__int64 _lseeki64(int,__int64,int); __int64 _lseeki64(int,__int64,int);
char* _mktemp(char*); char* _mktemp(char*);
int _open(const char*,int,...); int _open(const char*,int,...);
int _open_osfhandle(long,int); int _open_osfhandle(intptr_t,int);
int _pipe(int*,unsigned int,int); int _pipe(int*,unsigned int,int);
int _read(int,void*,unsigned int); int _read(int,void*,unsigned int);
int _setmode(int,int); int _setmode(int,int);
@ -116,10 +116,10 @@ int rename(const char*,const char*);
int _waccess(const wchar_t*,int); int _waccess(const wchar_t*,int);
int _wchmod(const wchar_t*,int); int _wchmod(const wchar_t*,int);
int _wcreat(const wchar_t*,int); int _wcreat(const wchar_t*,int);
long _wfindfirst(const wchar_t*,struct _wfinddata_t*); intptr_t _wfindfirst(const wchar_t*,struct _wfinddata_t*);
long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); intptr_t _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
int _wfindnext(long,struct _wfinddata_t*); int _wfindnext(intptr_t,struct _wfinddata_t*);
int _wfindnexti64(long, struct _wfinddatai64_t*); int _wfindnexti64(intptr_t, struct _wfinddatai64_t*);
wchar_t*_wmktemp(wchar_t*); wchar_t*_wmktemp(wchar_t*);
int _wopen(const wchar_t*,int,...); int _wopen(const wchar_t*,int,...);
int _wrename(const wchar_t*,const wchar_t*); int _wrename(const wchar_t*,const wchar_t*);