src: add "icu::" prefix before ICU symbols
In ICU 61.x, icu4c will no longer put its declarations in the global namespace. Everything will be in the "icu::" namespace (or icu_60:: in the linker). Prepare for this. https://ssl.icu-project.org/trac/ticket/13460
This commit is contained in:
parent
9b4aa78f72
commit
b8f47b2757
@ -74,11 +74,11 @@ std::string StringViewToUtf8(const StringView& view) {
|
|||||||
|
|
||||||
size_t result_length = view.length() * sizeof(*source);
|
size_t result_length = view.length() * sizeof(*source);
|
||||||
std::string result(result_length, '\0');
|
std::string result(result_length, '\0');
|
||||||
UnicodeString utf16(unicodeSource, view.length());
|
icu::UnicodeString utf16(unicodeSource, view.length());
|
||||||
// ICU components for std::string compatibility are not enabled in build...
|
// ICU components for std::string compatibility are not enabled in build...
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
CheckedArrayByteSink sink(&result[0], result_length);
|
icu::CheckedArrayByteSink sink(&result[0], result_length);
|
||||||
utf16.toUTF8(sink);
|
utf16.toUTF8(sink);
|
||||||
result_length = sink.NumberOfBytesAppended();
|
result_length = sink.NumberOfBytesAppended();
|
||||||
result.resize(result_length);
|
result.resize(result_length);
|
||||||
@ -111,8 +111,9 @@ void ReleasePairOnAsyncClose(uv_handle_t* async) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::unique_ptr<StringBuffer> Utf8ToStringView(const std::string& message) {
|
std::unique_ptr<StringBuffer> Utf8ToStringView(const std::string& message) {
|
||||||
UnicodeString utf16 =
|
icu::UnicodeString utf16 =
|
||||||
UnicodeString::fromUTF8(StringPiece(message.data(), message.length()));
|
icu::UnicodeString::fromUTF8(icu::StringPiece(message.data(),
|
||||||
|
message.length()));
|
||||||
StringView view(reinterpret_cast<const uint16_t*>(utf16.getBuffer()),
|
StringView view(reinterpret_cast<const uint16_t*>(utf16.getBuffer()),
|
||||||
utf16.length());
|
utf16.length());
|
||||||
return StringBuffer::create(view);
|
return StringBuffer::create(view);
|
||||||
|
@ -523,7 +523,7 @@ const char* GetVersion(const char* type,
|
|||||||
} else if (!strcmp(type, TYPE_UNICODE)) {
|
} else if (!strcmp(type, TYPE_UNICODE)) {
|
||||||
return U_UNICODE_VERSION;
|
return U_UNICODE_VERSION;
|
||||||
} else if (!strcmp(type, TYPE_TZ)) {
|
} else if (!strcmp(type, TYPE_TZ)) {
|
||||||
return TimeZone::getTZDataVersion(*status);
|
return icu::TimeZone::getTZDataVersion(*status);
|
||||||
} else if (!strcmp(type, TYPE_CLDR)) {
|
} else if (!strcmp(type, TYPE_CLDR)) {
|
||||||
UVersionInfo versionArray;
|
UVersionInfo versionArray;
|
||||||
ulocdata_getCLDRVersion(versionArray, status);
|
ulocdata_getCLDRVersion(versionArray, status);
|
||||||
|
@ -64,7 +64,7 @@ int VERBOSE = 0;
|
|||||||
#define RES_INDEX "res_index"
|
#define RES_INDEX "res_index"
|
||||||
#define INSTALLEDLOCALES "InstalledLocales"
|
#define INSTALLEDLOCALES "InstalledLocales"
|
||||||
|
|
||||||
CharString packageName;
|
icu::CharString packageName;
|
||||||
const char* locale = RES_INDEX; // locale referring to our index
|
const char* locale = RES_INDEX; // locale referring to our index
|
||||||
|
|
||||||
void usage() {
|
void usage() {
|
||||||
@ -147,7 +147,7 @@ int localeExists(const char* loc, UBool* exists) {
|
|||||||
if (VERBOSE > 1) {
|
if (VERBOSE > 1) {
|
||||||
printf("Trying to open %s:%s\n", packageName.data(), loc);
|
printf("Trying to open %s:%s\n", packageName.data(), loc);
|
||||||
}
|
}
|
||||||
LocalUResourceBundlePointer aResource(
|
icu::LocalUResourceBundlePointer aResource(
|
||||||
ures_openDirect(packageName.data(), loc, &status));
|
ures_openDirect(packageName.data(), loc, &status));
|
||||||
*exists = FALSE;
|
*exists = FALSE;
|
||||||
if (U_SUCCESS(status)) {
|
if (U_SUCCESS(status)) {
|
||||||
@ -189,11 +189,11 @@ void printIndent(FILE* bf, int indent) {
|
|||||||
* @return 0 for OK, 1 for err
|
* @return 0 for OK, 1 for err
|
||||||
*/
|
*/
|
||||||
int dumpAllButInstalledLocales(int lev,
|
int dumpAllButInstalledLocales(int lev,
|
||||||
LocalUResourceBundlePointer* bund,
|
icu::LocalUResourceBundlePointer* bund,
|
||||||
FILE* bf,
|
FILE* bf,
|
||||||
UErrorCode* status) {
|
UErrorCode* status) {
|
||||||
ures_resetIterator(bund->getAlias());
|
ures_resetIterator(bund->getAlias());
|
||||||
LocalUResourceBundlePointer t;
|
icu::LocalUResourceBundlePointer t;
|
||||||
while (U_SUCCESS(*status) && ures_hasNext(bund->getAlias())) {
|
while (U_SUCCESS(*status) && ures_hasNext(bund->getAlias())) {
|
||||||
t.adoptInstead(ures_getNextResource(bund->getAlias(), t.orphan(), status));
|
t.adoptInstead(ures_getNextResource(bund->getAlias(), t.orphan(), status));
|
||||||
ASSERT_SUCCESS(status, "while processing table");
|
ASSERT_SUCCESS(status, "while processing table");
|
||||||
@ -254,10 +254,10 @@ int list(const char* toBundle) {
|
|||||||
printf("\"locale\": %s\n", locale);
|
printf("\"locale\": %s\n", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalUResourceBundlePointer bund(
|
icu::LocalUResourceBundlePointer bund(
|
||||||
ures_openDirect(packageName.data(), locale, &status));
|
ures_openDirect(packageName.data(), locale, &status));
|
||||||
ASSERT_SUCCESS(&status, "while opening the bundle");
|
ASSERT_SUCCESS(&status, "while opening the bundle");
|
||||||
LocalUResourceBundlePointer installedLocales(
|
icu::LocalUResourceBundlePointer installedLocales(
|
||||||
// NOLINTNEXTLINE (readability/null_usage)
|
// NOLINTNEXTLINE (readability/null_usage)
|
||||||
ures_getByKey(bund.getAlias(), INSTALLEDLOCALES, NULL, &status));
|
ures_getByKey(bund.getAlias(), INSTALLEDLOCALES, NULL, &status));
|
||||||
ASSERT_SUCCESS(&status, "while fetching installed locales");
|
ASSERT_SUCCESS(&status, "while fetching installed locales");
|
||||||
@ -295,7 +295,7 @@ int list(const char* toBundle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OK, now list them.
|
// OK, now list them.
|
||||||
LocalUResourceBundlePointer subkey;
|
icu::LocalUResourceBundlePointer subkey;
|
||||||
|
|
||||||
int validCount = 0;
|
int validCount = 0;
|
||||||
for (int32_t i = 0; i < count; i++) {
|
for (int32_t i = 0; i < count; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user