From b32fbfedc67108cdef974876ed96762e2cefba98 Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Thu, 20 Jul 2000 22:25:32 +0000 Subject: [PATCH] ICU-447 removed dead code X-SVN-Rev: 1995 --- icu4c/source/common/unicode/ures.h | 4 +- icu4c/source/common/uresbund.c | 23 ----- icu4c/source/common/uresdata.c | 135 ----------------------------- icu4c/source/common/uresdata.h | 38 -------- icu4c/source/common/uresimp.h | 18 ---- 5 files changed, 3 insertions(+), 215 deletions(-) diff --git a/icu4c/source/common/unicode/ures.h b/icu4c/source/common/unicode/ures.h index 623592b3fef..eda2639da7e 100644 --- a/icu4c/source/common/unicode/ures.h +++ b/icu4c/source/common/unicode/ures.h @@ -566,7 +566,9 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resourceB */ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* key, int32_t* len, UErrorCode *status); - +U_CFUNC const char* ures_getName(const UResourceBundle* resB); +U_CFUNC const char* ures_getPath(const UResourceBundle* resB); +U_CFUNC const char* ures_getTag(const UResourceBundle* resB); #endif /*_URES*/ /*eof*/ diff --git a/icu4c/source/common/uresbund.c b/icu4c/source/common/uresbund.c index afc1bcfd8ee..29e2bbd79e0 100644 --- a/icu4c/source/common/uresbund.c +++ b/icu4c/source/common/uresbund.c @@ -72,16 +72,6 @@ void entryIncrease(UResourceDataEntry *entry) { umtx_unlock(&resbMutex); } -void entryDecrease(UResourceDataEntry *entry) { - umtx_lock(&resbMutex); - entry->fCountExisting++; - while(entry->fParent != NULL) { - entry = entry->fParent; - entry->fCountExisting++; - } - umtx_unlock(&resbMutex); -} - /** * Internal function. Tries to find a resource in given Resource * Bundle, as well as in its parents @@ -474,19 +464,6 @@ UResourceBundle *copyResb(UResourceBundle *r, const UResourceBundle *original, U } } -void copyResbFillIn(UResourceBundle *r, const UResourceBundle *original) { - if(r == NULL || original == NULL) { - return; - } - uprv_memcpy(r, original, sizeof(UResourceBundle)); - ures_setIsStackObject(r, TRUE); - if(original->fData != NULL) { - entryIncrease(r->fData); - } -} - - - /** * Functions to retrieve data from resource bundles. */ diff --git a/icu4c/source/common/uresdata.c b/icu4c/source/common/uresdata.c index 984a8509d0d..d60a753bd31 100644 --- a/icu4c/source/common/uresdata.c +++ b/icu4c/source/common/uresdata.c @@ -168,20 +168,6 @@ _res_findTableIndex(const Resource *pRoot, const Resource res, const char *key) } } -static UBool -_res_isStringArray(Resource *r) { - int32_t count=*(int32_t *)r; - - /* check to make sure all items are strings */ - while(count>0) { - if(RES_GET_TYPE(*++r)!=RES_STRING) { - return FALSE; - } - --count; - } - return TRUE; -} - /* helper for res_load() ---------------------------------------------------- */ static UBool @@ -257,27 +243,6 @@ res_getBinary(const ResourceData *pResData, const Resource res, int32_t *pLength } } -U_CFUNC Resource -res_getStringArray(const ResourceData *pResData, const char *key, int32_t *pCount) { - Resource res=_res_findTableItem(pResData->pRoot, pResData->rootRes, key); - if(res!=RES_BOGUS && RES_GET_TYPE(res)==RES_ARRAY) { - Resource *p=RES_GET_POINTER(pResData->pRoot, res); - int32_t count=*(int32_t *)p; - *pCount=count; - - /* check to make sure all items are strings */ - if(!_res_isStringArray(p)) { - *pCount=0; - return RES_BOGUS; - } - return res; - } else { - *pCount=0; - return RES_BOGUS; - } -} - - U_CFUNC int32_t res_countArrayItems(const ResourceData *pResData, const Resource res) { if(res!=RES_BOGUS) { @@ -294,64 +259,11 @@ res_countArrayItems(const ResourceData *pResData, const Resource res) { return 0; } -U_CFUNC int32_t -res_count2dArrayCols(const ResourceData *pResData, const Resource res) { - if(res!=RES_BOGUS) { - if(RES_GET_TYPE(res)==RES_ARRAY) { - Resource *p=RES_GET_POINTER(pResData->pRoot, res); - int32_t count = *(int32_t *)RES_GET_POINTER(pResData->pRoot, *(p+1)); /*Number of columns in the first row*/ - return count; - } - } - return 0; -} - -U_CFUNC Resource -res_get2DStringArray(const ResourceData *pResData, const char *key, int32_t *pRows, int32_t *pCols) { - Resource res=_res_findTableItem(pResData->pRoot, pResData->rootRes, key); - if(res!=RES_BOGUS && RES_GET_TYPE(res)==RES_ARRAY) { - Resource *p=RES_GET_POINTER(pResData->pRoot, res); - Resource *row=NULL; - int32_t row_count=*(int32_t *)p; - *pRows = row_count; - - *pCols = *(int32_t *)RES_GET_POINTER(pResData->pRoot, *(p+1)); /*Number of columns in the first row*/ - - /* check to make sure all items are strings */ - while(row_count>0) { - row = RES_GET_POINTER(pResData->pRoot, *(++p)); - if(!_res_isStringArray(row) || RES_GET_TYPE(*p)!=RES_ARRAY) { - *pRows=0; - *pCols=0; - return RES_BOGUS; - } else { - int32_t col_count=*(int32_t *)(row); - if(*pCols != col_count) { - *pRows=0; - *pCols=0; - return RES_BOGUS; - } - } - --row_count; - } - return res; - } else { - *pRows=0; - *pCols=0; - return RES_BOGUS; - } -} - U_CFUNC Resource res_getResource(const ResourceData *pResData, const char *key) { return _res_findTableItem(pResData->pRoot, pResData->rootRes, key); } -U_CFUNC Resource -res_getTable(const ResourceData *pResData, const char *key) { - return _res_findTableItem(pResData->pRoot, pResData->rootRes, key); -} - U_CFUNC Resource res_getArrayItem(const ResourceData *pResData, const Resource array, const int32_t indexR) { return _res_getArrayItem(pResData->pRoot, array, indexR); } @@ -406,50 +318,3 @@ res_getNextStringTableItem(const ResourceData *pResData, Resource table, const U *value = _res_getString(pResData->pRoot, next, len); } -U_CFUNC const UChar * -res_getStringTableItem(const ResourceData *pResData, Resource table, const char *key, int32_t *len) { - Resource res = _res_findTableItem(pResData->pRoot, table, key); - if(RES_GET_TYPE(res) != RES_STRING) { - return NULL; - } - - return _res_getString(pResData->pRoot, res, len); - -} - - -U_CFUNC const UChar * -res_get2DStringArrayItem(const ResourceData *pResData, - Resource arrayRes, int32_t row, int32_t col, int32_t *pLength) { - Resource res = _res_getArrayItem(pResData->pRoot, arrayRes, row); - return _res_getString(pResData->pRoot, - _res_getArrayItem(pResData->pRoot, res, col), - pLength); -} - -U_CFUNC const UChar * -res_getStringArrayItem(const ResourceData *pResData, - Resource arrayRes, int32_t indexS, int32_t *pLength) { - return _res_getString(pResData->pRoot, - _res_getArrayItem(pResData->pRoot, arrayRes, indexS), - pLength); -} - -U_CFUNC const char * -res_getVersion(const ResourceData *pResData) { - UDataInfo *info; - - info = (UDataInfo *)uprv_malloc(sizeof(UDataInfo)); - uprv_memset(info, 0, sizeof(UDataInfo)); - - if(info == NULL) { - return NULL; - } - - udata_getInfo(pResData->data, info); - - uprv_free(info); - - return NULL; -} - diff --git a/icu4c/source/common/uresdata.h b/icu4c/source/common/uresdata.h index c8e064120a4..ba80c6d5e6d 100644 --- a/icu4c/source/common/uresdata.h +++ b/icu4c/source/common/uresdata.h @@ -95,54 +95,16 @@ res_getString(const ResourceData *pResData, const Resource res, int32_t *pLength U_CFUNC const uint8_t * res_getBinary(const ResourceData *pResData, const Resource res, int32_t *pLength); -/* - * Get a Resource handle for an array of strings, and get the number of strings. - * Returns RES_BOGUS if not found. - */ -U_CFUNC Resource -res_getStringArray(const ResourceData *pResData, const char *key, int32_t *pCount); - -U_CFUNC Resource -res_get2DStringArray(const ResourceData *pResData, const char *key, - int32_t *pRows, int32_t *pCols); - -U_CFUNC Resource -res_getTable(const ResourceData *pResData, const char *key); - - U_CFUNC Resource res_getResource(const ResourceData *pResData, const char *key); -/* - * Get a string from a string array. - * This assumes that arrayRes is a valid handle to an array of strings as returned - * by res_getStringArray(), and that index is within bounds. - */ -U_CFUNC const UChar * -res_getStringArrayItem(const ResourceData *pResData, - Resource arrayRes, int32_t indexS, int32_t *pLength); - -U_CFUNC const UChar * -res_get2DStringArrayItem(const ResourceData *pResData, - Resource arrayRes, int32_t row, int32_t col, int32_t *pLength); - -U_CFUNC const UChar * -res_getStringTableItem(const ResourceData *pResData, Resource table, - const char *key, int32_t *len); -U_CFUNC const char * -res_getVersion(const ResourceData *pResData); - U_CFUNC int32_t res_countArrayItems(const ResourceData *pResData, const Resource res); -U_CFUNC int32_t -res_count2dArrayCols(const ResourceData *pResData, const Resource res); - U_CFUNC void res_getNextStringTableItem(const ResourceData *pResData, Resource table, const UChar **value, const char **key, int32_t *len, int16_t *indexS); - U_CFUNC int32_t res_getTableSize(const ResourceData *pResData, Resource table); U_CFUNC Resource res_getArrayItem(const ResourceData *pResData, const Resource array, const int32_t indexS); diff --git a/icu4c/source/common/uresimp.h b/icu4c/source/common/uresimp.h index d80ee5ae362..c3e6278ca63 100644 --- a/icu4c/source/common/uresimp.h +++ b/icu4c/source/common/uresimp.h @@ -66,34 +66,16 @@ struct UResourceBundle { Resource fRes; }; -/*U_CFUNC UResourceBundle* ures_openNoFallback(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status);*/ U_CFUNC UResourceBundle* ures_openNoFallback(const char* path, const char* localeID, UErrorCode* status); U_CFUNC const char* ures_getRealLocale(const UResourceBundle* resourceBundle, UErrorCode* status); U_CAPI void ures_setIsStackObject( UResourceBundle* resB, UBool state); U_CAPI UBool ures_isStackObject( UResourceBundle* resB, UErrorCode *status); -/*U_CFUNC UChar** ures_listInstalledLocales(const char *path, int32_t* count);*/ U_CFUNC const ResourceData *getFallbackData(const UResourceBundle* resBundle, const char* * resTag, UResourceDataEntry* *realData, Resource *res, UErrorCode *status); U_CFUNC int32_t hashBundle(const void *parm); U_CFUNC UBool compareBundles(const void *p1, const void *p2); /* Candidates for export */ U_CFUNC UResourceBundle *copyResb(UResourceBundle *r, const UResourceBundle *original, UErrorCode *status); -U_CFUNC void copyResbFillIn(UResourceBundle *dest, const UResourceBundle *original); -U_CFUNC const char* ures_getName(const UResourceBundle* resB); -U_CFUNC const char* ures_getPath(const UResourceBundle* resB); -U_CFUNC const char* ures_getTag(const UResourceBundle* resB); U_CFUNC const ResourceData * ures_getResData(const UResourceBundle* resB); -/* -U_CAPI int32_t U_EXPORT2 ures_getStringArray(const UResourceBundle* resourceBundle, const char* resourceTag, const UChar** array, - int32_t maxLen, UErrorCode* err); - -U_CAPI int32_t U_EXPORT2 ures_get2dStringArray(const UResourceBundle* resourceBundle, const char* resourceTag, const UChar*** matrix, - int32_t maxRows, int32_t cols, UErrorCode* err); - -U_CAPI int32_t U_EXPORT2 ures_getTaggedStringArray(const UResourceBundle* resourceBundle, const char* resourceTag, const char** itemTags, - const UChar** items, int32_t maxItems, - UErrorCode* err); - -*/ #endif /*URESIMP_H*/