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

Side by Side Diff: runtime/bin/dartutils.cc

Issue 26294002: Cleanups: int -> intptr_t for "array" lengths, memory sizes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 months 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
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/vm/assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return false; 42 return false;
43 #endif // defined(TARGET_OS_WINDOWS) 43 #endif // defined(TARGET_OS_WINDOWS)
44 } 44 }
45 45
46 46
47 const char* DartUtils::MapLibraryUrl(CommandLineOptions* url_mapping, 47 const char* DartUtils::MapLibraryUrl(CommandLineOptions* url_mapping,
48 const char* url_string) { 48 const char* url_string) {
49 ASSERT(url_mapping != NULL); 49 ASSERT(url_mapping != NULL);
50 // We need to check if the passed in url is found in the url_mapping array, 50 // We need to check if the passed in url is found in the url_mapping array,
51 // in that case use the mapped entry. 51 // in that case use the mapped entry.
52 int len = strlen(url_string); 52 intptr_t len = strlen(url_string);
53 for (int idx = 0; idx < url_mapping->count(); idx++) { 53 for (intptr_t idx = 0; idx < url_mapping->count(); idx++) {
54 const char* url_name = url_mapping->GetArgument(idx); 54 const char* url_name = url_mapping->GetArgument(idx);
55 if (!strncmp(url_string, url_name, len) && (url_name[len] == ',')) { 55 if (!strncmp(url_string, url_name, len) && (url_name[len] == ',')) {
56 const char* url_mapped_name = url_name + len + 1; 56 const char* url_mapped_name = url_name + len + 1;
57 if (strlen(url_mapped_name) != 0) { 57 if (strlen(url_mapped_name) != 0) {
58 return url_mapped_name; // Found a mapping for this URL. 58 return url_mapped_name; // Found a mapping for this URL.
59 } 59 }
60 } 60 }
61 } 61 }
62 return NULL; // Did not find a mapping for this URL. 62 return NULL; // Did not find a mapping for this URL.
63 } 63 }
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 932
933 933
934 Dart_CObject* CObject::NewString(intptr_t length) { 934 Dart_CObject* CObject::NewString(intptr_t length) {
935 Dart_CObject* cobject = New(Dart_CObject_kString, length + 1); 935 Dart_CObject* cobject = New(Dart_CObject_kString, length + 1);
936 cobject->value.as_string = reinterpret_cast<char*>(cobject + 1); 936 cobject->value.as_string = reinterpret_cast<char*>(cobject + 1);
937 return cobject; 937 return cobject;
938 } 938 }
939 939
940 940
941 Dart_CObject* CObject::NewString(const char* str) { 941 Dart_CObject* CObject::NewString(const char* str) {
942 int length = strlen(str); 942 intptr_t length = strlen(str);
943 Dart_CObject* cobject = NewString(length); 943 Dart_CObject* cobject = NewString(length);
944 memmove(cobject->value.as_string, str, length + 1); 944 memmove(cobject->value.as_string, str, length + 1);
945 return cobject; 945 return cobject;
946 } 946 }
947 947
948 948
949 Dart_CObject* CObject::NewArray(intptr_t length) { 949 Dart_CObject* CObject::NewArray(intptr_t length) {
950 Dart_CObject* cobject = 950 Dart_CObject* cobject =
951 New(Dart_CObject_kArray, length * sizeof(Dart_CObject*)); // NOLINT 951 New(Dart_CObject_kArray, length * sizeof(Dart_CObject*)); // NOLINT
952 cobject->value.as_array.length = length; 952 cobject->value.as_array.length = length;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 new CObjectString(CObject::NewString(os_error->message())); 1024 new CObjectString(CObject::NewString(os_error->message()));
1025 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1025 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1026 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1026 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1027 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1027 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1028 result->SetAt(2, error_message); 1028 result->SetAt(2, error_message);
1029 return result; 1029 return result;
1030 } 1030 }
1031 1031
1032 } // namespace bin 1032 } // namespace bin
1033 } // namespace dart 1033 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/vm/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698