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

Side by Side Diff: bin/file.cc

Issue 11275008: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file.h" 5 #include "bin/file.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 #include "bin/thread.h" 9 #include "bin/thread.h"
10 #include "bin/utils.h" 10 #include "bin/utils.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 425
426 426
427 void FUNCTION_NAME(File_Directory)(Dart_NativeArguments args) { 427 void FUNCTION_NAME(File_Directory)(Dart_NativeArguments args) {
428 Dart_EnterScope(); 428 Dart_EnterScope();
429 const char* str = 429 const char* str =
430 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 430 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
431 char* str_copy = strdup(str); 431 char* str_copy = strdup(str);
432 char* path = File::GetContainingDirectory(str_copy); 432 char* path = File::GetContainingDirectory(str_copy);
433 free(str_copy); 433 free(str_copy);
434 if (path != NULL) { 434 if (path != NULL) {
435 Dart_SetReturnValue(args, Dart_NewString(path)); 435 Dart_SetReturnValue(args, DartUtils::NewString(path));
436 free(path); 436 free(path);
437 } else { 437 } else {
438 Dart_Handle err = DartUtils::NewDartOSError(); 438 Dart_Handle err = DartUtils::NewDartOSError();
439 if (Dart_IsError(err)) Dart_PropagateError(err); 439 if (Dart_IsError(err)) Dart_PropagateError(err);
440 Dart_SetReturnValue(args, err); 440 Dart_SetReturnValue(args, err);
441 } 441 }
442 Dart_ExitScope(); 442 Dart_ExitScope();
443 } 443 }
444 444
445 445
446 void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) { 446 void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) {
447 Dart_EnterScope(); 447 Dart_EnterScope();
448 const char* str = 448 const char* str =
449 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 449 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
450 char* path = File::GetCanonicalPath(str); 450 char* path = File::GetCanonicalPath(str);
451 if (path != NULL) { 451 if (path != NULL) {
452 Dart_SetReturnValue(args, Dart_NewString(path)); 452 Dart_SetReturnValue(args, DartUtils::NewString(path));
453 free(path); 453 free(path);
454 } else { 454 } else {
455 Dart_Handle err = DartUtils::NewDartOSError(); 455 Dart_Handle err = DartUtils::NewDartOSError();
456 if (Dart_IsError(err)) Dart_PropagateError(err); 456 if (Dart_IsError(err)) Dart_PropagateError(err);
457 Dart_SetReturnValue(args, err); 457 Dart_SetReturnValue(args, err);
458 } 458 }
459 Dart_ExitScope(); 459 Dart_ExitScope();
460 } 460 }
461 461
462 462
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 Dart_EnterScope(); 985 Dart_EnterScope();
986 Dart_SetReturnValue(args, Dart_Null()); 986 Dart_SetReturnValue(args, Dart_Null());
987 Dart_Port service_port = File::GetServicePort(); 987 Dart_Port service_port = File::GetServicePort();
988 if (service_port != ILLEGAL_PORT) { 988 if (service_port != ILLEGAL_PORT) {
989 // Return a send port for the service port. 989 // Return a send port for the service port.
990 Dart_Handle send_port = Dart_NewSendPort(service_port); 990 Dart_Handle send_port = Dart_NewSendPort(service_port);
991 Dart_SetReturnValue(args, send_port); 991 Dart_SetReturnValue(args, send_port);
992 } 992 }
993 Dart_ExitScope(); 993 Dart_ExitScope();
994 } 994 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698