Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Unified Diff: runtime/bin/utils_win.cc

Issue 23463044: Remove duplicated code on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/utils_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/utils_win.cc
diff --git a/runtime/bin/utils_win.cc b/runtime/bin/utils_win.cc
index b926dd767de48c9a2f786ffd16af5bd038327db7..dab73552daabeb9ddaae673b017785c65b4ffe68 100644
--- a/runtime/bin/utils_win.cc
+++ b/runtime/bin/utils_win.cc
@@ -9,15 +9,14 @@
#include <time.h> // NOLINT
#include "bin/utils.h"
+#include "bin/utils_win.h"
#include "bin/log.h"
namespace dart {
namespace bin {
-static void FormatMessageIntoBuffer(DWORD code,
- wchar_t* buffer,
- int buffer_length) {
+void FormatMessageIntoBuffer(DWORD code, wchar_t* buffer, int buffer_length) {
DWORD message_size =
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
@@ -28,11 +27,14 @@ static void FormatMessageIntoBuffer(DWORD code,
NULL);
if (message_size == 0) {
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- Log::PrintErr("FormatMessage failed %d\n", GetLastError());
+ Log::PrintErr("FormatMessage failed for error code %d (error %d)\n",
+ code,
+ GetLastError());
}
_snwprintf(buffer, buffer_length, L"OS Error %d", code);
}
- buffer[buffer_length - 1] = '\0';
+ // Ensure string termination.
+ buffer[buffer_length - 1] = 0;
}
« no previous file with comments | « runtime/bin/utils_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698