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

Side by Side Diff: src/runtime/runtime-i18n.cc

Issue 2738503008: Prepare for ICU's switch to char16_t (Closed)
Patch Set: do not include uvernum.h in runtime-i18n.cc : no longer necessary Created 3 years, 9 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
« no previous file with comments | « src/i18n.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 #ifdef V8_I18N_SUPPORT 6 #ifdef V8_I18N_SUPPORT
7 #include "src/runtime/runtime-utils.h" 7 #include "src/runtime/runtime-utils.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 25 matching lines...) Expand all
36 #include "unicode/rbbi.h" 36 #include "unicode/rbbi.h"
37 #include "unicode/smpdtfmt.h" 37 #include "unicode/smpdtfmt.h"
38 #include "unicode/timezone.h" 38 #include "unicode/timezone.h"
39 #include "unicode/translit.h" 39 #include "unicode/translit.h"
40 #include "unicode/uchar.h" 40 #include "unicode/uchar.h"
41 #include "unicode/ucol.h" 41 #include "unicode/ucol.h"
42 #include "unicode/ucurr.h" 42 #include "unicode/ucurr.h"
43 #include "unicode/uloc.h" 43 #include "unicode/uloc.h"
44 #include "unicode/unistr.h" 44 #include "unicode/unistr.h"
45 #include "unicode/unum.h" 45 #include "unicode/unum.h"
46 #include "unicode/ustring.h"
46 #include "unicode/uversion.h" 47 #include "unicode/uversion.h"
47 48
48 49
49 namespace v8 { 50 namespace v8 {
50 namespace internal { 51 namespace internal {
51 namespace { 52 namespace {
52 53
53 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, 54 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat,
54 std::unique_ptr<uc16[]>* dest, 55 std::unique_ptr<uc16[]>* dest,
55 int32_t length) { 56 int32_t length) {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 UCollationResult result; 603 UCollationResult result;
603 UErrorCode status = U_ZERO_ERROR; 604 UErrorCode status = U_ZERO_ERROR;
604 { 605 {
605 DisallowHeapAllocation no_gc; 606 DisallowHeapAllocation no_gc;
606 int32_t length1 = string1->length(); 607 int32_t length1 = string1->length();
607 int32_t length2 = string2->length(); 608 int32_t length2 = string2->length();
608 String::FlatContent flat1 = string1->GetFlatContent(); 609 String::FlatContent flat1 = string1->GetFlatContent();
609 String::FlatContent flat2 = string2->GetFlatContent(); 610 String::FlatContent flat2 = string2->GetFlatContent();
610 std::unique_ptr<uc16[]> sap1; 611 std::unique_ptr<uc16[]> sap1;
611 std::unique_ptr<uc16[]> sap2; 612 std::unique_ptr<uc16[]> sap2;
612 const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1); 613 icu::UnicodeString string_val1(
613 const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2); 614 FALSE, GetUCharBufferFromFlat(flat1, &sap1, length1), length1);
614 result = 615 icu::UnicodeString string_val2(
615 collator->compare(string_val1, length1, string_val2, length2, status); 616 FALSE, GetUCharBufferFromFlat(flat2, &sap2, length2), length2);
617 result = collator->compare(string_val1, string_val2, status);
616 } 618 }
617 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); 619 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation();
618 620
619 return *isolate->factory()->NewNumberFromInt(result); 621 return *isolate->factory()->NewNumberFromInt(result);
620 } 622 }
621 623
622 624
623 RUNTIME_FUNCTION(Runtime_StringNormalize) { 625 RUNTIME_FUNCTION(Runtime_StringNormalize) {
624 HandleScope scope(isolate); 626 HandleScope scope(isolate);
625 static const struct { 627 static const struct {
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 Handle<FixedArray> date_cache_version = 1182 Handle<FixedArray> date_cache_version =
1181 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( 1183 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton(
1182 EternalHandles::DATE_CACHE_VERSION)); 1184 EternalHandles::DATE_CACHE_VERSION));
1183 return date_cache_version->get(0); 1185 return date_cache_version->get(0);
1184 } 1186 }
1185 1187
1186 } // namespace internal 1188 } // namespace internal
1187 } // namespace v8 1189 } // namespace v8
1188 1190
1189 #endif // V8_I18N_SUPPORT 1191 #endif // V8_I18N_SUPPORT
OLDNEW
« no previous file with comments | « src/i18n.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698