• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

The MinGW.org Windows System Libraries


Commit MetaInfo

Revisiond4a74a9c3f2752d7cf6c35180f3672501f6b91a2 (tree)
Time2013-06-17 03:23:18
AuthorEarnie Boyd <earnie@user...>
CommiterEarnie Boyd

Log Message

Correct malformations and missed definitions to finish _USE_32BIT_TIME_T coding.

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -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+
126 2013-06-07 Earnie Boyd <earnie@users.sourceforge.net>
227
328 * include/_mingw.h (_CRTALIAS): Add comments explaining its purpose.
--- a/include/_mingw.h
+++ b/include/_mingw.h
@@ -29,7 +29,9 @@
2929 */
3030 #ifndef __MINGW_H
3131 #define __MINGW_H
32+#ifndef __CRT_TESTING__
3233 #pragma GCC system_header
34+#endif
3335 #include <sdkddkver.h>
3436
3537 #define __MINGW_VERSION 4.0
--- a/include/string.h
+++ b/include/string.h
@@ -8,11 +8,11 @@
88 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
99 * and/or sell copies of the Software, and to permit persons to whom the
1010 * Software is furnished to do so, subject to the following conditions:
11- *
11+ *
1212 * The above copyright notice and this permission notice (including the next
1313 * paragraph) shall be included in all copies or substantial portions of the
1414 * Software.
15- *
15+ *
1616 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -23,7 +23,9 @@
2323 */
2424 #ifndef _STRING_H
2525 #define _STRING_H
26+#ifndef __CRT_TESTING__
2627 #pragma GCC system_header
28+#endif
2729 #include <_mingw.h>
2830
2931 /*
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -23,7 +23,9 @@
2323 */
2424 #ifndef _STAT_H_
2525 #define _STAT_H_
26+#ifndef __CRT_TESTING__
2627 #pragma GCC system_header
28+#endif
2729 #include <_mingw.h>
2830
2931 #define __need_size_t
@@ -33,6 +35,7 @@
3335 #endif /* Not RC_INVOKED */
3436
3537 #include <sys/types.h>
38+#include <string.h> /* Need memset declaration */
3639
3740 /*
3841 * Constants for the stat st_mode member.
@@ -86,6 +89,10 @@
8689
8790 #ifndef RC_INVOKED
8891
92+#ifdef __cplusplus
93+extern "C" {
94+#endif
95+
8996 #ifndef _STAT_DEFINED
9097 /*
9198 * The structure manipulated and returned by stat and fstat.
@@ -170,10 +177,6 @@ struct _stat64i32 {
170177 __time64_t st_ctime;
171178 };
172179
173-#ifdef __cplusplus
174-extern "C" {
175-#endif
176-
177180 /* _stat32 does not exist in MSVCRT.DLL */
178181 _CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat32*);
179182 _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) {
193196 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct _stat64*);
194197 int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*);
195198 int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*);
196-#include <string.h> /* Need memset declaration */
199+
197200 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) {
198201 struct _stat64 st;
199202 int ret = _fstat64(desc, &st);
@@ -214,8 +217,7 @@ __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) {
214217 _stat->st_ctime = st.st_ctime;
215218 return ret;
216219 }
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) {
219221 struct _stat32 st;
220222 int ret = _fstat32(desc, &st);
221223 if (ret == -1) {
@@ -235,8 +237,7 @@ __CRT_MAYBE_INLINE int __cdecl _fstat32i64(int desc, struct _stat32i64 *_stat)
235237 _stat->st_ctime = st.st_ctime;
236238 return ret;
237239 }
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) {
240241 struct _stat64 st;
241242 int ret = _stat64(fname, &st);
242243 if (ret == -1) {
@@ -256,8 +257,7 @@ __CRT_MAYBE_INLINE int __cdecl _stat64i32(const char *fname, struct _stat64i32 *
256257 _stat->st_ctime = st.st_ctime;
257258 return ret;
258259 }
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) {
261261 struct _stat32 st;
262262 int ret = _stat32(fname, &st);
263263 if (ret == -1) {
@@ -303,17 +303,15 @@ __CRT_MAYBE_INLINE int __cdecl _stat32i64(const char *fname, struct _stat32i64 *
303303
304304 #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */
305305 /* _wstat32 does not exist in MSVCRT.DLL */
306+_CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat32*);
306307 _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*);
308308 return _wstat(_v1, _v2);
309309 }
310310
311311 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*);
312312 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*);
313313 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) {
317315 struct _stat64 st;
318316 int ret = _wstat64(fname, &st);
319317 if (ret == -1) {
@@ -333,8 +331,7 @@ __CRT_MAYBE_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i
333331 _stat->st_ctime = st.st_ctime;
334332 return ret;
335333 }
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) {
338335 struct _stat32 st;
339336 int ret = _wstat32(fname, &st);
340337 if (ret == -1) {
@@ -359,14 +356,15 @@ __CRT_MAYBE_INLINE int __cdecl _wstat32i64(const wchar_t *fname, struct _stat32i
359356 #define _wstat _wstat32
360357 #define _wstati64 _wstat32i64
361358
362-#else /* !_USE_32BIT_TIME_T */
359+#else /* ! _USE_32BIT_TIME_T */
363360 #define _wstat _wstat64i32
364361 #define _wstati64 _wstat64
365362
366363 #endif /* _USE_32BIT_TIME_T */
367364
368365 #define _WSTAT_DEFINED
369-#endif /* _WSTAT_DEFIND */
366+#endif /* ! _WSTAT_DEFIND */
367+
370368
371369 #ifdef __cplusplus
372370 }
--- a/include/sys/utime.h
+++ b/include/sys/utime.h
@@ -74,14 +74,6 @@ struct utimbuf32
7474 extern "C" {
7575 #endif
7676
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-
8577 _CRTIMP int __cdecl __MINGW_NOTHROW _utime64 (const char*, struct __utimbuf64*);
8678 _CRTIMP int __cdecl __MINGW_NOTHROW _futime64 (int, struct __utimbuf64*);
8779
@@ -92,16 +84,27 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _futime32 (int, struct __utimbuf32*);
9284 #else
9385 _CRTIMP int __cdecl __MINGW_NOTHROW _utime (const char*, struct _utimbuf*);
9486 _CRTALIAS int __cdecl __MINGW_NOTHROW _utime32 (const char* _v1, struct __utimbuf32* _v2) {
95- return _utime(_v1, _v2);
87+ return _utime(_v1, (struct _utimbuf*)_v2);
9688 }
9789
9890 _CRTIMP int __cdecl __MINGW_NOTHROW _futime (int, struct _utimbuf*);
9991 _CRTALIAS int __cdecl __MINGW_NOTHROW _futime32 (int _v1, struct __utimbuf32* _v2) {
100- return _futime(_v1, _v2);
92+ return _futime(_v1, (struct _utimbuf*)_v2);
10193 }
10294
10395 #endif
10496
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+
105108 #ifndef _USE_32BIT_TIME_T
106109 _CRTALIAS int __cdecl __MINGW_NOTHROW _utime (const char* _v1, struct _utimbuf* _v2) {
107110 return(_utime64 (_v1,(struct __utimbuf64*)_v2));
@@ -130,7 +133,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t*, struct __utimbuf3
130133 #else /* MSVCRT_VERSION < 800 */
131134 _CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*);
132135 _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);
134137 }
135138
136139 #endif /* MSVCRT_VERSION >= 800 */
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -23,7 +23,9 @@
2323 */
2424 #ifndef _WCHAR_H_
2525 #define _WCHAR_H_
26+#ifndef __CRT_TESTING__
2627 #pragma GCC system_header
28+#endif
2729 #include <_mingw.h>
2830
2931 #ifndef RC_INVOKED
@@ -38,7 +40,7 @@
3840 #define __need___va_list
3941 #include <stdarg.h>
4042 #define __VALIST __builtin_va_list
41-#endif
43+#endif /* ndef __VALIST */
4244
4345 #endif /* Not RC_INVOKED */
4446
@@ -57,6 +59,10 @@
5759 #define WEOF (wchar_t)(0xFFFF)
5860 #endif
5961
62+#ifndef FILENAME_MAX
63+#define FILENAME_MAX 260
64+#endif
65+
6066 #ifndef RC_INVOKED
6167
6268 #ifdef __cplusplus
@@ -243,13 +249,12 @@ _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t* _v1) {
243249 #endif /* MSVCRT_VERSION >= 800 */
244250
245251 #if MSVCRT_VERSION >= 800
246-#if defined(_USE_32BIT_TIME_T)
252+#ifdef _USE_32BIT_TIME_T
247253 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime32 (_v)); }
248254
249-#else /* MSVCRT_VERSION < 800 */
255+#else /* ! _USE_32BIT_TIME_T */
250256 _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 */
253258
254259 #else /* MSVCRT_VERSION < 800 */
255260 #ifdef _USE_32BIT_TIME_T
@@ -272,7 +277,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wutime32 (const wchar_t*, struct __utimbuf3
272277 #else /* MSVCRT_VERSION < 800 */
273278 _CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*);
274279 _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);
276281 }
277282
278283 #endif /* MSVCRT_VERSION >= 800 */
@@ -341,11 +346,9 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*);
341346 #ifndef _NO_OLDNAMES
342347 /* NOTE: There is no _wcscmpi, but this is for compatibility. */
343348 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
346350 wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2)
347351 {return _wcsicmp (__ws1, __ws2);}
348-#endif
349352 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*);
350353 _CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*);
351354 _CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*);
@@ -427,7 +430,7 @@ struct _wfinddata_t {
427430 time_t time_access; /* -1 for FAT file systems */
428431 time_t time_write;
429432 _fsize_t size;
430- wchar_t name[260]; /* may include spaces. */
433+ wchar_t name[FILENAME_MAX]; /* may include spaces. */
431434 };
432435 struct _wfinddatai64_t {
433436 unsigned attrib;
@@ -435,7 +438,7 @@ struct _wfinddatai64_t {
435438 time_t time_access;
436439 time_t time_write;
437440 __int64 size;
438- wchar_t name[260];
441+ wchar_t name[FILENAME_MAX];
439442 };
440443 struct _wfinddata64_t {
441444 unsigned attrib;
@@ -444,9 +447,8 @@ struct _wfinddata64_t {
444447 __time64_t time_write;
445448 /* 8 bytes are returned so it can't be _fsize_t */
446449 __int64 size;
447- wchar_t name[260];
450+ wchar_t name[FILENAME_MAX];
448451 };
449-#include <stdio.h>
450452 struct _wfinddata32_t {
451453 unsigned attrib;
452454 __time32_t time_create;
@@ -514,7 +516,7 @@ _CRTALIAS int __cdecl __MINGW_NOTHROW _wfindnext32 (intptr_t _v1, struct _wfind
514516 #define _wfindfirsti64 _wfindfirst32i64
515517 #define _wfindnexti64 _wfindnext32i64
516518
517-#else /* !defined(_USE_32BIT_TIME_T)
519+#else /* !defined(_USE_32BIT_TIME_T) */
518520 #define _wfinddata_t _wfinddata64i32_t
519521 #define _wfinddatai64_t _wfinddata64_t
520522 #define _wfindfirst _wfindfirst64i32
@@ -621,28 +623,32 @@ struct _stat64i32 {
621623 };
622624
623625 #define __stat64 _stat64
624-#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800
626+#if defined(_USE_32BIT_TIME_T)
625627 #define _fstat _fstat32
626628 #define _fstati64 _fstat32i64
627629 #define _stat _stat32
628630 #define _stati64 _stat32i64
629-#else /* !_USE_32BIT_TIME_T */
631+#else /* ! _USE_32BIT_TIME_T */
630632 #define _fstat _fstat64i32
631633 #define _fstati64 _fstat64
632634 #define _stat _stat64i32
633635 #define _stati64 _stat64
634636 #endif /* _USE_32BIT_TIME_T */
635637 #define _STAT_DEFINED
636-#endif /* _STAT_DEFINED */
638+#endif /* ! _STAT_DEFINED */
637639
638640 #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+
640647 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*);
641648 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*);
642649 int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*);
643-#ifndef __NO_INLINE__
644650 #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)
646652 {
647653 struct _stat64 st;
648654 int ret = _wstat64(fname, &st);
@@ -662,16 +668,33 @@ int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*);
662668 _stat->st_mtime = st.st_mtime;
663669 _stat->st_ctime = st.st_ctime;
664670 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;
665678 }
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+}
669692
670-#if defined(_USE_32BIT_TIME_T) && MSVCRT_VERSION >= 800
693+#if defined(_USE_32BIT_TIME_T)
671694 #define _wstat _wstat32
672695 #define _wstati64 _wstat32i64
673-#else
674696
697+#else /* ! _USE_32BIT_TIME_T */
675698 #define _wstat _wstat64i32
676699 #define _wstati64 _wstat64
677700 #endif /* _USE_32BIT_TIME_T */