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

Side by Side Diff: vm/object.cc

Issue 11419259: Fix bug in Utf8::CodePointCount which was causing some strings with latin1 (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
« no previous file with comments | « vm/dart_api_message.cc ('k') | vm/object_test.cc » ('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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 10045 matching lines...) Expand 10 before | Expand all | Expand 10 after
10056 intptr_t array_len = strlen(str); 10056 intptr_t array_len = strlen(str);
10057 const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str); 10057 const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str);
10058 return String::New(utf8_array, array_len, space); 10058 return String::New(utf8_array, array_len, space);
10059 } 10059 }
10060 10060
10061 10061
10062 RawString* String::New(const uint8_t* utf8_array, 10062 RawString* String::New(const uint8_t* utf8_array,
10063 intptr_t array_len, 10063 intptr_t array_len,
10064 Heap::Space space) { 10064 Heap::Space space) {
10065 Utf8::Type type; 10065 Utf8::Type type;
10066 intptr_t len = Utf8::CodePointCount(utf8_array, array_len, &type); 10066 intptr_t len = Utf8::CodeUnitCount(utf8_array, array_len, &type);
10067 if (type == Utf8::kLatin1) { 10067 if (type == Utf8::kLatin1) {
10068 const String& strobj = String::Handle(OneByteString::New(len, space)); 10068 const String& strobj = String::Handle(OneByteString::New(len, space));
10069 if (len > 0) { 10069 if (len > 0) {
10070 NoGCScope no_gc; 10070 NoGCScope no_gc;
10071 Utf8::DecodeToLatin1(utf8_array, array_len, 10071 Utf8::DecodeToLatin1(utf8_array, array_len,
10072 OneByteString::CharAddr(strobj, 0), len); 10072 OneByteString::CharAddr(strobj, 0), len);
10073 } 10073 }
10074 return strobj.raw(); 10074 return strobj.raw();
10075 } 10075 }
10076 ASSERT((type == Utf8::kBMP) || (type == Utf8::kSupplementary)); 10076 ASSERT((type == Utf8::kBMP) || (type == Utf8::kSupplementary));
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after
12083 } 12083 }
12084 return result.raw(); 12084 return result.raw();
12085 } 12085 }
12086 12086
12087 12087
12088 const char* WeakProperty::ToCString() const { 12088 const char* WeakProperty::ToCString() const {
12089 return "_WeakProperty"; 12089 return "_WeakProperty";
12090 } 12090 }
12091 12091
12092 } // namespace dart 12092 } // namespace dart
OLDNEW
« no previous file with comments | « vm/dart_api_message.cc ('k') | vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698