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

Side by Side Diff: source/i18n/alphaindex.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 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 | « source/i18n/affixpatternparser.cpp ('k') | source/i18n/brktrans.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 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * Copyright (C) 2009-2014, International Business Machines Corporation and 3 * Copyright (C) 2009-2014, International Business Machines Corporation and
4 * others. All Rights Reserved. 4 * others. All Rights Reserved.
5 ******************************************************************************* 5 *******************************************************************************
6 */ 6 */
7 7
8 #include "unicode/utypes.h" 8 #include "unicode/utypes.h"
9 9
10 #if !UCONFIG_NO_COLLATION 10 #if !UCONFIG_NO_COLLATION
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 Bucket *asciiBuckets[26] = { 435 Bucket *asciiBuckets[26] = {
436 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 436 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
437 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL 437 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
438 }; 438 };
439 Bucket *pinyinBuckets[26] = { 439 Bucket *pinyinBuckets[26] = {
440 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 440 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
441 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL 441 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
442 }; 442 };
443 UBool hasPinyin = FALSE; 443 UBool hasPinyin = FALSE;
444 444
445 LocalPointer<UVector> bucketList(new UVector(errorCode)); 445 LocalPointer<UVector> bucketList(new UVector(errorCode), errorCode);
446 if (bucketList.isNull()) { 446 if (U_FAILURE(errorCode)) {
447 errorCode = U_MEMORY_ALLOCATION_ERROR;
448 return NULL; 447 return NULL;
449 } 448 }
450 bucketList->setDeleter(uprv_deleteUObject); 449 bucketList->setDeleter(uprv_deleteUObject);
451 450
452 // underflow bucket 451 // underflow bucket
453 Bucket *bucket = new Bucket(getUnderflowLabel(), emptyString_, U_ALPHAINDEX_ UNDERFLOW); 452 Bucket *bucket = new Bucket(getUnderflowLabel(), emptyString_, U_ALPHAINDEX_ UNDERFLOW);
454 if (bucket == NULL) { 453 if (bucket == NULL) {
455 errorCode = U_MEMORY_ALLOCATION_ERROR; 454 errorCode = U_MEMORY_ALLOCATION_ERROR;
456 return NULL; 455 return NULL;
457 } 456 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } 593 }
595 if (bucket->labelType_ == U_ALPHAINDEX_INFLOW) { 594 if (bucket->labelType_ == U_ALPHAINDEX_INFLOW) {
596 if (nextBucket->labelType_ != U_ALPHAINDEX_NORMAL) { 595 if (nextBucket->labelType_ != U_ALPHAINDEX_NORMAL) {
597 bucket->displayBucket_ = nextBucket; 596 bucket->displayBucket_ = nextBucket;
598 continue; 597 continue;
599 } 598 }
600 } 599 }
601 nextBucket = bucket; 600 nextBucket = bucket;
602 } 601 }
603 602
604 LocalPointer<UVector> publicBucketList(new UVector(errorCode)); 603 LocalPointer<UVector> publicBucketList(new UVector(errorCode), errorCode);
605 if (bucketList.isNull()) { 604 if (U_FAILURE(errorCode)) {
606 errorCode = U_MEMORY_ALLOCATION_ERROR;
607 return NULL; 605 return NULL;
608 } 606 }
609 // Do not call publicBucketList->setDeleter(): 607 // Do not call publicBucketList->setDeleter():
610 // This vector shares its objects with the bucketList. 608 // This vector shares its objects with the bucketList.
611 for (int32_t i = 0; i < bucketList->size(); ++i) { 609 for (int32_t i = 0; i < bucketList->size(); ++i) {
612 bucket = getBucket(*bucketList, i); 610 bucket = getBucket(*bucketList, i);
613 if (bucket->displayBucket_ == NULL) { 611 if (bucket->displayBucket_ == NULL) {
614 publicBucketList->addElement(bucket, errorCode); 612 publicBucketList->addElement(bucket, errorCode);
615 } 613 }
616 } 614 }
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 const AlphabeticIndex::Record *rightRec = static_cast<const AlphabeticIndex: :Record *>(rightElement->pointer); 981 const AlphabeticIndex::Record *rightRec = static_cast<const AlphabeticIndex: :Record *>(rightElement->pointer);
984 const Collator *col = static_cast<const Collator *>(context); 982 const Collator *col = static_cast<const Collator *>(context);
985 UErrorCode errorCode = U_ZERO_ERROR; 983 UErrorCode errorCode = U_ZERO_ERROR;
986 return col->compare(leftRec->name_, rightRec->name_, errorCode); 984 return col->compare(leftRec->name_, rightRec->name_, errorCode);
987 } 985 }
988 986
989 UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) { 987 UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) {
990 if (U_FAILURE(status)) { 988 if (U_FAILURE(status)) {
991 return NULL; 989 return NULL;
992 } 990 }
993 LocalPointer<UVector> dest(new UVector(status)); 991 LocalPointer<UVector> dest(new UVector(status), status);
994 if (dest.isNull()) { 992 if (U_FAILURE(status)) {
995 status = U_MEMORY_ALLOCATION_ERROR;
996 return NULL; 993 return NULL;
997 } 994 }
998 dest->setDeleter(uprv_deleteUObject); 995 dest->setDeleter(uprv_deleteUObject);
999 // Fetch the script-first-primary contractions which are defined in the root collator. 996 // Fetch the script-first-primary contractions which are defined in the root collator.
1000 // They all start with U+FDD1. 997 // They all start with U+FDD1.
1001 UnicodeSet set; 998 UnicodeSet set;
1002 collatorPrimaryOnly_->internalAddContractions(0xFDD1, set, status); 999 collatorPrimaryOnly_->internalAddContractions(0xFDD1, set, status);
1003 if (U_FAILURE(status)) { 1000 if (U_FAILURE(status)) {
1004 return NULL; 1001 return NULL;
1005 } 1002 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 } 1237 }
1241 1238
1242 1239
1243 AlphabeticIndex::Bucket::~Bucket() { 1240 AlphabeticIndex::Bucket::~Bucket() {
1244 delete records_; 1241 delete records_;
1245 } 1242 }
1246 1243
1247 U_NAMESPACE_END 1244 U_NAMESPACE_END
1248 1245
1249 #endif // !UCONFIG_NO_COLLATION 1246 #endif // !UCONFIG_NO_COLLATION
OLDNEW
« no previous file with comments | « source/i18n/affixpatternparser.cpp ('k') | source/i18n/brktrans.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698