Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22920 Avoid "return by const value" antipattern #3343

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion icu4c/source/common/resbund.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ const Locale &ResourceBundle::getLocale() const {
return ncThis->fLocale != nullptr ? *ncThis->fLocale : Locale::getDefault();
}

const Locale ResourceBundle::getLocale(ULocDataLocaleType type, UErrorCode &status) const
Locale ResourceBundle::getLocale(ULocDataLocaleType type, UErrorCode &status) const
{
return ures_getLocaleByType(fResource, type, &status);
}
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/common/unicode/resbund.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class U_COMMON_API ResourceBundle : public UObject {
* @return a Locale object
* @stable ICU 2.8
*/
const Locale
Locale
getLocale(ULocDataLocaleType type, UErrorCode &status) const;
#ifndef U_HIDE_INTERNAL_API
/**
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/i18n/timezone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ TimeZone::countEquivalentIDs(const UnicodeString& id) {

// ---------------------------------------

const UnicodeString U_EXPORT2
UnicodeString U_EXPORT2
TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {
U_DEBUG_TZ_MSG(("gEI(%d)\n", index));
UnicodeString result;
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/i18n/unicode/messageformat2_data_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ namespace message2 {
* @internal ICU 75 technology preview
* @deprecated This API is for technology preview only.
*/
const std::vector<VariableName> getSelectors() const {
std::vector<VariableName> getSelectors() const {
if (std::holds_alternative<Pattern>(body)) {
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/i18n/unicode/timezone.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class U_I18N_API TimeZone : public UObject {
* @see #countEquivalentIDs
* @stable ICU 2.0
*/
static const UnicodeString U_EXPORT2 getEquivalentID(const UnicodeString& id,
static UnicodeString U_EXPORT2 getEquivalentID(const UnicodeString& id,
int32_t index);

/**
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/tools/ctestfw/datamap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const ResourceBundle *RBDataMap::getItem(const char* key, UErrorCode &status) co
}
}

const UnicodeString RBDataMap::getString(const char* key, UErrorCode &status) const
UnicodeString RBDataMap::getString(const char* key, UErrorCode &status) const
{
const ResourceBundle *r = getItem(key, status);
if(U_SUCCESS(status)) {
Expand Down
4 changes: 2 additions & 2 deletions icu4c/source/tools/ctestfw/unicode/datamap.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class T_CTEST_EXPORT_API DataMap {
* @param key name of the data field.
* @return a string containing the data
*/
virtual const UnicodeString getString(const char* key, UErrorCode &status) const = 0;
virtual UnicodeString getString(const char* key, UErrorCode &status) const = 0;

/** get the string from the DataMap. Addressed by name
* parses a bundle string into an integer
Expand Down Expand Up @@ -121,7 +121,7 @@ class T_CTEST_EXPORT_API RBDataMap : public DataMap{

virtual const ResourceBundle *getItem(const char* key, UErrorCode &status) const;

virtual const UnicodeString getString(const char* key, UErrorCode &status) const override;
virtual UnicodeString getString(const char* key, UErrorCode &status) const override;
virtual int32_t getInt28(const char* key, UErrorCode &status) const override;
virtual uint32_t getUInt28(const char* key, UErrorCode &status) const override;
virtual const int32_t *getIntVector(int32_t &length, const char *key, UErrorCode &status) const override;
Expand Down
Loading