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

Side by Side Diff: lib/string.cc

Issue 11280241: Fix StringBase_createFromCodePoints to correctly accept Latin-1 characters (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 16 matching lines...) Expand all
27 if (!index_object.IsSmi()) { 27 if (!index_object.IsSmi()) {
28 GrowableArray<const Object*> args; 28 GrowableArray<const Object*> args;
29 args.Add(&index_object); 29 args.Add(&index_object);
30 Exceptions::ThrowByType(Exceptions::kArgument, args); 30 Exceptions::ThrowByType(Exceptions::kArgument, args);
31 } 31 }
32 intptr_t value = Smi::Cast(index_object).Value(); 32 intptr_t value = Smi::Cast(index_object).Value();
33 if (value < 0) { 33 if (value < 0) {
34 GrowableArray<const Object*> args; 34 GrowableArray<const Object*> args;
35 Exceptions::ThrowByType(Exceptions::kArgument, args); 35 Exceptions::ThrowByType(Exceptions::kArgument, args);
36 } else { 36 } else {
37 if (value > 0x7F) { 37 if (value > 0xFF) {
38 is_one_byte_string = false; 38 is_one_byte_string = false;
39 } 39 }
40 if (value > 0xFFFF) { 40 if (value > 0xFFFF) {
41 utf16_len += 1; 41 utf16_len += 1;
42 } 42 }
43 } 43 }
44 utf32_array[i] = value; 44 utf32_array[i] = value;
45 } 45 }
46 if (is_one_byte_string) { 46 if (is_one_byte_string) {
47 return OneByteString::New(utf32_array, array_len, Heap::kNew); 47 return OneByteString::New(utf32_array, array_len, Heap::kNew);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (!elem.IsString()) { 147 if (!elem.IsString()) {
148 GrowableArray<const Object*> args; 148 GrowableArray<const Object*> args;
149 args.Add(&elem); 149 args.Add(&elem);
150 Exceptions::ThrowByType(Exceptions::kArgument, args); 150 Exceptions::ThrowByType(Exceptions::kArgument, args);
151 } 151 }
152 } 152 }
153 return String::ConcatAll(strings); 153 return String::ConcatAll(strings);
154 } 154 }
155 155
156 } // namespace dart 156 } // namespace dart
OLDNEW
« no previous file with comments | « include/dart_api.h ('k') | vm/benchmark_test.cc » ('j') | vm/dart_api_impl_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698