X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..d5d484b0fbe924d3663b177965538d517ee412c1:/icuSources/common/ucmndata.c?ds=inline diff --git a/icuSources/common/ucmndata.c b/icuSources/common/ucmndata.c index 03043b99..1b12ffbd 100644 --- a/icuSources/common/ucmndata.c +++ b/icuSources/common/ucmndata.c @@ -103,7 +103,7 @@ offsetTOCLookupFn(const UDataMemory *pData, UErrorCode *pErrorCode) { const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc; if(toc!=NULL) { - const char *base=(const char *)pData->toc; + const char *base=(const char *)toc; uint32_t start, limit, number, lastNumber; int32_t strResult; const UDataOffsetTOCEntry *entry; @@ -120,13 +120,11 @@ offsetTOCLookupFn(const UDataMemory *pData, limit=toc->count; /* number of names in this table of contents */ lastNumber=limit; entry=toc->entry; - if (limit == 0) { /* Stub common data library used during build is empty. */ - return NULL; - } for (;;) { number = (start+limit)/2; if (lastNumber == number) { /* Have we moved? */ - break; /* We haven't moved, and it wasn't found. */ + break; /* We haven't moved, and it wasn't found; */ + /* or the empty stub common data library was used during build. */ } lastNumber = number; strResult = uprv_strcmp(tocEntryName, base+entry[number].nameOffset); @@ -165,11 +163,7 @@ offsetTOCLookupFn(const UDataMemory *pData, static uint32_t pointerTOCEntryCount(const UDataMemory *pData) { const PointerTOC *toc = (PointerTOC *)pData->toc; - if (toc != NULL) { - return toc->count; - } else { - return 0; - } + return (uint32_t)((toc != NULL) ? (toc->count) : 0); } @@ -194,14 +188,11 @@ static const DataHeader *pointerTOCLookupFn(const UDataMemory *pData, limit=toc->count; lastNumber=limit; - if (limit == 0) { /* Stub common data library used during build is empty. */ - return NULL; - } - for (;;) { number = (start+limit)/2; if (lastNumber == number) { /* Have we moved? */ - break; /* We haven't moved, and it wasn't found. */ + break; /* We haven't moved, and it wasn't found, */ + /* or the empty stub common data library was used during build. */ } lastNumber = number; strResult = uprv_strcmp(name, toc->entry[number].entryName);