X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..ef6cf650f4a75c3f97de06b51fa104f2069b9ea2:/icuSources/common/locbased.cpp?ds=sidebyside diff --git a/icuSources/common/locbased.cpp b/icuSources/common/locbased.cpp index e96b9f79..ba289621 100644 --- a/icuSources/common/locbased.cpp +++ b/icuSources/common/locbased.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2004, International Business Machines +* Copyright (c) 2004-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -36,11 +36,18 @@ const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status void LocaleBased::setLocaleIDs(const char* validID, const char* actualID) { if (validID != 0) { - uprv_strcpy(valid, validID); + uprv_strncpy(valid, validID, ULOC_FULLNAME_CAPACITY); + valid[ULOC_FULLNAME_CAPACITY-1] = 0; // always terminate } if (actualID != 0) { - uprv_strcpy(actual, actualID); + uprv_strncpy(actual, actualID, ULOC_FULLNAME_CAPACITY); + actual[ULOC_FULLNAME_CAPACITY-1] = 0; // always terminate } } +void LocaleBased::setLocaleIDs(const Locale& validID, const Locale& actualID) { + uprv_strcpy(valid, validID.getName()); + uprv_strcpy(actual, actualID.getName()); +} + U_NAMESPACE_END