| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return colon + 1; | 231 return colon + 1; |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 | 235 |
| 236 char* DartUtils::DirName(const char* url) { | 236 char* DartUtils::DirName(const char* url) { |
| 237 const char* slash = strrchr(url, File::PathSeparator()[0]); | 237 const char* slash = strrchr(url, File::PathSeparator()[0]); |
| 238 if (slash == NULL) { | 238 if (slash == NULL) { |
| 239 return strdup(url); | 239 return strdup(url); |
| 240 } else { | 240 } else { |
| 241 return strndup(url, slash - url + 1); | 241 return StringUtils::StrNDup(url, slash - url + 1); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 void* DartUtils::OpenFile(const char* name, bool write) { | 246 void* DartUtils::OpenFile(const char* name, bool write) { |
| 247 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead); | 247 File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead); |
| 248 return reinterpret_cast<void*>(file); | 248 return reinterpret_cast<void*>(file); |
| 249 } | 249 } |
| 250 | 250 |
| 251 | 251 |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 new CObjectString(CObject::NewString(os_error->message())); | 1177 new CObjectString(CObject::NewString(os_error->message())); |
| 1178 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1178 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 1179 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1179 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 1180 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1180 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 1181 result->SetAt(2, error_message); | 1181 result->SetAt(2, error_message); |
| 1182 return result; | 1182 return result; |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 } // namespace bin | 1185 } // namespace bin |
| 1186 } // namespace dart | 1186 } // namespace dart |
| OLD | NEW |