summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2013-02-06 22:32:42 +1100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-12 12:59:08 +0100
commit7370d84356ed4551ec1d72800666992817901b11 (patch)
tree85dcaa5e5ea557aa1379524f023d03cf65fc1934
parent1f8141e797bd5b4a318b052b7813bd76a8219f28 (diff)
downloadqtjsbackend-7370d84356ed4551ec1d72800666992817901b11.tar.gz
[v8] Do not rely on secure API functions when using MinGW-w64
Windows XP does not provide secure API functions in msvcrt.dll but newer versions of Windows do. Avoid using secure API functions for compatibility with msvcrt.dll on Windows XP. Upstream patches: - https://chromiumcodereview.appspot.com/12189010/ - https://chromiumcodereview.appspot.com/12210033/ Task-number: QTBUG-29306 Change-Id: I5bbd04dcb7bf46ad0246d120189b637a7d2e5422 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r--src/3rdparty/v8/src/platform-win32.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/3rdparty/v8/src/platform-win32.cc b/src/3rdparty/v8/src/platform-win32.cc
index 2473949..ba57803 100644
--- a/src/3rdparty/v8/src/platform-win32.cc
+++ b/src/3rdparty/v8/src/platform-win32.cc
@@ -27,6 +27,17 @@
// Platform specific code for Win32.
+// Secure API functions are not available using MinGW with msvcrt.dll
+// on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to
+// disable definition of secure API functions in standard headers that
+// would conflict with our own implementation.
+#ifdef __MINGW32__
+#include <_mingw.h>
+#ifdef MINGW_HAS_SECURE_API
+#undef MINGW_HAS_SECURE_API
+#endif // MINGW_HAS_SECURE_API
+#endif // __MINGW32__
+
#define V8_WIN32_HEADERS_FULL
#include "win32-headers.h"
@@ -65,8 +76,6 @@ inline void MemoryBarrier() {
#endif // __MINGW64_VERSION_MAJOR
-#ifndef MINGW_HAS_SECURE_API
-
int localtime_s(tm* out_tm, const time_t* time) {
tm* posix_local_time_struct = localtime(time);
if (posix_local_time_struct == NULL) return 1;
@@ -113,8 +122,6 @@ int strncpy_s(char* dest, size_t dest_size, const char* source, size_t count) {
return 0;
}
-#endif // MINGW_HAS_SECURE_API
-
#endif // __MINGW32__
// Generate a pseudo-random number in the range 0-2^31-1. Usually
@@ -201,7 +208,7 @@ UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN))
UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG))
UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction())
-#undef MATH_FUNCTION
+#undef UNARY_MATH_FUNCTION
void MathSetup() {
@@ -798,6 +805,9 @@ void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) {
}
+#undef _TRUNCATE
+#undef STRUNCATE
+
// We keep the lowest and highest addresses mapped as a quick way of
// determining that pointers are outside the heap (used mostly in assertions
// and verification). The estimate is conservative, i.e., not all addresses in
@@ -1199,6 +1209,11 @@ TLHELP32_FUNCTION_LIST(DLL_FUNC_LOADED)
// application is closed.
}
+#undef DBGHELP_FUNCTION_LIST
+#undef TLHELP32_FUNCTION_LIST
+#undef DLL_FUNC_VAR
+#undef DLL_FUNC_TYPE
+
// Load the symbols for generating stack traces.
static bool LoadSymbols(HANDLE process_handle) {