From b942cae860e43790cf73f3b5a0d913baf5c49d3b Mon Sep 17 00:00:00 2001
From: Markus Scherer NumberFormat
object:
*
*
- * . UErrorCode success = ZERO_ERROR;
+ * . UErrorCode success = U_ZERO_ERROR;
* . Locale myLocale;
* . NumberFormat *nf;
* .
diff --git a/icu4c/source/common/normlzr.cpp b/icu4c/source/common/normlzr.cpp
index 0700f4ae082..09fc2ff58c4 100644
--- a/icu4c/source/common/normlzr.cpp
+++ b/icu4c/source/common/normlzr.cpp
@@ -493,7 +493,7 @@ UChar Normalizer::nextCompose()
*/
UChar Normalizer::prevCompose()
{
- UErrorCode status = ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
initBuffer();
// Slurp up characters until we hit a base char or an initial Jamo
@@ -1017,7 +1017,7 @@ Normalizer::setText(const UnicodeString& newText,
}
CharacterIterator *newIter = new StringCharacterIterator(newText);
if (newIter == NULL) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
return;
}
delete text;
@@ -1038,7 +1038,7 @@ Normalizer::setText(const CharacterIterator& newText,
}
CharacterIterator *newIter = newText.clone();
if (newIter == NULL) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
return;
}
delete text;
@@ -1185,5 +1185,3 @@ void Normalizer::jamoToHangul(UnicodeString& buffer, UTextOffset start) {
buffer.truncate(out);
}
-
-
diff --git a/icu4c/source/common/rbcache.cpp b/icu4c/source/common/rbcache.cpp
index 5f129cbc51c..b38e5809e65 100644
--- a/icu4c/source/common/rbcache.cpp
+++ b/icu4c/source/common/rbcache.cpp
@@ -25,7 +25,7 @@
ResourceBundleCache::ResourceBundleCache()
{
- UErrorCode err = ZERO_ERROR;
+ UErrorCode err = U_ZERO_ERROR;
hashTable = uhash_open((UHashFunction)uhash_hashUString, &err);
uhash_setValueDeleter(hashTable, deleteValue);
}
@@ -39,7 +39,7 @@ void ResourceBundleCache::deleteValue(void* value)
VisitedFileCache::VisitedFileCache()
{
- UErrorCode err = ZERO_ERROR;
+ UErrorCode err = U_ZERO_ERROR;
hashTable = uhash_open((UHashFunction)uhash_hashUString, &err);
}
diff --git a/icu4c/source/common/rbcache.h b/icu4c/source/common/rbcache.h
index 3e20578ea72..623b2fcd644 100644
--- a/icu4c/source/common/rbcache.h
+++ b/icu4c/source/common/rbcache.h
@@ -64,7 +64,7 @@ inline bool_t VisitedFileCache::wasVisited(const UnicodeString& filename) const
inline void VisitedFileCache::markAsVisited(const UnicodeString& filename)
{
- UErrorCode err = ZERO_ERROR;
+ UErrorCode err = U_ZERO_ERROR;
uhash_putKey(hashTable, uhash_hashUString(filename.getUChars()), (void*)TRUE, &err);
}
diff --git a/icu4c/source/common/rbdata.cpp b/icu4c/source/common/rbdata.cpp
index 0b316063502..d2843d26330 100644
--- a/icu4c/source/common/rbdata.cpp
+++ b/icu4c/source/common/rbdata.cpp
@@ -86,7 +86,7 @@ String2dList::getStaticClassID()
TaggedList::TaggedList()
{
- UErrorCode err = ZERO_ERROR;
+ UErrorCode err = U_ZERO_ERROR;
fHashtableValues = uhash_open((UHashFunction)uhash_hashUString, &err);
uhash_setValueDeleter(fHashtableValues, deleteValue);
@@ -103,7 +103,7 @@ void
TaggedList::put(const UnicodeString& tag,
const UnicodeString& data)
{
- UErrorCode err = ZERO_ERROR;
+ UErrorCode err = U_ZERO_ERROR;
uhash_putKey(fHashtableValues,
tag.hashCode() & 0x7FFFFFFF,
diff --git a/icu4c/source/common/rbread.cpp b/icu4c/source/common/rbread.cpp
index 275c2bea34a..d9920d38005 100644
--- a/icu4c/source/common/rbread.cpp
+++ b/icu4c/source/common/rbread.cpp
@@ -93,7 +93,7 @@ read_strlist(FileStream *rb,
/* Setup the string list */
retval = new StringList();
if(retval == 0) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -111,7 +111,7 @@ read_strlist(FileStream *rb,
/* Allocate space for the array of strings */
retval->fStrings = new UnicodeString [ retval->fCount ];
if(retval->fStrings == 0) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
delete retval;
return 0;
}
@@ -146,7 +146,7 @@ read_strlist2d(FileStream *rb,
/* Setup the 2-d string list */
retval = new String2dList();
if(retval == 0) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -164,7 +164,7 @@ read_strlist2d(FileStream *rb,
/* Allocate space for the array of strings */
retval->fStrings = new UnicodeString* [ retval->fRowCount ];
if(retval->fStrings == 0) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
delete retval;
return 0;
}
@@ -181,7 +181,7 @@ read_strlist2d(FileStream *rb,
/* Allocate enough space for each item */
retval->fStrings[i] = new UnicodeString[itemcount];
if(retval->fStrings[i] == 0) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
/* Complicated cleanup later */
delete retval;
return 0;
@@ -218,7 +218,7 @@ read_taglist(FileStream *rb,
/* Setup the tagged list */
retval = new TaggedList();
if(retval == 0) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -269,7 +269,7 @@ rb_parse(FileStream *f,
/* Open the hashtable for saving data */
retval = uhash_open((UHashFunction)uhash_hashUString, &status);
if(retval == 0 || FAILURE(status)) {
- status = MEMORY_ALLOCATION_ERROR;
+ status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
uhash_setValueDeleter(retval, RBHashtable_valueDeleter);
@@ -280,7 +280,7 @@ rb_parse(FileStream *f,
/* Verify the byte ordering matches */
if(bom != sBOM) {
uhash_close(retval);
- status = INVALID_FORMAT_ERROR;
+ status = U_INVALID_FORMAT_ERROR;
return 0;
}
@@ -338,7 +338,7 @@ rb_parse(FileStream *f,
/* Check if any errors occurred during reading */
if(T_FileStream_error(f) != 0) {
- status = FILE_ACCESS_ERROR;
+ status = U_FILE_ACCESS_ERROR;
delete retval;
return 0;
}
diff --git a/icu4c/source/common/resbund.cpp b/icu4c/source/common/resbund.cpp
index cc2ab2710c2..839f0c8580e 100644
--- a/icu4c/source/common/resbund.cpp
+++ b/icu4c/source/common/resbund.cpp
@@ -96,9 +96,9 @@
* that data will not be stored into a TaggedList until a TaggedList
* has been created. Nonetheless, the code in parse() does some
* consistency checks as it runs the network, and fails with an
- * INTERNAL_PROGRAM_ERROR if one of these checks fails. If the input
- * data has a bad format, an INVALID_FORMAT_ERROR is returned. If you
- * see an INTERNAL_PROGRAM_ERROR the transition matrix has a bug in
+ * U_INTERNAL_PROGRAM_ERROR if one of these checks fails. If the input
+ * data has a bad format, an U_INVALID_FORMAT_ERROR is returned. If you
+ * see an U_INTERNAL_PROGRAM_ERROR the transition matrix has a bug in
* it.
*
* Old functionality of multiple locales in a single file is still
@@ -221,22 +221,22 @@ ResourceBundle::LocaleFallbackIterator::nextLocale(UErrorCode& status)
fTriedDefaultLocale = fTriedDefaultLocale || (fLocale == fDefaultLocale);
chopLocale();
- if(status != USING_DEFAULT_ERROR)
- status = USING_FALLBACK_ERROR;
+ if(status != U_USING_DEFAULT_ERROR)
+ status = U_USING_FALLBACK_ERROR;
if(fLocale.size() == 0) {
if(fUseDefaultLocale && !fTriedDefaultLocale) {
fLocale = fDefaultLocale;
fTriedDefaultLocale = TRUE;
- status = USING_DEFAULT_ERROR;
+ status = U_USING_DEFAULT_ERROR;
}
else if( ! fTriedRoot) {
fLocale = fRoot;
fTriedRoot = TRUE;
- status = USING_DEFAULT_ERROR;
+ status = U_USING_DEFAULT_ERROR;
}
else {
- status = MISSING_RESOURCE_ERROR;
+ status = U_MISSING_RESOURCE_ERROR;
return FALSE;
}
}
@@ -297,13 +297,13 @@ ResourceBundle::ResourceBundle( const UnicodeString& path,
fgCache(fgUserCache),
fgVisitedFiles(fgUserVisitedFiles)
{
- status = ZERO_ERROR;
+ status = U_ZERO_ERROR;
int32_t i;
for(i = 0; i < kDataCount; ++i) {
fData[i] = 0;
fLoaded[i] = FALSE;
- fDataStatus[i] = INTERNAL_PROGRAM_ERROR;
+ fDataStatus[i] = U_INTERNAL_PROGRAM_ERROR;
}
fLocaleIterator = 0;
@@ -314,7 +314,7 @@ ResourceBundle::ResourceBundle( const UnicodeString& path,
(void*)this, fgCache, status);
}
else {
- status = MISSING_RESOURCE_ERROR;
+ status = U_MISSING_RESOURCE_ERROR;
}
// Prevent further attempts to load hashtables
@@ -333,7 +333,7 @@ ResourceBundle::saveCollationHashtable(const UnicodeString& localeName,
if( ! bundle->fLoaded[i]) {
bundle->fData[i] = hashtable;
bundle->fLoaded[i] = TRUE;
- bundle->fDataStatus[i] = ZERO_ERROR; /* ??? */
+ bundle->fDataStatus[i] = U_ZERO_ERROR; /* ??? */
return;
}
}
@@ -377,7 +377,7 @@ ResourceBundle::constructForLocale(const PathInfo& path,
fIsDataOwned = FALSE;
fVersionID = 0;
- error = ZERO_ERROR;
+ error = U_ZERO_ERROR;
locale.getName(fRealLocaleID);
@@ -392,15 +392,15 @@ ResourceBundle::constructForLocale(const PathInfo& path,
for(i = 1; i < kDataCount; ++i) {
fData[i] = 0;
- fDataStatus[i] = INTERNAL_PROGRAM_ERROR;
+ fDataStatus[i] = U_INTERNAL_PROGRAM_ERROR;
fLoaded[i] = FALSE;
}
UnicodeString returnedLocale;
- error = ZERO_ERROR;
+ error = U_ZERO_ERROR;
fData[0] = getHashtableForLocale(fRealLocaleID, returnedLocale, error);
fLoaded[0] = TRUE;
- fDataStatus[0] = ZERO_ERROR;
+ fDataStatus[0] = U_ZERO_ERROR;
if(SUCCESS(error))
fRealLocaleID = returnedLocale;
@@ -425,7 +425,7 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
{
if(FAILURE(error)) return 0;
- error = ZERO_ERROR;
+ error = U_ZERO_ERROR;
const UHashtable* h = getFromCache(fPath, desiredLocale, fgCache);
if(h != 0) {
returnedLocale = desiredLocale;
@@ -438,11 +438,11 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
// A note on fileError. We are tracking two different error states
// here. One is that returned while iterating over different files.
// For instance, when going from de_CH.txt to de.txt we will get a
- // USING_FALLBACK_ERROR, but we don't care -- because if de.txt
+ // U_USING_FALLBACK_ERROR, but we don't care -- because if de.txt
// contains the de_CH locale, it isn't a fallback, from our
// perspective. Therefore we keep file associated errors in
// fileError, apart from the error parameter.
- UErrorCode fileError = ZERO_ERROR;
+ UErrorCode fileError = U_ZERO_ERROR;
for(;;) {
// Build a filename for the locale.
@@ -451,7 +451,7 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
if(FAILURE(error))
return 0;
- error = ZERO_ERROR;
+ error = U_ZERO_ERROR;
h = getFromCacheWithFallback(fPath, desiredLocale,
returnedLocale, fgCache, error);
didTryCacheWithFallback = TRUE;
@@ -460,7 +460,7 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
}
if(!iterator.nextLocale(fileError)) {
- error = MISSING_RESOURCE_ERROR;
+ error = U_MISSING_RESOURCE_ERROR;
break;
}
}
@@ -472,7 +472,7 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
// attempt to load our locale from the cache.
if(didTryCacheWithFallback)
return 0;
- error = ZERO_ERROR;
+ error = U_ZERO_ERROR;
return getFromCacheWithFallback(fPath, desiredLocale,
returnedLocale, fgCache, error);
}
@@ -488,7 +488,7 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
{
if(FAILURE(error))
return 0;
- error = ZERO_ERROR;
+ error = U_ZERO_ERROR;
// First try the cache
const UHashtable* h = getFromCache(fPath, desiredLocale, fgCache);
@@ -499,7 +499,7 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
LocaleFallbackIterator iterator(desiredLocale, kDefaultFilename, FALSE);
for(;;) {
- UErrorCode parseError = ZERO_ERROR;
+ UErrorCode parseError = U_ZERO_ERROR;
if(parseIfUnparsed(fPath, iterator.getLocale(),
fgCache, fgVisitedFiles, parseError)) {
if(FAILURE(parseError)) {
@@ -531,7 +531,7 @@ ResourceBundle::getFromCacheWithFallback(const PathInfo& path,
{
if(FAILURE(error))
return 0;
- error = ZERO_ERROR;
+ error = U_ZERO_ERROR;
LocaleFallbackIterator iterator(desiredLocale, kDefaultLocaleName, TRUE);
@@ -585,7 +585,7 @@ const ResourceBundleData*
ResourceBundle::getDataForTag(const UnicodeString& tag,
UErrorCode& err) const
{
- err = ZERO_ERROR; /* just to make sure there's no fallback/etc left over */
+ err = U_ZERO_ERROR; /* just to make sure there's no fallback/etc left over */
// Iterate over the kDataCount hashtables which may be associated with this
// bundle. At most we have kDataCount, but we may have as few as one.
for(int32_t i = 0; i < kDataCount; ++i) {
@@ -595,7 +595,7 @@ ResourceBundle::getDataForTag(const UnicodeString& tag,
ResourceBundle* nonconst = (ResourceBundle*)this;
nonconst->fLoaded[i] = TRUE;
if(fLocaleIterator->nextLocale(err)) {
- UErrorCode getHashtableStatus = ZERO_ERROR;
+ UErrorCode getHashtableStatus = U_ZERO_ERROR;
nonconst->fDataStatus[i] = err;
nonconst->fData[i] =
@@ -619,7 +619,7 @@ ResourceBundle::getDataForTag(const UnicodeString& tag,
// cerr << "Failed to find tag " << tag << " in " << fPath << fRealLocaleID << fFilenameSuffix << endl;
// cerr << *this;
#endif
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return 0;
}
@@ -649,7 +649,7 @@ ResourceBundle::getString( const UnicodeString& resourceTag,
&& ((StringList*)data)->fCount == 1) {
return &(((StringList*)data)->fStrings[0]);
}
- else err = MISSING_RESOURCE_ERROR;
+ else err = U_MISSING_RESOURCE_ERROR;
return NULL;
}
@@ -667,7 +667,7 @@ ResourceBundle::getStringArray( const UnicodeString& resourceTag,
count = ((StringList*)data)->fCount;
return ((StringList*)data)->fStrings;
}
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return 0;
}
@@ -704,7 +704,7 @@ ResourceBundle::getArrayItem( const UnicodeString& resourceTag,
return &(((StringList*)data)->fStrings[index]);
}
else
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return NULL;
}
@@ -726,7 +726,7 @@ ResourceBundle::get2dArray(const UnicodeString& resourceTag,
// Why is this cast required? It shouldn't be. [LIU]
return (const UnicodeString**)list->fStrings;
}
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return 0;
}
@@ -769,7 +769,7 @@ ResourceBundle::get2dArrayItem(const UnicodeString& resourceTag,
return &(list->fStrings[rowIndex][columnIndex]);
}
}
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return NULL;
}
@@ -804,7 +804,7 @@ ResourceBundle::getTaggedArrayItem( const UnicodeString& resourceTag,
return s;
}
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return NULL;
}
@@ -847,7 +847,7 @@ getTaggedArrayUCharsImplementation( const ResourceBundle* bundle,
const ResourceBundleData* data = bundle->getDataForTag(resourceTag, err);
if(FAILURE(err) || data == 0
|| data->getDynamicClassID() != TaggedList::getStaticClassID()) {
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return;
}
@@ -880,7 +880,7 @@ ResourceBundle::getTaggedArray( const UnicodeString& resourceTag,
const ResourceBundleData* data = getDataForTag(resourceTag, err);
if(FAILURE(err) || data == 0
|| data->getDynamicClassID() != TaggedList::getStaticClassID()) {
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return;
}
@@ -913,7 +913,7 @@ ResourceBundle::getVersionNumber() const
if(fVersionID == 0) {
// If the version ID has not been built yet, then do so. Retrieve
// the minor version from the file.
- UErrorCode status = ZERO_ERROR;
+ UErrorCode status = U_ZERO_ERROR;
UnicodeString minor_version;
getString(kVersionTag, minor_version, status);
@@ -953,7 +953,7 @@ ResourceBundle::listInstalledLocales(const UnicodeString& path,
kIndexLocaleName, fgUserCache);
if(h == 0) {
- UErrorCode error = ZERO_ERROR;
+ UErrorCode error = U_ZERO_ERROR;
if(parseIfUnparsed(PathInfo(path, kDefaultSuffix),
kIndexFilename, fgUserCache,
fgUserVisitedFiles, error)) {
@@ -1014,7 +1014,7 @@ T_ResourceBundle_countArrayItemsImplementation(const ResourceBundle* resourceBun
return 0;
if(!resourceKey) {
- err = ILLEGAL_ARGUMENT_ERROR;
+ err = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
const ResourceBundleData* data = resourceBundle->getDataForTag(resourceKey,
@@ -1035,7 +1035,7 @@ T_ResourceBundle_countArrayItemsImplementation(const ResourceBundle* resourceBun
numItems = ((String2dList*)data)->fRowCount;
}
else {
- err = MISSING_RESOURCE_ERROR;
+ err = U_MISSING_RESOURCE_ERROR;
return 0;
}
@@ -1087,7 +1087,7 @@ ResourceBundle::parse(const PathInfo& path,
f = path.openFile(locale);
if(f == 0) {
- status = FILE_ACCESS_ERROR;
+ status = U_FILE_ACCESS_ERROR;
return;
}
@@ -1113,7 +1113,7 @@ ResourceBundle::addToCache(const UnicodeString& localeName,
{
PathInfo *c = (PathInfo*)context;
UnicodeString keyName(c->makeHashkey(localeName));
- UErrorCode err = ZERO_ERROR;
+ UErrorCode err = U_ZERO_ERROR;
Mutex lock;
if(uhash_get(fgCache->hashTable, keyName.hashCode() & 0x7FFFFFFF) == 0) {
uhash_putKey(fgCache->hashTable, keyName.hashCode() & 0x7FFFFFFF,
diff --git a/icu4c/source/common/resbund.h b/icu4c/source/common/resbund.h
index 915440fb287..158d1c2161c 100644
--- a/icu4c/source/common/resbund.h
+++ b/icu4c/source/common/resbund.h
@@ -138,7 +138,7 @@ typedef struct _FileStream FileStream;
* This is an example for using a possible custom resource:
*
* . Locale currentLocale;
- * . UErrorCode success = ZERO_ERROR;
+ * . UErrorCode success = U_ZERO_ERROR;
* . ResourceBundle myResources("MyResources", currentLocale, success );
* .
* . UnicodeString button1Title, button2Title;
@@ -168,9 +168,9 @@ public:
* The UErrorCode& err parameter is used to return status information to the user. To
* check whether the construction succeeded or not, you should check the value of
* SUCCESS(err). If you wish more detailed information, you can check for
- * informational error results which still indicate success. USING_FALLBACK_ERROR
+ * informational error results which still indicate success. U_USING_FALLBACK_ERROR
* indicates that a fall back locale was used. For example, 'de_CH' was requested,
- * but nothing was found there, so 'de' was used. USING_DEFAULT_ERROR indicates that
+ * but nothing was found there, so 'de' was used. U_USING_DEFAULT_ERROR indicates that
* the default locale data was used; neither the requested locale nor any of its
* fall back locales could be found.
*/
@@ -192,7 +192,7 @@ public:
*
* @param resourceTag The resource tag of the string resource the caller wants
* @param theString Receives the actual data in the resource
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found.
*/
void getString( const UnicodeString& resourceTag,
@@ -205,7 +205,7 @@ public:
* these will be parsed prior to the data's return.
*
* @param resourceTag The resource tag of the string resource the caller wants
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found.
* @return A pointer to the string from the resource bundle, or NULL if there was
* an error.
@@ -219,13 +219,13 @@ public:
* objects. The number of elements in the array is returned in numArrayItems.
* Calling getStringArray on a resource of type string will return an array with one
* element; calling it on a resource of type tagged-array results in a
- * MISSING_RESOURCE_ERROR error.
+ * U_MISSING_RESOURCE_ERROR error.
*
* @param resourceTag The resource tag of the string-array resource the caller
* wants
* @param numArrayItems Receives the number of items in the array the function
* returns.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found.
* @return The resource requested, as a pointer to an array of
* UnicodeStrings. The caller does not own the storage and
@@ -238,7 +238,7 @@ public:
/**
* Returns a single item from a string-array resource. This will return the contents
* of a single item in a resource of string-array (comma-delimited-list) type. If
- * the resource is not an array, a MISSING_RESOURCE_ERROR will be returned in err.
+ * the resource is not an array, a U_MISSING_RESOURCE_ERROR will be returned in err.
* [THIS FUNCTION IS DEPRECATED; USE THE OVERLOAD BELOW INSTEAD]
*
* @param resourceTag The resource tag of the resource the caller wants to extract
@@ -246,7 +246,7 @@ public:
* @param index The index (zero-based) of the particular array item the user
* wants to extract from the resource.
* @param theArrayItem Receives the actual text of the desired array item.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found, or if the index was out of range.
*/
void getArrayItem( const UnicodeString& resourceTag,
@@ -257,13 +257,13 @@ public:
/**
* Returns a single item from a string-array resource. This will return the contents
* of a single item in a resource of string-array (comma-delimited-list) type. If
- * the resource is not an array, a MISSING_RESOURCE_ERROR will be returned in err.
+ * the resource is not an array, a U_MISSING_RESOURCE_ERROR will be returned in err.
*
* @param resourceTag The resource tag of the resource the caller wants to extract
* an item from.
* @param index The index (zero-based) of the particular array item the user
* wants to extract from the resource.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found, or if the index was out of range.
* @return A pointer to the text of the array item, or NULL is there was an error.
*/
@@ -275,7 +275,7 @@ public:
* Return the contents of a 2-dimensional array resource. The return value will be a
* UnicodeString** array. (This is really an array of pointers; each pointer is a
* ROW of the data.) The number of rows and columns is returned. If the resource is
- * of the wrong type, or not present, MISSING_RESOURCE_ERROR is placed in err.
+ * of the wrong type, or not present, U_MISSING_RESOURCE_ERROR is placed in err.
*
* @param resourceTag The resource tag of the string-array resource the caller
* wants
@@ -283,7 +283,7 @@ public:
* returns.
* @param columnCount Receives the number of columns in the array the function
* returns.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found.
* @return The resource requested, as a UnicodeStrings**. The caller
* does not own the storage and must not delete it.
@@ -296,7 +296,7 @@ public:
/**
* Return a single string from a 2-dimensional array resource. If the resource does
* not exists, or if it is not a 2-d array, or if the row or column indices are out
- * of bounds, err is set to MISSING_RESOURCE_ERROR.
+ * of bounds, err is set to U_MISSING_RESOURCE_ERROR.
* [THIS FUNCTION IS DEPRECATED; USE THE OVERLOAD BELOW INSTEAD]
*
* @param resourceTag The resource tag of the resource the caller wants to extract
@@ -306,7 +306,7 @@ public:
* @param columnIndex The column index (zero-based) of the array item the user
* wants to extract from the resource.
* @param theArrayItem Receives the actual text of the desired array item.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found, if the resource data was in
* the wrong format, or if either index is out of bounds.
*/
@@ -319,7 +319,7 @@ public:
/**
* Return a single string from a 2-dimensional array resource. If the resource does
* not exists, or if it is not a 2-d array, or if the row or column indices are out
- * of bounds, err is set to MISSING_RESOURCE_ERROR.
+ * of bounds, err is set to U_MISSING_RESOURCE_ERROR.
*
* @param resourceTag The resource tag of the resource the caller wants to extract
* an item from.
@@ -327,7 +327,7 @@ public:
* to extract from the resource.
* @param columnIndex The column index (zero-based) of the array item the user
* wants to extract from the resource.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found, if the resource data was in
* the wrong format, or if either index is out of bounds.
* @return A pointer to the text of the array item, or NULL is there was an error.
@@ -348,7 +348,7 @@ public:
* an item from.
* @param itemTag The item tag for the item the caller wants to extract.
* @param theArrayItem Receives the text of the desired array item.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified resource tag couldn't be found, or if an item
* with the specified item tag couldn't be found in the resource.
*/
@@ -366,7 +366,7 @@ public:
* @param resourceTag The resource tag of the resource the caller wants to extract
* an item from.
* @param itemTag The item tag for the item the caller wants to extract.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified resource tag couldn't be found, or if an item
* with the specified item tag coldn't be found in the resource.
* @return A pointer to the text of the array item, or NULL is there was an error.
@@ -394,7 +394,7 @@ public:
* own this array, and must delete it.
* @param numItems Receives the number of items in the arrays pointed to by
* items and itemTags.
- * @param err Set to MISSING_RESOURCE_ERROR if a resource with the
+ * @param err Set to U_MISSING_RESOURCE_ERROR if a resource with the
* specified tag couldn't be found.
*/
void getTaggedArray( const UnicodeString& resourceTag,
@@ -627,7 +627,3 @@ private:
};
#endif
-
-
-
-
diff --git a/icu4c/source/common/scsu.c b/icu4c/source/common/scsu.c
index ff4cb4a5cd9..b2725429921 100644
--- a/icu4c/source/common/scsu.c
+++ b/icu4c/source/common/scsu.c
@@ -278,7 +278,7 @@ scsu_compress(UnicodeCompressor *comp,
}
/* verify the target buffer can hold at least 4 bytes */
else if(targetLimit - byteBuffer < 4) {
- *status = ILLEGAL_ARGUMENT_ERROR;
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -836,7 +836,7 @@ scsu_compress(UnicodeCompressor *comp,
*source = unicharBuffer;
if(unicharBuffer < sourceLimit)
- *status = INDEX_OUTOFBOUNDS_ERROR;
+ *status = U_INDEX_OUTOFBOUNDS_ERROR;
}
void
@@ -869,7 +869,7 @@ scsu_decompress(UnicodeCompressor *comp,
}
/* verify the target buffer can hold at least 1 UChar */
else if(targetLimit - unicharBuffer < sizeof(UChar)) {
- *status = ILLEGAL_ARGUMENT_ERROR;
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1229,7 +1229,7 @@ scsu_decompress(UnicodeCompressor *comp,
*source = byteBuffer;
if(byteBuffer < sourceLimit)
- *status = INDEX_OUTOFBOUNDS_ERROR;
+ *status = U_INDEX_OUTOFBOUNDS_ERROR;
}
/** Reset the compressor to its initial state. */
diff --git a/icu4c/source/common/scsu.h b/icu4c/source/common/scsu.h
index 41b90c3d288..38a5b04fe36 100644
--- a/icu4c/source/common/scsu.h
+++ b/icu4c/source/common/scsu.h
@@ -82,9 +82,9 @@ CAPI void U_EXPORT2 scsu_reset(UnicodeCompressor *comp);
* This function is not guaranteed to completely fill the output buffer, nor
* is it guaranteed to compress the entire input.
* If the source data is completely compressed, status will be set
- * to ZERO_ERROR.
+ * to U_ZERO_ERROR.
* If the source data is not completely compressed, status will be
- * set to INDEX_OUTOFBOUNDS_ERROR. If this occurs, larger buffers
+ * set to U_INDEX_OUTOFBOUNDS_ERROR. If this occurs, larger buffers
* should be allocated, or data flushed, and the function should be called
* again with the new buffers.
*
@@ -114,9 +114,9 @@ CAPI void U_EXPORT2 scsu_compress(UnicodeCompressor *comp,
* This function will either completely fill the output buffer, or
* consume the entire input.
* If the source data is completely compressed, status will be set
- * to ZERO_ERROR.
+ * to U_ZERO_ERROR.
* If the source data is not completely compressed, status will be
- * set to INDEX_OUTOFBOUNDS_ERROR. If this occurs, larger buffers
+ * set to U_INDEX_OUTOFBOUNDS_ERROR. If this occurs, larger buffers
* should be allocated, or data flushed, and the function should be called
* again with the new buffers.
*
diff --git a/icu4c/source/common/ubidi.c b/icu4c/source/common/ubidi.c
index 189bbe64e96..7382f7467e3 100644
--- a/icu4c/source/common/ubidi.c
+++ b/icu4c/source/common/ubidi.c
@@ -136,7 +136,7 @@ adjustWSLevels(UBiDi *pBiDi);
CAPI UBiDi * U_EXPORT2
ubidi_open() {
- UErrorCode errorCode=ZERO_ERROR;
+ UErrorCode errorCode=U_ZERO_ERROR;
return ubidi_openSized(0, 0, &errorCode);
}
@@ -148,14 +148,14 @@ ubidi_openSized(UTextOffset maxLength, UTextOffset maxRunCount, UErrorCode *pErr
if(pErrorCode==NULL || FAILURE(*pErrorCode)) {
return NULL;
} else if(maxLength<0 || maxRunCount<0) {
- *pErrorCode=ILLEGAL_ARGUMENT_ERROR;
+ *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return NULL; /* invalid arguments */
}
/* allocate memory for the object */
pBiDi=(UBiDi *)icu_malloc(sizeof(UBiDi));
if(pBiDi==NULL) {
- *pErrorCode=MEMORY_ALLOCATION_ERROR;
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
@@ -167,7 +167,7 @@ ubidi_openSized(UTextOffset maxLength, UTextOffset maxRunCount, UErrorCode *pErr
if( !getInitialDirPropsMemory(pBiDi, maxLength) ||
!getInitialLevelsMemory(pBiDi, maxLength)
) {
- *pErrorCode=MEMORY_ALLOCATION_ERROR;
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
}
} else {
pBiDi->mayAllocateText=TRUE;
@@ -178,7 +178,7 @@ ubidi_openSized(UTextOffset maxLength, UTextOffset maxRunCount, UErrorCode *pErr
/* use simpleRuns[] */
pBiDi->runsSize=sizeof(Run);
} else if(!getInitialRunsMemory(pBiDi, maxRunCount)) {
- *pErrorCode=MEMORY_ALLOCATION_ERROR;
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
}
} else {
pBiDi->mayAllocateRuns=TRUE;
@@ -271,7 +271,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, UTextOffset length,
(UBIDI_MAX_EXPLICIT_LEVEL
*- * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . UNumberFormat *nf; * . const char* myLocale = "fr_FR"; * . diff --git a/icu4c/source/common/unistr.cpp b/icu4c/source/common/unistr.cpp index 7541a651636..97b076883f6 100644 --- a/icu4c/source/common/unistr.cpp +++ b/icu4c/source/common/unistr.cpp @@ -759,7 +759,7 @@ UnicodeString::extract(UTextOffset start, const UChar *mySource = getArrayStart() + start; const UChar *mySourceEnd = mySource + length; char *myTarget = dst; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t arraySize = 0x0FFFFFFF; // create the converter @@ -810,7 +810,7 @@ UnicodeString::doCodepageCreate(const char *codepageData, const char *mySource = codepageData; const char *mySourceEnd = mySource + sourceLen; UChar *myTarget = getArrayStart(); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t arraySize = getCapacity(); // create the converter @@ -835,7 +835,7 @@ UnicodeString::doCodepageCreate(const char *codepageData, // perform the conversion do { // reset the error code - status = ZERO_ERROR; + status = U_ZERO_ERROR; // perform the conversion ucnv_toUnicode(converter, &myTarget, myTarget + arraySize, @@ -880,7 +880,7 @@ UnicodeString::doCodepageCreate(const char *codepageData, arraySize = getCapacity() - fLength; } } - while(status == INDEX_OUTOFBOUNDS_ERROR); + while(status == U_INDEX_OUTOFBOUNDS_ERROR); fHashCode = kInvalidHashCode; @@ -1245,5 +1245,3 @@ operator<<(ostream& stream, stream.setf(saveFlags & ios::basefield, ios::basefield); return stream; } - - diff --git a/icu4c/source/common/ures.cpp b/icu4c/source/common/ures.cpp index cc9c73e3371..23ddfa398a7 100644 --- a/icu4c/source/common/ures.cpp +++ b/icu4c/source/common/ures.cpp @@ -69,7 +69,7 @@ CAPI const UChar* ures_get( const UResourceBundle* resourceBundle, if (FAILURE(*status)) return NULL; if (!resourceBundle || !resourceTag) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return NULL; } @@ -87,7 +87,7 @@ CAPI const UChar* ures_getArrayItem(const UResourceBundle* resourceBundle, if (FAILURE(*status)) return NULL; if (!resourceBundle || !resourceTag || (resourceIndex < 0)) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return NULL; } @@ -108,7 +108,7 @@ CAPI const UChar* ures_get2dArrayItem(const UResourceBundle* resourceBundle, if (FAILURE(*status)) return NULL; if (!resourceBundle || !resourceTag || (rowIndex < 0) || (columnIndex < 0)) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return NULL; } @@ -128,7 +128,7 @@ CAPI const UChar* ures_getTaggedArrayItem(const UResourceBundle* resourceBundl if (FAILURE(*status)) return NULL; if (!resourceBundle || !resourceTag || !itemTag) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return NULL; } @@ -179,7 +179,4 @@ extern "C" void T_ResourceBundle_getTaggedArrayUChars(const ResourceBundle* UR int32_t* numItems, UErrorCode* err); - //eof - - diff --git a/icu4c/source/common/ures.h b/icu4c/source/common/ures.h index 91aff86e585..ed5cf9775d8 100644 --- a/icu4c/source/common/ures.h +++ b/icu4c/source/common/ures.h @@ -107,7 +107,7 @@ * This is an example for using a possible custom resource: ** . const char *currentLocale; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . UResourceBundle* myResources=ures_open("MyResources", currentLocale, &success ); * . * . UChar *button1Title, *button2Title; @@ -141,9 +141,9 @@ typedef void* UResourceBundle; * The UErrorCode err parameter is used to return status information to the user. To * check whether the construction succeeded or not, you should check the value of * SUCCESS(err). If you wish more detailed information, you can check for - * informational error results which still indicate success. USING_FALLBACK_ERROR + * informational error results which still indicate success. U_USING_FALLBACK_ERROR * indicates that a fall back locale was used. For example, 'de_CH' was requested, - * but nothing was found there, so 'de' was used. USING_DEFAULT_ERROR indicates that + * but nothing was found there, so 'de' was used. U_USING_DEFAULT_ERROR indicates that * the default locale data was used; neither the requested locale nor any of its * fall back locales could be found. *@return : a newly allocated resource bundle. @@ -182,9 +182,9 @@ CAPI UResourceBundle* U_EXPORT2 ures_openW(const wchar_t* path, *@param resourceBundle: resourceBundle containing the desired string *@param resourceTag: key tagging the desired string *@param status: fills in the outgoing error code -* could be MISSING_RESOURCE_ERROR if the key is not found +* could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error -* e.g.: USING_FALLBACK_ERROR,USING_DEFAULT_ERROR +* e.g.: U_USING_FALLBACK_ERROR,U_USING_DEFAULT_ERROR *@return: a library-owned zero-terminated unicode string (its lifetime * is that of the resource bundle.) *@see ures_getArrayItem @@ -202,9 +202,9 @@ CAPI const UChar* U_EXPORT2 ures_get(const UResourceBundle* resourceBundle, *@param resourceTag: key tagging the desired array *@param resourceIndex: index of the desired string *@param status: fills in the outgoing error code -* could be MISSING_RESOURCE_ERROR if the key is not found +* could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error -* e.g.: USING_FALLBACK_ERROR,USING_DEFAULT_ERROR +* e.g.: U_USING_FALLBACK_ERROR,U_USING_DEFAULT_ERROR *@return: a library-owned zero-terminated unicode string (its lifetime * is that of the resource bundle.) *@see ures_get @@ -224,9 +224,9 @@ CAPI const UChar* U_EXPORT2 ures_getArrayItem(const UResourceBundle* resourc *@param resourceIndex: x index of the desired string *@param resourceIndex: y index of the desired string *@param status: fills in the outgoing error code -* could be MISSING_RESOURCE_ERROR if the key is not found +* could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error -* e.g.: USING_FALLBACK_ERROR,USING_DEFAULT_ERROR +* e.g.: U_USING_FALLBACK_ERROR,U_USING_DEFAULT_ERROR *@return: a library-owned zero-terminated unicode string (its lifetime * is that of the resource bundle.) *@see ures_get @@ -247,9 +247,9 @@ CAPI const UChar* U_EXPORT2 ures_get2dArrayItem(const UResourceBundle* resourc *@param resourceTag: key tagging the desired array *@param resourceIndex: key tagging the desired string *@param status: fills in the outgoing error code -* could be MISSING_RESOURCE_ERROR if the key is not found +* could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error -* e.g.: USING_FALLBACK_ERROR,USING_DEFAULT_ERROR +* e.g.: U_USING_FALLBACK_ERROR,U_USING_DEFAULT_ERROR *@return: a library-owned zero-terminated unicode string (its lifetime * is that of the resource bundle.) *@see ures_get @@ -270,9 +270,9 @@ CAPI const UChar* U_EXPORT2 ures_getTaggedArrayItem(const UResourceBundle* res *@param resourceBundle: resource bundle containing the desired strings *@param resourceKey: key tagging the resource *@param err: fills in the outgoing error code -* could be MISSING_RESOURCE_ERROR if the key is not found +* could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error -* e.g.: USING_FALLBACK_ERROR,USING_DEFAULT_ERROR +* e.g.: U_USING_FALLBACK_ERROR,U_USING_DEFAULT_ERROR *@return: for Arrays: returns the number of strings in the array * 2d Arrays: returns the number of 1d arrays * taggedArrays: returns the number of strings in the array @@ -291,9 +291,9 @@ CAPI int32_t U_EXPORT2 ures_countArrayItems(const UResourceBundle* resourceBundl * on this particular bundle are INVALID henceforth. * @param resourceBundle: a succesfully opened resourceBundle. * @param status: fills in the outgoing error code -* could be MISSING_RESOURCE_ERROR if the key is not found +* could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error -* e.g.: USING_FALLBACK_ERROR,USING_DEFAULT_ERROR +* e.g.: U_USING_FALLBACK_ERROR,U_USING_DEFAULT_ERROR * @see ures_open * @see ures_openW */ @@ -319,6 +319,3 @@ CAPI void U_EXPORT2 ures_close(UResourceBundle* resourceBundle); CAPI const char* U_EXPORT2 ures_getVersionNumber(const UResourceBundle* resourceBundle); #endif /*_URES*/ /*eof*/ - - - diff --git a/icu4c/source/common/ustring.c b/icu4c/source/common/ustring.c index de6618f8d0d..eefbee9bc35 100644 --- a/icu4c/source/common/ustring.c +++ b/icu4c/source/common/ustring.c @@ -25,7 +25,7 @@ static UConverter* _defaultConverter = NULL; -static UErrorCode gErr = ZERO_ERROR; +static UErrorCode gErr = U_ZERO_ERROR; #define MAX_STRLEN 0x00FFFFFF @@ -134,7 +134,7 @@ u_strlen(const UChar *s) UChar* u_uastrcpy(UChar *ucs1, const char *s2 ) { - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; ucnv_toUChars(defaultConverter, ucs1, MAX_STRLEN, @@ -149,7 +149,7 @@ UChar* u_uastrncpy(UChar *ucs1, const char *s2 , int32_t n) { - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; int32_t end = ucnv_toUChars(defaultConverter, ucs1, n, @@ -165,7 +165,7 @@ char* u_austrcpy(char *s1, const UChar *ucs2 ) { char * anchor = s1; /* save the start of result string */ - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; int32_t len = ucnv_fromUChars(defaultConverter, s1, MAX_STRLEN, diff --git a/icu4c/source/common/utypes.h b/icu4c/source/common/utypes.h index 0ea3d767bff..16c34ed9201 100644 --- a/icu4c/source/common/utypes.h +++ b/icu4c/source/common/utypes.h @@ -104,6 +104,17 @@ +/* Define NULL pointer value if it isn't already defined */ + +#ifndef NULL +#ifdef XP_CPLUSPLUS +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + + /*===========================================================================*/ /* Calendar/TimeZone data types */ /*===========================================================================*/ @@ -197,25 +208,30 @@ typedef void* ClassID; /** Error code to replace exception handling */ enum UErrorCode { - ZERO_ERROR = 0, - ILLEGAL_ARGUMENT_ERROR = 1, /* Start of codes indicating failure */ - MISSING_RESOURCE_ERROR = 2, - INVALID_FORMAT_ERROR = 3, - FILE_ACCESS_ERROR = 4, - INTERNAL_PROGRAM_ERROR = 5, /* Indicates a bug in the library code */ - MESSAGE_PARSE_ERROR = 6, - MEMORY_ALLOCATION_ERROR = 7, /* Memory allocation error */ - INDEX_OUTOFBOUNDS_ERROR = 8, - PARSE_ERROR = 9, /* Equivalent to Java ParseException */ - INVALID_CHAR_FOUND = 10, /* In the Character conversion routines: Invalid character or sequence was encountered*/ - TRUNCATED_CHAR_FOUND = 11, /* In the Character conversion routines: More bytes are required to complete the conversion successfully*/ - ILLEGAL_CHAR_FOUND = 12, /* In codeset conversion: a sequence that does NOT belong in the codepage has been encountered*/ - INVALID_TABLE_FORMAT = 13, /*Conversion table file found, nut corrupted*/ - INVALID_TABLE_FILE = 14, /*Conversion table file not found*/ - BUFFER_OVERFLOW_ERROR = 15, /* A result would not fit in the supplied buffer */ - UNSUPPORTED_ERROR = 16, /* Requested operation not supported in current context */ - USING_FALLBACK_ERROR = -128, /* Start of information results (semantically successful) */ - USING_DEFAULT_ERROR = -127 + U_ERROR_INFO_START = -128, /* Start of information results (semantically successful) */ + U_USING_FALLBACK_ERROR = -128, + U_USING_DEFAULT_ERROR = -127, + U_ERROR_INFO_LIMIT, + + U_ZERO_ERROR = 0, /* success */ + + U_ILLEGAL_ARGUMENT_ERROR = 1, /* Start of codes indicating failure */ + U_MISSING_RESOURCE_ERROR = 2, + U_INVALID_FORMAT_ERROR = 3, + U_FILE_ACCESS_ERROR = 4, + U_INTERNAL_PROGRAM_ERROR = 5, /* Indicates a bug in the library code */ + U_MESSAGE_PARSE_ERROR = 6, + U_MEMORY_ALLOCATION_ERROR = 7, /* Memory allocation error */ + U_INDEX_OUTOFBOUNDS_ERROR = 8, + U_PARSE_ERROR = 9, /* Equivalent to Java ParseException */ + U_INVALID_CHAR_FOUND = 10, /* In the Character conversion routines: Invalid character or sequence was encountered*/ + U_TRUNCATED_CHAR_FOUND = 11, /* In the Character conversion routines: More bytes are required to complete the conversion successfully*/ + U_ILLEGAL_CHAR_FOUND = 12, /* In codeset conversion: a sequence that does NOT belong in the codepage has been encountered*/ + U_INVALID_TABLE_FORMAT = 13, /* Conversion table file found, but corrupted*/ + U_INVALID_TABLE_FILE = 14, /* Conversion table file not found*/ + U_BUFFER_OVERFLOW_ERROR = 15, /* A result would not fit in the supplied buffer */ + U_UNSUPPORTED_ERROR = 16, /* Requested operation not supported in current context */ + U_ERROR_LIMIT }; #ifndef XP_CPLUSPLUS @@ -225,11 +241,11 @@ typedef enum UErrorCode UErrorCode; /* Use the following to determine if an UErrorCode represents */ /* operational success or failure. */ #ifdef XP_CPLUSPLUS -inline bool_t SUCCESS(UErrorCode code) { return (bool_t)(code<=ZERO_ERROR); } -inline bool_t FAILURE(UErrorCode code) { return (bool_t)(code>ZERO_ERROR); } +inline bool_t SUCCESS(UErrorCode code) { return (bool_t)(code<=U_ZERO_ERROR); } +inline bool_t FAILURE(UErrorCode code) { return (bool_t)(code>U_ZERO_ERROR); } #else -#define SUCCESS(x) ((x)<=ZERO_ERROR) -#define FAILURE(x) ((x)>ZERO_ERROR) +#define SUCCESS(x) ((x)<=U_ZERO_ERROR) +#define FAILURE(x) ((x)>U_ZERO_ERROR) #endif @@ -296,42 +312,56 @@ icu_arrayCopy(const UChar *src, int32_t srcStart, /* This function is useful for debugging; it returns the text name */ /* of an UErrorCode result. This is not the most efficient way of */ /* doing this but it's just for Debug builds anyway. */ -#if defined(_DEBUG) && defined(XP_CPLUSPLUS) -inline const char* errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case PARSE_ERROR: return "PARSE_ERROR"; - case INVALID_CHAR_FOUND: return "INVALID_CHAR_FOUND"; - case TRUNCATED_CHAR_FOUND: return "TRUNCATED_CHAR_FOUND"; - case ILLEGAL_CHAR_FOUND: return "ILLEGAL_CHAR_FOUND"; - case INVALID_TABLE_FORMAT: return "INVALID_TABLE_FORMAT"; - case INVALID_TABLE_FILE: return "INVALID_TABLE_FILE"; - case BUFFER_OVERFLOW_ERROR: return "BUFFER_OVERFLOW_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} -#endif -/* Define NULL pointer value if it isn't already defined */ +/* Do not use these arrays directly: they will move to a .c file! */ +static const char * +_uErrorInfoName[U_ERROR_INFO_LIMIT-U_ERROR_INFO_START]={ + "U_USING_FALLBACK_ERROR", + "U_USING_DEFAULT_ERROR" +}; + +static const char * +_uErrorName[U_ERROR_LIMIT]={ + "U_ZERO_ERROR", + + "U_ILLEGAL_ARGUMENT_ERROR", + "U_MISSING_RESOURCE_ERROR", + "U_INVALID_FORMAT_ERROR", + "U_FILE_ACCESS_ERROR", + "U_INTERNAL_PROGRAM_ERROR", + "U_MESSAGE_PARSE_ERROR", + "U_MEMORY_ALLOCATION_ERROR", + "U_INDEX_OUTOFBOUNDS_ERROR", + "U_PARSE_ERROR", + "U_INVALID_CHAR_FOUND", + "U_TRUNCATED_CHAR_FOUND", + "U_ILLEGAL_CHAR_FOUND", + "U_INVALID_TABLE_FORMAT", + "U_INVALID_TABLE_FILE", + "U_BUFFER_OVERFLOW_ERROR", + "U_UNSUPPORTED_ERROR" +}; -#ifndef NULL #ifdef XP_CPLUSPLUS -#define NULL 0 +inline const char * +errorName(UErrorCode code) +{ + if(code>=0 && code=U_ERROR_INFO_START && code =0 && (code) =U_ERROR_INFO_START && (code) fNumberFormat == 0) { bundle->fNumberFormat = unum_open(UNUM_DEFAULT, bundle->fLocale, &status); @@ -133,7 +133,7 @@ u_locbund_getNumberFormat(ULocaleBundle *bundle) UNumberFormat* u_locbund_getPercentFormat(ULocaleBundle *bundle) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if(bundle->fPercentFormat == 0) { bundle->fPercentFormat = unum_open(UNUM_PERCENT, bundle->fLocale, &status); @@ -147,7 +147,7 @@ u_locbund_getPercentFormat(ULocaleBundle *bundle) UNumberFormat* u_locbund_getCurrencyFormat(ULocaleBundle *bundle) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if(bundle->fCurrencyFormat == 0) { bundle->fCurrencyFormat = unum_open(UNUM_CURRENCY, bundle->fLocale, @@ -164,7 +164,7 @@ u_locbund_getCurrencyFormat(ULocaleBundle *bundle) UNumberFormat* u_locbund_getScientificFormat(ULocaleBundle *bundle) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar pattern [PAT_SIZE]; if(bundle->fScientificFormat == 0) { @@ -184,7 +184,7 @@ u_locbund_getScientificFormat(ULocaleBundle *bundle) UNumberFormat* u_locbund_getSpelloutFormat(ULocaleBundle *bundle) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if(bundle->fSpelloutFormat == 0) { bundle->fSpelloutFormat = unum_open(UNUM_SPELLOUT, bundle->fLocale, @@ -197,7 +197,7 @@ u_locbund_getSpelloutFormat(ULocaleBundle *bundle) UDateFormat* u_locbund_getDateFormat(ULocaleBundle *bundle) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if(bundle->fDateFormat == 0) { bundle->fDateFormat = udat_open(UDAT_NONE, UDAT_DEFAULT, @@ -210,7 +210,7 @@ u_locbund_getDateFormat(ULocaleBundle *bundle) UDateFormat* u_locbund_getTimeFormat(ULocaleBundle *bundle) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if(bundle->fTimeFormat == 0) { bundle->fTimeFormat = udat_open(UDAT_DEFAULT, UDAT_NONE, diff --git a/icu4c/source/extra/ustdio/loccache.c b/icu4c/source/extra/ustdio/loccache.c index ae307321b3a..8b3876d7585 100644 --- a/icu4c/source/extra/ustdio/loccache.c +++ b/icu4c/source/extra/ustdio/loccache.c @@ -44,7 +44,7 @@ u_loccache_get(const char *loc) UHashtable *tempCache; int32_t locCount; int32_t hashKey; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* Create the cache, if needed */ if(gLocaleCache == 0) { diff --git a/icu4c/source/extra/ustdio/ufile.c b/icu4c/source/extra/ustdio/ufile.c index 13fb020a46c..cf47d4929a2 100644 --- a/icu4c/source/extra/ustdio/ufile.c +++ b/icu4c/source/extra/ustdio/ufile.c @@ -127,7 +127,7 @@ u_fopen(const char *filename, const char *locale, const char *codepage) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; bool_t useSysCP = (locale == 0 && codepage == 0); UFILE *result = (UFILE*) malloc(sizeof(UFILE)); if(result == 0) @@ -182,7 +182,7 @@ u_finit(FILE *f, const char *locale, const char *codepage) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; bool_t useSysCP = (locale == 0 && codepage == 0); UFILE *result = (UFILE*) malloc(sizeof(UFILE)); if(result == 0) @@ -269,7 +269,7 @@ u_fsetlocale(const char *locale, const char* u_fgetcodepage(UFILE *file) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const char *codepage; codepage = ucnv_getName(file->fConverter, &status); @@ -281,7 +281,7 @@ int32_t u_fsetcodepage( const char *codepage, UFILE *file) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* if the codepage is 0, use the default for the locale */ if(codepage == 0) { diff --git a/icu4c/source/extra/ustdio/ufmt_cmn.c b/icu4c/source/extra/ustdio/ufmt_cmn.c index 45a13473197..9f9fb88d687 100644 --- a/icu4c/source/extra/ustdio/ufmt_cmn.c +++ b/icu4c/source/extra/ustdio/ufmt_cmn.c @@ -136,7 +136,7 @@ ufmt_defaultCPToUnicode(const char *s, int32_t size; UChar *target, *alias; UConverter *defConverter; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; defConverter = ucnv_open(ucnv_getDefaultName(), &status); if(FAILURE(status) || defConverter == 0) @@ -170,7 +170,7 @@ ufmt_unicodeToDefaultCP(const UChar *s, char *target, *alias; const UChar *consumed = 0; UConverter *defConverter; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; defConverter = ucnv_open(ucnv_getDefaultName(), &status); if(FAILURE(status) || defConverter == 0) diff --git a/icu4c/source/extra/ustdio/uprintf.c b/icu4c/source/extra/ustdio/uprintf.c index bc3920b0cb7..d51396e1a45 100644 --- a/icu4c/source/extra/ustdio/uprintf.c +++ b/icu4c/source/extra/ustdio/uprintf.c @@ -231,7 +231,7 @@ u_printf_integer_handler(UFILE *stream, UNumberFormat *format; UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i, minDigits = -1; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* mask off any necessary bits */ @@ -471,7 +471,7 @@ u_printf_double_handler(UFILE *stream, UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i, minDecimalDigits; int32_t maxDecimalDigits; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* mask off any necessary bits */ /* if(! info->fIsLongDouble) @@ -701,7 +701,7 @@ u_printf_scientific_handler(UFILE *stream, UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i, minDecimalDigits; int32_t maxDecimalDigits; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* mask off any necessary bits */ @@ -810,7 +810,7 @@ u_printf_date_handler(UFILE *stream, UDateFormat *format; UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* get the formatter */ @@ -872,7 +872,7 @@ u_printf_time_handler(UFILE *stream, UDateFormat *format; UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* get the formatter */ @@ -936,7 +936,7 @@ u_printf_percent_handler(UFILE *stream, UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i, minDecimalDigits; int32_t maxDecimalDigits; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* mask off any necessary bits */ @@ -1047,7 +1047,7 @@ u_printf_currency_handler(UFILE *stream, UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i, minDecimalDigits; int32_t maxDecimalDigits; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* mask off any necessary bits */ @@ -1349,7 +1349,7 @@ u_printf_spellout_handler(UFILE *stream, UChar result [UFPRINTF_BUFFER_SIZE]; int32_t i, minDecimalDigits; int32_t maxDecimalDigits; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* mask off any necessary bits */ diff --git a/icu4c/source/extra/ustdio/uscanf.c b/icu4c/source/extra/ustdio/uscanf.c index 59462a4230c..c00e685fb74 100644 --- a/icu4c/source/extra/ustdio/uscanf.c +++ b/icu4c/source/extra/ustdio/uscanf.c @@ -180,11 +180,11 @@ u_scanf_string_handler(UFILE *stream, int32_t count; const UChar *source; UConverter *conv; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; char *arg = (char*)(args[0].ptrValue); char *alias = arg; char *limit; - + /* skip all ws in the stream */ u_scanf_skip_leading_ws(stream, info->fPadChar); @@ -343,7 +343,7 @@ u_scanf_integer_handler(UFILE *stream, long *num = (long*) (args[0].ptrValue); UNumberFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -407,7 +407,7 @@ u_scanf_double_handler(UFILE *stream, double *num = (double*) (args[0].ptrValue); UNumberFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -469,7 +469,7 @@ u_scanf_scientific_handler(UFILE *stream, double *num = (double*) (args[0].ptrValue); UNumberFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -532,8 +532,8 @@ u_scanf_scidbl_handler(UFILE *stream, UNumberFormat *scientificFormat, *genericFormat; int32_t scientificResult, genericResult; int32_t scientificParsePos = 0, genericParsePos = 0; - UErrorCode scientificStatus = ZERO_ERROR; - UErrorCode genericStatus = ZERO_ERROR; + UErrorCode scientificStatus = U_ZERO_ERROR; + UErrorCode genericStatus = U_ZERO_ERROR; bool_t useScientific; @@ -614,7 +614,7 @@ u_scanf_currency_handler(UFILE *stream, double *num = (double*) (args[0].ptrValue); UNumberFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -676,7 +676,7 @@ u_scanf_percent_handler(UFILE *stream, double *num = (double*) (args[0].ptrValue); UNumberFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -738,7 +738,7 @@ u_scanf_date_handler(UFILE *stream, UDate *date = (UDate*) (args[0].ptrValue); UDateFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -796,7 +796,7 @@ u_scanf_time_handler(UFILE *stream, UDate *time = (UDate*) (args[0].ptrValue); UDateFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -939,7 +939,7 @@ u_scanf_spellout_handler(UFILE *stream, double *num = (double*) (args[0].ptrValue); UNumberFormat *format; int32_t parsePos = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* skip all ws in the stream */ @@ -1168,7 +1168,7 @@ u_scanf_scanset_handler(UFILE *stream, UChar c; const UChar *source; UConverter *conv; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; char *s = (char*) (args[0].ptrValue); char *alias, *limit; diff --git a/icu4c/source/extra/ustdio/ustdio.c b/icu4c/source/extra/ustdio/ustdio.c index 02965e6a499..94cc94d54e3 100644 --- a/icu4c/source/extra/ustdio/ustdio.c +++ b/icu4c/source/extra/ustdio/ustdio.c @@ -61,7 +61,7 @@ u_file_write( const UChar *chars, UFILE *f) { /* Set up conversion parameters */ - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const UChar *mySource = chars; const UChar *sourceAlias = chars; const UChar *mySourceEnd = chars + count; @@ -71,7 +71,7 @@ u_file_write( const UChar *chars, /* Perform the conversion in a loop */ do { - status = ZERO_ERROR; + status = U_ZERO_ERROR; sourceAlias = mySource; ucnv_fromUnicode(f->fConverter, @@ -92,7 +92,7 @@ u_file_write( const UChar *chars, written += (myTarget - f->fCharBuffer); myTarget = f->fCharBuffer; } - while(status == INDEX_OUTOFBOUNDS_ERROR); + while(status == U_INDEX_OUTOFBOUNDS_ERROR); /* return # of chars written */ return written; @@ -134,7 +134,7 @@ ufile_fill_uchar_buffer(UFILE *f) f->fFile); /* Set up conversion parameters */ - status = ZERO_ERROR; + status = U_ZERO_ERROR; mySource = f->fCharBuffer; mySourceEnd = f->fCharBuffer + bytesRead; myTarget = f->fUCBuffer + dataSize; @@ -336,8 +336,3 @@ u_file_read( UChar *chars, return read; } - - - - - diff --git a/icu4c/source/i18n/calendar.cpp b/icu4c/source/i18n/calendar.cpp index b4767cf573d..8e1eb91ff9f 100644 --- a/icu4c/source/i18n/calendar.cpp +++ b/icu4c/source/i18n/calendar.cpp @@ -114,7 +114,7 @@ Calendar::Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success) fNextStamp(kMinimumUserStamp) { if(zone == 0) { - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -255,7 +255,7 @@ Calendar::createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode bool_t Calendar::operator==(const Calendar& that) const { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // {sfb} is this correct? (Java equals) return (getDynamicClassID() == that.getDynamicClassID() && getTimeInMillis(status) == that.getTimeInMillis(status) && @@ -681,7 +681,7 @@ int32_t Calendar::stringToDayNumber(const UnicodeString& string, UErrorCode& sta int32_t len = string.size(); char *number = new char[1 + len]; - if (number == 0) { status = MEMORY_ALLOCATION_ERROR; return 0; } + if (number == 0) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } char *end; string.extract(0, len, number); @@ -691,7 +691,7 @@ int32_t Calendar::stringToDayNumber(const UnicodeString& string, UErrorCode& sta delete[] number; if (end-number != len || len == 0 || value < 1 || value > 7) - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return value; } @@ -719,7 +719,7 @@ Calendar::setWeekCountData(const Locale& desiredLocale, UErrorCode& status) // hard-coded data. if (FAILURE(status)) { - status = USING_FALLBACK_ERROR; + status = U_USING_FALLBACK_ERROR; fFirstDayOfWeek = Calendar::SUNDAY; fMinimalDaysInFirstWeek = 1; return; @@ -729,7 +729,7 @@ Calendar::setWeekCountData(const Locale& desiredLocale, UErrorCode& status) if (FAILURE(status)) return; if (count != 2) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return; } diff --git a/icu4c/source/i18n/calendar.h b/icu4c/source/i18n/calendar.h index 37ea934e666..efc2e17bd87 100644 --- a/icu4c/source/i18n/calendar.h +++ b/icu4c/source/i18n/calendar.h @@ -230,7 +230,7 @@ public: * for deleting the object returned. * * @param success Indicates the success/failure of Calendar creation. Filled in - * with ZERO_ERROR if created successfully, set to a failure result + * with U_ZERO_ERROR if created successfully, set to a failure result * otherwise. * @return A Calendar if created successfully. NULL otherwise. */ @@ -243,7 +243,7 @@ public: * * @param zoneToAdopt The given timezone to be adopted. * @param success Indicates the success/failure of Calendar creation. Filled in - * with ZERO_ERROR if created successfully, set to a failure result + * with U_ZERO_ERROR if created successfully, set to a failure result * otherwise. * @return A Calendar if created successfully. NULL otherwise. */ @@ -255,7 +255,7 @@ public: * * @param zone The timezone. * @param success Indicates the success/failure of Calendar creation. Filled in - * with ZERO_ERROR if created successfully, set to a failure result + * with U_ZERO_ERROR if created successfully, set to a failure result * otherwise. * @return A Calendar if created successfully. NULL otherwise. */ @@ -266,7 +266,7 @@ public: * * @param aLocale The given locale. * @param success Indicates the success/failure of Calendar creation. Filled in - * with ZERO_ERROR if created successfully, set to a failure result + * with U_ZERO_ERROR if created successfully, set to a failure result * otherwise. * @return A Calendar if created successfully. NULL otherwise. */ @@ -280,7 +280,7 @@ public: * @param zoneToAdopt The given timezone to be adopted. * @param aLocale The given locale. * @param success Indicates the success/failure of Calendar creation. Filled in - * with ZERO_ERROR if created successfully, set to a failure result + * with U_ZERO_ERROR if created successfully, set to a failure result * otherwise. * @return A Calendar if created successfully. NULL otherwise. */ @@ -293,7 +293,7 @@ public: * @param zone The timezone. * @param aLocale The given locale. * @param success Indicates the success/failure of Calendar creation. Filled in - * with ZERO_ERROR if created successfully, set to a failure result + * with U_ZERO_ERROR if created successfully, set to a failure result * otherwise. * @return A Calendar if created successfully. NULL otherwise. */ @@ -749,7 +749,7 @@ protected: * TimeZone::createInstance(), and the default locale. * * @param success Indicates the status of Calendar object construction. Returns - * ZERO_ERROR if constructed successfully. + * U_ZERO_ERROR if constructed successfully. */ Calendar(UErrorCode& success); @@ -770,7 +770,7 @@ protected: * @param zoneToAdopt The given time zone. * @param aLocale The given locale. * @param success Indicates the status of Calendar object construction. Returns - * ZERO_ERROR if constructed successfully. + * U_ZERO_ERROR if constructed successfully. */ Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success); @@ -780,7 +780,7 @@ protected: * @param zone The given time zone. * @param aLocale The given locale. * @param success Indicates the status of Calendar object construction. Returns - * ZERO_ERROR if constructed successfully. + * U_ZERO_ERROR if constructed successfully. */ Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success); @@ -935,7 +935,7 @@ private: * * @param desiredLocale The given locale. * @param success Indicates the status of setting the week count data from - * the resource for the given locale. Returns ZERO_ERROR if + * the resource for the given locale. Returns U_ZERO_ERROR if * constructed successfully. */ void setWeekCountData(const Locale& desiredLocale, UErrorCode& success); diff --git a/icu4c/source/i18n/choicfmt.cpp b/icu4c/source/i18n/choicfmt.cpp index 1e1e3788876..4e178f765ff 100644 --- a/icu4c/source/i18n/choicfmt.cpp +++ b/icu4c/source/i18n/choicfmt.cpp @@ -261,7 +261,7 @@ ChoiceFormat::applyPattern(const UnicodeString& newPattern, } else if (ch == 0x003C /*'<'*/ || ch == 0x0023 /*'#'*/ || ch == 0x2264) { if (segments[0] == "") { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -288,7 +288,7 @@ ChoiceFormat::applyPattern(const UnicodeString& newPattern, // {sfb} There is a bug in MSVC 5.0 sp3 -- 0.0 <= NaN ==> TRUE //if (startValue <= oldStartValue) { if (startValue <= oldStartValue && ! icu_isNaN(oldStartValue)) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } segments[0].remove(); @@ -341,7 +341,7 @@ ChoiceFormat::toPattern(UnicodeString& result) const double tryLessOrEqual = icu_fabs(icu_IEEEremainder(fChoiceLimits[i], 1.0)); double tryLess = icu_fabs(icu_IEEEremainder(less, 1.0)); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString buf; // {sfb} hack to get this to work on MSVC - NaN doesn't behave as it should if (tryLessOrEqual < tryLess && @@ -497,7 +497,7 @@ ChoiceFormat::format(const Formattable* objs, UErrorCode& status) const { if(cnt < 0) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return toAppendTo; } diff --git a/icu4c/source/i18n/choicfmt.h b/icu4c/source/i18n/choicfmt.h index bb9c6e8901c..2be056d30e0 100644 --- a/icu4c/source/i18n/choicfmt.h +++ b/icu4c/source/i18n/choicfmt.h @@ -86,7 +86,7 @@ * . double filelimits[] = {0,1,2}; * . UnicodeString filepart[] = {"are no files","is one file","are {2} files"}; * . ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3 ); - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . const Format* testFormats[] = { fileform, NULL, NumberFormat::createInstance(success) }; * . MessageFormat* pattform = new MessageFormat("There {0} on {1}", success ); * . pattform->setFormats( testFormats, 3 ); diff --git a/icu4c/source/i18n/colcache.cpp b/icu4c/source/i18n/colcache.cpp index c93e1a303aa..1be45e735b5 100644 --- a/icu4c/source/i18n/colcache.cpp +++ b/icu4c/source/i18n/colcache.cpp @@ -49,7 +49,7 @@ static void deleteTCD(void* TCD) CollationCache::CollationCache() { - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; fHashtable = uhash_open((UHashFunction) uhash_hashUString, &err); uhash_setValueDeleter(fHashtable, deleteTCD); } @@ -62,7 +62,7 @@ CollationCache::~CollationCache() void CollationCache::Add(const UnicodeString& key, TableCollationData* value) { - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; TableCollationData* previous = (TableCollationData*)uhash_putKey(fHashtable, key.hashCode() & 0x7FFFFFFF , value, &err); } diff --git a/icu4c/source/i18n/coleitr.cpp b/icu4c/source/i18n/coleitr.cpp index 073263f30bc..62d44f8c27a 100644 --- a/icu4c/source/i18n/coleitr.cpp +++ b/icu4c/source/i18n/coleitr.cpp @@ -90,7 +90,7 @@ CollationElementIterator::CollationElementIterator( const UnicodeString& sourceT text = new Normalizer(sourceText, decomp); if (text == NULL) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; } } } @@ -128,7 +128,7 @@ CollationElementIterator::CollationElementIterator( const CharacterIterator& sou text = new Normalizer(sourceText, decomp); if (text == NULL) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; } } } diff --git a/icu4c/source/i18n/coleitr.h b/icu4c/source/i18n/coleitr.h index c3b66567bbb..dae6f0661b9 100644 --- a/icu4c/source/i18n/coleitr.h +++ b/icu4c/source/i18n/coleitr.h @@ -65,7 +65,7 @@ class VectorOfPToContractElement; * . void CollationElementIterator_Example() * . { * . UnicodeString str = "This is a test"; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . RuleBasedCollator* rbc = * . (RuleBasedCollator*) RuleBasedCollator::createInstance(success); * . CollationElementIterator* c = diff --git a/icu4c/source/i18n/coll.h b/icu4c/source/i18n/coll.h index 82b926ed013..bfaa1fc93d6 100644 --- a/icu4c/source/i18n/coll.h +++ b/icu4c/source/i18n/coll.h @@ -79,7 +79,7 @@ class CollationKey; * ** // Compare two strings in the default locale - * UErrorCode success = ZERO_ERROR; + * UErrorCode success = U_ZERO_ERROR; * Collator* myCollator = Collator::createInstance(success); * if( myCollator->compare("abc", "ABC") < 0 ) { * cout << "abc is less than ABC" << endl; @@ -103,7 +103,7 @@ class CollationKey; *** //Get the Collator for US English and set its strength to PRIMARY - * UErrorCode success = ZERO_ERROR; + * UErrorCode success = U_ZERO_ERROR; * Collator* usCollator = Collator::createInstance(Locale::US, success); * usCollator->setStrength(Collator::PRIMARY); * if( usCollator->compare("abc", "ABC") == 0 ) { @@ -216,9 +216,9 @@ public : * To check whether the construction succeeded or not, you should check * the value of SUCCESS(err). If you wish more detailed information, you * can check for informational error results which still indicate success. - * USING_FALLBACK_ERROR indicates that a fall back locale was used. For + * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For * example, 'de_CH' was requested, but nothing was found there, so 'de' was - * used. USING_DEFAULT_ERROR indicates that the default locale data was + * used. U_USING_DEFAULT_ERROR indicates that the default locale data was * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. @@ -240,9 +240,9 @@ public : * To check whether the construction succeeded or not, you should check * the value of SUCCESS(err). If you wish more detailed information, you * can check for informational error results which still indicate success. - * USING_FALLBACK_ERROR indicates that a fall back locale was used. For + * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For * example, 'de_CH' was requested, but nothing was found there, so 'de' was - * used. USING_DEFAULT_ERROR indicates that the default locale data was + * used. U_USING_DEFAULT_ERROR indicates that the default locale data was * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. @@ -257,7 +257,7 @@ public : * is less than, greater than or equal to another string. *Example of use: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . Collator *myCollation = Collator::createInstance(Locale::US, status); * . if (FAILURE(status)) return; * . myCollation->setStrength(Collator::PRIMARY); @@ -282,7 +282,7 @@ public : * Does the same thing as compare but limits the comparison to a specified length *Example of use: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . Collator *myCollation = Collator::createInstance(Locale::US, status); * . if (FAILURE(status)) return; * . myCollation->setStrength(Collator::PRIMARY); @@ -316,7 +316,7 @@ public : * generated sort keys. *Example of use: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . Collator *myCollation = Collator::createInstance(Locale::US, status); * . if (FAILURE(status)) return; * . myCollation->setStrength(Collator::PRIMARY); @@ -395,7 +395,7 @@ public : Normalizer::EMode getDecomposition(void) const; /** * Set the decomposition mode of the collator object. success is equal - * to ILLEGAL_ARGUMENT_ERROR if error occurs. + * to U_ILLEGAL_ARGUMENT_ERROR if error occurs. * @param the new decomposition mode * @see Collator#getDecomposition */ @@ -414,7 +414,7 @@ public : * Sets the minimum strength to be used in comparison or transformation. *Example of use: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . Collator *myCollation = Collator::createInstance(Locale::US, status); * . if (FAILURE(status)) return; * . myCollation->setStrength(Collator::PRIMARY); diff --git a/icu4c/source/i18n/datefmt.cpp b/icu4c/source/i18n/datefmt.cpp index 14c7766dc7e..a1747bf3910 100644 --- a/icu4c/source/i18n/datefmt.cpp +++ b/icu4c/source/i18n/datefmt.cpp @@ -114,13 +114,13 @@ DateFormat::format(const Formattable& obj, format((UDate)obj.getLong(), toAppendTo, fieldPosition); break; default: - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return toAppendTo; } // Is this right? //if (fieldPosition.getBeginIndex() == fieldPosition.getEndIndex()) - // status = ILLEGAL_ARGUMENT_ERROR; + // status = U_ILLEGAL_ARGUMENT_ERROR; return toAppendTo; } @@ -147,7 +147,7 @@ DateFormat::parse(const UnicodeString& text, ParsePosition pos(0); UDate result = parse(text, pos); - if (pos.getIndex() == 0) status = ILLEGAL_ARGUMENT_ERROR; + if (pos.getIndex() == 0) status = U_ILLEGAL_ARGUMENT_ERROR; return result; } @@ -205,14 +205,14 @@ DateFormat* DateFormat::create(EStyle timeStyle, EStyle dateStyle, const Locale& locale) { // Try to create a SimpleDateFormat of the desired style. - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *f = new SimpleDateFormat(timeStyle, dateStyle, locale, status); if (SUCCESS(status)) return f; delete f; // If that fails, try to create a format using the default pattern and // the DateFormatSymbols for this locale. - status = ZERO_ERROR; + status = U_ZERO_ERROR; f = new SimpleDateFormat(locale, status); if (SUCCESS(status)) return f; delete f; @@ -247,7 +247,7 @@ DateFormat::getAvailableLocales(int32_t& count) int32_t i; for (i=0; i* You can use a DateFormat to parse also. * - * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . UDate myDate = df->parse(myString, status); ** Use createDateInstance() to produce the normal date format for that country. diff --git a/icu4c/source/i18n/dcfmtsym.cpp b/icu4c/source/i18n/dcfmtsym.cpp index 278f86be926..a7db4e4c657 100644 --- a/icu4c/source/i18n/dcfmtsym.cpp +++ b/icu4c/source/i18n/dcfmtsym.cpp @@ -184,7 +184,7 @@ DecimalFormatSymbols::initialize(const Locale& locale, UErrorCode& status, // Initializes with last resort data if necessary. if (useLastResortData) { - status = USING_FALLBACK_ERROR; + status = U_USING_FALLBACK_ERROR; initialize(fgLastResortNumberElements, fgLastResortCurrencyElements); } return; @@ -202,7 +202,7 @@ DecimalFormatSymbols::initialize(const Locale& locale, UErrorCode& status, // bundle, returns the failure error code. if (numberElementsLength < fgNumberElementsLength || currencyElementsLength < fgCurrencyElementsLength) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return; } diff --git a/icu4c/source/i18n/dcfmtsym.h b/icu4c/source/i18n/dcfmtsym.h index 6f0663d7c97..f222e76a563 100644 --- a/icu4c/source/i18n/dcfmtsym.h +++ b/icu4c/source/i18n/dcfmtsym.h @@ -85,7 +85,7 @@ public: * Create a DecimalFormatSymbols object for the default locale. * This constructor will not fail. If the resource file data is * not available, it will use hard-coded last-resort data and - * set status to USING_FALLBACK_ERROR. + * set status to U_USING_FALLBACK_ERROR. * * @param status Input/output parameter, set to success or * failure code upon return. diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index 880331dc60e..da2409e1752 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -145,7 +145,7 @@ DecimalFormat::DecimalFormat(const UnicodeString& pattern, fNegSuffixPattern(0), fSymbols(0) { - if (symbolsToAdopt == NULL) status = ILLEGAL_ARGUMENT_ERROR; + if (symbolsToAdopt == NULL) status = U_ILLEGAL_ARGUMENT_ERROR; construct(status, &pattern, symbolsToAdopt); } @@ -2201,7 +2201,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, if (digitRightCount > 0) { // Unexpected '0' debug("Unexpected '0'") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } ++zeroDigitCount; @@ -2218,7 +2218,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, if (decimalPos >= 0) { // Grouping separator after decimal debug("Grouping separator after decimal") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } groupingCount = 0; @@ -2226,7 +2226,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, if (decimalPos >= 0) { // Multiple decimal separators debug("Multiple decimal separators") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } // Intentionally incorporate the digitRightCount, @@ -2238,13 +2238,13 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, if (expDigits >= 0) { // Multiple exponential symbols debug("Multiple exponential symbols") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } if (groupingCount >= 0) { // Grouping separator in exponential pattern debug("Grouping separator in exponential pattern") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } // Check for positive prefix @@ -2265,7 +2265,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, expDigits < 1) { // Malformed exponential pattern debug("Malformed exponential pattern") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } @@ -2324,7 +2324,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, if (subpart == 1 || part == 1) { // Unexpected separator debug("Unexpected separator") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } sub2Limit = pos; @@ -2335,7 +2335,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, if (multiplier != 1) { // Too many percent/perMill characters debug("Too many percent/perMill characters") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } affix->append(kQuote); // Encode percent/perMill @@ -2351,7 +2351,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, if (padPos >= 0 || // Multiple pad specifiers (pos+1) == pattern.size()) { // Nothing after padEscape debug("Multiple pad specifiers") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } padPos = pos; @@ -2430,7 +2430,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, groupingCount == 0 || subpart > 2) { // subpart > 2 == unmatched quote debug("Syntax error") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -2447,7 +2447,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, } else { // Illegal pad position debug("Illegal pad position") - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } diff --git a/icu4c/source/i18n/decimfmt.h b/icu4c/source/i18n/decimfmt.h index a38100278eb..e6a807cd2f5 100644 --- a/icu4c/source/i18n/decimfmt.h +++ b/icu4c/source/i18n/decimfmt.h @@ -68,7 +68,7 @@ class DigitList; * . if (locCount > 12) locCount = 12; //limit output * . * . double myNumber = -1234.56; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . NumberFormat* form; //= NumberFormat::createInstance(success); * . * . // just for fun, we print out a number with the locale number, currency diff --git a/icu4c/source/i18n/dtfmtsym.cpp b/icu4c/source/i18n/dtfmtsym.cpp index 39e42525507..a87d042a51d 100644 --- a/icu4c/source/i18n/dtfmtsym.cpp +++ b/icu4c/source/i18n/dtfmtsym.cpp @@ -436,7 +436,7 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, bool // we just need to produce something that will be semi-intelligible // in most locales. - status = USING_FALLBACK_ERROR; + status = U_USING_FALLBACK_ERROR; fEras = (UnicodeString*)fgLastResortEras; fErasCount = sizeof(fgLastResortEras[0]) / sizeof(fgLastResortEras[0]); diff --git a/icu4c/source/i18n/fieldpos.h b/icu4c/source/i18n/fieldpos.h index b825a452439..69511839e1f 100644 --- a/icu4c/source/i18n/fieldpos.h +++ b/icu4c/source/i18n/fieldpos.h @@ -59,7 +59,7 @@ * . 12345.6789, -1234.56789, 123.456789, -12.3456789, 1.23456789}; * . int dNumSize = (int)(sizeof(doubleNum)/sizeof(double)); * . - * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . DecimalFormat* fmt = (DecimalFormat*) NumberFormat::createInstance(status); * . fmt->setDecimalSeparatorAlwaysShown(true); * . diff --git a/icu4c/source/i18n/format.cpp b/icu4c/source/i18n/format.cpp index 44a76a8e486..0dcc3a96168 100644 --- a/icu4c/source/i18n/format.cpp +++ b/icu4c/source/i18n/format.cpp @@ -92,7 +92,7 @@ Format::parseObject(const UnicodeString& source, ParsePosition parsePosition(0); parseObject(source, result, parsePosition); if (parsePosition.getIndex() == 0) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; } } diff --git a/icu4c/source/i18n/gregocal.cpp b/icu4c/source/i18n/gregocal.cpp index 2149dab3979..e32e7368913 100644 --- a/icu4c/source/i18n/gregocal.cpp +++ b/icu4c/source/i18n/gregocal.cpp @@ -768,7 +768,7 @@ GregorianCalendar::computeTime(UErrorCode& status) return; if (! isLenient() && ! validateFields()) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -785,7 +785,7 @@ GregorianCalendar::computeTime(UErrorCode& status) year = 1 - year; // Even in lenient mode we disallow ERA values other than AD & BC else if (era != AD) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } @@ -1309,7 +1309,7 @@ GregorianCalendar::add(EDateFields field, int32_t amount, UErrorCode& status) case ZONE_OFFSET: case DST_OFFSET: default: - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -1602,7 +1602,7 @@ GregorianCalendar::roll(EDateFields field, int32_t amount, UErrorCode& status) case ZONE_OFFSET: case DST_OFFSET: default: - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; // These fields cannot be rolled } @@ -1681,7 +1681,7 @@ GregorianCalendar::getActualMaximum(EDateFields field) const * that we permit it, rather than complicating the code to handle such * intricacies. - liu 8/20/98 */ - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; switch (field) { // we have functions that enable us to fast-path number of days in month diff --git a/icu4c/source/i18n/gregocal.h b/icu4c/source/i18n/gregocal.h index 4022ca7ecd6..0b46ed05b7e 100644 --- a/icu4c/source/i18n/gregocal.h +++ b/icu4c/source/i18n/gregocal.h @@ -66,7 +66,7 @@ * . * . // create a GregorianCalendar with the Pacific Daylight time zone * . // and the current date and time - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . Calendar* calendar = new GregorianCalendar( pdt, success ); * . * . // print out a bunch of interesting things @@ -132,7 +132,7 @@ public: * zone with the default locale. * * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(UErrorCode& success); @@ -143,7 +143,7 @@ public: * * @param zoneToAdopt The given timezone. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(TimeZone* zoneToAdopt, UErrorCode& success); @@ -153,7 +153,7 @@ public: * * @param zone The given timezone. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(const TimeZone& zone, UErrorCode& success); @@ -163,7 +163,7 @@ public: * * @param aLocale The given locale. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(const Locale& aLocale, UErrorCode& success); @@ -175,7 +175,7 @@ public: * @param zoneToAdopt The given timezone. * @param aLocale The given locale. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success); @@ -186,7 +186,7 @@ public: * @param zone The given timezone. * @param aLocale The given locale. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success); @@ -199,7 +199,7 @@ public: * value is 0-based. e.g., 0 for January. * @param date The value used to set the DATE time field in the calendar. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(int32_t year, int32_t month, int32_t date, UErrorCode& success); @@ -214,7 +214,7 @@ public: * @param hour The value used to set the HOUR_OF_DAY time field in the calendar. * @param minute The value used to set the MINUTE time field in the calendar. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, UErrorCode& success); @@ -230,7 +230,7 @@ public: * @param minute The value used to set the MINUTE time field in the calendar. * @param second The value used to set the SECOND time field in the calendar. * @param success Indicates the status of GregorianCalendar object construction. - * Returns ZERO_ERROR if constructed successfully. + * Returns U_ZERO_ERROR if constructed successfully. */ GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second, UErrorCode& success); diff --git a/icu4c/source/i18n/mergecol.cpp b/icu4c/source/i18n/mergecol.cpp index b84e9dd866b..16379688651 100644 --- a/icu4c/source/i18n/mergecol.cpp +++ b/icu4c/source/i18n/mergecol.cpp @@ -64,7 +64,7 @@ MergeCollation::MergeCollation(const UnicodeString& pattern, if (patterns == NULL) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -73,7 +73,7 @@ MergeCollation::MergeCollation(const UnicodeString& pattern, if (statusArray == NULL) { delete patterns; - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -474,7 +474,7 @@ MergeCollation::findLastEntry(const PatternEntry* lastEntry, // must exist! if (oldIndex == -1) { - success = INVALID_FORMAT_ERROR; + success = U_INVALID_FORMAT_ERROR; return oldIndex; } @@ -516,12 +516,10 @@ MergeCollation::findLastEntry(const PatternEntry* lastEntry, if (i == -1) { - success = INVALID_FORMAT_ERROR; + success = U_INVALID_FORMAT_ERROR; return i; } return i + 1; } } - - diff --git a/icu4c/source/i18n/mergecol.h b/icu4c/source/i18n/mergecol.h index acac58148f8..e48f89fea1a 100644 --- a/icu4c/source/i18n/mergecol.h +++ b/icu4c/source/i18n/mergecol.h @@ -72,7 +72,7 @@ public: * Creates a merged collation table from a pattern string. * @param pattern the pattern string. * @param status the error code status. If the input pattern is incorrect, - * this will be set to INVALID_FORMAT_ERROR. + * this will be set to U_INVALID_FORMAT_ERROR. */ MergeCollation( const UnicodeString& pattern, Normalizer::EMode decompMode, @@ -127,7 +127,7 @@ public: /** * Sets the pattern. * @param pattern string. - * @param status the error code status, it will be set to INVALID_FORMAT_ERROR + * @param status the error code status, it will be set to U_INVALID_FORMAT_ERROR * if the pattern is incorrect. */ void setPattern(const UnicodeString& pattern, @@ -137,7 +137,7 @@ public: /** * Adds a pattern to the current merge collation object. * @param pattern the new pattern to be added. - * @param status the error code status, it will be set to INVALID_FORMAT_ERROR + * @param status the error code status, it will be set to U_INVALID_FORMAT_ERROR * if the pattern is incorrect. */ void addPattern(const UnicodeString& pattern, @@ -190,7 +190,7 @@ private: * (which is usually at the end). Strength indicates the text order * weight for an entry. * @param newEntry the new pattern entry - * @param status the error code status, it will be set to INVALID_FORMAT_ERROR + * @param status the error code status, it will be set to U_INVALID_FORMAT_ERROR * if the strength is RESET and a previous entry can't be found. */ void fixEntry( PatternEntry* newEntry, @@ -201,7 +201,7 @@ private: * merge collation object. * @param lastEntry the entry that was previously installed. * @param excess the extra characters - * @param status the error code status, it will be set to INVALID_FORMAT_ERROR + * @param status the error code status, it will be set to U_INVALID_FORMAT_ERROR * if the strength is RESET and a previous entry can't be found. * @return the offset of the found entry */ diff --git a/icu4c/source/i18n/msgfmt.cpp b/icu4c/source/i18n/msgfmt.cpp index d8b16568472..d5d402acd5a 100644 --- a/icu4c/source/i18n/msgfmt.cpp +++ b/icu4c/source/i18n/msgfmt.cpp @@ -282,7 +282,7 @@ MessageFormat::applyPattern(const UnicodeString& newPattern, } if (braceStack == 0 && part != 0) { fMaxOffset = -1; - success = INVALID_FORMAT_ERROR; + success = U_INVALID_FORMAT_ERROR; return; //throw new IllegalArgumentException("Unmatched braces in the pattern."); } @@ -309,7 +309,7 @@ MessageFormat::toPattern(UnicodeString& result) const } else if (fFormats[i]->getDynamicClassID() == DecimalFormat::getStaticClassID()) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat& formatAlias = *(NumberFormat*)fFormats[i]; NumberFormat *numberTemplate = NumberFormat::createInstance(fLocale, status); NumberFormat *currencyTemplate = NumberFormat::createCurrencyInstance(fLocale, status); @@ -340,7 +340,7 @@ MessageFormat::toPattern(UnicodeString& result) const delete integerTemplate; } else if (fFormats[i]->getDynamicClassID() == SimpleDateFormat::getStaticClassID()) { - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; DateFormat& formatAlias = *(DateFormat*)fFormats[i]; DateFormat *defaultDateTemplate = DateFormat::createDateInstance(DateFormat::kDefault, fLocale); DateFormat *shortDateTemplate = DateFormat::createDateInstance(DateFormat::kShort, fLocale); @@ -560,7 +560,7 @@ MessageFormat::format(const Formattable& source, if (FAILURE(success)) return result; if (source.getType() != Formattable::kArray) { - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return result; } const Formattable* tmpPtr = source.getArray(cnt); @@ -581,7 +581,7 @@ MessageFormat::format(const Formattable* arguments, UErrorCode& success) const { if(/*arguments == NULL ||*/ cnt < 0) { - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return result; } @@ -598,7 +598,7 @@ MessageFormat::format(const Formattable* arguments, int32_t argumentNumber = fArgumentNumbers[i]; // Checks the scope of the argument number. if (argumentNumber >= cnt) { - /*success = ILLEGAL_ARGUMENT_ERROR; + /*success = U_ILLEGAL_ARGUMENT_ERROR; return result;*/ result += "{"; UnicodeString temp; @@ -644,7 +644,7 @@ MessageFormat::format(const Formattable* arguments, #ifdef LIUDEBUG cerr << "Unknown object of type:" << obj.getType() << endl; #endif - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return result; } // Needs to reprocess the ChoiceFormat option by using the MessageFormat @@ -807,7 +807,7 @@ MessageFormat::parse(const UnicodeString& source, // from zero offset of the source text. Formattable* result = parse(source, status, cnt); if (status.getIndex() == 0) { - success = MESSAGE_PARSE_ERROR; + success = U_MESSAGE_PARSE_ERROR; return NULL; } return result; @@ -914,7 +914,7 @@ UnicodeString& MessageFormat::itos(int32_t i, UnicodeString& string) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *myFormat = getNumberFormat(status); if(FAILURE(status)) @@ -944,7 +944,7 @@ MessageFormat::makeFormat(int32_t position, int32_t oldMaxOffset = fMaxOffset; argumentNumber = stoi(segments[1], success); // always unlocalized! if (argumentNumber < 0 || argumentNumber > 9) { - success = INVALID_FORMAT_ERROR; + success = U_INVALID_FORMAT_ERROR; return; } fMaxOffset = offsetNumber; @@ -980,7 +980,7 @@ MessageFormat::makeFormat(int32_t position, ((DecimalFormat*)newFormat)->applyPattern(segments[3], success); if(FAILURE(success)) { fMaxOffset = oldMaxOffset; - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return; } break; @@ -1010,7 +1010,7 @@ MessageFormat::makeFormat(int32_t position, ((SimpleDateFormat*)newFormat)->applyPattern(segments[3]); if(FAILURE(success)) { fMaxOffset = oldMaxOffset; - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return; } break; @@ -1039,7 +1039,7 @@ MessageFormat::makeFormat(int32_t position, ((SimpleDateFormat*)newFormat)->applyPattern(segments[3]); if(FAILURE(success)) { fMaxOffset = oldMaxOffset; - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return; } break; @@ -1049,13 +1049,13 @@ MessageFormat::makeFormat(int32_t position, newFormat = new ChoiceFormat(segments[3], success); if(FAILURE(success)) { fMaxOffset = oldMaxOffset; - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return; } break; default: fMaxOffset = oldMaxOffset; - success = ILLEGAL_ARGUMENT_ERROR; + success = U_ILLEGAL_ARGUMENT_ERROR; return; } diff --git a/icu4c/source/i18n/msgfmt.h b/icu4c/source/i18n/msgfmt.h index 193172fac82..8204ee50c78 100644 --- a/icu4c/source/i18n/msgfmt.h +++ b/icu4c/source/i18n/msgfmt.h @@ -42,7 +42,7 @@ class NumberFormat; * Here are some examples of usage: * Example 1: *- * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . GregorianCalendar cal(success); * . Formattable arguments[] = { * . 7L, @@ -64,7 +64,7 @@ class NumberFormat; ** Example 2: *
- * . success = ZERO_ERROR; + * . success = U_ZERO_ERROR; * . Formattable testArgs[] = {3L, "MyDisk"}; * . * . MessageFormat* form = new MessageFormat( @@ -138,7 +138,7 @@ class NumberFormat; * For more sophisticated patterns, you can use a ChoiceFormat to get * output such as: *- * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . MessageFormat* form = new MessageFormat("The disk \"{1}\" contains {0}.", success); * . double filelimits[] = {0,1,2}; * . UnicodeString filepart[] = {"no files","one file","{0,number} files"}; diff --git a/icu4c/source/i18n/numfmt.cpp b/icu4c/source/i18n/numfmt.cpp index 235c4c34294..537bf8a59c9 100644 --- a/icu4c/source/i18n/numfmt.cpp +++ b/icu4c/source/i18n/numfmt.cpp @@ -141,7 +141,7 @@ NumberFormat::format(const Formattable& obj, } // can't try to format a non-numeric object else { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return toAppendTo; } } @@ -165,7 +165,7 @@ UnicodeString& NumberFormat::format(double number, UnicodeString& toAppendTo) const { FieldPosition pos(0); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; return format(Formattable(number), toAppendTo, pos, status); } @@ -176,7 +176,7 @@ UnicodeString& NumberFormat::format(int32_t number, UnicodeString& toAppendTo) const { FieldPosition pos(0); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; return format(Formattable(number), toAppendTo, pos, status); } @@ -196,7 +196,7 @@ NumberFormat::parse(const UnicodeString& text, ParsePosition parsePosition(0); parse(text, result, parsePosition); if (parsePosition.getIndex() == 0) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; } } @@ -408,7 +408,7 @@ NumberFormat::createInstance(const Locale& desiredLocale, if (FAILURE(status)) return NULL; if (style < 0 || style >= kStyleCount) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return NULL; } @@ -416,7 +416,7 @@ NumberFormat::createInstance(const Locale& desiredLocale, if (FAILURE(status)) { // We don't appear to have resource data available -- use the last-resort data - status = USING_FALLBACK_ERROR; + status = U_USING_FALLBACK_ERROR; // Use the DecimalFormatSymbols constructor which uses last-resort data DecimalFormatSymbols* symbolsToAdopt = new DecimalFormatSymbols(status); @@ -433,7 +433,7 @@ NumberFormat::createInstance(const Locale& desiredLocale, patternCount, status); // If not all the styled patterns exists for the NumberFormat in this locale, // sets the status code to failure and returns nil. - if (patternCount < fgNumberPatternsCount) status = INVALID_FORMAT_ERROR; + if (patternCount < fgNumberPatternsCount) status = U_INVALID_FORMAT_ERROR; if (FAILURE(status)) return NULL; // If the requested style doesn't exist, use a last-resort style. diff --git a/icu4c/source/i18n/numfmt.h b/icu4c/source/i18n/numfmt.h index 0fbdef627e4..278fdc06c93 100644 --- a/icu4c/source/i18n/numfmt.h +++ b/icu4c/source/i18n/numfmt.h @@ -50,7 +50,7 @@ class Locale; ** . double myNumber = 7.0; * . UnicodeString myString; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . NumberFormat* nf = NumberFormat::createInstance(success) * . nf->format(myNumber, myString); * . cout << " Example 1: " << myString << endl; @@ -61,7 +61,7 @@ class Locale; * conventions multiple times. ** . UnicodeString myString; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . nf = NumberFormat::createInstance( success ); * . int32_t a[] = { 123, 3333, -1234567 }; * . const int32_t a_len = sizeof(a) / sizeof(a[0]); diff --git a/icu4c/source/i18n/ptnentry.cpp b/icu4c/source/i18n/ptnentry.cpp index cf6a0f49d01..1f96ae6b9c1 100644 --- a/icu4c/source/i18n/ptnentry.cpp +++ b/icu4c/source/i18n/ptnentry.cpp @@ -61,7 +61,7 @@ PatternEntry::PatternEntry(int32_t newStrength, // When there are multiple combining characters attached to a base character, // the combining characters must be in their canonical order // - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Normalizer::normalize(newChars, decompMode, 0, chars, status); if (FAILURE(status)) { chars = newChars; @@ -361,13 +361,13 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status) default: if (newStrength == PatternEntry::UNSET) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return NULL; } if (isSpecialChar(ch) && (inQuote == FALSE)) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return NULL; } @@ -386,7 +386,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status) if (newChars.isBogus() || newExtensions.isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return NULL; } @@ -401,7 +401,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status) if (newChars.size() == 0) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return NULL; } @@ -418,4 +418,3 @@ bool_t PatternEntry::isSpecialChar(UChar ch) ((ch <= 0x0060) && (ch >= 0x005B)) || ((ch <= 0x007E) && (ch >= 0x007B))); } - diff --git a/icu4c/source/i18n/simpletz.cpp b/icu4c/source/i18n/simpletz.cpp index e746c2a86f2..d51f5e35636 100644 --- a/icu4c/source/i18n/simpletz.cpp +++ b/icu4c/source/i18n/simpletz.cpp @@ -109,7 +109,7 @@ SimpleTimeZone::SimpleTimeZone(int32_t rawOffset, const UnicodeString& ID, decodeRules(status); if(dstSavings <= 0) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; } } @@ -323,7 +323,7 @@ int32_t SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, uint8_t dayOfWeek, int32_t millis) const { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; return getOffset(era, year, month, day, dayOfWeek, millis, status); } @@ -340,7 +340,7 @@ SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, // field) with fields ZONE_OFFSET and DST_OFFSET. We can't get rid of // this method because it's public API. - liu 8/10/98 if(month < Calendar::JANUARY || month > Calendar::DECEMBER) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return 0; } @@ -365,7 +365,7 @@ SimpleTimeZone::getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, || millis >= kMillisPerDay || monthLength < 28 || monthLength > 31) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return -1; } @@ -522,7 +522,7 @@ SimpleTimeZone::setRawOffset(int32_t offsetMillis) void SimpleTimeZone::setDSTSavings(int32_t millisSavedDuringDST) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; setDSTSavings(millisSavedDuringDST, status); } @@ -533,7 +533,7 @@ SimpleTimeZone::setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status) { dstSavings = millisSavedDuringDST; if(dstSavings <= 0) - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; } // ------------------------------------- @@ -706,11 +706,11 @@ SimpleTimeZone::decodeStartRule(UErrorCode& status) useDaylight = ((startDay != 0) && (endDay != 0) ? TRUE : FALSE); if (startDay != 0) { if (startMonth < Calendar::JANUARY || startMonth > Calendar::DECEMBER) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } if (startTime < 0 || startTime > kMillisPerDay) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } if (startDayOfWeek == 0) { @@ -728,17 +728,17 @@ SimpleTimeZone::decodeStartRule(UErrorCode& status) } } if (startDayOfWeek > Calendar::SATURDAY) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } if (startMode == DOW_IN_MONTH_MODE) { if (startDay < -5 || startDay > 5) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } else if (startDay > staticMonthLength[startMonth]) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } @@ -757,11 +757,11 @@ SimpleTimeZone::decodeEndRule(UErrorCode& status) useDaylight = ((startDay != 0) && (endDay != 0) ? TRUE : FALSE); if (endDay != 0) { if (endMonth < Calendar::JANUARY || endMonth > Calendar::DECEMBER) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } if (endTime < 0 || endTime > kMillisPerDay) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } if (endDayOfWeek == 0) { @@ -779,17 +779,17 @@ SimpleTimeZone::decodeEndRule(UErrorCode& status) } } if (endDayOfWeek > Calendar::SATURDAY) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } if (endMode == DOW_IN_MONTH_MODE) { if (endDay < -5 || endDay > 5) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } else if (endDay > staticMonthLength[endMonth]) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return; } } diff --git a/icu4c/source/i18n/smpdtfmt.cpp b/icu4c/source/i18n/smpdtfmt.cpp index b41e31fa8f1..29f7c436193 100644 --- a/icu4c/source/i18n/smpdtfmt.cpp +++ b/icu4c/source/i18n/smpdtfmt.cpp @@ -188,7 +188,7 @@ SimpleDateFormat::SimpleDateFormat(const Locale& locale, fSymbols = new DateFormatSymbols(locale, status); if (FAILURE(status)) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; delete fSymbols; // This constructor doesn't fail; it uses last resort data fSymbols = new DateFormatSymbols(status); @@ -272,7 +272,7 @@ void SimpleDateFormat::construct(EStyle timeStyle, if (FAILURE(status)) return; if (dtCount <= kDateTime) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return; } @@ -310,7 +310,7 @@ void SimpleDateFormat::construct(EStyle timeStyle, else if (dateStyle != kNone) fPattern = dateTimePatterns[dateStyle]; // and if it includes _neither_, that's an error - else status = INVALID_FORMAT_ERROR; + else status = U_INVALID_FORMAT_ERROR; // finally, finish initializing by creating a Calendar and a NumberFormat initialize(locale, status); @@ -327,7 +327,7 @@ SimpleDateFormat::initialize(const Locale& locale, // {sfb} should this be here? if (fSymbols->fZoneStringsColCount < 1) { - status = INVALID_FORMAT_ERROR; // Check for bogus locale data + status = U_INVALID_FORMAT_ERROR; // Check for bogus locale data return; } @@ -351,7 +351,7 @@ SimpleDateFormat::initialize(const Locale& locale, } else if (SUCCESS(status)) { - status = MISSING_RESOURCE_ERROR; + status = U_MISSING_RESOURCE_ERROR; } } @@ -363,7 +363,7 @@ void SimpleDateFormat::initializeDefaultCentury() fDefaultCenturyStart = internalGetDefaultCenturyStart(); fDefaultCenturyStartYear = internalGetDefaultCenturyStartYear(); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; fCalendar->setTime(fDefaultCenturyStart, status); // {sfb} throw away error } @@ -388,7 +388,7 @@ void SimpleDateFormat::parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& s UnicodeString& SimpleDateFormat::format(UDate date, UnicodeString& toAppendTo, FieldPosition& pos) const { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; pos.setBeginIndex(0); pos.setEndIndex(0); @@ -514,7 +514,7 @@ SimpleDateFormat::subFormat(UnicodeString& result, // if the pattern character is unrecognized, signal an error and dump out if ((patternCharIndex = (EField)DateFormatSymbols::fgPatternChars.indexOf(ch)) == (EField)-1) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return result; } @@ -927,7 +927,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const // when the two-digit year is equal to the start year, and thus might fall at the // front or the back of the default century. This only works because we adjust // the year correctly to start with in other cases -- see subParse(). - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate parsedDate; if (ambiguousYear[0]) // If this is true then the two-digit year == the default start year { @@ -1060,7 +1060,7 @@ SimpleDateFormat::subParseLong(const UnicodeString& text, ParsePosition& pos, in int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count, bool_t obeyCount, bool_t ambiguousYear[]) const { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Formattable number; int32_t value = 0; int32_t i; @@ -1296,7 +1296,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC // [+-]hhmm as specified by RFC 822. This code is actually // a little more permissive than RFC 822. It will try to do // its best with numbers that aren't strictly 4 digits long. - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *fmt = new DecimalFormat("+####;-####", status); if(FAILURE(status)) return -start; @@ -1409,7 +1409,7 @@ void SimpleDateFormat::translatePattern(const UnicodeString& originalPattern, || (c >= 0x0041 /*'A'*/ && c <= 0x005A /*'Z'*/)) { UTextOffset ci = from.indexOf(c); if (ci == -1) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return; } c = to[ci]; @@ -1418,7 +1418,7 @@ void SimpleDateFormat::translatePattern(const UnicodeString& originalPattern, translatedPattern += c; } if (inQuote) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return; } } @@ -1545,7 +1545,7 @@ SimpleDateFormat::initializeSystemDefaultCentury() // No point in locking as it should be idempotent. if (fgSystemDefaultCenturyStart == fgSystemDefaultCentury) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *calendar = Calendar::createInstance(status); if (calendar != NULL && SUCCESS(status)) { diff --git a/icu4c/source/i18n/smpdtfmt.h b/icu4c/source/i18n/smpdtfmt.h index d8879ec21d1..bff71221842 100644 --- a/icu4c/source/i18n/smpdtfmt.h +++ b/icu4c/source/i18n/smpdtfmt.h @@ -111,7 +111,7 @@ class DateFormatSymbols; ** Code Sample: *- * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST"); * . pdt->setStartRule( Calendar::APRIL, 1, Calendar::SUNDAY, 2*60*60*1000); * . pdt->setEndRule( Calendar::OCTOBER, -1, Calendar::SUNDAY, 2*60*60*1000); @@ -295,7 +295,7 @@ public: * parse() that takes a ParsePosition. * * @param text The date/time string to be parsed - * @param status Filled in with ZERO_ERROR if the parse was successful, and with + * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with * an error value if there was a parse error. * @return A valid UDate if the input could be parsed. */ @@ -486,7 +486,7 @@ private: * this function is formatting the field specfied by pos, it * will fill in pos will the beginning and ending offsets of the * field. - * @param status Receives a status code, which will be ZERO_ERROR if the operation + * @param status Receives a status code, which will be U_ZERO_ERROR if the operation * succeeds. * @return A reference to "result". */ diff --git a/icu4c/source/i18n/sortkey.h b/icu4c/source/i18n/sortkey.h index 7d5f472bfae..a32a01b5f67 100644 --- a/icu4c/source/i18n/sortkey.h +++ b/icu4c/source/i18n/sortkey.h @@ -55,7 +55,7 @@ * *Example of use: *
- * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . Collator* myCollator = Collator::createInstance(success); * . CollationKey* keys = new CollationKey [3]; * . myCollator->getCollationKey("Tom", keys[0], success ); @@ -173,11 +173,11 @@ public : * is not the same as String.hashCode. *Example of use: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . Collator *myCollation = Collator::createInstance(Locale::US, status); * . if (FAILURE(status)) return; * . CollationKey key1, key2; - * . UErrorCode status1 = ZERO_ERROR, status2 = ZERO_ERROR; + * . UErrorCode status1 = U_ZERO_ERROR, status2 = U_ZERO_ERROR; * . myCollation->getCollationKey("abc", key1, status1); * . if (FAILURE(status1)) { delete myCollation; return; } * . myCollation->getCollationKey("ABC", key2, status2); diff --git a/icu4c/source/i18n/tblcoll.cpp b/icu4c/source/i18n/tblcoll.cpp index 42ad8e8b433..5f15e725558 100644 --- a/icu4c/source/i18n/tblcoll.cpp +++ b/icu4c/source/i18n/tblcoll.cpp @@ -302,7 +302,7 @@ void RuleBasedCollator::constructFromRules(const UnicodeString& rules, if (rules.isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -318,7 +318,7 @@ void RuleBasedCollator::constructFromRules(const UnicodeString& rules, data = new TableCollationData; if (data->isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; delete data; data = 0; return; @@ -358,7 +358,7 @@ RuleBasedCollator::constructFromFile(const char* fileName, FileStream* ifs = T_FileStream_open(fileName, "rb"); if (ifs == 0) { - status = FILE_ACCESS_ERROR; + status = U_FILE_ACCESS_ERROR; return; } @@ -367,17 +367,17 @@ RuleBasedCollator::constructFromFile(const char* fileName, if (!T_FileStream_error(ifs)) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; } else if (data && data->isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; delete data; data = 0; } else { - status = MISSING_RESOURCE_ERROR; + status = U_MISSING_RESOURCE_ERROR; delete data; data = 0; } @@ -435,20 +435,20 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale, { if (next == eDone) { - // We've failed to load a locale, but should never return MISSING_RESOURCE_ERROR - UErrorCode intStatus = ZERO_ERROR; + // We've failed to load a locale, but should never return U_MISSING_RESOURCE_ERROR + UErrorCode intStatus = U_ZERO_ERROR; constructFromRules(RuleBasedCollator::DEFAULTRULES, intStatus); - if (intStatus == ZERO_ERROR) + if (intStatus == U_ZERO_ERROR) { - status = USING_DEFAULT_ERROR; + status = U_USING_DEFAULT_ERROR; } else { status = intStatus; // bubble back } - if (status == MEMORY_ALLOCATION_ERROR) + if (status == U_MEMORY_ALLOCATION_ERROR) { return; } @@ -469,7 +469,7 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale, switch (next) { case eTryDefaultLocale: - status = USING_DEFAULT_ERROR; + status = U_USING_DEFAULT_ERROR; Locale::getDefault().getName(localeName); next = eTryDefaultCollation; break; @@ -479,7 +479,7 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale, // using a default collation object and the condition of // using a default locale to get a collation object currently. // That is, the caller can't distinguish based on UErrorCode. - status = USING_DEFAULT_ERROR; + status = U_USING_DEFAULT_ERROR; localeName = ResourceBundle::kDefaultFilename; next = eDone; break; @@ -489,7 +489,7 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale, // First try to load the collation from the in-memory static cache. // Note that all of the caching logic is handled here, and in the // call to RuleBasedCollator::addToCache, below. - UErrorCode intStatus = ZERO_ERROR; + UErrorCode intStatus = U_ZERO_ERROR; constructFromCache(localeName, intStatus); if (SUCCESS(intStatus)) @@ -503,7 +503,7 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale, // a binary collation file, or if that is unavailable, it will go // to the text resource bundle file (with the corresponding name) // and try to get the collation table there. - intStatus = ZERO_ERROR; + intStatus = U_ZERO_ERROR; constructFromFile(desiredLocale, localeName, TRUE, intStatus); if (SUCCESS(intStatus)) { @@ -519,7 +519,7 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale, setDecomposition(Normalizer::NO_OP); break; // Done! } - if (intStatus == MEMORY_ALLOCATION_ERROR) + if (intStatus == U_MEMORY_ALLOCATION_ERROR) { status = intStatus; return; @@ -529,9 +529,9 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale, // it less specific, and try again. Indicate the use of a // fallback locale, unless we've already fallen through to // a default locale -- then leave the status as is. - if (status == ZERO_ERROR) + if (status == U_ZERO_ERROR) { - status = USING_FALLBACK_ERROR; + status = U_USING_FALLBACK_ERROR; } chopLocale(localeName); @@ -575,7 +575,7 @@ RuleBasedCollator::constructFromFile( const Locale& locale, #ifdef COLLDEBUG cerr << localeFileName << " binary load " << errorName(status) << endl; #endif - if(SUCCESS(status) || status == MEMORY_ALLOCATION_ERROR) + if(SUCCESS(status) || status == U_MEMORY_ALLOCATION_ERROR) return; } @@ -593,17 +593,17 @@ RuleBasedCollator::constructFromFile( const Locale& locale, // check and see if this resource bundle contains collation data UnicodeString colString; - UErrorCode intStatus = ZERO_ERROR; + UErrorCode intStatus = U_ZERO_ERROR; bundle.getString("CollationElements", colString, intStatus); if(colString.isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } // if this bundle doesn't contain collation data, break out if(FAILURE(intStatus)) { - status = MISSING_RESOURCE_ERROR; + status = U_MISSING_RESOURCE_ERROR; return; } @@ -613,23 +613,23 @@ RuleBasedCollator::constructFromFile( const Locale& locale, colString.insert(0, DEFAULTRULES); if(colString.isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } constructFromRules(colString, intStatus); - if(intStatus == MEMORY_ALLOCATION_ERROR) { - status = MEMORY_ALLOCATION_ERROR; + if(intStatus == U_MEMORY_ALLOCATION_ERROR) { + status = U_MEMORY_ALLOCATION_ERROR; return; } - if(intStatus != ZERO_ERROR) { - status = USING_DEFAULT_ERROR; + if(intStatus != U_ZERO_ERROR) { + status = U_USING_DEFAULT_ERROR; // predefined tables should contain correct grammar - intStatus = ZERO_ERROR; + intStatus = U_ZERO_ERROR; constructFromRules(DEFAULTRULES, intStatus); - if(intStatus != ZERO_ERROR) { + if(intStatus != U_ZERO_ERROR) { status = intStatus; } } @@ -682,7 +682,7 @@ RuleBasedCollator::clone() const CollationElementIterator* RuleBasedCollator::createCollationElementIterator(const UnicodeString& source) const { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; CollationElementIterator *newCursor = 0; newCursor = new CollationElementIterator(source, this, status); @@ -699,7 +699,7 @@ RuleBasedCollator::createCollationElementIterator(const UnicodeString& source) c CollationElementIterator* RuleBasedCollator::createCollationElementIterator(const CharacterIterator& source) const { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; CollationElementIterator *newCursor = 0; newCursor = new CollationElementIterator(source, this, status); @@ -737,7 +737,7 @@ RuleBasedCollator::getRules() const // Notice that we pass in a tryBinaryFile value of FALSE, since // by design the binary file has NO rules in it! RuleBasedCollator temp; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; temp.constructFromFile(data->desiredLocale, data->realLocaleName, FALSE, status); // We must check that mPattern is nonzero here, or we run the risk @@ -802,7 +802,7 @@ RuleBasedCollator::compare(const UnicodeString& source, } Collator::EComparisonResult result = Collator::EQUAL; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // The basic algorithm here is that we use CollationElementIterators // to step through both the source and target strings. We compare each @@ -1143,13 +1143,13 @@ RuleBasedCollator::getCollationKey( const UnicodeString& source, { if (FAILURE(status)) { - status = ILLEGAL_ARGUMENT_ERROR; + status = U_ILLEGAL_ARGUMENT_ERROR; return sortkey.setToBogus(); } if (source.isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return sortkey.setToBogus(); } @@ -1253,7 +1253,7 @@ RuleBasedCollator::getCollationKey( const UnicodeString& source, if (sortkey.isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return sortkey; } @@ -1363,7 +1363,7 @@ RuleBasedCollator::build(const UnicodeString& pattern, if (data->mapping->fBogus) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1376,7 +1376,7 @@ RuleBasedCollator::build(const UnicodeString& pattern, if (pattern.size() == 0) { - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return; } @@ -1471,7 +1471,7 @@ RuleBasedCollator::build(const UnicodeString& pattern, void RuleBasedCollator::addComposedChars() { UnicodeString buf; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // Iterate through all of the pre-composed characters in Unicode ComposedCharIter iter; @@ -1650,7 +1650,7 @@ RuleBasedCollator::addOrder(UChar ch, key += ch; if (key.isBogus()) { - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1754,7 +1754,7 @@ RuleBasedCollator::addContractOrder(const UnicodeString& groupChars, { delete data->contractTable; data->contractTable = NULL; - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } } @@ -1777,7 +1777,7 @@ RuleBasedCollator::addContractOrder(const UnicodeString& groupChars, delete entryTable; delete data->contractTable; data->contractTable = NULL; - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1787,7 +1787,7 @@ RuleBasedCollator::addContractOrder(const UnicodeString& groupChars, delete entryTable; delete data->contractTable; data->contractTable = NULL; - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1800,7 +1800,7 @@ RuleBasedCollator::addContractOrder(const UnicodeString& groupChars, delete entryTable; delete data->contractTable; data->contractTable = NULL; - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1812,7 +1812,7 @@ RuleBasedCollator::addContractOrder(const UnicodeString& groupChars, delete entryTable; delete data->contractTable; data->contractTable = NULL; - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -1846,7 +1846,7 @@ RuleBasedCollator::addContractOrder(const UnicodeString& groupChars, delete entryTable; delete data->contractTable; data->contractTable = NULL; - status = MEMORY_ALLOCATION_ERROR; + status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -2163,7 +2163,7 @@ RuleBasedCollator::constructFromCache(const UnicodeString& key, data = TableCollationData::findInCache(key); if (data == NULL) { - status = MISSING_RESOURCE_ERROR; + status = U_MISSING_RESOURCE_ERROR; } } diff --git a/icu4c/source/i18n/tblcoll.h b/icu4c/source/i18n/tblcoll.h index c05af43b41f..4aa933eec20 100644 --- a/icu4c/source/i18n/tblcoll.h +++ b/icu4c/source/i18n/tblcoll.h @@ -176,12 +176,12 @@ class RuleBasedCollatorStreamer; *To create a table-based collation object, simply supply the collation * rules to the RuleBasedCollator contructor. For example: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . RuleBasedCollator *mySimple = new RuleBasedCollator(Simple, status); **Another example: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . RuleBasedCollator *myNorwegian = new RuleBasedCollator(Norwegian, status); ** To add rules on top of an existing table, simply supply the orginal rules @@ -200,7 +200,7 @@ class RuleBasedCollatorStreamer; * the English collation rules and add the additional rules to the table. * For example: *- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . UnicodeString rules(DEFAULTRULES); * . rules += "& C < ch, cH, Ch, CH"; * . RuleBasedCollator *mySpanish = new RuleBasedCollator(rules, status); @@ -208,7 +208,7 @@ class RuleBasedCollatorStreamer; *In order to sort symbols in the similiar order of sorting their * alphabetic equivalents, you can do the following, *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . UnicodeString rules(DEFAULTRULES); * . rules += "& Question-mark ; '?' & Ampersand ; '&' & Dollar-sign ; '$' "; * . RuleBasedCollator *myTable = new RuleBasedCollator(rules, status); @@ -216,13 +216,13 @@ class RuleBasedCollatorStreamer; *Another way of creating the table-based collation object, mySimple, * is: *
- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . RuleBasedCollator *mySimple = new * . RuleBasedCollator(" < a < b & b < c & c < d", status); ** Or, *- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . RuleBasedCollator *mySimple = new * . RuleBasedCollator(" < a < b < d & b < c", status); *@@ -277,7 +277,7 @@ class RuleBasedCollatorStreamer; * . '<', 'c', ',', 'C', '<', 'e', ',', 'E', '&', * . 'C', '<', 'd', ',', 'D', 0 }; * . UnicodeString oldRules(contents); - * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . // change the order of accent characters * . UChar addOn[] = { '&', ',', 0x0300, ';', 0x0308, ';', 0x0302, 0 }; * . oldRules += addOn; @@ -288,7 +288,7 @@ class RuleBasedCollatorStreamer; * default setting. For example, in Japanese collation, you can either sort * English characters before or after Japanese characters, *- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . // get en_US collation rules * . RuleBasedCollator* en_USCollation = * . (RuleBasedCollator*) Collator::createInstance(Locale::US, status); diff --git a/icu4c/source/i18n/timezone.cpp b/icu4c/source/i18n/timezone.cpp index ed74dcd7c35..bdd871dd7fd 100644 --- a/icu4c/source/i18n/timezone.cpp +++ b/icu4c/source/i18n/timezone.cpp @@ -82,7 +82,7 @@ const UnicodeString TimeZone::CUSTOM_ID = "Custom"; const TimeZone* TimeZone::GMT = new SimpleTimeZone(0, GMT_ID); -UErrorCode TimeZone::fgStatus = ZERO_ERROR; +UErrorCode TimeZone::fgStatus = U_ZERO_ERROR; /* Lazy evaluated. HPUX CC compiler can't handle array initialization with complex objects */ @@ -1848,7 +1848,7 @@ TimeZone::getHashtable() // build a hashtable that contains all the TimeZone objects in kSystemTimeZones // and maps their IDs to the actual TimeZone objects (gives us fast lookup) - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; newHashtable = uhash_open((UHashFunction) uhash_hashUString, &err); uhash_setValueDeleter(newHashtable, TimeZone::deleteTimeZone); @@ -1892,7 +1892,7 @@ TimeZone::stringToInteger(const UnicodeString& string, UErrorCode& status) int32_t len = string.size(); char *number = new char[1 + len]; - if (number == 0) { status = MEMORY_ALLOCATION_ERROR; return 0; } + if (number == 0) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } char *end; string.extract(0, len, number); @@ -1902,7 +1902,7 @@ TimeZone::stringToInteger(const UnicodeString& string, UErrorCode& status) delete[] number; if (end-number != len || len == 0) - status = INVALID_FORMAT_ERROR; + status = U_INVALID_FORMAT_ERROR; return value; }*/ @@ -2131,7 +2131,7 @@ TimeZone::getDisplayName(bool_t daylight, EDisplayType style, const Locale& loca initSystemTimeZones(); } // SRL TODO: cache the SDF, just like java. - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat format(style == LONG ? "zzzz" : "z",locale,status); @@ -2199,7 +2199,7 @@ TimeZone::createCustomTimeZone(const UnicodeString& id) return 0; pos.setIndex(pos.getIndex() + 1); - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; numberFormat = NumberFormat::createInstance(success); numberFormat->setParseIntegerOnly(TRUE); diff --git a/icu4c/source/i18n/ubrk.cpp b/icu4c/source/i18n/ubrk.cpp index e5e07356ca6..4ffdd981df8 100644 --- a/icu4c/source/i18n/ubrk.cpp +++ b/icu4c/source/i18n/ubrk.cpp @@ -50,7 +50,7 @@ ubrk_open(UBreakIteratorType type, // check for allocation error if(result == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -58,7 +58,7 @@ ubrk_open(UBreakIteratorType type, UCharCharacterIterator *iter = 0; iter = new UCharCharacterIterator(text, textLen); if(iter == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; delete result; return 0; } @@ -140,4 +140,3 @@ ubrk_countAvailable() { return uloc_countAvailable(); } - diff --git a/icu4c/source/i18n/ucal.cpp b/icu4c/source/i18n/ucal.cpp index 49fa4b495b2..65035209461 100644 --- a/icu4c/source/i18n/ucal.cpp +++ b/icu4c/source/i18n/ucal.cpp @@ -33,14 +33,14 @@ ucal_getAvailableTZIDs( int32_t rawOffset, count); if(tzs == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } if(index < count) retVal = tzs[index]->getUChars(); else - *status = INDEX_OUTOFBOUNDS_ERROR; + *status = U_INDEX_OUTOFBOUNDS_ERROR; delete [] tzs; return retVal; @@ -55,7 +55,7 @@ ucal_countAvailableTZIDs(int32_t rawOffset) count); if(tzs == 0) { - // TBD: MEMORY_ALLOCATION_ERROR + // TBD: U_MEMORY_ALLOCATION_ERROR return 0; } @@ -90,14 +90,14 @@ ucal_open( const UChar* zoneID, length, length)); } if(zone == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } Calendar *cal = 0; cal = Calendar::createInstance(zone, Locale().init(locale), *status); if(cal == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; delete zone; return 0; } @@ -129,7 +129,7 @@ ucal_setTimeZone( UCalendar* cal, length, length)); } if(zone == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index ebd9539f99a..c86fe51c4a4 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -79,7 +79,7 @@ ucol_open( const char *loc, col = Collator::createInstance(Locale().init(loc), *status); if(col == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -124,7 +124,7 @@ ucol_openRules( const UChar *rules, *status); if(col == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -295,7 +295,7 @@ ucol_getSortKey(const UCollator *coll, int32_t len = (sourceLength == -1 ? u_strlen(source) : sourceLength); UnicodeString string((UChar*)source, len, len); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; ((Collator*)coll)->getCollationKey(string, key, status); if(FAILURE(status)) @@ -307,7 +307,7 @@ ucol_getSortKey(const UCollator *coll, icu_arrayCopy((const int8_t*)bytes, (int8_t*)result, copyLen); // if(count > resultLength) { - // *status = BUFFER_OVERFLOW_ERROR; + // *status = U_BUFFER_OVERFLOW_ERROR; // } return count; @@ -333,7 +333,7 @@ ucol_openElements( const UCollator *coll, CollationElementIterator *iter = 0; iter = ((RuleBasedCollator*)coll)->createCollationElementIterator(src); if(iter == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } diff --git a/icu4c/source/i18n/ucol.h b/icu4c/source/i18n/ucol.h index f716933be3c..af9a6a26b8c 100644 --- a/icu4c/source/i18n/ucol.h +++ b/icu4c/source/i18n/ucol.h @@ -34,7 +34,7 @@ *** // Compare two strings in the default locale - * UErrorCode success = ZERO_ERROR; + * UErrorCode success = U_ZERO_ERROR; * UCollator* myCollator = ucol_open(NULL, &success); * UChar source[4], target[4]; * u_uastrcpy(source, "abc"); @@ -62,7 +62,7 @@ *** //Get the Collator for US English and set its strength to UCOL_PRIMARY - * UErrorCode success = ZERO_ERROR; + * UErrorCode success = U_ZERO_ERROR; * UCollator* usCollator = ucol_open("en_US", &success); * ucol_setStrength(usCollator, UCOL_PRIMARY); * UChar source[4], target[4]; @@ -416,7 +416,7 @@ ucol_getStrength(const UCollator *coll); ** . UCollationResult result; * . UChar *source, *target; - * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . UCollator *myCollation = ucol_open("en_US", status); * . if (FAILURE(&status)) return; * . ucol_setStrength(myCollation, UCOL_PRIMARY); @@ -570,7 +570,7 @@ typedef struct UCollationElements UCollationElements; * . t_int32 order, primaryOrder; * . UCollationElements *c; * . UCollator *coll; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . s=(UChar*)malloc(sizeof(UChar) * (strlen("This is a test")+1) ); * . u_uastrcpy(s, "This is a test"); * . coll = ucol_open(NULL, &success); diff --git a/icu4c/source/i18n/udat.cpp b/icu4c/source/i18n/udat.cpp index 233e858c667..e3fa77ce846 100644 --- a/icu4c/source/i18n/udat.cpp +++ b/icu4c/source/i18n/udat.cpp @@ -45,7 +45,7 @@ udat_open( UDateFormatStyle timeStyle, Locale().init(locale)); if(fmt == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -55,7 +55,7 @@ udat_open( UDateFormatStyle timeStyle, zone = TimeZone::createTimeZone(UnicodeString((UChar*)tzID, length, length)); if(zone == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; delete fmt; return 0; } @@ -87,7 +87,7 @@ udat_openPattern( const UChar *pattern, *status); if(retVal == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } return retVal; @@ -108,7 +108,7 @@ udat_clone(const UDateFormat *fmt, Format *res = ((SimpleDateFormat*)fmt)->clone(); if(res == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -168,7 +168,7 @@ udat_parse( const UDateFormat* format, *parsePos = pp.getIndex(); else { *parsePos = pp.getErrorIndex(); - *status = PARSE_ERROR; + *status = U_PARSE_ERROR; } } @@ -274,7 +274,7 @@ udat_applyPattern( UDateFormat *format, { int32_t len = (patternLength == -1 ? u_strlen(pattern) : patternLength); const UnicodeString pat((UChar*)pattern, len, len); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if(localized) ((SimpleDateFormat*)format)->applyLocalizedPattern(pat, status); @@ -419,7 +419,7 @@ udat_setSymbols( UDateFormat *format, UnicodeString *array = 0; if(syms == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -428,7 +428,7 @@ udat_setSymbols( UDateFormat *format, res = syms->getEras(count); array = new UnicodeString[count]; if(array == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } icu_arrayCopy(res, array, count); @@ -441,7 +441,7 @@ udat_setSymbols( UDateFormat *format, res = syms->getMonths(count); array = new UnicodeString[count]; if(array == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } icu_arrayCopy(res, array, count); @@ -454,7 +454,7 @@ udat_setSymbols( UDateFormat *format, res = syms->getShortMonths(count); array = new UnicodeString[count]; if(array == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } icu_arrayCopy(res, array, count); @@ -467,7 +467,7 @@ udat_setSymbols( UDateFormat *format, res = syms->getWeekdays(count); array = new UnicodeString[count]; if(array == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } icu_arrayCopy(res, array, count); @@ -480,7 +480,7 @@ udat_setSymbols( UDateFormat *format, res = syms->getShortWeekdays(count); array = new UnicodeString[count]; if(array == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } icu_arrayCopy(res, array, count); @@ -493,7 +493,7 @@ udat_setSymbols( UDateFormat *format, res = syms->getAmPmStrings(count); array = new UnicodeString[count]; if(array == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } icu_arrayCopy(res, array, count); diff --git a/icu4c/source/i18n/udat.h b/icu4c/source/i18n/udat.h index e6cc397e3d8..20a66c97d14 100644 --- a/icu4c/source/i18n/udat.h +++ b/icu4c/source/i18n/udat.h @@ -39,8 +39,8 @@ * . t_int32 myStrlen=0; * . UDateFormat* dfmt = udat_open(UCAL_DEFAULT, UCAL_DEFAULT, NULL, "PST", &status); * . myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &status); - * . if(status==BUFFER_OVERFLOW_ERROR){ - * . status=ZERO_ERROR; + * . if(status==U_BUFFER_OVERFLOW_ERROR){ + * . status=U_ZERO_ERROR; * . myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) ); * . udat_format(dfmt, myDate, myString, myStrlen+1, &pos, &status); * . } @@ -55,8 +55,8 @@ * . UDateFormat* df = udat_open(UCAL_DEFAULT, UCAL_DEFAULT, NULL, "GMT", &status); * . for (i = 0; i < 3; ++i) { * . myStrlen = udat_format(df, myDate, NULL, myStrlen, &pos, &status); - * . if(status==BUFFER_OVERFLOW_ERROR){ - * . status=ZERO_ERROR; + * . if(status==U_BUFFER_OVERFLOW_ERROR){ + * . status=U_ZERO_ERROR; * . myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) ); * . udat_format(df, myDate, myString, myStrlen+1, &pos, &status); * . } @@ -71,7 +71,7 @@ ** You can use a DateFormat API udat_parse() to parse. *- * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . t_int32 parsepos=0; * . UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status); *diff --git a/icu4c/source/i18n/umsg.cpp b/icu4c/source/i18n/umsg.cpp index c3c3e89ee8f..4535333c437 100644 --- a/icu4c/source/i18n/umsg.cpp +++ b/icu4c/source/i18n/umsg.cpp @@ -218,7 +218,7 @@ UnicodeString& umsg_itos(int32_t i, UnicodeString& string) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *myFormat = umsg_getNumberFormat(status); if(FAILURE(status)) @@ -324,7 +324,7 @@ u_formatMessage( const char *locale, int32_t argNum = umsg_stoi(pattern + bracePos + 1, *status); if(argNum >= MAX_ARGS) { - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; return -1; } @@ -350,7 +350,7 @@ u_formatMessage( const char *locale, // detect any unmatched braces in the pattern if(braceStack == 0 && part != 0) { - *status = INVALID_FORMAT_ERROR; + *status = U_INVALID_FORMAT_ERROR; return -1; } diff --git a/icu4c/source/i18n/umsg.h b/icu4c/source/i18n/umsg.h index b431981e378..353a8b93cfe 100644 --- a/icu4c/source/i18n/umsg.h +++ b/icu4c/source/i18n/umsg.h @@ -32,7 +32,7 @@ * . UCalendar *cal; * . UDate d1; * . UDateFormat *def1; - * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . str=(UChar*)malloc(sizeof(UChar) * (strlen("disturbance in force") +1)); * . u_uastrcpy(str, "disturbance in force"); * . tzID=(UChar*)malloc(sizeof(UChar) * 4); @@ -43,8 +43,8 @@ * . u_uastrcpy(pattern, "On {0, date, long}, there was a {1} on planet {2,number,integer}"); * . resultlength=0; * . resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, d1, str, 7); - * . if(status==BUFFER_OVERFLOW_ERROR){ - * . status=ZERO_ERROR; + * . if(status==U_BUFFER_OVERFLOW_ERROR){ + * . status=U_ZERO_ERROR; * . resultlength=resultLengthOut+1; * . result=(UChar*)realloc(result, sizeof(UChar) * resultlength); * . u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, d1, str, 7); @@ -58,7 +58,7 @@ * Example 2: ** . UChar* str; - * . UErrorCode status = ZERO_ERROR; + * . UErrorCode status = U_ZERO_ERROR; * . UChar *result; * . UChar pattern[100]; * . t_int32 resultlength,resultLengthOut, i; @@ -69,8 +69,8 @@ * . for(i=0; i<3; i++){ * . resultlength=0; * . resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, testArgs[i], str); - * . if(status==BUFFER_OVERFLOW_ERROR){ - * . status=ZERO_ERROR; + * . if(status==U_BUFFER_OVERFLOW_ERROR){ + * . status=U_ZERO_ERROR; * . resultlength=resultLengthOut+1; * . result=(UChar*)malloc(sizeof(UChar) * resultlength); * . u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, testArgs[i], str); diff --git a/icu4c/source/i18n/unum.cpp b/icu4c/source/i18n/unum.cpp index 689615fd54f..a5b322f9880 100644 --- a/icu4c/source/i18n/unum.cpp +++ b/icu4c/source/i18n/unum.cpp @@ -62,13 +62,13 @@ unum_open( UNumberFormatStyle style, case UNUM_SPELLOUT: // TBD: Add spellout support //retVal = (UNumberFormat*)new NumberSpelloutFormat(); - *status = UNSUPPORTED_ERROR; + *status = U_UNSUPPORTED_ERROR; return 0; break; } if(retVal == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -94,14 +94,14 @@ unum_openPattern( const UChar* pattern, *status); if(syms == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } DecimalFormat *fmt = 0; fmt = new DecimalFormat(pat, syms, *status); if(fmt == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; delete syms; return 0; } @@ -124,7 +124,7 @@ unum_clone(const UNumberFormat *fmt, Format *res = ((DecimalFormat*)fmt)->clone(); if(res == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -213,7 +213,7 @@ unum_parse( const UNumberFormat* fmt, *parsePos = pp.getIndex(); else { *parsePos = pp.getErrorIndex(); - *status = PARSE_ERROR; + *status = U_PARSE_ERROR; } } @@ -247,7 +247,7 @@ unum_parseDouble( const UNumberFormat* fmt, *parsePos = pp.getIndex(); else { *parsePos = pp.getErrorIndex(); - *status = PARSE_ERROR; + *status = U_PARSE_ERROR; } } @@ -471,7 +471,7 @@ unum_getTextAttribute( const UNumberFormat* fmt, break; default: - *status = UNSUPPORTED_ERROR; + *status = U_UNSUPPORTED_ERROR; return -1; break; } @@ -515,7 +515,7 @@ unum_setTextAttribute( UNumberFormat* fmt, break; default: - *status = UNSUPPORTED_ERROR; + *status = U_UNSUPPORTED_ERROR; break; } } @@ -595,7 +595,7 @@ unum_setSymbols( UNumberFormat* fmt, DecimalFormatSymbols *syms = new DecimalFormatSymbols(*status); if(syms == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } diff --git a/icu4c/source/i18n/unum.h b/icu4c/source/i18n/unum.h index 2334de34620..6a806f83fce 100644 --- a/icu4c/source/i18n/unum.h +++ b/icu4c/source/i18n/unum.h @@ -38,7 +38,7 @@ * . UChar myString[20]; * . UFieldPosition pos=0; * . double myNumber = 7.0; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, &success) * . unum_formatDouble(nf, myNumber, myString, u_strlen(myString), &pos, &status); * . printf(" Example 1: %s\n", austrdup(myString) ); //austrdup( a function used to convert UChar* to char*) @@ -50,7 +50,7 @@ ** . UChar* myString; * . t_int32 i, resultlength, reslenneeded; - * . UErrorCode success = ZERO_ERROR; + * . UErrorCode success = U_ZERO_ERROR; * . UFieldPosition pos=0; * . t_int32 a[] = { 123, 3333, -1234567 }; * . const t_int32 a_len = sizeof(a) / sizeof(a[0]); @@ -58,8 +58,8 @@ * . for (i = 0; i < a_len; i++) { * . resultlength=0; * . reslenneeded=unum_format(nf, a[i], NULL, resultlength, &pos, &status); - * . if(status==BUFFER_OVERFLOW_ERROR){ - * . status=ZERO_ERROR; + * . if(status==U_BUFFER_OVERFLOW_ERROR){ + * . status=U_ZERO_ERROR; * . resultlength=resultlengthneeded+1; * . result=(UChar*)malloc(sizeof(UChar) * resultlength); * . unum_format(nf, a[i], result, resultlength, &pos, &status); diff --git a/icu4c/source/samples/XMLConverter/XMLConverter.cpp b/icu4c/source/samples/XMLConverter/XMLConverter.cpp index 8dbc9fea5df..692147fff64 100644 --- a/icu4c/source/samples/XMLConverter/XMLConverter.cpp +++ b/icu4c/source/samples/XMLConverter/XMLConverter.cpp @@ -118,7 +118,7 @@ void usage(char * exeName) int main(int argc, char** argv) { - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; char* inFileName; char* outFileName; char * encName = NULL; @@ -201,7 +201,7 @@ void convertFile(char* encName, char* iFN, char* oFN, UConverter* outConvrtr) char rawBuf[RAWBUFSIZE]; char* pRawBuf = NULL; unsigned long bytesRead = 0; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; //get the file size // @@ -356,7 +356,7 @@ void convertFile(char* encName, char* iFN, char* oFN, UConverter* outConvrtr) char *outBuf = new char[RAWBUFSIZE]; int outBufSize = RAWBUFSIZE; bool tFlush = false; - err = ZERO_ERROR; + err = U_ZERO_ERROR; if (verbose) fprintf(stdout, "processing the rest of the file \n"); @@ -382,7 +382,7 @@ void convertFile(char* encName, char* iFN, char* oFN, UConverter* outConvrtr) } } - if ((err != BUFFER_OVERFLOW_ERROR) && FAILURE(err) ) + if ((err != U_BUFFER_OVERFLOW_ERROR) && FAILURE(err) ) { #if defined(_DEBUG) fprintf (stderr, "Error transcoding rest of the file: (%s) %d\n", errorName(err), err); @@ -391,7 +391,7 @@ void convertFile(char* encName, char* iFN, char* oFN, UConverter* outConvrtr) fclose(outFile); exit(1); } - if ((bytesRead > 0) && (err !=ZERO_ERROR)) + if ((bytesRead > 0) && (err !=U_ZERO_ERROR)) { if(verbose) fprintf(stderr, "err=%d * read %d bytes\n", err,bytesRead); @@ -411,8 +411,8 @@ void convertFile(char* encName, char* iFN, char* oFN, UConverter* outConvrtr) } toRead = (RAWBUFSIZE > bytesLeft) ? bytesLeft : RAWBUFSIZE; if (toRead < RAWBUFSIZE) tFlush = true; - if (err == BUFFER_OVERFLOW_ERROR) - err = ZERO_ERROR; + if (err == U_BUFFER_OVERFLOW_ERROR) + err = U_ZERO_ERROR; } ucnv_close(inConvrtr); delete inEncodName; @@ -506,7 +506,7 @@ long convertFirstLine( FILE* inF, char* inEncName, char tempBuf[RAWBUFSIZE]; int bufLength = 0; long bytesNeeded = 0; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; bytesNeeded = ucnv_convert("ascii", inEncName, @@ -516,9 +516,9 @@ long convertFirstLine( FILE* inF, char* inEncName, bytesRead, &err); - if (err == BUFFER_OVERFLOW_ERROR) + if (err == U_BUFFER_OVERFLOW_ERROR) { - err = ZERO_ERROR; + err = U_ZERO_ERROR; } else if (FAILURE(err)) { @@ -767,7 +767,7 @@ long convertFirstLine( FILE* inF, char* inEncName, fwrite( (void*) uBuf, 1, 1, outF); } - err = ZERO_ERROR; + err = U_ZERO_ERROR; long oneChar = 0; while ( *stringTwo != '\0' ) { @@ -779,9 +779,9 @@ long convertFirstLine( FILE* inF, char* inEncName, (const char*) stringTwo, 1, &err); - if (err == BUFFER_OVERFLOW_ERROR) + if (err == U_BUFFER_OVERFLOW_ERROR) { - err = ZERO_ERROR; + err = U_ZERO_ERROR; } else if (FAILURE(err)) { @@ -843,7 +843,7 @@ long convertFirstLine( FILE* inF, char* inEncName, //transcode this ascii type to the input encoding type //and get the pointer to the end of first line in the input buffer // - err = ZERO_ERROR; + err = U_ZERO_ERROR; endBytes = ucnv_convert(newInEncName, "ascii", (char*) newBuf, @@ -852,9 +852,9 @@ long convertFirstLine( FILE* inF, char* inEncName, bufHere, &err); - if (err == BUFFER_OVERFLOW_ERROR) + if (err == U_BUFFER_OVERFLOW_ERROR) { - err = ZERO_ERROR; + err = U_ZERO_ERROR; } else if (FAILURE(err)) { @@ -914,7 +914,7 @@ int32_t XMLUConvert( UConverter* inConverter, flush, err); - if (*err == INDEX_OUTOFBOUNDS_ERROR) *err = BUFFER_OVERFLOW_ERROR; + if (*err == U_INDEX_OUTOFBOUNDS_ERROR) *err = U_BUFFER_OVERFLOW_ERROR; // *inBufSize = inBufferAlias; return outBufferAlias - outBuffer; @@ -962,13 +962,13 @@ void XMLU_fromCodepageToCodepage( UConverter* outConverter, flush, err); - /*INDEX_OUTOFBOUNDS_ERROR means that the output "CHUNK" is full + /*U_INDEX_OUTOFBOUNDS_ERROR means that the output "CHUNK" is full *we will require at least another loop (it's a recoverable error) */ - if (SUCCESS(*err) || (*err == INDEX_OUTOFBOUNDS_ERROR)) + if (SUCCESS(*err) || (*err == U_INDEX_OUTOFBOUNDS_ERROR)) { - *err = ZERO_ERROR; + *err = U_ZERO_ERROR; out_chunk_alias2 = out_chunk; while ((out_chunk_alias2 != out_chunk_alias) && SUCCESS(*err)) @@ -1017,13 +1017,13 @@ void XMLU_fromCodepageToCodepage( UConverter* outConverter, flush, err); - /*INDEX_OUTOFBOUNDS_ERROR means that the output "CHUNK" is full + /*U_INDEX_OUTOFBOUNDS_ERROR means that the output "CHUNK" is full *we will require at least another loop (it's a recoverable error) */ - if (SUCCESS (*err) || (*err == INDEX_OUTOFBOUNDS_ERROR)) + if (SUCCESS (*err) || (*err == U_INDEX_OUTOFBOUNDS_ERROR)) { - *err = ZERO_ERROR; + *err = U_ZERO_ERROR; out_chunk_alias2 = out_chunk; while ((out_chunk_alias2 != out_chunk_alias) && SUCCESS (*err)) diff --git a/icu4c/source/samples/cal/cal.c b/icu4c/source/samples/cal/cal.c index 54ed0615626..eafc691f742 100644 --- a/icu4c/source/samples/cal/cal.c +++ b/icu4c/source/samples/cal/cal.c @@ -82,7 +82,7 @@ main(int argc, int optind = 1; char *arg; int32_t month = -1, year = -1; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* parse the options */ diff --git a/icu4c/source/samples/cal/uprint.c b/icu4c/source/samples/cal/uprint.c index 58a8687fbdc..dfd49ac7576 100644 --- a/icu4c/source/samples/cal/uprint.c +++ b/icu4c/source/samples/cal/uprint.c @@ -56,7 +56,7 @@ uprint(const UChar *s, /* perform the conversion */ do { /* reset the error code */ - *status = ZERO_ERROR; + *status = U_ZERO_ERROR; /* perform the conversion */ ucnv_fromUnicode(converter, &myTarget, myTarget + arraySize, @@ -70,7 +70,7 @@ uprint(const UChar *s, myTarget = buf; arraySize = BUF_SIZE; } - while(*status == INDEX_OUTOFBOUNDS_ERROR); + while(*status == U_INDEX_OUTOFBOUNDS_ERROR); finish: diff --git a/icu4c/source/samples/date/date.c b/icu4c/source/samples/date/date.c index d4d647c18be..0da66f722b4 100644 --- a/icu4c/source/samples/date/date.c +++ b/icu4c/source/samples/date/date.c @@ -55,7 +55,7 @@ main(int argc, char *arg; const UChar *tz = 0; UDateFormatStyle style = UDAT_DEFAULT; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* parse the options */ @@ -164,8 +164,8 @@ date(const UChar *tz, fmt = udat_open(style, style, 0, tz, -1, status); len = udat_format(fmt, ucal_getNow(), 0, len, 0, status); - if(*status == BUFFER_OVERFLOW_ERROR) { - *status = ZERO_ERROR; + if(*status == U_BUFFER_OVERFLOW_ERROR) { + *status = U_ZERO_ERROR; s = (UChar*) malloc(sizeof(UChar) * (len+1)); if(s == 0) goto finish; udat_format(fmt, ucal_getNow(), s, len + 1, 0, status); diff --git a/icu4c/source/samples/date/uprint.c b/icu4c/source/samples/date/uprint.c index d445b0cc183..57ada0489fb 100644 --- a/icu4c/source/samples/date/uprint.c +++ b/icu4c/source/samples/date/uprint.c @@ -58,7 +58,7 @@ uprint(const UChar *s, /* perform the conversion */ do { /* reset the error code */ - *status = ZERO_ERROR; + *status = U_ZERO_ERROR; /* perform the conversion */ ucnv_fromUnicode(converter, &myTarget, myTarget + arraySize, @@ -72,7 +72,7 @@ uprint(const UChar *s, myTarget = buf; arraySize = BUF_SIZE; } - while(*status == INDEX_OUTOFBOUNDS_ERROR); + while(*status == U_INDEX_OUTOFBOUNDS_ERROR); finish: diff --git a/icu4c/source/test/cintltst/callcoll.c b/icu4c/source/test/cintltst/callcoll.c index ad31fb3baaf..3c0aebeaea2 100644 --- a/icu4c/source/test/cintltst/callcoll.c +++ b/icu4c/source/test/cintltst/callcoll.c @@ -422,7 +422,7 @@ void TestTertiary() { int32_t len,i; UChar *rules, *newRules; - UErrorCode status=ZERO_ERROR; + UErrorCode status=U_ZERO_ERROR; const char* str="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; newRules=(UChar*)malloc(sizeof(UChar*) * (strlen(str)+1)); u_uastrcpy(newRules, str); @@ -451,7 +451,7 @@ void TestPrimary( ) { int32_t len,i; UChar *rules, *newRules; - UErrorCode status=ZERO_ERROR; + UErrorCode status=U_ZERO_ERROR; const char* str="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; newRules=(UChar*)malloc(sizeof(UChar*) * strlen(str)); @@ -484,7 +484,7 @@ void TestSecondary() int32_t i; int32_t len; UChar *rules, *newRules; - UErrorCode status=ZERO_ERROR; + UErrorCode status=U_ZERO_ERROR; const char* str="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; newRules=(UChar*)malloc(sizeof(UChar*) * strlen(str)); @@ -514,7 +514,7 @@ void TestIdentical() int32_t i; int32_t len; UChar *rules = 0, *newRules = 0; - UErrorCode status=ZERO_ERROR; + UErrorCode status=U_ZERO_ERROR; const char* str="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; newRules=(UChar*)malloc(sizeof(UChar*) * strlen(str)); @@ -543,7 +543,7 @@ void TestExtra() int32_t i, j; int32_t len; UChar *rules, *newRules; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const char* str="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; newRules=(UChar*)malloc(sizeof(UChar*) * strlen(str)); u_uastrcpy(newRules, str); diff --git a/icu4c/source/test/cintltst/capitst.c b/icu4c/source/test/cintltst/capitst.c index 0c67bda2122..f9d4ee9b40c 100644 --- a/icu4c/source/test/cintltst/capitst.c +++ b/icu4c/source/test/cintltst/capitst.c @@ -56,7 +56,7 @@ void TestProperty() int32_t len; UChar *source, *target; int32_t tempLength; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; log_verbose("The property tests begin : \n"); log_verbose("Test ucol_strcoll : \n"); @@ -115,8 +115,8 @@ void TestProperty() log_verbose("Get display name for the default collation in German : \n"); len=ucol_getDisplayName("en_US", "de_DE", NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; disName=(UChar*)malloc(sizeof(UChar) * (len+1)); ucol_getDisplayName("en_US", "de_DE", disName, len+1, &status); } @@ -155,8 +155,8 @@ void TestProperty() log_verbose("Get display name for the french collation in english : \n"); len=ucol_getDisplayName("fr_FR", "en_US", NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; disName=(UChar*)malloc(sizeof(UChar) * (len+1)); ucol_getDisplayName("fr_FR", "en_US", disName, len+1, &status); } @@ -180,7 +180,7 @@ void TestRuleBasedColl() UChar ruleset2[50]; const UChar *rule1, *rule2, *rule3, *rule4; int32_t tempLength; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; u_uastrcpy(ruleset1, "< a, A < b, B < c, C; ch, cH, Ch, CH < d, D, e, E"); u_uastrcpy(ruleset2, "< a, A < b, B < c, C < d, D, e, E"); @@ -193,7 +193,7 @@ void TestRuleBasedColl() else log_verbose("PASS: RuleBased Collator creation passed\n"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; col2 = ucol_openRules(ruleset2, u_strlen(ruleset2), UCOL_DEFAULT_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status); if (FAILURE(status)) { log_err("RuleBased Collator creation failed.: %s\n", myErrorName(status)); @@ -203,7 +203,7 @@ void TestRuleBasedColl() log_verbose("PASS: RuleBased Collator creation passed\n"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; col3= ucol_open(NULL, &status); if (FAILURE(status)) { log_err("Default Collator creation failed.: %s\n", myErrorName(status)); @@ -237,13 +237,13 @@ void TestRuleBasedColl() void TestCompare() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UCollator *col; UChar* test1; UChar* test2; log_verbose("The compare tests begin : \n"); - status=ZERO_ERROR; + status=U_ZERO_ERROR; col = ucol_open("en_US", &status); if(FAILURE(status)) { log_err("ucal_open() collation creation failed.: %s\n", myErrorName(status)); @@ -291,7 +291,7 @@ void TestSortKey() int32_t sortklen; UCollator *col; UChar *test1, *test2, *test3; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; log_verbose("testing SortKey begins...\n"); col = ucol_open(NULL, &status); if (FAILURE(status)) { @@ -353,7 +353,7 @@ void TestHashCode() int32_t sortk1len, sortk2len, sortk3len; UCollator *col; UChar *test1, *test2, *test3; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; log_verbose("testing getHashCode begins...\n"); col = ucol_open("en_US", &status); if (FAILURE(status)) { @@ -404,7 +404,7 @@ void TestElemIter() UChar *testString1, *testString2; UCollator *col; UCollationElements *iterator1, *iterator2, *iterator3; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; log_verbose("testing UCollatorElements begins...\n"); col = ucol_open(NULL, &status); ucol_setNormalization(col, UCOL_NO_NORMALIZATION); @@ -521,5 +521,3 @@ void TestGetAll() } - - diff --git a/icu4c/source/test/cintltst/cbiapts.c b/icu4c/source/test/cintltst/cbiapts.c index 5fd4bc433e6..b61beddd5fa 100644 --- a/icu4c/source/test/cintltst/cbiapts.c +++ b/icu4c/source/test/cintltst/cbiapts.c @@ -41,13 +41,13 @@ void addBrkIterAPITest(TestNode** root) void TestBreakIteratorCAPI() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *word, *sentence, *line, *character, *b; UChar text[50]; UTextOffset start,pos,end,to; int32_t count = 0; u_uastrcpy(text, "He's from Africa. ""Mr. Livingston, I presume?"" Yeah"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; /*test ubrk_open()*/ log_verbose("\nTesting BreakIterator open functions\n"); diff --git a/icu4c/source/test/cintltst/cbiditst.c b/icu4c/source/test/cintltst/cbiditst.c index ba6fbcba8b0..d369043d871 100644 --- a/icu4c/source/test/cintltst/cbiditst.c +++ b/icu4c/source/test/cintltst/cbiditst.c @@ -57,7 +57,7 @@ addComplexTest(TestNode** root) { extern void doBiDiTest() { UBiDi *pBiDi, *pLine=NULL; - UErrorCode errorCode=ZERO_ERROR; + UErrorCode errorCode=U_ZERO_ERROR; log_verbose("*** bidi regression test ***\n"); @@ -92,7 +92,7 @@ doTests(UBiDi *pBiDi, UBiDi *pLine) { UBiDiLevel paraLevel; for(i=0; ilevels; const uint8_t *visualMap=test->visualMap; UTextOffset i, len=ubidi_getLength(pBiDi), logicalIndex, runCount; - UErrorCode errorCode=ZERO_ERROR; + UErrorCode errorCode=U_ZERO_ERROR; UBiDiLevel level, level2; testReordering(pBiDi, testNumber); @@ -212,7 +212,7 @@ testReordering(UBiDi *pBiDi, int testNumber) { UTextOffset logicalMap1[200], logicalMap2[200], logicalMap3[200], visualMap1[200], visualMap2[200], visualMap3[200], visualMap4[200]; - UErrorCode errorCode=ZERO_ERROR; + UErrorCode errorCode=U_ZERO_ERROR; UBiDiLevel levels[200]; UTextOffset i, length=ubidi_getLength(pBiDi); UTextOffset runCount, visualIndex, logicalStart, runLength; diff --git a/icu4c/source/test/cintltst/ccaltst.c b/icu4c/source/test/cintltst/ccaltst.c index 239c4b90f13..9402c75b7a5 100644 --- a/icu4c/source/test/cintltst/ccaltst.c +++ b/icu4c/source/test/cintltst/ccaltst.c @@ -51,7 +51,7 @@ void TestCalendar() int32_t count, count2, offset,i; UChar *tzID = 0; UChar *tzdname = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate now; UDateFormat *datdef = 0; UChar *result = 0; @@ -143,9 +143,9 @@ void TestCalendar() resultlength=0; resultlengthneeded=ucal_getTimeZoneDisplayName(caldef, UCAL_DST, "en_US", NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); ucal_getTimeZoneDisplayName(caldef, UCAL_DST, "en_US", result, resultlength, &status); @@ -246,7 +246,7 @@ void TestGetSetDateAPI() UDate d1; int32_t hour; UDateFormat *datdef = 0; - UErrorCode status=ZERO_ERROR; + UErrorCode status=U_ZERO_ERROR; UDate d2= 837039928046.0; UChar temp[30]; @@ -405,7 +405,7 @@ void TestFieldGetSet() UChar *tzID = 0; UDateFormat *datdef = 0; UDate d1; - UErrorCode status=ZERO_ERROR; + UErrorCode status=U_ZERO_ERROR; log_verbose("\nFetching pointer to UCalendar using the ucal_open()\n"); tzID=(UChar*)malloc(sizeof(UChar) * 4); u_uastrcpy(tzID, "GMT"); @@ -457,14 +457,14 @@ void TestFieldGetSet() ucal_set(cal, UCAL_DAY_OF_WEEK_IN_MONTH, - 1); verify1("1997 last Tuesday in June = ", cal, datdef,1997, UCAL_JUNE, 24); /*give undesirable input */ - status = ZERO_ERROR; + status = U_ZERO_ERROR; ucal_clear(cal); ucal_set(cal, UCAL_YEAR, 1997); ucal_set(cal, UCAL_DAY_OF_WEEK, UCAL_TUESDAY); ucal_set(cal, UCAL_MONTH, UCAL_JUNE); ucal_set(cal, UCAL_DAY_OF_WEEK_IN_MONTH, 0); d1=ucal_getMillis(cal,&status); - if (status != ILLEGAL_ARGUMENT_ERROR){ + if (status != U_ILLEGAL_ARGUMENT_ERROR){ log_err("FAIL: No IllegalArgumentError for :"); log_err("1997 zero-th Tuesday in June \n"); } @@ -483,7 +483,7 @@ void TestFieldGetSet() ucal_set(cal, UCAL_MONTH, UCAL_JUNE); ucal_set(cal, UCAL_WEEK_OF_MONTH, 5); verify1("1997 Tuesday in week 5 of June = ", cal,datdef, 1997, UCAL_JULY, 1); - status = ZERO_ERROR; + status = U_ZERO_ERROR; ucal_clear(cal); ucal_set(cal, UCAL_YEAR, 1997); ucal_set(cal, UCAL_DAY_OF_WEEK, UCAL_TUESDAY); @@ -506,7 +506,7 @@ void TestFieldGetSet() verify1("1999 1st day of the year =", cal, datdef, 1999, UCAL_JANUARY, 1); ucal_set(cal, UCAL_MONTH, -3); d1=ucal_getMillis(cal,&status); - if (status != ILLEGAL_ARGUMENT_ERROR){ + if (status != U_ILLEGAL_ARGUMENT_ERROR){ log_err("FAIL: No IllegalArgumentError for :\"1999 -3th month \" "); } else @@ -551,7 +551,7 @@ void TestAddRollExtensive() UCalendarDateFields e; int32_t y,m,d,hr,min,sec,ms; int32_t maxlimit = 40; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; y = 1997; m = UCAL_FEBRUARY; d = 1; hr = 1; min = 1; sec = 0; ms = 0; log_verbose("Testing add and roll extensively\n"); @@ -593,12 +593,12 @@ void TestAddRollExtensive() ++m; checkDate(cal, y, m, d); ucal_add(cal, -1, 10, &status); - if(status==ILLEGAL_ARGUMENT_ERROR) + if(status==U_ILLEGAL_ARGUMENT_ERROR) log_verbose("Pass: Illegal argument error as expected\n"); else{ log_err("Fail: No, illegal argument error as expected. Got....: %s\n", myErrorName(status)); } - status=ZERO_ERROR; + status=U_ZERO_ERROR; /*confirm that applying roll to various fields works fine*/ @@ -627,13 +627,13 @@ void TestAddRollExtensive() d = 2; checkDate(cal, y, m, d); ucal_roll(cal, -1, 10, &status); - if(status==ILLEGAL_ARGUMENT_ERROR) + if(status==U_ILLEGAL_ARGUMENT_ERROR) log_verbose("Pass: illegal arguement error as expected\n"); else{ log_err("Fail: no illegal argument error got..: %s\n", myErrorName(status)); return; } - status=ZERO_ERROR; + status=U_ZERO_ERROR; ucal_setDateTime(cal, 1999, UCAL_FEBRUARY, 28, 10, 30, 45, &status); if(FAILURE(status)){ log_err("error is setting the datetime: %s\n", myErrorName(status)); @@ -645,7 +645,7 @@ void TestAddRollExtensive() ucal_close(cal); /*--------------- */ - status=ZERO_ERROR; + status=U_ZERO_ERROR; /* Testing add and roll extensively */ log_verbose("\nTesting the ucal_add() and ucal_roll() functions extensively\n"); y = 1997; m = UCAL_FEBRUARY; d = 1; hr = 1; min = 1; sec = 0; ms = 0; @@ -661,15 +661,15 @@ void TestAddRollExtensive() ucal_set(cal, UCAL_MINUTE, min); ucal_set(cal, UCAL_SECOND,sec); ucal_set(cal, UCAL_MILLISECOND, ms); - status=ZERO_ERROR; + status=U_ZERO_ERROR; log_verbose("\nTesting UCalendar add...\n"); for(e = UCAL_YEAR;e < UCAL_FIELD_COUNT; e=(UCalendarDateFields)((int32_t)e + 1)) { limit = maxlimit; - status = ZERO_ERROR; + status = U_ZERO_ERROR; for (i = 0; i < limit; i++) { ucal_add(cal, e, 1, &status); - if (FAILURE(status)) { limit = i; status = ZERO_ERROR; } + if (FAILURE(status)) { limit = i; status = U_ZERO_ERROR; } } for (i = 0; i < limit; i++) { ucal_add(cal, e, -1, &status); @@ -683,10 +683,10 @@ void TestAddRollExtensive() log_verbose("\nTesting calendar ucal_roll()...\n"); for(e = UCAL_YEAR;e < UCAL_FIELD_COUNT; e=(UCalendarDateFields)((int32_t)e + 1)) { int32_t limit = maxlimit; - status = ZERO_ERROR; + status = U_ZERO_ERROR; for (i = 0; i < limit; i++) { ucal_roll(cal, e, 1, &status); - if (FAILURE(status)) { limit = i; status = ZERO_ERROR; } + if (FAILURE(status)) { limit = i; status = U_ZERO_ERROR; } } for (i = 0; i < limit; i++) { ucal_roll(cal, e, -1, &status); @@ -709,7 +709,7 @@ void TestGetLimits() UCalendar *cal = 0; int32_t min, max, gr_min, le_max, ac_min, ac_max, val; UChar* tzID = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; tzID=(UChar*)malloc(sizeof(UChar) * 4); @@ -802,7 +802,7 @@ void TestDOWProgression() UDateFormat *datfor = 0; UDate date1; int32_t delta=24; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar* tzID = 0; tzID=(UChar*)malloc(sizeof(UChar) * 4); u_uastrcpy(tzID, "GMT"); @@ -877,7 +877,7 @@ void testZones(int32_t yr, int32_t mo, int32_t dt, int32_t hr, int32_t mn, int32 UDate date1; double temp; UDateFormat *datfor = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar* tzID = 0; tzID=(UChar*)malloc(sizeof(UChar) * 4); u_uastrcpy(tzID, "GMT"); @@ -953,7 +953,7 @@ void checkDateTime(UCalendar* c, int32_t ms, UCalendarDateFields field) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (ucal_get(c, UCAL_YEAR, &status) != y || ucal_get(c, UCAL_MONTH, &status) != m || ucal_get(c, UCAL_DATE, &status) != d || @@ -986,7 +986,7 @@ void checkDateTime(UCalendar* c, void checkDate(UCalendar* c, int32_t y, int32_t m, int32_t d) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (ucal_get(c,UCAL_YEAR, &status) != y || ucal_get(c, UCAL_MONTH, &status) != m || ucal_get(c, UCAL_DATE, &status) != d) { @@ -1014,7 +1014,7 @@ void checkDate(UCalendar* c, int32_t y, int32_t m, int32_t d) void verify1(const char* msg, UCalendar* c, UDateFormat* dat, int32_t year, int32_t month, int32_t day) { UDate d1; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (ucal_get(c, UCAL_YEAR, &status) == year && ucal_get(c, UCAL_MONTH, &status) == month && ucal_get(c, UCAL_DATE, &status) == day) { @@ -1050,7 +1050,7 @@ void verify2(const char* msg, UCalendar* c, UDateFormat* dat, int32_t year, int3 { UDate d1; char str[3]; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (ucal_get(c, UCAL_YEAR, &status) == year && ucal_get(c, UCAL_MONTH, &status) == month && ucal_get(c, UCAL_DATE, &status) == day && @@ -1091,5 +1091,3 @@ void verify2(const char* msg, UCalendar* c, UDateFormat* dat, int32_t year, int3 } /*--------------------------------------------- */ - - diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index 88b83c08840..60a7d37d5b8 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -41,11 +41,6 @@ int32_t strCaseIcmp(const char* a1,const char * a2); /*returns an action other than the one provided*/ UCNV_FromUCallBack otherUnicodeAction(UCNV_FromUCallBack MIA); UCNV_ToUCallBack otherCharAction(UCNV_ToUCallBack MIA); -/*Asciifies the ErrorCodes*/ -const char* errorString(UErrorCode err); -const char* myErrorName(UErrorCode err); - - void addTestConvert(TestNode** root) @@ -89,7 +84,7 @@ void TestConvert() int32_t k = 0; uint16_t codepage_index = 0; int32_t cp = 0; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; const char* available_conv; char ucs_file_name[UCS_FILE_NAME_SIZE]; UCNV_FromUCallBack MIA1; @@ -419,9 +414,9 @@ void TestConvert() displayname=(UChar*)malloc(1 * sizeof(UChar)); len=0; disnamelen = ucnv_getDisplayName(myConverter,locale,displayname, len, &err); - if(err==BUFFER_OVERFLOW_ERROR) + if(err==U_BUFFER_OVERFLOW_ERROR) { - err=ZERO_ERROR; + err=U_ZERO_ERROR; displayname=(UChar*)realloc(displayname, (disnamelen+1) * sizeof(UChar)); ucnv_getDisplayName(myConverter,locale,displayname,disnamelen+1, &err); if(FAILURE(err)) @@ -568,9 +563,9 @@ void TestConvert() &err); /*if there is an buffer overflow then trap the values and pass them and make the actual call*/ - if(err==BUFFER_OVERFLOW_ERROR) + if(err==U_BUFFER_OVERFLOW_ERROR) { - err=ZERO_ERROR; + err=U_ZERO_ERROR; uchar2=(UChar*)malloc((targetsize) * sizeof(UChar)); targetsize = ucnv_toUChars(myConverter, uchar2, @@ -691,6 +686,3 @@ UCNV_ToUCallBack otherCharAction(UCNV_ToUCallBack MIA) { return (MIA==(UCNV_ToUCallBack)MissingCharAction_STOP)?(UCNV_ToUCallBack)MissingCharAction_SUBSTITUTE:(UCNV_ToUCallBack)MissingCharAction_STOP; } - - - diff --git a/icu4c/source/test/cintltst/ccurrtst.c b/icu4c/source/test/cintltst/ccurrtst.c index 68222112dcd..9f80691a0ec 100644 --- a/icu4c/source/test/cintltst/ccurrtst.c +++ b/icu4c/source/test/cintltst/ccurrtst.c @@ -67,7 +67,7 @@ void currTest() int res; UCollator *c; uint8_t *sortKey1, *sortKey2; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UCollationResult compareResult, keyResult; UCollationResult expectedResult = UCOL_EQUAL; log_verbose("Testing currency of all locales\n"); @@ -103,7 +103,7 @@ void currTest() compareResult = ucol_strcoll(c, source, u_strlen(source), target, u_strlen(target)); - status = ZERO_ERROR; + status = U_ZERO_ERROR; sortklen=ucol_getSortKey(c, source, u_strlen(source), NULL, 0); sortKey1=(uint8_t*)malloc(sizeof(uint8_t) * (sortklen+1)); diff --git a/icu4c/source/test/cintltst/cdantst.c b/icu4c/source/test/cintltst/cdantst.c index 7a5e1d73210..9b30cfd4803 100644 --- a/icu4c/source/test/cintltst/cdantst.c +++ b/icu4c/source/test/cintltst/cdantst.c @@ -223,7 +223,7 @@ void TestTertiary( ) { int32_t i,j; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("da_DK", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -253,7 +253,7 @@ void TestPrimary() { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("da_DK", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cdattst.c b/icu4c/source/test/cintltst/cdattst.c index a617ca61cd4..3031bfad209 100644 --- a/icu4c/source/test/cintltst/cdattst.c +++ b/icu4c/source/test/cintltst/cdattst.c @@ -44,7 +44,7 @@ void TestDateFormat() { UDateFormat *def, *fr, *it, *de, *def1, *fr_pat; UDateFormat *copy; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar* result; const UCalendar *cal; const UNumberFormat *numformat1, *numformat2; @@ -119,9 +119,9 @@ void TestDateFormat() /*format using def */ resultlength=0; resultlengthneeded=udat_format(def, d, NULL, resultlength, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_format(def, d, result, resultlength, &pos, &status); @@ -176,7 +176,7 @@ free(result); /*Testing udat_openPattern() */ - status=ZERO_ERROR; + status=U_ZERO_ERROR; log_verbose("\nTesting the udat_openPattern with a specified pattern\n"); /*for french locale */ fr_pat=udat_openPattern(temp, u_strlen(temp), "fr_FR", &status); @@ -196,9 +196,9 @@ free(result); resultlength=0; resultlengthneeded=udat_toPattern(def1, FALSE, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded + 1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_toPattern(def1, FALSE, result, resultlength, &status); @@ -233,7 +233,7 @@ free(result); if(FAILURE(status)) { log_err("ERROR: udat_get2DigitYearStart failed %s\n", myErrorName(status) ); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; udat_set2DigitYearStart(def1 ,d1, &status); if(FAILURE(status)) { log_err("ERROR: udat_set2DigitYearStart failed %s\n", myErrorName(status) ); @@ -301,7 +301,7 @@ free(result); void TestSymbols() { UDateFormat *def, *fr; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *value, *result; int32_t resultlength; int32_t resultlengthout; @@ -343,9 +343,9 @@ void TestSymbols() u_uastrcpy(pattern, "jeudi"); resultlength=0; resultlengthout=udat_getSymbols(fr, UDAT_WEEKDAYS, 5 , NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthout+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(fr, UDAT_WEEKDAYS, 5, result, resultlength, &status); @@ -386,9 +386,9 @@ free(pattern); /*applying the pattern so that setSymbolss works */ resultlength=0; resultlengthout=udat_toPattern(fr, FALSE, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthout + 1; pattern=(UChar*)malloc(sizeof(UChar) * resultlength); udat_toPattern(fr, FALSE, pattern, resultlength, &status); @@ -402,9 +402,9 @@ free(pattern); udat_applyPattern(def, FALSE, pattern, u_strlen(pattern)); resultlength=0; resultlengthout=udat_toPattern(def, FALSE, NULL, resultlength,&status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthout + 1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_toPattern(fr, FALSE,result, resultlength, &status); @@ -424,8 +424,8 @@ free(pattern); /*testing set symbols */ resultlength=0; resultlengthout=udat_getSymbols(fr, UDAT_MONTHS, 11 , NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; resultlength=resultlengthout+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(fr, UDAT_MONTHS, 11, result, resultlength, &status); @@ -445,8 +445,8 @@ free(pattern); resultlength=0; resultlengthout=udat_getSymbols(def, UDAT_MONTHS, 11, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; resultlength=resultlengthout+1; value=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(def, UDAT_MONTHS, 11, value, resultlength, &status); @@ -495,7 +495,7 @@ free(pattern); void VerifygetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, int32_t index, const char* expected) { UChar *pattern; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *result; int32_t resultlength, resultlengthout; @@ -504,9 +504,9 @@ void VerifygetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, int32_t i u_uastrcpy(pattern, expected); resultlength=0; resultlengthout=udat_getSymbols(datfor, type, index , NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthout+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(datfor, type, index, result, resultlength, &status); @@ -532,7 +532,7 @@ void VerifysetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, int32_t i UChar *result; UChar *value; int32_t resultlength, resultlengthout; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; value=(UChar*)malloc(sizeof(UChar) * (strlen(expected) + 1)); u_uastrcpy(value, expected); @@ -545,8 +545,8 @@ void VerifysetSymbols(UDateFormat* datfor, UDateFormatSymbolType type, int32_t i resultlength=0; resultlengthout=udat_getSymbols(datfor, type, index, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; resultlength=resultlengthout+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(datfor, type, index, result, resultlength, &status); @@ -574,12 +574,12 @@ void VerifygetsetSymbols(UDateFormat* from, UDateFormat* to, UDateFormatSymbolTy UChar *result; UChar *value; int32_t resultlength, resultlengthout; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; resultlength=0; resultlengthout=udat_getSymbols(from, type, index , NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; resultlength=resultlengthout+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(from, type, index, result, resultlength, &status); @@ -599,8 +599,8 @@ void VerifygetsetSymbols(UDateFormat* from, UDateFormat* to, UDateFormatSymbolTy resultlength=0; resultlengthout=udat_getSymbols(to, type, index, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; resultlength=resultlengthout+1; value=(UChar*)malloc(sizeof(UChar) * resultlength); udat_getSymbols(to, type, index, value, resultlength, &status); @@ -629,13 +629,13 @@ UChar* myNumformat(const UNumberFormat* numfor, double d) UChar *result2; int32_t resultlength, resultlengthneeded; UFieldPosition pos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; resultlength=0; resultlengthneeded=unum_formatDouble(numfor, d, NULL, resultlength, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result2=(UChar*)malloc(sizeof(UChar) * resultlength); unum_formatDouble(numfor, d, result2, resultlength, &pos, &status); diff --git a/icu4c/source/test/cintltst/cdetst.c b/icu4c/source/test/cintltst/cdetst.c index b78ee5a4bf6..3a2e34a88f6 100644 --- a/icu4c/source/test/cintltst/cdetst.c +++ b/icu4c/source/test/cintltst/cdetst.c @@ -125,7 +125,7 @@ void TestTertiary( ) { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("de_DE", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -144,7 +144,7 @@ void TestPrimary() { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("de_DE", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cdtdptst.c b/icu4c/source/test/cintltst/cdtdptst.c index 48129ba49e0..ecaaa8b3977 100644 --- a/icu4c/source/test/cintltst/cdtdptst.c +++ b/icu4c/source/test/cintltst/cdtdptst.c @@ -48,7 +48,7 @@ void addDtFrDepTest(TestNode** root) void TestTwoDigitYearDSTParse() { UDateFormat *fullFmt, *fmt; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *pattern; UDate d; UChar *str; @@ -97,7 +97,7 @@ void TestPartialParse994() { int32_t pos; UDateFormat *f; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *s; UDate d, null; null=0; @@ -128,7 +128,7 @@ void tryPat994(UDateFormat* format, const char* pattern, const char* s, UDate ex UDate date; UDate null=0; int32_t pos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (strlen(s) + 1) ); u_uastrcpy(str, s); pat=(UChar*)malloc(sizeof(UChar) * (strlen(pattern) + 1) ); @@ -166,7 +166,7 @@ void TestRunTogetherPattern985() UChar *pattern, *now, *then; UDateFormat *format; UDate date1, date2; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; pattern=(UChar*)malloc(sizeof(UChar) * (strlen("yyyyMMddHHmmssSSS")+1) ); u_uastrcpy(pattern, "yyyyMMddHHmmssSSS"); format = udat_openPattern(pattern, u_strlen(pattern), NULL, &status); @@ -200,14 +200,14 @@ void TestCzechMonths459() UDateFormat *fmt; UCalendar *cal; UDate june, july, d; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; fmt = udat_open(UDAT_FULL, UDAT_FULL, "cs", NULL, 0, &status); if(FAILURE(status)){log_err("Error in constructing the date format\n"); } lneed=0; lneed=udat_toPattern(fmt, TRUE, NULL, lneed, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; pattern=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); udat_toPattern(fmt, TRUE, pattern, lneed+1, &status); } @@ -254,7 +254,7 @@ void TestQuotePattern161() UDate currentTime_1; UChar *pattern, *tzID, *exp; UChar *dateString; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; pattern=(UChar*)malloc(sizeof(UChar) * (strlen("MM/dd/yyyy 'at' hh:mm:ss a zzz")+1) ); u_uastrcpy(pattern, "MM/dd/yyyy 'at' hh:mm:ss a zzz"); @@ -277,4 +277,3 @@ void TestQuotePattern161() log_err("Error in formatting a pattern with single quotes\n"); } - diff --git a/icu4c/source/test/cintltst/cdtrgtst.c b/icu4c/source/test/cintltst/cdtrgtst.c index 2ca81f3201b..2513d21ef56 100644 --- a/icu4c/source/test/cintltst/cdtrgtst.c +++ b/icu4c/source/test/cintltst/cdtrgtst.c @@ -57,7 +57,7 @@ void Test4029195() UDate today, d1; UDateFormat *df; int32_t parsepos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; log_verbose("Testing date format and parse function in regression test\n"); today = ucal_getNow(); @@ -69,9 +69,9 @@ void Test4029195() } resultlength=0; resultlengthneeded=udat_toPattern(df, TRUE, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded + 1; pat=(UChar*)malloc(sizeof(UChar) * resultlength); udat_toPattern(df, TRUE, pat, resultlength, &status); @@ -126,7 +126,7 @@ void Test4056591() UChar pat[10]; UChar *tzID; UDate d[4]; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const char* strings[] = { "091225", "091224", @@ -192,7 +192,7 @@ void Test4059917() { UDateFormat* def; UChar *myDate; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *pattern; log_verbose("Testing apply pattern and to pattern regressively\n"); pattern=(UChar*)malloc(sizeof(UChar) * 11); @@ -226,16 +226,16 @@ void Test4059917() void aux917( UDateFormat *fmt, UChar* str) { int32_t resultlength, resultlengthneeded; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar* formatted; UChar *pat; UDate d1=1000000000.0; resultlength=0; resultlengthneeded=udat_toPattern(fmt, TRUE, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded + 1; pat=(UChar*)malloc(sizeof(UChar) * (resultlength)); udat_toPattern(fmt, TRUE, pat, resultlength, &status); @@ -245,7 +245,7 @@ void aux917( UDateFormat *fmt, UChar* str) } log_verbose("pattern: %s\n", austrdup(pat) ); - status = ZERO_ERROR; + status = U_ZERO_ERROR; formatted = myFormatit(fmt, d1); if( u_strcmp(formatted,str)!=0) { log_err("Fail: Want %s Got: %s\n", austrdup(str), austrdup(formatted) ); @@ -261,7 +261,7 @@ void Test4060212() int32_t pos; UCalendar *cal; UDateFormat *formatter, *fmt; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate myDate; UChar *myString; UChar dateString[20], pattern[20], tzID[3]; @@ -269,7 +269,7 @@ void Test4060212() u_uastrcpy(pattern, "yyyy-DDD.hh:mm:ss"); log_verbose( "dateString= %s Using yyyy-DDD.hh:mm:ss\n", austrdup(dateString) ); - status = ZERO_ERROR; + status = U_ZERO_ERROR; formatter = udat_openPattern(pattern, u_strlen(pattern), NULL, &status); pos=0; @@ -307,13 +307,13 @@ void Test4061287() bool_t ok; int32_t pos; UDateFormat *df; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate myDate; UChar pattern[21], dateString[11]; u_uastrcpy(dateString, "35/13/1971"); u_uastrcpy(pattern, "dd/mm/yyyy"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; log_verbose("Testing parsing by changing the attribute lenient\n"); df = udat_openPattern(pattern, u_strlen(pattern), NULL, &status); if(FAILURE(status)){ @@ -356,7 +356,7 @@ void Test4073003() UDate d,dd; UChar *datestr; UChar temp[15]; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDateFormat *fmt; UChar *result, *result2; const char* tests [] = { @@ -376,7 +376,7 @@ void Test4073003() udat_applyPattern(fmt, TRUE, temp, u_strlen(temp)); for(i= 0; i < 4; i+=2) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; datestr=(UChar*)malloc(sizeof(UChar) * (strlen(tests[i])+1)); u_uastrcpy(datestr, tests[i]); @@ -391,7 +391,7 @@ void Test4073003() u_uastrcpy(datestr, tests[i+1]); pos=0; - status=ZERO_ERROR; + status=U_ZERO_ERROR; dd = udat_parse(fmt, datestr, u_strlen(datestr), &pos, &status); if(FAILURE(status)){ log_err("ERROR : in test 4073003: %s\n", myErrorName(status)); @@ -419,13 +419,13 @@ void Test4162071() { int32_t pos; UDate x; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDateFormat *df; UChar datestr[30]; UChar format[50]; u_uastrcpy(datestr, "Thu, 30-Jul-1999 11:51:14 GMT"); u_uastrcpy(format, "EEE', 'dd-MMM-yyyy HH:mm:ss z"); /* RFC 822/1123 */ - status = ZERO_ERROR; + status = U_ZERO_ERROR; /* Can't hardcode the result to assume the default locale is "en_US". */ df = udat_openPattern(format, u_strlen(format), "en_US", &status); if(FAILURE(status)){ @@ -449,13 +449,13 @@ UChar* myFormatit(UDateFormat* datdef, UDate d1) UChar *result1; int32_t resultlength, resultlengthneeded; UFieldPosition pos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; resultlength=0; resultlengthneeded=udat_format(datdef, d1, NULL, resultlength, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result1=(UChar*)malloc(sizeof(UChar) * resultlength); udat_format(datdef, d1, result1, resultlength, &pos, &status); @@ -471,5 +471,4 @@ UChar* myFormatit(UDateFormat* datdef, UDate d1) } - /*eof*/ diff --git a/icu4c/source/test/cintltst/cestst.c b/icu4c/source/test/cintltst/cestst.c index 5e63271e5b9..d5a489d30dd 100644 --- a/icu4c/source/test/cintltst/cestst.c +++ b/icu4c/source/test/cintltst/cestst.c @@ -108,7 +108,7 @@ void TestTertiary( ) { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("es_ES", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -126,7 +126,7 @@ void TestPrimary() { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("es_ES", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cfintst.c b/icu4c/source/test/cintltst/cfintst.c index 469dc57cf4f..4fa652ac0d5 100644 --- a/icu4c/source/test/cintltst/cfintst.c +++ b/icu4c/source/test/cintltst/cfintst.c @@ -99,7 +99,7 @@ void TestTertiary( ) { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("fi_FI", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -117,7 +117,7 @@ void TestPrimary() { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("fi_FI", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cformtst.c b/icu4c/source/test/cintltst/cformtst.c index cabd0abb412..8ceacd78756 100644 --- a/icu4c/source/test/cintltst/cformtst.c +++ b/icu4c/source/test/cintltst/cformtst.c @@ -83,14 +83,14 @@ UChar* myDateFormat(UDateFormat* dat, UDate d1) UChar *result1; int32_t resultlength, resultlengthneeded; UFieldPosition pos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; resultlength=0; resultlengthneeded=udat_format(dat, d1, NULL, resultlength, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result1=(UChar*)malloc(sizeof(UChar) * resultlength); udat_format(dat, d1, result1, resultlength, &pos, &status); @@ -103,4 +103,3 @@ UChar* myDateFormat(UDateFormat* dat, UDate d1) return result1; } - diff --git a/icu4c/source/test/cintltst/cfrtst.c b/icu4c/source/test/cintltst/cfrtst.c index 24d7e6e0e6f..b318dddc3d6 100644 --- a/icu4c/source/test/cintltst/cfrtst.c +++ b/icu4c/source/test/cintltst/cfrtst.c @@ -169,7 +169,7 @@ void TestTertiary( ) { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("fr_FR", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -187,7 +187,7 @@ void TestSecondary() { int32_t i,j, testAcuteSize; UCollationResult expected; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("fr_FR", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -211,7 +211,7 @@ ucol_close(myCollation); void TestExtra() { int32_t i, j; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("fr_FR", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cg7coll.c b/icu4c/source/test/cintltst/cg7coll.c index 098b65fc6a5..f8ce44c4f02 100644 --- a/icu4c/source/test/cintltst/cg7coll.c +++ b/icu4c/source/test/cintltst/cg7coll.c @@ -190,13 +190,13 @@ void doTest(UCollator *myCollation, const UChar source[], const UChar target[], void TestG7Locales() { UCollator *myCollation, *tblColl1; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const UChar *defRules; int32_t i, rlen, j, n; log_verbose("Testing ucol_openRules for all the locales\n"); for (i = 0; i < 8; i++) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; myCollation = ucol_open(locales[i], &status); if (FAILURE(status)) { @@ -205,7 +205,7 @@ void TestG7Locales() } defRules = ucol_getRules(myCollation, &rlen); - status = ZERO_ERROR; + status = U_ZERO_ERROR; tblColl1 = ucol_openRules(defRules, rlen, UCOL_NO_NORMALIZATION, UCOL_DEFAULT_STRENGTH, &status); if (FAILURE(status)) @@ -241,9 +241,9 @@ void TestDemo1() UChar *newRules, *temp; int32_t len, rlen, j, n; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; log_verbose("Demo Test 1 : Create a new table collation with rules \" & Z < p, P \" \n"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; col = ucol_open(NULL, &status); if(FAILURE(status)){ log_err("Error in creation of Collator in Demo1 :%s\n", myErrorName(status)); @@ -284,13 +284,13 @@ void TestDemo1() void TestDemo2() { UCollator *col, *myCollation; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const UChar *baseRules; UChar *newRules, *temp; int32_t len, rlen, j, n; log_verbose("Demo Test 2 : Create a new table collation with rules \"& C < ch , cH, Ch, CH\""); - status = ZERO_ERROR; + status = U_ZERO_ERROR; col = ucol_open(NULL, &status); if(FAILURE(status)){ log_err("Error in creation of Collator in Demo1 : %s\n", myErrorName(status)); @@ -329,13 +329,13 @@ void TestDemo2() void TestDemo3() { UCollator *col, *myCollation; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const UChar *baseRules; UChar *newRules, *temp; int32_t rlen, j, n, len; log_verbose("Demo Test 3 : Create a new table collation with rules \"& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'\" \n"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; col = ucol_open(NULL, &status); if(FAILURE(status)){ log_err("Error in creation of Collator in Demo3 : %s\n", myErrorName(status)); @@ -376,13 +376,13 @@ void TestDemo3() void TestDemo4() { UCollator *col, *myCollation; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const UChar *baseRules; UChar *newRules, *temp; int32_t rlen, j, n, len; log_verbose("Demo Test 4 : Create a new table collation with rules \" & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' \"\n"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; col = ucol_open(NULL, &status); if(FAILURE(status)){ log_err("Error in creation of Collator in Demo1 : %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cintltst.c b/icu4c/source/test/cintltst/cintltst.c index f475c28f42e..e5ff4b89dab 100644 --- a/icu4c/source/test/cintltst/cintltst.c +++ b/icu4c/source/test/cintltst/cintltst.c @@ -128,30 +128,3 @@ char *austrdup(const UChar* unichars) return newString; } - - -const char* myErrorName(UErrorCode status) -{ - switch (status) - { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case PARSE_ERROR: return "PARSE_ERROR"; - case INVALID_CHAR_FOUND: return "INVALID_CHAR_FOUND"; - case TRUNCATED_CHAR_FOUND: return "TRUNCATED_CHAR_FOUND"; - case ILLEGAL_CHAR_FOUND: return "ILLEGAL_CHAR_FOUND"; - case INVALID_TABLE_FORMAT: return "INVALID_TABLE_FORMAT"; - case INVALID_TABLE_FILE: return "INVALID_TABLE_FILE"; - case BUFFER_OVERFLOW_ERROR: return "BUFFER_OVERFLOW_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS ErrorCode]"; - } -} - diff --git a/icu4c/source/test/cintltst/cintltst.h b/icu4c/source/test/cintltst/cintltst.h index 54d5a29dc2b..667a2d555dc 100644 --- a/icu4c/source/test/cintltst/cintltst.h +++ b/icu4c/source/test/cintltst/cintltst.h @@ -66,7 +66,7 @@ C_FUNC char *austrdup(const UChar* unichars); * converts the errorcode to an error descriptive string(const char*) * @param status the error code */ -C_FUNC const char* myErrorName(UErrorCode status); +#define myErrorName(errorCode) errorName(errorCode) #endif diff --git a/icu4c/source/test/cintltst/citertst.c b/icu4c/source/test/cintltst/citertst.c index 82cb18c8937..f06d46417e3 100644 --- a/icu4c/source/test/cintltst/citertst.c +++ b/icu4c/source/test/cintltst/citertst.c @@ -33,7 +33,7 @@ #define ARRAY_LENGTH(array) (sizeof array / sizeof array[0]) -static UErrorCode status = ZERO_ERROR; +static UErrorCode status = U_ZERO_ERROR; UCollator *en_us; @@ -60,7 +60,7 @@ void TestPrevious() UChar *source; UCollator *c1, *c2, *c3; UCollationElements *iter; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; test1=(UChar*)malloc(sizeof(UChar) * 50); test2=(UChar*)malloc(sizeof(UChar) * 50); u_uastrcpy(test1, "What subset of all possible test cases?"); @@ -151,7 +151,7 @@ void TestPrevious() */ void TestOffset() { - UErrorCode status= ZERO_ERROR; + UErrorCode status= U_ZERO_ERROR; UCollationElements *iter, *pristine; int32_t offset; int32_t *orders; @@ -187,7 +187,7 @@ void TestOffset() myErrorName(status)); return; } - status = ZERO_ERROR; + status = U_ZERO_ERROR; ucol_setOffset(iter, 0, &status); if (FAILURE(status)) @@ -213,7 +213,7 @@ void TestOffset() void TestSetText() { int32_t c,i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UCollationElements *iter1, *iter2; test1=(UChar*)malloc(sizeof(UChar) * 50); test2=(UChar*)malloc(sizeof(UChar) * 50); @@ -275,7 +275,7 @@ void backAndForth(UCollationElements *iter) { /* Run through the iterator forwards and stick it into an array */ int32_t index, o; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t orderLength = 0; int32_t *orders; orders= getOrders(iter, &orderLength); @@ -329,7 +329,7 @@ int32_t* getOrders(UCollationElements *iter, int32_t *orderLength) int32_t size = 0; int32_t *temp; int32_t *orders =(int32_t*)malloc(sizeof(int32_t) * maxSize); - status= ZERO_ERROR; + status= U_ZERO_ERROR; @@ -372,7 +372,7 @@ void assertEqual(UCollationElements *i1, UCollationElements *i2) { int32_t c1, c2; int32_t count = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; do { diff --git a/icu4c/source/test/cintltst/cjaptst.c b/icu4c/source/test/cintltst/cjaptst.c index b79df12580c..2105aa568a6 100644 --- a/icu4c/source/test/cintltst/cjaptst.c +++ b/icu4c/source/test/cintltst/cjaptst.c @@ -111,7 +111,7 @@ void TestTertiary( ) { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("ja_JP", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index 48a0a57e3d9..585df4167c5 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -84,7 +84,7 @@ void addLocaleTest(TestNode** root) void TestBasicGetters() { int32_t i; int32_t cap; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; char *testLocale = 0; char *temp = 0, *name = 0; log_verbose("Testing Basic Getters\n"); @@ -94,8 +94,8 @@ void TestBasicGetters() { log_verbose("Testing %s .....\n", testLocale); cap=uloc_getLanguage(testLocale, NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; temp=(char*)malloc(sizeof(char) * (cap+1)); uloc_getLanguage(testLocale, temp, cap, &status); } @@ -109,8 +109,8 @@ void TestBasicGetters() { cap=uloc_getCountry(testLocale, temp, cap, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; temp=(char*)realloc(temp, sizeof(char) * (cap+1)); uloc_getCountry(testLocale, temp, cap, &status); } @@ -123,8 +123,8 @@ void TestBasicGetters() { } cap=uloc_getVariant(testLocale, temp, cap, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; temp=(char*)realloc(temp, sizeof(char) * (cap+1)); uloc_getVariant(testLocale, temp, cap, &status); } @@ -139,8 +139,8 @@ void TestBasicGetters() { cap=uloc_getName(testLocale, NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; name=(char*)malloc(sizeof(char) * (cap+1)); uloc_getName(testLocale, name, cap, &status); } @@ -209,7 +209,7 @@ void TestDisplayNames() const char *saveDefault; char *defaultLocale; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; saveDefault = uloc_getDefault(); @@ -304,7 +304,7 @@ void TestDataDirectory() char oldDirectory[80]; const char *temp,*testValue1,*testValue2,*testValue3; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; const char path[40] ="d:\\icu\\source\\test\\intltest\\" ; /*give the required path */ @@ -351,7 +351,7 @@ void doTestDisplayNames(const char* inLocale, int32_t compareIndex, int32_t defaultIsFrench) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t i; int32_t maxresultsize; @@ -400,9 +400,9 @@ void doTestDisplayNames(const char* inLocale, if (strcmp(inLocale, defaultDefaultLocale)==0) { maxresultsize=0; maxresultsize=uloc_getDisplayLanguage(testLocale, NULL, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testLang=(UChar*)malloc(sizeof(UChar) * (maxresultsize + 1)); uloc_getDisplayLanguage(testLocale, NULL, testLang, maxresultsize, &status); @@ -414,9 +414,9 @@ void doTestDisplayNames(const char* inLocale, } maxresultsize=0; maxresultsize=uloc_getDisplayCountry(testLocale, NULL, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testCtry=(UChar*)malloc(sizeof(UChar) * (maxresultsize + 1)); uloc_getDisplayCountry(testLocale, NULL, testCtry, maxresultsize, &status); } @@ -427,9 +427,9 @@ void doTestDisplayNames(const char* inLocale, maxresultsize=0; maxresultsize=uloc_getDisplayVariant(testLocale, NULL, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testVar=(UChar*)malloc(sizeof(UChar) * (maxresultsize+1)); uloc_getDisplayVariant(testLocale, NULL, testVar, maxresultsize, &status); } @@ -439,9 +439,9 @@ void doTestDisplayNames(const char* inLocale, } maxresultsize=0; maxresultsize=uloc_getDisplayName(testLocale, NULL, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testName=(UChar*)malloc(sizeof(UChar) * (maxresultsize+1)); uloc_getDisplayName(testLocale, NULL, testName, maxresultsize, &status); } @@ -454,9 +454,9 @@ void doTestDisplayNames(const char* inLocale, else { maxresultsize=0; maxresultsize=uloc_getDisplayLanguage(testLocale, inLocale, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testLang=(UChar*)malloc(sizeof(UChar) * (maxresultsize+1)); uloc_getDisplayLanguage(testLocale, inLocale, testLang, maxresultsize, &status); } @@ -466,9 +466,9 @@ void doTestDisplayNames(const char* inLocale, maxresultsize=0; maxresultsize=uloc_getDisplayCountry(testLocale, inLocale, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testCtry=(UChar*)malloc(sizeof(UChar) * (maxresultsize+1)); uloc_getDisplayCountry(testLocale, inLocale, testCtry, maxresultsize, &status); } @@ -478,9 +478,9 @@ void doTestDisplayNames(const char* inLocale, maxresultsize=0; maxresultsize=uloc_getDisplayVariant(testLocale, inLocale, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testVar=(UChar*)malloc(sizeof(UChar) * (maxresultsize+1)); uloc_getDisplayVariant(testLocale, inLocale, testVar, maxresultsize, &status); } @@ -490,9 +490,9 @@ void doTestDisplayNames(const char* inLocale, maxresultsize=0; maxresultsize=uloc_getDisplayName(testLocale, inLocale, NULL, maxresultsize, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; testName=(UChar*)malloc(sizeof(UChar) * (maxresultsize+1)); uloc_getDisplayName(testLocale, inLocale, testName, maxresultsize, &status); } diff --git a/icu4c/source/test/cintltst/cmsgtst.c b/icu4c/source/test/cintltst/cmsgtst.c index 6e04e9de4d9..9fa2d82203e 100644 --- a/icu4c/source/test/cintltst/cmsgtst.c +++ b/icu4c/source/test/cintltst/cmsgtst.c @@ -77,7 +77,7 @@ void MessageFormatTest( void ) UChar *str; UChar* result; int32_t resultLengthOut,resultlength,i, patternlength; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate d1=1000000000.0; str=(UChar*)malloc(sizeof(UChar) * 7); u_uastrcpy(str, "MyDisk"); @@ -86,13 +86,13 @@ void MessageFormatTest( void ) log_verbose("Testing u_formatMessage90\n"); InitStrings(); for (i = 0; i < cnt_testCases; i++) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; patternlength=u_strlen(testCasePatterns[i]); resultLengthOut=u_formatMessage( "en_US",testCasePatterns[i], patternlength, result, resultlength, &status, 1, 3456.00, d1); - if(status== BUFFER_OVERFLOW_ERROR) + if(status== U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)realloc(result,sizeof(UChar) * resultlength); u_formatMessage( "en_US",testCasePatterns[i], patternlength, result, resultlength, @@ -122,7 +122,7 @@ void TestSampleMessageFormat() UChar pattern[100], expected[100]; int32_t resultLengthOut, resultlength; UDate d = 837039928046.0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * 15); u_uastrcpy(str, "abc"); @@ -132,9 +132,9 @@ void TestSampleMessageFormat() log_verbose("\nTesting a sample for Message format test#1\n"); resultlength=1; resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, str, d); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)realloc(result, sizeof(UChar) * resultlength); u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, str, d); @@ -163,9 +163,9 @@ void TestSampleMessageFormat() &status, str, 235); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)realloc(result, sizeof(UChar) * (resultlength+1)); u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, str, 23); @@ -188,9 +188,9 @@ void TestSampleMessageFormat() u_uastrcpy(str, "deposit"); resultlength=0; resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, str, 500.00); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, str, 500.00); @@ -221,7 +221,7 @@ void TestSampleFormatAndParse() UCalendar *cal; UDate d1,d; UDateFormat *def1; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; double value; UChar ret[30]; log_verbose("Testing format and parse\n"); @@ -246,9 +246,9 @@ void TestSampleFormatAndParse() resultlength=1; result=(UChar*)malloc(sizeof(UChar) * resultlength); resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, d1, str, 7); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)realloc(result, sizeof(UChar) * resultlength); u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, d1, str, 7); @@ -298,7 +298,7 @@ void TestSampleFormatAndParse() void TestMsgFormatChoice() { UChar* str; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *result; UChar pattern[100]; UChar expected[100]; @@ -312,9 +312,9 @@ void TestMsgFormatChoice() u_uastrcpy(expected, "The disk MyDisk contains 100 files"); resultlength=0; resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, 100., str); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, 100., str); @@ -334,9 +334,9 @@ void TestMsgFormatChoice() u_uastrcpy(expected, "The disk MyDisk contains no files"); resultlength=0; resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, 0., str); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, 0., str); @@ -356,9 +356,9 @@ void TestMsgFormatChoice() u_uastrcpy(expected, "The disk MyDisk contains one file"); resultlength=0; resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, 1., str); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultLengthOut+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, 1., str); @@ -382,7 +382,7 @@ void TestParseMessage() { UChar pattern[100]; UChar source[100]; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; double value; UChar str[10]; UChar res[10]; @@ -432,4 +432,3 @@ void addMsgForTest(TestNode** root) addTest(root, &TestParseMessage, "tsformat/cmsgtst/TestParseMessage"); } - diff --git a/icu4c/source/test/cintltst/cnmdptst.c b/icu4c/source/test/cintltst/cnmdptst.c index 893e065086e..40cebbba57d 100644 --- a/icu4c/source/test/cintltst/cnmdptst.c +++ b/icu4c/source/test/cintltst/cnmdptst.c @@ -53,7 +53,7 @@ void TestPatterns() UChar unum[5]; UChar *unewp; UChar *str; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const char* pat[] = { "#.#", "#.", ".#", "#" }; const char* newpat[] = { "#0.#", "#0.", "#.0", "#" }; const char* num[] = { "0", "0.", ".0", "0" }; @@ -62,7 +62,7 @@ void TestPatterns() pat_length = sizeof(pat) / sizeof(pat[0]); for (i=0; i < pat_length; ++i) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; u_uastrcpy(upat, pat[i]); fmt= unum_openPattern(upat, u_strlen(upat), "en_US", &status); if (FAILURE(status)) { @@ -71,8 +71,8 @@ void TestPatterns() } lneed=0; lneed=unum_toPattern(fmt, FALSE, NULL, lneed, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status= ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status= U_ZERO_ERROR; unewp=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_toPattern(fmt, FALSE, unewp, lneed+1, &status); } @@ -85,8 +85,8 @@ void TestPatterns() lneed=0; lneed=unum_format(fmt, 0, NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_format(fmt, 0, str, lneed+1, &pos, &status); } @@ -111,7 +111,7 @@ void TestQuotes() UChar res[15]; UChar *str; UNumberFormat *fmt; - status=ZERO_ERROR; + status=U_ZERO_ERROR; log_verbose("\nTestting the handling of quotes in number format\n"); u_uastrcpy(pat, "a'fo''o'b#"); fmt =unum_openPattern(pat, u_strlen(pat), "en_US", &status); @@ -120,8 +120,8 @@ void TestQuotes() } lneed=0; lneed=unum_format(fmt, 123, NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_format(fmt, 123, str, lneed+1, &pos, &status); } @@ -148,8 +148,8 @@ void TestQuotes() } lneed=0; lneed=unum_format(fmt, 123, NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_format(fmt, 123, str, lneed+1, &pos, &status); } @@ -180,7 +180,7 @@ void TestExponential() UChar *str; UChar uvalfor[20], ulvalfor[20]; double a; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; double val[] = { 0.01234, 123456789, 1.23e300, -3.141592653e-271 }; char* pat[] = { "0.####E0", "00.000E00", "##0.######E000", "0.###E0;[0.###E0]" }; int32_t lval[] = { 0, -1, 1, 123456789 }; @@ -237,8 +237,8 @@ void TestExponential() /*format*/ lneed=0; lneed=unum_formatDouble(fmt, val[v], NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_formatDouble(fmt, val[v], str, lneed+1, &pos, &status); } @@ -269,8 +269,8 @@ void TestExponential() /*format*/ lneed=0; lneed=unum_formatDouble(fmt, lval[v], NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_formatDouble(fmt, lval[v], str, lneed+1, &pos, &status); } @@ -315,7 +315,7 @@ void TestCurrencySign() UChar *pat; UChar *res; UFieldPosition pos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; pattern=(UChar*)malloc(sizeof(UChar) * (strlen("\xA4#,##0.00;-\xA4#,##0.00") + 1) ); u_uastrcpy(pattern, "\xA4#,##0.00;-\xA4#,##0.00"); fmt = unum_openPattern(pattern, u_strlen(pattern), "en_US", &status); @@ -324,8 +324,8 @@ void TestCurrencySign() } lneed=0; lneed=unum_formatDouble(fmt, 1234.56, NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_formatDouble(fmt, 1234.56, str, lneed+1, &pos, &status); } @@ -334,8 +334,8 @@ void TestCurrencySign() } lneed=0; lneed=unum_toPattern(fmt, FALSE, NULL, lneed, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; pat=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_formatDouble(fmt, FALSE, pat, lneed+1, &pos, &status); } @@ -351,8 +351,8 @@ void TestCurrencySign() lneed=0; lneed=unum_formatDouble(fmt, -1234.56, NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_formatDouble(fmt, -1234.56, str, lneed+1, &pos, &status); } @@ -377,7 +377,7 @@ void TestCurrency() UChar *str, *res; int32_t lneed, i; UFieldPosition pos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const char* locale[]={"fr_CA", "de_DE", "fr_FR"}; const char* result[]={"1,50 $", "1,50 DM", "1,50 F"}; log_verbose("\nTesting the number format with different currency patterns\n"); @@ -389,8 +389,8 @@ void TestCurrency() } lneed=0; lneed= unum_formatDouble(currencyFmt, 1.50, NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; str=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_formatDouble(currencyFmt, 1.50, str, lneed+1, &pos, &status); } @@ -410,7 +410,7 @@ void TestCurrency() void TestRounding487() { UNumberFormat *nnf; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; nnf = unum_open(UNUM_DEFAULT, NULL, &status); if(FAILURE(status)){ log_err("FAIL: failure in the construction of number format: %s\n", myErrorName(status)); @@ -434,12 +434,12 @@ void roundingTest(UNumberFormat* nf, double x, int32_t maxFractionDigits, const UFieldPosition pos; UErrorCode status; int32_t lneed; - status=ZERO_ERROR; + status=U_ZERO_ERROR; unum_setAttribute(nf, UNUM_MAX_FRACTION_DIGITS, maxFractionDigits); lneed=0; lneed=unum_formatDouble(nf, x, NULL, lneed, &pos, &status); - if(status==BUFFER_OVERFLOW_ERROR){ - status=ZERO_ERROR; + if(status==U_BUFFER_OVERFLOW_ERROR){ + status=U_ZERO_ERROR; out=(UChar*)malloc(sizeof(UChar) * (lneed+1) ); unum_formatDouble(nf, x, out, lneed+1, &pos, &status); } diff --git a/icu4c/source/test/cintltst/cnormtst.c b/icu4c/source/test/cintltst/cnormtst.c index ae2e9eb7c1d..676b327c205 100644 --- a/icu4c/source/test/cintltst/cnormtst.c +++ b/icu4c/source/test/cintltst/cnormtst.c @@ -102,10 +102,10 @@ void addNormTest(TestNode** root) void TestDecomp() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t x, neededLen, resLen; UChar *source, *result; - status = ZERO_ERROR; + status = U_ZERO_ERROR; myCollation = ucol_open("en_US", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -116,9 +116,9 @@ void TestDecomp() { source=CharsToUChars(canonTests[x][0]); neededLen= u_normalize(source, u_strlen(source), UCOL_DECOMP_CAN, UCOL_IGNORE_HANGUL, NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resLen=neededLen+1; result=(UChar*)malloc(sizeof(UChar*) * resLen); u_normalize(source, u_strlen(source), UCOL_DECOMP_CAN, UCOL_IGNORE_HANGUL, result, resLen, &status); @@ -133,10 +133,10 @@ void TestDecomp() } void TestCompatDecomp() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t x, neededLen, resLen; UChar *source, *result; - status = ZERO_ERROR; + status = U_ZERO_ERROR; myCollation = ucol_open("en_US", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -147,9 +147,9 @@ void TestCompatDecomp() { source=CharsToUChars(compatTests[x][0]); neededLen= u_normalize(source, u_strlen(source), UCOL_DECOMP_COMPAT, UCOL_IGNORE_HANGUL, NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resLen=neededLen+1; result=(UChar*)malloc(sizeof(UChar*) * resLen); u_normalize(source, u_strlen(source), UCOL_DECOMP_COMPAT,UCOL_IGNORE_HANGUL, result, resLen, &status); @@ -164,10 +164,10 @@ void TestCompatDecomp() } void TestCanonDecompCompose() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t x, neededLen, resLen; UChar *source, *result; - status = ZERO_ERROR; + status = U_ZERO_ERROR; myCollation = ucol_open("en_US", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -178,9 +178,9 @@ void TestCanonDecompCompose() { source=CharsToUChars(canonTests[x][0]); neededLen= u_normalize(source, u_strlen(source), UCOL_DECOMP_CAN_COMP_COMPAT, UCOL_IGNORE_HANGUL, NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resLen=neededLen+1; result=(UChar*)malloc(sizeof(UChar*) * resLen); u_normalize(source, u_strlen(source), UCOL_DECOMP_CAN_COMP_COMPAT, UCOL_IGNORE_HANGUL, result, resLen, &status); @@ -195,10 +195,10 @@ void TestCanonDecompCompose() } void TestCompatDecompCompose() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t x, neededLen, resLen; UChar *source, *result; - status = ZERO_ERROR; + status = U_ZERO_ERROR; myCollation = ucol_open("en_US", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -209,9 +209,9 @@ void TestCompatDecompCompose() { source=CharsToUChars(compatTests[x][0]); neededLen= u_normalize(source, u_strlen(source), UCOL_DECOMP_COMPAT_COMP_CAN, UCOL_IGNORE_HANGUL, NULL, 0, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resLen=neededLen+1; result=(UChar*)malloc(sizeof(UChar*) * resLen); u_normalize(source, u_strlen(source), UCOL_DECOMP_COMPAT_COMP_CAN, UCOL_IGNORE_HANGUL, result, resLen, &status); @@ -234,4 +234,3 @@ void assertEqual(const UChar* result, const UChar* expected, int32_t index) austrdup(result) ); } } - diff --git a/icu4c/source/test/cintltst/cnumtst.c b/icu4c/source/test/cintltst/cnumtst.c index 663474b6f2c..d8d25a623cd 100644 --- a/icu4c/source/test/cintltst/cnumtst.c +++ b/icu4c/source/test/cintltst/cnumtst.c @@ -61,12 +61,12 @@ void TestNumberFormat() UNumberFormatAttribute attr; UNumberFormatSymbols symbols1, symbols2; int32_t newvalue; - UErrorCode status=ZERO_ERROR; + UErrorCode status=U_ZERO_ERROR; UNumberFormatStyle style= UNUM_DEFAULT; UNumberFormat *pattern; UNumberFormat *def, *fr, *cur_def, *cur_fr, *per_def, *per_fr, *spellout_def, *cur_frpattern; /* Testing unum_open() with various Numberformat styles and locales*/ - status = ZERO_ERROR; + status = U_ZERO_ERROR; log_verbose("Testing unum_open() with default style and locale\n"); def=unum_open(style, NULL, &status); if(FAILURE(status)) @@ -132,9 +132,9 @@ void TestNumberFormat() log_verbose("\nTesting unum_format() \n"); resultlength=0; resultlengthneeded=unum_format(cur_def, l, NULL, resultlength, &pos1, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); unum_format(cur_def, l, result, resultlength, &pos1, &status); @@ -156,9 +156,9 @@ free(result); u_uastrcpy(temp1, "($10,456.37)"); resultlength=0; resultlengthneeded=unum_formatDouble(cur_def, d, NULL, resultlength, &pos2, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); unum_formatDouble(cur_def, d, result, resultlength, &pos2, &status); @@ -193,9 +193,9 @@ free(result); resultlength=0; parsepos=0; resultlengthneeded=unum_format(per_fr, l, NULL, resultlength, &pos1, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); unum_format(per_fr, l, result, resultlength, &pos1, &status); @@ -234,9 +234,9 @@ free(result); log_verbose("\nTesting unum_toPattern()\n"); resultlength=0; resultlengthneeded=unum_toPattern(pattern, FALSE, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); unum_toPattern(pattern, FALSE, result, resultlength, &status); @@ -260,9 +260,9 @@ free(temp1); /*when we try to change the symbols of french to default we need to apply the pattern as well to fetch correct results */ resultlength=0; resultlengthneeded=unum_toPattern(cur_def, FALSE, NULL, resultlength, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); unum_toPattern(cur_def, FALSE, result, resultlength, &status); @@ -286,9 +286,9 @@ free(result); /*format to check the result */ resultlength=0; resultlengthneeded=unum_format(cur_def, l, NULL, resultlength, &pos1, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; result=(UChar*)malloc(sizeof(UChar) * resultlength); unum_format(cur_def, l, result, resultlength, &pos1, &status); @@ -330,9 +330,9 @@ free(result); resultlength=0; resultlengthneeded=unum_format(cur_frpattern, l, NULL, resultlength, &pos1, &status); - if(status==BUFFER_OVERFLOW_ERROR) + if(status==U_BUFFER_OVERFLOW_ERROR) { - status=ZERO_ERROR; + status=U_ZERO_ERROR; resultlength=resultlengthneeded+1; temp1=(UChar*)malloc(sizeof(UChar) * resultlength); unum_format(cur_frpattern, l, temp1, resultlength, &pos1, &status); @@ -471,4 +471,3 @@ free(temp1); unum_close(cur_frpattern); } - diff --git a/icu4c/source/test/cintltst/cregrtst.c b/icu4c/source/test/cintltst/cregrtst.c index f6f059476d1..924415aa03a 100644 --- a/icu4c/source/test/cintltst/cregrtst.c +++ b/icu4c/source/test/cintltst/cregrtst.c @@ -671,7 +671,7 @@ UChar* createTestData(Vector *select, int32_t e) void TestForwardSentenceSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestSentenceData(); e = ubrk_open(UBRK_SENTENCE, "en_US", testSentenceText, u_strlen(testSentenceText), &status); @@ -688,7 +688,7 @@ void TestForwardSentenceSelection() void TestFirstSentenceSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestSentenceData(); e = ubrk_open(UBRK_SENTENCE, "en_US", testSentenceText, u_strlen(testSentenceText), &status); @@ -704,7 +704,7 @@ void TestFirstSentenceSelection() void TestLastSentenceSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestSentenceData(); e = ubrk_open(UBRK_SENTENCE, "en_US", testSentenceText, u_strlen(testSentenceText), &status); @@ -720,7 +720,7 @@ void TestLastSentenceSelection() void TestBackwardSentenceSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestSentenceData(); e = ubrk_open(UBRK_SENTENCE, "en_US", testSentenceText, u_strlen(testSentenceText), &status); @@ -736,7 +736,7 @@ void TestBackwardSentenceSelection() void TestForwardSentenceIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestSentenceData(); e = ubrk_open(UBRK_SENTENCE, "en_US", testSentenceText, u_strlen(testSentenceText), &status); @@ -752,7 +752,7 @@ void TestForwardSentenceIndexSelection() void TestBackwardSentenceIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestSentenceData(); e = ubrk_open(UBRK_SENTENCE, "en_US", testSentenceText, u_strlen(testSentenceText), &status); @@ -788,7 +788,7 @@ FreeTextBoundary(); void TestForwardWordSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestWordData(); e = ubrk_open(UBRK_WORD, "en_US", testWordText, u_strlen(testWordText), &status); @@ -805,7 +805,7 @@ void TestForwardWordSelection() void TestFirstWordSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestWordData(); e = ubrk_open(UBRK_WORD, "en_US", testWordText, u_strlen(testWordText), &status); @@ -821,7 +821,7 @@ void TestFirstWordSelection() void TestLastWordSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestWordData(); e = ubrk_open(UBRK_WORD, "en_US", testWordText, u_strlen(testWordText), &status); @@ -837,7 +837,7 @@ void TestLastWordSelection() void TestBackwardWordSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestWordData(); e = ubrk_open(UBRK_WORD, "en_US", testWordText, u_strlen(testWordText), &status); @@ -853,7 +853,7 @@ void TestBackwardWordSelection() void TestForwardWordIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestWordData(); e = ubrk_open(UBRK_WORD, "en_US", testWordText, u_strlen(testWordText), &status); @@ -869,7 +869,7 @@ void TestForwardWordIndexSelection() void TestBackwardWordIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestWordData(); e = ubrk_open(UBRK_WORD, "en_US", testWordText, u_strlen(testWordText), &status); @@ -907,7 +907,7 @@ FreeTextBoundary(); void TestForwardLineSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestLineData(); e = ubrk_open(UBRK_LINE, "en_US", testLineText, u_strlen(testLineText), &status); @@ -922,7 +922,7 @@ void TestForwardLineSelection() void TestFirstLineSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestLineData(); e = ubrk_open(UBRK_LINE, "en_US", testLineText, u_strlen(testLineText), &status); @@ -938,7 +938,7 @@ void TestFirstLineSelection() void TestLastLineSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestLineData(); e = ubrk_open(UBRK_LINE, "en_US", testLineText, u_strlen(testLineText), &status); @@ -954,7 +954,7 @@ void TestLastLineSelection() void TestBackwardLineSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestLineData(); e = ubrk_open(UBRK_LINE, "en_US", testLineText, u_strlen(testLineText), &status); @@ -970,7 +970,7 @@ void TestBackwardLineSelection() void TestForwardLineIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestLineData(); e = ubrk_open(UBRK_LINE, "en_US", testLineText, u_strlen(testLineText), &status); @@ -986,7 +986,7 @@ void TestForwardLineIndexSelection() void TestBackwardLineIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestLineData(); e = ubrk_open(UBRK_LINE, "en_US", testLineText, u_strlen(testLineText), &status); @@ -1005,7 +1005,7 @@ void TestLineInvariants() UTextOffset i, j, k; UChar c; UBreakIterator *e; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar noBreak[10], dashes[10]; bool_t saw2; UChar work[5]; @@ -1024,7 +1024,7 @@ AllocateTextBoundary(); /* in addition to the other invariants, a line-break iterator should make sure that: it doesn't break around the non-breaking characters */ errorCount=0; - status=ZERO_ERROR; + status=U_ZERO_ERROR; u_strcpy(noBreak, CharsToUCharArray("\\u00a0\\u2007\\u2011\\ufeff")); u_uastrcpy(work, "aaa"); for (i = 0; i < u_strlen(s); i++) { @@ -1064,11 +1064,11 @@ AllocateTextBoundary(); work[1] = dashes[j]; for (k = 0; k < u_strlen(s); k++) { c = s[k]; - if (u_charType(c) == DECIMAL_DIGIT_NUMBER || - u_charType(c) == OTHER_NUMBER || - u_charType(c) == NON_SPACING_MARK || - u_charType(c) == ENCLOSING_MARK || - u_charType(c) == CURRENCY_SYMBOL || + if (u_charType(c) == U_DECIMAL_DIGIT_NUMBER || + u_charType(c) == U_OTHER_NUMBER || + u_charType(c) == U_NON_SPACING_MARK || + u_charType(c) == U_ENCLOSING_MARK || + u_charType(c) == U_CURRENCY_SYMBOL || c == '\n' || c == '\r' || c == 0x2028 || c == 0x2029 || c == 0x0003 || c == 0x00a0 || c == 0x2007 || c == 0x2011 || c == 0xfeff) @@ -1103,7 +1103,7 @@ FreeTextBoundary(); void TestForwardCharacterSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestCharacterData(); e = ubrk_open(UBRK_CHARACTER, "en_US", testCharacterText, u_strlen(testCharacterText), &status); @@ -1119,7 +1119,7 @@ void TestForwardCharacterSelection() void TestFirstCharacterSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestCharacterData(); e = ubrk_open(UBRK_CHARACTER, "en_US", testCharacterText, u_strlen(testCharacterText), &status); @@ -1135,7 +1135,7 @@ void TestFirstCharacterSelection() void TestLastCharacterSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestCharacterData(); e = ubrk_open(UBRK_CHARACTER, "en_US", testCharacterText, u_strlen(testCharacterText), &status); @@ -1151,7 +1151,7 @@ void TestLastCharacterSelection() void TestBackwardCharacterSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestCharacterData(); e = ubrk_open(UBRK_CHARACTER, "en_US", testCharacterText, u_strlen(testCharacterText), &status); @@ -1167,7 +1167,7 @@ void TestBackwardCharacterSelection() void TestForwardCharacterIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestCharacterData(); e = ubrk_open(UBRK_CHARACTER, "en_US", testCharacterText, u_strlen(testCharacterText), &status); @@ -1183,7 +1183,7 @@ void TestForwardCharacterIndexSelection() void TestBackwardCharacterIndexSelection() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator *e; addTestCharacterData(); e = ubrk_open(UBRK_CHARACTER, "en_US", testCharacterText, u_strlen(testCharacterText), &status); @@ -1223,7 +1223,7 @@ void TestPreceding() UTextOffset p1, p2, p3, p4, f, p; UBreakIterator *e; UChar words3[15]; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; u_uastrcpy(words3, "aaa bbb ccc"); log_verbose("Testting preceding...\n"); e = ubrk_open(UBRK_WORD, "en_US", words3, u_strlen(words3), &status); @@ -1251,7 +1251,7 @@ void TestPreceding() void TestEndBehaviour() { int32_t end, previous; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UBreakIterator* wb; UChar testString[5]; u_uastrcpy(testString, "boo"); @@ -1515,13 +1515,13 @@ void doBreakInvariantTest(UBreakIteratorType type, UChar* testChars) int l,k; UBreakIterator *tb; UTextOffset i, j; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar work[3]; UChar breaks[10]; UChar c; bool_t seen2; int errorCount = 0; - status=ZERO_ERROR; + status=U_ZERO_ERROR; u_uastrcpy(work, "aaa"); @@ -1572,11 +1572,11 @@ void doOtherInvariantTest(UBreakIteratorType type , UChar* testChars) int32_t k; UBreakIterator *tb; UTextOffset i, j; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar work[5]; UChar c; int32_t errorCount = 0; - status=ZERO_ERROR; + status=U_ZERO_ERROR; u_uastrcpy(work, "a\r\na"); @@ -1612,8 +1612,8 @@ void doOtherInvariantTest(UBreakIteratorType type , UChar* testChars) work[1] = c; for (j = 0; j < u_strlen(testChars); j++) { c = testChars[j]; - if ((u_charType(c) != NON_SPACING_MARK) && - (u_charType(c) != ENCLOSING_MARK)) + if ((u_charType(c) != U_NON_SPACING_MARK) && + (u_charType(c) != U_ENCLOSING_MARK)) continue; work[2] = c; tb=ubrk_open(type, "en_US", work, u_strlen(work), &status); diff --git a/icu4c/source/test/cintltst/crestst.c b/icu4c/source/test/cintltst/crestst.c index a2a63135a2c..4eef583f42e 100644 --- a/icu4c/source/test/cintltst/crestst.c +++ b/icu4c/source/test/cintltst/crestst.c @@ -108,12 +108,12 @@ param[] = /* "IN" means inherits */ /* "NE" or "ne" means "does not exist" */ - { "default", ZERO_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, - { "te", ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN", ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "te_NE", USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN_NE", USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "ne", USING_DEFAULT_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } + { "default", U_ZERO_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, + { "te", U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN", U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "te_NE", U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN_NE", U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "ne", U_USING_DEFAULT_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } }; static int32_t bundles_count = sizeof(param) / sizeof(param[0]); @@ -159,8 +159,8 @@ void TestConstruction1() { UResourceBundle *test1 = 0, *test2 = 0; const UChar *result1, *result2; - UErrorCode status= ZERO_ERROR; - UErrorCode err = ZERO_ERROR; + UErrorCode status= U_ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; const char* directory; const char* locale="te_IN"; @@ -204,7 +204,7 @@ void TestConstruction2() UChar temp[7]; UResourceBundle *test4 = 0; const UChar* result4; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; const char* directory; const char* locale="te_IN"; wchar_t widedirectory[256]; @@ -274,7 +274,7 @@ bool_t testTag(const char* frag, UResourceBundle* theBundle = NULL; char tag[99]; char action[256]; - UErrorCode expected_status,status = ZERO_ERROR,expected_resource_status = ZERO_ERROR; + UErrorCode expected_status,status = U_ZERO_ERROR,expected_resource_status = U_ZERO_ERROR; UChar* base = NULL; UChar* expected_string = NULL; const UChar* string = NULL; @@ -300,7 +300,7 @@ bool_t testTag(const char* frag, strcat(action, param[i].name); - status = ZERO_ERROR; + status = U_ZERO_ERROR; theBundle = ures_open(directory, param[i].name, &status); @@ -316,18 +316,18 @@ bool_t testTag(const char* frag, else actual_bundle = i; - expected_resource_status = MISSING_RESOURCE_ERROR; + expected_resource_status = U_MISSING_RESOURCE_ERROR; for (j=e_te_IN; j>=e_Default; --j) { if (is_in[j] && param[i].inherits[j]) { if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */ - expected_resource_status = ZERO_ERROR; + expected_resource_status = U_ZERO_ERROR; else if(j == 0) - expected_resource_status = USING_DEFAULT_ERROR; + expected_resource_status = U_USING_DEFAULT_ERROR; else - expected_resource_status = USING_FALLBACK_ERROR; + expected_resource_status = U_USING_FALLBACK_ERROR; log_verbose("%s[%d]::%s: in<%d:%s> inherits<%d:%s>. actual_bundle=%s\n", param[i].name, @@ -371,12 +371,12 @@ bool_t testTag(const char* frag, string= kERROR; - status = ZERO_ERROR; + status = U_ZERO_ERROR; ures_get(theBundle, tag, &status); if(SUCCESS(status)) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; string=ures_get(theBundle, tag, &status); } @@ -421,7 +421,7 @@ bool_t testTag(const char* frag, for(j = 0; j < count; j++) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; string = kERROR; index=j; @@ -431,7 +431,7 @@ bool_t testTag(const char* frag, /* how could 'index==j' ever be >= count ? */ - expected_status = (index >= 0 && index < count) ? expected_resource_status : MISSING_RESOURCE_ERROR; + expected_status = (index >= 0 && index < count) ? expected_resource_status : U_MISSING_RESOURCE_ERROR; log_verbose("Status for %s was %d, expected %d\n", action, status, expected_status); @@ -472,7 +472,7 @@ bool_t testTag(const char* frag, for(k=0;k = 0 && row < row_count && col >= 0 && col < column_count) ? - expected_resource_status : MISSING_RESOURCE_ERROR; + expected_resource_status : U_MISSING_RESOURCE_ERROR; CONFIRM_ErrorCode(status,expected_status); @@ -524,7 +524,7 @@ bool_t testTag(const char* frag, strcpy(item_tag, "tag"); strcat(item_tag, itoa1(index,buf)); - status = ZERO_ERROR; + status = U_ZERO_ERROR; string = kERROR; @@ -535,12 +535,12 @@ bool_t testTag(const char* frag, if (index < 0) { - CONFIRM_ErrorCode(status,MISSING_RESOURCE_ERROR); + CONFIRM_ErrorCode(status,U_MISSING_RESOURCE_ERROR); } else { UChar* element; - if (strcmp(myErrorName(status),"MISSING_RESOURCE_ERROR")!=0) { + if (strcmp(myErrorName(status),"U_MISSING_RESOURCE_ERROR")!=0) { count++; u_strcpy(expected_string,base); element=(UChar*)malloc(sizeof(UChar) * (strlen(buf)+1)); @@ -571,13 +571,13 @@ void record_fail() } /** - * Test to make sure that the USING_FALLBACK_ERROR and USING_DEFAULT_ERROR + * Test to make sure that the U_USING_FALLBACK_ERROR and U_USING_DEFAULT_ERROR * are set correctly */ void TestFallback() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UResourceBundle *fr_FR = NULL; const UChar *junk; /* ignored */ @@ -589,36 +589,36 @@ void TestFallback() return; } - status = ZERO_ERROR; + status = U_ZERO_ERROR; /* clear it out.. just do some calls to get the gears turning */ junk = ures_get(fr_FR, "LocaleID", &status); - status = ZERO_ERROR; + status = U_ZERO_ERROR; junk = ures_get(fr_FR, "LocaleString", &status); - status = ZERO_ERROR; + status = U_ZERO_ERROR; junk = ures_get(fr_FR, "LocaleID", &status); - status = ZERO_ERROR; + status = U_ZERO_ERROR; /* OK first one. This should be a Default value. */ junk = ures_get(fr_FR, "Version", &status); - if(status != USING_DEFAULT_ERROR) + if(status != U_USING_DEFAULT_ERROR) { - log_err("Expected USING_DEFAULT_ERROR when trying to get Version from fr_FR, got %d\n", + log_err("Expected U_USING_DEFAULT_ERROR when trying to get Version from fr_FR, got %d\n", status); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; /* and this is a Fallback, to fr */ junk = ures_get(fr_FR, "ShortLanguage", &status); - if(status != USING_FALLBACK_ERROR) + if(status != U_USING_FALLBACK_ERROR) { - log_err("Expected USING_FALLBACK_ERROR when trying to get ShortLanguage from fr_FR, got %d\n", + log_err("Expected U_USING_FALLBACK_ERROR when trying to get ShortLanguage from fr_FR, got %d\n", status); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; ures_close(fr_FR); } diff --git a/icu4c/source/test/cintltst/cturtst.c b/icu4c/source/test/cintltst/cturtst.c index edcf65fb113..0024c2f2f0f 100644 --- a/icu4c/source/test/cintltst/cturtst.c +++ b/icu4c/source/test/cintltst/cturtst.c @@ -117,7 +117,7 @@ void TestTertiary( ) int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("tr", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -136,7 +136,7 @@ void TestPrimary() int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("tr", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/cucdtst.c b/icu4c/source/test/cintltst/cucdtst.c index 01ff347bf95..d7fee0fc56f 100644 --- a/icu4c/source/test/cintltst/cucdtst.c +++ b/icu4c/source/test/cintltst/cucdtst.c @@ -33,36 +33,36 @@ const UChar LAST_CHAR_CODE_IN_FILE = 0xFFFD; const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPePoSmScSkSoPiPf"; const int32_t tagValues[] = { - /* Mn */ NON_SPACING_MARK, - /* Mc */ COMBINING_SPACING_MARK, - /* Me */ ENCLOSING_MARK, - /* Nd */ DECIMAL_DIGIT_NUMBER, - /* Nl */ LETTER_NUMBER, - /* No */ OTHER_NUMBER, - /* Zs */ SPACE_SEPARATOR, - /* Zl */ LINE_SEPARATOR, - /* Zp */ PARAGRAPH_SEPARATOR, - /* Cc */ CONTROL, - /* Cf */ FORMAT, - /* Cs */ SURROGATE, - /* Co */ PRIVATE_USE, - /* Cn */ UNASSIGNED, - /* Lu */ UPPERCASE_LETTER, - /* Ll */ LOWERCASE_LETTER, - /* Lt */ TITLECASE_LETTER, - /* Lm */ MODIFIER_LETTER, - /* Lo */ OTHER_LETTER, - /* Pc */ CONNECTOR_PUNCTUATION, - /* Pd */ DASH_PUNCTUATION, - /* Ps */ START_PUNCTUATION, - /* Pe */ END_PUNCTUATION, - /* Po */ OTHER_PUNCTUATION, - /* Sm */ MATH_SYMBOL, - /* Sc */ CURRENCY_SYMBOL, - /* Sk */ MODIFIER_SYMBOL, - /* So */ OTHER_SYMBOL, - /* Pi */ INITIAL_PUNCTUATION, - /* Pf */ FINAL_PUNCTUATION + /* Mn */ U_NON_SPACING_MARK, + /* Mc */ U_COMBINING_SPACING_MARK, + /* Me */ U_ENCLOSING_MARK, + /* Nd */ U_DECIMAL_DIGIT_NUMBER, + /* Nl */ U_LETTER_NUMBER, + /* No */ U_OTHER_NUMBER, + /* Zs */ U_SPACE_SEPARATOR, + /* Zl */ U_LINE_SEPARATOR, + /* Zp */ U_PARAGRAPH_SEPARATOR, + /* Cc */ U_CONTROL_CHAR, + /* Cf */ U_FORMAT_CHAR, + /* Cs */ U_SURROGATE, + /* Co */ U_PRIVATE_USE_CHAR, + /* Cn */ U_UNASSIGNED, + /* Lu */ U_UPPERCASE_LETTER, + /* Ll */ U_LOWERCASE_LETTER, + /* Lt */ U_TITLECASE_LETTER, + /* Lm */ U_MODIFIER_LETTER, + /* Lo */ U_OTHER_LETTER, + /* Pc */ U_CONNECTOR_PUNCTUATION, + /* Pd */ U_DASH_PUNCTUATION, + /* Ps */ U_START_PUNCTUATION, + /* Pe */ U_END_PUNCTUATION, + /* Po */ U_OTHER_PUNCTUATION, + /* Sm */ U_MATH_SYMBOL, + /* Sc */ U_CURRENCY_SYMBOL, + /* Sk */ U_MODIFIER_SYMBOL, + /* So */ U_OTHER_SYMBOL, + /* Pi */ U_INITIAL_PUNCTUATION, + /* Pf */ U_FINAL_PUNCTUATION }; const char dirStrings[][5] = { "L", @@ -384,7 +384,7 @@ void TestUnicodeData() } } - if (u_charScript((UChar)0x0041 != BASIC_LATIN)) { + if (u_charScript((UChar)0x0041 != U_BASIC_LATIN)) { log_err("Unicode character script property failed !\n"); } if (input) diff --git a/icu4c/source/test/cintltst/encoll.c b/icu4c/source/test/cintltst/encoll.c index 6b64db87faf..4f1ad019c0b 100644 --- a/icu4c/source/test/cintltst/encoll.c +++ b/icu4c/source/test/cintltst/encoll.c @@ -288,7 +288,7 @@ void TestTertiary( ) int32_t testMoreSize; UCollationResult expected; int32_t i,j; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("en_US", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -329,7 +329,7 @@ void TestPrimary() { int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("en_US", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); @@ -348,7 +348,7 @@ void TestSecondary() { UCollationResult expected; int32_t i,j, testAcuteSize; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("en_US", &status); if(FAILURE(status)){ log_err("ERROR: in creation of rule based collator: %s\n", myErrorName(status)); diff --git a/icu4c/source/test/cintltst/nccbtst.c b/icu4c/source/test/cintltst/nccbtst.c index 508d28cd7aa..f01dd1d5b7e 100644 --- a/icu4c/source/test/cintltst/nccbtst.c +++ b/icu4c/source/test/cintltst/nccbtst.c @@ -353,7 +353,7 @@ bool_t testConvertFromUnicode(const UChar *source, int sourceLen, const char *e { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UConverter *conv = 0; char junkout[NEW_MAX_BUFFER]; /* FIX */ int32_t junokout[NEW_MAX_BUFFER]; /* FIX */ @@ -431,7 +431,7 @@ bool_t testConvertFromUnicode(const UChar *source, int sourceLen, const char *e log_verbose("calling fromUnicode @ SOURCE:%08lx to %08lx TARGET: %08lx to %08lx, flush=%s\n", src,sourceLimit, targ,end, doFlush?"TRUE":"FALSE"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; ucnv_fromUnicode (conv, &targ, @@ -442,7 +442,7 @@ bool_t testConvertFromUnicode(const UChar *source, int sourceLen, const char *e doFlush, /* flush if we're at the end of the input data */ &status); - } while ( (status == INDEX_OUTOFBOUNDS_ERROR) || (sourceLimit < realSourceEnd) ); + } while ( (status == U_INDEX_OUTOFBOUNDS_ERROR) || (sourceLimit < realSourceEnd) ); if(FAILURE(status)) { @@ -518,7 +518,7 @@ bool_t testConvertFromUnicode(const UChar *source, int sourceLen, const char *e bool_t testConvertToUnicode( const char *source, int sourcelen, const UChar *expect, int expectlen, const char *codepage, UCNV_ToUCallBack callback, int32_t *expectOffsets) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UConverter *conv = 0; UChar junkout[NEW_MAX_BUFFER]; /* FIX */ int32_t junokout[NEW_MAX_BUFFER]; /* FIX */ @@ -596,7 +596,7 @@ bool_t testConvertToUnicode( const char *source, int sourcelen, const UChar *exp - status = ZERO_ERROR; + status = U_ZERO_ERROR; ucnv_toUnicode (conv, &targ, @@ -609,9 +609,9 @@ bool_t testConvertToUnicode( const char *source, int sourcelen, const UChar *exp - } while ( (status == INDEX_OUTOFBOUNDS_ERROR) || (srcLimit < realSourceEnd) ); /* while we just need another buffer */ + } while ( (status == U_INDEX_OUTOFBOUNDS_ERROR) || (srcLimit < realSourceEnd) ); /* while we just need another buffer */ /*check for an INVALID character for testing the call back function STOP*/ - if(status == INVALID_CHAR_FOUND || status == ILLEGAL_CHAR_FOUND ) + if(status == U_INVALID_CHAR_FOUND || status == U_ILLEGAL_CHAR_FOUND ) { for(p = junkout;p compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) diff --git a/icu4c/source/test/intltest/apicoll.cpp b/icu4c/source/test/intltest/apicoll.cpp index 612fbfccac7..9448731efd2 100644 --- a/icu4c/source/test/intltest/apicoll.cpp +++ b/icu4c/source/test/intltest/apicoll.cpp @@ -69,7 +69,7 @@ CollationAPITest::doAssert(bool_t condition, const char *message) void CollationAPITest::TestProperty( char* par ) { - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; Collator *col = 0; logln("The property tests begin : "); @@ -153,7 +153,7 @@ CollationAPITest::TestProperty( char* par ) logln("Create junk collation: "); Locale abcd("ab", "CD", ""); - success = ZERO_ERROR; + success = U_ZERO_ERROR; Collator *junk = 0; junk = Collator::createInstance(abcd, success); @@ -197,7 +197,7 @@ void CollationAPITest::TestHashCode( char* par ) { logln("hashCode tests begin."); - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; Collator *col1 = 0; col1 = Collator::createInstance(success); if (FAILURE(success)) @@ -243,7 +243,7 @@ CollationAPITest::TestCollationKey( char* par ) { logln("testing CollationKey begins..."); Collator *col = 0; - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; col = Collator::createInstance(success); if (FAILURE(success)) { @@ -253,7 +253,7 @@ CollationAPITest::TestCollationKey( char* par ) CollationKey sortk1, sortk2; UnicodeString test1("Abcda"), test2("abcda"); - UErrorCode key1Status = ZERO_ERROR, key2Status = ZERO_ERROR; + UErrorCode key1Status = U_ZERO_ERROR, key2Status = U_ZERO_ERROR; logln("Use tertiary comparison level testing ...."); @@ -327,7 +327,7 @@ CollationAPITest::TestElemIter( char* par ) { logln("testing sortkey begins..."); Collator *col = 0; - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; col = Collator::createInstance(success); if (FAILURE(success)) { @@ -464,7 +464,7 @@ CollationAPITest::TestElemIter( char* par ) void CollationAPITest::TestOperators( char* par ) { - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; UnicodeString ruleset1("< a, A < b, B < c, C; ch, cH, Ch, CH < d, D, e, E"); UnicodeString ruleset2("< a, A < b, B < c, C < d, D, e, E"); RuleBasedCollator *col1 = new RuleBasedCollator(ruleset1, success); @@ -472,7 +472,7 @@ CollationAPITest::TestOperators( char* par ) errln("RuleBasedCollator creation failed."); return; } - success = ZERO_ERROR; + success = U_ZERO_ERROR; RuleBasedCollator *col2 = new RuleBasedCollator(ruleset2, success); if (FAILURE(success)) { errln("The RuleBasedCollator constructor failed when building with the 2nd rule set."); @@ -484,7 +484,7 @@ CollationAPITest::TestOperators( char* par ) *col1 = *col2; doAssert((*col1 == *col2), "Collator objects not equal after assignment (operator=)"); - success = ZERO_ERROR; + success = U_ZERO_ERROR; Collator *col3 = Collator::createInstance(success); if (FAILURE(success)) { errln("Default collation creation failed."); @@ -519,7 +519,7 @@ CollationAPITest::TestOperators( char* par ) void CollationAPITest::TestDuplicate( char* par ) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator *col1 = Collator::createInstance(status); if (FAILURE(status)) { logln("Default collator creation failed."); @@ -542,7 +542,7 @@ CollationAPITest::TestCompare( char* par ) { logln("The compare tests begin : "); Collator *col = 0; - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; col = Collator::createInstance(success); if (FAILURE(success)) { errln("Default collation creation failed."); diff --git a/icu4c/source/test/intltest/callimts.cpp b/icu4c/source/test/intltest/callimts.cpp index 3e7bb800a21..d7966b03d8b 100644 --- a/icu4c/source/test/intltest/callimts.cpp +++ b/icu4c/source/test/intltest/callimts.cpp @@ -49,9 +49,9 @@ const UDate CalendarLimitTest::LATEST_SUPPORTED_MILLIS = 4503599627370495.0 void CalendarLimitTest::test(UDate millis, Calendar* cal, DateFormat* fmt) { - UErrorCode exception = ZERO_ERROR; + UErrorCode exception = U_ZERO_ERROR; UnicodeString theDate; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate d = millis; cal->setTime(millis, exception); if (SUCCESS(exception)) { @@ -92,7 +92,7 @@ CalendarLimitTest::TestCalendarLimit() { logln("Limit tests"); logln("--------------------"); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; explore2(EARLIEST_SUPPORTED_MILLIS); explore3(LATEST_SUPPORTED_MILLIS); Calendar *cal = Calendar::createInstance(status); diff --git a/icu4c/source/test/intltest/calregts.cpp b/icu4c/source/test/intltest/calregts.cpp index 8505baed70e..4a976c100b8 100644 --- a/icu4c/source/test/intltest/calregts.cpp +++ b/icu4c/source/test/intltest/calregts.cpp @@ -75,24 +75,6 @@ CalendarRegressionTest::runIndexedTest( int32_t index, bool_t exec, char* &name, } } -const char* -CalendarRegressionTest::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t CalendarRegressionTest::failure(UErrorCode status, const char* msg) { @@ -110,7 +92,7 @@ CalendarRegressionTest::failure(UErrorCode status, const char* msg) void CalendarRegressionTest::test4100311() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal = (GregorianCalendar*)Calendar::createInstance(status); failure(status, "Calendar::createInstance(status)"); cal->set(Calendar::YEAR, 1997); @@ -128,7 +110,7 @@ CalendarRegressionTest::test4100311() void CalendarRegressionTest::test4074758() { //Set system time to between 12-1 (am or pm) and then run - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal = new GregorianCalendar(status); failure(status, "new GregorianCalendar"); for (int32_t h=0; h<25; ++h) { @@ -146,7 +128,7 @@ CalendarRegressionTest::test4074758() void CalendarRegressionTest::test4028518() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal1 = new GregorianCalendar(status) ; failure(status, "new GregorianCalendar"); GregorianCalendar *cal2 = (GregorianCalendar*) cal1->clone() ; @@ -162,7 +144,7 @@ CalendarRegressionTest::test4028518() void CalendarRegressionTest::printdate(GregorianCalendar *cal, char *string) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; logln(UnicodeString(string)); log(UnicodeString("") + cal->get(GregorianCalendar::MONTH, status)) ; failure(status, "cal->get"); @@ -181,7 +163,7 @@ CalendarRegressionTest::test4031502() { // This bug actually occurs on Windows NT as well, and doesn't // require the host zone to be set; it can be set in Java. - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t count = 0; const UnicodeString **ids = TimeZone::createAvailableIDs(count); bool_t bad = FALSE; @@ -212,7 +194,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4035301() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *c = new GregorianCalendar(98, 8, 7,status); GregorianCalendar *d = new GregorianCalendar(98, 8, 7,status); if (c->after(*d,status) || @@ -234,7 +216,7 @@ CalendarRegressionTest::test4031502() int32_t count = 0; const UnicodeString **ids = TimeZone::createAvailableIDs(-8 * 60 * 60 * 1000, count); SimpleTimeZone *pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, *ids[0]); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; pdt->setStartRule(Calendar::APRIL, 1, Calendar::SUNDAY, 2 * 60 * 60 * 1000, status); pdt->setEndRule(Calendar::OCTOBER, -1, Calendar::SUNDAY, 2 * 60 * 60 * 1000, status); Calendar *calendar = new GregorianCalendar(pdt, status); @@ -271,7 +253,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4051765() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(status); cal->setLenient(FALSE); cal->set(Calendar::DAY_OF_WEEK, 0); @@ -349,7 +331,7 @@ CalendarRegressionTest::test4031502() * @bug 4059654 */ void CalendarRegressionTest::test4059654() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *gc = new GregorianCalendar(status); gc->set(1997, 3, 1, 15, 16, 17); // April 1, 1997 @@ -374,7 +356,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4061476() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *fmt = new SimpleDateFormat("ddMMMyy", Locale::UK,status); Calendar *cal = Calendar::createInstance(TimeZone::createTimeZone("GMT"), Locale::UK,status); @@ -401,7 +383,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4070502() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate d = getAssociatedDate(makeDate(1998,0,30), status); Calendar *cal = new GregorianCalendar(status); cal->setTime(d,status); @@ -452,7 +434,7 @@ CalendarRegressionTest::test4031502() void CalendarRegressionTest::dowTest(bool_t lenient) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal = new GregorianCalendar(status); cal->set(1997, Calendar::AUGUST, 12); // Wednesday // cal.getTime(); // Force update @@ -477,7 +459,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4071385() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(status); cal->setTime(makeDate(1998, Calendar::JUNE, 24),status); cal->set(Calendar::MONTH, Calendar::NOVEMBER); // change a field @@ -493,7 +475,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4073929() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *foo1 = new GregorianCalendar(1997, 8, 27,status); foo1->add(Calendar::DAY_OF_MONTH, + 1, status); int32_t testyear = foo1->get(Calendar::YEAR, status); @@ -512,7 +494,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4083167() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; TimeZone *saveZone = TimeZone::createDefault(); //try { TimeZone *newZone = TimeZone::createTimeZone("UTC"); @@ -553,7 +535,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4086724() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *date; TimeZone *saveZone = TimeZone::createDefault(); Locale saveLocale = Locale::getDefault(); @@ -591,7 +573,7 @@ CalendarRegressionTest::test4031502() * @bug 4092362 */ void CalendarRegressionTest::test4092362() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal1 = new GregorianCalendar(1997, 10, 11, 10, 20, 40,status); /*cal1.set( Calendar::YEAR, 1997 ); cal1.set( Calendar::MONTH, 10 ); @@ -626,7 +608,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4095407() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *a = new GregorianCalendar(1997,Calendar::NOVEMBER, 13,status); int32_t dow = a->get(Calendar::DAY_OF_WEEK, status); if (dow != Calendar::THURSDAY) @@ -640,7 +622,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4096231() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; TimeZone *GMT = TimeZone::createTimeZone("GMT"); TimeZone *PST = TimeZone::createTimeZone("PST"); int32_t sec = 0, min = 0, hr = 0, day = 1, month = 10, year = 1997; @@ -701,7 +683,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4096539() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t y [] = {31,28,31,30,31,30,31,31,30,31,30,31}; for (int32_t x=0;x<12;x++) { @@ -729,7 +711,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test41003112() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal = (GregorianCalendar*)Calendar::createInstance(status); cal->set(Calendar::YEAR, 1997); cal->set(Calendar::DAY_OF_YEAR, 1); @@ -745,7 +727,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4103271() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *sdf = new SimpleDateFormat(status); int32_t numYears=40, startYear=1997, numDays=15; UnicodeString output, testDesc; @@ -935,7 +917,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4106136() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale saveLocale = Locale::getDefault(); //try { Locale locales [] = { Locale::CHINESE, Locale::CHINA }; @@ -966,7 +948,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4108764() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate d00 = makeDate(1997, Calendar::MARCH, 15, 12, 00, 00); UDate d01 = makeDate(1997, Calendar::MARCH, 15, 12, 00, 56); UDate d10 = makeDate(1997, Calendar::MARCH, 15, 12, 34, 00); @@ -1010,7 +992,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4114578() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t ONE_HOUR = 60*60*1000; Calendar *cal = Calendar::createInstance(status); cal->adoptTimeZone(TimeZone::createTimeZone("PST")); @@ -1074,7 +1056,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4118384() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(status); if (cal->getMaximum(Calendar::HOUR) != 11 || cal->getLeastMaximum(Calendar::HOUR) != 11 || @@ -1090,7 +1072,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4125881() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal = (GregorianCalendar*) Calendar::createInstance(status); DateFormat *fmt = new SimpleDateFormat("MMMM d, yyyy G",status); cal->clear(); @@ -1114,7 +1096,7 @@ CalendarRegressionTest::test4031502() * at 45 BC, and not have leap years before then). */ void CalendarRegressionTest::test4125892() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal = (GregorianCalendar*) Calendar::createInstance(status); DateFormat *fmt = new SimpleDateFormat("MMMM d, yyyy G",status); cal->clear(); @@ -1138,7 +1120,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4141665() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *cal = new GregorianCalendar(status); GregorianCalendar *cal2 = (GregorianCalendar*)cal->clone(); UDate cut = cal->getGregorianChange(); @@ -1162,7 +1144,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4142933() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *calendar = new GregorianCalendar(status); //try { calendar->roll((Calendar::EDateFields)-1, TRUE, status); @@ -1191,7 +1173,7 @@ CalendarRegressionTest::test4031502() */ void CalendarRegressionTest::test4145158() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *calendar = new GregorianCalendar(status); calendar->adoptTimeZone(TimeZone::createTimeZone("GMT")); @@ -1225,7 +1207,7 @@ CalendarRegressionTest::test4031502() // small change in millis. void CalendarRegressionTest::test4145983() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *calendar = new GregorianCalendar(status); calendar->adoptTimeZone(TimeZone::createTimeZone("GMT")); UDate DATES [] = { LATEST_SUPPORTED_MILLIS, EARLIEST_SUPPORTED_MILLIS }; @@ -1270,7 +1252,7 @@ CalendarRegressionTest::test4031502() "ZONE_OFFSET", "DST_OFFSET" }; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *calendar = new GregorianCalendar(status); calendar->setLenient(FALSE); UDate date = makeDate(1996, Calendar::JANUARY, 3); // Arbitrary date @@ -1306,7 +1288,7 @@ CalendarRegressionTest::test4031502() void CalendarRegressionTest::Test4149677() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; TimeZone *zones [] = { TimeZone::createTimeZone("GMT"), @@ -1366,7 +1348,7 @@ CalendarRegressionTest::Test4149677() void CalendarRegressionTest::Test4162587() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; TimeZone *tz = TimeZone::createTimeZone("PST"); TimeZone::adoptDefault(tz); @@ -1417,7 +1399,7 @@ CalendarRegressionTest::Test4162587() void CalendarRegressionTest::Test4165343() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *calendar = new GregorianCalendar(1996, Calendar::FEBRUARY, 29, status); if(FAILURE(status)) { errln("Couldn't create calendar"); @@ -1470,7 +1452,7 @@ CalendarRegressionTest::Test4166109() * 29 30 31 */ bool_t passed = TRUE; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar::EDateFields field = Calendar::WEEK_OF_MONTH; GregorianCalendar *calendar = new GregorianCalendar(Locale::US, status); @@ -1514,7 +1496,7 @@ CalendarRegressionTest::Test4166109() void CalendarRegressionTest::Test4167060() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar::EDateFields field = Calendar::YEAR; DateFormat *format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy G", Locale::US, status); @@ -1607,7 +1589,7 @@ CalendarRegressionTest::makeDate(int32_t y, int32_t m, int32_t d, { UDate result; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(status); cal->clear(); diff --git a/icu4c/source/test/intltest/calregts.h b/icu4c/source/test/intltest/calregts.h index 2a0f6428327..17a8fd2fe35 100644 --- a/icu4c/source/test/intltest/calregts.h +++ b/icu4c/source/test/intltest/calregts.h @@ -77,7 +77,6 @@ public: static const UDate LATEST_SUPPORTED_MILLIS; protected: - const char* errorName(UErrorCode code); bool_t failure(UErrorCode status, const char* msg); }; diff --git a/icu4c/source/test/intltest/caltest.cpp b/icu4c/source/test/intltest/caltest.cpp index 330647fc64f..8e9b8230a12 100644 --- a/icu4c/source/test/intltest/caltest.cpp +++ b/icu4c/source/test/intltest/caltest.cpp @@ -148,7 +148,7 @@ void CalendarTest::runIndexedTest( int32_t index, bool_t exec, char* &name, char void CalendarTest::TestGenericAPI() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString str; UDate when = date(90, Calendar::APRIL, 15); @@ -337,7 +337,7 @@ CalendarTest::TestGenericAPI() void CalendarTest::TestRog() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar* gc = new GregorianCalendar(status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } int32_t year = 1997, month = Calendar::APRIL, date = 1; @@ -371,7 +371,7 @@ CalendarTest::TestDOW943() void CalendarTest::dowTest(bool_t lenient) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar* cal = new GregorianCalendar(status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } cal->set(1997, Calendar::AUGUST, 12); @@ -399,7 +399,7 @@ void CalendarTest::dowTest(bool_t lenient) void CalendarTest::TestClonesUnique908() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *c = Calendar::createInstance(status); if (FAILURE(status)) { errln("Calendar::createInstance failed"); return; } Calendar *d = (Calendar*) c->clone(); @@ -423,7 +423,7 @@ void CalendarTest::TestGregorianChange768() { bool_t b; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString str; GregorianCalendar* c = new GregorianCalendar(status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } @@ -448,7 +448,7 @@ CalendarTest::TestGregorianChange768() void CalendarTest::TestDisambiguation765() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *c = Calendar::createInstance(status); if (FAILURE(status)) { errln("Calendar::createInstance failed"); return; } c->setLenient(FALSE); @@ -470,7 +470,7 @@ CalendarTest::TestDisambiguation765() c->set(Calendar::DAY_OF_WEEK_IN_MONTH, - 1); verify765("1997 last Tuesday in June = ", c, 1997, Calendar::JUNE, 24); // IllegalArgumentException e = null; - status = ZERO_ERROR; + status = U_ZERO_ERROR; //try { c->clear(); c->set(Calendar::YEAR, 1997); @@ -495,7 +495,7 @@ CalendarTest::TestDisambiguation765() c->set(Calendar::MONTH, Calendar::JUNE); c->set(Calendar::WEEK_OF_MONTH, 5); verify765("1997 Tuesday in week 5 of June = ", c, 1997, Calendar::JULY, 1); - status = ZERO_ERROR; + status = U_ZERO_ERROR; //try { c->clear(); c->set(Calendar::YEAR, 1997); @@ -542,7 +542,7 @@ void CalendarTest::verify765(const UnicodeString& msg, Calendar* c, int32_t year, int32_t month, int32_t day) { UnicodeString str; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (c->get(Calendar::YEAR, status) == year && c->get(Calendar::MONTH, status) == month && c->get(Calendar::DATE, status) == day) { @@ -561,7 +561,7 @@ CalendarTest::verify765(const UnicodeString& msg, Calendar* c, int32_t year, int void CalendarTest::verify765(const UnicodeString& msg/*, IllegalArgumentException e*/, UErrorCode status) { - if (status != ILLEGAL_ARGUMENT_ERROR) errln("FAIL: No IllegalArgumentException for " + msg); + if (status != U_ILLEGAL_ARGUMENT_ERROR) errln("FAIL: No IllegalArgumentException for " + msg); else logln("PASS: " + msg + "IllegalArgument as expected"); } @@ -583,7 +583,7 @@ void CalendarTest::test4064654(int32_t yr, int32_t mo, int32_t dt, int32_t hr, int32_t mn, int32_t sc) { UDate date; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString str; Calendar *gmtcal = Calendar::createInstance(status); if (FAILURE(status)) { errln("Calendar::createInstance failed"); return; } @@ -627,7 +627,7 @@ void CalendarTest::TestAddSetOrder621() { UDate d = date(97, 4, 14, 13, 23, 45); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(status); if (FAILURE(status)) { errln("Calendar::createInstance failed"); @@ -702,7 +702,7 @@ void CalendarTest::TestAdd520() { int32_t y = 1997, m = Calendar::FEBRUARY, d = 1; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *temp = new GregorianCalendar(y, m, d, status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } check520(temp, y, m, d); @@ -739,7 +739,7 @@ CalendarTest::TestAddRollExtensive() { int32_t maxlimit = 40; int32_t y = 1997, m = Calendar::FEBRUARY, d = 1, hr = 1, min = 1, sec = 0, ms = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *temp = new GregorianCalendar(y, m, d, status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } @@ -755,10 +755,10 @@ CalendarTest::TestAddRollExtensive() while (e < Calendar::FIELD_COUNT) { int32_t i; int32_t limit = maxlimit; - status = ZERO_ERROR; + status = U_ZERO_ERROR; for (i = 0; i < limit; i++) { temp->add(e, 1, status); - if (FAILURE(status)) { limit = i; status = ZERO_ERROR; } + if (FAILURE(status)) { limit = i; status = U_ZERO_ERROR; } } for (i = 0; i < limit; i++) { temp->add(e, -1, status); @@ -774,10 +774,10 @@ CalendarTest::TestAddRollExtensive() while (e < Calendar::FIELD_COUNT) { int32_t i; int32_t limit = maxlimit; - status = ZERO_ERROR; + status = U_ZERO_ERROR; for (i = 0; i < limit; i++) { temp->roll(e, 1, status); - if (FAILURE(status)) { limit = i; status = ZERO_ERROR; } + if (FAILURE(status)) { limit = i; status = U_ZERO_ERROR; } } for (i = 0; i < limit; i++) { temp->roll(e, -1, status); @@ -799,7 +799,7 @@ CalendarTest::check520(Calendar* c, int32_t ms, Calendar::EDateFields field) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (c->get(Calendar::YEAR, status) != y || c->get(Calendar::MONTH, status) != m || c->get(Calendar::DATE, status) != d || @@ -834,7 +834,7 @@ CalendarTest::check520(Calendar* c, int32_t y, int32_t m, int32_t d) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (c->get(Calendar::YEAR, status) != y || c->get(Calendar::MONTH, status) != m || c->get(Calendar::DATE, status) != d) { @@ -862,7 +862,7 @@ void CalendarTest::TestFieldSet4781() { // try { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *g = new GregorianCalendar(status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } GregorianCalendar *g2 = new GregorianCalendar(status); @@ -935,7 +935,7 @@ UnicodeString& CalendarTest::FILENAME = "tmp337.bin"; void CalendarTest::TestSecondsZero121() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = new GregorianCalendar(status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } cal->setTime(Calendar::getNow(), status); @@ -960,7 +960,7 @@ CalendarTest::TestSecondsZero121() void CalendarTest::TestAddSetGet0610() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; { Calendar *calendar = new GregorianCalendar(status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } @@ -1007,7 +1007,7 @@ CalendarTest::TestAddSetGet0610() UnicodeString CalendarTest::value(Calendar* calendar) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; return UnicodeString("") + (int32_t)calendar->get(Calendar::YEAR, status) + "/" + (int32_t)calendar->get(Calendar::MONTH, status) + "/" + (int32_t)calendar->get(Calendar::DATE, status) + @@ -1024,7 +1024,7 @@ UnicodeString CalendarTest::EXPECTED_0610 = "1993/0/5"; void CalendarTest::TestFields060() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t year = 1997; int32_t month = Calendar::OCTOBER; int32_t dDate = 22; @@ -1064,7 +1064,7 @@ const int32_t CalendarTest::EXPECTED_FIELDS_length = sizeof(CalendarTest::EXPECT void CalendarTest::TestEpochStartFields() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; TimeZone *z = TimeZone::createDefault(); Calendar *c = Calendar::createInstance(status); if (FAILURE(status)) { errln("Calendar::createInstance failed"); return; } @@ -1120,7 +1120,7 @@ int32_t CalendarTest::EPOCH_FIELDS[] = { void CalendarTest::TestDOWProgression() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = new GregorianCalendar(1972, Calendar::OCTOBER, 26, status); if (FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; } marchByDelta(cal, 24); @@ -1132,7 +1132,7 @@ CalendarTest::TestDOWProgression() void CalendarTest::marchByDelta(Calendar* cal, int32_t delta) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cur = (Calendar*) cal->clone(); int32_t initialDOW = cur->get(Calendar::DAY_OF_WEEK, status); if (FAILURE(status)) { errln("Calendar::get failed"); return; } diff --git a/icu4c/source/test/intltest/caltztst.cpp b/icu4c/source/test/intltest/caltztst.cpp index e26ccacf25d..d9d8e49e77b 100644 --- a/icu4c/source/test/intltest/caltztst.cpp +++ b/icu4c/source/test/intltest/caltztst.cpp @@ -26,24 +26,6 @@ DateFormat* CalendarTimeZoneTest::fgDateFormat = 0; Calendar* CalendarTimeZoneTest::fgCalendar = 0; -const char* CalendarTimeZoneTest::errorName(UErrorCode code) -{ - switch (code) - { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t CalendarTimeZoneTest::failure(UErrorCode status, const char* msg) { if (FAILURE(status)) @@ -71,7 +53,7 @@ DateFormat* CalendarTimeZoneTest::getDateFormat() if(theFormat == 0) // If we weren't able to pull it out of the cache, then we have to create it. { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; theFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", status); if (FAILURE(status)) { @@ -117,7 +99,7 @@ Calendar* CalendarTimeZoneTest::getCalendar() if(theCalendar == 0) // If we weren't able to pull it out of the cache, then we have to create it. { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; theCalendar = Calendar::createInstance(status); if (FAILURE(status)) { @@ -178,7 +160,7 @@ CalendarTimeZoneTest::date(int32_t y, int32_t m, int32_t d, int32_t hr, int32_t if (cal == 0) return 0.0; cal->clear(); cal->set(1900 + y, m, d, hr, min, sec); // Add 1900 to follow java.util.Date protocol - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate dt = cal->getTime(status); releaseCalendar(cal); if (FAILURE(status)) @@ -195,7 +177,7 @@ CalendarTimeZoneTest::utcDate(int32_t y, int32_t m, int32_t d, int32_t hr, int32 { Calendar* cal = getCalendar(); if (cal == 0) return 0.0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Date dt = date(y, m, d, hr, min, sec) + cal->get(Calendar::ZONE_OFFSET, status) - cal->get(Calendar::DST_OFFSET, status); @@ -214,7 +196,7 @@ CalendarTimeZoneTest::dateToFields(UDate date, int32_t& y, int32_t& m, int32_t& { Calendar* cal = getCalendar(); if (cal == 0) return; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; cal->setTime(date, status); y = cal->get(Calendar::YEAR, status) - 1900; m = cal->get(Calendar::MONTH, status); diff --git a/icu4c/source/test/intltest/caltztst.h b/icu4c/source/test/intltest/caltztst.h index 19eab0db78c..48368144498 100644 --- a/icu4c/source/test/intltest/caltztst.h +++ b/icu4c/source/test/intltest/caltztst.h @@ -55,8 +55,6 @@ protected: // Utility method to get the fields of a date; similar to Date.getYear() etc. void dateToFields(UDate date, int32_t& y, int32_t& m, int32_t& d, int32_t& hr, int32_t& min, int32_t& sec); - static const char* errorName(UErrorCode code); - protected: static DateFormat* fgDateFormat; static Calendar* fgCalendar; diff --git a/icu4c/source/test/intltest/cppcnvt.cpp b/icu4c/source/test/intltest/cppcnvt.cpp index 366ed4456eb..cfc429ddb0b 100644 --- a/icu4c/source/test/intltest/cppcnvt.cpp +++ b/icu4c/source/test/intltest/cppcnvt.cpp @@ -23,8 +23,7 @@ int32_t strCaseIcmp(const char* a1,const char * a2); UCNV_FromUCallBack otherUnicodeAction(UCNV_FromUCallBack MIA); UCNV_ToUCallBack otherCharAction(UCNV_ToUCallBack MIA); /*Asciifies the UErrorCodes*/ -const char* errorString(UErrorCode err); -const char* myErrorName(UErrorCode err); +#define myErrorName(errorCode) errorName(errorCode) void ConvertTest::runIndexedTest( int32_t index, bool_t exec, char* &name, char* par ) { @@ -69,7 +68,7 @@ void ConvertTest::TestConvert() int32_t k = 0; uint16_t codepage_index = 0; int32_t cp = 0; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; const char* const* available_conv = NULL; char ucs_file_name[UCS_FILE_NAME_SIZE]; UCNV_FromUCallBack MIA1; @@ -554,24 +553,3 @@ UCNV_ToUCallBack otherCharAction(UCNV_ToUCallBack MIA) { return (MIA==(UCNV_ToUCallBack)MissingCharAction_STOP)?(UCNV_ToUCallBack)MissingCharAction_SUBSTITUTE:(UCNV_ToUCallBack)MissingCharAction_STOP; } - - -const char* myErrorName(UErrorCode err) -{ - switch (err) - { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - case INDEX_OUTOFBOUNDS_ERROR: return "INDEX_OUTOFBOUNDS_ERROR"; - case PARSE_ERROR: return "PARSE_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} diff --git a/icu4c/source/test/intltest/currcoll.cpp b/icu4c/source/test/intltest/currcoll.cpp index d4fa5374555..d7e7d10e4c6 100644 --- a/icu4c/source/test/intltest/currcoll.cpp +++ b/icu4c/source/test/intltest/currcoll.cpp @@ -67,7 +67,7 @@ void CollationCurrencyTest::currencyTest(char *par) int32_t i, j; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator::EComparisonResult expectedResult = Collator::EQUAL; RuleBasedCollator *c = (RuleBasedCollator *)Collator::createInstance(status); @@ -102,7 +102,7 @@ void CollationCurrencyTest::currencyTest(char *par) Collator::EComparisonResult compareResult = c->compare(source, target); CollationKey sourceKey, targetKey; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; c->getCollationKey(source, sourceKey, status); diff --git a/icu4c/source/test/intltest/dacoll.cpp b/icu4c/source/test/intltest/dacoll.cpp index 643263a0dc5..10caa98b5be 100644 --- a/icu4c/source/test/intltest/dacoll.cpp +++ b/icu4c/source/test/intltest/dacoll.cpp @@ -34,7 +34,7 @@ CollationDanishTest::CollationDanishTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale("da", "DK", ""),status); } @@ -194,7 +194,7 @@ void CollationDanishTest::doTest( UnicodeString source, UnicodeString target, Co { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) { diff --git a/icu4c/source/test/intltest/dcfmapts.cpp b/icu4c/source/test/intltest/dcfmapts.cpp index 305314569a6..b2bf0f7c774 100644 --- a/icu4c/source/test/intltest/dcfmapts.cpp +++ b/icu4c/source/test/intltest/dcfmapts.cpp @@ -28,7 +28,7 @@ void IntlTestDecimalFormatAPI::runIndexedTest( int32_t index, bool_t exec, char* case 0: name = "DecimalFormat API test"; if (exec) { logln((UnicodeString)"DecimalFormat API test---"); logln((UnicodeString)""); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale::setDefault(Locale::ENGLISH, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: Could not set default locale, test may not give correct results"); @@ -47,7 +47,7 @@ void IntlTestDecimalFormatAPI::runIndexedTest( int32_t index, bool_t exec, char* */ void IntlTestDecimalFormatAPI::testAPI(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // ======= Test constructors @@ -58,26 +58,26 @@ void IntlTestDecimalFormatAPI::testAPI(char *par) errln((UnicodeString)"ERROR: Could not create DecimalFormat (default)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; const UnicodeString pattern("#,##0.# FF"); DecimalFormat pat(pattern, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: Could not create DecimalFormat (pattern)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DecimalFormatSymbols *symbols = new DecimalFormatSymbols(Locale::FRENCH, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: Could not create DecimalFormatSymbols (French)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DecimalFormat cust1(pattern, symbols, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: Could not create DecimalFormat (pattern, symbols*)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DecimalFormat cust2(pattern, *symbols, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: Could not create DecimalFormat (pattern, symbols)"); @@ -122,14 +122,14 @@ void IntlTestDecimalFormatAPI::testAPI(char *par) res2 = pat.format(l, res2, pos2); logln((UnicodeString) "" + (int32_t) l + " formatted to " + res2); - status = ZERO_ERROR; + status = U_ZERO_ERROR; res3 = cust1.format(fD, res3, pos3, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: format(Formattable [double]) failed"); } logln((UnicodeString) "" + (int32_t) fD.getDouble() + " formatted to " + res3); - status = ZERO_ERROR; + status = U_ZERO_ERROR; res4 = cust2.format(fL, res4, pos4, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: format(Formattable [long]) failed"); @@ -144,7 +144,7 @@ void IntlTestDecimalFormatAPI::testAPI(char *par) Formattable result1, result2; ParsePosition pos(0); UnicodeString patt("#,##0.#"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; pat.applyPattern(patt, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: applyPattern() failed"); @@ -155,7 +155,7 @@ void IntlTestDecimalFormatAPI::testAPI(char *par) } logln(text + " parsed into " + (int32_t) result1.getDouble()); - status = ZERO_ERROR; + status = U_ZERO_ERROR; pat.parse(text, result2, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: parse() failed"); @@ -246,7 +246,7 @@ void IntlTestDecimalFormatAPI::testAPI(char *par) UnicodeString p1("#,##0.0#;(#,##0.0#)"); logln((UnicodeString)"Applying pattern " + p1); - status = ZERO_ERROR; + status = U_ZERO_ERROR; pat.applyPattern(p1, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: applyPattern() failed with " + (int32_t) status); @@ -260,7 +260,7 @@ void IntlTestDecimalFormatAPI::testAPI(char *par) UnicodeString p2("#,##0.0# FF;(#,##0.0# FF)"); logln((UnicodeString)"Applying pattern " + p2); - status = ZERO_ERROR; + status = U_ZERO_ERROR; pat.applyLocalizedPattern(p2, status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: applyPattern() failed with " + (int32_t) status); @@ -276,7 +276,7 @@ void IntlTestDecimalFormatAPI::testAPI(char *par) logln((UnicodeString)"Testing getStaticClassID()"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; NumberFormat *test = new DecimalFormat(status); if(FAILURE(status)) { errln((UnicodeString)"ERROR: Couldn't create a DecimalFormat"); diff --git a/icu4c/source/test/intltest/decoll.cpp b/icu4c/source/test/intltest/decoll.cpp index 98ee9d424ba..1451a7f9928 100644 --- a/icu4c/source/test/intltest/decoll.cpp +++ b/icu4c/source/test/intltest/decoll.cpp @@ -35,7 +35,7 @@ CollationGermanTest::CollationGermanTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale::GERMANY, status); } @@ -97,7 +97,7 @@ void CollationGermanTest::doTest( UnicodeString source, UnicodeString target, Co { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) diff --git a/icu4c/source/test/intltest/dtfmapts.cpp b/icu4c/source/test/intltest/dtfmapts.cpp index 9414896a444..5afb51fc57b 100644 --- a/icu4c/source/test/intltest/dtfmapts.cpp +++ b/icu4c/source/test/intltest/dtfmapts.cpp @@ -29,7 +29,7 @@ void IntlTestDateFormatAPI::runIndexedTest( int32_t index, bool_t exec, char* &n case 0: name = "DateFormat API test"; if (exec) { logln("DateFormat API test---"); logln(""); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale::setDefault(Locale::ENGLISH, status); if(FAILURE(status)) { errln("ERROR: Could not set default locale, test may not give correct results"); @@ -54,7 +54,7 @@ void IntlTestDateFormatAPI::runIndexedTest( int32_t index, bool_t exec, char* &n */ void IntlTestDateFormatAPI::TestEquals() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // Create two objects at different system times DateFormat *a = DateFormat::createInstance(); UDate start = Calendar::getNow(); @@ -83,7 +83,7 @@ void IntlTestDateFormatAPI::TestEquals() */ void IntlTestDateFormatAPI::testAPI(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // ======= Test constructors @@ -112,7 +112,7 @@ void IntlTestDateFormatAPI::testAPI(char *par) UnicodeString res1, res2, res3; FieldPosition pos1(0), pos2(0); - status = ZERO_ERROR; + status = U_ZERO_ERROR; res1 = fr->format(d, res1, pos1, status); if(FAILURE(status)) { errln("ERROR: format() failed (French)"); @@ -139,7 +139,7 @@ void IntlTestDateFormatAPI::testAPI(char *par) } logln(text + " parsed into " + result1.getDate()); - status = ZERO_ERROR; + status = U_ZERO_ERROR; result2 = def->parse(text, status); if(FAILURE(status)) { errln("ERROR: parse() failed"); @@ -196,7 +196,7 @@ void IntlTestDateFormatAPI::testAPI(char *par) logln("Testing getStaticClassID()"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; DateFormat *test = new SimpleDateFormat(status); if(FAILURE(status)) { errln("ERROR: Couldn't create a DateFormat"); diff --git a/icu4c/source/test/intltest/dtfmrgts.cpp b/icu4c/source/test/intltest/dtfmrgts.cpp index cc90f077918..de6ff18372b 100644 --- a/icu4c/source/test/intltest/dtfmrgts.cpp +++ b/icu4c/source/test/intltest/dtfmrgts.cpp @@ -62,7 +62,7 @@ DateFormatRegressionTest::runIndexedTest( int32_t index, bool_t exec, char* &nam */ void DateFormatRegressionTest::Test4029195() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate today = Calendar::getNow(); logln((UnicodeString) "today: " + today); @@ -206,7 +206,7 @@ void DateFormatRegressionTest::Test4052408() */ void DateFormatRegressionTest::Test4056591() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; //try { SimpleDateFormat *fmt = new SimpleDateFormat("yyMMdd", Locale::US, status); @@ -260,7 +260,7 @@ void DateFormatRegressionTest::Test4056591() */ void DateFormatRegressionTest::Test4059917() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *fmt; UnicodeString myDate; @@ -296,7 +296,7 @@ void DateFormatRegressionTest::aux917( SimpleDateFormat *fmt, UnicodeString& str fmt->parseObject( str, o, pos ); //logln( UnicodeString("Parsed object: ") + o ); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString formatted; FieldPosition poss(FieldPosition::DONT_CARE); formatted = fmt->format( o, formatted, poss, status ); @@ -320,7 +320,7 @@ void DateFormatRegressionTest::Test4060212() logln( "dateString= " + dateString ); logln("Using yyyy-DDD.hh:mm:ss"); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *formatter = new SimpleDateFormat("yyyy-DDD.hh:mm:ss", status); failure(status, "new SimpleDateFormat"); ParsePosition pos(0); @@ -364,7 +364,7 @@ void DateFormatRegressionTest::Test4060212() */ void DateFormatRegressionTest::Test4061287() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *df = new SimpleDateFormat("dd/MM/yyyy", status); failure(status, "new SimpleDateFormat"); @@ -400,7 +400,7 @@ void DateFormatRegressionTest::Test4065240() Locale saveLocale = Locale::getDefault(); TimeZone *saveZone = TimeZone::createDefault(); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; //try { Locale *curLocale = new Locale("de","DE"); Locale::setDefault(*curLocale, status); @@ -474,7 +474,7 @@ void DateFormatRegressionTest::Test4071441() UDate epoch = date(0, 0, 0); UDate xmas = date(61, Calendar::DECEMBER, 25); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; calA->setTime(epoch, status); failure(status, "calA->setTime"); calB->setTime(epoch, status); @@ -518,7 +518,7 @@ void DateFormatRegressionTest::Test4073003() (UnicodeString) "4/3/2010", (UnicodeString) "4/3/10" }; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; for(int i= 0; i < 4; i+=2) { UDate d = fmt->parse(tests[i], status); failure(status, "fmt->parse"); @@ -550,7 +550,7 @@ void DateFormatRegressionTest::Test4089106() //try { TimeZone *z = new SimpleTimeZone((int)(1.25 * 3600000), "FAKEZONE"); TimeZone::setDefault(*z); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *f = new SimpleDateFormat(status); failure(status, "new SimpleDateFormat"); if (f->getTimeZone()!= *z) @@ -643,7 +643,7 @@ void DateFormatRegressionTest::Test4100302() */ void DateFormatRegressionTest::Test4101483() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *sdf = new SimpleDateFormat("z", Locale::US, status); failure(status, "new SimpleDateFormat"); FieldPosition fp(DateFormat::TIMEZONE_FIELD); @@ -672,7 +672,7 @@ void DateFormatRegressionTest::Test4101483() */ void DateFormatRegressionTest::Test4103340() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // choose a date that is the FIRST of some month // and some arbitrary time @@ -705,7 +705,7 @@ void DateFormatRegressionTest::Test4103341() // {sfb} changed from setDefault to adoptDefault TimeZone::adoptDefault(TimeZone::createTimeZone("CST")); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *simple = new SimpleDateFormat("MM/dd/yyyy HH:mm", status); failure(status, "new SimpleDateFormat"); TimeZone *temp = TimeZone::createDefault(); @@ -725,7 +725,7 @@ void DateFormatRegressionTest::Test4103341() */ void DateFormatRegressionTest::Test4104136() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *sdf = new SimpleDateFormat(status); failure(status, "new SimpleDateFormat"); UnicodeString pattern = "'time' hh:mm"; @@ -784,7 +784,7 @@ void DateFormatRegressionTest::Test4104136() */ void DateFormatRegressionTest::Test4104522() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *sdf = new SimpleDateFormat(status); failure(status, "new SimpleDateFormat"); @@ -815,7 +815,7 @@ void DateFormatRegressionTest::Test4106807() UDate dt; DateFormat *df = DateFormat::createDateTimeInstance(); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *sdfs [] = { new SimpleDateFormat("yyyyMMddHHmmss", status), new SimpleDateFormat("yyyyMMddHHmmss'Z'", status), @@ -857,7 +857,7 @@ void DateFormatRegressionTest::Test4106807() // {sfb} some of these parses will fail purposely if(FAILURE(status)) break; - status = ZERO_ERROR; + status = U_ZERO_ERROR; UnicodeString fmtd; FieldPosition pos(FieldPosition::DONT_CARE); fmtd = df->format(dt, fmtd, pos); @@ -914,7 +914,7 @@ void DateFormatRegressionTest::Test4108407() */ void DateFormatRegressionTest::Test4134203() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString dateFormat = "MM/dd/yy HH:mm:ss zzz"; SimpleDateFormat *fmt = new SimpleDateFormat(dateFormat, status); failure(status, "new SimpleDateFormat"); @@ -937,7 +937,7 @@ void DateFormatRegressionTest::Test4151631() { UnicodeString pattern = "'TO_DATE('''dd'-'MM'-'yyyy HH:mm:ss''' , ''DD-MM-YYYY HH:MI:SS'')'"; logln("pattern=" + pattern); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *format = new SimpleDateFormat(pattern, Locale::US, status); failure(status, "new SimpleDateFormat"); UnicodeString result; @@ -960,7 +960,7 @@ void DateFormatRegressionTest::Test4151631() */ void DateFormatRegressionTest::Test4151706() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *fmt = new SimpleDateFormat("EEEE, dd-MMM-yy HH:mm:ss z", Locale::US, status); failure(status, "new SimpleDateFormat"); @@ -985,7 +985,7 @@ DateFormatRegressionTest::Test4162071() { UnicodeString dateString("Thu, 30-Jul-1999 11:51:14 GMT"); UnicodeString format("EEE', 'dd-MMM-yyyy HH:mm:ss z"); // RFC 822/1123 - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat df(format, Locale::US, status); if(FAILURE(status)) errln("Couldn't create SimpleDateFormat"); diff --git a/icu4c/source/test/intltest/dtfmtrtts.cpp b/icu4c/source/test/intltest/dtfmtrtts.cpp index 135afb465d4..fe1c7f9f707 100644 --- a/icu4c/source/test/intltest/dtfmtrtts.cpp +++ b/icu4c/source/test/intltest/dtfmtrtts.cpp @@ -47,24 +47,6 @@ DateFormatRoundTripTest::runIndexedTest( int32_t index, bool_t exec, char* &name } } -const char* -DateFormatRoundTripTest::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t DateFormatRoundTripTest::failure(UErrorCode status, const char* msg) { @@ -80,7 +62,7 @@ DateFormatRoundTripTest::failure(UErrorCode status, const char* msg) void DateFormatRoundTripTest::TestDateFormatRoundTrip() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss.SSS zzz yyyy G", status); failure(status, "new SimpleDateFormat"); @@ -208,7 +190,7 @@ void DateFormatRoundTripTest::test(DateFormat *fmt, bool_t timeOnly) d[0] = generateDate(); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // We go through this loop until we achieve a match or until // the maximum loop count is reached. We record the points at @@ -312,7 +294,7 @@ void DateFormatRoundTripTest::test(DateFormat *fmt, bool_t timeOnly) */ int32_t DateFormatRoundTripTest::getField(UDate d, int32_t f) { // Should be synchronized, but we're single threaded so it's ok - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; getFieldCal->setTime(d, status); failure(status, "getfieldCal->setTime"); int32_t ret = getFieldCal->get((Calendar::EDateFields)f, status); diff --git a/icu4c/source/test/intltest/dtfmtrtts.h b/icu4c/source/test/intltest/dtfmtrtts.h index bc69c4e7eb4..ca09832c42e 100644 --- a/icu4c/source/test/intltest/dtfmtrtts.h +++ b/icu4c/source/test/intltest/dtfmtrtts.h @@ -79,7 +79,6 @@ static double randDouble(double range) } protected: - const char* errorName(UErrorCode code); bool_t failure(UErrorCode status, const char* msg); private: diff --git a/icu4c/source/test/intltest/dtfmttst.cpp b/icu4c/source/test/intltest/dtfmttst.cpp index 8aa7c8fb0f2..829040cc900 100644 --- a/icu4c/source/test/intltest/dtfmttst.cpp +++ b/icu4c/source/test/intltest/dtfmttst.cpp @@ -52,7 +52,7 @@ void DateFormatTest::runIndexedTest( int32_t index, bool_t exec, char* &name, ch // Test written by Wally Wedel and emailed to me. void DateFormatTest::TestWallyWedel() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; /* * Instantiate a TimeZone so we can get the ids. */ @@ -163,7 +163,7 @@ DateFormatTest::TestEquals() void DateFormatTest::TestTwoDigitYearDSTParse() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat* fullFmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss.SSS zzz yyyy G", status); SimpleDateFormat *fmt = new SimpleDateFormat("dd-MMM-yy h:mm:ss 'o''clock' a z", Locale::ENGLISH, status); //DateFormat* fmt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, Locale::ENGLISH); @@ -242,7 +242,7 @@ DateFormatTest::fgCalendarToDateFormatField[] = { void DateFormatTest::TestFieldPosition(void) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DateFormat* dateFormats[4]; int32_t dateFormats_length = sizeof(dateFormats) / sizeof(dateFormats[0]); @@ -314,7 +314,7 @@ DateFormatTest::getFieldText(DateFormat* df, int32_t field, UDate date, UnicodeS void DateFormatTest::TestPartialParse994() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat* f = new SimpleDateFormat(status); UDate null = 0; tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:11:42", date(97, 1 - 1, 17, 10, 11, 42)); @@ -331,7 +331,7 @@ DateFormatTest::TestPartialParse994() void DateFormatTest::tryPat994(SimpleDateFormat* format, const char* pat, const char* str, UDate expected) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate null = 0; logln(UnicodeString("Pattern \"") + pat + "\" String \"" + str + "\""); //try { @@ -372,7 +372,7 @@ DateFormatTest::tryPat994(SimpleDateFormat* format, const char* pat, const char* void DateFormatTest::TestRunTogetherPattern985() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString format("yyyyMMddHHmmssSSS"); UnicodeString now, then; //bool_t flag; @@ -399,7 +399,7 @@ DateFormatTest::TestRunTogetherPattern985() void DateFormatTest::TestRunTogetherPattern917() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat* fmt; UnicodeString myDate; fmt = new SimpleDateFormat("yyyy/MM/dd", status); @@ -418,7 +418,7 @@ DateFormatTest::TestRunTogetherPattern917() void DateFormatTest::testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString pattern; logln((UnicodeString)"pattern=" + fmt->toPattern(pattern) + " string=" + str); Formattable o; @@ -447,7 +447,7 @@ DateFormatTest::testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expec void DateFormatTest::TestCzechMonths459() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DateFormat* fmt = DateFormat::createDateInstance(DateFormat::FULL, Locale("cs", "", "")); UnicodeString pattern; logln((UnicodeString)"Pattern " + ((SimpleDateFormat*) fmt)->toPattern(pattern)); @@ -484,7 +484,7 @@ DateFormatTest::TestCzechMonths459() void DateFormatTest::TestLetterDPattern212() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString dateString("1995-040.05:01:29"); UnicodeString bigD("yyyy-DDD.hh:mm:ss"); UnicodeString littleD("yyyy-ddd.hh:mm:ss"); @@ -515,7 +515,7 @@ DateFormatTest::TestLetterDPattern212() void DateFormatTest::TestDayOfYearPattern195() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate today = Calendar::getNow(); int32_t year,month,day,hour,min,sec; dateToFields(today,year,month,day,hour,min,sec); UDate expected = date(year, month, day); @@ -532,7 +532,7 @@ DateFormatTest::TestDayOfYearPattern195() void DateFormatTest::tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, UDate expected) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (pattern != 0) sdf.applyPattern(pattern); UnicodeString thePat; logln((UnicodeString)"pattern: " + sdf.toPattern(thePat)); @@ -560,7 +560,7 @@ DateFormatTest::tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, void DateFormatTest::TestQuotePattern161() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat* formatter = new SimpleDateFormat("MM/dd/yyyy 'at' hh:mm:ss a zzz", status); UDate currentTime_1 = date(97, Calendar::AUGUST, 13, 10, 42, 28); UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString); @@ -579,7 +579,7 @@ DateFormatTest::TestQuotePattern161() void DateFormatTest::TestBadInput135() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t looks[] = { DateFormat::SHORT, DateFormat::MEDIUM, DateFormat::LONG, DateFormat::FULL }; @@ -613,7 +613,7 @@ DateFormatTest::TestBadInput135() } //} //catch(ParseException e) { - else status = ZERO_ERROR; + else status = U_ZERO_ERROR; //} //catch(StringIndexOutOfBoundsException e) { // errln(prefix + "SHOULD NOT HAPPEN: " + (int)status); @@ -662,7 +662,7 @@ const char* DateFormatTest::inputStrings[] = { void DateFormatTest::TestBadInput135a() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat* dateParse = new SimpleDateFormat(status); const char* s; UDate date; @@ -680,7 +680,7 @@ DateFormatTest::TestBadInput135a() //catch(Exception ex) { else logln((UnicodeString)"Exception during parse: " + (int32_t)status); - status = ZERO_ERROR; + status = U_ZERO_ERROR; //} for (int32_t i = 0; i < sizeof(inputStrings)/sizeof(inputStrings[0]); i += (PFLENGTH + 1)) { ParsePosition parsePosition(0); @@ -741,7 +741,7 @@ DateFormatTest::TestTwoDigitYear() void DateFormatTest::parse2DigitYear(DateFormat& fmt, const char* str, UDate expected) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; //try { UDate d = fmt.parse(str, status); UnicodeString thePat; @@ -763,7 +763,7 @@ DateFormatTest::parse2DigitYear(DateFormat& fmt, const char* str, UDate expected void DateFormatTest::TestDateFormatZone061() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate date; DateFormat *formatter; date= 859248000000.0; @@ -808,7 +808,7 @@ TimeZone *testdefault = TimeZone::createDefault(); else errln("Test timezone should be GMT, not " + testtimezone); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // now try to use the default GMT time zone GregorianCalendar *greenwichcalendar = new GregorianCalendar(1997, 3, 4, 23, 0, status); diff --git a/icu4c/source/test/intltest/encoll.cpp b/icu4c/source/test/intltest/encoll.cpp index b9380629d30..fb9449337ae 100644 --- a/icu4c/source/test/intltest/encoll.cpp +++ b/icu4c/source/test/intltest/encoll.cpp @@ -34,7 +34,7 @@ CollationEnglishTest::CollationEnglishTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale::ENGLISH, status); } @@ -261,7 +261,7 @@ void CollationEnglishTest::doTest( UnicodeString source, UnicodeString target, C { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) diff --git a/icu4c/source/test/intltest/escoll.cpp b/icu4c/source/test/intltest/escoll.cpp index a16f8bdea95..f340dca696e 100644 --- a/icu4c/source/test/intltest/escoll.cpp +++ b/icu4c/source/test/intltest/escoll.cpp @@ -34,7 +34,7 @@ CollationSpanishTest::CollationSpanishTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale("es", "ES", ""),status); } @@ -84,7 +84,7 @@ void CollationSpanishTest::doTest( UnicodeString source, UnicodeString target, C { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) { diff --git a/icu4c/source/test/intltest/ficoll.cpp b/icu4c/source/test/intltest/ficoll.cpp index eb88f4218c8..d25e760e427 100644 --- a/icu4c/source/test/intltest/ficoll.cpp +++ b/icu4c/source/test/intltest/ficoll.cpp @@ -33,7 +33,7 @@ CollationFinnishTest::CollationFinnishTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale("fi", "FI", ""),status); } @@ -71,7 +71,7 @@ void CollationFinnishTest::doTest( UnicodeString source, UnicodeString target, C { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) { diff --git a/icu4c/source/test/intltest/frcoll.cpp b/icu4c/source/test/intltest/frcoll.cpp index 8d7247dae57..8eec42c7472 100644 --- a/icu4c/source/test/intltest/frcoll.cpp +++ b/icu4c/source/test/intltest/frcoll.cpp @@ -34,7 +34,7 @@ CollationFrenchTest::CollationFrenchTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale::FRANCE, status); } @@ -140,7 +140,7 @@ void CollationFrenchTest::doTest( UnicodeString source, UnicodeString target, Co { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) diff --git a/icu4c/source/test/intltest/g7coll.cpp b/icu4c/source/test/intltest/g7coll.cpp index ce4dd26ec7f..49afa423543 100644 --- a/icu4c/source/test/intltest/g7coll.cpp +++ b/icu4c/source/test/intltest/g7coll.cpp @@ -100,7 +100,7 @@ void G7CollationTest::doTest( Collator* myCollation, UnicodeString source, Unico { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) { @@ -119,7 +119,7 @@ void G7CollationTest::TestG7Locales( char* par ) { Collator *myCollation= 0; UnicodeString dispName; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator* tblColl1 = 0; myCollation = Collator::createInstance(locales[i], status); @@ -136,7 +136,7 @@ void G7CollationTest::TestG7Locales( char* par ) } const UnicodeString& defRules = ((RuleBasedCollator*)myCollation)->getRules(); - status = ZERO_ERROR; + status = U_ZERO_ERROR; tblColl1 = new RuleBasedCollator(((RuleBasedCollator*)myCollation)->getRules(), status); if (FAILURE(status)) { @@ -174,7 +174,7 @@ void G7CollationTest::TestG7Locales( char* par ) void G7CollationTest::TestDemo1( char* par ) { logln("Demo Test 1 : Create a new table collation with rules \"& Z < p, P\""); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator *col = Collator::createInstance(status); const UnicodeString baseRules = ((RuleBasedCollator*)col)->getRules(); UnicodeString newRules(" & Z < p, P"); @@ -203,7 +203,7 @@ void G7CollationTest::TestDemo1( char* par ) void G7CollationTest::TestDemo2( char* par ) { logln("Demo Test 2 : Create a new table collation with rules \"& C < ch , cH, Ch, CH\""); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator *col = Collator::createInstance(status); const UnicodeString baseRules = ((RuleBasedCollator*)col)->getRules(); UnicodeString newRules("& C < ch , cH, Ch, CH"); @@ -232,7 +232,7 @@ void G7CollationTest::TestDemo2( char* par ) void G7CollationTest::TestDemo3( char* par ) { logln("Demo Test 3 : Create a new table collation with rules \"& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'\""); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator *col = Collator::createInstance(status); const UnicodeString baseRules = ((RuleBasedCollator*)col)->getRules(); UnicodeString newRules = "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'"; @@ -261,7 +261,7 @@ void G7CollationTest::TestDemo3( char* par ) void G7CollationTest::TestDemo4( char* par ) { logln("Demo Test 4 : Create a new table collation with rules \" & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' \""); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator *col = Collator::createInstance(status); const UnicodeString baseRules = ((RuleBasedCollator*)col)->getRules(); UnicodeString newRules = " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' "; diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index 1a4614849d2..030fd6d1c6f 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -112,7 +112,7 @@ UnicodeString toString(const Formattable& f) { switch (f.getType()) { case Formattable::kDate: { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat fmt(status); if (SUCCESS(status)) { FieldPosition pos; diff --git a/icu4c/source/test/intltest/isocoll.cpp b/icu4c/source/test/intltest/isocoll.cpp index 34a65664a12..dda3c90cba8 100644 --- a/icu4c/source/test/intltest/isocoll.cpp +++ b/icu4c/source/test/intltest/isocoll.cpp @@ -7017,7 +7017,7 @@ void CollationISOTest::quickSort(CollationKey** keyArray, int *indexes, int lo0, CollationISOTest::CollationISOTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale::FRENCH, status); } @@ -7048,7 +7048,7 @@ void CollationISOTest::TestAll( char* par ) for (i = 0; i < n; i++) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; testArray[i] = new UnicodeString(testCases[i], 1); keyArray[i] = new CollationKey(); myCollation->getCollationKey(*testArray[i], *keyArray[i], status); diff --git a/icu4c/source/test/intltest/itercoll.cpp b/icu4c/source/test/intltest/itercoll.cpp index 382e22d52ee..fd16746b472 100644 --- a/icu4c/source/test/intltest/itercoll.cpp +++ b/icu4c/source/test/intltest/itercoll.cpp @@ -32,7 +32,7 @@ #define ARRAY_LENGTH(array) (sizeof array / sizeof array[0]) -static UErrorCode status = ZERO_ERROR; +static UErrorCode status = U_ZERO_ERROR; const UnicodeString CollationIteratorTest::test1 = "What subset of all possible test cases?"; const UnicodeString CollationIteratorTest::test2 = "has the highest probability of detecting"; @@ -55,7 +55,7 @@ CollationIteratorTest::~CollationIteratorTest() */ void CollationIteratorTest::TestPrevious(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; CollationElementIterator *iter = en_us->createCollationElementIterator(test1); // A basic test to see if it's working at all @@ -139,7 +139,7 @@ void CollationIteratorTest::TestOffset(char *par) // Now set the offset back to the beginning and see if it works CollationElementIterator *pristine = en_us->createCollationElementIterator(test1); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; iter->setOffset(0, status); @@ -166,7 +166,7 @@ void CollationIteratorTest::TestSetText(char *par) { CollationElementIterator *iter1 = en_us->createCollationElementIterator(test1); CollationElementIterator *iter2 = en_us->createCollationElementIterator(test2); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // Run through the second iterator just to exercise it int32_t c = iter2->next(status); @@ -238,7 +238,7 @@ void CollationIteratorTest::TestMaxExpansion(char *par) */ void CollationIteratorTest::TestClearBuffers(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = NULL; c = new RuleBasedCollator("< a < b < c & ab = d", status); @@ -318,7 +318,7 @@ void CollationIteratorTest::backAndForth(CollationElementIterator &iter) // Run through the iterator forwards and stick it into an array int32_t orderLength = 0; int32_t *orders = getOrders(iter, orderLength); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // Now go through it backwards and make sure we get the same values int32_t index = orderLength; @@ -384,7 +384,7 @@ void CollationIteratorTest::backAndForth(CollationElementIterator &iter) */ void CollationIteratorTest::verifyExpansion(UnicodeString rules, ExpansionRecord tests[], int32_t testCount) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *coll = NULL; coll = new RuleBasedCollator(rules, status); @@ -457,7 +457,7 @@ int32_t *CollationIteratorTest::getOrders(CollationElementIterator &iter, int32_ int32_t maxSize = 100; int32_t size = 0; int32_t *orders = new int32_t[maxSize]; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t order; while ((order = iter.next(status)) != CollationElementIterator::NULLORDER) @@ -495,7 +495,7 @@ int32_t *CollationIteratorTest::getOrders(CollationElementIterator &iter, int32_ UnicodeString &CollationIteratorTest::orderString(CollationElementIterator &iter, UnicodeString &target) { int32_t order; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; while ((order = iter.next(status)) != CollationElementIterator::NULLORDER) { @@ -510,7 +510,7 @@ UnicodeString &CollationIteratorTest::orderString(CollationElementIterator &iter void CollationIteratorTest::assertEqual(CollationElementIterator &i1, CollationElementIterator &i2) { int32_t c1, c2, count = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; do { diff --git a/icu4c/source/test/intltest/itformat.cpp b/icu4c/source/test/intltest/itformat.cpp index ce94c24774f..cb30a99ef5b 100644 --- a/icu4c/source/test/intltest/itformat.cpp +++ b/icu4c/source/test/intltest/itformat.cpp @@ -55,7 +55,7 @@ void IntlTestFormat::runIndexedTest( int32_t index, bool_t exec, char* &name, ch TimeZone *tz = TimeZone::createTimeZone("PST"); TimeZone::setDefault(*tz); delete tz; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale::setDefault( Locale::ENGLISH, status ); if (FAILURE(status)) { errln("itformat: couldn't set default Locale to ENGLISH!"); @@ -419,7 +419,7 @@ void IntlTestFormat::runIndexedTest( int32_t index, bool_t exec, char* &name, ch if (exec) { // restore saved Locale and TimeZone TimeZone::adoptDefault(saveDefaultTimeZone); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale::setDefault( saveDefaultLocale, status ); if (FAILURE(status)) { errln("itformat: couldn't re-set default Locale!"); diff --git a/icu4c/source/test/intltest/jacoll.cpp b/icu4c/source/test/intltest/jacoll.cpp index f605e9e68b2..1edc018a42c 100644 --- a/icu4c/source/test/intltest/jacoll.cpp +++ b/icu4c/source/test/intltest/jacoll.cpp @@ -33,7 +33,7 @@ CollationKanaTest::CollationKanaTest() : myCollation(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance(Locale::JAPAN, status); myCollation->setDecomposition(Normalizer::DECOMP); } @@ -89,7 +89,7 @@ void CollationKanaTest::doTest( UnicodeString source, UnicodeString target, Coll { Collator::EComparisonResult compareResult = myCollation->compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) { diff --git a/icu4c/source/test/intltest/loctest.cpp b/icu4c/source/test/intltest/loctest.cpp index 9c7131e4940..1ebd10c10f0 100644 --- a/icu4c/source/test/intltest/loctest.cpp +++ b/icu4c/source/test/intltest/loctest.cpp @@ -193,7 +193,7 @@ LocaleTest::TestDisplayNames() Locale french("fr", "FR"); Locale croatian("hr", "HR"); Locale greek("el", "GR"); - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; Locale::setDefault(english, err); if (FAILURE(err)) { @@ -424,7 +424,7 @@ void LocaleTest::TestDataDirectory() /* char oldDirectory[80]; const char* temp; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; UnicodeString testValue; temp = Locale::getDataDirectory(); @@ -639,7 +639,7 @@ LocaleTest::TestISO3Fallback() Locale test("xx", "YY"); bool_t gotException = FALSE; UnicodeString result; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; //try { result = test.getISO3Language(result, err); @@ -652,7 +652,7 @@ LocaleTest::TestISO3Fallback() errln("getISO3Language() on xx_YY returned " + result + " instead of throwing an exception"); gotException = FALSE; - err = ZERO_ERROR; + err = U_ZERO_ERROR; //try { result = test.getISO3Country(result, err); //} @@ -1004,7 +1004,7 @@ LocaleTest::TestAtypicalLocales() "Belgium" }; int32_t i; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale::setDefault(Locale::US, status); for (i = 0; i < 9; ++i) { UnicodeString name; @@ -1070,7 +1070,7 @@ LocaleTest::TestNullDefault() void LocaleTest::TestThaiCurrencyFormat() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *thaiCurrency = (DecimalFormat*)NumberFormat::createCurrencyInstance( Locale("th", "TH"), status); UChar posPrefix = 0x0e3f; @@ -1105,7 +1105,7 @@ LocaleTest::TestEuroSupport() UChar euro = 0x20ac; const UnicodeString EURO_CURRENCY(&euro, 1, 1); // Look for this UnicodeString in formatted Euro currency - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString temp; @@ -1194,7 +1194,7 @@ LocaleTest::Test4139940() { Locale mylocale("hu", "", ""); UDate mydate = date(98,3,13); // A Monday - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat df_full("EEEE", mylocale, status); UnicodeString str; FieldPosition pos(FieldPosition::DONT_CARE); @@ -1210,7 +1210,7 @@ LocaleTest::Test4139940() UDate LocaleTest::date(int32_t y, int32_t m, int32_t d, int32_t hr, int32_t min, int32_t sec) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(status); if (cal == 0) return 0.0; @@ -1231,7 +1231,7 @@ LocaleTest::date(int32_t y, int32_t m, int32_t d, int32_t hr, int32_t min, int32 void LocaleTest::Test4143951() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(Locale("ru", "", ""), status); if (cal->getFirstDayOfWeek() != Calendar::MONDAY) { errln("Fail: First day of week in Russia should be Monday"); @@ -1253,7 +1253,7 @@ LocaleTest::Test4147315() //try { UnicodeString result; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; locale.getISO3Country(result, err); UnicodeString temp; @@ -1277,7 +1277,7 @@ LocaleTest::Test4147317() //try { UnicodeString result; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; locale.getISO3Language(result, err); UnicodeString temp; @@ -1403,7 +1403,7 @@ LocaleTest::Test4105828() { Locale LOC [] = { Locale::CHINESE, Locale("zh", "CN", ""), Locale("zh", "TW", ""), Locale("zh", "HK", "") }; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; for (int32_t i = 0; i < 4; ++i) { NumberFormat *fmt = NumberFormat::createPercentInstance(LOC[i], status); if(FAILURE(status)) { diff --git a/icu4c/source/test/intltest/miscdtfm.cpp b/icu4c/source/test/intltest/miscdtfm.cpp index c15452c7f4b..41c5eab03c7 100644 --- a/icu4c/source/test/intltest/miscdtfm.cpp +++ b/icu4c/source/test/intltest/miscdtfm.cpp @@ -41,24 +41,6 @@ DateFormatMiscTests::runIndexedTest( int32_t index, bool_t exec, char* &name, ch } } -const char* -DateFormatMiscTests::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t DateFormatMiscTests::failure(UErrorCode status, const char* msg) { @@ -71,7 +53,7 @@ DateFormatMiscTests::failure(UErrorCode status, const char* msg) } /* - * @test @(#)$RCSfile: miscdtfm.cpp,v $ $Revision: 1.2 $ $Date: 1999/09/03 22:08:47 $ + * @test @(#)$RCSfile: miscdtfm.cpp,v $ $Revision: 1.3 $ $Date: 1999/10/07 00:07:52 $ * * @bug 4097450 */ @@ -132,7 +114,7 @@ DateFormatMiscTests::test4097450() FALSE }; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *formatter; SimpleDateFormat *resultFormatter = new SimpleDateFormat("yyyy", status); failure(status, "new SimpleDateFormat"); @@ -163,7 +145,7 @@ DateFormatMiscTests::test4097450() } /* - * @test @(#)$RCSfile: miscdtfm.cpp,v $ $Revision: 1.2 $ $Date: 1999/09/03 22:08:47 $ + * @test @(#)$RCSfile: miscdtfm.cpp,v $ $Revision: 1.3 $ $Date: 1999/10/07 00:07:52 $ * * @bug 4099975 */ @@ -171,7 +153,7 @@ DateFormatMiscTests::test4097450() void DateFormatMiscTests::test4099975() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DateFormatSymbols *symbols = new DateFormatSymbols(status); failure(status, "new DateFormatSymbols"); SimpleDateFormat *df = new SimpleDateFormat(UnicodeString("E hh:mm"), symbols, status); @@ -222,7 +204,7 @@ DateFormatMiscTests::test4117335() UnicodeString jstShort = "JST"; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DateFormatSymbols *symbols = new DateFormatSymbols(Locale::JAPAN, status); failure(status, "new DateFormatSymbols"); int32_t eraCount = 0; diff --git a/icu4c/source/test/intltest/miscdtfm.h b/icu4c/source/test/intltest/miscdtfm.h index fa1318fa0af..6d90aecbb45 100644 --- a/icu4c/source/test/intltest/miscdtfm.h +++ b/icu4c/source/test/intltest/miscdtfm.h @@ -30,7 +30,6 @@ public: void test4117335(void); protected: - const char* errorName(UErrorCode code); bool_t failure(UErrorCode status, const char* msg); }; diff --git a/icu4c/source/test/intltest/mnkytst.cpp b/icu4c/source/test/intltest/mnkytst.cpp index db83eacab25..a04c2989b92 100644 --- a/icu4c/source/test/intltest/mnkytst.cpp +++ b/icu4c/source/test/intltest/mnkytst.cpp @@ -49,7 +49,7 @@ const UnicodeString CollationMonkeyTest::source("-abcdefghijklmnopqrstuvwxyz#&^$ CollationMonkeyTest::CollationMonkeyTest() : myCollator(0) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; myCollator = Collator::createInstance(status); } @@ -100,7 +100,7 @@ void CollationMonkeyTest::TestCollationKey( char* par ) source.extract(MIN(t, tlen), MAX(t, tlen), subt); CollationKey collationKey1, collationKey2; - UErrorCode status1 = ZERO_ERROR, status2= ZERO_ERROR; + UErrorCode status1 = U_ZERO_ERROR, status2= U_ZERO_ERROR; myCollator->setStrength(Collator::TERTIARY); myCollator->getCollationKey(subs, collationKey1, status1); diff --git a/icu4c/source/test/intltest/msfmrgts.cpp b/icu4c/source/test/intltest/msfmrgts.cpp index 55af3fe4967..ca9b45dead4 100644 --- a/icu4c/source/test/intltest/msfmrgts.cpp +++ b/icu4c/source/test/intltest/msfmrgts.cpp @@ -56,24 +56,6 @@ MessageFormatRegressionTest::runIndexedTest( int32_t index, bool_t exec, char* & } } -const char* -MessageFormatRegressionTest::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t MessageFormatRegressionTest::failure(UErrorCode status, const char* msg) { @@ -100,7 +82,7 @@ void MessageFormatRegressionTest::Test4074764() { //length of the string without param while it is not so //in the other case. - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; MessageFormat *messageFormatter = new MessageFormat("", status); failure(status, "couldn't create MessageFormat"); @@ -165,7 +147,7 @@ void MessageFormatRegressionTest::Test4074764() { */ void MessageFormatRegressionTest::Test4058973() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; MessageFormat *fmt = new MessageFormat("{0,choice,0#no files|1#one file|1< {0,number,integer} files}", status); failure(status, "new MessageFormat"); @@ -185,7 +167,7 @@ void MessageFormatRegressionTest::Test4058973() */ void MessageFormatRegressionTest::Test4031438() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString pattern1("Impossible {1} has occurred -- status code is {0} and message is {2}."); UnicodeString pattern2("Double '' Quotes {0} test and quoted '{1}' test plus 'other {2} stuff'."); @@ -282,7 +264,7 @@ void MessageFormatRegressionTest::Test4052223() errln("ParsePosition.getErrorIndex initialization failed."); } - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; MessageFormat *fmt = new MessageFormat("There are {0} apples growing on the {1} tree.", status); failure(status, "new MessageFormat"); UnicodeString str("There is one apple growing on the peach tree."); @@ -333,7 +315,7 @@ void MessageFormatRegressionTest::Test4104976() UnicodeString("xyz"), UnicodeString("abc") }; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; ChoiceFormat *cf = new ChoiceFormat(limits, formats, status); failure(status, "new ChoiceFormat"); //try { @@ -449,7 +431,7 @@ void MessageFormatRegressionTest::Test4111739() void MessageFormatRegressionTest::Test4114743() { UnicodeString originalPattern("initial pattern"); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; MessageFormat *mf = new MessageFormat(originalPattern, status); failure(status, "new MessageFormat"); //try { @@ -474,7 +456,7 @@ void MessageFormatRegressionTest::Test4116444() (UnicodeString) "{0,date,short}" }; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; MessageFormat *mf = new MessageFormat("", status); failure(status, "new MessageFormat"); @@ -521,7 +503,7 @@ void MessageFormatRegressionTest::Test4116444() void MessageFormatRegressionTest::Test4114739() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; MessageFormat *mf = new MessageFormat("<{0}>", status); failure(status, "new MessageFormat"); @@ -555,7 +537,7 @@ void MessageFormatRegressionTest::Test4114739() void MessageFormatRegressionTest::Test4113018() { UnicodeString originalPattern("initial pattern"); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; MessageFormat *mf = new MessageFormat(originalPattern, status); failure(status, "new messageFormat"); UnicodeString illegalPattern("format: {0, xxxYYY}"); @@ -578,7 +560,7 @@ void MessageFormatRegressionTest::Test4113018() */ void MessageFormatRegressionTest::Test4106661() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; ChoiceFormat *fmt = new ChoiceFormat( "-1#are negative| 0#are no or fraction | 1#is one |1.0 format(l, res4, pos2); logln((UnicodeString) "" + (int32_t) l + " formatted to " + res4); - status = ZERO_ERROR; + status = U_ZERO_ERROR; res5 = cur_fr->format(fD, res5, pos3, status); if(FAILURE(status)) { errln("ERROR: format(Formattable [double]) failed"); } logln((UnicodeString) "" + (int32_t) fD.getDouble() + " formatted to " + res5); - status = ZERO_ERROR; + status = U_ZERO_ERROR; res6 = cur_fr->format(fL, res6, pos4, status); if(FAILURE(status)) { errln("ERROR: format(Formattable [long]) failed"); @@ -153,7 +153,7 @@ void IntlTestNumberFormatAPI::testAPI(char *par) } logln(text + " parsed into " + (int32_t) result2.getDouble()); - status = ZERO_ERROR; + status = U_ZERO_ERROR; fr->parse(text, result3, status); if(FAILURE(status)) { errln("ERROR: parse() failed"); @@ -212,7 +212,7 @@ void IntlTestNumberFormatAPI::testAPI(char *par) logln("Testing getStaticClassID()"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; NumberFormat *test = new DecimalFormat(status); if(FAILURE(status)) { errln("ERROR: Couldn't create a NumberFormat"); diff --git a/icu4c/source/test/intltest/nmfmtrt.cpp b/icu4c/source/test/intltest/nmfmtrt.cpp index 82f46710fc8..2d75e7d4838 100644 --- a/icu4c/source/test/intltest/nmfmtrt.cpp +++ b/icu4c/source/test/intltest/nmfmtrt.cpp @@ -41,24 +41,6 @@ void NumberFormatRoundTripTest::runIndexedTest( int32_t index, bool_t exec, char } } -const char* -NumberFormatRoundTripTest::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t NumberFormatRoundTripTest::failure(UErrorCode status, const char* msg) { @@ -75,7 +57,7 @@ NumberFormatRoundTripTest::start() { // test(NumberFormat.getInstance(new Locale("sr", "", ""))); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *fmt = NULL; @@ -205,7 +187,7 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt, const Formattable& value) { fmt->setMaximumFractionDigits(999); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString s, s2, temp; if(isDouble(value)) s = fmt->format(value.getDouble(), s); diff --git a/icu4c/source/test/intltest/nmfmtrt.h b/icu4c/source/test/intltest/nmfmtrt.h index 36132e56e27..a611af708aa 100644 --- a/icu4c/source/test/intltest/nmfmtrt.h +++ b/icu4c/source/test/intltest/nmfmtrt.h @@ -84,7 +84,6 @@ static double randFraction() } protected: - const char* errorName(UErrorCode code); bool_t failure(UErrorCode status, const char* msg); }; diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp index 7364460906d..38fb7898dba 100644 --- a/icu4c/source/test/intltest/numfmtst.cpp +++ b/icu4c/source/test/intltest/numfmtst.cpp @@ -55,7 +55,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, bool_t exec, char* &name, void NumberFormatTest::TestPatterns() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols sym(Locale::US, status); if (FAILURE(status)) { errln("FAIL: Could not construct DecimalFormatSymbols"); return; } @@ -65,7 +65,7 @@ NumberFormatTest::TestPatterns() const char* num[] = { "0", "0.", ".0", "0" }; for (int32_t i=0; i format(1234.56, s); @@ -293,7 +293,7 @@ NumberFormatTest::escape(UnicodeString& s) void NumberFormatTest::TestCurrency() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat* currencyFmt = NumberFormat::createCurrencyInstance(Locale::CANADA_FRENCH, status); UnicodeString s; currencyFmt->format(1.50, s); logln((UnicodeString)"Un pauvre ici a..........." + s); @@ -322,7 +322,7 @@ NumberFormatTest::TestCurrency() void NumberFormatTest::TestParse() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString arg("0"); DecimalFormat* format = new DecimalFormat("00", status); //try { @@ -346,7 +346,7 @@ NumberFormatTest::TestParse() void NumberFormatTest::TestRounding487() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(status); roundingTest(*nf, 0.00159999, 4, "0.0016"); roundingTest(*nf, 0.00995, 4, "0.01"); @@ -374,7 +374,7 @@ NumberFormatTest::roundingTest(NumberFormat& nf, double x, int32_t maxFractionDi * Upgrade to alphaWorks */ void NumberFormatTest::expect(NumberFormat& fmt, const UnicodeString& str, int32_t n) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Formattable num; fmt.parse(str, num, status); CHECK(status, "NumberFormat.parse"); @@ -399,7 +399,7 @@ void NumberFormatTest::expect(NumberFormat& fmt, const Formattable& n, const UnicodeString& exp) { UnicodeString saw; FieldPosition pos; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; fmt.format(n, saw, pos, status); CHECK(status, "format"); UnicodeString pat; @@ -427,7 +427,7 @@ void NumberFormatTest::expect(NumberFormat* fmt, const Formattable& n, * Upgrade to alphaWorks */ void NumberFormatTest::TestExponent() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols US(Locale::US, status); CHECK(status, "DecimalFormatSymbols constructor"); DecimalFormat fmt1(UnicodeString("0.###E0"), US, status); @@ -446,7 +446,7 @@ void NumberFormatTest::TestExponent() { * Upgrade to alphaWorks */ void NumberFormatTest::TestScientific() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols US(Locale::US, status); CHECK(status, "DecimalFormatSymbols constructor"); @@ -614,7 +614,7 @@ void NumberFormatTest::TestScientific() { * Upgrade to alphaWorks */ void NumberFormatTest::TestPad() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols US(Locale::US, status); CHECK(status, "DecimalFormatSymbols constructor"); @@ -636,7 +636,7 @@ void NumberFormatTest::TestPad() { * Upgrade to alphaWorks */ void NumberFormatTest::TestPatterns2() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols US(Locale::US, status); CHECK(status, "DecimalFormatSymbols constructor"); @@ -703,7 +703,7 @@ void NumberFormatTest::expectPad(DecimalFormat& fmt, const UnicodeString& pat, int32_t pos, int32_t width, UChar pad) { int32_t apos = 0, awidth = 0; UChar apad = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; fmt.applyPattern(pat, status); if (SUCCESS(status)) { apos = fmt.getPadPosition(); diff --git a/icu4c/source/test/intltest/numrgts.cpp b/icu4c/source/test/intltest/numrgts.cpp index 88694f524ca..4cef8d633bb 100644 --- a/icu4c/source/test/intltest/numrgts.cpp +++ b/icu4c/source/test/intltest/numrgts.cpp @@ -97,24 +97,6 @@ NumberFormatRegressionTest::runIndexedTest( int32_t index, bool_t exec, char* &n } } -const char* -NumberFormatRegressionTest::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg) { @@ -209,7 +191,7 @@ void NumberFormatRegressionTest::Test4074620() void NumberFormatRegressionTest::Test4088161 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); double d = 100; @@ -238,7 +220,7 @@ void NumberFormatRegressionTest::Test4088161 () */ void NumberFormatRegressionTest::Test4087245 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols *symbols = new DecimalFormatSymbols(status); failure(status, "new DecimalFormatSymbols"); // {sfb} One note about this test: if you pass in a pointer @@ -267,7 +249,7 @@ void NumberFormatRegressionTest::Test4087245 () */ void NumberFormatRegressionTest::Test4087535 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); df->setMinimumIntegerDigits(0); @@ -292,7 +274,7 @@ void NumberFormatRegressionTest::Test4087535 () // {sfb} how do I tell if this worked? --> FieldPosition doesn't change ?? void NumberFormatRegressionTest::Test4088503 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); df->setGroupingSize(0); @@ -322,7 +304,7 @@ float NumberFormatRegressionTest::assignFloatValue(float returnfloat) { logln(UnicodeString(" VALUE ") + returnfloat); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nfcommon = NumberFormat::createCurrencyInstance(Locale::US, status); failure(status, "NumberFormat::createCurrencyInstance"); nfcommon->setGroupingUsed(FALSE); @@ -349,7 +331,7 @@ NumberFormatRegressionTest::assignFloatValue(float returnfloat) */ void NumberFormatRegressionTest::Test4059870() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *format = new DecimalFormat("00", status); failure(status, "new Decimalformat"); //try { @@ -372,7 +354,7 @@ void NumberFormatRegressionTest::Test4059870() // {sfb} this is silly in C++ void NumberFormatRegressionTest::Test4083018 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols *dfs = new DecimalFormatSymbols(status); failure(status, "new DecimalFormatSymbols"); //try { @@ -393,7 +375,7 @@ void NumberFormatRegressionTest::Test4083018 () void NumberFormatRegressionTest::Test4071492 () { double x = 0.00159999; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(status); failure(status, "NumberFormat::createInstance"); nf->setMaximumFractionDigits(4); @@ -414,7 +396,7 @@ void NumberFormatRegressionTest::Test4071492 () */ void NumberFormatRegressionTest::Test4086575() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf1 = NumberFormat::createInstance(Locale::FRANCE, status); failure(status, "NumberFormat::createInstance"); @@ -489,7 +471,7 @@ void NumberFormatRegressionTest::Test4068693() { logln("----- Test Application -----"); ParsePosition pos(0); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); Formattable d; @@ -540,7 +522,7 @@ void NumberFormatRegressionTest::Test4069754() */ void NumberFormatRegressionTest::Test4087251 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); //try { @@ -575,7 +557,7 @@ void NumberFormatRegressionTest::Test4090489 () // {sfb} sprintf doesn't correctly handle the double, so there is nothing // that NumberFormat can do. For some reason, it does not format the last 1. -/* UErrorCode status = ZERO_ERROR; +/* UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); df->setMinimumFractionDigits(10); @@ -601,7 +583,7 @@ void NumberFormatRegressionTest::Test4090504 () { double d = 1; logln(UnicodeString("d = ") + d); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); UnicodeString sb; @@ -625,7 +607,7 @@ void NumberFormatRegressionTest::Test4090504 () */ void NumberFormatRegressionTest::Test4095713 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFOrmat"); UnicodeString str("0.1234"); @@ -646,7 +628,7 @@ void NumberFormatRegressionTest::Test4095713 () // {sfb} not sure what to do with this one void NumberFormatRegressionTest::Test4092561 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); @@ -667,7 +649,7 @@ void NumberFormatRegressionTest::Test4092561 () */ void NumberFormatRegressionTest::Test4092480 () { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *dfFoo = new DecimalFormat(UnicodeString("000"), status); failure(status, "new DecimalFormat"); @@ -716,7 +698,7 @@ void NumberFormatRegressionTest::Test4092480 () */ void NumberFormatRegressionTest::Test4087244 () { Locale *de = new Locale(UnicodeString("pt"), UnicodeString("PT")); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createCurrencyInstance(*de, status); if (nf->getDynamicClassID() != DecimalFormat::getStaticClassID()) { errln("expected DecimalFormat!"); @@ -775,7 +757,7 @@ void NumberFormatRegressionTest::Test4070798 () UnicodeString expectedCurrency(chars2, 10, 10); UnicodeString expectedPercent(chars3, 9, 9); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; formatter = NumberFormat::createInstance(Locale::FRANCE, status); failure(status, "NumberFormat::createNumberInstance"); tempString = formatter->format (-5789.9876, tempString); @@ -843,7 +825,7 @@ void NumberFormatRegressionTest::Test4071005 () UnicodeString expectedCurrency(chars2, 10, 10); UnicodeString expectedPercent(chars3, 9, 9); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; formatter = NumberFormat::createInstance(Locale::CANADA_FRENCH, status); failure(status, "NumberFormat::createNumberInstance"); tempString = formatter->format (-5789.9876, tempString); @@ -903,7 +885,7 @@ void NumberFormatRegressionTest::Test4071014 () UnicodeString expectedCurrency("5.789,99 DM"); UnicodeString expectedPercent("-578.999%"); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; formatter = NumberFormat::createInstance(Locale::GERMANY, status); failure(status, "NumberFormat::createNumberInstance"); tempString.remove(); @@ -963,7 +945,7 @@ void NumberFormatRegressionTest::Test4071859 () UnicodeString expectedCurrency("-L. 5.790"); UnicodeString expectedPercent("-578.999%"); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; formatter = NumberFormat::createInstance(Locale::ITALY, status); failure(status, "NumberFormat::createNumberInstance"); tempString = formatter->format (-5789.9876, tempString); @@ -1011,7 +993,7 @@ void NumberFormatRegressionTest::Test4071859 () */ void NumberFormatRegressionTest::Test4093610() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat("#0.#", status); failure(status, "new DecimalFormat"); UnicodeString s("12.4"); @@ -1052,7 +1034,7 @@ void NumberFormatRegressionTest::roundingTest(DecimalFormat *df, double x, Unico void NumberFormatRegressionTest::Test4098741() { //try { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *fmt = NumberFormat::createPercentInstance(status); fmt->setMaximumFractionDigits(20); UnicodeString temp; @@ -1070,7 +1052,7 @@ void NumberFormatRegressionTest::Test4098741() void NumberFormatRegressionTest::Test4074454() { //try { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *fmt = new DecimalFormat("#,#00.00;-#.#", status); failure(status, "new DecimalFormat"); logln("Inconsistent negative pattern is fine."); @@ -1110,7 +1092,7 @@ void NumberFormatRegressionTest::Test4074454() void NumberFormatRegressionTest::Test4099404() { //try { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *fmt = new DecimalFormat(UnicodeString("000.0#0"), status); if(! FAILURE(status)) errln(UnicodeString("Bug 4099404 failed applying illegal pattern \"000.0#0\"")); @@ -1134,7 +1116,7 @@ void NumberFormatRegressionTest::Test4099404() */ void NumberFormatRegressionTest::Test4101481() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *sdf = new DecimalFormat(UnicodeString("#,##0"), status); failure(status, "new DecimalFormat"); if (sdf->getMinimumIntegerDigits() != 1) @@ -1146,7 +1128,7 @@ void NumberFormatRegressionTest::Test4101481() void NumberFormatRegressionTest::Test4052223() { //try { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *fmt = new DecimalFormat(UnicodeString("#,#00.00"), status); failure(status, "new DecimalFormat"); Formattable num; @@ -1163,7 +1145,7 @@ void NumberFormatRegressionTest::Test4052223() */ void NumberFormatRegressionTest::Test4061302() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols *fmt = new DecimalFormatSymbols(status); failure(status, "new DecimalFormatSymbols"); UnicodeString currency; @@ -1198,7 +1180,7 @@ void NumberFormatRegressionTest::Test4061302() */ void NumberFormatRegressionTest::Test4062486() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *fmt = new DecimalFormat(UnicodeString("#,##0.00"), status); failure(status, "new DecimalFormat"); UnicodeString formatted; @@ -1220,7 +1202,7 @@ void NumberFormatRegressionTest::Test4062486() */ void NumberFormatRegressionTest::Test4108738() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols *syms = new DecimalFormatSymbols(Locale::US, status); failure(status, "new DecimalFormatSymbols"); DecimalFormat *df = new DecimalFormat("#,##0.###", syms, status); @@ -1256,7 +1238,7 @@ void NumberFormatRegressionTest::Test4108738() */ void NumberFormatRegressionTest::Test4106658() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); // Corrected; see 4147706 failure(status, "new DecimalFormat"); #if defined(WIN32) || defined(HPUX) @@ -1285,7 +1267,7 @@ void NumberFormatRegressionTest::Test4106658() */ void NumberFormatRegressionTest::Test4106662() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); UnicodeString text("x"); @@ -1314,7 +1296,7 @@ void NumberFormatRegressionTest::Test4106662() */ void NumberFormatRegressionTest::Test4114639() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *format = NumberFormat::createInstance(status); failure(status, "NumberFormat::createInstance"); UnicodeString text("time 10:x"); @@ -1332,7 +1314,7 @@ void NumberFormatRegressionTest::Test4114639() */ void NumberFormatRegressionTest::Test4106664() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); // {sfb} long in java is 64 bits @@ -1361,7 +1343,7 @@ void NumberFormatRegressionTest::Test4106664() */ void NumberFormatRegressionTest::Test4106667() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(status); failure(status, "new DecimalFormat"); UChar foo [] = { 0x002B }; @@ -1388,7 +1370,7 @@ void NumberFormatRegressionTest::Test4106667() */ void NumberFormatRegressionTest::Test4110936() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(status); failure(status, "NumberFormat::createInstance"); nf->setMaximumIntegerDigits(128); @@ -1413,7 +1395,7 @@ void NumberFormatRegressionTest::Test4122840() const Locale *locales = Locale::getAvailableLocales(count); for (int i = 0; i < count; i++) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; ResourceBundle *rb = new ResourceBundle( icu_getDefaultDataDirectory()/*"java.text.resources.LocaleElements"*/, locales[i], status); @@ -1503,7 +1485,7 @@ void NumberFormatRegressionTest::Test4122840() */ void NumberFormatRegressionTest::Test4125885() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; double rate = 12.34; DecimalFormat *formatDec = new DecimalFormat ("000.00", status); failure(status, "new DecimalFormat"); @@ -1533,7 +1515,7 @@ void NumberFormatRegressionTest::Test4125885() */ void NumberFormatRegressionTest::Test4134034() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *nf = new DecimalFormat("##,###,###.00", status); failure(status, "new DecimalFormat"); @@ -1592,7 +1574,7 @@ void NumberFormatRegressionTest::Test4134300() { for (int i=0; i< 10; i+=2) { UnicodeString result; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat(DATA[i], status); failure(status, "new DecimalFormat"); FieldPosition pos(FieldPosition::DONT_CARE); @@ -1615,7 +1597,7 @@ void NumberFormatRegressionTest::Test4134300() { */ void NumberFormatRegressionTest::Test4140009() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols *syms = new DecimalFormatSymbols(Locale::ENGLISH, status); failure(status, "new DecimalFormatSymbols"); DecimalFormat *f = new DecimalFormat(UnicodeString(""), syms, status); @@ -1656,7 +1638,7 @@ void NumberFormatRegressionTest::Test4141750() { */ void NumberFormatRegressionTest::Test4145457() { //try { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nff = NumberFormat::createInstance(status); failure(status, "NumberFormat::createInstance"); if(nff->getDynamicClassID() != DecimalFormat::getStaticClassID()) { @@ -1730,7 +1712,7 @@ void NumberFormatRegressionTest::Test4145457() { */ void NumberFormatRegressionTest::Test4147295() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *sdf = new DecimalFormat(status); UnicodeString pattern("#,###"); logln("Applying pattern \"" + pattern + "\""); @@ -1756,7 +1738,7 @@ void NumberFormatRegressionTest::Test4147295() */ void NumberFormatRegressionTest::Test4147706() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat *df = new DecimalFormat("#,##0.0##", status); failure(status, "new DecimalFormat"); DecimalFormatSymbols *syms = new DecimalFormatSymbols(Locale::ENGLISH, status); @@ -1808,7 +1790,7 @@ NumberFormatRegressionTest::Test4162198() { // for some reason, DBL_MAX will not round trip. (bug in sprintf/atof) double dbl = LONG_MAX * 1000.0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *f = NumberFormat::createInstance(status); if(FAILURE(status)) { errln("Couldn't create number format"); @@ -1844,7 +1826,7 @@ NumberFormatRegressionTest::Test4162198() void NumberFormatRegressionTest::Test4162852() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; for(int32_t i=0; i < 2; ++i) { NumberFormat *f = (i == 0) ? NumberFormat::createInstance(status) : NumberFormat::createPercentInstance(status); @@ -1879,7 +1861,7 @@ static double _u_abs(double a) { return a<0?-a:a; } * NumberFormat truncates data */ void NumberFormatRegressionTest::Test4167494() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *fmt = NumberFormat::createInstance(Locale::US, status); failure(status, "NumberFormat::createInstance"); @@ -1912,7 +1894,7 @@ void NumberFormatRegressionTest::Test4167494() { * DecimalFormat.parse() fails when ParseIntegerOnly set to true */ void NumberFormatRegressionTest::Test4170798() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(Locale::US, status); failure(status, "NumberFormat::createInstance"); if(nf->getDynamicClassID() != DecimalFormat::getStaticClassID()) { @@ -1947,7 +1929,7 @@ void NumberFormatRegressionTest::Test4176114() { "0,000,000,000,000.0000", "#0,000,000,000,000.0000", // Reported }; int DATA_length = sizeof(DATA) / sizeof(DATA[0]); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString s; for (int i=0; i setMaximumFractionDigits(2); @@ -2233,7 +2215,7 @@ void NumberFormatRegressionTest::Test4217661() { * alphaWorks upgrade */ void NumberFormatRegressionTest::Test4161100() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(Locale::US, status); failure(status, "createInstance"); nf->setMinimumFractionDigits(1); @@ -2255,7 +2237,7 @@ void NumberFormatRegressionTest::Test4161100() { * Formatting .5 rounds to "1" instead of "0". (Regression in 1.2.2 RC1) */ void NumberFormatRegressionTest::Test4243011() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols sym(Locale::US, status); failure(status, "DecimalFormatSymbols ct"); DecimalFormat fmt(UnicodeString("0."), sym, status); @@ -2285,7 +2267,7 @@ void NumberFormatRegressionTest::Test4243011() { * (Regression in 1.2.2 RC1) */ void NumberFormatRegressionTest::Test4243108() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols sym(Locale::US, status); failure(status, "DecimalFormatSymbols ct"); DecimalFormat fmt(UnicodeString("#.#"), sym, status); diff --git a/icu4c/source/test/intltest/numrgts.h b/icu4c/source/test/intltest/numrgts.h index 3c0c779d98d..f0db5473eb0 100644 --- a/icu4c/source/test/intltest/numrgts.h +++ b/icu4c/source/test/intltest/numrgts.h @@ -96,7 +96,6 @@ public: void Test4243108(); protected: - const char* errorName(UErrorCode code); bool_t failure(UErrorCode status, const UnicodeString& msg); }; diff --git a/icu4c/source/test/intltest/pptest.cpp b/icu4c/source/test/intltest/pptest.cpp index 56fcc8bdd9c..aa51175d176 100644 --- a/icu4c/source/test/intltest/pptest.cpp +++ b/icu4c/source/test/intltest/pptest.cpp @@ -33,24 +33,6 @@ void ParsePositionTest::runIndexedTest( int32_t index, bool_t exec, char* &name, } } -const char* -ParsePositionTest::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t ParsePositionTest::failure(UErrorCode status, const char* msg) { @@ -172,7 +154,7 @@ void ParsePositionTest::TestFieldPosition_example() 1.23456789}; int dNumSize = 9; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(status); failure(status, "NumberFormat::createInstance"); diff --git a/icu4c/source/test/intltest/pptest.h b/icu4c/source/test/intltest/pptest.h index 6a99413c2fd..d04d80e07a9 100644 --- a/icu4c/source/test/intltest/pptest.h +++ b/icu4c/source/test/intltest/pptest.h @@ -31,7 +31,6 @@ public: void Test4109023(void); protected: - const char* errorName(UErrorCode code); bool_t failure(UErrorCode status, const char* msg); }; diff --git a/icu4c/source/test/intltest/regcoll.cpp b/icu4c/source/test/intltest/regcoll.cpp index d6984a86a7a..a6b1e97d5bd 100644 --- a/icu4c/source/test/intltest/regcoll.cpp +++ b/icu4c/source/test/intltest/regcoll.cpp @@ -32,7 +32,7 @@ #define ARRAY_LENGTH(array) (sizeof array / sizeof array[0]) -static UErrorCode status = ZERO_ERROR; +static UErrorCode status = U_ZERO_ERROR; const UnicodeString CollationRegressionTest::test1 = "XFILE What subset of all possible test cases has the highest probability of detecting the most errors?"; const UnicodeString CollationRegressionTest::test2 = "Xf ile What subset of all possible test cases has the lowest probability of detecting the least errors?"; @@ -58,7 +58,7 @@ void CollationRegressionTest::Test4048446(char *par) { CollationElementIterator *i1 = en_us->createCollationElementIterator(test1); CollationElementIterator *i2 = en_us->createCollationElementIterator(test1); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (i1 == NULL|| i2 == NULL) { @@ -104,7 +104,7 @@ void CollationRegressionTest::Test4051866(char *par) */ UnicodeString rules; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; rules += "< o "; rules += "& oe ,o"; @@ -249,7 +249,7 @@ void CollationRegressionTest::Test4058613(char *par) // locale Locale oldDefault = Locale::getDefault(); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale::setDefault(Locale::KOREAN, status); @@ -290,7 +290,7 @@ void CollationRegressionTest::Test4058613(char *par) // void CollationRegressionTest::Test4059820(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = NULL; UnicodeString rules = "< a < b , c/a < d < z"; @@ -318,7 +318,7 @@ void CollationRegressionTest::Test4059820(char *par) // void CollationRegressionTest::Test4060154(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString rules; rules += "< g, G < h, H < i, I < j, J"; @@ -389,7 +389,7 @@ void CollationRegressionTest::Test4060154(char *par) // void CollationRegressionTest::Test4062418(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = NULL; @@ -469,7 +469,7 @@ void CollationRegressionTest::Test4066189(char *par) // void CollationRegressionTest::Test4066696(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = NULL; c = (RuleBasedCollator *)Collator::createInstance(Locale::FRANCE, status); @@ -555,7 +555,7 @@ void CollationRegressionTest::Test4079231(char *par) // void CollationRegressionTest::Test4078588(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *rbc = new RuleBasedCollator("< a < bb", status); if (rbc == NULL || FAILURE(status)) @@ -613,7 +613,7 @@ void CollationRegressionTest::Test4081866(char *par) // void CollationRegressionTest::Test4087241(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale da_DK("da", "DK"); RuleBasedCollator *c = NULL; @@ -666,7 +666,7 @@ void CollationRegressionTest::Test4087243(char *par) // void CollationRegressionTest::Test4092260(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale el("el", ""); Collator *c = NULL; @@ -693,7 +693,7 @@ void CollationRegressionTest::Test4092260(char *par) // void CollationRegressionTest::Test4095316(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale el_GR("el", "GR"); Collator *c = Collator::createInstance(el_GR, status); @@ -720,7 +720,7 @@ void CollationRegressionTest::Test4095316(char *par) // void CollationRegressionTest::Test4101940(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = NULL; UnicodeString rules = "< a < b"; UnicodeString nothing = ""; @@ -810,7 +810,7 @@ void CollationRegressionTest::Test4114076(char *par) // void CollationRegressionTest::Test4124632(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator *coll = NULL; coll = Collator::createInstance(Locale::JAPAN, status); @@ -840,7 +840,7 @@ void CollationRegressionTest::Test4124632(char *par) // void CollationRegressionTest::Test4132736(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Collator *c = NULL; @@ -926,7 +926,7 @@ void CollationRegressionTest::Test4141640(char *par) // try to instantiate one for every locale available on the system // in order to prevent this sort of bug from cropping up in the future // - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t i, localeCount; const Locale *locales = Locale::getAvailableLocales(localeCount); @@ -962,7 +962,7 @@ void CollationRegressionTest::Test4139572(char *par) // (and then translated to C++ ;-) // // create spanish locale and collator - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale l("es", "es"); Collator *col = NULL; @@ -1034,7 +1034,7 @@ void CollationRegressionTest::Test4146160(char *par) // Use a custom collator class whose createCollationElementIterator // methods increment a count.... // - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; CollationKey key; My4146160Collator::count = 0; @@ -1109,7 +1109,7 @@ void CollationRegressionTest::compareArray(Collator &c, Collator::EComparisonResult compareResult = c.compare(source, target); CollationKey sourceKey, targetKey; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; c.getCollationKey(source, sourceKey, status); @@ -1138,7 +1138,7 @@ void CollationRegressionTest::compareArray(Collator &c, void CollationRegressionTest::assertEqual(CollationElementIterator &i1, CollationElementIterator &i2) { int32_t c1, c2, count = 0; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; do { diff --git a/icu4c/source/test/intltest/restest.cpp b/icu4c/source/test/intltest/restest.cpp index 6169e03baf8..f2f5b55e960 100644 --- a/icu4c/source/test/intltest/restest.cpp +++ b/icu4c/source/test/intltest/restest.cpp @@ -112,12 +112,12 @@ param[] = // "IN" means inherits // "NE" or "ne" means "does not exist" - { "default", 0, ZERO_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, - { "te", 0, ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN", 0, ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "te_NE", 0, USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN_NE", 0, USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "ne", 0, USING_DEFAULT_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } + { "default", 0, U_ZERO_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, + { "te", 0, U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN", 0, U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "te_NE", 0, U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN_NE", 0, U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "ne", 0, U_USING_DEFAULT_ERROR, e_Default, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } }; int32_t bundles_count = sizeof(param) / sizeof(param[0]); @@ -247,7 +247,7 @@ void ResourceBundleTest::TestConstruction() { { - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; const char *directory; Locale locale("te", "IN"); @@ -295,7 +295,7 @@ ResourceBundleTest::TestConstruction() errln("getVersionNumber() failed"); } { - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; const char *directory; Locale locale("te", "IN"); @@ -355,7 +355,7 @@ ResourceBundleTest::testTag(const char* frag, action = "Constructor for "; action += param[i].name; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; ResourceBundle theBundle( directory, *param[i].locale, status); CONFIRM_UErrorCode(status,param[i].expected_constructor_status); @@ -369,17 +369,17 @@ ResourceBundleTest::testTag(const char* frag, actual_bundle = i; - UErrorCode expected_resource_status = MISSING_RESOURCE_ERROR; + UErrorCode expected_resource_status = U_MISSING_RESOURCE_ERROR; for (j=e_te_IN; j>=e_Default; --j) { if (is_in[j] && param[i].inherits[j]) { if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */ - expected_resource_status = ZERO_ERROR; + expected_resource_status = U_ZERO_ERROR; else if(j == 0) - expected_resource_status = USING_DEFAULT_ERROR; + expected_resource_status = U_USING_DEFAULT_ERROR; else - expected_resource_status = USING_FALLBACK_ERROR; + expected_resource_status = U_USING_FALLBACK_ERROR; break; } @@ -409,7 +409,7 @@ ResourceBundleTest::testTag(const char* frag, tag += frag; UnicodeString string(kERROR); - status = ZERO_ERROR; + status = U_ZERO_ERROR; theBundle.getString(tag, string, status); CONFIRM_UErrorCode(status, expected_resource_status); @@ -431,7 +431,7 @@ ResourceBundleTest::testTag(const char* frag, tag += frag; int32_t count = kERROR_COUNT; - status = ZERO_ERROR; + status = U_ZERO_ERROR; const UnicodeString* array = theBundle.getStringArray(tag, count, status); CONFIRM_UErrorCode(status,expected_resource_status); @@ -466,10 +466,10 @@ ResourceBundleTest::testTag(const char* frag, for (j=0; j<100; ++j) { index = count ? (randi(count * 3) - count) : (randi(200) - 100); - status = ZERO_ERROR; + status = U_ZERO_ERROR; string = kERROR; theBundle.getArrayItem(tag, index, string, status); - expected_status = (index >= 0 && index < count) ? expected_resource_status : MISSING_RESOURCE_ERROR; + expected_status = (index >= 0 && index < count) ? expected_resource_status : U_MISSING_RESOURCE_ERROR; CONFIRM_UErrorCode(status,expected_status); if (SUCCESS(status)) @@ -497,7 +497,7 @@ ResourceBundleTest::testTag(const char* frag, tag += frag; int32_t row_count = kERROR_COUNT, column_count = kERROR_COUNT; - status = ZERO_ERROR; + status = U_ZERO_ERROR; const UnicodeString** array2d = theBundle.get2dArray(tag, row_count, column_count, status); CONFIRM_UErrorCode(status,expected_resource_status); @@ -539,11 +539,11 @@ ResourceBundleTest::testTag(const char* frag, { row = row_count ? (randi(row_count * 3) - row_count) : (randi(200) - 100); col = column_count ? (randi(column_count * 3) - column_count) : (randi(200) - 100); - status = ZERO_ERROR; + status = U_ZERO_ERROR; string = kERROR; theBundle.get2dArrayItem(tag, row, col, string, status); expected_status = (row >= 0 && row < row_count && col >= 0 && col < column_count) ? - expected_resource_status: MISSING_RESOURCE_ERROR; + expected_resource_status: U_MISSING_RESOURCE_ERROR; CONFIRM_UErrorCode(status,expected_status); if (SUCCESS(status)) @@ -575,7 +575,7 @@ ResourceBundleTest::testTag(const char* frag, UnicodeString* items = 0; int32_t expected_count; - status = ZERO_ERROR; + status = U_ZERO_ERROR; theBundle.getTaggedArray(tag, tags, items, expected_count, status); CONFIRM_UErrorCode(status, expected_resource_status); @@ -613,16 +613,16 @@ ResourceBundleTest::testTag(const char* frag, UnicodeString item_tag("tag"); item_tag += itoa(index,buf); - status = ZERO_ERROR; + status = U_ZERO_ERROR; string = kERROR; theBundle.getTaggedArrayItem(tag,item_tag,string,status); if (index < 0) { - CONFIRM_UErrorCode(status,MISSING_RESOURCE_ERROR); + CONFIRM_UErrorCode(status,U_MISSING_RESOURCE_ERROR); } else { - if (status != MISSING_RESOURCE_ERROR) { + if (status != U_MISSING_RESOURCE_ERROR) { count++; expected_string = base; expected_string += buf; @@ -647,5 +647,3 @@ ResourceBundleTest::record_fail() ++fail; } //eof - - diff --git a/icu4c/source/test/intltest/sdtfmtts.cpp b/icu4c/source/test/intltest/sdtfmtts.cpp index 5e0776b35ad..fee2ca95d0a 100644 --- a/icu4c/source/test/intltest/sdtfmtts.cpp +++ b/icu4c/source/test/intltest/sdtfmtts.cpp @@ -28,7 +28,7 @@ void IntlTestSimpleDateFormatAPI::runIndexedTest( int32_t index, bool_t exec, ch case 0: name = "SimpleDateFormat API test"; if (exec) { logln("SimpleDateFormat API test---"); logln(""); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Locale::setDefault(Locale::ENGLISH, status); if(FAILURE(status)) { errln("ERROR: Could not set default locale, test may not give correct results"); @@ -46,7 +46,7 @@ void IntlTestSimpleDateFormatAPI::runIndexedTest( int32_t index, bool_t exec, ch */ void IntlTestSimpleDateFormatAPI::testAPI(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // ======= Test constructors @@ -57,32 +57,32 @@ void IntlTestSimpleDateFormatAPI::testAPI(char *par) errln("ERROR: Could not create SimpleDateFormat (default)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; const UnicodeString pattern("yyyy.MM.dd G 'at' hh:mm:ss z"); SimpleDateFormat pat(pattern, status); if(FAILURE(status)) { errln("ERROR: Could not create SimpleDateFormat (pattern)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; SimpleDateFormat pat_fr(pattern, Locale::FRENCH, status); if(FAILURE(status)) { errln("ERROR: Could not create SimpleDateFormat (pattern French)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DateFormatSymbols *symbols = new DateFormatSymbols(Locale::FRENCH, status); if(FAILURE(status)) { errln("ERROR: Could not create DateFormatSymbols (French)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; SimpleDateFormat cust1(pattern, symbols, status); if(FAILURE(status)) { errln("ERROR: Could not create SimpleDateFormat (pattern, symbols*)"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; SimpleDateFormat cust2(pattern, *symbols, status); if(FAILURE(status)) { errln("ERROR: Could not create SimpleDateFormat (pattern, symbols)"); @@ -122,7 +122,7 @@ void IntlTestSimpleDateFormatAPI::testAPI(char *par) res1 = def.format(d, res1, pos1); logln( (UnicodeString) "" + d + " formatted to " + res1); - status = ZERO_ERROR; + status = U_ZERO_ERROR; res2 = cust1.format(fD, res2, pos2, status); if(FAILURE(status)) { errln("ERROR: format(Formattable [Date]) failed"); @@ -139,7 +139,7 @@ void IntlTestSimpleDateFormatAPI::testAPI(char *par) result1 = def.parse(text, pos); logln(text + " parsed into " + result1); - status = ZERO_ERROR; + status = U_ZERO_ERROR; result2 = def.parse(text, status); if(FAILURE(status)) { errln("ERROR: parse() failed"); @@ -158,13 +158,13 @@ void IntlTestSimpleDateFormatAPI::testAPI(char *par) errln("ERROR: adopt or set DateFormatSymbols() failed"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; UDate startDate = pat.get2DigitYearStart(status); if(FAILURE(status)) { errln("ERROR: getTwoDigitStartDate() failed"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; pat_fr.set2DigitYearStart(startDate, status); if(FAILURE(status)) { errln("ERROR: setTwoDigitStartDate() failed"); @@ -176,7 +176,7 @@ void IntlTestSimpleDateFormatAPI::testAPI(char *par) UnicodeString p1("yyyy.MM.dd G 'at' hh:mm:ss z"); logln("Applying pattern " + p1); - status = ZERO_ERROR; + status = U_ZERO_ERROR; pat.applyPattern(p1); UnicodeString s2; @@ -187,13 +187,13 @@ void IntlTestSimpleDateFormatAPI::testAPI(char *par) } logln("Applying pattern " + p1); - status = ZERO_ERROR; + status = U_ZERO_ERROR; pat.applyLocalizedPattern(p1, status); if(FAILURE(status)) { errln("ERROR: applyPattern() failed with " + (int32_t) status); } UnicodeString s3; - status = ZERO_ERROR; + status = U_ZERO_ERROR; s3 = pat.toLocalizedPattern(s3, status); if(FAILURE(status)) { errln("ERROR: toLocalizedPattern() failed"); @@ -207,7 +207,7 @@ void IntlTestSimpleDateFormatAPI::testAPI(char *par) logln("Testing getStaticClassID()"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; DateFormat *test = new SimpleDateFormat(status); if(FAILURE(status)) { errln("ERROR: Couldn't create a SimpleDateFormat"); diff --git a/icu4c/source/test/intltest/tchcfmt.cpp b/icu4c/source/test/intltest/tchcfmt.cpp index 2829cab07b3..2ae7005f9fc 100644 --- a/icu4c/source/test/intltest/tchcfmt.cpp +++ b/icu4c/source/test/intltest/tchcfmt.cpp @@ -47,7 +47,7 @@ TestChoiceFormat::TestSimpleExample( void ) //for (double i = 0.0; i <= 8.0; ++i) { for (int32_t ix = 0; ix <= 8; ++ix) { double i = ix; //nos - status = ZERO_ERROR; + status = U_ZERO_ERROR; fpos = 0; str = ""; res1 = form->format(i, str, fpos, status ); @@ -65,7 +65,7 @@ TestChoiceFormat::TestSimpleExample( void ) void TestChoiceFormat::TestComplexExample( void ) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; const double filelimits[] = {0,1,2}; const UnicodeString filepart[] = {"are no files","is one file","are {2} files"}; @@ -131,12 +131,12 @@ TestChoiceFormat::TestComplexExample( void ) "There are 3 files on Disk_A" }; - if (status != ZERO_ERROR) return; + if (status != U_ZERO_ERROR) return; int32_t i; for (i = 0; i < 4; ++i) { str = ""; - status = ZERO_ERROR; + status = U_ZERO_ERROR; testArgs[0] = Formattable((int32_t)i); testArgs[2] = testArgs[0]; res2 = pattform->format(testArgs, 3, str, fpos, status ); @@ -185,7 +185,7 @@ TestChoiceFormat::TestComplexExample( void ) }; fileform->applyPattern("0#is no folder|1#is one folder|2#are many folders", status ); - if (status == ZERO_ERROR) it_out << "status applyPattern OK!" << endl; + if (status == U_ZERO_ERROR) it_out << "status applyPattern OK!" << endl; if (!chkstatus( status, "*** test_complex_example pattform" )) { delete fileform; delete filenumform; @@ -196,7 +196,7 @@ TestChoiceFormat::TestComplexExample( void ) fpos = 0; for (i = 0; i < 4; ++i) { str = ""; - status = ZERO_ERROR; + status = U_ZERO_ERROR; testArgs[0] = Formattable((int32_t)i); testArgs[2] = testArgs[0]; res2 = pattform->format(testArgs, 3, str, fpos, status ); @@ -328,7 +328,7 @@ TestChoiceFormat::TestComplexExample( void ) str = ""; fpos = 0; - status = ZERO_ERROR; + status = U_ZERO_ERROR; double arg_double = 3.0; res1 = form_pat.format( arg_double, str, fpos ); it_out << "ChoiceFormat format:" << res1 << endl; @@ -336,7 +336,7 @@ TestChoiceFormat::TestComplexExample( void ) str = ""; fpos = 0; - status = ZERO_ERROR; + status = U_ZERO_ERROR; int32_t arg_long = 3; res1 = form_pat.format( arg_long, str, fpos ); it_out << "ChoiceFormat format:" << res1 << endl; @@ -345,7 +345,7 @@ TestChoiceFormat::TestComplexExample( void ) Formattable ft( T_INT32(3) ); str = ""; fpos = 0; - status = ZERO_ERROR; + status = U_ZERO_ERROR; res1 = form_pat.format( ft, str, fpos, status ); if (!chkstatus( status, "*** test_complex_example format (int32_t, ...)" )) { delete fileform; @@ -359,7 +359,7 @@ TestChoiceFormat::TestComplexExample( void ) Formattable fta[] = { T_INT32(3) }; str = ""; fpos = 0; - status = ZERO_ERROR; + status = U_ZERO_ERROR; res1 = form_pat.format( fta, 1, str, fpos, status ); if (!chkstatus( status, "*** test_complex_example format (int32_t, ...)" )) { delete fileform; diff --git a/icu4c/source/test/intltest/tfsmalls.cpp b/icu4c/source/test/intltest/tfsmalls.cpp index 22df3caeb7f..cb3061153c2 100644 --- a/icu4c/source/test/intltest/tfsmalls.cpp +++ b/icu4c/source/test/intltest/tfsmalls.cpp @@ -27,7 +27,7 @@ static bool_t chkstatus( UErrorCode &status, char* msg = NULL ) { - bool_t ok = (status == ZERO_ERROR); + bool_t ok = (status == U_ZERO_ERROR); if (!ok) it_errln( msg ); return ok; } @@ -90,7 +90,7 @@ void test_FieldPosition_example( void ) 12345.6789, -1234.56789, 123.456789, -12.3456789, 1.23456789}; int32_t dNumSize = (int32_t)(sizeof(doubleNum)/sizeof(double)); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormat* fmt = (DecimalFormat*) NumberFormat::createInstance(status); fmt->setDecimalSeparatorAlwaysShown(TRUE); @@ -164,7 +164,7 @@ void test_FieldPosition( void ) void test_Formattable( void ) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Formattable* ftp = new Formattable(); if (!ftp || !(ftp->getType() == Formattable::kLong) || !(ftp->getLong() == 0)) { diff --git a/icu4c/source/test/intltest/tmsgfmt.cpp b/icu4c/source/test/intltest/tmsgfmt.cpp index 5517f13cbc0..722b7b92da1 100644 --- a/icu4c/source/test/intltest/tmsgfmt.cpp +++ b/icu4c/source/test/intltest/tmsgfmt.cpp @@ -131,7 +131,7 @@ void TestMessageFormat::testBug3() for (i= 0; i < 49; i++) { UnicodeString buffer; it_out << locale[i].getDisplayName(buffer) << endl; - UErrorCode success = ZERO_ERROR; + UErrorCode success = U_ZERO_ERROR; // form = (DecimalFormat*)NumberFormat::createCurrencyInstance(locale[i], success); form = (DecimalFormat*)NumberFormat::createInstance(locale[i], success); if (FAILURE(success)) { @@ -143,7 +143,7 @@ void TestMessageFormat::testBug3() FieldPosition pos(0); buffer.remove(); form->format(myNumber, buffer, pos); - success = ZERO_ERROR; + success = U_ZERO_ERROR; ParsePosition parsePos; form->parse(buffer, result, parsePos); #ifdef _DEBUG @@ -176,7 +176,7 @@ void TestMessageFormat::testBug1() void TestMessageFormat::testBug2() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString result; // {sfb} use double format in pattern, so result will match (not strictly necessary) const UnicodeString pattern = "There {0,choice,0.0#are no files|1.0#is one file|1.0 compare(source, target); CollationKey sortKey1, sortKey2; - UErrorCode key1status = ZERO_ERROR, key2status = ZERO_ERROR; //nos + UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos myCollation->getCollationKey(source, /*nos*/ sortKey1, key1status ); myCollation->getCollationKey(target, /*nos*/ sortKey2, key2status ); if (FAILURE(key1status) || FAILURE(key2status)) { diff --git a/icu4c/source/test/intltest/tsdate.cpp b/icu4c/source/test/intltest/tsdate.cpp index fabe581dedc..1c251641f55 100644 --- a/icu4c/source/test/intltest/tsdate.cpp +++ b/icu4c/source/test/intltest/tsdate.cpp @@ -152,7 +152,7 @@ void IntlTestDateFormat::tryDate(UDate theDate) int32_t i; for (i=0; i parse(string[i-1], status); if (FAILURE(status)) diff --git a/icu4c/source/test/intltest/tsdcfmsy.cpp b/icu4c/source/test/intltest/tsdcfmsy.cpp index 71f7f63da79..886f250ed2e 100644 --- a/icu4c/source/test/intltest/tsdcfmsy.cpp +++ b/icu4c/source/test/intltest/tsdcfmsy.cpp @@ -37,14 +37,14 @@ void IntlTestDecimalFormatSymbols::runIndexedTest( int32_t index, bool_t exec, c */ void IntlTestDecimalFormatSymbols::testSymbols(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DecimalFormatSymbols fr(Locale::FRENCH, status); if(FAILURE(status)) { errln("ERROR: Couldn't create French DecimalFormatSymbols"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DecimalFormatSymbols en(Locale::ENGLISH, status); if(FAILURE(status)) { errln("ERROR: Couldn't create English DecimalFormatSymbols"); @@ -128,7 +128,7 @@ void IntlTestDecimalFormatSymbols::testSymbols(char *par) errln("ERROR: get/set Exponential failed"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DecimalFormatSymbols foo(status); DecimalFormatSymbols bar(foo); diff --git a/icu4c/source/test/intltest/tsdtfmsy.cpp b/icu4c/source/test/intltest/tsdtfmsy.cpp index 878c37bbb51..8aaa50e4f81 100644 --- a/icu4c/source/test/intltest/tsdtfmsy.cpp +++ b/icu4c/source/test/intltest/tsdtfmsy.cpp @@ -44,7 +44,7 @@ void IntlTestDateFormatSymbols::runIndexedTest( int32_t index, bool_t exec, char */ void IntlTestDateFormatSymbols::TestGetMonths() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t cnt; const UnicodeString* month; DateFormatSymbols *symbol; @@ -68,14 +68,14 @@ void IntlTestDateFormatSymbols::TestGetMonths() */ void IntlTestDateFormatSymbols::testSymbols(char *par) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; DateFormatSymbols fr(Locale::FRENCH, status); if(FAILURE(status)) { errln("ERROR: Couldn't create French DateFormatSymbols"); } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DateFormatSymbols en(Locale::ENGLISH, status); if(FAILURE(status)) { errln("ERROR: Couldn't create English DateFormatSymbols"); @@ -147,7 +147,7 @@ void IntlTestDateFormatSymbols::testSymbols(char *par) } - status = ZERO_ERROR; + status = U_ZERO_ERROR; DateFormatSymbols foo(status); DateFormatSymbols bar(foo); diff --git a/icu4c/source/test/intltest/tsmthred.cpp b/icu4c/source/test/intltest/tsmthred.cpp index 9c2a228dd6a..c1e5ad989c9 100644 --- a/icu4c/source/test/intltest/tsmthred.cpp +++ b/icu4c/source/test/intltest/tsmthred.cpp @@ -529,35 +529,7 @@ int32_t kPercentFormatTestDataLength = sizeof(kPercentFormatTestData) / sizeof(k void errorToString(UErrorCode theStatus, UnicodeString &string) { - /* don't use these: - USING_FALLBACK_ERROR = -128, // Start of information results (semantically successful) - USING_DEFAULT_ERROR = -127 - */ - double limits[] = {0,1,2,3,4,5,6,7,8,9,10,11}; - UnicodeString errors[] = { - "ZERO_ERROR", - "ILLEGAL_ARGUMENT_ERROR", - "MISSING_RESOURCE_ERROR", - "INVALID_FORMAT_ERROR", - "FILE_ACCESS_ERROR", - "INTERNAL_PROGRAM_ERROR", - "MESSAGE_PARSE_ERROR", - "MEMORY_ALLOCATION_ERROR", - "INDEX_OUTOFBOUNDS_ERROR", - "PARSE_ERROR", - "INVALID_CHAR_FOUND", - "INPUT_CHAR_TRUNCATED", - }; - - ChoiceFormat* form = new ChoiceFormat(limits, errors, 12 ); - ParsePosition* status = new ParsePosition(0); - FieldPosition f1(0), f2(0); - status->setIndex(0); - Formattable parseResult; - string.remove(); - form->format((int32_t)theStatus,string, f1); - delete form; - delete status; + string=errorName(theStatus); } // "Someone from {2} is receiving a #{0} error - {1}. Their telephone call is costing {3 number,currency}." @@ -612,7 +584,7 @@ public: { int32_t iteration; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; NumberFormat *formatter = NumberFormat::createInstance(Locale::ENGLISH,status); if(FAILURE(status)) @@ -671,32 +643,32 @@ public: { default: case 0: - statusToCheck= FILE_ACCESS_ERROR; + statusToCheck= U_FILE_ACCESS_ERROR; patternToCheck= "0:Someone from {2} is receiving a #{0} error - {1}. Their telephone call is costing {3,number,currency}."; // number,currency messageLocale= Locale("en","US"); countryToCheck= Locale("","HR"); currencyToCheck= 8192.77; - expected= "0:Someone from Croatia is receiving a #4 error - FILE_ACCESS_ERROR. Their telephone call is costing $8,192.77."; + expected= "0:Someone from Croatia is receiving a #4 error - U_FILE_ACCESS_ERROR. Their telephone call is costing $8,192.77."; break; case 1: - statusToCheck= INDEX_OUTOFBOUNDS_ERROR; + statusToCheck= U_INDEX_OUTOFBOUNDS_ERROR; patternToCheck= "1:A customer in {2} is receiving a #{0} error - {1}. Their telephone call is costing {3,number,currency}."; // number,currency messageLocale= Locale("de","DE"); countryToCheck= Locale("","BF"); currencyToCheck= 2.32; - expected= "1:A customer in Burkina Faso is receiving a #8 error - INDEX_OUTOFBOUNDS_ERROR. Their telephone call is costing $2.32."; + expected= "1:A customer in Burkina Faso is receiving a #8 error - U_INDEX_OUTOFBOUNDS_ERROR. Their telephone call is costing $2.32."; case 2: - statusToCheck= MEMORY_ALLOCATION_ERROR; + statusToCheck= U_MEMORY_ALLOCATION_ERROR; patternToCheck= "2:user in {2} is receiving a #{0} error - {1}. They insist they just spent {3,number,currency} on memory."; // number,currency messageLocale= Locale("de","AT"); // Austrian German countryToCheck= Locale("","US"); // hmm currencyToCheck= 40193.12; - expected= UEscapeString("2:user in Vereinigte Staaten is receiving a #7 error - MEMORY_ALLOCATION_ERROR. They insist they just spent \\u00f6S 40.193,12 on memory."); + expected= UEscapeString("2:user in Vereinigte Staaten is receiving a #7 error - U_MEMORY_ALLOCATION_ERROR. They insist they just spent \\u00f6S 40.193,12 on memory."); break; } UnicodeString result; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; formatErrorMessage(status,patternToCheck,messageLocale,statusToCheck,countryToCheck,currencyToCheck,result); if(FAILURE(status)) { diff --git a/icu4c/source/test/intltest/tsnmfmt.cpp b/icu4c/source/test/intltest/tsnmfmt.cpp index 7c1b532eeb1..35a4d98874b 100644 --- a/icu4c/source/test/intltest/tsnmfmt.cpp +++ b/icu4c/source/test/intltest/tsnmfmt.cpp @@ -33,7 +33,7 @@ void IntlTestNumberFormat::runIndexedTest( int32_t index, bool_t exec, char* &na if (exec) { logln(name); - fStatus = ZERO_ERROR; + fStatus = U_ZERO_ERROR; fFormat = NumberFormat::createInstance(fStatus); testFormat(par); } @@ -68,19 +68,19 @@ IntlTestNumberFormat::testLocale(char* par, const Locale& locale, const UnicodeS name = "Number test"; logln((UnicodeString)name + " (" + localeName + ")"); - fStatus = ZERO_ERROR; + fStatus = U_ZERO_ERROR; fFormat = NumberFormat::createInstance(locale, fStatus); testFormat(par); name = "Currency test"; logln((UnicodeString)name + " (" + localeName + ")"); - fStatus = ZERO_ERROR; + fStatus = U_ZERO_ERROR; fFormat = NumberFormat::createCurrencyInstance(locale, fStatus); testFormat(par); name = "Percent test"; logln((UnicodeString)name + " (" + localeName + ")"); - fStatus = ZERO_ERROR; + fStatus = U_ZERO_ERROR; fFormat = NumberFormat::createPercentInstance(locale, fStatus); testFormat(par); } @@ -208,7 +208,7 @@ IntlTestNumberFormat::tryIt(double aNumber) int32_t i; for (i=0; i parse(string[i-1], number[i], status); if (FAILURE(status)) @@ -276,7 +276,7 @@ IntlTestNumberFormat::tryIt(int32_t aNumber) int32_t i; for (i=0; i parse(string[i-1], number[i], status); if (FAILURE(status)) diff --git a/icu4c/source/test/intltest/tstnorm.cpp b/icu4c/source/test/intltest/tstnorm.cpp index 7155ce5a40f..298271c62b6 100644 --- a/icu4c/source/test/intltest/tstnorm.cpp +++ b/icu4c/source/test/intltest/tstnorm.cpp @@ -18,7 +18,7 @@ #define ARRAY_LENGTH(array) (sizeof (array) / sizeof (*array)) -static UErrorCode status = ZERO_ERROR; +static UErrorCode status = U_ZERO_ERROR; /** * Convert Java-style strings with \u Unicode escapes into UnicodeString objects diff --git a/icu4c/source/test/intltest/tzbdtest.cpp b/icu4c/source/test/intltest/tzbdtest.cpp index d5307b15ff8..a429a066e84 100644 --- a/icu4c/source/test/intltest/tzbdtest.cpp +++ b/icu4c/source/test/intltest/tzbdtest.cpp @@ -119,7 +119,7 @@ TimeZoneBoundaryTest::findDaylightBoundaryUsingTimeZone(UDate d, bool_t startsIn void TimeZoneBoundaryTest::findDaylightBoundaryUsingTimeZone(UDate d, bool_t startsInDST, UDate expectedBoundary, TimeZone* tz) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString str; UDate min = d; UDate max = min + SIX_MONTHS; @@ -189,7 +189,7 @@ void TimeZoneBoundaryTest::verifyDST(UDate d, TimeZone* time_zone, bool_t expUseDaylightTime, bool_t expInDaylightTime, UDate expZoneOffset, UDate expDSTOffset) { UnicodeString str; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; logln("-- Verifying time " + dateToString(d) + " in zone " + time_zone->getID(str)); if (time_zone->inDaylightTime(d, status) == expInDaylightTime) logln(UnicodeString("PASS: inDaylightTime = ") + (time_zone->inDaylightTime(d, status)?"true":"false")); @@ -275,7 +275,7 @@ TimeZoneBoundaryTest::TestBoundaries() void TimeZoneBoundaryTest::testUsingBinarySearch(SimpleTimeZone* tz, UDate d, UDate expectedBoundary) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate min = d; UDate max = min + SIX_MONTHS; bool_t startsInDST = tz->inDaylightTime(d, status); @@ -313,7 +313,7 @@ TimeZoneBoundaryTest::testUsingBinarySearch(SimpleTimeZone* tz, UDate d, UDate e void TimeZoneBoundaryTest::TestNewRules() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; if (TRUE) { SimpleTimeZone *tz; logln("-----------------------------------------------------------------"); @@ -340,7 +340,7 @@ TimeZoneBoundaryTest::TestNewRules() void TimeZoneBoundaryTest::findBoundariesStepwise(int32_t year, UDate interval, TimeZone* z, int32_t expectedChanges) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString str; UDate d = date(year - 1900, Calendar::JANUARY, 1); UDate time = d; diff --git a/icu4c/source/test/intltest/tzregts.cpp b/icu4c/source/test/intltest/tzregts.cpp index 9f7d9046be1..73dda9aee7b 100644 --- a/icu4c/source/test/intltest/tzregts.cpp +++ b/icu4c/source/test/intltest/tzregts.cpp @@ -50,24 +50,6 @@ TimeZoneRegressionTest::runIndexedTest( int32_t index, bool_t exec, char* &name, } } -const char* -TimeZoneRegressionTest::errorName(UErrorCode code) -{ - switch (code) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "int32_tERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - bool_t TimeZoneRegressionTest::failure(UErrorCode status, const char* msg) { @@ -108,7 +90,7 @@ void TimeZoneRegressionTest:: Test4073209() { // {sfb} will this work using a Calendar? void TimeZoneRegressionTest:: Test4073215() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleTimeZone *z = (SimpleTimeZone*) TimeZone::createTimeZone("GMT"); if (z->useDaylightTime()) errln("Fail: Fix test to start with non-DST zone"); @@ -237,7 +219,7 @@ void TimeZoneRegressionTest:: Test4096952() { * @bug 4109314 */ void TimeZoneRegressionTest:: Test4109314() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; GregorianCalendar *testCal = (GregorianCalendar*)Calendar::createInstance(status); failure(status, "Calendar::createInstance"); TimeZone *PST = TimeZone::createTimeZone("PST"); @@ -274,7 +256,7 @@ void TimeZoneRegressionTest:: Test4109314() { bool_t TimeZoneRegressionTest::checkCalendar314(GregorianCalendar *testCal, TimeZone *testTZ) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // GregorianCalendar testCal = (GregorianCalendar)aCal.clone(); int32_t tzOffset, tzRawOffset; @@ -374,7 +356,7 @@ TimeZoneRegressionTest::checkCalendar314(GregorianCalendar *testCal, TimeZone *t */ void TimeZoneRegressionTest:: Test4126678() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; Calendar *cal = Calendar::createInstance(status); failure(status, "Calendar::createInstance"); TimeZone *tz = TimeZone::createTimeZone("PST"); @@ -457,7 +439,7 @@ void TimeZoneRegressionTest:: Test4151429() { * and different DST parameters. */ void TimeZoneRegressionTest:: Test4154537() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // tz1 and tz2 have no DST and different rule parameters SimpleTimeZone *tz1 = new SimpleTimeZone(0, "1", 0, 0, 0, 0, 2, 0, 0, 0, status); SimpleTimeZone *tz2 = new SimpleTimeZone(0, "2", 1, 0, 0, 0, 3, 0, 0, 0, status); @@ -534,7 +516,7 @@ void TimeZoneRegressionTest:: Test4154542() int32_t dayOfWeek = DATA[i+3]; int32_t time = DATA[i+4]; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; //Exception ex = null; //try { @@ -551,7 +533,7 @@ void TimeZoneRegressionTest:: Test4154542() //ex = null; //try { - status = ZERO_ERROR; + status = U_ZERO_ERROR; zone->setEndRule(month, day, dayOfWeek, time, status); //} catch (IllegalArgumentException e) { // ex = e; @@ -566,7 +548,7 @@ void TimeZoneRegressionTest:: Test4154542() //ex = null; //try { // {sfb} need to look into ctor problems! (UErrorCode vs. dst signature confusion) - status = ZERO_ERROR; + status = U_ZERO_ERROR; SimpleTimeZone *temp = new SimpleTimeZone(0, "Z", (int8_t)month, (int8_t)day, (int8_t)dayOfWeek, time, (int8_t)GOOD_MONTH, (int8_t)GOOD_DAY, (int8_t)GOOD_DAY_OF_WEEK, @@ -584,7 +566,7 @@ void TimeZoneRegressionTest:: Test4154542() delete temp; //ex = null; //try { - status = ZERO_ERROR; + status = U_ZERO_ERROR; temp = new SimpleTimeZone(0, "Z", (int8_t)GOOD_MONTH, (int8_t)GOOD_DAY, (int8_t)GOOD_DAY_OF_WEEK, GOOD_TIME, @@ -622,7 +604,7 @@ TimeZoneRegressionTest::Test4154525() // Integer.MAX_VALUE, ?, // no upper limit on DST savings at this time }; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; for(int32_t i = 0; i < 10; i+=2) { int32_t savings = DATA[i]; bool_t valid = DATA[i+1] == GOOD; @@ -660,7 +642,7 @@ TimeZoneRegressionTest::Test4154525() errln(UnicodeString("Fail: DST savings of ") + savings + " accepted by " + method); } } - status = ZERO_ERROR; + status = U_ZERO_ERROR; delete z; } } @@ -708,7 +690,7 @@ TimeZoneRegressionTest::Test4154650() int32_t dataLen = sizeof(DATA) / sizeof(DATA[0]); - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; TimeZone *tz = TimeZone::createDefault(); for(int32_t i = 0; i < dataLen; i += 7) { bool_t good = DATA[i] == GOOD; @@ -725,7 +707,7 @@ TimeZoneRegressionTest::Test4154650() DATA[i+4] + ", " + DATA[i+5] + ", " + DATA[i+6] + (good ? (UnicodeString(") threw ") + errorName(status)) : UnicodeString(") accepts invalid args"))); } - status = ZERO_ERROR; // reset + status = U_ZERO_ERROR; // reset } delete tz; } @@ -738,7 +720,7 @@ TimeZoneRegressionTest::Test4154650() void TimeZoneRegressionTest::Test4162593() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; SimpleDateFormat *fmt = new SimpleDateFormat("z", Locale::US, status); const int32_t ONE_HOUR = 60*60*1000; @@ -821,7 +803,7 @@ TimeZoneRegressionTest::TestJDK12API() errln("FAILURE: PST and CST have same rules"); } - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t offset1 = pst->getOffset(1, 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000), status); failure(status, "getOffset() failed"); @@ -840,7 +822,7 @@ TimeZoneRegressionTest::TestJDK12API() if(SUCCESS(status)) errln("FAILURE: getOffset() succeeded with -1 for month"); - status = ZERO_ERROR; + status = U_ZERO_ERROR; cst->setDSTSavings(60*60*1000, status); failure(status, "setDSTSavings() failed"); diff --git a/icu4c/source/test/intltest/tzregts.h b/icu4c/source/test/intltest/tzregts.h index f4cb7c1983c..a2401f9538e 100644 --- a/icu4c/source/test/intltest/tzregts.h +++ b/icu4c/source/test/intltest/tzregts.h @@ -49,7 +49,6 @@ public: protected: - const char* errorName(UErrorCode code); bool_t failure(UErrorCode status, const char* msg); }; diff --git a/icu4c/source/test/intltest/tztest.cpp b/icu4c/source/test/intltest/tztest.cpp index 1b246b2c882..33a70fd655a 100644 --- a/icu4c/source/test/intltest/tztest.cpp +++ b/icu4c/source/test/intltest/tztest.cpp @@ -154,7 +154,7 @@ TimeZoneTest::TestGenericAPI() logln(UnicodeString("Value returned from t_timezone = ") + tzoffset); // Invert sign because UNIX semantics are backwards if (tzoffset < 0) tzoffset = -tzoffset; - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // --- The following test would fail outside PST now that // --- PST is generally set to be default timezone in format tests //if ((*saveDefault == *pstZone) && (tzoffset != 28800)) { @@ -187,7 +187,7 @@ TimeZoneTest::TestGenericAPI() void TimeZoneTest::TestRuleAPI() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UDate offset = 60*60*1000*1.75; // Pick a weird offset SimpleTimeZone *zone = new SimpleTimeZone((int32_t)offset, "TestZone"); @@ -260,7 +260,7 @@ TimeZoneTest::TestRuleAPI() void TimeZoneTest::testUsingBinarySearch(SimpleTimeZone* tz, UDate min, UDate max, UDate expectedBoundary) { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; bool_t startsInDST = tz->inDaylightTime(min, status); if (failure(status, "SimpleTimeZone::inDaylightTime")) return; if (tz->inDaylightTime(max, status) == startsInDST) { @@ -321,7 +321,7 @@ TimeZoneTest::TestPRTOffset() void TimeZoneTest::TestVariousAPI518() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; TimeZone* time_zone = TimeZone::createTimeZone("PST"); UDate d = date(97, Calendar::APRIL, 30); UnicodeString str; @@ -858,7 +858,7 @@ void TimeZoneTest::TestCustomParse() void TimeZoneTest::TestDisplayName() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; int32_t i; TimeZone *zone = TimeZone::createTimeZone("PST"); UnicodeString name; @@ -983,7 +983,7 @@ TimeZoneTest::TestDisplayName() void TimeZoneTest::TestDSTSavings() { - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; // It might be better to find a way to integrate this test into the main TimeZone // tests above, but I don't have time to figure out how to do this (or if it's // even really a good idea). Let's consider that a future. --rtg 1/27/98 @@ -1043,7 +1043,7 @@ TimeZoneTest::TestAlternateRules() SimpleTimeZone tz(-5 * kMillisPerHour, "alternateRuleTest"); // test the day-of-month API - UErrorCode status = ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; tz.setStartRule(Calendar::MARCH, 10, 12 * kMillisPerHour, status); if(FAILURE(status)) errln("tz.setStartRule failed"); diff --git a/icu4c/source/tools/gencol/gencol.c b/icu4c/source/tools/gencol/gencol.c index 07b70edb936..fd6670110b5 100644 --- a/icu4c/source/tools/gencol/gencol.c +++ b/icu4c/source/tools/gencol/gencol.c @@ -31,7 +31,6 @@ /* Protos */ static void usage(); static void version(); -static const char* errorName(UErrorCode status); int main(int argc, char **argv); @@ -96,7 +95,7 @@ main(int argc, /* generate the binary collation files */ for(i = 0; i < uloc_countAvailable(); ++i) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; loc = uloc_getAvailable(i); printf("gencol: Creating collation data for locale \"%s\"\n", loc); coll = ucol_open(loc, &status); @@ -132,35 +131,3 @@ version() puts("US Government Users Restricted Rights - Use, duplication, or disclosure"); puts("restricted by GSA ADP Schedule Contract with IBM Corp."); } - -/* Get the error message for an error code */ -static const char* -errorName(UErrorCode status) -{ - switch(status) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case INDEX_OUTOFBOUNDS_ERROR: return "INDEX_OUTOFBOUNDS_ERROR"; - case PARSE_ERROR: return "PARSE_ERROR"; - case INVALID_CHAR_FOUND: return "INVALID_CHAR_FOUND"; - case TRUNCATED_CHAR_FOUND: return "TRUNCATED_CHAR_FOUND"; - case ILLEGAL_CHAR_FOUND: return "ILLEGAL_CHAR_FOUND"; - case INVALID_TABLE_FORMAT: return "INVALID_TABLE_FORMAT"; - case INVALID_TABLE_FILE: return "INVALID_TABLE_FILE"; - case BUFFER_OVERFLOW_ERROR: return "BUFFER_OVERFLOW_ERROR"; - case UNSUPPORTED_ERROR: return "UNSUPPORTED_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - - - - diff --git a/icu4c/source/tools/genrb/genrb.c b/icu4c/source/tools/genrb/genrb.c index f2b0ee5e25f..bfbcb9af207 100644 --- a/icu4c/source/tools/genrb/genrb.c +++ b/icu4c/source/tools/genrb/genrb.c @@ -36,7 +36,6 @@ static void version(); static void processFile(const char *filename, UErrorCode *status); static char* make_res_filename(const char *filename, UErrorCode *status); static char* make_col_filename(const char *filename, UErrorCode *status); -static const char* errorName(UErrorCode status); int main(int argc, char **argv); /* File suffixes */ @@ -102,7 +101,7 @@ main(int argc, /* generate the binary files */ for(i = optind; i < argc; ++i) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; processFile(argv[i], &status); if(FAILURE(status)) { printf("genrb: %s processing file \"%s\"\n", errorName(status), argv[i]); @@ -154,7 +153,7 @@ processFile(const char *filename, /* Open the input file for reading */ in = T_FileStream_open(filename, "r"); if(in == 0) { - *status = FILE_ACCESS_ERROR; + *status = U_FILE_ACCESS_ERROR; setErrorText("File not found"); return; } @@ -171,7 +170,7 @@ processFile(const char *filename, /* Open the target file for writing */ rb_out = T_FileStream_open(rbname, "wb"); if(rb_out == 0 || T_FileStream_error(rb_out) != 0) { - *status = FILE_ACCESS_ERROR; + *status = U_FILE_ACCESS_ERROR; setErrorText("Could not open file for writing"); goto finish; } @@ -206,14 +205,14 @@ make_res_filename(const char *filename, /* determine basename, and compiled file names */ basename = (char*) icu_malloc(sizeof(char) * (icu_strlen(filename) + 1)); if(basename == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } get_basename(basename, filename); dirname = (char*) icu_malloc(sizeof(char) * (icu_strlen(filename) + 1)); if(dirname == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } get_dirname(dirname, filename); @@ -222,7 +221,7 @@ make_res_filename(const char *filename, + icu_strlen(basename) + icu_strlen(RES_SUFFIX) + 1)); if(resName == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } icu_strcpy(resName, dirname); @@ -253,14 +252,14 @@ make_col_filename(const char *filename, /* determine basename, and compiled file names */ basename = (char*) icu_malloc(sizeof(char) * (icu_strlen(filename) + 1)); if(basename == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } get_basename(basename, filename); dirname = (char*) icu_malloc(sizeof(char) * (icu_strlen(filename) + 1)); if(dirname == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } get_dirname(dirname, filename); @@ -269,7 +268,7 @@ make_col_filename(const char *filename, + icu_strlen(basename) + icu_strlen(COL_SUFFIX) + 1)); if(colName == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; goto finish; } icu_strcpy(colName, dirname); @@ -282,35 +281,3 @@ make_col_filename(const char *filename, return colName; } - -/* Get the error message for an error code */ -static const char* -errorName(UErrorCode status) -{ - switch(status) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case INDEX_OUTOFBOUNDS_ERROR: return "INDEX_OUTOFBOUNDS_ERROR"; - case PARSE_ERROR: return "PARSE_ERROR"; - case INVALID_CHAR_FOUND: return "INVALID_CHAR_FOUND"; - case TRUNCATED_CHAR_FOUND: return "TRUNCATED_CHAR_FOUND"; - case ILLEGAL_CHAR_FOUND: return "ILLEGAL_CHAR_FOUND"; - case INVALID_TABLE_FORMAT: return "INVALID_TABLE_FORMAT"; - case INVALID_TABLE_FILE: return "INVALID_TABLE_FILE"; - case BUFFER_OVERFLOW_ERROR: return "BUFFER_OVERFLOW_ERROR"; - case UNSUPPORTED_ERROR: return "UNSUPPORTED_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - - - - diff --git a/icu4c/source/tools/genrb/list.c b/icu4c/source/tools/genrb/list.c index 89869854087..cd6160613f5 100644 --- a/icu4c/source/tools/genrb/list.c +++ b/icu4c/source/tools/genrb/list.c @@ -39,7 +39,7 @@ strlist_open(UErrorCode *status) list = (struct SList*) icu_malloc(sizeof(struct SList)); if(list == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -63,7 +63,7 @@ strlist_close(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -87,7 +87,7 @@ strlist_add(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -99,7 +99,7 @@ strlist_add(struct SList *list, list->u.fStringList.fData[index] = (UChar*) icu_malloc(sizeof(UChar) * (u_strlen(s) + 1)); if(list->u.fStringList.fData[index] == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -118,7 +118,7 @@ strlist_grow(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -127,7 +127,7 @@ strlist_grow(struct SList *list, /* allocate space for the array of strings */ newData = (UChar**) icu_malloc(sizeof(UChar*) * newCapacity); if(newData == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -136,7 +136,7 @@ strlist_grow(struct SList *list, newData[i] = (UChar*) icu_malloc(sizeof(UChar) * (u_strlen(list->u.fStringList.fData[i]) + 1)); if(newData[i] == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; for(j = 0; j < i; ++j) icu_free(newData[j]); icu_free(newData); @@ -161,7 +161,7 @@ strlist2d_open(UErrorCode *status) list = (struct SList*) icu_malloc(sizeof(struct SList)); if(list == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -195,7 +195,7 @@ strlist2d_close(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList2d) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -218,7 +218,7 @@ strlist2d_newRow(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList2d) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -238,7 +238,7 @@ void strlist2d_add(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList2d) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -250,7 +250,7 @@ void strlist2d_add(struct SList *list, list->u.fStringList2d.fData[index] = (UChar*) icu_malloc(sizeof(UChar) * (u_strlen(s) + 1)); if(list->u.fStringList2d.fData[index] == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -269,7 +269,7 @@ strlist2d_grow(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList2d) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -278,7 +278,7 @@ strlist2d_grow(struct SList *list, /* allocate space for the array of strings */ newData = (UChar**) icu_malloc(sizeof(UChar*) * newCapacity); if(newData == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -287,7 +287,7 @@ strlist2d_grow(struct SList *list, newData[i] = (UChar*) icu_malloc(sizeof(UChar) * (u_strlen(list->u.fStringList2d.fData[i]) + 1)); if(newData[i] == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; for(j = 0; j < i; ++j) icu_free(newData[j]); icu_free(newData); @@ -312,7 +312,7 @@ strlist2d_growRows(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eStringList2d) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -321,7 +321,7 @@ strlist2d_growRows(struct SList *list, /* allocate space for the array of ints */ newRows = (int32_t*) icu_malloc(sizeof(int32_t) * newCapacity); if(newRows == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; } /* copy each int */ @@ -345,7 +345,7 @@ taglist_open(UErrorCode *status) list = (struct SList*) icu_malloc(sizeof(struct SList)); if(list == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -367,7 +367,7 @@ taglist_close(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eTaggedList) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -389,7 +389,7 @@ taglist_grow(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eTaggedList) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -399,7 +399,7 @@ taglist_grow(struct SList *list, newData = (struct SStringPair*) icu_malloc(sizeof(struct SStringPair) * newCapacity); if(newData == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -425,19 +425,19 @@ taglist_add(struct SList *list, if(FAILURE(*status)) return; if(list->fType != eTaggedList) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return; } pair.fKey = (UChar*) icu_malloc(sizeof(UChar) * (u_strlen(tag) + 1)); if(pair.fKey == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } pair.fValue = (UChar*) icu_malloc(sizeof(UChar) * (u_strlen(data) + 1)); if(pair.fValue == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; icu_free(pair.fKey); return; } @@ -464,7 +464,7 @@ taglist_get(const struct SList *list, if(FAILURE(*status)) return 0; if(list->fType != eTaggedList) { - *status = ILLEGAL_ARGUMENT_ERROR; + *status = U_ILLEGAL_ARGUMENT_ERROR; return 0; } diff --git a/icu4c/source/tools/genrb/parse.c b/icu4c/source/tools/genrb/parse.c index 568c5792912..340b28eb9f9 100644 --- a/icu4c/source/tools/genrb/parse.c +++ b/icu4c/source/tools/genrb/parse.c @@ -177,13 +177,13 @@ parse(FileStream *f, switch(type) { case tok_EOF: - *status = (node == eInitial) ? ZERO_ERROR : INVALID_FORMAT_ERROR; + *status = (node == eInitial) ? U_ZERO_ERROR : U_INVALID_FORMAT_ERROR; setErrorText("Unexpected EOF encountered"); goto finish; /*break;*/ case tok_error: - *status = INVALID_FORMAT_ERROR; + *status = U_INVALID_FORMAT_ERROR; goto finish; /*break;*/ @@ -195,7 +195,7 @@ parse(FileStream *f, node = t.fNext; if(node == eError) { - *status = INVALID_FORMAT_ERROR; + *status = U_INVALID_FORMAT_ERROR; goto finish; } @@ -208,7 +208,7 @@ parse(FileStream *f, ustr_cpy(&tag, &token, status); if(FAILURE(*status)) goto finish; if(uhash_get(data, uhash_hashUString(tag.fChars)) != 0) { - *status = INVALID_FORMAT_ERROR; + *status = U_INVALID_FORMAT_ERROR; setErrorText("Duplicate tag name detected"); goto finish; } @@ -217,7 +217,7 @@ parse(FileStream *f, /* Record a singleton string */ case eStr: if(current != 0) { - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; goto finish; } current = strlist_open(status); @@ -233,7 +233,7 @@ parse(FileStream *f, /* Begin a string list */ case eBegList: if(current != 0) { - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; goto finish; } current = strlist_open(status); @@ -259,7 +259,7 @@ parse(FileStream *f, case eBeg2dList: if(current != 0) { - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; goto finish; } current = strlist2d_open(status); @@ -287,7 +287,7 @@ parse(FileStream *f, case eBegTagged: if(current != 0) { - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; goto finish; } current = taglist_open(status); @@ -314,7 +314,7 @@ parse(FileStream *f, ustr_cpy(&subtag, &token, status); if(FAILURE(*status)) goto finish; if(taglist_get(current, subtag.fChars, status) != 0) { - *status = INVALID_FORMAT_ERROR; + *status = U_INVALID_FORMAT_ERROR; setErrorText("Duplicate subtag found in tagged list"); goto finish; } @@ -322,7 +322,7 @@ parse(FileStream *f, case eOpen: if(data != 0) { - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; goto finish; } ustr_cpy(&localeName, &token, status); @@ -333,7 +333,7 @@ parse(FileStream *f, case eClose: if(data == 0) { - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; goto finish; } break; diff --git a/icu4c/source/tools/genrb/rblist.c b/icu4c/source/tools/genrb/rblist.c index 3777b7630c7..ab276c7c68d 100644 --- a/icu4c/source/tools/genrb/rblist.c +++ b/icu4c/source/tools/genrb/rblist.c @@ -38,13 +38,13 @@ make_rbitem(const UChar *tag, item = (struct SRBItem*) icu_malloc(sizeof(struct SRBItem)); if(item == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } s = (UChar*) icu_malloc(sizeof(UChar) * (u_strlen(tag) + 1)); if(s == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } u_strcpy(s, tag); @@ -64,7 +64,7 @@ rblist_open(UErrorCode *status) list = (struct SRBItemList*) icu_malloc(sizeof(struct SRBItemList)); if(list == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -122,7 +122,7 @@ void rblist_setlocale(struct SRBItemList *list, list->fLocale = (UChar*) icu_realloc(list->fLocale, sizeof(UChar) * (u_strlen(locale) + 1)); if(list->fLocale == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } @@ -162,7 +162,7 @@ rblist_grow(struct SRBItemList *list, newData = (struct SRBItem**) icu_malloc(sizeof(struct SRBItem*) * newCapacity); if(newData == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return; } diff --git a/icu4c/source/tools/genrb/read.c b/icu4c/source/tools/genrb/read.c index 12b0bcea24b..1590bae7b0c 100644 --- a/icu4c/source/tools/genrb/read.c +++ b/icu4c/source/tools/genrb/read.c @@ -229,7 +229,7 @@ void seekUntilNewline(UFILE *f, do { c = u_fgetc(f, status); - } while(! isNewline(c) && c != (UChar)U_EOF && *status == ZERO_ERROR); + } while(! isNewline(c) && c != (UChar)U_EOF && *status == U_ZERO_ERROR); /*if(FAILURE(*status)) err = kItemNotFound;*/ @@ -251,10 +251,10 @@ void seekUntilEndOfComment(UFILE *f, else break; } - } while(c != (UChar)U_EOF && *status == ZERO_ERROR); + } while(c != (UChar)U_EOF && *status == U_ZERO_ERROR); if(c == (UChar)U_EOF) { - *status = INVALID_FORMAT_ERROR; + *status = U_INVALID_FORMAT_ERROR; setErrorText("Unterminated comment detected"); } } @@ -298,7 +298,7 @@ static UChar unescape(UFILE *f, else maxChars = 4; out = 0; - while(maxChars != 0 && *status == ZERO_ERROR) { + while(maxChars != 0 && *status == U_ZERO_ERROR) { c = u_fgetc(f, status); if(c == (UChar)U_EOF || FAILURE(*status)) return U_EOF; diff --git a/icu4c/source/tools/genrb/ufile.c b/icu4c/source/tools/genrb/ufile.c index 1b1c3aa81bd..c3cb3c27601 100644 --- a/icu4c/source/tools/genrb/ufile.c +++ b/icu4c/source/tools/genrb/ufile.c @@ -33,7 +33,7 @@ u_finit(FileStream *f, { UFILE *result = (UFILE*) icu_malloc(sizeof(UFILE)); if(result == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -97,7 +97,7 @@ ufile_fill_uchar_buffer(UFILE *f, MIN(maxCPBytes, UFILE_CHARBUFFER_SIZE)); /* Set up conversion parameters */ - *status = ZERO_ERROR; + *status = U_ZERO_ERROR; mySource = f->fCharBuffer; mySourceEnd = f->fCharBuffer + bytesRead; myTarget = f->fUCBuffer + dataSize; @@ -117,4 +117,3 @@ ufile_fill_uchar_buffer(UFILE *f, f->fUCPos = f->fUCBuffer; f->fUCLimit = myTarget; } - diff --git a/icu4c/source/tools/genrb/ustdio.c b/icu4c/source/tools/genrb/ustdio.c index 8720fafcca7..5fd4f233686 100644 --- a/icu4c/source/tools/genrb/ustdio.c +++ b/icu4c/source/tools/genrb/ustdio.c @@ -78,7 +78,7 @@ u_file_write(const UChar *chars, /* Perform the conversion in a loop */ do { - *status = ZERO_ERROR; + *status = U_ZERO_ERROR; sourceAlias = mySource; ucnv_fromUnicode(f->fConverter, @@ -98,7 +98,7 @@ u_file_write(const UChar *chars, written += (myTarget - f->fCharBuffer); myTarget = f->fCharBuffer; } - while(*status == INDEX_OUTOFBOUNDS_ERROR); + while(*status == U_INDEX_OUTOFBOUNDS_ERROR); /* return # of chars written */ return written; @@ -241,7 +241,7 @@ u_fungetc(UChar c, /* if we're at the beginning of the buffer, sorry! */ if(f->fUCPos == f->fUCBuffer) { - *status = BUFFER_OVERFLOW_ERROR; + *status = U_BUFFER_OVERFLOW_ERROR; return U_EOF; } /* otherwise, put the character back */ @@ -300,8 +300,3 @@ u_file_read(UChar *chars, return read; } - - - - - diff --git a/icu4c/source/tools/genrb/ustr.c b/icu4c/source/tools/genrb/ustr.c index ac96a1c7832..d95ff4b9962 100644 --- a/icu4c/source/tools/genrb/ustr.c +++ b/icu4c/source/tools/genrb/ustr.c @@ -131,7 +131,7 @@ ustr_resize(struct UString *s, /* +1 for trailing 0x0000 */ s->fChars = (UChar*) icu_realloc(s->fChars, sizeof(UChar) * (len + 1)); if(s->fChars == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; s->fChars = 0; s->fLength = s->fCapacity = 0; return; diff --git a/icu4c/source/tools/genrb/write.c b/icu4c/source/tools/genrb/write.c index af19f85c931..f0e2e4af412 100644 --- a/icu4c/source/tools/genrb/write.c +++ b/icu4c/source/tools/genrb/write.c @@ -187,7 +187,7 @@ rb_write(FileStream *f, break; case eEmpty: - *status = INTERNAL_PROGRAM_ERROR; + *status = U_INTERNAL_PROGRAM_ERROR; setErrorText("Unexpected empty item found"); goto finish; /*break;*/ @@ -199,7 +199,7 @@ rb_write(FileStream *f, /* Check if any errors occurred during writing */ if(T_FileStream_error(f) != 0) { - *status = FILE_ACCESS_ERROR; + *status = U_FILE_ACCESS_ERROR; } finish: diff --git a/icu4c/source/tools/makeconv/makeconv.c b/icu4c/source/tools/makeconv/makeconv.c index ac12b6709c7..6b949c3bd50 100644 --- a/icu4c/source/tools/makeconv/makeconv.c +++ b/icu4c/source/tools/makeconv/makeconv.c @@ -75,7 +75,7 @@ static const char UNICODE_CODEPOINT_SEPARATORS[6] = { '<', '>', 'U', ' ', '\t', int main(int argc, char** argv) { UConverterSharedData* mySharedData = NULL; - UErrorCode err = ZERO_ERROR; + UErrorCode err = U_ZERO_ERROR; char outFileName[MAX_FULL_FILE_NAME_LENGTH]; char* dot = NULL; @@ -101,7 +101,7 @@ int main(int argc, char** argv) { /* in an error is found, print out a error msg and keep going*/ printf("Error creating \"%s\" file for \"%s\" (error code %d)\n", outFileName, argv[argc], err); - err = ZERO_ERROR; + err = U_ZERO_ERROR; } else { @@ -187,7 +187,7 @@ void writeUConverterSharedDataToFile(const char* filename, outfile = T_FileStream_open(filename, "wb"); if (outfile == NULL) { - *err = FILE_ACCESS_ERROR; + *err = U_FILE_ACCESS_ERROR; return; } @@ -226,7 +226,7 @@ void writeUConverterSharedDataToFile(const char* filename, if (T_FileStream_error(outfile)) { - *err = FILE_ACCESS_ERROR; + *err = U_FILE_ACCESS_ERROR; } T_FileStream_close(outfile); } @@ -338,7 +338,7 @@ void readHeaderFromFile(UConverter* myConverter, } else { - *err = INVALID_TABLE_FORMAT; + *err = U_INVALID_TABLE_FORMAT; return; } @@ -385,7 +385,7 @@ void readHeaderFromFile(UConverter* myConverter, } - if (!endOfHeader || !hasConvClass) *err = INVALID_TABLE_FORMAT; + if (!endOfHeader || !hasConvClass) *err = U_INVALID_TABLE_FORMAT; return; } @@ -409,7 +409,7 @@ void loadSBCSTableFromFile(FileStream* convFile, UConverter* myConverter, UError myConverterTable = (ConverterTable*)icu_malloc(sizeof(SBCS_TABLE)); if (myConverterTable == NULL) { - *err = MEMORY_ALLOCATION_ERROR; + *err = U_MEMORY_ALLOCATION_ERROR; return; } @@ -418,7 +418,7 @@ void loadSBCSTableFromFile(FileStream* convFile, UConverter* myConverter, UError if (myFromUnicode == NULL) { icu_free(myConverterTable); - *err = MEMORY_ALLOCATION_ERROR; + *err = U_MEMORY_ALLOCATION_ERROR; return; } @@ -476,7 +476,7 @@ void loadMBCSTableFromFile(FileStream* convFile, UConverter* myConverter, UError myConverterTable = (ConverterTable*)icu_malloc(sizeof(MBCS_TABLE)); if (myConverterTable == NULL) { - *err = MEMORY_ALLOCATION_ERROR; + *err = U_MEMORY_ALLOCATION_ERROR; return; } @@ -549,7 +549,7 @@ void loadEBCDIC_STATEFULTableFromFile(FileStream* convFile, UConverter* myConver myConverterTable = (ConverterTable*)icu_malloc(sizeof(MBCS_TABLE)); if (myConverterTable == NULL) { - *err = MEMORY_ALLOCATION_ERROR; + *err = U_MEMORY_ALLOCATION_ERROR; return; } @@ -616,7 +616,7 @@ void loadDBCSTableFromFile(FileStream* convFile, UConverter* myConverter, UError myConverterTable = (ConverterTable*)icu_malloc(sizeof(DBCS_TABLE)); if (myConverterTable == NULL) { - *err = MEMORY_ALLOCATION_ERROR; + *err = U_MEMORY_ALLOCATION_ERROR; return; } @@ -701,7 +701,7 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE convFile = T_FileStream_open(converterName, "r"); if (convFile == NULL) { - *err = FILE_ACCESS_ERROR; + *err = U_FILE_ACCESS_ERROR; return NULL; } @@ -709,7 +709,7 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE mySharedData = (UConverterSharedData*) icu_malloc(sizeof(UConverterSharedData)); if (mySharedData == NULL) { - *err = MEMORY_ALLOCATION_ERROR; + *err = U_MEMORY_ALLOCATION_ERROR; T_FileStream_close(convFile); } @@ -747,7 +747,3 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE T_FileStream_close(convFile); return mySharedData; } - - - - diff --git a/icu4c/source/tools/rbdump/parse.c b/icu4c/source/tools/rbdump/parse.c index fcaf2807218..396f5492e72 100644 --- a/icu4c/source/tools/rbdump/parse.c +++ b/icu4c/source/tools/rbdump/parse.c @@ -61,7 +61,7 @@ read_ustring(FileStream *rb, /* Allocate space for the string */ s = (UChar*) icu_malloc(sizeof(UChar) * (len + 1)); if(s == 0) { - *status = MEMORY_ALLOCATION_ERROR; + *status = U_MEMORY_ALLOCATION_ERROR; return 0; } @@ -234,7 +234,7 @@ parse(FileStream *f, /* Verify the byte ordering matches */ if(bom != sBOM) { - *status = INVALID_FORMAT_ERROR; + *status = U_INVALID_FORMAT_ERROR; goto finish; } @@ -286,7 +286,7 @@ parse(FileStream *f, /* Check if any errors occurred during reading */ if(T_FileStream_error(f) != 0) { - *status = FILE_ACCESS_ERROR; + *status = U_FILE_ACCESS_ERROR; } finish: diff --git a/icu4c/source/tools/rbdump/read.c b/icu4c/source/tools/rbdump/read.c index afe01393db6..13024e2330a 100644 --- a/icu4c/source/tools/rbdump/read.c +++ b/icu4c/source/tools/rbdump/read.c @@ -93,7 +93,7 @@ main(int argc, /* print out the files */ for(i = optind; i < argc; ++i) { - status = ZERO_ERROR; + status = U_ZERO_ERROR; processFile(argv[i], &status); if(FAILURE(status)) { printf("rbdump: %s processing file \"%s\"\n", errorName(status), argv[i]); @@ -140,7 +140,7 @@ processFile(const char *filename, /* Open the input file for reading */ in = T_FileStream_open(filename, "rb"); if(in == 0) { - *status = FILE_ACCESS_ERROR; + *status = U_FILE_ACCESS_ERROR; return; } @@ -150,35 +150,3 @@ processFile(const char *filename, /* Clean up */ T_FileStream_close(in); } - -/* Get the error message for an error code */ -static const char* -errorName(UErrorCode status) -{ - switch(status) { - case ZERO_ERROR: return "ZERO_ERROR"; - case ILLEGAL_ARGUMENT_ERROR: return "ILLEGAL_ARGUMENT_ERROR"; - case MISSING_RESOURCE_ERROR: return "MISSING_RESOURCE_ERROR"; - case INVALID_FORMAT_ERROR: return "INVALID_FORMAT_ERROR"; - case FILE_ACCESS_ERROR: return "FILE_ACCESS_ERROR"; - case INTERNAL_PROGRAM_ERROR: return "INTERNAL_PROGRAM_ERROR"; - case MESSAGE_PARSE_ERROR: return "MESSAGE_PARSE_ERROR"; - case MEMORY_ALLOCATION_ERROR: return "MEMORY_ALLOCATION_ERROR"; - case INDEX_OUTOFBOUNDS_ERROR: return "INDEX_OUTOFBOUNDS_ERROR"; - case PARSE_ERROR: return "PARSE_ERROR"; - case INVALID_CHAR_FOUND: return "INVALID_CHAR_FOUND"; - case TRUNCATED_CHAR_FOUND: return "TRUNCATED_CHAR_FOUND"; - case ILLEGAL_CHAR_FOUND: return "ILLEGAL_CHAR_FOUND"; - case INVALID_TABLE_FORMAT: return "INVALID_TABLE_FORMAT"; - case INVALID_TABLE_FILE: return "INVALID_TABLE_FILE"; - case BUFFER_OVERFLOW_ERROR: return "BUFFER_OVERFLOW_ERROR"; - case UNSUPPORTED_ERROR: return "UNSUPPORTED_ERROR"; - case USING_FALLBACK_ERROR: return "USING_FALLBACK_ERROR"; - case USING_DEFAULT_ERROR: return "USING_DEFAULT_ERROR"; - default: return "[BOGUS UErrorCode]"; - } -} - - - - diff --git a/icu4c/source/tools/rbdump/uprint.c b/icu4c/source/tools/rbdump/uprint.c index d445b0cc183..57ada0489fb 100644 --- a/icu4c/source/tools/rbdump/uprint.c +++ b/icu4c/source/tools/rbdump/uprint.c @@ -58,7 +58,7 @@ uprint(const UChar *s, /* perform the conversion */ do { /* reset the error code */ - *status = ZERO_ERROR; + *status = U_ZERO_ERROR; /* perform the conversion */ ucnv_fromUnicode(converter, &myTarget, myTarget + arraySize, @@ -72,7 +72,7 @@ uprint(const UChar *s, myTarget = buf; arraySize = BUF_SIZE; } - while(*status == INDEX_OUTOFBOUNDS_ERROR); + while(*status == U_INDEX_OUTOFBOUNDS_ERROR); finish: