From 912f07b919c1ec44f0cdd5278d74a9bc29b91846 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 4 Mar 2014 15:25:58 +0100 Subject: mingw build fixes (tested with i686-w64-mingw32 on linux-x86_64) --- libs/pbd/pbd/localtime_r.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'libs/pbd/pbd/localtime_r.h') diff --git a/libs/pbd/pbd/localtime_r.h b/libs/pbd/pbd/localtime_r.h index ad5b89d134..1e810ec084 100644 --- a/libs/pbd/pbd/localtime_r.h +++ b/libs/pbd/pbd/localtime_r.h @@ -3,11 +3,22 @@ #include #ifdef COMPILER_MSVC - #define localtime_r( _clock, _result ) \ - ( *(_result) = *localtime( (_clock) ), \ - (_result) ) -#else - extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm); + +#define localtime_r( _clock, _result ) \ + ( *(_result) = *localtime( (_clock) ), (_result) ) + +#elif defined __MINGW64__ + +# ifdef (localtime_r) +# undef localtime_r +# endif + +// As in 64 bit time_t is 64 bit integer, compiler breaks compilation +// everytime implicit cast from long int* to time_t* worked in +// the past (32 bit). To unblock such a cast we added the localtime below: +extern struct tm *localtime(const long int *_Time); +extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm); + #endif #endif -- cgit v1.2.3