# HG changeset patch # User jodogne # Date 1349277292 -7200 # Node ID 5bae1ac18ded1e379fa73a62f91003b9fc7f5cd3 # Parent bb50d0eb4493b3105bb3bc95f7ea5dde0d56735a fixes diff -r bb50d0eb4493 -r 5bae1ac18ded Resources/CMake/GoogleLogConfiguration.cmake --- a/Resources/CMake/GoogleLogConfiguration.cmake Wed Oct 03 16:56:14 2012 +0200 +++ b/Resources/CMake/GoogleLogConfiguration.cmake Wed Oct 03 17:14:52 2012 +0200 @@ -12,7 +12,11 @@ WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src ) execute_process( - COMMAND patch port.h ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-port.diff + COMMAND patch port.h ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-port-h.diff + WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows + ) + execute_process( + COMMAND patch port.cc ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-port-cc.diff WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows ) endif() @@ -39,8 +43,8 @@ ) set(GOOGLE_LOG_SOURCES + ${GOOGLE_LOG_SOURCES_DIR}/src/windows/port.cc ${GOOGLE_LOG_SOURCES_DIR}/src/logging.cc - ${GOOGLE_LOG_SOURCES_DIR}/src/windows/port.cc ${GOOGLE_LOG_SOURCES_DIR}/src/raw_logging.cc ${GOOGLE_LOG_SOURCES_DIR}/src/utilities.cc ${GOOGLE_LOG_SOURCES_DIR}/src/vlog_is_on.cc diff -r bb50d0eb4493 -r 5bae1ac18ded Resources/Patches/glog-port-cc.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Patches/glog-port-cc.diff Wed Oct 03 17:14:52 2012 +0200 @@ -0,0 +1,15 @@ +--- i/glog-0.3.2/src/windows/port.cc 2011-08-30 09:56:13.000000000 +0200 ++++ port.cc 2012-10-03 17:11:54.000000000 +0200 +@@ -55,6 +55,7 @@ + return _vsnprintf(str, size-1, format, ap); + } + ++#if !defined(__MINGW32__) + int snprintf(char *str, size_t size, const char *format, ...) { + va_list ap; + va_start(ap, format); +@@ -62,3 +63,4 @@ + va_end(ap); + return r; + } ++#endif diff -r bb50d0eb4493 -r 5bae1ac18ded Resources/Patches/glog-port-h.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Patches/glog-port-h.diff Wed Oct 03 17:14:52 2012 +0200 @@ -0,0 +1,30 @@ +--- /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; diff -r bb50d0eb4493 -r 5bae1ac18ded Resources/Patches/glog-port.diff --- a/Resources/Patches/glog-port.diff Wed Oct 03 16:56:14 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ ---- /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;