From efda50128517b760b98b889c2521441a5c449459 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Wed, 5 Mar 2003 04:56:28 +0000 Subject: [PATCH] ICU-2710 Remove some obsolete code X-SVN-Rev: 11248 --- icu4c/source/common/ucnv_io.c | 12 -- icu4c/source/common/ucnv_io.h | 11 -- icu4c/source/common/unicode/unistr.h | 8 - icu4c/source/common/unicode/ures.h | 26 --- icu4c/source/test/intltest/itmajor.cpp | 12 -- icu4c/source/test/intltest/loctest.cpp | 214 ++----------------------- icu4c/source/test/intltest/loctest.h | 2 - 7 files changed, 16 insertions(+), 269 deletions(-) diff --git a/icu4c/source/common/ucnv_io.c b/icu4c/source/common/ucnv_io.c index 2d90799b894..e9a2c7df168 100644 --- a/icu4c/source/common/ucnv_io.c +++ b/icu4c/source/common/ucnv_io.c @@ -933,18 +933,6 @@ ucnv_openAllNames(UErrorCode *pErrorCode) { return myEnum; } -#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES -U_CFUNC void -ucnv_io_fillAvailableConverters(const char **aliases, UErrorCode *pErrorCode) { - if (haveAvailableConverterList(pErrorCode)) { - uint16_t count = 0; - while (count < gAvailableConverterCount) { - *aliases++=gAvailableConverters[count++]; - } - } -} -#endif - U_CFUNC uint16_t ucnv_io_countAvailableAliases(UErrorCode *pErrorCode) { if (haveAliasData(pErrorCode)) { diff --git a/icu4c/source/common/ucnv_io.h b/icu4c/source/common/ucnv_io.h index a3a7e5a6503..a236f5b0a0a 100644 --- a/icu4c/source/common/ucnv_io.h +++ b/icu4c/source/common/ucnv_io.h @@ -106,17 +106,6 @@ ucnv_io_countAvailableConverters(UErrorCode *pErrorCode); U_CFUNC const char * ucnv_io_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode); -#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES -/** - * Fill an array const char *aliases[ucnv_io_countAvailableConverters()] - * with pointers to all converter names in mixed-case. - * @param aliases The alias array to be filled - * @param pErrorCode The error code - */ -U_CFUNC void -ucnv_io_fillAvailableConverters(const char **aliases, UErrorCode *pErrorCode); -#endif - /** * Return the (n)th converter name in mixed case, or NULL * if there is none (typically, if the data cannot be loaded). diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h index 27d4f25d40e..6ee353add2c 100644 --- a/icu4c/source/common/unicode/unistr.h +++ b/icu4c/source/common/unicode/unistr.h @@ -51,10 +51,6 @@ class UCharReference; class StringCharacterIterator; class BreakIterator; // unicode/brkiter.h -#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES -class UnicodeConverter; // unicode/convert.h -#endif - /* The include has been moved to unicode/ustream.h */ /** @@ -3043,10 +3039,6 @@ private: kWritableAlias=0 }; -#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES - friend class UnicodeConverter; -#endif - friend class StringCharacterIterator; friend class StringThreadTest; diff --git a/icu4c/source/common/unicode/ures.h b/icu4c/source/common/unicode/ures.h index 4814e313ebc..efab5890c23 100644 --- a/icu4c/source/common/unicode/ures.h +++ b/icu4c/source/common/unicode/ures.h @@ -134,32 +134,6 @@ ures_openDirect(const char* path, const char* locale, UErrorCode* status); -#ifdef ICU_URES_USE_DEPRECATES -/** -*Opens a UResourceBundle, from which users can extract strings by using -*their corresponding keys. This version of open requires the path -*string to be of type const wchar_t*. -*Note that the caller is responsible of calling ures_close on each succesfully -*opened resource bundle. -*@param path: string containing the full path pointing to the directory -* where the resources reside (should end with a directory -* separator. -* e.g. "/usr/resource/my_app/resources/" on a Unix system -* if NULL will use the system's current data directory -*@param locale: specifies the locale for which we want to open the resource -* if NULL will use the default locale -* -*@param status: fills in the outgoing error code. -*@see ures_close -*@return : a newly allocated resource bundle. -* @obsolete ICU 2.4. Use const char * pathnames instead since this API will be removed in that release. -*/ -U_CAPI UResourceBundle* U_EXPORT2 -ures_openW(const wchar_t* path, - const char* locale, - UErrorCode* status); -#endif /* ICU_URES_USE_DEPRECATES */ - /** * Same as ures_open() but takes a const UChar *path. * This path will be converted to char * using the default converter, diff --git a/icu4c/source/test/intltest/itmajor.cpp b/icu4c/source/test/intltest/itmajor.cpp index 3052a8dd355..fa09061217d 100644 --- a/icu4c/source/test/intltest/itmajor.cpp +++ b/icu4c/source/test/intltest/itmajor.cpp @@ -127,18 +127,6 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam #endif break; -//% case 9: name = "convert"; -//%/* Only the C API exists */ -//%#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES -//% if (exec) { -//% logln("TestSuite Convert---"); logln(); -//% IntlTestConvert test; -//% callTest( test, par ); -//% } -//%#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */ -//% break; - -//% case 10: name = "icuserv"; case 9: name = "icuserv"; #if !UCONFIG_NO_SERVICE if (exec) { diff --git a/icu4c/source/test/intltest/loctest.cpp b/icu4c/source/test/intltest/loctest.cpp index 910484ad236..eebb9623d0e 100644 --- a/icu4c/source/test/intltest/loctest.cpp +++ b/icu4c/source/test/intltest/loctest.cpp @@ -168,33 +168,31 @@ void LocaleTest::runIndexedTest( int32_t index, UBool exec, const char* &name, c CASE(7, TestISO3Fallback) CASE(8, TestGetLangsAndCountries) - CASE(9, Test4126880) - CASE(10, TestBug4135316) - CASE(11, TestSimpleDisplayNames) - CASE(12, TestUninstalledISO3Names) - CASE(13, TestAtypicalLocales) + CASE(9, TestSimpleDisplayNames) + CASE(10, TestUninstalledISO3Names) + CASE(11, TestAtypicalLocales) #if !UCONFIG_NO_FORMATTING - CASE(14, TestThaiCurrencyFormat) - CASE(15, TestEuroSupport) + CASE(12, TestThaiCurrencyFormat) + CASE(13, TestEuroSupport) #endif - CASE(16, TestToString) + CASE(14, TestToString) #if !UCONFIG_NO_FORMATTING - CASE(17, Test4139940) - CASE(18, Test4143951) + CASE(15, Test4139940) + CASE(16, Test4143951) #endif - CASE(19, Test4147315) - CASE(20, Test4147317) - CASE(21, Test4147552) - CASE(22, TestVariantParsing) + CASE(17, Test4147315) + CASE(18, Test4147317) + CASE(19, Test4147552) + CASE(20, TestVariantParsing) #if !UCONFIG_NO_FORMATTING - CASE(23, Test4105828) + CASE(21, Test4105828) #endif - CASE(24, TestSetIsBogus) - CASE(25, TestParallelAPIValues) + CASE(22, TestSetIsBogus) + CASE(23, TestParallelAPIValues) // keep the last index in sync with the condition in default: default: - if(index <= 25) { // keep this in sync with the last index! + if(index <= 23) { // keep this in sync with the last index! name = "switched off"; // UCONFIG_NO_FORMATTING } else { name = ""; @@ -240,42 +238,6 @@ void LocaleTest::TestBasicGetters() { errln(" Variant code mismatch: something versus \"\""); } - /*tests for the depracted API*/ -#ifdef ICU_LOCID_USE_DEPRECATES - for (i = 0; i <= MAX_LOCALES; i++) { - Locale testLocale((UnicodeString)rawData[LANG][i], (UnicodeString)rawData[CTRY][i], (UnicodeString)rawData[VAR][i]); - logln("Testing " + (UnicodeString)testLocale.getName() + "..."); - - if ( testLocale.getLanguage(temp) != (UnicodeString)(dataTable[LANG][i])) - errln(" Language code mismatch: " + temp + " versus " - + dataTable[LANG][i]); - if ( testLocale.getCountry(temp) != (UnicodeString)(dataTable[CTRY][i])) - errln(" Country code mismatch: " + temp + " versus " - + dataTable[CTRY][i]); - if ( testLocale.getVariant(temp) != (UnicodeString)(dataTable[VAR][i])) - errln(" Variant code mismatch: " + temp + " versus " - + dataTable[VAR][i]); - if ( testLocale.getName(temp) != (UnicodeString)(dataTable[NAME][i])) - errln(" Locale name mismatch: " + temp + " versus " - + dataTable[NAME][i]); - } - logln("Same thing without variant codes..."); - for (i = 0; i <= MAX_LOCALES; i++) { - Locale testLocale((UnicodeString)rawData[LANG][i], (UnicodeString)rawData[CTRY][i]); - logln("Testing " + (testLocale.getName(temp)) + "..."); - - if ( testLocale.getLanguage(temp) != (UnicodeString)(dataTable[LANG][i])) - errln(" Language code mismatch: " + temp + " versus " - + dataTable[LANG][i]); - if ( testLocale.getCountry(temp) != (UnicodeString)(dataTable[CTRY][i])) - errln(" Country code mismatch: " + temp + " versus " - + dataTable[CTRY][i]); - if (testLocale.getVariant(temp).length() != 0 ) - errln(" Variant code mismatch: something versus \"\""); - } - -#endif - logln("Testing long language names and getters"); Locale test8 = Locale::createFromName("x-klingon-zx.utf32be@special"); @@ -400,27 +362,6 @@ void LocaleTest::TestSimpleResourceInfo() { err = U_ZERO_ERROR; } - /*tests for the deprecated API*/ -#ifdef ICU_LOCID_USE_DEPRECATES - for (i = 0; i <= MAX_LOCALES; i++) { - Locale testLocale((UnicodeString)rawData[LANG][i], (UnicodeString)rawData[CTRY][i], (UnicodeString)rawData[VAR][i]); - logln("Testing " + (testLocale.getName(temp)) + "..."); - - if ( testLocale.getISO3Language(temp, err) != (UnicodeString)(dataTable[LANG3][i])) - errln(" ISO-3 language code mismatch: " + temp - + " versus " + dataTable[LANG3][i]); - if ( testLocale.getISO3Country(temp, err) != (UnicodeString)(dataTable[CTRY3][i])) - errln(" ISO-3 country code mismatch: " + temp - + " versus " + dataTable[CTRY3][i]); - - if(U_FAILURE(err)) - { - errln((UnicodeString)"Some error on number " + i + u_errorName(err)); - } - err = U_ZERO_ERROR; - } -#endif - Locale locale("en"); if(strcmp(locale.getName(), "en") != 0|| strcmp(locale.getLanguage(), "en") != 0) { @@ -924,129 +865,6 @@ LocaleTest::TestGetLangsAndCountries() } } -/** - * @bug 4126880 - */ -// since this returns const UnicodeString* in C++, is this test applicable? -void -LocaleTest::Test4126880() -{ -#ifdef ICU_LOCID_USE_DEPRECATES - - const UnicodeString *test; - int32_t testCount=0; - - /*test = Locale::getISOCountries(testCount); - test[0] = "SUCKER!!!"; - test = Locale::getISOCountries(testCount); - if (test[0] == "SUCKER!!!") - errln("Changed internal country code list!"); - - test = Locale::getISOLanguages(testCount); - test[0] = "HAHAHAHA!!!"; - test = Locale::getISOLanguages(testCount); - if (test[0] == "HAHAHAHA!!!") // Fixed typo - errln("Changes internal language code list!"); - */ - /*tests for deprecated API*/ - test=Locale::getISOCountries(testCount); - if(testCount != 239){ - errln((UnicodeString)"There is an error in getISOCountries " + testCount); - } - test=Locale::getISOLanguages(testCount); - if(testCount != 437){ - errln((UnicodeString)"There is an error in getISOLanguages " + testCount); - } -/*----------*/ -#else - logln("Skipping Test4126880 for deprecated API"); -#endif -} - -/** - * @bug 4135316 - */ -// not applicable in C++ - const Locale* -void -LocaleTest::TestBug4135316() -{ -/* - Locale[] locales1 = Locale.getAvailableLocales(); - Locale[] locales2 = Locale.getAvailableLocales(); - if (locales1 == locales2) - errln("Locale.getAvailableLocales() doesn't clone its internal storage!"); -*/ -} - -/** - * @bug 4107953 - */ -/* -test commented out pending API-change approval -public void TestGetLanguagesForCountry() { - UnicodeString[] languages = Locale.getLanguagesForCountry("US"); - - if (!searchStringArrayFor("en", languages)) - errln("Didn't get en as a language for US"); - - languages = Locale.getLanguagesForCountry("FR"); - if (!searchStringArrayFor("fr", languages)) - errln("Didn't get fr as a language for FR"); - - languages = Locale.getLanguagesForCountry("CH"); - if (!searchStringArrayFor("fr", languages)) - errln("Didn't get fr as a language for CH"); - if (!searchStringArrayFor("it", languages)) - errln("Didn't get it as a language for CH"); - if (!searchStringArrayFor("de", languages)) - errln("Didn't get de as a language for CH"); - - languages = Locale.getLanguagesForCountry("JP"); - if (!searchStringArrayFor("ja", languages)) - errln("Didn't get ja as a language for JP"); -} -*/ - -/* -private UBool searchStringArrayFor(UnicodeString s, UnicodeString[] array) { - for (int32_t i = 0; i < array.length; i++) - if (s.equals(array[i])) - return TRUE; - return FALSE; -} -*/ - -/** - * @bug 4110613 - */ -// not applicable in C++ - /* -void -LocaleTest::TestSerialization() throws ClassNotFoundException, OptionalDataException, - IOException, StreamCorruptedException -{ - ObjectOutputStream ostream; - ByteArrayOutputStream obstream; - byte[] bytes = null; - - obstream = new ByteArrayOutputStream(); - ostream = new ObjectOutputStream(obstream); - - Locale test1 = new Locale("zh", "TW", ""); - int32_t dummy = test1.hashCode(); // fill in the cached hash-code value - ostream.writeObject(test1); - - bytes = obstream.toByteArray(); - - ObjectInputStream istream = new ObjectInputStream(new ByteArrayInputStream(bytes)); - - Locale test2 = (Locale)(istream.readObject()); - - if (!test1.equals(test2) || test1.hashCode() != test2.hashCode()) - errln("Locale failed to deserialize correctly."); -} -*/ - /** * @bug 4118587 */ diff --git a/icu4c/source/test/intltest/loctest.h b/icu4c/source/test/intltest/loctest.h index 610bb08814d..660f52bd5ba 100644 --- a/icu4c/source/test/intltest/loctest.h +++ b/icu4c/source/test/intltest/loctest.h @@ -52,8 +52,6 @@ public: void TestISO3Fallback(void); void TestGetLangsAndCountries(void); - void Test4126880(void); - void TestBug4135316(void); void TestSimpleDisplayNames(void); void TestUninstalledISO3Names(void); void TestAtypicalLocales(void);