From 69ba4854152415ab3e2ec11cdb6f9c9ce5af9ac8 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Wed, 23 Jan 2013 02:21:26 -0500 Subject: Fix compile under MingW --- src/porting.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/porting.h') diff --git a/src/porting.h b/src/porting.h index 184e1ab54..c8d19154c 100644 --- a/src/porting.h +++ b/src/porting.h @@ -42,18 +42,26 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifdef _WIN32 #include - #define ALIGNOF(x) __alignof(x) #define sleep_ms(x) Sleep(x) +#else + #include + #include //for uintptr_t + + #define sleep_ms(x) usleep(x*1000) +#endif + +#ifdef _MSC_VER + #define ALIGNOF(x) __alignof(x) #define strtok_r(x, y, z) strtok_s(x, y, z) #define strtof(x, y) (float)strtod(x, y) #define strtoll(x, y, z) _strtoi64(x, y, z) #define strtoull(x, y, z) _strtoui64(x, y, z) #else - #include - #include //for uintptr_t - #define ALIGNOF(x) __alignof__(x) - #define sleep_ms(x) usleep(x*1000) +#endif + +#ifdef __MINGW32__ + #define strtok_r(x, y, z) mystrtok_r(x, y, z) #endif #define PADDING(x, y) ((ALIGNOF(y) - ((uintptr_t)(x) & (ALIGNOF(y) - 1))) & (ALIGNOF(y) - 1)) -- cgit v1.2.3