ICU-2710 Remove obsolete code

X-SVN-Rev: 11040
This commit is contained in:
George Rhoten 2003-02-14 01:33:13 +00:00
parent 4dc1d411e8
commit cfbdea0e8a
11 changed files with 1 additions and 688 deletions

View file

@ -137,40 +137,6 @@ U_NAMESPACE_BEGIN
// In the platform codepage.
#define SEP_CHAR '_'
/**
* static variables
*/
#ifdef ICU_LOCID_USE_DEPRECATES
const Locale::LocaleProxy Locale::ENGLISH = {eENGLISH};
const Locale::LocaleProxy Locale::FRENCH = {eFRENCH};
const Locale::LocaleProxy Locale::GERMAN = {eGERMAN};
const Locale::LocaleProxy Locale::ITALIAN = {eITALIAN};
const Locale::LocaleProxy Locale::JAPANESE = {eJAPANESE};
const Locale::LocaleProxy Locale::KOREAN = {eKOREAN};
const Locale::LocaleProxy Locale::CHINESE = {eCHINESE};
const Locale::LocaleProxy Locale::SIMPLIFIED_CHINESE={eCHINA};
const Locale::LocaleProxy Locale::TRADITIONAL_CHINESE={eTAIWAN};
const Locale::LocaleProxy Locale::FRANCE = {eFRANCE};
const Locale::LocaleProxy Locale::GERMANY = {eGERMANY};
const Locale::LocaleProxy Locale::ITALY = {eITALY};
const Locale::LocaleProxy Locale::JAPAN = {eJAPAN};
const Locale::LocaleProxy Locale::KOREA = {eKOREA};
const Locale::LocaleProxy Locale::CHINA = {eCHINA};
const Locale::LocaleProxy Locale::PRC = {eCHINA};
const Locale::LocaleProxy Locale::TAIWAN = {eTAIWAN};
const Locale::LocaleProxy Locale::UK = {eUK};
const Locale::LocaleProxy Locale::US = {eUS};
const Locale::LocaleProxy Locale::CANADA = {eCANADA};
const Locale::LocaleProxy Locale::CANADA_FRENCH={eCANADA_FRENCH};
Locale::LocaleProxy::operator const Locale&(void) const
{
return Locale::getLocale(magicLocaleNumber);
}
#endif
Locale::~Locale()
{
/*if fullName is on the heap, we free it*/

View file

@ -190,16 +190,6 @@ ResourceBundle::ResourceBundle( const UnicodeString& path,
constructForLocale(path, Locale::getDefault(), error);
}
#ifdef ICU_RESOURCEBUNDLE_USE_DEPRECATES
ResourceBundle::ResourceBundle(const wchar_t* path,
const Locale& locale,
UErrorCode& err)
:UObject(), locName(NULL)
{
constructForLocale(path, locale, err);
}
#endif /* ICU_RESOURCEBUNDLE_USE_DEPRECATES */
ResourceBundle::ResourceBundle(const ResourceBundle &other)
:UObject(other), locName(NULL)
{
@ -275,20 +265,6 @@ ResourceBundle::constructForLocale(const UnicodeString& path,
}
}
#ifdef ICU_RESOURCEBUNDLE_USE_DEPRECATES
void
ResourceBundle::constructForLocale(const wchar_t* path,
const Locale& locale,
UErrorCode& error)
{
if(path != 0) {
resource = ures_openW(path, locale.getName(), &error);
} else {
resource = ures_open(0, locale.getName(), &error);
}
}
#endif /* ICU_RESOURCEBUNDLE_USE_DEPRECATES */
UnicodeString ResourceBundle::getString(UErrorCode& status) const {
int32_t len = 0;
const UChar *r = ures_getString(resource, &len, &status);

View file

@ -179,112 +179,6 @@
U_NAMESPACE_BEGIN
class U_COMMON_API Locale : public UObject {
public:
#ifdef ICU_LOCID_USE_DEPRECATES
/**
* A proxy for the Locale.
* This is defined to stay source code compatible and to remove static initialization.
* Treat it just like a Locale.
* @obsolete ICU 2.4. Use one of the other Locale get functions instead since this API will be removed in that release.
*/
typedef struct U_COMMON_API LocaleProxy {
/* Try not to access this. This is not meant for normal use. */
int32_t magicLocaleNumber;
/** Calls Locale's equivalent function */
inline const char *getLanguage( ) const;
/** Calls Locale's equivalent function */
inline const char *getCountry( ) const;
/** Calls Locale's equivalent function */
inline const char *getVariant( ) const;
/** Calls Locale's equivalent function */
inline const char *getName() const;
/** Calls Locale's equivalent function */
inline const char *getISO3Language() const;
/** Calls Locale's equivalent function */
inline const char *getISO3Country() const;
/** Calls Locale's equivalent function */
inline uint32_t getLCID(void) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayLanguage(UnicodeString& dispLang) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayLanguage( const Locale& inLocale,
UnicodeString& dispLang) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayCountry( UnicodeString& dispCountry) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayCountry( const Locale& inLocale,
UnicodeString& dispCountry) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayVariant( UnicodeString& dispVar) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayVariant( const Locale& inLocale,
UnicodeString& dispVar) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayName( UnicodeString& name) const;
/** Calls Locale's equivalent function */
inline UnicodeString& getDisplayName( const Locale& inLocale,
UnicodeString& name) const;
/** Calls Locale's equivalent function */
inline int32_t hashCode(void) const;
/** Cast a LocaleProxy into a Locale. This is the magic behind this proxy. */
operator const Locale&() const;
} LocaleProxy;
/**
* Useful constants for language.
*/
/** @obsolete ICU 2.4. Use getEnglish() instead since this API will be removed in that release. */
static const LocaleProxy ENGLISH;
/** @obsolete ICU 2.4. Use getFrench() instead since this API will be removed in that release. */
static const LocaleProxy FRENCH;
/** @obsolete ICU 2.4. Use getGerman() instead since this API will be removed in that release. */
static const LocaleProxy GERMAN;
/** @obsolete ICU 2.4. Use getItalian() instead since this API will be removed in that release. */
static const LocaleProxy ITALIAN;
/** @obsolete ICU 2.4. Use getJapanese() instead since this API will be removed in that release. */
static const LocaleProxy JAPANESE;
/** @obsolete ICU 2.4. Use getKorean() instead since this API will be removed in that release. */
static const LocaleProxy KOREAN;
/** @obsolete ICU 2.4. Use getChinese() instead since this API will be removed in that release. */
static const LocaleProxy CHINESE;
/** @obsolete ICU 2.4. Use getSimplifiedChinese() instead since this API will be removed in that release. */
static const LocaleProxy SIMPLIFIED_CHINESE;
/** @obsolete ICU 2.4. Use getTraditionalChinese() instead since this API will be removed in that release. */
static const LocaleProxy TRADITIONAL_CHINESE;
/**
* Useful constants for country.
*/
/** @obsolete ICU 2.4. Use getFrance() instead since this API will be removed in that release. */
static const LocaleProxy FRANCE;
/** @obsolete ICU 2.4. Use getGermany() instead since this API will be removed in that release. */
static const LocaleProxy GERMANY;
/** @obsolete ICU 2.4. Use getItaly() instead since this API will be removed in that release. */
static const LocaleProxy ITALY;
/** @obsolete ICU 2.4. Use getJapan() instead since this API will be removed in that release. */
static const LocaleProxy JAPAN;
/** @obsolete ICU 2.4. Use getKorea() instead since this API will be removed in that release. */
static const LocaleProxy KOREA;
/** @obsolete ICU 2.4. Use getChina() instead since this API will be removed in that release. */
static const LocaleProxy CHINA; /* Alias for PRC */
/** @obsolete ICU 2.4. Use getPRC() instead since this API will be removed in that release. */
static const LocaleProxy PRC; /* Peoples Republic of China */
/** @obsolete ICU 2.4. Use getTaiwan() instead since this API will be removed in that release. */
static const LocaleProxy TAIWAN;
/** @obsolete ICU 2.4. Use getUK() instead since this API will be removed in that release. */
static const LocaleProxy UK;
/** @obsolete ICU 2.4. Use getUS() instead since this API will be removed in that release. */
static const LocaleProxy US;
/** @obsolete ICU 2.4. Use getCanada() instead since this API will be removed in that release. */
static const LocaleProxy CANADA;
/** @obsolete ICU 2.4. Use getCanadaFrench() instead since this API will be removed in that release. */
static const LocaleProxy CANADA_FRENCH;
#endif /* ICU_LOCID_USE_DEPRECATES */
/** Useful constant for this language. @stable ICU 2.0 */
static const Locale &getEnglish(void);
/** Useful constant for this language. @stable ICU 2.0 */
@ -701,13 +595,6 @@ private:
*/
static const char fgClassID;
// static Locale *localeList;
// static int32_t localeListCount;
#ifdef ICU_LOCID_USE_DEPRECATES
friend struct LocaleProxy;
#endif
static const Locale &getLocale(int locid);
friend void locale_set_default_internal(const char *);
@ -753,95 +640,9 @@ Locale::getName() const
inline UBool
Locale::isBogus(void) const {
return fIsBogus;
return fIsBogus;
}
#ifdef ICU_LOCID_USE_DEPRECATES
/* Proxy functions */
inline const char *Locale::LocaleProxy::getLanguage( ) const
{
return ((const Locale)*this).getLanguage();
}
inline const char *Locale::LocaleProxy::getCountry( ) const
{
return ((const Locale)*this).getCountry();
}
inline const char *Locale::LocaleProxy::getVariant( ) const
{
return ((const Locale)*this).getVariant();
}
inline const char *Locale::LocaleProxy::getName() const
{
return ((const Locale)*this).getName();
}
inline const char *Locale::LocaleProxy::getISO3Language() const
{
return ((const Locale)*this).getISO3Language();
}
inline const char *Locale::LocaleProxy::getISO3Country() const
{
return ((const Locale)*this).getISO3Country();
}
inline uint32_t Locale::LocaleProxy::getLCID(void) const
{
return ((const Locale)*this).getLCID();
}
inline UnicodeString& Locale::LocaleProxy::getDisplayLanguage(UnicodeString& dispLang) const
{
return ((const Locale)*this).getDisplayLanguage(dispLang);
}
inline UnicodeString& Locale::LocaleProxy::getDisplayLanguage( const Locale& inLocale,
UnicodeString& dispLang) const
{
return ((const Locale)*this).getDisplayLanguage(inLocale, dispLang);
}
inline UnicodeString& Locale::LocaleProxy::getDisplayCountry(UnicodeString& dispCountry) const
{
return ((const Locale)*this).getDisplayCountry(dispCountry);
}
inline UnicodeString& Locale::LocaleProxy::getDisplayCountry(const Locale& inLocale,
UnicodeString& dispCountry) const
{
return ((const Locale)*this).getDisplayCountry(inLocale, dispCountry);
}
inline UnicodeString& Locale::LocaleProxy::getDisplayVariant(UnicodeString& dispVar) const
{
return ((const Locale)*this).getDisplayVariant(dispVar);
}
inline UnicodeString& Locale::LocaleProxy::getDisplayVariant(const Locale& inLocale,
UnicodeString& dispVar) const
{
return ((const Locale)*this).getDisplayVariant(inLocale, dispVar);
}
inline UnicodeString& Locale::LocaleProxy::getDisplayName(UnicodeString& name) const
{
return ((const Locale)*this).getDisplayName(name);
}
inline UnicodeString& Locale::LocaleProxy::getDisplayName(const Locale& inLocale,
UnicodeString& name) const
{
return ((const Locale)*this).getDisplayName(inLocale, name);
}
inline int32_t Locale::LocaleProxy::hashCode(void) const
{
return ((const Locale)*this).hashCode();
}
#endif /* !ICU_LOCID_USE_DEPRECATES */
U_NAMESPACE_END
#endif

View file

@ -122,17 +122,6 @@ public:
*/
ResourceBundle(UErrorCode &err);
#ifdef ICU_RESOURCEBUNDLE_USE_DEPRECATES
/**
* Constructs a ResourceBundle
*
* @obsolete ICU 2.4. Use const char * pathnames instead since this API will be removed in that release.
*/
ResourceBundle(const wchar_t* path,
const Locale& locale,
UErrorCode& err);
#endif /* ICU_RESOURCEBUNDLE_USE_DEPRECATES */
/**
* Standard constructor, onstructs a resource bundle for the locale-specific
* bundle in the specified path.
@ -441,12 +430,6 @@ public:
private:
UResourceBundle *resource;
void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error);
#ifdef ICU_RESOURCEBUNDLE_USE_DEPRECATES
/**
* @obsolete ICU 2.4. Use const char * pathnames instead since this API will be removed in that release.
*/
void constructForLocale(const wchar_t* path, const Locale& locale, UErrorCode& error);
#endif /* ICU_RESOURCEBUNDLE_USE_DEPRECATES */
Locale *locName;
/**

View file

@ -1221,66 +1221,6 @@ public:
*/
inline int32_t getChar32Limit(int32_t offset) const;
#ifdef ICU_UNICODESTRING_USE_DEPRECATES
/**
* Same as getChar32Start().
* This original function name (without "32")
* was meant to look like UTF_SET_CHAR_START,
* but since most code point-related function names in C++ APIs
* contain a "32", this caused confusion.
* Note that UTF_SET_CHAR_START got renamed to U16_SET_CP_START in ICU 2.4.
*
* Adjust a random-access offset so that
* it points to the beginning of a Unicode character.
* The offset that is passed in points to
* any code unit of a code point,
* while the returned offset will point to the first code unit
* of the same code point.
* In UTF-16, if the input offset points to a second surrogate
* of a surrogate pair, then the returned offset will point
* to the first surrogate.
* @param offset a valid offset into one code point of the text
* @return offset of the first code unit of the same code point
* @obsolete ICU 2.4. Use getChar32Start() instead since this API will be removed in that release.
*/
inline int32_t getCharStart(int32_t offset) const;
/**
* Same as getChar32Limit().
* This original function name (without "32")
* was meant to look like UTF_SET_CHAR_LIMIT,
* but since most code point-related function names in C++ APIs
* contain a "32", this caused confusion.
* Note that UTF_SET_CHAR_LIMIT got renamed to U16_SET_CP_LIMIT in ICU 2.4.
*
* Adjust a random-access offset so that
* it points behind a Unicode character.
* The offset that is passed in points behind
* any code unit of a code point,
* while the returned offset will point behind the last code unit
* of the same code point.
* In UTF-16, if the input offset points behind the first surrogate
* (i.e., to the second surrogate)
* of a surrogate pair, then the returned offset will point
* behind the second surrogate (i.e., to the first surrogate).
* @param offset a valid offset after any code unit of a code point of the text
* @return offset of the first code unit after the same code point
* @obsolete ICU 2.4. Use getChar32Limit() instead since this API will be removed in that release.
*/
inline int32_t getCharLimit(int32_t offset) const;
/**
* Determine if this string is empty.
* This function was renamed to isEmtpy() because it caused confusion.
* If you need to determine if a string is empty, then use isEmpty().
* If you want to remove a string's contents, then call truncate(0).
*
* @return TRUE if this string contains 0 characters, FALSE otherwise.
* @obsolete ICU 2.4. Use isEmtpy() or truncate(0) instead since this API will be removed in that release.
*/
inline UBool empty(void) const;
#endif
/**
* Move the code unit index along the string by delta code points.
* Interpret the input index as a code unit-based offset into the string,
@ -3871,23 +3811,6 @@ UnicodeString::isEmpty() const {
return fLength == 0;
}
#ifdef ICU_UNICODESTRING_USE_DEPRECATES
inline int32_t
UnicodeString::getCharStart(int32_t offset) const {
return getChar32Start(offset);
}
inline int32_t
UnicodeString::getCharLimit(int32_t offset) const {
return getChar32Limit(offset);
}
inline UBool
UnicodeString::empty() const {
return isEmpty();
}
#endif
//========================================
// Write implementation methods
//========================================

View file

@ -1486,37 +1486,6 @@ ures_open(const char* path,
return r;
}
#ifdef ICU_URES_USE_DEPRECATES
U_CAPI UResourceBundle* U_EXPORT2
ures_openW(const wchar_t* myPath,
const char* localeID,
UErrorCode* status)
{
UResourceBundle *r;
size_t pathSize = (uprv_wcslen(myPath) + 1) * sizeof(int32_t);
char *path = (char *)uprv_malloc(pathSize);
/* test for NULL */
if (path == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_wcstombs(path, myPath, pathSize);
/*u_UCharsToChars(myPath, path, uprv_wcslen(myPath)+1);*/
r = ures_open(path, localeID, status);
uprv_free(path);
if (U_FAILURE(*status)) {
return NULL;
}
return r;
}
#endif /* ICU_URES_USE_DEPRECATES */
U_CAPI UResourceBundle* U_EXPORT2 ures_openU(const UChar* myPath,
const char* localeID,
UErrorCode* status)

View file

@ -187,38 +187,6 @@ void TestGetDefaultRules(){
}
#endif
#ifdef U_USE_DEPRECATED_UCOL_API
/*
* Test ucol_openVersion for some locale. Called by TestProperty().
*/
static void
TestOpenVersion(const char *locale) {
UVersionInfo version1, version2;
UCollator *collator1, *collator2;
UErrorCode errorCode;
errorCode=U_ZERO_ERROR;
collator1=ucol_open(locale, &errorCode);
if(U_SUCCESS(errorCode)) {
/* get the current version */
ucol_getVersion(collator1, version1);
ucol_close(collator1);
/* try to get that same version again */
collator2=ucol_openVersion(locale, version1, &errorCode);
if(U_SUCCESS(errorCode)) {
ucol_getVersion(collator2, version2);
if(0!=uprv_memcmp(version1, version2, sizeof(UVersionInfo))) {
log_err("error: ucol_openVersion(\"%s\", ucol_getVersion(%s collator)) returns a different collator\n", locale, locale);
}
ucol_close(collator2);
} else {
log_err("error: ucol_openVersion(\"%s\", ucol_getVersion(%s collator)) fails: %s\n", locale, locale, u_errorName(errorCode));
}
}
}
#endif
/* Collator Properties
ucol_open, ucol_strcoll, getStrength/setStrength
getDecomposition/setDecomposition, getDisplayName*/
@ -381,24 +349,6 @@ void TestProperty()
}
log_verbose("Default collation getDisplayName ended.\n");
#ifdef U_USE_DEPRECATED_UCOL_API
/* test ucol_openVersion */
TestOpenVersion("");
TestOpenVersion("da");
TestOpenVersion("fr");
TestOpenVersion("ja");
/* try some bogus version */
versionArray[0]=0;
versionArray[1]=0x99;
versionArray[2]=0xc7;
versionArray[3]=0xfe;
col=ucol_openVersion("", versionArray, &status);
if(U_SUCCESS(status)) {
log_err("error: ucol_openVersion(bogus version) succeeded\n");
ucol_close(col);
}
#endif
}
/* Test RuleBasedCollator and getRules*/

View file

@ -94,9 +94,6 @@ void addResourceBundleTest(TestNode** root)
addTest(root, &TestFallback, "tsutil/crestst/TestFallback");
addTest(root, &TestAliasConflict, "tsutil/crestst/TestAliasConflict");
addTest(root, &TestFileStream, "tsutil/crestst/TestFileStream");
#ifdef ICU_URES_USE_DEPRECATES
addTest(root, &TestConstruction2, "tsutil/crestst/TestConstruction2");
#endif
}
@ -217,67 +214,6 @@ void TestConstruction1()
ures_close(test2);
}
#ifdef ICU_URES_USE_DEPRECATES
void TestConstruction2()
{
int n;
int32_t resultLen;
UChar temp[7];
UResourceBundle *test4 = 0;
const UChar* result4;
UErrorCode err = U_ZERO_ERROR;
const char* locale="te_IN";
wchar_t widedirectory[256];
const char *testdatapath;
testdatapath=loadTestData(&err);
mbstowcs(widedirectory, testdatapath, 256);
log_verbose("Testing ures_openW().......\n");
test4=ures_openW(widedirectory, locale, &err);
if(U_FAILURE(err)){
log_err("Error in the construction using ures_openW(): %s\n", myErrorName(err));
return;
}
result4=ures_getStringByKey(test4, "string_in_Root_te_te_IN", &resultLen, &err);
if (U_FAILURE(err)) {
log_err("Something threw an error in TestConstruction() %s\n", myErrorName(err));
return;
}
log_verbose("for string_in_Root_te_te_IN, te_IN.txt had %s\n", austrdup(result4));
u_uastrcpy(temp, "TE_IN");
if(u_strcmp(result4, temp)!=0)
{
log_err("Construction test failed for ures_openW();\n");
if(!VERBOSITY)
log_info("(run verbose for more information)\n");
log_verbose("\nGot->");
for(n=0;result4[n];n++)
{
log_verbose("%04X ",result4[n]);
}
log_verbose("<\n");
log_verbose("\nWant>");
for(n=0;temp[n];n++)
{
log_verbose("%04X ",temp[n]);
}
log_verbose("<\n");
}
ures_close(test4);
}
#endif
/*****************************************************************************/
/*****************************************************************************/

View file

@ -32,10 +32,6 @@
#include "creststn.h"
#include "unicode/ctest.h"
#ifdef ICU_URES_USE_DEPRECATES
static void TestConstruction2(void);
#endif
static int32_t pass;
static int32_t fail;
@ -186,9 +182,6 @@ void addNEWResourceBundleTest(TestNode** root)
addTest(root, &TestResourceLevelAliasing, "tsutil/creststn/TestResourceLevelAliasing");
addTest(root, &TestDirectAccess, "tsutil/creststn/TestDirectAccess");
#ifdef ICU_URES_USE_DEPRECATES
addTest(root, &TestConstruction2, "tsutil/creststn/TestConstruction2");
#endif
}
@ -1225,59 +1218,6 @@ static void TestConstruction1()
}
#ifdef ICU_URES_USE_DEPRECATES
static void TestConstruction2()
{
UChar temp[7];
UResourceBundle *test4 = 0;
const UChar* result4;
UErrorCode err = U_ZERO_ERROR;
const char* locale="te_IN";
wchar_t widedirectory[256];
const char *testdatapath;
int32_t len=0;
char verboseOutput[256];
testdatapath= loadTestData(&err);
mbstowcs(widedirectory, testdatapath, 256);
log_verbose("Testing ures_openW().......\n");
test4=ures_openW(widedirectory, locale, &err);
if(U_FAILURE(err)){
log_err("Error in the construction using ures_openW(): %s\n", myErrorName(err));
return;
}
result4=ures_getStringByKey(test4, "string_in_Root_te_te_IN", &len, &err);
if (U_FAILURE(err) || len==0) {
log_err("Something threw an error in TestConstruction() %s\n", myErrorName(err));
return;
}
log_verbose("for string_in_Root_te_te_IN, te_IN.txt had %s\n", u_austrcpy(verboseOutput, result4));
u_uastrcpy(temp, "TE_IN");
if(u_strcmp(result4, temp)!=0)
{
log_err("Construction test failed for ures_openW();\n");
if(!VERBOSITY)
log_info("(run verbose for more information)\n");
log_verbose("\nGot->");
printUChars((UChar*)result4);
log_verbose(" Want->");
printUChars(temp);
log_verbose("\n");
}
ures_close(test4);
}
#endif
/*****************************************************************************/
/*****************************************************************************/

View file

@ -21,7 +21,6 @@
*/
#include "unicode/unum.h"
#include "unicode/ucol.h"
#include "unicode/udat.h"
#include "unicode/ustring.h"
#include "unicode/utrans.h"
@ -32,9 +31,6 @@
#include <stdio.h>
#ifdef U_USE_DEPRECATED_UCOL_API
static void TestDeprecatedCollationAPI(void);
#endif
#ifdef U_USE_DEPRECATED_FORMAT_API
static void TestDeprecatedNumFmtAPI(void);
static void TestDeprecatedDateFmtAPI(void);
@ -42,40 +38,11 @@ static void TestDeprecatedUErrorCode(void);
static void TestDeprecatedUCharScript(void);
#endif
const static char cnt1[][10] = {
"AA",
"AC",
"AZ",
"AQ",
"AB",
"ABZ",
"ABQ",
"Z",
"ABC",
"Q",
"B"
};
const static char cnt2[][10] = {
"DA",
"DAD",
"DAZ",
"MAR",
"Z",
"DAVIS",
"MARK",
"DAV",
"DAVI"
};
void addTestDeprecatedAPI(TestNode** root);
void
addTestDeprecatedAPI(TestNode** root)
{
#ifdef U_USE_DEPRECATED_UCOL_API
addTest(root, &TestDeprecatedCollationAPI, "ctstdep/TestDeprecatedCollationAPI");
#endif
#ifdef U_USE_DEPRECATED_FORMAT_API
addTest(root, &TestDeprecatedNumFmtAPI, "ctstdep/TestDeprecatedNumFmtAPI");
addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedDateFmtAPI");
@ -84,71 +51,6 @@ addTestDeprecatedAPI(TestNode** root)
#endif
}
#ifdef U_USE_DEPRECATED_UCOL_API
/*
*TODO: The ucol_openRules method which does not take UParseError as one of its params
* has been deprecated in 2.0 release.Please remove this API by 10/1/2002
*/
static void
TestDeprecatedCollationAPI(void)
{
UErrorCode status = U_ZERO_ERROR;
UChar temp[90];
UChar t1[90];
UChar t2[90];
UCollator *coll = NULL;
uint32_t i = 0, j = 0;
uint32_t size = 0;
u_uastrcpy(temp, " & Z < ABC < Q < B");
coll = ucol_openRules(temp, u_strlen(temp), UCOL_OFF, UCOL_DEFAULT_STRENGTH, &status);
if(U_SUCCESS(status)) {
size = sizeof(cnt1)/sizeof(cnt1[0]);
for(i = 0; i < size-1; i++) {
for(j = i+1; j < size; j++) {
UCollationElements *iter;
u_uastrcpy(t1, cnt1[i]);
u_uastrcpy(t2, cnt1[j]);
iter = ucol_openElements(coll, t2, u_strlen(t2), &status);
if (U_FAILURE(status)) {
log_err("Creation of iterator failed\n");
break;
}
ucol_closeElements(iter);
}
}
}
ucol_close(coll);
u_uastrcpy(temp, " & Z < DAVIS < MARK <DAV");
coll = ucol_openRules(temp, u_strlen(temp), UCOL_OFF, UCOL_DEFAULT_STRENGTH, &status);
if(U_SUCCESS(status)) {
size = sizeof(cnt2)/sizeof(cnt2[0]);
for(i = 0; i < size-1; i++) {
for(j = i+1; j < size; j++) {
UCollationElements *iter;
u_uastrcpy(t1, cnt2[i]);
u_uastrcpy(t2, cnt2[j]);
iter = ucol_openElements(coll, t2, u_strlen(t2), &status);
if (U_FAILURE(status)) {
log_err("Creation of iterator failed\n");
break;
}
ucol_closeElements(iter);
}
}
}
ucol_close(coll);
}
#endif
#ifdef U_USE_DEPRECATED_FORMAT_API
/*
*TODO: The unum_open,unum_applyPattern, which does not take UParseError as one of their params

View file

@ -246,39 +246,6 @@ static void TestPUtilAPI(void){
tzoffset=uprv_getUTCtime();
}
/* We can deprecate the test code right away; the API itself goes 2002-Jun-30 */
#ifdef ICU_ENABLE_DEPRECATED_NEXTDOUBLE
log_verbose("Testing uprv_nextDouble() where the value is NaN ...\n");
expn1=uprv_nextDouble(uprv_getNaN(), TRUE);
doAssert(expn1, uprv_getNaN(), "uprv_nextDouble(uprv_getNaN(), TRUE) failed.");
#if defined(OS400)
/* This is oddly enough the same value as DBL_MIN on Windows. */
/* This number is used because really small IEEE 754 numbers get an underflow exception on this platform */
y1=2.2250738585072014e-308;
#elif IEEE_754
/* OS390 may define IEEE_754, so check it first */
y1=4.9406564584125e-324;
#elif defined(OS390) || defined(XP_MAC)
y1=4.9406564584125e-78;
#else
/* This is the default IEEE754 value. The test should fail if it's not correct. */
y1=4.9406564584125e-324;
#endif
doAssert(uprv_nextDouble(0, TRUE), y1, "uprv_nextDouble(0, TRUE) failed.");
doAssert(uprv_nextDouble(0, FALSE), -y1, "uprv_nextDouble(0, FALSE) failed.");
expn1=uprv_nextDouble(1.0, TRUE);
if(expn1 < 1.0 || expn1 > 1.0001){
log_err("ERROR: uprv_nextDouble failed. Expected : %lf, Got: %f\n", y1, expn1);
}
expn1=uprv_nextDouble(1.0, FALSE);
if(expn1 > 1.0 || expn1 < 0.9999){
log_err("ERROR: uprv_nextDouble failed. Expected : %lf, Got: %f\n", y1, expn1);
}
#endif
}
#if 0