| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 if (bytes == NULL) { | 1624 if (bytes == NULL) { |
| 1625 return Api::NewError("%s expects argument 'bytes' to be non-null.", | 1625 return Api::NewError("%s expects argument 'bytes' to be non-null.", |
| 1626 CURRENT_FUNC); | 1626 CURRENT_FUNC); |
| 1627 } | 1627 } |
| 1628 if (length == NULL) { | 1628 if (length == NULL) { |
| 1629 return Api::NewError("%s expects argument 'length' to be non-null.", | 1629 return Api::NewError("%s expects argument 'length' to be non-null.", |
| 1630 CURRENT_FUNC); | 1630 CURRENT_FUNC); |
| 1631 } | 1631 } |
| 1632 const char* cstring = str.ToCString(); | 1632 const char* cstring = str.ToCString(); |
| 1633 *length = Utf8::Length(str); | 1633 *length = Utf8::Length(str); |
| 1634 char* result = reinterpret_cast<char*>(Api::Allocate(isolate, *length)); | 1634 uint8_t* result = reinterpret_cast<uint8_t*>(Api::Allocate(isolate, *length)); |
| 1635 if (result == NULL) { | 1635 if (result == NULL) { |
| 1636 return Api::NewError("Unable to allocate memory"); | 1636 return Api::NewError("Unable to allocate memory"); |
| 1637 } | 1637 } |
| 1638 memmove(result, cstring, *length); | 1638 memmove(result, cstring, *length); |
| 1639 *bytes = result; | 1639 *bytes = result; |
| 1640 return Api::Success(isolate); | 1640 return Api::Success(isolate); |
| 1641 } | 1641 } |
| 1642 | 1642 |
| 1643 | 1643 |
| 1644 // --- Lists --- | 1644 // --- Lists --- |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3322 *buffer = NULL; | 3322 *buffer = NULL; |
| 3323 } | 3323 } |
| 3324 delete debug_region; | 3324 delete debug_region; |
| 3325 } else { | 3325 } else { |
| 3326 *buffer = NULL; | 3326 *buffer = NULL; |
| 3327 *buffer_size = 0; | 3327 *buffer_size = 0; |
| 3328 } | 3328 } |
| 3329 } | 3329 } |
| 3330 | 3330 |
| 3331 } // namespace dart | 3331 } // namespace dart |
| OLD | NEW |