From 1e7ac47da45656270146d8e4a2f5d8582819395b Mon Sep 17 00:00:00 2001 From: Richard Gillam Date: Wed, 8 Dec 1999 01:11:01 +0000 Subject: [PATCH] ICU-157 fixed opening single, mapped files X-SVN-Rev: 338 --- icu4c/source/common/udata.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/icu4c/source/common/udata.c b/icu4c/source/common/udata.c index 355e198d01..b4704f13ce 100644 --- a/icu4c/source/common/udata.c +++ b/icu4c/source/common/udata.c @@ -194,7 +194,9 @@ LOAD_LIBRARY(const char *path, const char *basename, bool_t isCommon) { pData->p=p; /* is it acceptable? */ - if(NULL==getChoice(pData, NULL, DATA_TYPE, COMMON_DATA_NAME, isCommonDataAcceptable, NULL, &errorCode)) { + if(NULL==getChoice(pData, NULL, DATA_TYPE, COMMON_DATA_NAME, + isCommon ? isCommonDataAcceptable : NULL, NULL, &errorCode) + ) { udata_close(pData); return NULL; } @@ -351,7 +353,9 @@ LOAD_LIBRARY(const char *path, const char *basename, bool_t isCommon) { pData->p =(MappedData *)data; /* is it acceptable? */ - if(NULL==getChoice(pData, NULL, DATA_TYPE, COMMON_DATA_NAME, isCommonDataAcceptable, NULL, &errorCode)) { + if(NULL==getChoice(pData, NULL, DATA_TYPE, COMMON_DATA_NAME, + isCommon ? isCommonDataAcceptable : NULL, NULL, &errorCode) + ) { udata_close(pData); return NULL; } @@ -823,7 +827,12 @@ doOpenChoice(const char *path, const char *type, const char *name, if(IS_LIBRARY(lib)) { /* look for the entry point */ - p=getChoice(lib, entryName, type, name, isAcceptable, context, &errorCode); +# ifdef UDATA_MAP + /* entryName passed as NULL: prevent TOC lookup for single, mapped files */ + p=getChoice(lib, NULL, type, name, isAcceptable, context, &errorCode); +# else + p=getChoice(lib, entryName, type, name, isAcceptable, context, &errorCode); +# endif if(p==NULL) { UNLOAD_LIBRARY(lib); } @@ -850,7 +859,12 @@ doOpenChoice(const char *path, const char *type, const char *name, if(IS_LIBRARY(lib)) { /* look for the entry point */ - p=getChoice(lib, entryName, type, name, isAcceptable, context, &errorCode); +# ifdef UDATA_MAP + /* entryName passed as NULL: prevent TOC lookup for single, mapped files */ + p=getChoice(lib, NULL, type, name, isAcceptable, context, &errorCode); +# else + p=getChoice(lib, entryName, type, name, isAcceptable, context, &errorCode); +# endif if(p==NULL) { UNLOAD_LIBRARY(lib); }