diff options
Diffstat (limited to 'thirdparty/icu4c/common/udata.cpp')
-rw-r--r-- | thirdparty/icu4c/common/udata.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/thirdparty/icu4c/common/udata.cpp b/thirdparty/icu4c/common/udata.cpp index ec9c999cea..2bc74c9789 100644 --- a/thirdparty/icu4c/common/udata.cpp +++ b/thirdparty/icu4c/common/udata.cpp @@ -106,10 +106,10 @@ static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err); */ static UDataMemory *gCommonICUDataArray[10] = { NULL }; // Access protected by icu global mutex. -static u_atomic_int32_t gHaveTriedToLoadCommonData = ATOMIC_INT32_T_INITIALIZER(0); // See extendICUData(). +static u_atomic_int32_t gHaveTriedToLoadCommonData {0}; // See extendICUData(). static UHashtable *gCommonDataCache = NULL; /* Global hash table of opened ICU data files. */ -static icu::UInitOnce gCommonDataCacheInitOnce = U_INITONCE_INITIALIZER; +static icu::UInitOnce gCommonDataCacheInitOnce {}; #if !defined(ICU_DATA_DIR_WINDOWS) static UDataFileAccess gDataFileAccess = UDATA_DEFAULT_ACCESS; // Access not synchronized. @@ -136,25 +136,25 @@ udata_cleanup(void) } gHaveTriedToLoadCommonData = 0; - return TRUE; /* Everything was cleaned up */ + return true; /* Everything was cleaned up */ } static UBool U_CALLCONV findCommonICUDataByName(const char *inBasename, UErrorCode &err) { - UBool found = FALSE; + UBool found = false; int32_t i; UDataMemory *pData = udata_findCachedData(inBasename, err); if (U_FAILURE(err) || pData == NULL) - return FALSE; + return false; { Mutex lock; for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) { if ((gCommonICUDataArray[i] != NULL) && (gCommonICUDataArray[i]->pHeader == pData->pHeader)) { /* The data pointer is already in the array. */ - found = TRUE; + found = true; break; } } @@ -174,9 +174,9 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca { UDataMemory *newCommonData = UDataMemory_createNewInstance(pErr); int32_t i; - UBool didUpdate = FALSE; + UBool didUpdate = false; if (U_FAILURE(*pErr)) { - return FALSE; + return false; } /* For the assignment, other threads must cleanly see either the old */ @@ -188,7 +188,7 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) { if (gCommonICUDataArray[i] == NULL) { gCommonICUDataArray[i] = newCommonData; - didUpdate = TRUE; + didUpdate = true; break; } else if (gCommonICUDataArray[i]->pHeader == pData->pHeader) { /* The same data pointer is already in the array. */ @@ -216,7 +216,7 @@ setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCod UDataMemory_init(&tData); UDataMemory_setData(&tData, pData); udata_checkCommonData(&tData, pErrorCode); - return setCommonICUData(&tData, FALSE, pErrorCode); + return setCommonICUData(&tData, false, pErrorCode); } #endif @@ -429,7 +429,7 @@ private: CharString pathBuffer; /* output path for this it'ion */ CharString packageStub; /* example: "/icudt28b". Will ignore that leaf in set paths. */ - UBool checkLastFour; /* if TRUE then allow paths such as '/foo/myapp.dat' + UBool checkLastFour; /* if true then allow paths such as '/foo/myapp.dat' * to match, checks last 4 chars of suffix with * last 4 of path, then previous chars. */ }; @@ -501,7 +501,7 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg, suffix.data(), itemPath.data(), nextPath, - checkLastFour?"TRUE":"false"); + checkLastFour?"true":"false"); #endif } @@ -568,7 +568,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode) /* check for .dat files */ pathBasename = findBasename(pathBuffer.data()); - if(checkLastFour == TRUE && + if(checkLastFour == true && (pathLen>=4) && uprv_strncmp(pathBuffer.data() +(pathLen-4), suffix.data(), 4)==0 && /* suffix matches */ uprv_strncmp(findBasename(pathBuffer.data()), basename, basenameLen)==0 && /* base matches */ @@ -711,15 +711,15 @@ openCommonData(const char *path, /* Path from OpenChoice? */ */ /* if (uprv_getICUData_collation) { - setCommonICUDataPointer(uprv_getICUData_collation(), FALSE, pErrorCode); + setCommonICUDataPointer(uprv_getICUData_collation(), false, pErrorCode); } if (uprv_getICUData_conversion) { - setCommonICUDataPointer(uprv_getICUData_conversion(), FALSE, pErrorCode); + setCommonICUDataPointer(uprv_getICUData_conversion(), false, pErrorCode); } */ #if !defined(ICU_DATA_DIR_WINDOWS) // When using the Windows system data, we expect only a single data file. - setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, FALSE, pErrorCode); + setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, false, pErrorCode); { Mutex lock; return gCommonICUDataArray[commonDataIndex]; @@ -761,9 +761,9 @@ openCommonData(const char *path, /* Path from OpenChoice? */ * Hunt it down, trying all the path locations */ - UDataPathIterator iter(u_getDataDirectory(), inBasename, path, ".dat", TRUE, pErrorCode); + UDataPathIterator iter(u_getDataDirectory(), inBasename, path, ".dat", true, pErrorCode); - while ((UDataMemory_isLoaded(&tData)==FALSE) && (pathBuffer = iter.next(pErrorCode)) != NULL) + while ((UDataMemory_isLoaded(&tData)==false) && (pathBuffer = iter.next(pErrorCode)) != NULL) { #ifdef UDATA_DEBUG fprintf(stderr, "ocd: trying path %s - ", pathBuffer); @@ -822,7 +822,7 @@ static UBool extendICUData(UErrorCode *pErr) { UDataMemory *pData; UDataMemory copyPData; - UBool didUpdate = FALSE; + UBool didUpdate = false; /* * There is a chance for a race condition here. @@ -859,7 +859,7 @@ static UBool extendICUData(UErrorCode *pErr) didUpdate = /* no longer using this result */ setCommonICUData(©PData,/* The new common data. */ - FALSE, /* No warnings if write didn't happen */ + false, /* No warnings if write didn't happen */ pErr); /* setCommonICUData honors errors; NOP if error set */ } @@ -906,7 +906,7 @@ udata_setCommonData(const void *data, UErrorCode *pErrorCode) { /* we have good data */ /* Set it up as the ICU Common Data. */ - setCommonICUData(&dataMemory, TRUE, pErrorCode); + setCommonICUData(&dataMemory, true, pErrorCode); } /*--------------------------------------------------------------------------- @@ -999,7 +999,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, /* look in ind. files: package\nam.typ ========================= */ /* init path iterator for individual files */ - UDataPathIterator iter(dataPath, pkgName, path, tocEntryPathSuffix, FALSE, pErrorCode); + UDataPathIterator iter(dataPath, pkgName, path, tocEntryPathSuffix, false, pErrorCode); while ((pathBuffer = iter.next(pErrorCode)) != NULL) { @@ -1055,7 +1055,7 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName const DataHeader *pHeader; UDataMemory *pCommonData; int32_t commonDataIndex; - UBool checkedExtendedICUData = FALSE; + UBool checkedExtendedICUData = false; /* try to get common data. The loop is for platforms such as the 390 that do * not initially load the full set of ICU data. If the lookup of an ICU data item * fails, the full (but slower to load) set is loaded, the and the loop repeats, @@ -1104,7 +1104,7 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName } else if (pCommonData != NULL) { ++commonDataIndex; /* try the next data package */ } else if ((!checkedExtendedICUData) && extendICUData(subErrorCode)) { - checkedExtendedICUData = TRUE; + checkedExtendedICUData = true; /* try this data package slot again: it changed from NULL to non-NULL */ } else { return NULL; @@ -1169,7 +1169,7 @@ doOpenChoice(const char *path, const char *type, const char *name, UErrorCode subErrorCode=U_ZERO_ERROR; const char *treeChar; - UBool isICUData = FALSE; + UBool isICUData = false; FileTracer::traceOpen(path, type, name); @@ -1182,7 +1182,7 @@ doOpenChoice(const char *path, const char *type, const char *name, uprv_strlen(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING)) || !uprv_strncmp(path, U_ICUDATA_ALIAS U_TREE_SEPARATOR_STRING, /* "ICUDATA-" */ uprv_strlen(U_ICUDATA_ALIAS U_TREE_SEPARATOR_STRING))) { - isICUData = TRUE; + isICUData = true; } #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR) /* Windows: try "foo\bar" and "foo/bar" */ |