]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/locbased.cpp
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / common / locbased.cpp
index e96b9f79f3da0f88915eaeacc36b1a7329dee055..ba289621f9a99712b590417570417f8456400414 100644 (file)
@@ -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
 * 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) {
 
 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) {
     }
     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
 U_NAMESPACE_END