Skip to content

Commit c656f65

Browse files
committed
ICU-20392 Use getName() instead of private member fullName directly.
1 parent ce3f11a commit c656f65

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

icu4c/source/common/locdispnames.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Locale::getDisplayLanguage(const Locale &displayLocale,
6666
return result;
6767
}
6868

69-
length=uloc_getDisplayLanguage(fullName, displayLocale.fullName,
69+
length=uloc_getDisplayLanguage(getName(), displayLocale.getName(),
7070
buffer, result.getCapacity(),
7171
&errorCode);
7272
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -78,7 +78,7 @@ Locale::getDisplayLanguage(const Locale &displayLocale,
7878
return result;
7979
}
8080
errorCode=U_ZERO_ERROR;
81-
length=uloc_getDisplayLanguage(fullName, displayLocale.fullName,
81+
length=uloc_getDisplayLanguage(getName(), displayLocale.getName(),
8282
buffer, result.getCapacity(),
8383
&errorCode);
8484
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -106,7 +106,7 @@ Locale::getDisplayScript(const Locale &displayLocale,
106106
return result;
107107
}
108108

109-
length=uloc_getDisplayScript(fullName, displayLocale.fullName,
109+
length=uloc_getDisplayScript(getName(), displayLocale.getName(),
110110
buffer, result.getCapacity(),
111111
&errorCode);
112112
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -118,7 +118,7 @@ Locale::getDisplayScript(const Locale &displayLocale,
118118
return result;
119119
}
120120
errorCode=U_ZERO_ERROR;
121-
length=uloc_getDisplayScript(fullName, displayLocale.fullName,
121+
length=uloc_getDisplayScript(getName(), displayLocale.getName(),
122122
buffer, result.getCapacity(),
123123
&errorCode);
124124
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -146,7 +146,7 @@ Locale::getDisplayCountry(const Locale &displayLocale,
146146
return result;
147147
}
148148

149-
length=uloc_getDisplayCountry(fullName, displayLocale.fullName,
149+
length=uloc_getDisplayCountry(getName(), displayLocale.getName(),
150150
buffer, result.getCapacity(),
151151
&errorCode);
152152
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -158,7 +158,7 @@ Locale::getDisplayCountry(const Locale &displayLocale,
158158
return result;
159159
}
160160
errorCode=U_ZERO_ERROR;
161-
length=uloc_getDisplayCountry(fullName, displayLocale.fullName,
161+
length=uloc_getDisplayCountry(getName(), displayLocale.getName(),
162162
buffer, result.getCapacity(),
163163
&errorCode);
164164
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -186,7 +186,7 @@ Locale::getDisplayVariant(const Locale &displayLocale,
186186
return result;
187187
}
188188

189-
length=uloc_getDisplayVariant(fullName, displayLocale.fullName,
189+
length=uloc_getDisplayVariant(getName(), displayLocale.getName(),
190190
buffer, result.getCapacity(),
191191
&errorCode);
192192
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -198,7 +198,7 @@ Locale::getDisplayVariant(const Locale &displayLocale,
198198
return result;
199199
}
200200
errorCode=U_ZERO_ERROR;
201-
length=uloc_getDisplayVariant(fullName, displayLocale.fullName,
201+
length=uloc_getDisplayVariant(getName(), displayLocale.getName(),
202202
buffer, result.getCapacity(),
203203
&errorCode);
204204
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -226,7 +226,7 @@ Locale::getDisplayName(const Locale &displayLocale,
226226
return result;
227227
}
228228

229-
length=uloc_getDisplayName(fullName, displayLocale.fullName,
229+
length=uloc_getDisplayName(getName(), displayLocale.getName(),
230230
buffer, result.getCapacity(),
231231
&errorCode);
232232
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);
@@ -238,7 +238,7 @@ Locale::getDisplayName(const Locale &displayLocale,
238238
return result;
239239
}
240240
errorCode=U_ZERO_ERROR;
241-
length=uloc_getDisplayName(fullName, displayLocale.fullName,
241+
length=uloc_getDisplayName(getName(), displayLocale.getName(),
242242
buffer, result.getCapacity(),
243243
&errorCode);
244244
result.releaseBuffer(U_SUCCESS(errorCode) ? length : 0);

icu4c/source/common/locid.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ Locale::clone() const {
477477
bool
478478
Locale::operator==( const Locale& other) const
479479
{
480-
return (uprv_strcmp(other.fullName, fullName) == 0);
480+
return uprv_strcmp(other.getName(), getName()) == 0;
481481
}
482482

483483
namespace {
@@ -1965,7 +1965,7 @@ Locale& Locale::init(StringPiece localeID, UBool canonicalize)
19651965
}
19661966

19671967
if (canonicalize) {
1968-
if (!isKnownCanonicalizedLocale(fullName, err)) {
1968+
if (!isKnownCanonicalizedLocale(getName(), err)) {
19691969
CharString replaced;
19701970
// Not sure it is already canonicalized
19711971
if (canonicalizeLocale(*this, replaced, err)) {
@@ -2030,7 +2030,7 @@ Locale::initBaseName(UErrorCode &status) {
20302030
int32_t
20312031
Locale::hashCode() const
20322032
{
2033-
return ustr_hashCharsN(fullName, static_cast<int32_t>(uprv_strlen(fullName)));
2033+
return ustr_hashCharsN(getName(), static_cast<int32_t>(uprv_strlen(getName())));
20342034
}
20352035

20362036
void
@@ -2088,7 +2088,7 @@ Locale::addLikelySubtags(UErrorCode& status) {
20882088
return;
20892089
}
20902090

2091-
CharString maximizedLocaleID = ulocimp_addLikelySubtags(fullName, status);
2091+
CharString maximizedLocaleID = ulocimp_addLikelySubtags(getName(), status);
20922092

20932093
if (U_FAILURE(status)) {
20942094
return;
@@ -2110,7 +2110,7 @@ Locale::minimizeSubtags(bool favorScript, UErrorCode& status) {
21102110
return;
21112111
}
21122112

2113-
CharString minimizedLocaleID = ulocimp_minimizeSubtags(fullName, favorScript, status);
2113+
CharString minimizedLocaleID = ulocimp_minimizeSubtags(getName(), favorScript, status);
21142114

21152115
if (U_FAILURE(status)) {
21162116
return;
@@ -2131,7 +2131,7 @@ Locale::canonicalize(UErrorCode& status) {
21312131
status = U_ILLEGAL_ARGUMENT_ERROR;
21322132
return;
21332133
}
2134-
CharString uncanonicalized(fullName, status);
2134+
CharString uncanonicalized(getName(), status);
21352135
if (U_FAILURE(status)) {
21362136
return;
21372137
}
@@ -2196,7 +2196,7 @@ Locale::toLanguageTag(ByteSink& sink, UErrorCode& status) const
21962196
return;
21972197
}
21982198

2199-
ulocimp_toLanguageTag(fullName, sink, /*strict=*/false, status);
2199+
ulocimp_toLanguageTag(getName(), sink, /*strict=*/false, status);
22002200
}
22012201

22022202
Locale U_EXPORT2
@@ -2229,14 +2229,14 @@ Locale::createCanonical(const char* name) {
22292229
const char *
22302230
Locale::getISO3Language() const
22312231
{
2232-
return uloc_getISO3Language(fullName);
2232+
return uloc_getISO3Language(getName());
22332233
}
22342234

22352235

22362236
const char *
22372237
Locale::getISO3Country() const
22382238
{
2239-
return uloc_getISO3Country(fullName);
2239+
return uloc_getISO3Country(getName());
22402240
}
22412241

22422242
/**
@@ -2249,7 +2249,7 @@ Locale::getISO3Country() const
22492249
uint32_t
22502250
Locale::getLCID() const
22512251
{
2252-
return uloc_getLCID(fullName);
2252+
return uloc_getLCID(getName());
22532253
}
22542254

22552255
const char* const* U_EXPORT2 Locale::getISOCountries()
@@ -2556,8 +2556,8 @@ Locale::createKeywords(UErrorCode &status) const
25562556
return result;
25572557
}
25582558

2559-
const char* variantStart = uprv_strchr(fullName, '@');
2560-
const char* assignment = uprv_strchr(fullName, '=');
2559+
const char* variantStart = uprv_strchr(getName(), '@');
2560+
const char* assignment = uprv_strchr(getName(), '=');
25612561
if(variantStart) {
25622562
if(assignment > variantStart) {
25632563
CharString keywords = ulocimp_getKeywords(variantStart + 1, '@', false, status);
@@ -2583,8 +2583,8 @@ Locale::createUnicodeKeywords(UErrorCode &status) const
25832583
return result;
25842584
}
25852585

2586-
const char* variantStart = uprv_strchr(fullName, '@');
2587-
const char* assignment = uprv_strchr(fullName, '=');
2586+
const char* variantStart = uprv_strchr(getName(), '@');
2587+
const char* assignment = uprv_strchr(getName(), '=');
25882588
if(variantStart) {
25892589
if(assignment > variantStart) {
25902590
CharString keywords = ulocimp_getKeywords(variantStart + 1, '@', false, status);
@@ -2604,7 +2604,7 @@ Locale::createUnicodeKeywords(UErrorCode &status) const
26042604
int32_t
26052605
Locale::getKeywordValue(const char* keywordName, char *buffer, int32_t bufLen, UErrorCode &status) const
26062606
{
2607-
return uloc_getKeywordValue(fullName, keywordName, buffer, bufLen, &status);
2607+
return uloc_getKeywordValue(getName(), keywordName, buffer, bufLen, &status);
26082608
}
26092609

26102610
void
@@ -2618,7 +2618,7 @@ Locale::getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& sta
26182618
return;
26192619
}
26202620

2621-
ulocimp_getKeywordValue(fullName, keywordName, sink, status);
2621+
ulocimp_getKeywordValue(getName(), keywordName, sink, status);
26222622
}
26232623

26242624
void
@@ -2664,7 +2664,7 @@ Locale::setKeywordValue(StringPiece keywordName,
26642664
status = U_ZERO_ERROR;
26652665
}
26662666

2667-
int32_t length = static_cast<int32_t>(uprv_strlen(fullName));
2667+
int32_t length = static_cast<int32_t>(uprv_strlen(getName()));
26682668
int32_t capacity = fullName == fullNameBuffer ? ULOC_FULLNAME_CAPACITY : length + 1;
26692669

26702670
const char* start = locale_getKeywordsStart(fullName);

0 commit comments

Comments
 (0)