diff --git a/src/openalpr/support/re2/re2.cc b/src/openalpr/support/re2/re2.cc index aea5f6e..3f0020f 100644 --- a/src/openalpr/support/re2/re2.cc +++ b/src/openalpr/support/re2/re2.cc @@ -36,7 +36,7 @@ const VariadicFunction2 const VariadicFunction2 RE2::FindAndConsume = {}; // This will trigger LNK2005 error in MSVC. -#ifndef COMPILER_MSVC +#ifndef WIN32 const int RE2::Options::kDefaultMaxMem; // initialized in re2.h #endif // COMPILER_MSVC diff --git a/src/openalpr/support/re2/util/stringprintf.cc b/src/openalpr/support/re2/util/stringprintf.cc index 3c9c14b..5f1869f 100644 --- a/src/openalpr/support/re2/util/stringprintf.cc +++ b/src/openalpr/support/re2/util/stringprintf.cc @@ -14,7 +14,12 @@ static void StringAppendV(string* dst, const char* format, va_list ap) { // the data in it upon use. The fix is to make a copy // of the structure before using it and use that copy instead. va_list backup_ap; + + #if defined(WIN32) + backup_ap = ap; + #else va_copy(backup_ap, ap); + #endif int result = vsnprintf(space, sizeof(space), format, backup_ap); va_end(backup_ap); @@ -37,7 +42,12 @@ static void StringAppendV(string* dst, const char* format, va_list ap) { char* buf = new char[length]; // Restore the va_list before we use it again + #if defined(WIN32) + va_list backup_ap = ap; + #else va_copy(backup_ap, ap); + #endif + #ifdef WIN32 result = vsnprintf_s(buf, length, length, format, backup_ap); #else diff --git a/src/openalpr/support/timing.h b/src/openalpr/support/timing.h index 9a022e6..13b8761 100644 --- a/src/openalpr/support/timing.h +++ b/src/openalpr/support/timing.h @@ -1,12 +1,22 @@ -#ifndef TIMING_H -#define TIMING_H +#ifndef OPENALPR_TIMING_H +#define OPENALPR_TIMING_H #include #include #include +#if WINDOWS +struct timespec +{ + time_t tv_sec; // Seconds - >= 0 + long tv_usec; // Nanoseconds - [0, 999999999] +}; +#endif + #ifdef WINDOWS // Import windows only stuff + #include + #else #include #endif @@ -17,13 +27,6 @@ #include #endif -// Support for Windows -#ifdef WINDOWS -#include - -#define timespec timeval -#endif - namespace alpr {