| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -433,6 +433,34 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| 433 | 433 | ||
| 434 | 434 | ---------------------------------------------------------------------- | |
| 435 | 435 | ||
| 436 | + JSON parsing library (nlohmann/json) | ||
| 437 | + | ||
| 438 | + File: vendor/json/upstream/single_include/nlohmann/json.hpp (only for ICU4C) | ||
| 439 | + | ||
| 440 | + MIT License | ||
| 441 | + | ||
| 442 | + Copyright (c) 2013-2022 Niels Lohmann | ||
| 443 | + | ||
| 444 | + Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 445 | + of this software and associated documentation files (the "Software"), to deal | ||
| 446 | + in the Software without restriction, including without limitation the rights | ||
| 447 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 448 | + copies of the Software, and to permit persons to whom the Software is | ||
| 449 | + furnished to do so, subject to the following conditions: | ||
| 450 | + | ||
| 451 | + The above copyright notice and this permission notice shall be included in all | ||
| 452 | + copies or substantial portions of the Software. | ||
| 453 | + | ||
| 454 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 455 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 456 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 457 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 458 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 459 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 460 | + SOFTWARE. | ||
| 461 | + | ||
| 462 | + ---------------------------------------------------------------------- | ||
| 463 | + | ||
| 436 | 464 | File: aclocal.m4 (only for ICU4C) | |
| 437 | 465 | Section: pkg.m4 - Macros to locate and utilise pkg-config. | |
| 438 | 466 | ||
@@ -473,7 +501,7 @@ File: config.guess (only for ICU4C) | |||
| 473 | 501 | ||
| 474 | 502 | This file is free software; you can redistribute it and/or modify it | |
| 475 | 503 | under the terms of the GNU General Public License as published by | |
| 476 | - the Free Software Foundation; either version 3 of the License, or | ||
| 504 | + the Free Software Foundation, either version 3 of the License, or | ||
| 477 | 505 | (at your option) any later version. | |
| 478 | 506 | ||
| 479 | 507 | This program is distributed in the hope that it will be useful, but | |
| 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 75 source files with the following exception(s): | ||
| 5 | - * deps/icu-small/source/data/in/icudt75l.dat.bz2 : compressed data file | ||
| 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 | ||
| 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 | |
|---|---|---|---|
@@ -25,7 +25,7 @@ Appendable::~Appendable() {} | |||
| 25 | 25 | UBool | |
| 26 | 26 | Appendable::appendCodePoint(UChar32 c) { | |
| 27 | 27 | if(c<=0xffff) { | |
| 28 | - return appendCodeUnit((char16_t)c); | ||
| 28 | + return appendCodeUnit(static_cast<char16_t>(c)); | ||
| 29 | 29 | } else { | |
| 30 | 30 | return appendCodeUnit(U16_LEAD(c)) && appendCodeUnit(U16_TRAIL(c)); | |
| 31 | 31 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,7 +75,7 @@ static void set32x64Bits(uint32_t table[64], int32_t start, int32_t limit) { | |||
| 75 | 75 | int32_t trail=start&0x3f; // Named for UTF-8 2-byte trail byte with lower 6 bits. | |
| 76 | 76 | ||
| 77 | 77 | // Set one bit indicating an all-one block. | |
| 78 | - uint32_t bits=(uint32_t)1<<lead; | ||
| 78 | + uint32_t bits = static_cast<uint32_t>(1) << lead; | ||
| 79 | 79 | if((start+1)==limit) { // Single-character shortcut. | |
| 80 | 80 | table[trail]|=bits; | |
| 81 | 81 | return; | |
@@ -100,9 +100,9 @@ static void set32x64Bits(uint32_t table[64], int32_t start, int32_t limit) { | |||
| 100 | 100 | ++lead; | |
| 101 | 101 | } | |
| 102 | 102 | if(lead<limitLead) { | |
| 103 | - bits=~(((unsigned)1<<lead)-1); | ||
| 103 | + bits = ~((static_cast<unsigned>(1) << lead) - 1); | ||
| 104 | 104 | if(limitLead<0x20) { | |
| 105 | - bits&=((unsigned)1<<limitLead)-1; | ||
| 105 | + bits &= (static_cast<unsigned>(1) << limitLead) - 1; | ||
| 106 | 106 | } | |
| 107 | 107 | for(trail=0; trail<64; ++trail) { | |
| 108 | 108 | table[trail]|=bits; | |
@@ -111,7 +111,7 @@ static void set32x64Bits(uint32_t table[64], int32_t start, int32_t limit) { | |||
| 111 | 111 | // limit<=0x800. If limit==0x800 then limitLead=32 and limitTrail=0. | |
| 112 | 112 | // In that case, bits=1<<limitLead is undefined but the bits value | |
| 113 | 113 | // is not used because trail<limitTrail is already false. | |
| 114 | - bits=(uint32_t)1<<((limitLead == 0x20) ? (limitLead - 1) : limitLead); | ||
| 114 | + bits = static_cast<uint32_t>(1) << ((limitLead == 0x20) ? (limitLead - 1) : limitLead); | ||
| 115 | 115 | for(trail=0; trail<limitTrail; ++trail) { | |
| 116 | 116 | table[trail]|=bits; | |
| 117 | 117 | } | |
@@ -290,22 +290,22 @@ int32_t BMPSet::findCodePoint(UChar32 c, int32_t lo, int32_t hi) const { | |||
| 290 | 290 | ||
| 291 | 291 | UBool | |
| 292 | 292 | BMPSet::contains(UChar32 c) const { | |
| 293 | - if((uint32_t)c<=0xff) { | ||
| 294 | - return (UBool)latin1Contains[c]; | ||
| 295 | - } else if((uint32_t)c<=0x7ff) { | ||
| 296 | - return (UBool)((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))!=0); | ||
| 297 | - } else if((uint32_t)c<0xd800 || (c>=0xe000 && c<=0xffff)) { | ||
| 293 | + if (static_cast<uint32_t>(c) <= 0xff) { | ||
| 294 | + return latin1Contains[c]; | ||
| 295 | + } else if (static_cast<uint32_t>(c) <= 0x7ff) { | ||
| 296 | + return (table7FF[c & 0x3f] & (static_cast<uint32_t>(1) << (c >> 6))) != 0; | ||
| 297 | + } else if (static_cast<uint32_t>(c) < 0xd800 || (c >= 0xe000 && c <= 0xffff)) { | ||
| 298 | 298 | int lead=c>>12; | |
| 299 | 299 | uint32_t twoBits=(bmpBlockBits[(c>>6)&0x3f]>>lead)&0x10001; | |
| 300 | 300 | if(twoBits<=1) { | |
| 301 | 301 | // All 64 code points with the same bits 15..6 | |
| 302 | 302 | // are either in the set or not. | |
| 303 | - return (UBool)twoBits; | ||
| 303 | + return twoBits; | ||
| 304 | 304 | } else { | |
| 305 | 305 | // Look up the code point in its 4k block of code points. | |
| 306 | 306 | return containsSlow(c, list4kStarts[lead], list4kStarts[lead+1]); | |
| 307 | 307 | } | |
| 308 | - } else if((uint32_t)c<=0x10ffff) { | ||
| 308 | + } else if (static_cast<uint32_t>(c) <= 0x10ffff) { | ||
| 309 | 309 | // surrogate or supplementary code point | |
| 310 | 310 | return containsSlow(c, list4kStarts[0xd], list4kStarts[0x11]); | |
| 311 | 311 | } else { | |
@@ -332,7 +332,7 @@ BMPSet::span(const char16_t *s, const char16_t *limit, USetSpanCondition spanCon | |||
| 332 | 332 | break; | |
| 333 | 333 | } | |
| 334 | 334 | } else if(c<=0x7ff) { | |
| 335 | - if((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))==0) { | ||
| 335 | + if ((table7FF[c & 0x3f] & (static_cast<uint32_t>(1) << (c >> 6))) == 0) { | ||
| 336 | 336 | break; | |
| 337 | 337 | } | |
| 338 | 338 | } else if(c<0xd800 || c>=0xe000) { | |
@@ -372,7 +372,7 @@ BMPSet::span(const char16_t *s, const char16_t *limit, USetSpanCondition spanCon | |||
| 372 | 372 | break; | |
| 373 | 373 | } | |
| 374 | 374 | } else if(c<=0x7ff) { | |
| 375 | - if((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))!=0) { | ||
| 375 | + if ((table7FF[c & 0x3f] & (static_cast<uint32_t>(1) << (c >> 6))) != 0) { | ||
| 376 | 376 | break; | |
| 377 | 377 | } | |
| 378 | 378 | } else if(c<0xd800 || c>=0xe000) { | |
@@ -421,7 +421,7 @@ BMPSet::spanBack(const char16_t *s, const char16_t *limit, USetSpanCondition spa | |||
| 421 | 421 | break; | |
| 422 | 422 | } | |
| 423 | 423 | } else if(c<=0x7ff) { | |
| 424 | - if((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))==0) { | ||
| 424 | + if ((table7FF[c & 0x3f] & (static_cast<uint32_t>(1) << (c >> 6))) == 0) { | ||
| 425 | 425 | break; | |
| 426 | 426 | } | |
| 427 | 427 | } else if(c<0xd800 || c>=0xe000) { | |
@@ -464,7 +464,7 @@ BMPSet::spanBack(const char16_t *s, const char16_t *limit, USetSpanCondition spa | |||
| 464 | 464 | break; | |
| 465 | 465 | } | |
| 466 | 466 | } else if(c<=0x7ff) { | |
| 467 | - if((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))!=0) { | ||
| 467 | + if ((table7FF[c & 0x3f] & (static_cast<uint32_t>(1) << (c >> 6))) != 0) { | ||
| 468 | 468 | break; | |
| 469 | 469 | } | |
| 470 | 470 | } else if(c<0xd800 || c>=0xe000) { | |
@@ -527,7 +527,7 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi | |||
| 527 | 527 | b=*s; | |
| 528 | 528 | } while(U8_IS_SINGLE(b)); | |
| 529 | 529 | } | |
| 530 | - length=(int32_t)(limit-s); | ||
| 530 | + length = static_cast<int32_t>(limit - s); | ||
| 531 | 531 | } | |
| 532 | 532 | ||
| 533 | 533 | if(spanCondition!=USET_SPAN_NOT_CONTAINED) { | |
@@ -547,7 +547,7 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi | |||
| 547 | 547 | * the truncated sequence. | |
| 548 | 548 | */ | |
| 549 | 549 | b=*(limit-1); | |
| 550 | - if((int8_t)b<0) { | ||
| 550 | + if (static_cast<int8_t>(b) < 0) { | ||
| 551 | 551 | // b>=0x80: lead or trail byte | |
| 552 | 552 | if(b<0xc0) { | |
| 553 | 553 | // single trail byte, check for preceding 3- or 4-byte lead byte | |
@@ -602,15 +602,15 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi | |||
| 602 | 602 | if(b>=0xe0) { | |
| 603 | 603 | if(b<0xf0) { | |
| 604 | 604 | if( /* handle U+0000..U+FFFF inline */ | |
| 605 | - (t1=(uint8_t)(s[0]-0x80)) <= 0x3f && | ||
| 606 | - (t2=(uint8_t)(s[1]-0x80)) <= 0x3f | ||
| 605 | + (t1 = static_cast<uint8_t>(s[0] - 0x80)) <= 0x3f && | ||
| 606 | + (t2 = static_cast<uint8_t>(s[1] - 0x80)) <= 0x3f | ||
| 607 | 607 | ) { | |
| 608 | 608 | b&=0xf; | |
| 609 | 609 | uint32_t twoBits=(bmpBlockBits[t1]>>b)&0x10001; | |
| 610 | 610 | if(twoBits<=1) { | |
| 611 | 611 | // All 64 code points with this lead byte and middle trail byte | |
| 612 | 612 | // are either in the set or not. | |
| 613 | - if(twoBits!=(uint32_t)spanCondition) { | ||
| 613 | + if (twoBits != static_cast<uint32_t>(spanCondition)) { | ||
| 614 | 614 | return s-1; | |
| 615 | 615 | } | |
| 616 | 616 | } else { | |
@@ -624,12 +624,12 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi | |||
| 624 | 624 | continue; | |
| 625 | 625 | } | |
| 626 | 626 | } else if( /* handle U+10000..U+10FFFF inline */ | |
| 627 | - (t1=(uint8_t)(s[0]-0x80)) <= 0x3f && | ||
| 628 | - (t2=(uint8_t)(s[1]-0x80)) <= 0x3f && | ||
| 629 | - (t3=(uint8_t)(s[2]-0x80)) <= 0x3f | ||
| 627 | + (t1 = static_cast<uint8_t>(s[0] - 0x80)) <= 0x3f && | ||
| 628 | + (t2 = static_cast<uint8_t>(s[1] - 0x80)) <= 0x3f && | ||
| 629 | + (t3 = static_cast<uint8_t>(s[2] - 0x80)) <= 0x3f | ||
| 630 | 630 | ) { | |
| 631 | 631 | // Give an illegal sequence the same value as the result of contains(FFFD). | |
| 632 | - UChar32 c=((UChar32)(b-0xf0)<<18)|((UChar32)t1<<12)|(t2<<6)|t3; | ||
| 632 | + UChar32 c = (static_cast<UChar32>(b - 0xf0) << 18) | (static_cast<UChar32>(t1) << 12) | (t2 << 6) | t3; | ||
| 633 | 633 | if( ( (0x10000<=c && c<=0x10ffff) ? | |
| 634 | 634 | containsSlow(c, list4kStarts[0x10], list4kStarts[0x11]) : | |
| 635 | 635 | containsFFFD | |
@@ -643,9 +643,9 @@ BMPSet::spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanConditi | |||
| 643 | 643 | } else { | |
| 644 | 644 | if( /* handle U+0000..U+07FF inline */ | |
| 645 | 645 | b>=0xc0 && | |
| 646 | - (t1=(uint8_t)(*s-0x80)) <= 0x3f | ||
| 646 | + (t1 = static_cast<uint8_t>(*s - 0x80)) <= 0x3f | ||
| 647 | 647 | ) { | |
| 648 | - if((USetSpanCondition)((table7FF[t1]&((uint32_t)1<<(b&0x1f)))!=0) != spanCondition) { | ||
| 648 | + if (static_cast<USetSpanCondition>((table7FF[t1] & (static_cast<uint32_t>(1) << (b & 0x1f))) != 0) != spanCondition) { | ||
| 649 | 649 | return s-1; | |
| 650 | 650 | } | |
| 651 | 651 | ++s; | |
@@ -711,7 +711,7 @@ BMPSet::spanBackUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCon | |||
| 711 | 711 | c=utf8_prevCharSafeBody(s, 0, &length, b, -3); | |
| 712 | 712 | // c is a valid code point, not ASCII, not a surrogate | |
| 713 | 713 | if(c<=0x7ff) { | |
| 714 | - if((USetSpanCondition)((table7FF[c&0x3f]&((uint32_t)1<<(c>>6)))!=0) != spanCondition) { | ||
| 714 | + if (static_cast<USetSpanCondition>((table7FF[c & 0x3f] & (static_cast<uint32_t>(1) << (c >> 6))) != 0) != spanCondition) { | ||
| 715 | 715 | return prev+1; | |
| 716 | 716 | } | |
| 717 | 717 | } else if(c<=0xffff) { | |
@@ -720,7 +720,7 @@ BMPSet::spanBackUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCon | |||
| 720 | 720 | if(twoBits<=1) { | |
| 721 | 721 | // All 64 code points with the same bits 15..6 | |
| 722 | 722 | // are either in the set or not. | |
| 723 | - if(twoBits!=(uint32_t)spanCondition) { | ||
| 723 | + if (twoBits != static_cast<uint32_t>(spanCondition)) { | ||
| 724 | 724 | return prev+1; | |
| 725 | 725 | } | |
| 726 | 726 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -156,7 +156,7 @@ class BMPSet : public UMemory { | |||
| 156 | 156 | }; | |
| 157 | 157 | ||
| 158 | 158 | inline UBool BMPSet::containsSlow(UChar32 c, int32_t lo, int32_t hi) const { | |
| 159 | - return (UBool)(findCodePoint(c, lo, hi) & 1); | ||
| 159 | + return findCodePoint(c, lo, hi) & 1; | ||
| 160 | 160 | } | |
| 161 | 161 | ||
| 162 | 162 | U_NAMESPACE_END | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,7 +86,7 @@ UnhandledEngine::findBreaks( UText *text, | |||
| 86 | 86 | if (U_FAILURE(status)) return 0; | |
| 87 | 87 | utext_setNativeIndex(text, startPos); | |
| 88 | 88 | UChar32 c = utext_current32(text); | |
| 89 | - while((int32_t)utext_getNativeIndex(text) < endPos && fHandled->contains(c)) { | ||
| 89 | + while (static_cast<int32_t>(utext_getNativeIndex(text)) < endPos && fHandled->contains(c)) { | ||
| 90 | 90 | utext_next32(text); // TODO: recast loop to work with post-increment operations. | |
| 91 | 91 | c = utext_current32(text); | |
| 92 | 92 | } | |
@@ -146,7 +146,7 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c, const char* locale) { | |||
| 146 | 146 | Mutex m(&gBreakEngineMutex); | |
| 147 | 147 | int32_t i = fEngines->size(); | |
| 148 | 148 | while (--i >= 0) { | |
| 149 | - lbe = (const LanguageBreakEngine *)(fEngines->elementAt(i)); | ||
| 149 | + lbe = static_cast<const LanguageBreakEngine*>(fEngines->elementAt(i)); | ||
| 150 | 150 | if (lbe != nullptr && lbe->handles(c, locale)) { | |
| 151 | 151 | return lbe; | |
| 152 | 152 | } | |
@@ -259,7 +259,7 @@ ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) { | |||
| 259 | 259 | CharString ext; | |
| 260 | 260 | const char16_t *extStart = u_memrchr(dictfname, 0x002e, dictnlength); // last dot | |
| 261 | 261 | if (extStart != nullptr) { | |
| 262 | - int32_t len = (int32_t)(extStart - dictfname); | ||
| 262 | + int32_t len = static_cast<int32_t>(extStart - dictfname); | ||
| 263 | 263 | ext.appendInvariantChars(UnicodeString(false, extStart + 1, dictnlength - len - 1), status); | |
| 264 | 264 | dictnlength = len; | |
| 265 | 265 | } | |
@@ -269,18 +269,18 @@ ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) { | |||
| 269 | 269 | UDataMemory *file = udata_open(U_ICUDATA_BRKITR, ext.data(), dictnbuf.data(), &status); | |
| 270 | 270 | if (U_SUCCESS(status)) { | |
| 271 | 271 | // build trie | |
| 272 | - const uint8_t *data = (const uint8_t *)udata_getMemory(file); | ||
| 273 | - const int32_t *indexes = (const int32_t *)data; | ||
| 272 | + const uint8_t* data = static_cast<const uint8_t*>(udata_getMemory(file)); | ||
| 273 | + const int32_t* indexes = reinterpret_cast<const int32_t*>(data); | ||
| 274 | 274 | const int32_t offset = indexes[DictionaryData::IX_STRING_TRIE_OFFSET]; | |
| 275 | 275 | const int32_t trieType = indexes[DictionaryData::IX_TRIE_TYPE] & DictionaryData::TRIE_TYPE_MASK; | |
| 276 | 276 | DictionaryMatcher *m = nullptr; | |
| 277 | 277 | if (trieType == DictionaryData::TRIE_TYPE_BYTES) { | |
| 278 | 278 | const int32_t transform = indexes[DictionaryData::IX_TRANSFORM]; | |
| 279 | - const char *characters = (const char *)(data + offset); | ||
| 279 | + const char* characters = reinterpret_cast<const char*>(data + offset); | ||
| 280 | 280 | m = new BytesDictionaryMatcher(characters, transform, file); | |
| 281 | 281 | } | |
| 282 | 282 | else if (trieType == DictionaryData::TRIE_TYPE_UCHARS) { | |
| 283 | - const char16_t *characters = (const char16_t *)(data + offset); | ||
| 283 | + const char16_t* characters = reinterpret_cast<const char16_t*>(data + offset); | ||
| 284 | 284 | m = new UCharsDictionaryMatcher(characters, file); | |
| 285 | 285 | } | |
| 286 | 286 | if (m == nullptr) { | |
@@ -337,12 +337,12 @@ int32_t BreakEngineWrapper::findBreaks( | |||
| 337 | 337 | // extends towards the start or end of the text, depending on 'reverse'. | |
| 338 | 338 | ||
| 339 | 339 | utext_setNativeIndex(text, startPos); | |
| 340 | - int32_t start = (int32_t)utext_getNativeIndex(text); | ||
| 340 | + int32_t start = static_cast<int32_t>(utext_getNativeIndex(text)); | ||
| 341 | 341 | int32_t current; | |
| 342 | 342 | int32_t rangeStart; | |
| 343 | 343 | int32_t rangeEnd; | |
| 344 | 344 | UChar32 c = utext_current32(text); | |
| 345 | - while((current = (int32_t)utext_getNativeIndex(text)) < endPos && delegate->handles(c)) { | ||
| 345 | + while ((current = static_cast<int32_t>(utext_getNativeIndex(text))) < endPos && delegate->handles(c)) { | ||
| 346 | 346 | utext_next32(text); // TODO: recast loop for postincrement | |
| 347 | 347 | c = utext_current32(text); | |
| 348 | 348 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,7 +85,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st | |||
| 85 | 85 | // Get the actual string | |
| 86 | 86 | brkfname = ures_getString(brkName, &size, &status); | |
| 87 | 87 | U_ASSERT((size_t)size<sizeof(fnbuff)); | |
| 88 | - if ((size_t)size>=sizeof(fnbuff)) { | ||
| 88 | + if (static_cast<size_t>(size) >= sizeof(fnbuff)) { | ||
| 89 | 89 | size=0; | |
| 90 | 90 | if (U_SUCCESS(status)) { | |
| 91 | 91 | status = U_BUFFER_OVERFLOW_ERROR; | |
@@ -99,7 +99,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st | |||
| 99 | 99 | char16_t* extStart=u_strchr(brkfname, 0x002e); | |
| 100 | 100 | int len = 0; | |
| 101 | 101 | if (extStart != nullptr){ | |
| 102 | - len = (int)(extStart-brkfname); | ||
| 102 | + len = static_cast<int>(extStart - brkfname); | ||
| 103 | 103 | u_UCharsToChars(extStart+1, ext, sizeof(ext)); // nul terminates the buff | |
| 104 | 104 | u_UCharsToChars(brkfname, fnbuff, len); | |
| 105 | 105 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,7 +64,7 @@ ByteSinkUtil::appendChange(const uint8_t *s, const uint8_t *limit, | |||
| 64 | 64 | errorCode = U_INDEX_OUTOFBOUNDS_ERROR; | |
| 65 | 65 | return false; | |
| 66 | 66 | } | |
| 67 | - return appendChange((int32_t)(limit - s), s16, s16Length, sink, edits, errorCode); | ||
| 67 | + return appendChange(static_cast<int32_t>(limit - s), s16, s16Length, sink, edits, errorCode); | ||
| 68 | 68 | } | |
| 69 | 69 | ||
| 70 | 70 | void | |
@@ -81,15 +81,15 @@ ByteSinkUtil::appendCodePoint(int32_t length, UChar32 c, ByteSink &sink, Edits * | |||
| 81 | 81 | namespace { | |
| 82 | 82 | ||
| 83 | 83 | // See unicode/utf8.h U8_APPEND_UNSAFE(). | |
| 84 | - inline uint8_t getTwoByteLead(UChar32 c) { return (uint8_t)((c >> 6) | 0xc0); } | ||
| 85 | - inline uint8_t getTwoByteTrail(UChar32 c) { return (uint8_t)((c & 0x3f) | 0x80); } | ||
| 84 | + inline uint8_t getTwoByteLead(UChar32 c) { return static_cast<uint8_t>((c >> 6) | 0xc0); } | ||
| 85 | + inline uint8_t getTwoByteTrail(UChar32 c) { return static_cast<uint8_t>((c & 0x3f) | 0x80); } | ||
| 86 | 86 | ||
| 87 | 87 | } // namespace | |
| 88 | 88 | ||
| 89 | 89 | void | |
| 90 | 90 | ByteSinkUtil::appendTwoBytes(UChar32 c, ByteSink &sink) { | |
| 91 | 91 | U_ASSERT(0x80 <= c && c <= 0x7ff); // 2-byte UTF-8 | |
| 92 | - char s8[2] = { (char)getTwoByteLead(c), (char)getTwoByteTrail(c) }; | ||
| 92 | + char s8[2] = {static_cast<char>(getTwoByteLead(c)), static_cast<char>(getTwoByteTrail(c))}; | ||
| 93 | 93 | sink.Append(s8, 2); | |
| 94 | 94 | } | |
| 95 | 95 | ||
@@ -114,7 +114,7 @@ ByteSinkUtil::appendUnchanged(const uint8_t *s, const uint8_t *limit, | |||
| 114 | 114 | errorCode = U_INDEX_OUTOFBOUNDS_ERROR; | |
| 115 | 115 | return false; | |
| 116 | 116 | } | |
| 117 | - int32_t length = (int32_t)(limit - s); | ||
| 117 | + int32_t length = static_cast<int32_t>(limit - s); | ||
| 118 | 118 | if (length > 0) { | |
| 119 | 119 | appendNonEmptyUnchanged(s, length, sink, options, edits); | |
| 120 | 120 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,7 +73,7 @@ class U_COMMON_API ByteSinkUtil { | |||
| 73 | 73 | /** The few bytes at [src, nextSrc[ were mapped/changed to valid code point c. */ | |
| 74 | 74 | static inline void appendCodePoint(const uint8_t *src, const uint8_t *nextSrc, UChar32 c, | |
| 75 | 75 | ByteSink &sink, Edits *edits = nullptr) { | |
| 76 | - appendCodePoint((int32_t)(nextSrc - src), c, sink, edits); | ||
| 76 | + appendCodePoint(static_cast<int32_t>(nextSrc - src), c, sink, edits); | ||
| 77 | 77 | } | |
| 78 | 78 | ||
| 79 | 79 | /** Append the two-byte character (U+0080..U+07FF). */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments