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

Unified Diff: runtime/bin/dbg_message.cc

Issue 169893003: Another round of cleanups for http://www.dartbug.com/15922 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
Index: runtime/bin/dbg_message.cc
===================================================================
--- runtime/bin/dbg_message.cc (revision 32732)
+++ runtime/bin/dbg_message.cc (working copy)
@@ -91,12 +91,11 @@
}
-static int GetIntValue(Dart_Handle int_handle) {
+static int64_t GetIntValue(Dart_Handle int_handle) {
int64_t int64_val = -1;
ASSERT(Dart_IsInteger(int_handle));
Dart_Handle res = Dart_IntegerToInt64(int_handle, &int64_val);
ASSERT_NOT_ERROR(res);
- // TODO(hausner): Range check.
return int64_val;
}
@@ -367,10 +366,10 @@
res = Dart_ListLength(import_list, &list_length);
RETURN_IF_ERROR(res);
buf->Printf(",\"imports\":[");
- for (int i = 0; i + 1 < list_length; i += 2) {
+ for (intptr_t i = 0; i + 1 < list_length; i += 2) {
Dart_Handle lib_id = Dart_ListGetAt(import_list, i + 1);
ASSERT_NOT_ERROR(lib_id);
- buf->Printf("%s{\"libraryId\":%d,",
+ buf->Printf("%s{\"libraryId\":%" Pd64 ",",
(i > 0) ? ",": "",
GetIntValue(lib_id));
@@ -580,14 +579,15 @@
intptr_t num_libs;
Dart_Handle res = Dart_ListLength(lib_ids, &num_libs);
ASSERT_NOT_ERROR(res);
- for (int i = 0; i < num_libs; i++) {
+ for (intptr_t i = 0; i < num_libs; i++) {
Dart_Handle lib_id_handle = Dart_ListGetAt(lib_ids, i);
ASSERT(Dart_IsInteger(lib_id_handle));
- int lib_id = GetIntValue(lib_id_handle);
- Dart_Handle lib_url = Dart_GetLibraryURL(lib_id);
+ int64_t lib_id = GetIntValue(lib_id_handle);
+ ASSERT((lib_id >= kIntptrMin) && (lib_id <= kIntptrMax));
+ Dart_Handle lib_url = Dart_GetLibraryURL(static_cast<intptr_t>(lib_id));
ASSERT_NOT_ERROR(lib_url);
ASSERT(Dart_IsString(lib_url));
- msg.Printf("%s{\"id\":%d,\"url\":", (i == 0) ? "" : ", ", lib_id);
+ msg.Printf("%s{\"id\":%" Pd64 ",\"url\":", (i == 0) ? "" : ", ", lib_id);
FormatEncodedString(&msg, lib_url);
msg.Printf("}");
}
@@ -898,11 +898,11 @@
num_elems = 0;
} else {
ASSERT(Dart_IsInteger(elem));
- int value = GetIntValue(elem);
+ int64_t value = GetIntValue(elem);
if (num_elems == 0) {
- msg.Printf("%d", value);
+ msg.Printf("%" Pd64 "", value);
} else {
- msg.Printf(",%d", value);
+ msg.Printf(",%" Pd64 "", value);
}
num_elems++;
}

Powered by Google App Engine
This is Rietveld 408576698