| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0c0f7fe commit 0be9fa3
145 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ UNICODE LICENSE V3 | |||
| 2 | 2 | ||
| 3 | 3 | COPYRIGHT AND PERMISSION NOTICE | |
| 4 | 4 | ||
| 5 | - Copyright © 2016-2024 Unicode, Inc. | ||
| 5 | + Copyright © 2016-2025 Unicode, Inc. | ||
| 6 | 6 | ||
| 7 | 7 | NOTICE TO USER: Carefully read the following legal agreement. BY | |
| 8 | 8 | DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,8 @@ | |||
| 1 | 1 | ICU sources - auto generated by shrink-icu-src.py | |
| 2 | 2 | ||
| 3 | 3 | This directory contains the ICU subset used by --with-intl=full-icu | |
| 4 | - It is a strict subset of ICU 76 source files with the following exception(s): | ||
| 5 | - * deps/icu-small/source/data/in/icudt76l.dat.bz2 : compressed data file | ||
| 4 | + It is a strict subset of ICU 77 source files with the following exception(s): | ||
| 5 | + * deps/icu-small/source/data/in/icudt77l.dat.bz2 : compressed data file | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | To rebuild this directory, see ../../tools/icu/README.md | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,7 +59,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st | |||
| 59 | 59 | { | |
| 60 | 60 | char fnbuff[256]; | |
| 61 | 61 | char ext[4]={'\0'}; | |
| 62 | - CharString actualLocale; | ||
| 62 | + CharString actual; | ||
| 63 | 63 | int32_t size; | |
| 64 | 64 | const char16_t* brkfname = nullptr; | |
| 65 | 65 | UResourceBundle brkRulesStack; | |
@@ -94,7 +94,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st | |||
| 94 | 94 | ||
| 95 | 95 | // Use the string if we found it | |
| 96 | 96 | if (U_SUCCESS(status) && brkfname) { | |
| 97 | - actualLocale.append(ures_getLocaleInternal(brkName, &status), -1, status); | ||
| 97 | + actual.append(ures_getLocaleInternal(brkName, &status), -1, status); | ||
| 98 | 98 | ||
| 99 | 99 | char16_t* extStart=u_strchr(brkfname, 0x002e); | |
| 100 | 100 | int len = 0; | |
@@ -123,10 +123,9 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st | |||
| 123 | 123 | if (U_SUCCESS(status) && result != nullptr) { | |
| 124 | 124 | U_LOCALE_BASED(locBased, *(BreakIterator*)result); | |
| 125 | 125 | ||
| 126 | - locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status), | ||
| 127 | - actualLocale.data()); | ||
| 128 | - uprv_strncpy(result->requestLocale, loc.getName(), ULOC_FULLNAME_CAPACITY); | ||
| 129 | - result->requestLocale[ULOC_FULLNAME_CAPACITY-1] = 0; // always terminate | ||
| 126 | + locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status), | ||
| 127 | + actual.data(), status); | ||
| 128 | + LocaleBased::setLocaleID(loc.getName(), result->requestLocale, status); | ||
| 130 | 129 | } | |
| 131 | 130 | ||
| 132 | 131 | ures_close(b); | |
@@ -206,26 +205,32 @@ BreakIterator::getAvailableLocales(int32_t& count) | |||
| 206 | 205 | ||
| 207 | 206 | BreakIterator::BreakIterator() | |
| 208 | 207 | { | |
| 209 | - *validLocale = *actualLocale = *requestLocale = 0; | ||
| 210 | 208 | } | |
| 211 | 209 | ||
| 212 | 210 | BreakIterator::BreakIterator(const BreakIterator &other) : UObject(other) { | |
| 213 | - uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale)); | ||
| 214 | - uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale)); | ||
| 215 | - uprv_strncpy(requestLocale, other.requestLocale, sizeof(requestLocale)); | ||
| 211 | + UErrorCode status = U_ZERO_ERROR; | ||
| 212 | + U_LOCALE_BASED(locBased, *this); | ||
| 213 | + locBased.setLocaleIDs(other.validLocale, other.actualLocale, status); | ||
| 214 | + LocaleBased::setLocaleID(other.requestLocale, requestLocale, status); | ||
| 215 | + U_ASSERT(U_SUCCESS(status)); | ||
| 216 | 216 | } | |
| 217 | 217 | ||
| 218 | 218 | BreakIterator &BreakIterator::operator =(const BreakIterator &other) { | |
| 219 | 219 | if (this != &other) { | |
| 220 | - uprv_strncpy(actualLocale, other.actualLocale, sizeof(actualLocale)); | ||
| 221 | - uprv_strncpy(validLocale, other.validLocale, sizeof(validLocale)); | ||
| 222 | - uprv_strncpy(requestLocale, other.requestLocale, sizeof(requestLocale)); | ||
| 220 | + UErrorCode status = U_ZERO_ERROR; | ||
| 221 | + U_LOCALE_BASED(locBased, *this); | ||
| 222 | + locBased.setLocaleIDs(other.validLocale, other.actualLocale, status); | ||
| 223 | + LocaleBased::setLocaleID(other.requestLocale, requestLocale, status); | ||
| 224 | + U_ASSERT(U_SUCCESS(status)); | ||
| 223 | 225 | } | |
| 224 | 226 | return *this; | |
| 225 | 227 | } | |
| 226 | 228 | ||
| 227 | 229 | BreakIterator::~BreakIterator() | |
| 228 | 230 | { | |
| 231 | + delete validLocale; | ||
| 232 | + delete actualLocale; | ||
| 233 | + delete requestLocale; | ||
| 229 | 234 | } | |
| 230 | 235 | ||
| 231 | 236 | // ------------------------------------------ | |
@@ -394,7 +399,7 @@ BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& statu | |||
| 394 | 399 | // revisit this in ICU 3.0 and clean it up/fix it/remove it. | |
| 395 | 400 | if (U_SUCCESS(status) && (result != nullptr) && *actualLoc.getName() != 0) { | |
| 396 | 401 | U_LOCALE_BASED(locBased, *result); | |
| 397 | - locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName()); | ||
| 402 | + locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName(), status); | ||
| 398 | 403 | } | |
| 399 | 404 | return result; | |
| 400 | 405 | } | |
@@ -488,6 +493,7 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status) | |||
| 488 | 493 | } | |
| 489 | 494 | ||
| 490 | 495 | if (U_FAILURE(status)) { | |
| 496 | + delete result; | ||
| 491 | 497 | return nullptr; | |
| 492 | 498 | } | |
| 493 | 499 | ||
@@ -496,20 +502,25 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status) | |||
| 496 | 502 | ||
| 497 | 503 | Locale | |
| 498 | 504 | BreakIterator::getLocale(ULocDataLocaleType type, UErrorCode& status) const { | |
| 505 | + if (U_FAILURE(status)) { | ||
| 506 | + return Locale::getRoot(); | ||
| 507 | + } | ||
| 499 | 508 | if (type == ULOC_REQUESTED_LOCALE) { | |
| 500 | - return {requestLocale}; | ||
| 509 | + return requestLocale == nullptr ? | ||
| 510 | + Locale::getRoot() : Locale(requestLocale->data()); | ||
| 501 | 511 | } | |
| 502 | - U_LOCALE_BASED(locBased, *this); | ||
| 503 | - return locBased.getLocale(type, status); | ||
| 512 | + return LocaleBased::getLocale(validLocale, actualLocale, type, status); | ||
| 504 | 513 | } | |
| 505 | 514 | ||
| 506 | 515 | const char * | |
| 507 | 516 | BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const { | |
| 517 | + if (U_FAILURE(status)) { | ||
| 518 | + return nullptr; | ||
| 519 | + } | ||
| 508 | 520 | if (type == ULOC_REQUESTED_LOCALE) { | |
| 509 | - return requestLocale; | ||
| 521 | + return requestLocale == nullptr ? "" : requestLocale->data(); | ||
| 510 | 522 | } | |
| 511 | - U_LOCALE_BASED(locBased, *this); | ||
| 512 | - return locBased.getLocaleID(type, status); | ||
| 523 | + return LocaleBased::getLocaleID(validLocale, actualLocale, type, status); | ||
| 513 | 524 | } | |
| 514 | 525 | ||
| 515 | 526 | ||
@@ -536,8 +547,10 @@ int32_t BreakIterator::getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UE | |||
| 536 | 547 | } | |
| 537 | 548 | ||
| 538 | 549 | BreakIterator::BreakIterator (const Locale& valid, const Locale& actual) { | |
| 550 | + UErrorCode status = U_ZERO_ERROR; | ||
| 539 | 551 | U_LOCALE_BASED(locBased, (*this)); | |
| 540 | - locBased.setLocaleIDs(valid, actual); | ||
| 552 | + locBased.setLocaleIDs(valid.getName(), actual.getName(), status); | ||
| 553 | + U_ASSERT(U_SUCCESS(status)); | ||
| 541 | 554 | } | |
| 542 | 555 | ||
| 543 | 556 | U_NAMESPACE_END | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,6 +70,15 @@ CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) { | |||
| 70 | 70 | return *this; | |
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | + CharString &CharString::copyFrom(StringPiece s, UErrorCode &errorCode) { | ||
| 74 | + if (U_FAILURE(errorCode)) { | ||
| 75 | + return *this; | ||
| 76 | + } | ||
| 77 | + len = 0; | ||
| 78 | + append(s, errorCode); | ||
| 79 | + return *this; | ||
| 80 | + } | ||
| 81 | + | ||
| 73 | 82 | int32_t CharString::lastIndexOf(char c) const { | |
| 74 | 83 | for(int32_t i=len; i>0;) { | |
| 75 | 84 | if(buffer[--i]==c) { | |
@@ -143,7 +152,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error | |||
| 143 | 152 | return *this; | |
| 144 | 153 | } | |
| 145 | 154 | ||
| 146 | - CharString &CharString::appendNumber(int32_t number, UErrorCode &status) { | ||
| 155 | + CharString &CharString::appendNumber(int64_t number, UErrorCode &status) { | ||
| 147 | 156 | if (number < 0) { | |
| 148 | 157 | this->append('-', status); | |
| 149 | 158 | if (U_FAILURE(status)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,6 +74,7 @@ class U_COMMON_API CharString : public UMemory { | |||
| 74 | 74 | * use a UErrorCode where memory allocations might be needed. | |
| 75 | 75 | */ | |
| 76 | 76 | CharString ©From(const CharString &other, UErrorCode &errorCode); | |
| 77 | + CharString ©From(StringPiece s, UErrorCode &errorCode); | ||
| 77 | 78 | ||
| 78 | 79 | UBool isEmpty() const { return len==0; } | |
| 79 | 80 | int32_t length() const { return len; } | |
@@ -135,7 +136,7 @@ class U_COMMON_API CharString : public UMemory { | |||
| 135 | 136 | } | |
| 136 | 137 | CharString &append(const char *s, int32_t sLength, UErrorCode &status); | |
| 137 | 138 | ||
| 138 | - CharString &appendNumber(int32_t number, UErrorCode &status); | ||
| 139 | + CharString &appendNumber(int64_t number, UErrorCode &status); | ||
| 139 | 140 | ||
| 140 | 141 | /** | |
| 141 | 142 | * Returns a writable buffer for appending and writes the buffer's capacity to | |
| Back | FazBrowse Home | New Git URL |
0 commit comments