From 702663805e3411eb0be1f26030bccaef480b36e3 Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Fri, 9 May 2003 22:15:25 +0000 Subject: [PATCH] ICU-2787 Locale setDefault(), fix failing test - name too long. X-SVN-Rev: 11875 --- icu4c/source/common/locid.cpp | 4 ++++ icu4c/source/test/cintltst/cloctst.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/icu4c/source/common/locid.cpp b/icu4c/source/common/locid.cpp index 81f4d91b638..165d5a57505 100644 --- a/icu4c/source/common/locid.cpp +++ b/icu4c/source/common/locid.cpp @@ -291,6 +291,10 @@ Locale::Locale(const Locale &other) Locale &Locale::operator=(const Locale &other) { + if (*this == other) { + return *this; + } + /* Free our current storage */ if(fullName != fullNameBuffer) { uprv_free(fullName); diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index b0b41727617..161a270959d 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -254,9 +254,9 @@ static void TestNullDefault() { char original[ULOC_FULLNAME_CAPACITY]; uprv_strcpy(original, uloc_getDefault()); - uloc_setDefault("qq_BLAH", &status); - if (uprv_strcmp(uloc_getDefault(), "qq_BLAH") != 0) { - log_err(" Mismatch in uloc_setDefault: qq_BLAH versus %s\n", uloc_getDefault()); + uloc_setDefault("qq_BLA", &status); + if (uprv_strcmp(uloc_getDefault(), "qq_BLA") != 0) { + log_err(" Mismatch in uloc_setDefault: qq_BLA versus %s\n", uloc_getDefault()); } uloc_setDefault(NULL, &status); if (uprv_strcmp(uloc_getDefault(), original) != 0) {