view Resources/Patches/glog-port-h.diff @ 1112:a119f9ae3640

upgrade to Mongoose 3.8
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Sep 2014 12:20:26 +0200
parents 5bae1ac18ded
children
line wrap: on
line source

--- /tmp/m/glog-0.3.2/src/windows/port.h	2012-10-03 12:54:10.958149861 +0200
+++ port.h	2012-10-03 16:19:56.721837994 +0200
@@ -129,6 +129,27 @@
 #define pthread_self  GetCurrentThreadId
 #define pthread_equal(pthread_t_1, pthread_t_2)  ((pthread_t_1)==(pthread_t_2))
 
+#if defined(__MINGW32__)
+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
+
 inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
   localtime_s(result, timep);
   return result;