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

Unified Diff: runtime/bin/dartutils.h

Issue 23479010: Add length checks to ApiMessageWriter. (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 | « no previous file | 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 85b5585f5fa447b1fb4b37ca53f12faeb3f8e8f1..6e9a9344cbb1efaea4454d4243ba53915bc88702 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -271,14 +271,14 @@ class CObject {
static Dart_CObject* NewIntptr(intptr_t value);
// TODO(sgjesse): Add support for kBigint.
static Dart_CObject* NewDouble(double value);
- static Dart_CObject* NewString(int length);
+ static Dart_CObject* NewString(intptr_t length);
static Dart_CObject* NewString(const char* str);
- static Dart_CObject* NewArray(int length);
- static Dart_CObject* NewUint8Array(int length);
+ static Dart_CObject* NewArray(intptr_t length);
+ static Dart_CObject* NewUint8Array(intptr_t length);
static Dart_CObject* NewExternalUint8Array(
- int64_t length, uint8_t* data, void* peer,
+ intptr_t length, uint8_t* data, void* peer,
Dart_WeakPersistentHandleFinalizer callback);
- static Dart_CObject* NewIOBuffer(int64_t length);
+ static Dart_CObject* NewIOBuffer(intptr_t length);
static void FreeIOBufferData(Dart_CObject* object);
Dart_CObject* AsApiCObject() { return cobject_; }
@@ -452,11 +452,11 @@ class CObjectArray : public CObject {
public:
DECLARE_COBJECT_CONSTRUCTORS(Array)
- int Length() const { return cobject_->value.as_array.length; }
- CObject* operator[](int index) const {
+ intptr_t Length() const { return cobject_->value.as_array.length; }
+ CObject* operator[](intptr_t index) const {
return new CObject(cobject_->value.as_array.values[index]);
}
- void SetAt(int index, CObject* value) {
+ void SetAt(intptr_t index, CObject* value) {
cobject_->value.as_array.values[index] = value->AsApiCObject();
}
@@ -480,7 +480,7 @@ class CObjectTypedData : public CObject {
Dart_TypedData_Type Type() const {
return cobject_->value.as_typed_data.type;
}
- int Length() const { return cobject_->value.as_typed_data.length; }
+ intptr_t Length() const { return cobject_->value.as_typed_data.length; }
uint8_t* Buffer() const { return cobject_->value.as_typed_data.values; }
private:
@@ -492,7 +492,7 @@ class CObjectUint8Array : public CObject {
public:
DECLARE_COBJECT_TYPED_DATA_CONSTRUCTORS(Uint8)
- int Length() const { return cobject_->value.as_typed_data.length; }
+ intptr_t Length() const { return cobject_->value.as_typed_data.length; }
uint8_t* Buffer() const { return cobject_->value.as_typed_data.values; }
private:
@@ -504,8 +504,10 @@ class CObjectExternalUint8Array : public CObject {
public:
DECLARE_COBJECT_EXTERNAL_TYPED_DATA_CONSTRUCTORS(Uint8)
- int Length() const { return cobject_->value.as_external_typed_data.length; }
- void SetLength(uint64_t length) {
+ intptr_t Length() const {
+ return cobject_->value.as_external_typed_data.length;
+ }
+ void SetLength(intptr_t length) {
cobject_->value.as_external_typed_data.length = length;
}
uint8_t* Data() const { return cobject_->value.as_external_typed_data.data; }
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698