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

Unified Diff: util/test/errors.cc

Issue 816223007: win: implement ErrnoMessage (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: include Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/test/errors.cc
diff --git a/util/test/errors.cc b/util/test/errors.cc
index 9c1ac2b7d850162590b797e900579d744651f44e..1fd3a0f515084ad43dae2c377d948f88094bd61a 100644
--- a/util/test/errors.cc
+++ b/util/test/errors.cc
@@ -16,17 +16,30 @@
#include <errno.h>
-#include "base/safe_strerror_posix.h"
+#include "build/build_config.h"
#include "base/strings/stringprintf.h"
+#if defined(OS_POSIX)
+#include "base/safe_strerror_posix.h"
+#elif defined(OS_WIN)
+#include <string.h>
+#endif
+
namespace crashpad {
namespace test {
std::string ErrnoMessage(int err, const std::string& base) {
+#if defined(OS_POSIX)
+ std::string err_as_string = safe_strerror(errno);
+ const char* err_string = err_as_string.c_str();
+#elif defined(OS_WIN)
+ char err_string[256];
+ strerror_s(err_string, errno);
+#endif
return base::StringPrintf("%s%s%s (%d)",
base.c_str(),
base.empty() ? "" : ": ",
- safe_strerror(errno).c_str(),
+ err_string,
err);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698