Diff
Modified: trunk/Source/WTF/ChangeLog (217037 => 217038)
--- trunk/Source/WTF/ChangeLog 2017-05-18 06:57:43 UTC (rev 217037)
+++ trunk/Source/WTF/ChangeLog 2017-05-18 07:12:13 UTC (rev 217038)
@@ -1,3 +1,14 @@
+2017-05-18 Don Olmstead <[email protected]>
+
+ [Win] Remove usage of _snprintf
+ https://bugs.webkit.org/show_bug.cgi?id=172251
+
+ Reviewed by Per Arne Vollan.
+
+ * wtf/DataLog.cpp:
+ (WTF::initializeLogFileOnce):
+ (WTF::setDataFile):
+
2017-05-15 Mark Lam <[email protected]>
Rolling out r214038 and r213697: Crashes when using computed properties with rest destructuring and object spread.
Modified: trunk/Source/WTF/wtf/DataLog.cpp (217037 => 217038)
--- trunk/Source/WTF/wtf/DataLog.cpp 2017-05-18 06:57:43 UTC (rev 217037)
+++ trunk/Source/WTF/wtf/DataLog.cpp 2017-05-18 07:12:13 UTC (rev 217038)
@@ -29,6 +29,7 @@
#include <string.h>
#include <wtf/FilePrintStream.h>
#include <wtf/LockedPrintStream.h>
+#include <wtf/ProcessID.h>
#include <wtf/Threading.h>
#include <mutex>
#include <thread>
@@ -96,11 +97,7 @@
char actualFilename[maxPathLength + 1];
if (filename && !strstr(filename, "%pid")) {
-#if PLATFORM(WIN)
- _snprintf(actualFilename, sizeof(actualFilename), "%s.%%pid.txt", filename);
-#else
snprintf(actualFilename, sizeof(actualFilename), "%s.%%pid.txt", filename);
-#endif
filename = actualFilename;
}
#endif // DATA_LOG_TO_FILE
@@ -133,12 +130,8 @@
char* nextDest = formattedPath + pathCharactersAvailable;
pathCharactersAvailable = maxPathLength - pathCharactersAvailable;
if (pathCharactersAvailable) {
- int pidTextLength;
-#if PLATFORM(WIN)
- pidTextLength = _snprintf(nextDest, pathCharactersAvailable, "%d", GetCurrentProcessId());
-#else
- pidTextLength = snprintf(nextDest, pathCharactersAvailable, "%d", getpid());
-#endif
+ int pidTextLength = snprintf(nextDest, pathCharactersAvailable, "%d", getCurrentProcessID());
+
if (pidTextLength < 0 || static_cast<size_t>(pidTextLength) >= pathCharactersAvailable)
pathCharactersAvailable = 0;
else {
Modified: trunk/Tools/ChangeLog (217037 => 217038)
--- trunk/Tools/ChangeLog 2017-05-18 06:57:43 UTC (rev 217037)
+++ trunk/Tools/ChangeLog 2017-05-18 07:12:13 UTC (rev 217038)
@@ -1,3 +1,14 @@
+2017-05-18 Don Olmstead <[email protected]>
+
+ [Win] Remove usage of _snprintf
+ https://bugs.webkit.org/show_bug.cgi?id=172251
+
+ Reviewed by Per Arne Vollan.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
+ * MiniBrowser/win/PageLoadTestClient.cpp:
+ (PageLoadTestClient::dumpRunStatistics):
+
2017-05-17 Ryan Haddad <[email protected]>
Unreviewed, rolling out r217014.
Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h (217037 => 217038)
--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h 2017-05-18 06:57:43 UTC (rev 217037)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h 2017-05-18 07:12:13 UTC (rev 217038)
@@ -31,10 +31,6 @@
#include <map>
#include <string>
-#if defined(_MSC_VER) && _MSC_VER < 1900
-#define snprintf _snprintf
-#endif
-
// Helper classes for implementing has_member
typedef char (&no_tag)[1];
typedef char (&yes_tag)[2];
Modified: trunk/Tools/MiniBrowser/win/PageLoadTestClient.cpp (217037 => 217038)
--- trunk/Tools/MiniBrowser/win/PageLoadTestClient.cpp 2017-05-18 06:57:43 UTC (rev 217037)
+++ trunk/Tools/MiniBrowser/win/PageLoadTestClient.cpp 2017-05-18 07:12:13 UTC (rev 217038)
@@ -28,9 +28,10 @@
#include "MiniBrowser.h"
#include <WebCore/PlatformExportMacros.h>
+#include <cmath>
#include <wtf/Assertions.h>
#include <wtf/FilePrintStream.h>
-#include <cmath>
+#include <wtf/ProcessID.h>
static const CFTimeInterval waitForNewResourceLoadDuration = 0.1;
@@ -187,22 +188,12 @@
char filenameSuffix[maxPathLength + 1];
-#if PLATFORM(WIN)
- DWORD pid = GetCurrentProcessId();
- _snprintf(filenameSuffix, sizeof(filenameSuffix), ".%d.txt", pid);
-#else
- long pid = getpid();
- snprintf(filenameSuffix, sizeof(filenameSuffix), ".%d.txt", pid);
-#endif
+ snprintf(filenameSuffix, sizeof(filenameSuffix), ".%d.txt", getCurrentProcessID());
const char* filename = "webkit_performance_log";
char actualFilename[maxPathLength + 1];
-#if PLATFORM(WIN)
- _snprintf(actualFilename, sizeof(actualFilename), "%s%s", filename, filenameSuffix);
-#else
snprintf(actualFilename, sizeof(actualFilename), "%s%s", filename, filenameSuffix);
-#endif
std::unique_ptr<WTF::FilePrintStream> file = WTF::FilePrintStream::open(actualFilename, "w");
if (!file) {