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

Unified Diff: runtime/vm/os_fuchsia.cc

Issue 2158673002: Fuchsia: Hello, Fuchsia! (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge, cleanup Created 4 years, 5 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/platform/utils_fuchsia.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_fuchsia.cc
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index 9a4151f30a45dcab28f4a596a0a1f94688a85c72..2a813271b467d7d8d5be2a66149c99ad7d45caa7 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -7,6 +7,7 @@
#include "vm/os.h"
+#include <errno.h>
#include <magenta/syscalls.h>
#include <magenta/types.h>
@@ -240,8 +241,21 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
bool OS::StringToInt64(const char* str, int64_t* value) {
- UNIMPLEMENTED();
- return false;
+ ASSERT(str != NULL && strlen(str) > 0 && value != NULL);
+ int32_t base = 10;
+ char* endptr;
+ int i = 0;
+ if (str[0] == '-') {
+ i = 1;
+ }
+ if ((str[i] == '0') &&
+ (str[i + 1] == 'x' || str[i + 1] == 'X') &&
+ (str[i + 2] != '\0')) {
+ base = 16;
+ }
+ errno = 0;
+ *value = strtoll(str, &endptr, base);
+ return ((errno == 0) && (endptr != str) && (*endptr == 0));
}
« no previous file with comments | « runtime/platform/utils_fuchsia.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698