diff --git a/src/openalpr/support/re2/re2.cc b/src/openalpr/support/re2/re2.cc index 28581b6..aea5f6e 100644 --- a/src/openalpr/support/re2/re2.cc +++ b/src/openalpr/support/re2/re2.cc @@ -11,7 +11,9 @@ #include #include +#ifndef WIN32 #include +#endif #include #include "util/atomicops.h" #include "util/util.h" diff --git a/src/openalpr/support/re2/util/mutex.h b/src/openalpr/support/re2/util/mutex.h index f64acb1..19a49d5 100644 --- a/src/openalpr/support/re2/util/mutex.h +++ b/src/openalpr/support/re2/util/mutex.h @@ -14,8 +14,10 @@ namespace re2 { -#define HAVE_PTHREAD 1 -#define HAVE_RWLOCK 1 +#ifndef WIN32 + #define HAVE_PTHREAD 1 + #define HAVE_RWLOCK 1 +#endif #if defined(NO_THREADS) typedef int MutexType; // to keep a lock-count diff --git a/src/openalpr/support/re2/util/stringprintf.cc b/src/openalpr/support/re2/util/stringprintf.cc index e15c550..3c9c14b 100644 --- a/src/openalpr/support/re2/util/stringprintf.cc +++ b/src/openalpr/support/re2/util/stringprintf.cc @@ -38,7 +38,11 @@ static void StringAppendV(string* dst, const char* format, va_list ap) { // Restore the va_list before we use it again va_copy(backup_ap, ap); - result = vsnprintf(buf, length, format, backup_ap); + #ifdef WIN32 + result = vsnprintf_s(buf, length, length, format, backup_ap); + #else + result = vsnprintf(buf, length, format, backup_ap); + #endif va_end(backup_ap); if ((result >= 0) && (result < length)) { diff --git a/src/openalpr/support/re2/util/strutil.cc b/src/openalpr/support/re2/util/strutil.cc index 74116ce..ab28df7 100644 --- a/src/openalpr/support/re2/util/strutil.cc +++ b/src/openalpr/support/re2/util/strutil.cc @@ -1,7 +1,7 @@ // Copyright 1999-2005 The RE2 Authors. All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. - +#include #include "re2/util/util.h" #include "re2/stringpiece.h" @@ -38,7 +38,12 @@ int CEscapeString(const char* src, int src_len, char* dest, if (c < ' ' || c > '~') { if (dest_len - used < 5) // space for four-character escape + \0 return -1; - sprintf(dest + used, "\\%03o", c); + #ifdef WIN32 + sprintf_s(dest + used, dest_len, "\\%03o", c); + #else + std::sprintf(dest + used, "\\%03o", c); + #endif + used += 4; } else { dest[used++] = c; break;