| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c20eb4f commit e5b51cc
260 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,8 @@ | |||
| 1 | 1 | Small ICU sources - auto generated by shrink-icu-src.py | |
| 2 | 2 | ||
| 3 | 3 | This directory contains the ICU subset used by --with-intl=small-icu (the default) | |
| 4 | - It is a strict subset of ICU 62 source files with the following exception(s): | ||
| 5 | - * deps/icu-small/source/data/in/icudt62l.dat : Reduced-size data file | ||
| 4 | + It is a strict subset of ICU 63 source files with the following exception(s): | ||
| 5 | + * deps/icu-small/source/data/in/icudt63l.dat : Reduced-size 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 | |
|---|---|---|---|
@@ -241,13 +241,13 @@ void BMPSet::overrideIllegal() { | |||
| 241 | 241 | bmpBlockBits[i]|=bits; | |
| 242 | 242 | } | |
| 243 | 243 | ||
| 244 | - mask=~(0x10001<<0xd); // Lead byte 0xED. | ||
| 244 | + mask= static_cast<uint32_t>(~(0x10001<<0xd)); // Lead byte 0xED. | ||
| 245 | 245 | bits=1<<0xd; | |
| 246 | 246 | for(i=32; i<64; ++i) { // Second half of 4k block. | |
| 247 | 247 | bmpBlockBits[i]=(bmpBlockBits[i]&mask)|bits; | |
| 248 | 248 | } | |
| 249 | 249 | } else { | |
| 250 | - mask=~(0x10001<<0xd); // Lead byte 0xED. | ||
| 250 | + mask= static_cast<uint32_t>(~(0x10001<<0xd)); // Lead byte 0xED. | ||
| 251 | 251 | for(i=32; i<64; ++i) { // Second half of 4k block. | |
| 252 | 252 | bmpBlockBits[i]&=mask; | |
| 253 | 253 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,7 @@ | |||
| 11 | 11 | #include "unicode/utf8.h" | |
| 12 | 12 | #include "unicode/utf16.h" | |
| 13 | 13 | #include "bytesinkutil.h" | |
| 14 | + #include "charstr.h" | ||
| 14 | 15 | #include "cmemory.h" | |
| 15 | 16 | #include "uassert.h" | |
| 16 | 17 | ||
@@ -120,4 +121,41 @@ ByteSinkUtil::appendUnchanged(const uint8_t *s, const uint8_t *limit, | |||
| 120 | 121 | return TRUE; | |
| 121 | 122 | } | |
| 122 | 123 | ||
| 124 | + CharStringByteSink::CharStringByteSink(CharString* dest) : dest_(*dest) { | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + CharStringByteSink::~CharStringByteSink() = default; | ||
| 128 | + | ||
| 129 | + void | ||
| 130 | + CharStringByteSink::Append(const char* bytes, int32_t n) { | ||
| 131 | + UErrorCode status = U_ZERO_ERROR; | ||
| 132 | + dest_.append(bytes, n, status); | ||
| 133 | + // Any errors are silently ignored. | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + char* | ||
| 137 | + CharStringByteSink::GetAppendBuffer(int32_t min_capacity, | ||
| 138 | + int32_t desired_capacity_hint, | ||
| 139 | + char* scratch, | ||
| 140 | + int32_t scratch_capacity, | ||
| 141 | + int32_t* result_capacity) { | ||
| 142 | + if (min_capacity < 1 || scratch_capacity < min_capacity) { | ||
| 143 | + *result_capacity = 0; | ||
| 144 | + return nullptr; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + UErrorCode status = U_ZERO_ERROR; | ||
| 148 | + char* result = dest_.getAppendBuffer( | ||
| 149 | + min_capacity, | ||
| 150 | + desired_capacity_hint, | ||
| 151 | + *result_capacity, | ||
| 152 | + status); | ||
| 153 | + if (U_SUCCESS(status)) { | ||
| 154 | + return result; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + *result_capacity = scratch_capacity; | ||
| 158 | + return scratch; | ||
| 159 | + } | ||
| 160 | + | ||
| 123 | 161 | U_NAMESPACE_END | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,7 @@ | |||
| 13 | 13 | U_NAMESPACE_BEGIN | |
| 14 | 14 | ||
| 15 | 15 | class ByteSink; | |
| 16 | + class CharString; | ||
| 16 | 17 | class Edits; | |
| 17 | 18 | ||
| 18 | 19 | class U_COMMON_API ByteSinkUtil { | |
@@ -58,4 +59,25 @@ class U_COMMON_API ByteSinkUtil { | |||
| 58 | 59 | ByteSink &sink, uint32_t options, Edits *edits); | |
| 59 | 60 | }; | |
| 60 | 61 | ||
| 62 | + class CharStringByteSink : public ByteSink { | ||
| 63 | + public: | ||
| 64 | + CharStringByteSink(CharString* dest); | ||
| 65 | + ~CharStringByteSink() override; | ||
| 66 | + | ||
| 67 | + CharStringByteSink() = delete; | ||
| 68 | + CharStringByteSink(const CharStringByteSink&) = delete; | ||
| 69 | + CharStringByteSink& operator=(const CharStringByteSink&) = delete; | ||
| 70 | + | ||
| 71 | + void Append(const char* bytes, int32_t n) override; | ||
| 72 | + | ||
| 73 | + char* GetAppendBuffer(int32_t min_capacity, | ||
| 74 | + int32_t desired_capacity_hint, | ||
| 75 | + char* scratch, | ||
| 76 | + int32_t scratch_capacity, | ||
| 77 | + int32_t* result_capacity) override; | ||
| 78 | + | ||
| 79 | + private: | ||
| 80 | + CharString& dest_; | ||
| 81 | + }; | ||
| 82 | + | ||
| 61 | 83 | U_NAMESPACE_END | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -339,7 +339,8 @@ BytesTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, UChar | |||
| 339 | 339 | ||
| 340 | 340 | BytesTrieBuilder::BTLinearMatchNode::BTLinearMatchNode(const char *bytes, int32_t len, Node *nextNode) | |
| 341 | 341 | : LinearMatchNode(len, nextNode), s(bytes) { | |
| 342 | - hash=hash*37+ustr_hashCharsN(bytes, len); | ||
| 342 | + hash=static_cast<int32_t>( | ||
| 343 | + static_cast<uint32_t>(hash)*37u + static_cast<uint32_t>(ustr_hashCharsN(bytes, len))); | ||
| 343 | 344 | } | |
| 344 | 345 | ||
| 345 | 346 | UBool | |
| Back | FazBrowse Home | New Git URL |
0 commit comments