view Resources/Patches/glog-port-h-v2.diff @ 1500:a11281698db9

downcase
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Aug 2015 16:50:38 +0200
parents 0d9812893262
children
line wrap: on
line source

124,130c124,146
< // ----------------------------------- THREADS
< typedef DWORD pthread_t;
< typedef DWORD pthread_key_t;
< typedef LONG pthread_once_t;
< enum { PTHREAD_ONCE_INIT = 0 };   // important that this be 0! for SpinLock
< #define pthread_self  GetCurrentThreadId
< #define pthread_equal(pthread_t_1, pthread_t_2)  ((pthread_t_1)==(pthread_t_2))
---
> // ----------------------------------- SECURE STRINGS
> 
> #if HAVE_SECURE_STRING_EXTENSIONS == 0
> // Emulation of "localtime_s" and "strerror_s" for old versions of MinGW
> inline int localtime_s(tm * _tm, const time_t * time)
> {
>   tm * posix_local_time_struct = localtime(time);
>   if (posix_local_time_struct == NULL) 
>   {
>     return 1;
>   }
> 
>   *_tm = *posix_local_time_struct;
> 
>   return 0;
> }
> 
> inline char* strerror_s(char* buf, size_t buflen, int errnum) 
> {
>   const char* str = strerror(errnum);
>   return strncpy(buf, str, buflen - 1);
> }
> #endif
131a148,149
> 
> #if !defined(__MINGW32__) || HAVE_SECURE_STRING_EXTENSIONS == 0
135a154,155
> #endif
> 
140a161,173
> 
> 
> // ----------------------------------- THREADS
> 
> #if !defined(__MINGW32__) || HAVE_WIN_PTHREAD == 0
> typedef DWORD pthread_t;
> typedef DWORD pthread_key_t;
> typedef LONG pthread_once_t;
> enum { PTHREAD_ONCE_INIT = 0 };   // important that this be 0! for SpinLock
> #define pthread_self  GetCurrentThreadId
> #define pthread_equal(pthread_t_1, pthread_t_2)  ((pthread_t_1)==(pthread_t_2))
> #endif
>