The MinGW.org Windows System Libraries
Revision | d4a74a9c3f2752d7cf6c35180f3672501f6b91a2 (tree) |
---|---|
Time | 2013-06-17 03:23:18 |
Author | Earnie Boyd <earnie@user...> |
Commiter | Earnie Boyd |
Correct malformations and missed definitions to finish _USE_32BIT_TIME_T coding.
@@ -1,3 +1,28 @@ | ||
1 | +2013-06-16 Earnie Boyd <earnie@users.sourceforge.net> | |
2 | + | |
3 | + * include/_mingw.h (GCC system_header): Add a __CRT_TESTING__ filter. | |
4 | + * include/string.h (GCC system_header): Ditto. | |
5 | + * include/sys/stat.h (GCC system_header): Ditto. | |
6 | + (string.h): Move the include toward the top of the file. | |
7 | + (extern "C" {): Move above the filters so that it is not incorrectly | |
8 | + conditional. | |
9 | + Correct some comments and move the opening brace to the function | |
10 | + definition line throughout. | |
11 | + * include/sys/utime.h (utime): Move declaration to after the declaration | |
12 | + of _utime64(). Create a _CRTALIAS when _USE_32BIT_TIME_T is undefined. | |
13 | + Add datatype specifiers within the _CRTALIAS definitions throughout. | |
14 | + * include/wchar.h (GCC system_header): Add a __CRT_TESTING__ filter. | |
15 | + (FILENAME_MAX): Define macro if not already defined. | |
16 | + Correct comments throughout. | |
17 | + Correct #if...#endif misaligned pair. | |
18 | + (wcsicmp): Use _CRTALIAS instead of __CRT_INLINE since it is a one line | |
19 | + function definition. | |
20 | + (*wfinddata*): Use FILENAME_MAX throughout. | |
21 | + (_wstat32): Make a _CRTALIAS rather than a _CRTIMP. | |
22 | + (_wstat64i32): Use __CRT_MAYBE_INLINE instead of __CRT_INLINE. | |
23 | + (_wstat32i64): Define. | |
24 | + (_wstat, _wstati64): Remove the MSVCRT_VERSION >= 800 filter. | |
25 | + | |
1 | 26 | 2013-06-07 Earnie Boyd <earnie@users.sourceforge.net> |
2 | 27 | |
3 | 28 | * include/_mingw.h (_CRTALIAS): Add comments explaining its purpose. |
@@ -29,7 +29,9 @@ | ||
29 | 29 | */ |
30 | 30 | #ifndef __MINGW_H |
31 | 31 | #define __MINGW_H |
32 | +#ifndef __CRT_TESTING__ | |
32 | 33 | #pragma GCC system_header |
34 | +#endif | |
33 | 35 | #include <sdkddkver.h> |
34 | 36 | |
35 | 37 | #define __MINGW_VERSION 4.0 |
@@ -8,11 +8,11 @@ | ||
8 | 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
9 | 9 | * and/or sell copies of the Software, and to permit persons to whom the |
10 | 10 | * Software is furnished to do so, subject to the following conditions: |
11 | - * | |
11 | + * | |
12 | 12 | * The above copyright notice and this permission notice (including the next |
13 | 13 | * paragraph) shall be included in all copies or substantial portions of the |
14 | 14 | * Software. |
15 | - * | |
15 | + * | |
16 | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
@@ -23,7 +23,9 @@ | ||
23 | 23 | */ |
24 | 24 | #ifndef _STRING_H |
25 | 25 | #define _STRING_H |
26 | +#ifndef __CRT_TESTING__ | |
26 | 27 | #pragma GCC system_header |
28 | +#endif | |
27 | 29 | #include <_mingw.h> |
28 | 30 | |
29 | 31 | /* |
@@ -23,7 +23,9 @@ | ||
23 | 23 | */ |
24 | 24 | #ifndef _STAT_H_ |
25 | 25 | #define _STAT_H_ |
26 | +#ifndef __CRT_TESTING__ | |
26 | 27 | #pragma GCC system_header |
28 | +#endif | |
27 | 29 | #include <_mingw.h> |
28 | 30 | |
29 | 31 | #define __need_size_t |
@@ -33,6 +35,7 @@ | ||
33 | 35 | #endif /* Not RC_INVOKED */ |
34 | 36 | |
35 | 37 | #include <sys/types.h> |
38 | +#include <string.h> /* Need memset declaration */ | |
36 | 39 | |
37 | 40 | /* |
38 | 41 | * Constants for the stat st_mode member. |
@@ -86,6 +89,10 @@ | ||
86 | 89 | |
87 | 90 | #ifndef RC_INVOKED |
88 | 91 | |
92 | +#ifdef __cplusplus | |
93 | +extern "C" { | |
94 | +#endif | |
95 | + | |
89 | 96 | #ifndef _STAT_DEFINED |
90 | 97 | /* |
91 | 98 | * The structure manipulated and returned by stat and fstat. |
@@ -170,10 +177,6 @@ struct _stat64i32 { | ||
170 | 177 | __time64_t st_ctime; |
171 | 178 | }; |
172 | 179 | |
173 | -#ifdef __cplusplus | |
174 | -extern "C" { | |
175 | -#endif | |
176 | - | |
177 | 180 | /* _stat32 does not exist in MSVCRT.DLL */ |
178 | 181 | _CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat32*); |
179 | 182 | _CRTALIAS int __cdecl __MINGW_NOTHROW _stat32 (const char* _v1, struct _stat32* _v2) { |
@@ -193,7 +196,7 @@ _CRTALIAS int __cdecl __MINGW_NOTHROW _fstat32 (int _v1, struct _stat32* _v2) { | ||
193 | 196 | _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct _stat64*); |
194 | 197 | int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*); |
195 | 198 | int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); |
196 | -#include <string.h> /* Need memset declaration */ | |
199 | + | |
197 | 200 | __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) { |
198 | 201 | struct _stat64 st; |
199 | 202 | int ret = _fstat64(desc, &st); |
@@ -214,8 +217,7 @@ __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) { | ||
214 | 217 | _stat->st_ctime = st.st_ctime; |
215 | 218 | return ret; |
216 | 219 | } |
217 | -__CRT_MAYBE_INLINE int __cdecl _fstat32i64(int desc, struct _stat32i64 *_stat) | |
218 | -{ | |
220 | +__CRT_MAYBE_INLINE int __cdecl _fstat32i64(int desc, struct _stat32i64 *_stat) { | |
219 | 221 | struct _stat32 st; |
220 | 222 | int ret = _fstat32(desc, &st); |
221 | 223 | if (ret == -1) { |
@@ -235,8 +237,7 @@ __CRT_MAYBE_INLINE int __cdecl _fstat32i64(int desc, struct _stat32i64 *_stat) | ||
235 | 237 | _stat->st_ctime = st.st_ctime; |
236 | 238 | return ret; |
237 | 239 | } |
238 | -__CRT_MAYBE_INLINE int __cdecl _stat64i32(const char *fname, struct _stat64i32 *_stat) | |
239 | -{ | |
240 | +__CRT_MAYBE_INLINE int __cdecl _stat64i32(const char *fname, struct _stat64i32 *_stat) { | |
240 | 241 | struct _stat64 st; |
241 | 242 | int ret = _stat64(fname, &st); |
242 | 243 | if (ret == -1) { |
@@ -256,8 +257,7 @@ __CRT_MAYBE_INLINE int __cdecl _stat64i32(const char *fname, struct _stat64i32 * | ||
256 | 257 | _stat->st_ctime = st.st_ctime; |
257 | 258 | return ret; |
258 | 259 | } |
259 | -__CRT_MAYBE_INLINE int __cdecl _stat32i64(const char *fname, struct _stat32i64 *_stat) | |
260 | -{ | |
260 | +__CRT_MAYBE_INLINE int __cdecl _stat32i64(const char *fname, struct _stat32i64 *_stat) { | |
261 | 261 | struct _stat32 st; |
262 | 262 | int ret = _stat32(fname, &st); |
263 | 263 | if (ret == -1) { |
@@ -303,17 +303,15 @@ __CRT_MAYBE_INLINE int __cdecl _stat32i64(const char *fname, struct _stat32i64 * | ||
303 | 303 | |
304 | 304 | #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ |
305 | 305 | /* _wstat32 does not exist in MSVCRT.DLL */ |
306 | +_CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat32*); | |
306 | 307 | _CRTALIAS int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t* _v1, struct _stat32* _v2) { |
307 | - _CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat32*); | |
308 | 308 | return _wstat(_v1, _v2); |
309 | 309 | } |
310 | 310 | |
311 | 311 | _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*); |
312 | 312 | _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*); |
313 | 313 | int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); |
314 | -#include <string.h> /* Need memset declaration */ | |
315 | -__CRT_MAYBE_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat) | |
316 | -{ | |
314 | +__CRT_MAYBE_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat) { | |
317 | 315 | struct _stat64 st; |
318 | 316 | int ret = _wstat64(fname, &st); |
319 | 317 | if (ret == -1) { |
@@ -333,8 +331,7 @@ __CRT_MAYBE_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i | ||
333 | 331 | _stat->st_ctime = st.st_ctime; |
334 | 332 | return ret; |
335 | 333 | } |
336 | -__CRT_MAYBE_INLINE int __cdecl _wstat32i64(const wchar_t *fname, struct _stat32i64 *_stat) | |
337 | -{ | |
334 | +__CRT_MAYBE_INLINE int __cdecl _wstat32i64(const wchar_t *fname, struct _stat32i64 *_stat) { | |
338 | 335 | struct _stat32 st; |
339 | 336 | int ret = _wstat32(fname, &st); |
340 | 337 | if (ret == -1) { |
@@ -359,14 +356,15 @@ __CRT_MAYBE_INLINE int __cdecl _wstat32i64(const wchar_t *fname, struct _stat32i | ||
359 | 356 | #define _wstat _wstat32 |
360 | 357 | #define _wstati64 _wstat32i64 |
361 | 358 | |
362 | -#else /* !_USE_32BIT_TIME_T */ | |
359 | +#else /* ! _USE_32BIT_TIME_T */ | |
363 | 360 | #define _wstat _wstat64i32 |
364 | 361 | #define _wstati64 _wstat64 |
365 | 362 | |
366 | 363 | #endif /* _USE_32BIT_TIME_T */ |
367 | 364 | |
368 | 365 | #define _WSTAT_DEFINED |
369 | -#endif /* _WSTAT_DEFIND */ | |
366 | +#endif /* ! _WSTAT_DEFIND */ | |
367 | + | |
370 | 368 | |
371 | 369 | #ifdef __cplusplus |
372 | 370 | } |
@@ -74,14 +74,6 @@ struct utimbuf32 | ||
74 | 74 | extern "C" { |
75 | 75 | #endif |
76 | 76 | |
77 | -#ifndef _NO_OLDNAMES | |
78 | -#ifdef _USE_32BIT_TIME_T | |
79 | -_CRTIMP int __cdecl __MINGW_NOTHROW utime (const char*, struct utimbuf*); | |
80 | -#else | |
81 | -#define utime _utime | |
82 | -#endif | |
83 | -#endif /* Not _NO_OLDNAMES */ | |
84 | - | |
85 | 77 | _CRTIMP int __cdecl __MINGW_NOTHROW _utime64 (const char*, struct __utimbuf64*); |
86 | 78 | _CRTIMP int __cdecl __MINGW_NOTHROW _futime64 (int, struct __utimbuf64*); |
87 | 79 |
@@ -92,16 +84,27 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _futime32 (int, struct __utimbuf32*); | ||
92 | 84 | #else |
93 | 85 | _CRTIMP int __cdecl __MINGW_NOTHROW _utime (const char*, struct _utimbuf*); |
94 | 86 | _CRTALIAS int __cdecl __MINGW_NOTHROW _utime32 (const char* _v1, struct __utimbuf32* _v2) { |
95 | - return _utime(_v1, _v2); | |
87 | + return _utime(_v1, (struct _utimbuf*)_v2); | |
96 | 88 | } |
97 | 89 | |
98 | 90 | _CRTIMP int __cdecl __MINGW_NOTHROW _futime (int, struct _utimbuf*); |
99 | 91 | _CRTALIAS int __cdecl __MINGW_NOTHROW _futime32 (int _v1, struct __utimbuf32* _v2) { |
100 | - return _futime(_v1, _v2); | |
92 | + return _futime(_v1, (struct _utimbuf*)_v2); | |
101 | 93 | } |
102 | 94 | |
103 | 95 | #endif |
104 | 96 | |
97 | +#ifndef _NO_OLDNAMES | |
98 | +#ifdef _USE_32BIT_TIME_T | |
99 | +_CRTIMP int __cdecl __MINGW_NOTHROW utime (const char*, struct utimbuf*); | |
100 | +#else | |
101 | +int __cdecl __MINGW_NOTHROW utime (const char*, struct utimbuf*); | |
102 | +_CRTALIAS int __cdecl __MINGW_NOTHROW utime (const char* _v1, struct utimbuf* _v2) { | |
103 | + return _utime64(_v1, (struct __utimbuf64*)_v2); | |
104 | +} | |
105 | +#endif | |
106 | +#endif /* Not _NO_OLDNAMES */ | |
107 | + | |
105 | 108 | #ifndef _USE_32BIT_TIME_T |
106 | 109 | _CRTALIAS int __cdecl __MINGW_NOTHROW _utime (const char* _v1, struct _utimbuf* _v2) { |
107 | 110 | return(_utime64 (_v1,(struct __utimbuf64*)_v2)); |
@@ -130,7 +133,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t*, struct __utimbuf3 | ||
130 | 133 | #else /* MSVCRT_VERSION < 800 */ |
131 | 134 | _CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*); |
132 | 135 | _CRTALIAS int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t* _v1, struct __utimbuf32* _v2) { |
133 | - return _wutime(_v1, _v2); | |
136 | + return _wutime(_v1, (struct _utimbuf*)_v2); | |
134 | 137 | } |
135 | 138 | |
136 | 139 | #endif /* MSVCRT_VERSION >= 800 */ |
@@ -23,7 +23,9 @@ | ||
23 | 23 | */ |
24 | 24 | #ifndef _WCHAR_H_ |
25 | 25 | #define _WCHAR_H_ |
26 | +#ifndef __CRT_TESTING__ | |
26 | 27 | #pragma GCC system_header |
28 | +#endif | |
27 | 29 | #include <_mingw.h> |
28 | 30 | |
29 | 31 | #ifndef RC_INVOKED |
@@ -38,7 +40,7 @@ | ||
38 | 40 | #define __need___va_list |
39 | 41 | #include <stdarg.h> |
40 | 42 | #define __VALIST __builtin_va_list |
41 | -#endif | |
43 | +#endif /* ndef __VALIST */ | |
42 | 44 | |
43 | 45 | #endif /* Not RC_INVOKED */ |
44 | 46 |
@@ -57,6 +59,10 @@ | ||
57 | 59 | #define WEOF (wchar_t)(0xFFFF) |
58 | 60 | #endif |
59 | 61 | |
62 | +#ifndef FILENAME_MAX | |
63 | +#define FILENAME_MAX 260 | |
64 | +#endif | |
65 | + | |
60 | 66 | #ifndef RC_INVOKED |
61 | 67 | |
62 | 68 | #ifdef __cplusplus |
@@ -243,13 +249,12 @@ _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t* _v1) { | ||
243 | 249 | #endif /* MSVCRT_VERSION >= 800 */ |
244 | 250 | |
245 | 251 | #if MSVCRT_VERSION >= 800 |
246 | -#if defined(_USE_32BIT_TIME_T) | |
252 | +#ifdef _USE_32BIT_TIME_T | |
247 | 253 | _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime32 (_v)); } |
248 | 254 | |
249 | -#else /* MSVCRT_VERSION < 800 */ | |
255 | +#else /* ! _USE_32BIT_TIME_T */ | |
250 | 256 | _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime64 (_v)); } |
251 | -#endif /* defined(_USE_32BIT_TIME_T) */ | |
252 | -#endif /* MSVCRT_VERSION >= 800 */ | |
257 | +#endif /* _USE_32BIT_TIME_T */ | |
253 | 258 | |
254 | 259 | #else /* MSVCRT_VERSION < 800 */ |
255 | 260 | #ifdef _USE_32BIT_TIME_T |
@@ -272,7 +277,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t*, struct __utimbuf3 | ||
272 | 277 | #else /* MSVCRT_VERSION < 800 */ |
273 | 278 | _CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*); |
274 | 279 | _CRTALIAS int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t* _v1, struct __utimbuf32* _v2) { |
275 | - return _wutime(_v1, _v2); | |
280 | + return _wutime(_v1, (struct _utimbuf *)_v2); | |
276 | 281 | } |
277 | 282 | |
278 | 283 | #endif /* MSVCRT_VERSION >= 800 */ |
@@ -341,11 +346,9 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*); | ||
341 | 346 | #ifndef _NO_OLDNAMES |
342 | 347 | /* NOTE: There is no _wcscmpi, but this is for compatibility. */ |
343 | 348 | int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t *, const wchar_t *); |
344 | -#ifndef __NO_INLINE__ | |
345 | -__CRT_INLINE int __cdecl __MINGW_NOTHROW | |
349 | +_CRTALIAS int __cdecl __MINGW_NOTHROW | |
346 | 350 | wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) |
347 | 351 | {return _wcsicmp (__ws1, __ws2);} |
348 | -#endif | |
349 | 352 | _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*); |
350 | 353 | _CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*); |
351 | 354 | _CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*); |
@@ -427,7 +430,7 @@ struct _wfinddata_t { | ||
427 | 430 | time_t time_access; /* -1 for FAT file systems */ |
428 | 431 | time_t time_write; |
429 | 432 | _fsize_t size; |
430 | - wchar_t name[260]; /* may include spaces. */ | |
433 | + wchar_t name[FILENAME_MAX]; /* may include spaces. */ | |
431 | 434 | }; |
432 | 435 | struct _wfinddatai64_t { |
433 | 436 | unsigned attrib; |
@@ -435,7 +438,7 @@ struct _wfinddatai64_t { | ||
435 | 438 | time_t time_access; |
436 | 439 | time_t time_write; |
437 | 440 | __int64 size; |
438 | - wchar_t name[260]; | |
441 | + wchar_t name[FILENAME_MAX]; | |
439 | 442 | }; |
440 | 443 | struct _wfinddata64_t { |
441 | 444 | unsigned attrib; |
@@ -444,9 +447,8 @@ struct _wfinddata64_t { | ||
444 | 447 | __time64_t time_write; |
445 | 448 | /* 8 bytes are returned so it can't be _fsize_t */ |
446 | 449 | __int64 size; |
447 | - wchar_t name[260]; | |
450 | + wchar_t name[FILENAME_MAX]; | |
448 | 451 | }; |
449 | -#include <stdio.h> | |
450 | 452 | struct _wfinddata32_t { |
451 | 453 | unsigned attrib; |
452 | 454 | __time32_t time_create; |
@@ -514,7 +516,7 @@ _CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t _v1, struct _wfind | ||
514 | 516 | #define _wfindfirsti64 _wfindfirst32i64 |
515 | 517 | #define _wfindnexti64 _wfindnext32i64 |
516 | 518 | |
517 | -#else /* !defined(_USE_32BIT_TIME_T) | |
519 | +#else /* !defined(_USE_32BIT_TIME_T) */ | |
518 | 520 | #define _wfinddata_t _wfinddata64i32_t |
519 | 521 | #define _wfinddatai64_t _wfinddata64_t |
520 | 522 | #define _wfindfirst _wfindfirst64i32 |
@@ -621,28 +623,32 @@ struct _stat64i32 { | ||
621 | 623 | }; |
622 | 624 | |
623 | 625 | #define __stat64 _stat64 |
624 | -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 | |
626 | +#if defined(_USE_32BIT_TIME_T) | |
625 | 627 | #define _fstat _fstat32 |
626 | 628 | #define _fstati64 _fstat32i64 |
627 | 629 | #define _stat _stat32 |
628 | 630 | #define _stati64 _stat32i64 |
629 | -#else /* !_USE_32BIT_TIME_T */ | |
631 | +#else /* ! _USE_32BIT_TIME_T */ | |
630 | 632 | #define _fstat _fstat64i32 |
631 | 633 | #define _fstati64 _fstat64 |
632 | 634 | #define _stat _stat64i32 |
633 | 635 | #define _stati64 _stat64 |
634 | 636 | #endif /* _USE_32BIT_TIME_T */ |
635 | 637 | #define _STAT_DEFINED |
636 | -#endif /* _STAT_DEFINED */ | |
638 | +#endif /* ! _STAT_DEFINED */ | |
637 | 639 | |
638 | 640 | #if !defined ( _WSTAT_DEFINED) /* also declared in sys/stat.h */ |
639 | -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t*, struct _stat32*); | |
641 | +/* _wstat32 does not exist in MSVCRT.DLL */ | |
642 | +_CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat32*); | |
643 | +_CRTALIAS int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t* _v1, struct _stat32* _v2) { | |
644 | + return _wstat(_v1, _v2); | |
645 | +} | |
646 | + | |
640 | 647 | _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*); |
641 | 648 | _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*); |
642 | 649 | int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); |
643 | -#ifndef __NO_INLINE__ | |
644 | 650 | #include <string.h> /* Need memset declaration. */ |
645 | - __CRT_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat) | |
651 | +__CRT_MAYBE_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat) | |
646 | 652 | { |
647 | 653 | struct _stat64 st; |
648 | 654 | int ret = _wstat64(fname, &st); |
@@ -662,16 +668,33 @@ int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); | ||
662 | 668 | _stat->st_mtime = st.st_mtime; |
663 | 669 | _stat->st_ctime = st.st_ctime; |
664 | 670 | return ret; |
671 | +} | |
672 | +__CRT_MAYBE_INLINE int __cdecl _wstat32i64(const wchar_t *fname, struct _stat32i64 *_stat) { | |
673 | + struct _stat32 st; | |
674 | + int ret = _wstat32(fname, &st); | |
675 | + if (ret == -1) { | |
676 | + memset(_stat, 0, sizeof(struct _stat32i64)); | |
677 | + return -1; | |
665 | 678 | } |
666 | -#else | |
667 | -#define _wstat64i32 _wstat64 | |
668 | -#endif | |
679 | + _stat->st_dev = st.st_dev; | |
680 | + _stat->st_ino = st.st_ino; | |
681 | + _stat->st_mode = st.st_mode; | |
682 | + _stat->st_nlink = st.st_nlink; | |
683 | + _stat->st_uid = st.st_uid; | |
684 | + _stat->st_gid = st.st_gid; | |
685 | + _stat->st_rdev = st.st_rdev; | |
686 | + _stat->st_size = (_off_t) st.st_size; | |
687 | + _stat->st_atime = st.st_atime; | |
688 | + _stat->st_mtime = st.st_mtime; | |
689 | + _stat->st_ctime = st.st_ctime; | |
690 | + return ret; | |
691 | +} | |
669 | 692 | |
670 | -#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800 | |
693 | +#if defined(_USE_32BIT_TIME_T) | |
671 | 694 | #define _wstat _wstat32 |
672 | 695 | #define _wstati64 _wstat32i64 |
673 | -#else | |
674 | 696 | |
697 | +#else /* ! _USE_32BIT_TIME_T */ | |
675 | 698 | #define _wstat _wstat64i32 |
676 | 699 | #define _wstati64 _wstat64 |
677 | 700 | #endif /* _USE_32BIT_TIME_T */ |