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

Unified Diff: runtime/bin/dartutils.h

Issue 11414293: Fix a number of int type issues in dart:io File implementation to avoid implicit conversions that c… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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/builtin_natives.cc ('k') | runtime/bin/dartutils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dartutils.h
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index 95d44c93aec68ef539f8f505f584d92ff3bef315..76668ae7c35cf5328d3c5df582a2735ca01ab2b8 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -76,6 +76,10 @@ class DartUtils {
// Assumes that the value object is known to be an integer object
// that fits in a signed 64-bit integer.
static int64_t GetIntegerValue(Dart_Handle value_obj);
+ // Assumes that the value object is known to be an intptr_t. This should
+ // only be known when the value has been put into Dart as a pointer encoded
+ // in a 64-bit integer. This is the case for file and directory operations.
+ static intptr_t GetIntptrValue(Dart_Handle value_obj);
// Checks that the value object is an integer object that fits in a
// signed 64-bit integer. If it is, the value is returned in the
// value out parameter and true is returned. Otherwise, false is
@@ -210,7 +214,7 @@ class CObject {
static Dart_CObject* NewString(const char* str);
static Dart_CObject* NewArray(int length);
static Dart_CObject* NewUint8Array(int length);
- static Dart_CObject* NewExternalUint8Array(int length,
+ static Dart_CObject* NewExternalUint8Array(int64_t length,
uint8_t* data,
void* peer,
Dart_PeerFinalizer callback);
@@ -308,7 +312,8 @@ class CObjectIntptr : public CObject {
if (type() == Dart_CObject::kInt32) {
result = cobject_->value.as_int32;
} else {
- result = cobject_->value.as_int64;
+ ASSERT(sizeof(result) == 8);
+ result = static_cast<intptr_t>(cobject_->value.as_int64);
}
return result;
}
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/dartutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698