| 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/crypto.h" | 7 #include "bin/crypto.h" |
| 8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
| 9 #include "bin/extensions.h" | 9 #include "bin/extensions.h" |
| 10 #include "bin/file.h" | 10 #include "bin/file.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 intptr_t num_bytes, | 215 intptr_t num_bytes, |
| 216 void* stream) { | 216 void* stream) { |
| 217 ASSERT(stream != NULL); | 217 ASSERT(stream != NULL); |
| 218 File* file_stream = reinterpret_cast<File*>(stream); | 218 File* file_stream = reinterpret_cast<File*>(stream); |
| 219 bool bytes_written = file_stream->WriteFully(buffer, num_bytes); | 219 bool bytes_written = file_stream->WriteFully(buffer, num_bytes); |
| 220 ASSERT(bytes_written); | 220 ASSERT(bytes_written); |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 void DartUtils::CloseFile(void* stream) { | 224 void DartUtils::CloseFile(void* stream) { |
| 225 delete reinterpret_cast<File*>(stream); | 225 File* file = reinterpret_cast<File*>(stream); |
| 226 file->Release(); |
| 226 } | 227 } |
| 227 | 228 |
| 228 | 229 |
| 229 bool DartUtils::EntropySource(uint8_t* buffer, intptr_t length) { | 230 bool DartUtils::EntropySource(uint8_t* buffer, intptr_t length) { |
| 230 return Crypto::GetRandomBytes(length, buffer); | 231 return Crypto::GetRandomBytes(length, buffer); |
| 231 } | 232 } |
| 232 | 233 |
| 233 | 234 |
| 234 static Dart_Handle SingleArgDart_Invoke(Dart_Handle lib, const char* method, | 235 static Dart_Handle SingleArgDart_Invoke(Dart_Handle lib, const char* method, |
| 235 Dart_Handle arg) { | 236 Dart_Handle arg) { |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 new CObjectString(CObject::NewString(os_error->message())); | 1262 new CObjectString(CObject::NewString(os_error->message())); |
| 1262 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1263 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 1263 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1264 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 1264 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1265 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 1265 result->SetAt(2, error_message); | 1266 result->SetAt(2, error_message); |
| 1266 return result; | 1267 return result; |
| 1267 } | 1268 } |
| 1268 | 1269 |
| 1269 } // namespace bin | 1270 } // namespace bin |
| 1270 } // namespace dart | 1271 } // namespace dart |
| OLD | NEW |