Author: tkreuzer
Date: Tue Aug 26 22:59:24 2008
New Revision: 35695
URL:
http://svn.reactos.org/svn/reactos?rev=35695&view=rev
Log:
Merge 34717 from ros-amd64-bringup branch:
- Fix prototypes of _findfirst, _findnext, _findclose, _findfirsti64, _findnexti64
_wfindfirst, _wfindnext, _wfindfirst64, _wfindnext64, strndup,
- Fix a number of pointer to int casts
Modified:
trunk/reactos/include/crt/io.h
trunk/reactos/include/reactos/wine/library.h
trunk/reactos/lib/3rdparty/mingw/gccmain.c
trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c
trunk/reactos/lib/sdk/crt/misc/getargs.c
trunk/reactos/lib/sdk/crt/search/lfind.c
trunk/reactos/lib/sdk/crt/search/lsearch.c
trunk/reactos/lib/sdk/crt/stdio/find.c
Modified: trunk/reactos/include/crt/io.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/io.h?rev=35695…
==============================================================================
--- trunk/reactos/include/crt/io.h [iso-8859-1] (original)
+++ trunk/reactos/include/crt/io.h [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -129,10 +129,10 @@
* _findclose calls. _findnext also returns -1 if no match could be found,
* and 0 if a match was found. Call _findclose when you are finished.
*/
-/* FIXME: Should these all use intptr_t, as per recent MSDN docs? */
-_CRTIMP long __cdecl __MINGW_NOTHROW _findfirst (const char*, struct _finddata_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _findnext (long, struct _finddata_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _findclose (long);
+
+_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst (const char*, struct _finddata_t*);
+_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findnext (intptr_t, struct _finddata_t*);
+_CRTIMP int __cdecl __MINGW_NOTHROW _findclose (intptr_t);
_CRTIMP int __cdecl __MINGW_NOTHROW _chdir (const char*);
_CRTIMP char* __cdecl __MINGW_NOTHROW _getcwd (char*, int);
@@ -143,8 +143,8 @@
#ifdef __MSVCRT__
_CRTIMP __int64 __cdecl __MINGW_NOTHROW _filelengthi64(int);
-_CRTIMP long __cdecl __MINGW_NOTHROW _findfirsti64(const char*, struct _finddatai64_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _findnexti64(long, struct _finddatai64_t*);
+_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirsti64(const char*, struct
_finddatai64_t*);
+_CRTIMP int __cdecl __MINGW_NOTHROW _findnexti64(intptr_t, struct _finddatai64_t*);
_CRTIMP __int64 __cdecl __MINGW_NOTHROW _lseeki64(int, __int64, int);
_CRTIMP __int64 __cdecl __MINGW_NOTHROW _telli64(int);
/* These require newer versions of msvcrt.dll (6.1 or higher). */
@@ -259,14 +259,14 @@
_CRTIMP int __cdecl __MINGW_NOTHROW _waccess(const wchar_t*, int);
_CRTIMP int __cdecl __MINGW_NOTHROW _wchmod(const wchar_t*, int);
_CRTIMP int __cdecl __MINGW_NOTHROW _wcreat(const wchar_t*, int);
-_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirst(const wchar_t*, struct _wfinddata_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext(long, struct _wfinddata_t *);
+_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst(const wchar_t*, struct
_wfinddata_t*);
+_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext(intptr_t, struct _wfinddata_t *);
_CRTIMP int __cdecl __MINGW_NOTHROW _wunlink(const wchar_t*);
_CRTIMP int __cdecl __MINGW_NOTHROW _wopen(const wchar_t*, int, ...);
_CRTIMP int __cdecl __MINGW_NOTHROW _wsopen(const wchar_t*, int, int, ...);
_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wmktemp(wchar_t*);
-_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirsti64(const wchar_t*, struct
_wfinddatai64_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnexti64(long, struct _wfinddatai64_t*);
+_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirsti64(const wchar_t*, struct
_wfinddatai64_t*);
+_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnexti64(intptr_t, struct _wfinddatai64_t*);
#if __MSVCRT_VERSION__ >= 0x0601
_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct
__wfinddata64_t*);
_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct
__wfinddata64_t*);
Modified: trunk/reactos/include/reactos/wine/library.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/libra…
==============================================================================
--- trunk/reactos/include/reactos/wine/library.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/wine/library.h [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -23,6 +23,7 @@
#include <stdarg.h>
#include <sys/types.h>
+#include <stdint.h>
#include <windef.h>
#include <winbase.h>
@@ -131,9 +132,9 @@
/* helper functions to manipulate the LDT_ENTRY structure */
inline static void wine_ldt_set_base( LDT_ENTRY *ent, const void *base )
{
- ent->BaseLow = (WORD)(unsigned long)base;
- ent->HighWord.Bits.BaseMid = (BYTE)((unsigned long)base >> 16);
- ent->HighWord.Bits.BaseHi = (BYTE)((unsigned long)base >> 24);
+ ent->BaseLow = (WORD)(intptr_t)base;
+ ent->HighWord.Bits.BaseMid = (BYTE)((intptr_t)base >> 16);
+ ent->HighWord.Bits.BaseHi = (BYTE)((intptr_t)base >> 24);
}
inline static void wine_ldt_set_limit( LDT_ENTRY *ent, unsigned int limit )
{
@@ -144,8 +145,8 @@
inline static void *wine_ldt_get_base( const LDT_ENTRY *ent )
{
return (void *)(ent->BaseLow |
- (unsigned long)ent->HighWord.Bits.BaseMid << 16 |
- (unsigned long)ent->HighWord.Bits.BaseHi << 24);
+ (intptr_t)ent->HighWord.Bits.BaseMid << 16 |
+ (intptr_t)ent->HighWord.Bits.BaseHi << 24);
}
inline static unsigned int wine_ldt_get_limit( const LDT_ENTRY *ent )
{
Modified: trunk/reactos/lib/3rdparty/mingw/gccmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/gccmain…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/gccmain.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/gccmain.c [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -13,6 +13,7 @@
/* Needed for the atexit prototype. */
#include <stdlib.h>
+#include <stddef.h>
typedef void (*func_ptr) (void);
extern func_ptr __CTOR_LIST__[];
@@ -37,8 +38,8 @@
void
__do_global_ctors (void)
{
- unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
- unsigned i;
+ unsigned long nptrs = (unsigned long) (ptrdiff_t) __CTOR_LIST__[0];
+ unsigned long i;
/*
* If the first entry in the constructor list is -1 then the list
@@ -47,8 +48,7 @@
*/
if (nptrs == -1)
{
- for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++)
- ;
+ for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
}
/*
@@ -77,3 +77,4 @@
}
}
+
Modified: trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/pseudo-…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -28,12 +28,12 @@
static void
do_pseudo_reloc (void* start, void* end, void* base)
{
- DWORD reloc_target;
+ ptrdiff_t reloc_target;
runtime_pseudo_reloc* r;
for (r = (runtime_pseudo_reloc*) start; r < (runtime_pseudo_reloc*) end; r++)
{
- reloc_target = (DWORD) base + r->target;
- *((DWORD*) reloc_target) += r->addend;
+ reloc_target = (ptrdiff_t) base + r->target;
+ *((ptrdiff_t*) reloc_target) += r->addend;
}
}
Modified: trunk/reactos/lib/sdk/crt/misc/getargs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/misc/getargs.c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/misc/getargs.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/misc/getargs.c [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -24,7 +24,7 @@
extern HANDLE hHeap;
-char* strndup(char* name, int len)
+char* strndup(char* name, size_t len)
{
char *s = malloc(len + 1);
if (s != NULL)
@@ -35,7 +35,7 @@
return s;
}
-wchar_t* wcsndup(wchar_t* name, int len)
+wchar_t* wcsndup(wchar_t* name, size_t len)
{
wchar_t *s = malloc((len + 1) * sizeof(wchar_t));
if (s != NULL)
@@ -362,3 +362,4 @@
return &__wargv;
}
+
Modified: trunk/reactos/lib/sdk/crt/search/lfind.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/search/lfind.c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/search/lfind.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/search/lfind.c [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -1,12 +1,11 @@
+#include <stdlib.h>
#include <search.h>
-#include <stdlib.h>
-
/*
* @implemented
*/
-void *_lfind(const void *key, const void *base, size_t *nelp,
- size_t width, int (*compar)(const void *, const void *))
+void *_lfind(const void *key, const void *base, unsigned int *nelp,
+ unsigned int width, int (*compar)(const void *, const void *))
{
char* char_base = (char*)base;
unsigned int i;
@@ -19,3 +18,4 @@
return NULL;
}
+
Modified: trunk/reactos/lib/sdk/crt/search/lsearch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/search/lsearch…
==============================================================================
--- trunk/reactos/lib/sdk/crt/search/lsearch.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/search/lsearch.c [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -1,11 +1,11 @@
-#include <search.h>
#include <stdlib.h>
#include <string.h>
+#include <search.h>
/*
* @implemented
*/
-void *_lsearch(const void *key, void *base, size_t *nelp, size_t width,
+void *_lsearch(const void *key, void *base, unsigned int *nelp, unsigned int width,
int (*compar)(const void *, const void *))
{
void *ret_find = _lfind(key,base,nelp,width,compar);
@@ -19,3 +19,4 @@
return base;
}
+
Modified: trunk/reactos/lib/sdk/crt/stdio/find.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/find.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdio/find.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdio/find.c [iso-8859-1] Tue Aug 26 22:59:24 2008
@@ -4,17 +4,13 @@
/*
* @implemented
*/
-#if defined(_UNICODE) || !(__MINGW32_MAJOR_VERSION < 3 || __MINGW32_MINOR_VERSION <
3)
-long
-#else
-int
-#endif
+intptr_t
_tfindfirst(const _TCHAR* _name, struct _tfinddata_t* result)
{
WIN32_FIND_DATA FindFileData;
long hFindFile;
- hFindFile = (long)FindFirstFile(_name, &FindFileData);
+ hFindFile = (intptr_t)FindFirstFile(_name, &FindFileData);
if (hFindFile == -1) {
_dosmaperr(GetLastError());
return -1;
@@ -33,13 +29,7 @@
/*
* @implemented
*/
-int _tfindnext(
-#if defined(_UNICODE) || !(__MINGW32_MAJOR_VERSION < 3 || __MINGW32_MINOR_VERSION <
3)
- long handle,
-#else
- int handle,
-#endif
- struct _tfinddata_t* result)
+intptr_t _tfindnext(intptr_t handle, struct _tfinddata_t* result)
{
WIN32_FIND_DATA FindFileData;
@@ -62,12 +52,12 @@
/*
* @implemented
*/
-long _tfindfirsti64(const _TCHAR *_name, struct _tfinddatai64_t *result)
+intptr_t _tfindfirsti64(const _TCHAR *_name, struct _tfinddatai64_t *result)
{
WIN32_FIND_DATA FindFileData;
long hFindFile;
- hFindFile = (long)FindFirstFile(_name, &FindFileData);
+ hFindFile = (intptr_t)FindFirstFile(_name, &FindFileData);
if (hFindFile == -1)
{
_dosmaperr(GetLastError());
@@ -85,14 +75,10 @@
return hFindFile;
}
-//_CRTIMP long __cdecl _findfirsti64(const char*, struct _finddatai64_t*);
-//_CRTIMP int __cdecl _findnexti64(long, struct _finddatai64_t*);
-
-
/*
* @implemented
*/
-int _tfindnexti64(long handle, struct _tfinddatai64_t *result)
+int _tfindnexti64(intptr_t handle, struct _tfinddatai64_t *result)
{
WIN32_FIND_DATA FindFileData;
@@ -119,15 +105,9 @@
/*
* @implemented
*/
-int _findclose(
-#if __MINGW32_MAJOR_VERSION < 3 || __MINGW32_MINOR_VERSION < 3
- int handle
-#else
- long handle
-#endif
- )
+int _findclose(intptr_t handle)
{
- if (!FindClose((void*)handle)) {
+ if (!FindClose((HANDLE)handle)) {
_dosmaperr(GetLastError());
return -1;
}