| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 #include "bin/file.h" | 7 #include "bin/file.h" |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 Dart_CObject* CObject::NewArray(int length) { | 392 Dart_CObject* CObject::NewArray(int length) { |
| 393 Dart_CObject* cobject = | 393 Dart_CObject* cobject = |
| 394 New(Dart_CObject::kArray, length * sizeof(Dart_CObject*)); // NOLINT | 394 New(Dart_CObject::kArray, length * sizeof(Dart_CObject*)); // NOLINT |
| 395 cobject->value.as_array.length = length; | 395 cobject->value.as_array.length = length; |
| 396 cobject->value.as_array.values = | 396 cobject->value.as_array.values = |
| 397 reinterpret_cast<Dart_CObject**>(cobject + 1); | 397 reinterpret_cast<Dart_CObject**>(cobject + 1); |
| 398 return cobject; | 398 return cobject; |
| 399 } | 399 } |
| 400 | 400 |
| 401 | 401 |
| 402 Dart_CObject* CObject::NewByteArray(int length) { | 402 Dart_CObject* CObject::NewUint8Array(int length) { |
| 403 Dart_CObject* cobject = New(Dart_CObject::kByteArray, length); | 403 Dart_CObject* cobject = New(Dart_CObject::kUint8Array, length); |
| 404 cobject->value.as_byte_array.length = length; | 404 cobject->value.as_byte_array.length = length; |
| 405 cobject->value.as_byte_array.values = reinterpret_cast<uint8_t*>(cobject + 1); | 405 cobject->value.as_byte_array.values = reinterpret_cast<uint8_t*>(cobject + 1); |
| 406 return cobject; | 406 return cobject; |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 static int kIllegalArgumentError = 1; | 410 static int kIllegalArgumentError = 1; |
| 411 static int kOSError = 2; | 411 static int kOSError = 2; |
| 412 static int kFileClosedError = 3; | 412 static int kFileClosedError = 3; |
| 413 | 413 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 433 | 433 |
| 434 CObject* CObject::NewOSError(OSError* os_error) { | 434 CObject* CObject::NewOSError(OSError* os_error) { |
| 435 CObject* error_message = | 435 CObject* error_message = |
| 436 new CObjectString(CObject::NewString(os_error->message())); | 436 new CObjectString(CObject::NewString(os_error->message())); |
| 437 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 437 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 438 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 438 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 439 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 439 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 440 result->SetAt(2, error_message); | 440 result->SetAt(2, error_message); |
| 441 return result; | 441 return result; |
| 442 } | 442 } |
| OLD | NEW |