msvcrt: Use intptr_t or size_t instead of long where appropriate.
diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c
index d06242c..da688bf 100644
--- a/dlls/msvcrt/dir.c
+++ b/dlls/msvcrt/dir.c
@@ -201,7 +201,7 @@
* NOTES
* See FindClose.
*/
-int CDECL MSVCRT__findclose(long hand)
+int CDECL MSVCRT__findclose(MSVCRT_intptr_t hand)
{
TRACE(":handle %ld\n",hand);
if (!FindClose((HANDLE)hand))
@@ -229,7 +229,7 @@
* NOTES
* 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;
HANDLE hfind;
@@ -242,7 +242,7 @@
}
msvcrt_fttofd(&find_data,ft);
TRACE(":got handle %p\n",hfind);
- return (long)hfind;
+ return (MSVCRT_intptr_t)hfind;
}
/*********************************************************************
@@ -250,7 +250,7 @@
*
* 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;
HANDLE hfind;
@@ -263,7 +263,7 @@
}
msvcrt_wfttofd(&find_data,ft);
TRACE(":got handle %p\n",hfind);
- return (long)hfind;
+ return (MSVCRT_intptr_t)hfind;
}
/*********************************************************************
@@ -271,7 +271,7 @@
*
* 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;
HANDLE hfind;
@@ -284,7 +284,7 @@
}
msvcrt_fttofdi64(&find_data,ft);
TRACE(":got handle %p\n",hfind);
- return (long)hfind;
+ return (MSVCRT_intptr_t)hfind;
}
/*********************************************************************
@@ -292,7 +292,7 @@
*
* 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;
HANDLE hfind;
@@ -305,7 +305,7 @@
}
msvcrt_wfttofdi64(&find_data,ft);
TRACE(":got handle %p\n",hfind);
- return (long)hfind;
+ return (MSVCRT_intptr_t)hfind;
}
/*********************************************************************
@@ -324,7 +324,7 @@
* NOTES
* 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;
@@ -343,7 +343,7 @@
*
* 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;
@@ -362,7 +362,7 @@
*
* 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;
@@ -381,7 +381,7 @@
*
* 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;
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 78861e4..866cd65 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -1244,12 +1244,12 @@
/*********************************************************************
* _get_osfhandle (MSVCRT.@)
*/
-long CDECL _get_osfhandle(int fd)
+MSVCRT_intptr_t CDECL _get_osfhandle(int fd)
{
HANDLE hand = msvcrt_fdtoh(fd);
TRACE(":fd (%d) handle (%p)\n",fd,hand);
- return (long)hand;
+ return (MSVCRT_intptr_t)hand;
}
/*********************************************************************
@@ -1599,7 +1599,7 @@
/*********************************************************************
* _open_osfhandle (MSVCRT.@)
*/
-int CDECL _open_osfhandle(long handle, int oflags)
+int CDECL _open_osfhandle(MSVCRT_intptr_t handle, int oflags)
{
int fd;
diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index 8b92f0f..e40a0c9 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -39,7 +39,7 @@
~(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 int MSVCRT_new_mode;
@@ -52,7 +52,7 @@
/*********************************************************************
* ??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);
TRACE("(%ld) returning %p\n", size, retval);
@@ -130,7 +130,7 @@
/*********************************************************************
* _callnewh (MSVCRT.@)
*/
-int CDECL _callnewh(unsigned long size)
+int CDECL _callnewh(MSVCRT_size_t size)
{
if(MSVCRT_new_handler)
(*MSVCRT_new_handler)(size);
@@ -237,7 +237,7 @@
*/
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;
return -1;
}
@@ -247,8 +247,8 @@
*/
MSVCRT_size_t CDECL _msize(void* mem)
{
- long size = HeapSize(GetProcessHeap(),0,mem);
- if (size == -1)
+ MSVCRT_size_t size = HeapSize(GetProcessHeap(),0,mem);
+ if (size == ~(MSVCRT_size_t)0)
{
WARN(":Probably called with non wine-allocated memory, ret = -1\n");
/* At least the Win32 crtdll/msvcrt also return -1 in this case */
@@ -342,7 +342,7 @@
void * CDECL _aligned_offset_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment, MSVCRT_size_t offset)
{
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 */
if ((alignment & (alignment - 1)) != 0)
@@ -384,7 +384,7 @@
*/
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);
}
@@ -396,7 +396,7 @@
{
void * temp, **saved;
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)
return _aligned_offset_malloc(size, alignment, offset);
@@ -508,6 +508,6 @@
*/
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);
}
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 0fadac4..92bd115 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -51,9 +51,9 @@
typedef __int64 MSVCRT_intptr_t;
typedef unsigned __int64 MSVCRT_uintptr_t;
#else
-typedef unsigned int MSVCRT_size_t;
-typedef int MSVCRT_intptr_t;
-typedef unsigned int MSVCRT_uintptr_t;
+typedef unsigned long MSVCRT_size_t;
+typedef long MSVCRT_intptr_t;
+typedef unsigned long MSVCRT_uintptr_t;
#endif
typedef unsigned int MSVCRT__dev_t;
typedef int MSVCRT__off_t;
@@ -132,7 +132,7 @@
*/
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*);
typedef void* (*__cdecl malloc_func_t)(MSVCRT_size_t);
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index b53cbcd..2b4327b 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -377,7 +377,7 @@
char *s, *fmt;
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 );
if (!(fmt = MSVCRT_malloc( len ))) return 0;
diff --git a/include/msvcrt/io.h b/include/msvcrt/io.h
index f195d71..0b411fa 100644
--- a/include/msvcrt/io.h
+++ b/include/msvcrt/io.h
@@ -85,19 +85,19 @@
int _eof(int);
__int64 _filelengthi64(int);
long _filelength(int);
-int _findclose(long);
-long _findfirst(const char*,struct _finddata_t*);
-long _findfirsti64(const char*, struct _finddatai64_t*);
-int _findnext(long,struct _finddata_t*);
-int _findnexti64(long, struct _finddatai64_t*);
-long _get_osfhandle(int);
+int _findclose(intptr_t);
+intptr_t _findfirst(const char*,struct _finddata_t*);
+intptr_t _findfirsti64(const char*, struct _finddatai64_t*);
+int _findnext(intptr_t,struct _finddata_t*);
+int _findnexti64(intptr_t, struct _finddatai64_t*);
+intptr_t _get_osfhandle(int);
int _isatty(int);
int _locking(int,int,long);
long _lseek(int,long,int);
__int64 _lseeki64(int,__int64,int);
char* _mktemp(char*);
int _open(const char*,int,...);
-int _open_osfhandle(long,int);
+int _open_osfhandle(intptr_t,int);
int _pipe(int*,unsigned int,int);
int _read(int,void*,unsigned int);
int _setmode(int,int);
@@ -116,10 +116,10 @@
int _waccess(const wchar_t*,int);
int _wchmod(const wchar_t*,int);
int _wcreat(const wchar_t*,int);
-long _wfindfirst(const wchar_t*,struct _wfinddata_t*);
-long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
-int _wfindnext(long,struct _wfinddata_t*);
-int _wfindnexti64(long, struct _wfinddatai64_t*);
+intptr_t _wfindfirst(const wchar_t*,struct _wfinddata_t*);
+intptr_t _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
+int _wfindnext(intptr_t,struct _wfinddata_t*);
+int _wfindnexti64(intptr_t, struct _wfinddatai64_t*);
wchar_t*_wmktemp(wchar_t*);
int _wopen(const wchar_t*,int,...);
int _wrename(const wchar_t*,const wchar_t*);