[Mingw-w64-public] Mass rebuild report for January 03 2015
Jacek Caban
jacek at codeweavers.com
Tue Jan 6 12:26:04 UTC 2015
On 01/06/15 12:49, Kai Tietz wrote:
> 2015-01-06 12:22 GMT+01:00 Jacek Caban <jacek at codeweavers.com>:
>> On 01/05/15 21:58, Erik van Pienbroek wrote:
>>> Jacek Caban schreef op ma 05-01-2015 om 14:05 [+0100]:
>>>> On 01/04/15 12:49, Jacek Caban wrote:
>>>>> Maybe I missed some better options for us. None of above is perfect and
>>>>> I'm not sure what we should do about it. Solution 2. seems the least
>>>>> problematic.
>>>> Looking deeper at this, current implementation has one more problem. We
>>>> can't really have localtime_r, because it needs to depend on
>>>> _USE_32BIT_TIME_T macro. So if we really wanted to have a real function
>>>> in mingwex, we'd need it as localtime32_r and localtime64_r and an
>>>> inline wrapper. Given that, I think we should live with inline
>>>> implementation. Esp. since we may use localtime_s (which already has
>>>> wrapper inline as well as compatibility stub in libmsvcrt.a), which
>>>> makes the implementation trivial. Please review the attached patch. I
>>>> believe we should do the same for ctime_r and asctime_r.
>>> Hi Jacek,
>>>
>>> Thanks for the patch. I just tested it and I can confirm that it solves
>>> the localtime_r issue in glib2 and the gmtime_r issues in libgsf and
>>> libsoup.
>> Thanks for testing. Kai, what do you think, should I commit the patch?
> Sure. Patch is ok.
OK, committed.
>>> The cmtime_r issue in cairo is not resolved yet with this
>>> patch, but I guess this is expected for now.
>> Yeah, I may prepare a patch for that as well if we decided to go this way.
> This route makes sense IMO. So what are others thinking about it?
The attached patch implements that. Please review.
Thanks,
Jacek
-------------- next part --------------
commit b49ead84169c782a27140fca3cc10a175831985b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Jan 6 13:24:49 2015 +0100
time.h: Use inline functions for ctime_r and asctime_r implementations.
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 5fe8d51..b0ac2f2 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -271,7 +271,7 @@ src_libmingwex=\
misc/wcstoimax.c misc/wcstold.c misc/wcstoumax.c misc/wctob.c misc/wctrans.c \
misc/wctype.c misc/wdirent.c misc/winbs_uint64.c misc/winbs_ulong.c misc/winbs_ushort.c \
misc/wmemchr.c misc/wmemcmp.c misc/wmemcpy.c misc/wmemmove.c misc/wmempcpy.c \
- misc/wmemset.c misc/ftw.c misc/ftw64.c misc/time_r.c \
+ misc/wmemset.c misc/ftw.c misc/ftw64.c \
\
stdio/mingw_pformat.h \
stdio/vfscanf2.S stdio/vfwscanf2.S stdio/vscanf2.S stdio/vsscanf2.S stdio/vswscanf2.S \
diff --git a/mingw-w64-crt/misc/time_r.c b/mingw-w64-crt/misc/time_r.c
deleted file mode 100644
index 8850e31..0000000
--- a/mingw-w64-crt/misc/time_r.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-
-/* Both the 32-bit and 64-bit versions of gmtime, mktime, mkgmtime,
- * and localtime all use one common tm structure per thread for the
- * conversion. Each call to one of these functions destroys the
- * result of any previous call.
- */
-char *__cdecl ctime_r(const time_t *_Time, char * _Str)
-{
- char *tmp;
-
- if (_Time == NULL || _Str == NULL)
- {
- errno = EINVAL;
- return NULL;
- }
-
- tmp = ctime(_Time);
- if (tmp != NULL)
- tmp = strcpy(_Str,tmp);
- return tmp;
-}
-
- /* TODO: thread safe implementation */
-char *__cdecl asctime_r(const struct tm *_Tm, char * _Str)
-{
- char *tmp;
-
- if (_Tm == NULL || _Str == NULL)
- {
- errno = EINVAL;
- return NULL;
- }
-
- tmp = asctime(_Tm);
- if (tmp != NULL)
- tmp = strcpy(_Str,tmp);
-
- return tmp;
-}
diff --git a/mingw-w64-headers/crt/sec_api/time_s.h b/mingw-w64-headers/crt/sec_api/time_s.h
index a3f1eec..9352188 100644
--- a/mingw-w64-headers/crt/sec_api/time_s.h
+++ b/mingw-w64-headers/crt/sec_api/time_s.h
@@ -45,10 +45,12 @@ __CRT_INLINE errno_t __cdecl _wctime_s (wchar_t *_Buffer,size_t _SizeInWords,con
#ifdef _USE_32BIT_TIME_T
__forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); }
__forceinline errno_t __cdecl gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime32_s(_Tm, _Time); }
+__forceinline errno_t __cdecl _ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime32_s(_Buf,_SizeInBytes,_Time); }
#else
__forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); }
__forceinline errno_t __cdecl gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime64_s(_Tm, _Time); }
+__forceinline errno_t __cdecl _ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime64_s(_Buf,_SizeInBytes,_Time); }
#endif
#endif
diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index 6d415a7..65ddddc 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -232,8 +232,12 @@ __forceinline struct tm *__cdecl localtime_r(const time_t *_Time, struct tm *_Tm
__forceinline struct tm *__cdecl gmtime_r(const time_t *_Time, struct tm *_Tm) {
return gmtime_s(_Tm, _Time) ? NULL : _Tm;
}
-char *__cdecl ctime_r(const time_t *_Time, char * _Str);
-char *__cdecl asctime_r(const struct tm *_Tm, char * _Str);
+__forceinline char *__cdecl ctime_r(const time_t *_Time, char *_Str) {
+ return _ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str;
+}
+char *__cdecl asctime_r(const struct tm *_Tm, char * _Str) {
+ return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
+}
#endif /* _POSIX */
/* Adding timespec definition. */
More information about the mingw
mailing list