OSDN Git Service

Further corrections for _wfindfirst* and _wfindnext*. Work around issue for __CRT_MA...
authorEarnie Boyd <earnie@users.sourceforge.net>
Mon, 17 Jun 2013 17:33:54 +0000 (13:33 -0400)
committerEarnie Boyd <earnie@users.sourceforge.net>
Mon, 17 Jun 2013 17:33:54 +0000 (13:33 -0400)
ChangeLog
include/_mingw.h
include/io.h
include/wchar.h

index 2b7abc9..265696e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-06-17  Earnie Boyd  <earnie@users.sourceforge.net>
+
+       * include/_mingw.h (__CRT_MAYBE_INLINE): When __NO_INLINE__ defined we
+       need to make it _CRTALIAS to avoid auto export issues.
+       * include/io.h (_wfindfirst*, _wfindnext*): Remove the __NO_INLINE__
+       filter and use __CRT_MAYBE_INLINE definitions.
+       * include/wchar.h (_wfindfirst*, _wfindnext*): Correct the declarations.
+       (_wfindfirst32i64, _wfindfirst64i32, _wfindnext32i64, _wfindnext64i32):
+       Define as __CRT_MAYBE_INLINE.
+
 2013-06-16  Earnie Boyd  <earnie@users.sourceforge.net>
 
        * NEWS: Add text for MSVCRT_VERSION and for the _CRTALIAS 32bit time_t
index eb7c41f..765c60e 100644 (file)
 #ifndef __NO_INLINE__
 #define __CRT_MAYBE_INLINE __CRT_INLINE
 #else /* def __NO_INLINE__ */
-#define __CRT_MAYBE_INLINE
+#define __CRT_MAYBE_INLINE _CRTALIAS /* We need to inline to stop auto-export */
 #endif /* ndef __NO_INLINE__ */
 
 #ifdef __cplusplus
index 6581094..3f32528 100644 (file)
@@ -428,9 +428,8 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct _wfinddata64_t
 int  __cdecl __MINGW_NOTHROW   _wfindnext32i64 (intptr_t, struct _wfinddata32i64_t*);
 int  __cdecl __MINGW_NOTHROW   _wfindnext64i32 (intptr_t, struct _wfinddata64i32_t*);
 
-#ifndef __NO_INLINE__
 #include <string.h>
-__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst32i64(const wchar_t* _filename, struct _wfinddata32i64_t* _fdata) {
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst32i64(const wchar_t* _filename, struct _wfinddata32i64_t* _fdata) {
     struct _wfinddata64_t fd;
     intptr_t ret = _wfindfirst64(_filename, &fd);
     if (ret == -1) {
@@ -446,7 +445,7 @@ __CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst32i64(const wchar_t* _f
     return ret;
 }
 
-__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst64i32(const wchar_t* _filename, struct _wfinddata64i32_t* _fdata) {
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst64i32(const wchar_t* _filename, struct _wfinddata64i32_t* _fdata) {
     struct _wfinddata32_t fd;
     intptr_t ret = _wfindfirst32(_filename, &fd);
     if (ret == -1) {
@@ -462,7 +461,7 @@ __CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst64i32(const wchar_t* _f
     return ret;
 }
 
-__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext32i64(intptr_t _fp, struct _wfinddata32i64_t* _fdata) {
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext32i64(intptr_t _fp, struct _wfinddata32i64_t* _fdata) {
     struct _wfinddata64_t fd;
     int ret = _wfindnext64(_fp,&fd);
     if (ret == -1) {
@@ -478,7 +477,7 @@ __CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext32i64(intptr_t _fp, stru
     return ret;
 }
 
-__CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext64i32(intptr_t _fp, struct _wfinddata64i32_t* _fdata) {
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext64i32(intptr_t _fp, struct _wfinddata64i32_t* _fdata) {
     struct _wfinddata32_t fd;
     int ret = _wfindnext32(_fp, &fd);
     if (ret == -1) {
@@ -494,22 +493,6 @@ __CRT_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext64i32(intptr_t _fp, stru
     return ret;
 }
 
-#else /* def __NO_INLINE__ */
-#define _findfirst64i32 _findfirst64
-#define _finddata64i32_t __finddata64_t
-#define _findfirst32i64 _findfirst32
-#define _finddata32i64_t _finddata32_t
-#define _findnext64i32 _findnext64
-#define _findnext32i64 _findnext32
-
-#define _wfindfirst64i32 _wfindfirst64
-#define _wfindnext64i32 _wfindnext64
-#define _wfinddata64i32_t _wfinddata64_t
-#define _wfindfirst32i64 _wfindfirst32
-#define _wfindnext32i64 _wfindnext32
-#define _wfinddata32i64_t _wfinddata32_t
-#endif /* ndef __NO_INLINE__ */
-
 #endif /* _WIO_DEFINED */
 
 #ifndef        _NO_OLDNAMES
index 0efaedc..233941c 100644 (file)
@@ -489,25 +489,90 @@ _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 intptr_t __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t*, struct _wfinddata32_t*);
+_CRTIMP intptr_t __cdecl __MINGW_NOTHROW       _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
 _CRTIMP int __cdecl __MINGW_NOTHROW    _wfindnexti64 (long, struct _wfinddatai64_t*);
-_CRTIMP long __cdecl __MINGW_NOTHROW   _wfindfirst32i64 (const wchar_t*, struct _wfinddata32i64_t*);
-_CRTIMP long __cdecl __MINGW_NOTHROW   _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*);
-_CRTIMP int  __cdecl __MINGW_NOTHROW   _wfindnext32i64 (long, struct _wfinddata32i64_t*);
-_CRTIMP int  __cdecl __MINGW_NOTHROW   _wfindnext64i32 (long, struct _wfinddata64i32_t*);
+intptr_t __cdecl __MINGW_NOTHROW       _wfindfirst32i64 (const wchar_t*, struct _wfinddata32i64_t*);
+intptr_t __cdecl __MINGW_NOTHROW       _wfindfirst64i32 (const wchar_t*, struct _wfinddata64i32_t*);
+_CRTIMP int  __cdecl __MINGW_NOTHROW _wfindnext (intptr_t, struct _wfinddata32_t*);
+int  __cdecl __MINGW_NOTHROW   _wfindnext32i64 (intptr_t, struct _wfinddata32i64_t*);
+int  __cdecl __MINGW_NOTHROW   _wfindnext64i32 (intptr_t, struct _wfinddata64i32_t*);
 _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*);
 
 /* _wfindfirst32 and _wfindnext32 do not exist in MSVCRT.DLL */
 _CRTALIAS intptr_t __cdecl __MINGW_NOTHROW _wfindfirst32 (const wchar_t* _v1, struct _wfinddata32_t* _v2) {
-    _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t*, struct _wfinddata32_t*);
     return _wfindfirst(_v1, _v2);
 }
 _CRTALIAS int  __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t _v1, struct _wfinddata32_t* _v2) {
-    _CRTIMP int  __cdecl __MINGW_NOTHROW _wfindnext (intptr_t, struct _wfinddata32_t*);
     return _wfindnext(_v1, _v2);
 }
 
+#include <string.h>
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst32i64(const wchar_t* _filename, struct _wfinddata32i64_t* _fdata) {
+    struct _wfinddata64_t fd;
+    intptr_t ret = _wfindfirst64(_filename, &fd);
+    if (ret == -1) {
+        memset(_fdata, 0, sizeof(struct _wfinddata64_t));
+        return ret;
+    }
+    _fdata->attrib = fd.attrib;
+    _fdata->time_create = (__time32_t)fd.time_create;
+    _fdata->time_access = (__time32_t)fd.time_access;
+    _fdata->time_write  = (__time32_t)fd.time_write;
+    _fdata->size        = fd.size;
+    wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
+    return ret;
+}
+
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindfirst64i32(const wchar_t* _filename, struct _wfinddata64i32_t* _fdata) {
+    struct _wfinddata32_t fd;
+    intptr_t ret = _wfindfirst32(_filename, &fd);
+    if (ret == -1) {
+        memset(_fdata, 0, sizeof(struct _wfinddata32_t));
+        return ret;
+    }
+    _fdata->attrib = fd.attrib;
+    _fdata->time_create = (__time64_t)fd.time_create;
+    _fdata->time_access = (__time64_t)fd.time_access;
+    _fdata->time_write  = (__time64_t)fd.time_write;
+    _fdata->size        = fd.size;
+    wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
+    return ret;
+}
+
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext32i64(intptr_t _fp, struct _wfinddata32i64_t* _fdata) {
+    struct _wfinddata64_t fd;
+    int ret = _wfindnext64(_fp,&fd);
+    if (ret == -1) {
+      memset(_fdata, 0, sizeof(struct _wfinddata32i64_t));
+      return ret;
+    }
+    _fdata->attrib = fd.attrib;
+    _fdata->time_create = (__time32_t)fd.time_create;
+    _fdata->time_access = (__time32_t)fd.time_access;
+    _fdata->time_write  = (__time32_t)fd.time_write;
+    _fdata->size        = fd.size;
+    wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
+    return ret;
+}
+
+__CRT_MAYBE_INLINE __cdecl __MINGW_NOTHROW intptr_t _wfindnext64i32(intptr_t _fp, struct _wfinddata64i32_t* _fdata) {
+    struct _wfinddata32_t fd;
+    int ret = _wfindnext32(_fp, &fd);
+    if (ret == -1) {
+      memset(_fdata, 0, sizeof(struct _wfinddata64i32_t));
+      return ret;
+    }
+    _fdata->attrib = fd.attrib;
+    _fdata->time_create = (__time64_t)fd.time_create;
+    _fdata->time_access = (__time64_t)fd.time_access;
+    _fdata->time_write  = (__time64_t)fd.time_write;
+    _fdata->size        = fd.size;
+    wcsncpy(_fdata->name, fd.name, FILENAME_MAX);
+    return ret;
+}
+
 #if defined(_USE_32BIT_TIME_T)
 #define _wfinddata_t _wfinddata32_t
 #define _wfinddatai64_t _wfinddata32i64_t