From: Andy Heninger Date: Wed, 7 Dec 2016 21:14:27 +0000 (+0000) Subject: ICU-12809 only .cpp files no .c in ICU library code X-Git-Tag: milestone-59-0-1~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fd5600285dfbfd517c88ea28c25e123fda40506;p=icu ICU-12809 only .cpp files no .c in ICU library code X-SVN-Rev: 39527 --- diff --git a/icu4c/source/common/cmemory.c b/icu4c/source/common/cmemory.cpp similarity index 100% rename from icu4c/source/common/cmemory.c rename to icu4c/source/common/cmemory.cpp diff --git a/icu4c/source/common/common.vcxproj b/icu4c/source/common/common.vcxproj index e6c9acffb49..952abc17fd5 100644 --- a/icu4c/source/common/common.vcxproj +++ b/icu4c/source/common/common.vcxproj @@ -237,11 +237,11 @@ - - - - - + + + + + @@ -271,12 +271,12 @@ ..\i18n;%(AdditionalIncludeDirectories) ..\i18n;%(AdditionalIncludeDirectories) - - - - + + + + - + @@ -286,8 +286,8 @@ - - + + false false false @@ -299,59 +299,59 @@ false false - + false false false false - - - + + + false false false false - + - - - - + + + + - - - - - - + + + + + + - - - - + + + + - + - + false - + - - + + false - + false false false @@ -360,7 +360,7 @@ - + @@ -380,10 +380,10 @@ - + - - + + @@ -405,7 +405,7 @@ - + false @@ -417,8 +417,8 @@ - - + + @@ -446,9 +446,9 @@ - + - + @@ -460,7 +460,7 @@ - + @@ -476,7 +476,7 @@ - + @@ -1856,4 +1856,4 @@ - \ No newline at end of file + diff --git a/icu4c/source/common/common.vcxproj.filters b/icu4c/source/common/common.vcxproj.filters index 56e8c12f04d..8cf40fb1c0e 100644 --- a/icu4c/source/common/common.vcxproj.filters +++ b/icu4c/source/common/common.vcxproj.filters @@ -49,16 +49,16 @@ - + bidi - + bidi - + bidi - + bidi @@ -106,22 +106,22 @@ collections - + collections - + collections - + collections - + collections collections - + collections @@ -154,31 +154,31 @@ configuration - + configuration - + configuration configuration - + configuration configuration - + configuration - + configuration - + configuration - + conversion @@ -187,13 +187,13 @@ conversion - + conversion - + conversion - + conversion @@ -202,49 +202,49 @@ conversion - + conversion - + conversion - + conversion - + conversion - + conversion - + conversion conversion - + conversion - + conversion - + conversion - + conversion conversion - + conversion conversion - + data & memory @@ -253,22 +253,22 @@ data & memory - + data & memory data & memory - + data & memory - + data & memory data & memory - + data & memory @@ -289,7 +289,7 @@ formatting - + formatting @@ -334,16 +334,16 @@ locales & resources - + locales & resources locales & resources - + locales & resources - + locales & resources @@ -391,7 +391,7 @@ properties & sets - + properties & sets @@ -418,10 +418,10 @@ properties & sets - + properties & sets - + properties & sets @@ -469,13 +469,13 @@ strings - + strings strings - + strings @@ -493,7 +493,7 @@ strings - + strings @@ -541,7 +541,7 @@ strings - + strings @@ -568,7 +568,7 @@ break iteration - + conversion @@ -595,7 +595,7 @@ registration - + bidi @@ -1181,4 +1181,4 @@ collections - \ No newline at end of file + diff --git a/icu4c/source/common/cstring.c b/icu4c/source/common/cstring.cpp similarity index 100% rename from icu4c/source/common/cstring.c rename to icu4c/source/common/cstring.cpp diff --git a/icu4c/source/common/cwchar.c b/icu4c/source/common/cwchar.cpp similarity index 100% rename from icu4c/source/common/cwchar.c rename to icu4c/source/common/cwchar.cpp diff --git a/icu4c/source/common/icudataver.c b/icu4c/source/common/icudataver.cpp similarity index 100% rename from icu4c/source/common/icudataver.c rename to icu4c/source/common/icudataver.cpp diff --git a/icu4c/source/common/locmap.c b/icu4c/source/common/locmap.cpp similarity index 100% rename from icu4c/source/common/locmap.c rename to icu4c/source/common/locmap.cpp diff --git a/icu4c/source/common/propsvec.c b/icu4c/source/common/propsvec.cpp similarity index 99% rename from icu4c/source/common/propsvec.c rename to icu4c/source/common/propsvec.cpp index ed4d89954b8..6067adf3cf2 100644 --- a/icu4c/source/common/propsvec.c +++ b/icu4c/source/common/propsvec.cpp @@ -499,6 +499,8 @@ upvec_compactToUTrie2Handler(void *context, UChar32 start, UChar32 end, int32_t rowIndex, uint32_t *row, int32_t columns, UErrorCode *pErrorCode) { + (void)row; + (void)columns; UPVecToUTrie2Context *toUTrie2=(UPVecToUTrie2Context *)context; if(starttrie, start, end, (uint32_t)rowIndex, TRUE, pErrorCode); diff --git a/icu4c/source/common/uarrsort.c b/icu4c/source/common/uarrsort.cpp similarity index 99% rename from icu4c/source/common/uarrsort.c rename to icu4c/source/common/uarrsort.cpp index bb1b5bdd785..4d5d8ee08c0 100644 --- a/icu4c/source/common/uarrsort.c +++ b/icu4c/source/common/uarrsort.cpp @@ -38,16 +38,19 @@ enum { U_CAPI int32_t U_EXPORT2 uprv_uint16Comparator(const void *context, const void *left, const void *right) { + (void)context; return (int32_t)*(const uint16_t *)left - (int32_t)*(const uint16_t *)right; } U_CAPI int32_t U_EXPORT2 uprv_int32Comparator(const void *context, const void *left, const void *right) { + (void)context; return *(const int32_t *)left - *(const int32_t *)right; } U_CAPI int32_t U_EXPORT2 uprv_uint32Comparator(const void *context, const void *left, const void *right) { + (void)context; uint32_t l=*(const uint32_t *)left, r=*(const uint32_t *)right; /* compare directly because (l-r) would overflow the int32_t result */ diff --git a/icu4c/source/common/ubidi.c b/icu4c/source/common/ubidi.cpp similarity index 98% rename from icu4c/source/common/ubidi.c rename to icu4c/source/common/ubidi.cpp index 3c949786263..60d5a099746 100644 --- a/icu4c/source/common/ubidi.c +++ b/icu4c/source/common/ubidi.cpp @@ -447,12 +447,12 @@ getDirProps(UBiDi *pBiDi) { UBool removeBiDiControls = (UBool)(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS); - typedef enum { + enum State { NOT_SEEKING_STRONG, /* 0: not contextual paraLevel, not after FSI */ SEEKING_STRONG_FOR_PARA, /* 1: looking for first strong char in para */ SEEKING_STRONG_FOR_FSI, /* 2: looking for first strong after FSI */ LOOKING_FOR_PDI /* 3: found strong after FSI, looking for PDI */ - } State; + }; State state; DirProp lastStrong=ON; /* for default level & inverse BiDi */ /* The following stacks are used to manage isolate sequences. Those @@ -466,7 +466,7 @@ getDirProps(UBiDi *pBiDi) { int32_t isolateStartStack[UBIDI_MAX_EXPLICIT_LEVEL+1]; /* The following stack contains the last known state before encountering the initiator of an isolate sequence */ - int8_t previousStateStack[UBIDI_MAX_EXPLICIT_LEVEL+1]; + State previousStateStack[UBIDI_MAX_EXPLICIT_LEVEL+1]; int32_t stackLast=-1; if(pBiDi->reorderingOptions & UBIDI_OPTION_STREAMING) @@ -677,7 +677,9 @@ bracketInit(UBiDi *pBiDi, BracketData *bd) { bd->isoRuns[0].start=0; bd->isoRuns[0].limit=0; bd->isoRuns[0].level=GET_PARALEVEL(pBiDi, 0); - bd->isoRuns[0].lastStrong=bd->isoRuns[0].lastBase=bd->isoRuns[0].contextDir=GET_PARALEVEL(pBiDi, 0)&1; + UBiDiLevel t = GET_PARALEVEL(pBiDi, 0) & 1; + bd->isoRuns[0].lastStrong = bd->isoRuns[0].lastBase = t; + bd->isoRuns[0].contextDir = (UBiDiDirection)t; bd->isoRuns[0].contextPos=0; if(pBiDi->openingsMemory) { bd->openings=pBiDi->openingsMemory; @@ -696,7 +698,8 @@ bracketProcessB(BracketData *bd, UBiDiLevel level) { bd->isoRunLast=0; bd->isoRuns[0].limit=0; bd->isoRuns[0].level=level; - bd->isoRuns[0].lastStrong=bd->isoRuns[0].lastBase=bd->isoRuns[0].contextDir=level&1; + bd->isoRuns[0].lastStrong=bd->isoRuns[0].lastBase=level&1; + bd->isoRuns[0].contextDir=(UBiDiDirection)(level&1); bd->isoRuns[0].contextPos=0; } @@ -712,8 +715,9 @@ bracketProcessBoundary(BracketData *bd, int32_t lastCcPos, contextLevel=embeddingLevel; pLastIsoRun->limit=pLastIsoRun->start; pLastIsoRun->level=embeddingLevel; - pLastIsoRun->lastStrong=pLastIsoRun->lastBase=pLastIsoRun->contextDir=contextLevel&1; - pLastIsoRun->contextPos=lastCcPos; + pLastIsoRun->lastStrong=pLastIsoRun->lastBase=contextLevel&1; + pLastIsoRun->contextDir=(UBiDiDirection)(contextLevel&1); + pLastIsoRun->contextPos=(UBiDiDirection)lastCcPos; } /* LRI or RLI */ @@ -727,7 +731,8 @@ bracketProcessLRI_RLI(BracketData *bd, UBiDiLevel level) { pLastIsoRun++; pLastIsoRun->start=pLastIsoRun->limit=lastLimit; pLastIsoRun->level=level; - pLastIsoRun->lastStrong=pLastIsoRun->lastBase=pLastIsoRun->contextDir=level&1; + pLastIsoRun->lastStrong=pLastIsoRun->lastBase=level&1; + pLastIsoRun->contextDir=(UBiDiDirection)(level&1); pLastIsoRun->contextPos=0; } @@ -801,7 +806,7 @@ bracketProcessClosing(BracketData *bd, int32_t openIdx, int32_t position) { UBool stable; DirProp newProp; pOpening=&bd->openings[openIdx]; - direction=pLastIsoRun->level&1; + direction=(UBiDiDirection)(pLastIsoRun->level&1); stable=TRUE; /* assume stable until proved otherwise */ /* The stable flag is set when brackets are paired and their @@ -894,7 +899,7 @@ bracketProcessChar(BracketData *bd, int32_t position) { break; } pLastIsoRun->lastBase=ON; - pLastIsoRun->contextDir=newProp; + pLastIsoRun->contextDir=(UBiDiDirection)newProp; pLastIsoRun->contextPos=position; level=bd->pBiDi->levels[position]; if(level&UBIDI_LEVEL_OVERRIDE) { /* X4, X5 */ @@ -942,14 +947,14 @@ bracketProcessChar(BracketData *bd, int32_t position) { dirProps[position]=newProp; pLastIsoRun->lastBase=newProp; pLastIsoRun->lastStrong=newProp; - pLastIsoRun->contextDir=newProp; + pLastIsoRun->contextDir=(UBiDiDirection)newProp; pLastIsoRun->contextPos=position; } else if(dirProp<=R || dirProp==AL) { newProp=DIR_FROM_STRONG(dirProp); pLastIsoRun->lastBase=dirProp; pLastIsoRun->lastStrong=dirProp; - pLastIsoRun->contextDir=newProp; + pLastIsoRun->contextDir=(UBiDiDirection)newProp; pLastIsoRun->contextPos=position; } else if(dirProp==EN) { @@ -958,7 +963,7 @@ bracketProcessChar(BracketData *bd, int32_t position) { newProp=L; /* W7 */ if(!bd->isNumbersSpecial) dirProps[position]=ENL; - pLastIsoRun->contextDir=L; + pLastIsoRun->contextDir=(UBiDiDirection)L; pLastIsoRun->contextPos=position; } else { @@ -967,14 +972,14 @@ bracketProcessChar(BracketData *bd, int32_t position) { dirProps[position]=AN; /* W2 */ else dirProps[position]=ENR; - pLastIsoRun->contextDir=R; + pLastIsoRun->contextDir=(UBiDiDirection)R; pLastIsoRun->contextPos=position; } } else if(dirProp==AN) { newProp=R; /* N0 */ pLastIsoRun->lastBase=AN; - pLastIsoRun->contextDir=R; + pLastIsoRun->contextDir=(UBiDiDirection)R; pLastIsoRun->contextPos=position; } else if(dirProp==NSM) { @@ -1313,7 +1318,7 @@ resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { previousLevel=embeddingLevel; levels[i]=embeddingLevel; if(!bracketProcessChar(&bracketData, i)) - return -1; + return (UBiDiDirection)-1; /* the dirProp may have been changed in bracketProcessChar() */ flags|=DIRPROP_FLAG(dirProps[i]); break; @@ -1772,7 +1777,7 @@ addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag) if (pInsertPoints->capacity == 0) { - pInsertPoints->points=uprv_malloc(sizeof(Point)*FIRSTALLOC); + pInsertPoints->points=static_cast(uprv_malloc(sizeof(Point)*FIRSTALLOC)); if (pInsertPoints->points == NULL) { pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR; @@ -1782,9 +1787,9 @@ addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag) } if (pInsertPoints->size >= pInsertPoints->capacity) /* no room for new point */ { - void * savePoints=pInsertPoints->points; - pInsertPoints->points=uprv_realloc(pInsertPoints->points, - pInsertPoints->capacity*2*sizeof(Point)); + Point * savePoints=pInsertPoints->points; + pInsertPoints->points=static_cast(uprv_realloc(pInsertPoints->points, + pInsertPoints->capacity*2*sizeof(Point))); if (pInsertPoints->points == NULL) { pInsertPoints->points=savePoints; @@ -2342,7 +2347,7 @@ setParaSuccess(UBiDi *pBiDi) { static void setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, UBiDiLevel paraLevel, UErrorCode *pErrorCode) { - void *runsOnlyMemory = NULL; + int32_t *runsOnlyMemory = NULL; int32_t *visualMap; UChar *visualText; int32_t saveLength, saveTrailingWSStart; @@ -2363,7 +2368,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length, goto cleanup3; } /* obtain memory for mapping table and visual text */ - runsOnlyMemory=uprv_malloc(length*(sizeof(int32_t)+sizeof(UChar)+sizeof(UBiDiLevel))); + runsOnlyMemory=static_cast(uprv_malloc(length*(sizeof(int32_t)+sizeof(UChar)+sizeof(UBiDiLevel)))); if(runsOnlyMemory==NULL) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; goto cleanup3; @@ -2558,7 +2563,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, pBiDi->text=text; pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length; pBiDi->paraLevel=paraLevel; - pBiDi->direction=paraLevel&1; + pBiDi->direction=(UBiDiDirection)(paraLevel&1); pBiDi->paraCount=1; pBiDi->dirProps=NULL; @@ -3009,7 +3014,7 @@ ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c) dir = ubidi_getClass(pBiDi->bdp, c); } if(dir >= U_CHAR_DIRECTION_COUNT) { - dir = ON; + dir = (UCharDirection)ON; } return dir; } diff --git a/icu4c/source/common/ubidi_props.c b/icu4c/source/common/ubidi_props.cpp similarity index 99% rename from icu4c/source/common/ubidi_props.c rename to icu4c/source/common/ubidi_props.cpp index 7c7a6ce25ef..121a1ff37cc 100644 --- a/icu4c/source/common/ubidi_props.c +++ b/icu4c/source/common/ubidi_props.cpp @@ -55,6 +55,8 @@ ubidi_getSingleton() { static UBool U_CALLCONV _enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) { + (void)end; + (void)value; /* add the start code point to the USet */ const USetAdder *sa=(const USetAdder *)context; sa->add(sa->set, start); diff --git a/icu4c/source/common/ubidiln.c b/icu4c/source/common/ubidiln.cpp similarity index 100% rename from icu4c/source/common/ubidiln.c rename to icu4c/source/common/ubidiln.cpp diff --git a/icu4c/source/common/ubiditransform.c b/icu4c/source/common/ubiditransform.cpp similarity index 99% rename from icu4c/source/common/ubiditransform.c rename to icu4c/source/common/ubiditransform.cpp index 5f83a2b5a62..4b19717e2dc 100644 --- a/icu4c/source/common/ubiditransform.c +++ b/icu4c/source/common/ubiditransform.cpp @@ -165,6 +165,7 @@ action_reorder(UBiDiTransform *pTransform, UErrorCode *pErrorCode) static UBool action_setInverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode) { + (void)pErrorCode; ubidi_setInverse(pTransform->pBidi, TRUE); ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_INVERSE_LIKE_DIRECT); return FALSE; @@ -183,6 +184,7 @@ action_setInverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode) static UBool action_setRunsOnly(UBiDiTransform *pTransform, UErrorCode *pErrorCode) { + (void)pErrorCode; ubidi_setReorderingMode(pTransform->pBidi, UBIDI_REORDER_RUNS_ONLY); return FALSE; } diff --git a/icu4c/source/common/ubidiwrt.c b/icu4c/source/common/ubidiwrt.cpp similarity index 100% rename from icu4c/source/common/ubidiwrt.c rename to icu4c/source/common/ubidiwrt.cpp diff --git a/icu4c/source/common/ucat.c b/icu4c/source/common/ucat.cpp similarity index 100% rename from icu4c/source/common/ucat.c rename to icu4c/source/common/ucat.cpp diff --git a/icu4c/source/common/uchar.c b/icu4c/source/common/uchar.cpp similarity index 99% rename from icu4c/source/common/uchar.c rename to icu4c/source/common/uchar.cpp index 496df86f4ce..fcd1f8c732b 100644 --- a/icu4c/source/common/uchar.c +++ b/icu4c/source/common/uchar.cpp @@ -68,6 +68,7 @@ struct _EnumTypeCallback { static uint32_t U_CALLCONV _enumTypeValue(const void *context, uint32_t value) { + (void)context; return GET_CATEGORY(value); } @@ -654,6 +655,8 @@ _enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32 /* add the start code point to the USet */ const USetAdder *sa=(const USetAdder *)context; sa->add(sa->set, start); + (void)end; + (void)value; return TRUE; } diff --git a/icu4c/source/common/ucmndata.c b/icu4c/source/common/ucmndata.cpp similarity index 99% rename from icu4c/source/common/ucmndata.c rename to icu4c/source/common/ucmndata.cpp index 6b7d78d104d..fdb21b30570 100644 --- a/icu4c/source/common/ucmndata.c +++ b/icu4c/source/common/ucmndata.cpp @@ -221,6 +221,7 @@ offsetTOCLookupFn(const UDataMemory *pData, const char *tocEntryName, int32_t *pLength, UErrorCode *pErrorCode) { + (void)pErrorCode; const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc; if(toc!=NULL) { const char *base=(const char *)toc; @@ -272,6 +273,7 @@ static const DataHeader *pointerTOCLookupFn(const UDataMemory *pData, const char *name, int32_t *pLength, UErrorCode *pErrorCode) { + (void)pErrorCode; if(pData->toc!=NULL) { const PointerTOC *toc = (PointerTOC *)pData->toc; int32_t number, count=(int32_t)toc->count; diff --git a/icu4c/source/common/ucnv.c b/icu4c/source/common/ucnv.cpp similarity index 100% rename from icu4c/source/common/ucnv.c rename to icu4c/source/common/ucnv.cpp diff --git a/icu4c/source/common/ucnv_cb.c b/icu4c/source/common/ucnv_cb.cpp similarity index 100% rename from icu4c/source/common/ucnv_cb.c rename to icu4c/source/common/ucnv_cb.cpp diff --git a/icu4c/source/common/ucnv_cnv.c b/icu4c/source/common/ucnv_cnv.cpp similarity index 97% rename from icu4c/source/common/ucnv_cnv.c rename to icu4c/source/common/ucnv_cnv.cpp index 01f84829dd3..6e1c53fd8b7 100644 --- a/icu4c/source/common/ucnv_cnv.c +++ b/icu4c/source/common/ucnv_cnv.cpp @@ -33,6 +33,9 @@ ucnv_getCompleteUnicodeSet(const UConverter *cnv, const USetAdder *sa, UConverterUnicodeSet which, UErrorCode *pErrorCode) { + (void)cnv; + (void)which; + (void)pErrorCode; sa->addRange(sa->set, 0, 0x10ffff); } @@ -41,6 +44,9 @@ ucnv_getNonSurrogateUnicodeSet(const UConverter *cnv, const USetAdder *sa, UConverterUnicodeSet which, UErrorCode *pErrorCode) { + (void)cnv; + (void)which; + (void)pErrorCode; sa->addRange(sa->set, 0, 0xd7ff); sa->addRange(sa->set, 0xe000, 0x10ffff); } diff --git a/icu4c/source/common/ucnv_ct.c b/icu4c/source/common/ucnv_ct.cpp similarity index 99% rename from icu4c/source/common/ucnv_ct.c rename to icu4c/source/common/ucnv_ct.cpp index f76919c4a54..c59c0c6bf54 100644 --- a/icu4c/source/common/ucnv_ct.c +++ b/icu4c/source/common/ucnv_ct.cpp @@ -264,7 +264,7 @@ _CompoundTextOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorC UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) cnv->extraInfo; UConverterNamePieces stackPieces; - UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) }; + UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER; myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_0] = NULL; myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_1] = ucnv_loadSharedData("icu-internal-compound-s1", &stackPieces, &stackArgs, errorCode); @@ -319,10 +319,13 @@ _CompoundTextClose(UConverter *converter) { static void _CompoundTextReset(UConverter *converter, UConverterResetChoice choice) { + (void)converter; + (void)choice; } static const char* _CompoundTextgetName(const UConverter* cnv){ + (void)cnv; return "x11-compound-text"; } @@ -613,7 +616,9 @@ static const UConverterImpl _CompoundTextImpl = { _CompoundTextgetName, NULL, NULL, - _CompoundText_GetUnicodeSet + _CompoundText_GetUnicodeSet, + NULL, + NULL }; static const UConverterStaticData _CompoundTextStaticData = { sizeof(UConverterStaticData), diff --git a/icu4c/source/common/ucnv_err.c b/icu4c/source/common/ucnv_err.cpp similarity index 98% rename from icu4c/source/common/ucnv_err.c rename to icu4c/source/common/ucnv_err.cpp index c609bed4bd9..5fb9b655a15 100644 --- a/icu4c/source/common/ucnv_err.c +++ b/icu4c/source/common/ucnv_err.cpp @@ -107,6 +107,10 @@ UCNV_FROM_U_CALLBACK_STOP ( UConverterCallbackReason reason, UErrorCode * err) { + (void)context; + (void)fromUArgs; + (void)codeUnits; + (void)length; if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint)) { /* @@ -130,6 +134,7 @@ UCNV_TO_U_CALLBACK_STOP ( UErrorCode * err) { /* the caller must have set the error code accordingly */ + (void)context; (void)toUArgs; (void)codePoints; (void)length; (void)reason; (void)err; return; } @@ -143,6 +148,9 @@ UCNV_FROM_U_CALLBACK_SKIP ( UConverterCallbackReason reason, UErrorCode * err) { + (void)fromUArgs; + (void)codeUnits; + (void)length; if (reason <= UCNV_IRREGULAR) { if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint)) @@ -171,6 +179,8 @@ UCNV_FROM_U_CALLBACK_SUBSTITUTE ( UConverterCallbackReason reason, UErrorCode * err) { + (void)codeUnits; + (void)length; if (reason <= UCNV_IRREGULAR) { if (reason == UCNV_UNASSIGNED && IS_DEFAULT_IGNORABLE_CODE_POINT(codePoint)) @@ -368,6 +378,9 @@ UCNV_TO_U_CALLBACK_SKIP ( UConverterCallbackReason reason, UErrorCode * err) { + (void)toArgs; + (void)codeUnits; + (void)length; if (reason <= UCNV_IRREGULAR) { if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED)) @@ -388,6 +401,8 @@ UCNV_TO_U_CALLBACK_SUBSTITUTE ( UConverterCallbackReason reason, UErrorCode * err) { + (void)codeUnits; + (void)length; if (reason <= UCNV_IRREGULAR) { if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED)) diff --git a/icu4c/source/common/ucnv_lmb.c b/icu4c/source/common/ucnv_lmb.cpp similarity index 99% rename from icu4c/source/common/ucnv_lmb.c rename to icu4c/source/common/ucnv_lmb.cpp index e4277909fe8..14c83732356 100644 --- a/icu4c/source/common/ucnv_lmb.c +++ b/icu4c/source/common/ucnv_lmb.cpp @@ -600,7 +600,9 @@ static const UConverterImpl _LMBCSImpl##n={\ NULL,\ NULL,\ _LMBCSSafeClone,\ - ucnv_getCompleteUnicodeSet\ + ucnv_getCompleteUnicodeSet,\ + NULL,\ + NULL\ };\ static const UConverterStaticData _LMBCSStaticData##n={\ sizeof(UConverterStaticData),\ @@ -629,12 +631,12 @@ _LMBCSOpenWorker(UConverter* _this, UErrorCode* err, ulmbcs_byte_t OptGroup) { - UConverterDataLMBCS * extraInfo = _this->extraInfo = - (UConverterDataLMBCS*)uprv_malloc (sizeof (UConverterDataLMBCS)); + UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS*)uprv_malloc (sizeof (UConverterDataLMBCS)); + _this->extraInfo = extraInfo; if(extraInfo != NULL) { UConverterNamePieces stackPieces; - UConverterLoadArgs stackArgs={ (int32_t)sizeof(UConverterLoadArgs) }; + UConverterLoadArgs stackArgs= UCNV_LOAD_ARGS_INITIALIZER; ulmbcs_byte_t i; uprv_memset(extraInfo, 0, sizeof(UConverterDataLMBCS)); @@ -691,6 +693,7 @@ _LMBCSSafeClone(const UConverter *cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status) { + (void)status; LMBCSClone *newLMBCS; UConverterDataLMBCS *extraInfo; int32_t i; diff --git a/icu4c/source/common/ucnv_set.c b/icu4c/source/common/ucnv_set.cpp similarity index 100% rename from icu4c/source/common/ucnv_set.c rename to icu4c/source/common/ucnv_set.cpp diff --git a/icu4c/source/common/ucnv_u16.c b/icu4c/source/common/ucnv_u16.cpp similarity index 99% rename from icu4c/source/common/ucnv_u16.c rename to icu4c/source/common/ucnv_u16.cpp index 1458a8a4b32..d07bc42fa90 100644 --- a/icu4c/source/common/ucnv_u16.c +++ b/icu4c/source/common/ucnv_u16.cpp @@ -21,6 +21,7 @@ #if !UCONFIG_NO_CONVERSION #include "unicode/ucnv.h" +#include "unicode/uversion.h" #include "ucnv_bld.h" #include "ucnv_cnv.h" #include "cmemory.h" @@ -587,6 +588,7 @@ static void _UTF16BEOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *pErrorCode) { + (void)pArgs; if(UCNV_GET_VERSION(cnv)<=1) { _UTF16BEReset(cnv, UCNV_RESET_BOTH); } else { @@ -1186,6 +1188,7 @@ static void _UTF16LEOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *pErrorCode) { + (void)pArgs; if(UCNV_GET_VERSION(cnv)<=1) { _UTF16LEReset(cnv, UCNV_RESET_BOTH); } else { @@ -1281,7 +1284,7 @@ _UTF16Reset(UConverter *cnv, UConverterResetChoice choice) { } } -static const UConverterSharedData _UTF16v2Data; +extern const UConverterSharedData _UTF16v2Data; static void _UTF16Open(UConverter *cnv, @@ -1315,7 +1318,7 @@ _UTF16GetName(const UConverter *cnv) { } } -const UConverterSharedData _UTF16Data; +extern const UConverterSharedData _UTF16Data; #define IS_UTF16BE(cnv) ((cnv)->sharedData==&_UTF16BEData) #define IS_UTF16LE(cnv) ((cnv)->sharedData==&_UTF16LEData) @@ -1557,7 +1560,7 @@ static const UConverterStaticData _UTF16v2StaticData = { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */ }; -static const UConverterSharedData _UTF16v2Data = +const UConverterSharedData _UTF16v2Data = UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF16v2StaticData, &_UTF16v2Impl); #endif diff --git a/icu4c/source/common/ucnv_u32.c b/icu4c/source/common/ucnv_u32.cpp similarity index 99% rename from icu4c/source/common/ucnv_u32.c rename to icu4c/source/common/ucnv_u32.cpp index b0a0fe28529..10a2b301885 100644 --- a/icu4c/source/common/ucnv_u32.c +++ b/icu4c/source/common/ucnv_u32.cpp @@ -1038,6 +1038,8 @@ static void _UTF32Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *pErrorCode) { + (void)pArgs; + (void)pErrorCode; _UTF32Reset(cnv, UCNV_RESET_BOTH); } diff --git a/icu4c/source/common/ucnv_u7.c b/icu4c/source/common/ucnv_u7.cpp similarity index 99% rename from icu4c/source/common/ucnv_u7.c rename to icu4c/source/common/ucnv_u7.cpp index c3b4d74b9a9..ae464a27ead 100644 --- a/icu4c/source/common/ucnv_u7.c +++ b/icu4c/source/common/ucnv_u7.cpp @@ -196,6 +196,7 @@ static void _UTF7Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *pErrorCode) { + (void)pArgs; if(UCNV_GET_VERSION(cnv)<=1) { /* TODO(markus): Should just use cnv->options rather than copying the version number. */ cnv->fromUnicodeStatus=UCNV_GET_VERSION(cnv)<<28; @@ -1462,7 +1463,9 @@ static const UConverterImpl _IMAPImpl={ NULL, NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */ NULL, - ucnv_getCompleteUnicodeSet + ucnv_getCompleteUnicodeSet, + NULL, + NULL }; static const UConverterStaticData _IMAPStaticData={ diff --git a/icu4c/source/common/ucnv_u8.c b/icu4c/source/common/ucnv_u8.cpp similarity index 100% rename from icu4c/source/common/ucnv_u8.c rename to icu4c/source/common/ucnv_u8.cpp diff --git a/icu4c/source/common/ucnvdisp.c b/icu4c/source/common/ucnvdisp.cpp similarity index 100% rename from icu4c/source/common/ucnvdisp.c rename to icu4c/source/common/ucnvdisp.cpp diff --git a/icu4c/source/common/ucnvhz.c b/icu4c/source/common/ucnvhz.cpp similarity index 99% rename from icu4c/source/common/ucnvhz.c rename to icu4c/source/common/ucnvhz.cpp index d35551628b0..3848ed31343 100644 --- a/icu4c/source/common/ucnvhz.c +++ b/icu4c/source/common/ucnvhz.cpp @@ -604,7 +604,9 @@ static const UConverterImpl _HZImpl={ NULL, _HZ_WriteSub, _HZ_SafeClone, - _HZ_GetUnicodeSet + _HZ_GetUnicodeSet, + NULL, + NULL }; static const UConverterStaticData _HZStaticData={ diff --git a/icu4c/source/common/ucnvisci.c b/icu4c/source/common/ucnvisci.cpp similarity index 99% rename from icu4c/source/common/ucnvisci.c rename to icu4c/source/common/ucnvisci.cpp index b520fc244e3..e8e676ae929 100644 --- a/icu4c/source/common/ucnvisci.c +++ b/icu4c/source/common/ucnvisci.cpp @@ -1432,7 +1432,7 @@ static void UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *ar if (*toUnicodeStatus != missingCharMarker) { /* Check to make sure that consonant clusters are handled correct for Gurmukhi script. */ if (data->currentDeltaToUnicode == PNJ_DELTA && data->prevToUnicodeStatus != 0 && isPNJConsonant(data->prevToUnicodeStatus) && - (*toUnicodeStatus + PNJ_DELTA) == PNJ_SIGN_VIRAMA && (targetUniChar + PNJ_DELTA) == data->prevToUnicodeStatus) { + (*toUnicodeStatus + PNJ_DELTA) == PNJ_SIGN_VIRAMA && ((UChar32)(targetUniChar + PNJ_DELTA) == data->prevToUnicodeStatus)) { /* Consonant clusters C + HALANT + C should be encoded as ADHAK + C */ offset = (int)(source-args->source - 3); tempTargetUniChar = PNJ_ADHAK; /* This is necessary to avoid some compiler warnings. */ @@ -1556,6 +1556,9 @@ _ISCIIGetUnicodeSet(const UConverter *cnv, UConverterUnicodeSet which, UErrorCode *pErrorCode) { + (void)cnv; + (void)which; + (void)pErrorCode; int32_t idx, script; uint8_t mask; @@ -1598,7 +1601,9 @@ static const UConverterImpl _ISCIIImpl={ _ISCIIgetName, NULL, _ISCII_SafeClone, - _ISCIIGetUnicodeSet + _ISCIIGetUnicodeSet, + NULL, + NULL }; static const UConverterStaticData _ISCIIStaticData={ diff --git a/icu4c/source/common/ucnvlat1.c b/icu4c/source/common/ucnvlat1.cpp similarity index 99% rename from icu4c/source/common/ucnvlat1.c rename to icu4c/source/common/ucnvlat1.cpp index f17777f066c..2579e7f7114 100644 --- a/icu4c/source/common/ucnvlat1.c +++ b/icu4c/source/common/ucnvlat1.cpp @@ -421,6 +421,9 @@ _Latin1GetUnicodeSet(const UConverter *cnv, const USetAdder *sa, UConverterUnicodeSet which, UErrorCode *pErrorCode) { + (void)cnv; + (void)which; + (void)pErrorCode; sa->addRange(sa->set, 0, 0xff); } @@ -695,6 +698,9 @@ _ASCIIGetUnicodeSet(const UConverter *cnv, const USetAdder *sa, UConverterUnicodeSet which, UErrorCode *pErrorCode) { + (void)cnv; + (void)which; + (void)pErrorCode; sa->addRange(sa->set, 0, 0x7f); } diff --git a/icu4c/source/common/ucnvscsu.c b/icu4c/source/common/ucnvscsu.cpp similarity index 99% rename from icu4c/source/common/ucnvscsu.c rename to icu4c/source/common/ucnvscsu.cpp index 9849cdebbbb..4827456e39a 100644 --- a/icu4c/source/common/ucnvscsu.c +++ b/icu4c/source/common/ucnvscsu.cpp @@ -2017,7 +2017,9 @@ static const UConverterImpl _SCSUImpl={ _SCSUGetName, NULL, _SCSUSafeClone, - ucnv_getCompleteUnicodeSet + ucnv_getCompleteUnicodeSet, + NULL, + NULL }; static const UConverterStaticData _SCSUStaticData={ diff --git a/icu4c/source/common/udatamem.c b/icu4c/source/common/udatamem.cpp similarity index 98% rename from icu4c/source/common/udatamem.c rename to icu4c/source/common/udatamem.cpp index daa919373b7..5f3b4695a8d 100644 --- a/icu4c/source/common/udatamem.c +++ b/icu4c/source/common/udatamem.cpp @@ -44,7 +44,7 @@ U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr) { if (U_FAILURE(*pErr)) { return NULL; } - This = uprv_malloc(sizeof(UDataMemory)); + This = (UDataMemory *)uprv_malloc(sizeof(UDataMemory)); if (This == NULL) { *pErr = U_MEMORY_ALLOCATION_ERROR; } else { diff --git a/icu4c/source/common/udataswp.c b/icu4c/source/common/udataswp.cpp similarity index 99% rename from icu4c/source/common/udataswp.c rename to icu4c/source/common/udataswp.cpp index f47ac1f5e06..e195984138f 100644 --- a/icu4c/source/common/udataswp.c +++ b/icu4c/source/common/udataswp.cpp @@ -374,7 +374,7 @@ udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset, } /* allocate the swapper */ - swapper=uprv_malloc(sizeof(UDataSwapper)); + swapper=(UDataSwapper *)uprv_malloc(sizeof(UDataSwapper)); if(swapper==NULL) { *pErrorCode=U_MEMORY_ALLOCATION_ERROR; return NULL; @@ -435,7 +435,7 @@ udata_openSwapperForInputData(const void *data, int32_t length, } pHeader=(const DataHeader *)data; - if( (length>=0 && length=0 && length<(int32_t)sizeof(DataHeader)) || pHeader->dataHeader.magic1!=0xda || pHeader->dataHeader.magic2!=0x27 || pHeader->info.sizeofUChar!=2 diff --git a/icu4c/source/common/uenum.c b/icu4c/source/common/uenum.cpp similarity index 100% rename from icu4c/source/common/uenum.c rename to icu4c/source/common/uenum.cpp diff --git a/icu4c/source/common/uhash.c b/icu4c/source/common/uhash.cpp similarity index 100% rename from icu4c/source/common/uhash.c rename to icu4c/source/common/uhash.cpp diff --git a/icu4c/source/common/uinvchar.c b/icu4c/source/common/uinvchar.cpp similarity index 99% rename from icu4c/source/common/uinvchar.c rename to icu4c/source/common/uinvchar.cpp index 79dd05143f0..f4919c4a417 100644 --- a/icu4c/source/common/uinvchar.c +++ b/icu4c/source/common/uinvchar.cpp @@ -451,6 +451,7 @@ U_CFUNC int32_t uprv_compareInvAscii(const UDataSwapper *ds, const char *outString, int32_t outLength, const UChar *localString, int32_t localLength) { + (void)ds; int32_t minLength; UChar32 c1, c2; uint8_t c; @@ -496,6 +497,7 @@ U_CFUNC int32_t uprv_compareInvEbcdic(const UDataSwapper *ds, const char *outString, int32_t outLength, const UChar *localString, int32_t localLength) { + (void)ds; int32_t minLength; UChar32 c1, c2; uint8_t c; diff --git a/icu4c/source/common/ulist.c b/icu4c/source/common/ulist.cpp similarity index 97% rename from icu4c/source/common/ulist.c rename to icu4c/source/common/ulist.cpp index a31c6040833..511a17aee4f 100644 --- a/icu4c/source/common/ulist.c +++ b/icu4c/source/common/ulist.cpp @@ -158,7 +158,7 @@ U_CAPI UBool U_EXPORT2 ulist_containsString(const UList *list, const char *data, if (list != NULL) { const UListNode *pointer; for (pointer = list->head; pointer != NULL; pointer = pointer->next) { - if (length == uprv_strlen(pointer->data)) { + if (length == (int32_t)uprv_strlen((const char *)pointer->data)) { if (uprv_memcmp(data, pointer->data, length) == 0) { return TRUE; } @@ -172,7 +172,7 @@ U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data) { if (list != NULL) { UListNode *pointer; for (pointer = list->head; pointer != NULL; pointer = pointer->next) { - if (uprv_strcmp(data, pointer->data) == 0) { + if (uprv_strcmp(data, (const char *)pointer->data) == 0) { ulist_removeItem(list, pointer); // Remove only the first occurrence, like Java LinkedList.remove(Object). return TRUE; diff --git a/icu4c/source/common/uloc_tag.c b/icu4c/source/common/uloc_tag.cpp similarity index 99% rename from icu4c/source/common/uloc_tag.c rename to icu4c/source/common/uloc_tag.cpp index 224470ad89c..b82aeacdccd 100644 --- a/icu4c/source/common/uloc_tag.c +++ b/icu4c/source/common/uloc_tag.cpp @@ -823,7 +823,7 @@ _appendVariantsToLanguageTag(const char* localeID, char* appendAt, int32_t capac /* validate */ if (_isVariantSubtag(pVar, -1)) { - if (uprv_strcmp(pVar,POSIX_VALUE) || len != uprv_strlen(POSIX_VALUE)) { + if (uprv_strcmp(pVar,POSIX_VALUE) || len != (int32_t)uprv_strlen(POSIX_VALUE)) { /* emit the variant to the list */ var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry)); if (var == NULL) { @@ -1371,7 +1371,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT U_ASSERT(pBcpKey != NULL); - if (bcpKeyLen >= sizeof(bcpKeyBuf)) { + if (bcpKeyLen >= (int32_t)sizeof(bcpKeyBuf)) { /* the BCP key is invalid */ *status = U_ILLEGAL_ARGUMENT_ERROR; goto cleanup; @@ -1406,7 +1406,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT if (pBcpType) { char bcpTypeBuf[128]; /* practically long enough even considering multiple subtag type */ - if (bcpTypeLen >= sizeof(bcpTypeBuf)) { + if (bcpTypeLen >= (int32_t)sizeof(bcpTypeBuf)) { /* the BCP type is too long */ *status = U_ILLEGAL_ARGUMENT_ERROR; goto cleanup; @@ -1642,6 +1642,7 @@ _appendKeywords(ULanguageTag* langtag, char* appendAt, int32_t capacity, UErrorC static int32_t _appendPrivateuseToLanguageTag(const char* localeID, char* appendAt, int32_t capacity, UBool strict, UBool hadPosix, UErrorCode* status) { + (void)hadPosix; char buf[ULOC_FULLNAME_CAPACITY]; char tmpAppend[ULOC_FULLNAME_CAPACITY]; UErrorCode tmpStatus = U_ZERO_ERROR; diff --git a/icu4c/source/common/umapfile.c b/icu4c/source/common/umapfile.cpp similarity index 100% rename from icu4c/source/common/umapfile.c rename to icu4c/source/common/umapfile.cpp diff --git a/icu4c/source/common/umath.c b/icu4c/source/common/umath.cpp similarity index 100% rename from icu4c/source/common/umath.c rename to icu4c/source/common/umath.cpp diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h index 51581c7dcdc..547ef1ec499 100644 --- a/icu4c/source/common/unicode/umachine.h +++ b/icu4c/source/common/unicode/umachine.h @@ -57,21 +57,19 @@ * When defined, force use of char16_t for UChar. * Note: char16_t is expected to become the default and required in the future, * and this option will be removed. + * + * Note: for plain C, #include should define char16_t, + * but Macintosh Xcode does not yet implement it. * @internal */ #ifdef U_USE_CHAR16_T +#ifdef __cplusplus #ifdef UCHAR_TYPE #undef UCHAR_TYPE #endif #define UCHAR_TYPE char16_t - -/* - * In plain C, is needed for the definition of char16_t - */ -#ifndef __cplusplus -#include -#endif -#endif +#endif /* __cpluplus */ +#endif /* U_USE_CHAR16_t */ #endif /* U_HIDE_INTERNAL_API */ /*==========================================================================*/ diff --git a/icu4c/source/common/unicode/utf8.h b/icu4c/source/common/unicode/utf8.h index 55f7b9d21d8..50871ccdb6a 100644 --- a/icu4c/source/common/unicode/utf8.h +++ b/icu4c/source/common/unicode/utf8.h @@ -41,25 +41,7 @@ /* internal definitions ----------------------------------------------------- */ -/** - * \var utf8_countTrailBytes - * Internal array with numbers of trail bytes for any given byte used in - * lead byte position. - * - * This is internal since it is not meant to be called directly by external clients; - * however it is called by public macros in this file and thus must remain stable, - * and should not be hidden when other internal functions are hidden (otherwise - * public macros would fail to compile). - * @internal - */ -#ifdef U_UTF8_IMPL -U_EXPORT const uint8_t -#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) -U_CFUNC const uint8_t -#else -U_CFUNC U_IMPORT const uint8_t /* U_IMPORT2? */ /*U_IMPORT*/ -#endif -utf8_countTrailBytes[256]; + /** * Counts the trail bytes for a UTF-8 lead byte. diff --git a/icu4c/source/common/unicode/utf_old.h b/icu4c/source/common/unicode/utf_old.h index c7d5145a231..b7f39f1044b 100644 --- a/icu4c/source/common/unicode/utf_old.h +++ b/icu4c/source/common/unicode/utf_old.h @@ -17,12 +17,12 @@ */ /** - * \file + * \file * \brief C API: Deprecated macros for Unicode string handling */ /** - * + * * The macros in utf_old.h are all deprecated and their use discouraged. * Some of the design principles behind the set of UTF macros * have changed or proved impractical. @@ -267,6 +267,25 @@ typedef int32_t UTextOffset; /* Formerly utf8.h ---------------------------------------------------------- */ +/** +* \var utf8_countTrailBytes +* Internal array with numbers of trail bytes for any given byte used in +* lead byte position. +* +* This is internal since it is not meant to be called directly by external clients; +* however it is called by public macros in this file and thus must remain stable, +* and should not be hidden when other internal functions are hidden (otherwise +* public macros would fail to compile). +* @internal +*/ +#ifdef U_UTF8_IMPL +// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes. +#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) +U_CFUNC const uint8_t utf8_countTrailBytes[]; +#else +U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/ +#endif + /** * Count the trail bytes for a UTF-8 lead byte. * @deprecated ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h. diff --git a/icu4c/source/common/ures_cnv.c b/icu4c/source/common/ures_cnv.cpp similarity index 95% rename from icu4c/source/common/ures_cnv.c rename to icu4c/source/common/ures_cnv.cpp index 58c6cd0746f..43926339896 100644 --- a/icu4c/source/common/ures_cnv.c +++ b/icu4c/source/common/ures_cnv.cpp @@ -43,7 +43,7 @@ ures_openU(const UChar *myPath, } else { length=u_strlen(myPath); - if(length>=sizeof(pathBuffer)) { + if(length>=(int32_t)sizeof(pathBuffer)) { *status=U_ILLEGAL_ARGUMENT_ERROR; return NULL; } else if(uprv_isInvariantUString(myPath, length)) { @@ -61,7 +61,7 @@ ures_openU(const UChar *myPath, if(U_FAILURE(*status)) { return NULL; } - if(length>=sizeof(pathBuffer)) { + if(length>=(int32_t)sizeof(pathBuffer)) { /* not NUL-terminated - path too long */ *status=U_ILLEGAL_ARGUMENT_ERROR; return NULL; diff --git a/icu4c/source/common/usc_impl.c b/icu4c/source/common/usc_impl.cpp similarity index 99% rename from icu4c/source/common/usc_impl.c rename to icu4c/source/common/usc_impl.cpp index 1fff0c4482d..b1559101fde 100644 --- a/icu4c/source/common/usc_impl.c +++ b/icu4c/source/common/usc_impl.cpp @@ -197,7 +197,7 @@ uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode) return NULL; } - result = uprv_malloc(sizeof (UScriptRun)); + result = (UScriptRun *)uprv_malloc(sizeof (UScriptRun)); if (result == NULL) { *pErrorCode = U_MEMORY_ALLOCATION_ERROR; diff --git a/icu4c/source/common/uscript.c b/icu4c/source/common/uscript.cpp similarity index 100% rename from icu4c/source/common/uscript.c rename to icu4c/source/common/uscript.cpp diff --git a/icu4c/source/common/ustrfmt.c b/icu4c/source/common/ustrfmt.cpp similarity index 100% rename from icu4c/source/common/ustrfmt.c rename to icu4c/source/common/ustrfmt.cpp diff --git a/icu4c/source/common/utf_impl.c b/icu4c/source/common/utf_impl.cpp similarity index 95% rename from icu4c/source/common/utf_impl.c rename to icu4c/source/common/utf_impl.cpp index c4c88121380..f5ee2344a64 100644 --- a/icu4c/source/common/utf_impl.c +++ b/icu4c/source/common/utf_impl.cpp @@ -31,6 +31,15 @@ #include "uassert.h" /* + * Table of the number of utf8 trail bytes, indexed by the lead byte. + * Used by the deprecated macro UTF8_COUNT_TRAIL_BYTES, defined in utf_old.h + * + * The current macro, U8_COUNT_TRAIL_BYTES, does _not_ use this table. + * + * Note that this table cannot be removed, even if UTF8_COUNT_TRAIL_BYTES were + * changed to no longer use it. References to the table from expansions of UTF8_COUNT_TRAIL_BYTES + * may exist in old client code that must continue to run with newer icu library versions. + * * This table could be replaced on many machines by * a few lines of assembler code using an * "index of first 0-bit from msb" instruction and @@ -51,7 +60,7 @@ * lead bytes above 0xf4 are illegal. * We keep them in this table for skipping long ISO 10646-UTF-8 sequences. */ -U_EXPORT const uint8_t +extern "C" U_EXPORT const uint8_t utf8_countTrailBytes[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/icu4c/source/common/utrace.c b/icu4c/source/common/utrace.cpp similarity index 98% rename from icu4c/source/common/utrace.c rename to icu4c/source/common/utrace.cpp index ca4dddfa1a3..0adc414b96b 100644 --- a/icu4c/source/common/utrace.c +++ b/icu4c/source/common/utrace.cpp @@ -11,7 +11,6 @@ * indentation:4 */ -#define UTRACE_IMPL #include "unicode/utrace.h" #include "utracimp.h" #include "cstring.h" @@ -24,7 +23,11 @@ static UTraceExit *pTraceExitFunc = NULL; static UTraceData *pTraceDataFunc = NULL; static const void *gTraceContext = NULL; -U_EXPORT int32_t +/** + * \var utrace_level + * Trace level variable. Negative for "off". + */ +static int32_t utrace_level = UTRACE_ERROR; U_CAPI void U_EXPORT2 @@ -134,7 +137,7 @@ static void outputHexBytes(int64_t val, int32_t charsToOutput, /* Output a pointer value in hex. Work with any size of pointer */ static void outputPtrBytes(void *val, char *outBuf, int32_t *outIx, int32_t capacity) { - int32_t i; + uint32_t i; int32_t incVal = 1; /* +1 for big endian, -1 for little endian */ char *p = (char *)&val; /* point to current byte to output in the ptr val */ @@ -230,7 +233,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, case 'S': /* UChar * string, with length, len==-1 for null terminated. */ - ptrArg = va_arg(args, void *); /* Ptr */ + ptrArg = va_arg(args, char *); /* Ptr */ intArg =(int32_t)va_arg(args, int32_t); /* Length */ outputUString((const UChar *)ptrArg, intArg, outBuf, &outIx, capacity, indent); break; @@ -261,7 +264,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, case 'p': /* Pointers. */ - ptrArg = va_arg(args, void *); + ptrArg = va_arg(args, char *); outputPtrBytes(ptrArg, outBuf, &outIx, capacity); break; @@ -332,7 +335,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, break; case 's': charsToOutput = 0; - outputString(*ptrPtr, outBuf, &outIx, capacity, indent); + outputString((const char *)*ptrPtr, outBuf, &outIx, capacity, indent); outputChar('\n', outBuf, &outIx, capacity, indent); longArg = *ptrPtr==NULL? 0: 1; /* for test for null term. array. */ ptrPtr++; diff --git a/icu4c/source/common/utracimp.h b/icu4c/source/common/utracimp.h index c1786f55b2a..8852aa5f881 100644 --- a/icu4c/source/common/utracimp.h +++ b/icu4c/source/common/utracimp.h @@ -47,20 +47,6 @@ U_CDECL_BEGIN -/** - * \var utrace_level - * Trace level variable. Negative for "off". - * Use only via UTRACE_ macros. - * @internal - */ -#ifdef UTRACE_IMPL -U_EXPORT int32_t -#else -U_CFUNC U_COMMON_API int32_t -#endif -utrace_level; - - /** * Traced Function Exit return types. * Flags indicating the number and types of varargs included in a call diff --git a/icu4c/source/common/utypes.c b/icu4c/source/common/utypes.cpp similarity index 100% rename from icu4c/source/common/utypes.c rename to icu4c/source/common/utypes.cpp diff --git a/icu4c/source/common/wintz.c b/icu4c/source/common/wintz.cpp similarity index 100% rename from icu4c/source/common/wintz.c rename to icu4c/source/common/wintz.cpp diff --git a/icu4c/source/i18n/decContext.c b/icu4c/source/i18n/decContext.cpp similarity index 100% rename from icu4c/source/i18n/decContext.c rename to icu4c/source/i18n/decContext.cpp diff --git a/icu4c/source/i18n/decNumber.c b/icu4c/source/i18n/decNumber.cpp similarity index 99% rename from icu4c/source/i18n/decNumber.c rename to icu4c/source/i18n/decNumber.cpp index 2604c37ebe8..3b72c1eac1f 100644 --- a/icu4c/source/i18n/decNumber.c +++ b/icu4c/source/i18n/decNumber.cpp @@ -5007,7 +5007,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, /* Make sure no signed int overflow below. This is always true */ /* if the given numbers have less digits than DEC_MAX_DIGITS. */ - U_ASSERT(iacc <= INT32_MAX/sizeof(uLong)); + U_ASSERT((uint32_t)iacc <= INT32_MAX/sizeof(uLong)); needbytes=iacc*sizeof(uLong); #if DECDPUN==1 zoff=(iacc+7)/8; /* items to offset by */ diff --git a/icu4c/source/i18n/i18n.vcxproj b/icu4c/source/i18n/i18n.vcxproj index 869d3a95181..73e0f2422a5 100644 --- a/icu4c/source/i18n/i18n.vcxproj +++ b/icu4c/source/i18n/i18n.vcxproj @@ -316,11 +316,11 @@ - + - + @@ -380,14 +380,14 @@ - + - + @@ -1700,4 +1700,4 @@ - \ No newline at end of file + diff --git a/icu4c/source/i18n/i18n.vcxproj.filters b/icu4c/source/i18n/i18n.vcxproj.filters index 57bf52f28d1..c7b477ce46b 100644 --- a/icu4c/source/i18n/i18n.vcxproj.filters +++ b/icu4c/source/i18n/i18n.vcxproj.filters @@ -138,7 +138,7 @@ formatting - + formatting @@ -150,7 +150,7 @@ formatting - + formatting @@ -321,7 +321,7 @@ formatting - + formatting @@ -336,7 +336,7 @@ formatting - + formatting diff --git a/icu4c/source/i18n/ulocdata.c b/icu4c/source/i18n/ulocdata.cpp similarity index 100% rename from icu4c/source/i18n/ulocdata.c rename to icu4c/source/i18n/ulocdata.cpp diff --git a/icu4c/source/i18n/utmscale.c b/icu4c/source/i18n/utmscale.cpp similarity index 100% rename from icu4c/source/i18n/utmscale.c rename to icu4c/source/i18n/utmscale.cpp diff --git a/icu4c/source/io/io.vcxproj b/icu4c/source/io/io.vcxproj index 3173e920809..128ec83f68b 100644 --- a/icu4c/source/io/io.vcxproj +++ b/icu4c/source/io/io.vcxproj @@ -249,18 +249,18 @@ - - + + false - - + + - - - - + + + + false false @@ -320,4 +320,4 @@ - \ No newline at end of file + diff --git a/icu4c/source/io/io.vcxproj.filters b/icu4c/source/io/io.vcxproj.filters index 61252bff3a0..4a6841ba286 100644 --- a/icu4c/source/io/io.vcxproj.filters +++ b/icu4c/source/io/io.vcxproj.filters @@ -18,34 +18,34 @@ Source Files - + Source Files - + Source Files Source Files - + Source Files - + Source Files Source Files - + Source Files - + Source Files - + Source Files - + Source Files diff --git a/icu4c/source/io/sprintf.c b/icu4c/source/io/sprintf.cpp similarity index 100% rename from icu4c/source/io/sprintf.c rename to icu4c/source/io/sprintf.cpp diff --git a/icu4c/source/io/sscanf.c b/icu4c/source/io/sscanf.cpp similarity index 100% rename from icu4c/source/io/sscanf.c rename to icu4c/source/io/sscanf.cpp diff --git a/icu4c/source/io/ufile.c b/icu4c/source/io/ufile.cpp similarity index 88% rename from icu4c/source/io/ufile.c rename to icu4c/source/io/ufile.cpp index 87ed3f1e969..8fb11ba19a2 100644 --- a/icu4c/source/io/ufile.c +++ b/icu4c/source/io/ufile.cpp @@ -8,7 +8,7 @@ * ****************************************************************************** * -* File ufile.c +* File ufile.cpp * * Modification History: * @@ -20,13 +20,6 @@ ****************************************************************************** */ -/* - * fileno is not declared when building with GCC in strict mode. - */ -#if defined(__GNUC__) && defined(__STRICT_ANSI__) -#undef __STRICT_ANSI__ -#endif - #include "locmap.h" #include "unicode/ustdio.h" @@ -64,33 +57,7 @@ finit_owner(FILE *f, uprv_memset(result, 0, sizeof(UFILE)); result->fFileno = fileno(f); - -#if U_PLATFORM_USES_ONLY_WIN32_API && _MSC_VER < 1900 - /* - * Below is a very old workaround (ICU ticket:231). - * - * Previously, 'FILE*' from inside and outside ICU's DLL - * were different, because they pointed into local copies - * of the io block. At least by VS 2015 the implementation - * is something like: - * stdio = _acrt_iob_func(0) - * .. which is a function call, so should return the same pointer - * regardless of call site. - * As of _MSC_VER 1900 this patch is retired, at 16 years old. - */ - if (0 <= result->fFileno && result->fFileno <= 2) { - /* stdin, stdout and stderr need to be special cased for Windows 98 */ -#if _MSC_VER >= 1400 - result->fFile = &__iob_func()[_fileno(f)]; -#else - result->fFile = &_iob[_fileno(f)]; -#endif - } - else -#endif - { - result->fFile = f; - } + result->fFile = f; result->str.fBuffer = result->fUCBuffer; result->str.fPos = result->fUCBuffer; diff --git a/icu4c/source/io/ufmt_cmn.c b/icu4c/source/io/ufmt_cmn.cpp similarity index 100% rename from icu4c/source/io/ufmt_cmn.c rename to icu4c/source/io/ufmt_cmn.cpp diff --git a/icu4c/source/io/ufmt_cmn.h b/icu4c/source/io/ufmt_cmn.h index 97079ed9d28..f79ec8b03c1 100644 --- a/icu4c/source/io/ufmt_cmn.h +++ b/icu4c/source/io/ufmt_cmn.h @@ -26,7 +26,7 @@ #include "unicode/utf16.h" #define UFMT_DEFAULT_BUFFER_SIZE 128 -#define MAX_UCHAR_BUFFER_SIZE(buffer) (sizeof(buffer)/(U16_MAX_LENGTH*sizeof(UChar))) +#define MAX_UCHAR_BUFFER_SIZE(buffer) ((int32_t)(sizeof(buffer)/(U16_MAX_LENGTH*sizeof(UChar)))) #define MAX_UCHAR_BUFFER_NEEDED(strLen) ((strLen+1)*U16_MAX_LENGTH*sizeof(UChar)) /** diff --git a/icu4c/source/io/uprntf_p.c b/icu4c/source/io/uprntf_p.cpp similarity index 99% rename from icu4c/source/io/uprntf_p.c rename to icu4c/source/io/uprntf_p.cpp index 9890b29b964..794c944ec7c 100644 --- a/icu4c/source/io/uprntf_p.c +++ b/icu4c/source/io/uprntf_p.cpp @@ -184,6 +184,9 @@ u_printf_simple_percent_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)formatBundle; + (void)info; + (void)args; static const UChar PERCENT[] = { UP_PERCENT }; /* put a single '%' onto the output */ @@ -198,6 +201,7 @@ u_printf_string_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)formatBundle; UChar *s; UChar buffer[UFMT_DEFAULT_BUFFER_SIZE]; int32_t len, written; @@ -248,6 +252,7 @@ u_printf_char_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)formatBundle; UChar s[U16_MAX_LENGTH+1]; int32_t len = 1, written; unsigned char arg = (unsigned char)(args[0].int64Value); @@ -418,6 +423,7 @@ u_printf_hex_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)formatBundle; int64_t num = args[0].int64Value; UChar result[UPRINTF_BUFFER_SIZE]; int32_t len = UPRINTF_BUFFER_SIZE; @@ -453,6 +459,7 @@ u_printf_octal_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)formatBundle; int64_t num = args[0].int64Value; UChar result[UPRINTF_BUFFER_SIZE]; int32_t len = UPRINTF_BUFFER_SIZE; @@ -539,7 +546,8 @@ u_printf_pointer_handler(const u_printf_stream_handler *handler, ULocaleBundle *formatBundle, const u_printf_spec_info *info, const ufmt_args *args) -{ +{ + (void)formatBundle; UChar result[UPRINTF_BUFFER_SIZE]; int32_t len = UPRINTF_BUFFER_SIZE; @@ -751,6 +759,7 @@ u_printf_ustring_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)formatBundle; int32_t len, written; const UChar *arg = (const UChar*)(args[0].ptrValue); @@ -779,6 +788,7 @@ u_printf_uchar_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)formatBundle; int32_t written = 0; UChar arg = (UChar)(args[0].int64Value); @@ -858,6 +868,9 @@ u_printf_count_handler(const u_printf_stream_handler *handler, const u_printf_spec_info *info, const ufmt_args *args) { + (void)handler; + (void)context; + (void)formatBundle; int32_t *count = (int32_t*)(args[0].ptrValue); /* in the special case of count, the u_printf_spec_info's width */ diff --git a/icu4c/source/io/uscanf.c b/icu4c/source/io/uscanf.cpp similarity index 100% rename from icu4c/source/io/uscanf.c rename to icu4c/source/io/uscanf.cpp diff --git a/icu4c/source/io/uscanf_p.c b/icu4c/source/io/uscanf_p.cpp similarity index 98% rename from icu4c/source/io/uscanf_p.c rename to icu4c/source/io/uscanf_p.cpp index ded984cef2d..14b3dc54634 100644 --- a/icu4c/source/io/uscanf_p.c +++ b/icu4c/source/io/uscanf_p.cpp @@ -380,6 +380,11 @@ u_scanf_simple_percent_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)info; + (void)args; + (void)fmt; + (void)fmtConsumed; + /* make sure the next character in the input is a percent */ *argConverted = 0; if(u_fgetc(input) != 0x0025) { @@ -396,6 +401,10 @@ u_scanf_count_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)input; + (void)fmt; + (void)fmtConsumed; + /* in the special case of count, the u_scanf_spec_info's width */ /* will contain the # of items converted thus far */ if (!info->fSkipArg) { @@ -420,6 +429,9 @@ u_scanf_double_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; double num; UNumberFormat *format; @@ -485,6 +497,9 @@ u_scanf_scientific_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; double num; UNumberFormat *format; @@ -582,6 +597,9 @@ u_scanf_scidbl_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; double num; UNumberFormat *scientificFormat, *genericFormat; @@ -672,6 +690,9 @@ u_scanf_integer_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; void *num = (void*) (args[0].ptrValue); UNumberFormat *format; @@ -745,6 +766,9 @@ u_scanf_percent_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; double num; UNumberFormat *format; @@ -802,6 +826,9 @@ u_scanf_string_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + const UChar *source; UConverter *conv; char *arg = (char*)(args[0].ptrValue); @@ -900,6 +927,9 @@ u_scanf_ustring_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + UChar *arg = (UChar*)(args[0].ptrValue); UChar *alias = arg; int32_t count; @@ -969,6 +999,9 @@ u_scanf_spellout_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; double num; UNumberFormat *format; @@ -1028,6 +1061,9 @@ u_scanf_hex_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; int32_t skipped; void *num = (void*) (args[0].ptrValue); @@ -1084,6 +1120,9 @@ u_scanf_octal_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; int32_t skipped; void *num = (void*) (args[0].ptrValue); @@ -1131,6 +1170,9 @@ u_scanf_pointer_handler(UFILE *input, int32_t *fmtConsumed, int32_t *argConverted) { + (void)fmt; + (void)fmtConsumed; + int32_t len; int32_t skipped; void *result; diff --git a/icu4c/source/io/ustdio.c b/icu4c/source/io/ustdio.cpp similarity index 100% rename from icu4c/source/io/ustdio.c rename to icu4c/source/io/ustdio.cpp diff --git a/icu4c/source/stubdata/stubdata.c b/icu4c/source/stubdata/stubdata.cpp similarity index 97% rename from icu4c/source/stubdata/stubdata.c rename to icu4c/source/stubdata/stubdata.cpp index 6493ac4b844..1b10f34bac5 100644 --- a/icu4c/source/stubdata/stubdata.c +++ b/icu4c/source/stubdata/stubdata.cpp @@ -40,7 +40,7 @@ typedef struct { /* pointerTOC to OffsetTOC. */ } ICU_Data_Header; -U_EXPORT const ICU_Data_Header U_ICUDATA_ENTRY_POINT = { +extern "C" U_EXPORT const ICU_Data_Header U_ICUDATA_ENTRY_POINT = { 32, /* headerSize */ 0xda, /* magic1, (see struct MappedData in udata.c) */ 0x27, /* magic2 */ diff --git a/icu4c/source/stubdata/stubdata.vcxproj b/icu4c/source/stubdata/stubdata.vcxproj index 36291a34518..0ca6f49eee2 100644 --- a/icu4c/source/stubdata/stubdata.vcxproj +++ b/icu4c/source/stubdata/stubdata.vcxproj @@ -268,7 +268,7 @@ - + @@ -281,4 +281,4 @@ - \ No newline at end of file + diff --git a/icu4c/source/stubdata/stubdata.vcxproj.filters b/icu4c/source/stubdata/stubdata.vcxproj.filters index f2742598d9c..da86a1b2f01 100644 --- a/icu4c/source/stubdata/stubdata.vcxproj.filters +++ b/icu4c/source/stubdata/stubdata.vcxproj.filters @@ -15,7 +15,7 @@ - + Source Files @@ -24,4 +24,4 @@ Resource Files - \ No newline at end of file + diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index 2f6dc7a59ee..a3cf62376ed 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -24,6 +24,7 @@ #include "unicode/putil.h" #include "unicode/uset.h" #include "unicode/ustring.h" +#include "unicode/utf8.h" #include "ucnv_bld.h" /* for sizeof(UConverter) */ #include "cmemory.h" /* for UAlignedMemory */ #include "cintltst.h" diff --git a/icu4c/source/test/intltest/intltest.vcxproj b/icu4c/source/test/intltest/intltest.vcxproj index 9571c134224..d14bb4f60ec 100644 --- a/icu4c/source/test/intltest/intltest.vcxproj +++ b/icu4c/source/test/intltest/intltest.vcxproj @@ -416,10 +416,7 @@ - false - false - false - false + false @@ -583,4 +580,4 @@ - \ No newline at end of file + diff --git a/icu4c/source/test/intltest/intltest.vcxproj.filters b/icu4c/source/test/intltest/intltest.vcxproj.filters index 65ef6b9bd68..c490d90fdfb 100644 --- a/icu4c/source/test/intltest/intltest.vcxproj.filters +++ b/icu4c/source/test/intltest/intltest.vcxproj.filters @@ -151,9 +151,6 @@ configuration - - configuration - configuration @@ -436,6 +433,9 @@ strings + + strings + strings @@ -585,9 +585,6 @@ configuration - - configuration - configuration @@ -831,6 +828,9 @@ strings + + strings + strings diff --git a/icu4c/source/test/intltest/strtest.cpp b/icu4c/source/test/intltest/strtest.cpp index f621631c5a9..fd809b5bf99 100644 --- a/icu4c/source/test/intltest/strtest.cpp +++ b/icu4c/source/test/intltest/strtest.cpp @@ -22,6 +22,8 @@ #include "unicode/stringpiece.h" #include "unicode/unistr.h" #include "unicode/ustring.h" +#include "unicode/utf_old.h" // for UTF8_COUNT_TRAIL_BYTES +#include "unicode/utf8.h" #include "charstr.h" #include "cstr.h" #include "intltest.h" @@ -148,8 +150,18 @@ StringTest::Test_UTF8_COUNT_TRAIL_BYTES() { || UTF8_COUNT_TRAIL_BYTES(0xF0) != 3) { errln("Test_UTF8_COUNT_TRAIL_BYTES: UTF8_COUNT_TRAIL_BYTES does not work right! " - "See utf8.h."); - } + "See utf_old.h."); + } + // Note: U8_COUNT_TRAIL_BYTES (current) and UTF8_COUNT_TRAIL_BYTES (deprecated) + // have completely different implementations. + if (U8_COUNT_TRAIL_BYTES(0x7F) != 0 + || U8_COUNT_TRAIL_BYTES(0xC0) != 1 + || U8_COUNT_TRAIL_BYTES(0xE0) != 2 + || U8_COUNT_TRAIL_BYTES(0xF0) != 3) + { + errln("Test_UTF8_COUNT_TRAIL_BYTES: U8_COUNT_TRAIL_BYTES does not work right! " + "See utf8.h."); + } } void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char * /*par*/) { diff --git a/icu4c/source/tools/toolutil/filestrm.c b/icu4c/source/tools/toolutil/filestrm.cpp similarity index 100% rename from icu4c/source/tools/toolutil/filestrm.c rename to icu4c/source/tools/toolutil/filestrm.cpp diff --git a/icu4c/source/tools/toolutil/flagparser.c b/icu4c/source/tools/toolutil/flagparser.cpp similarity index 96% rename from icu4c/source/tools/toolutil/flagparser.c rename to icu4c/source/tools/toolutil/flagparser.cpp index 0ffc3715bfd..69d1c1f5078 100644 --- a/icu4c/source/tools/toolutil/flagparser.c +++ b/icu4c/source/tools/toolutil/flagparser.cpp @@ -34,9 +34,9 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize, *status = U_FILE_ACCESS_ERROR; goto parseFlagsFile_cleanup; } - - buffer = uprv_malloc(sizeof(char) * currentBufferSize); - tmpFlagBuffer = uprv_malloc(sizeof(char) * flagBufferSize); + + buffer = (char *)uprv_malloc(sizeof(char) * currentBufferSize); + tmpFlagBuffer = (char *)uprv_malloc(sizeof(char) * flagBufferSize); if (buffer == NULL || tmpFlagBuffer == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; @@ -48,7 +48,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize, allocateMoreSpace = FALSE; currentBufferSize *= 2; uprv_free(buffer); - buffer = uprv_malloc(sizeof(char) * currentBufferSize); + buffer = (char *)uprv_malloc(sizeof(char) * currentBufferSize); if (buffer == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; goto parseFlagsFile_cleanup; diff --git a/icu4c/source/tools/toolutil/pkg_genc.c b/icu4c/source/tools/toolutil/pkg_genc.cpp similarity index 99% rename from icu4c/source/tools/toolutil/pkg_genc.c rename to icu4c/source/tools/toolutil/pkg_genc.cpp index f0dbd4ca36d..2b98cfed0f4 100644 --- a/icu4c/source/tools/toolutil/pkg_genc.c +++ b/icu4c/source/tools/toolutil/pkg_genc.cpp @@ -708,7 +708,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char length=T_FileStream_read(in, buffer.bytes, sizeof(buffer.bytes)); #ifdef U_ELF - if(lengthfalse - + - + - + false - + false @@ -276,12 +276,12 @@ false - - - - - - + + + + + + false @@ -332,4 +332,4 @@ - \ No newline at end of file + diff --git a/icu4c/source/tools/toolutil/ucm.c b/icu4c/source/tools/toolutil/ucm.cpp similarity index 99% rename from icu4c/source/tools/toolutil/ucm.c rename to icu4c/source/tools/toolutil/ucm.cpp index 8d4cdfc40f1..9ff42dc9b06 100644 --- a/icu4c/source/tools/toolutil/ucm.c +++ b/icu4c/source/tools/toolutil/ucm.cpp @@ -310,6 +310,8 @@ enum { static uint8_t checkBaseExtUnicode(UCMStates *baseStates, UCMTable *base, UCMTable *ext, UBool moveToExt, UBool intersectBase) { + (void)baseStates; + UCMapping *mb, *me, *mbLimit, *meLimit; int32_t cmp; uint8_t result; @@ -1043,6 +1045,7 @@ ucm_mappingType(UCMStates *baseStates, UCMapping *m, UChar32 codePoints[UCNV_EXT_MAX_UCHARS], uint8_t bytes[UCNV_EXT_MAX_BYTES]) { + (void)codePoints; /* check validity of the bytes and count the characters in them */ int32_t count=ucm_countChars(baseStates, bytes, m->bLen); if(count<1) { diff --git a/icu4c/source/tools/toolutil/ucmstate.c b/icu4c/source/tools/toolutil/ucmstate.cpp similarity index 99% rename from icu4c/source/tools/toolutil/ucmstate.c rename to icu4c/source/tools/toolutil/ucmstate.cpp index 1aabbfbf6a9..669b16d9bce 100644 --- a/icu4c/source/tools/toolutil/ucmstate.c +++ b/icu4c/source/tools/toolutil/ucmstate.cpp @@ -918,6 +918,7 @@ compactToUnicodeHelper(UCMStates *states, static int32_t compareFallbacks(const void *context, const void *fb1, const void *fb2) { + (void)context; return ((const _MBCSToUFallback *)fb1)->offset-((const _MBCSToUFallback *)fb2)->offset; } diff --git a/icu4c/source/tools/toolutil/unewdata.c b/icu4c/source/tools/toolutil/unewdata.cpp similarity index 100% rename from icu4c/source/tools/toolutil/unewdata.c rename to icu4c/source/tools/toolutil/unewdata.cpp diff --git a/icu4c/source/tools/toolutil/uoptions.c b/icu4c/source/tools/toolutil/uoptions.cpp similarity index 100% rename from icu4c/source/tools/toolutil/uoptions.c rename to icu4c/source/tools/toolutil/uoptions.cpp diff --git a/icu4c/source/tools/toolutil/uparse.c b/icu4c/source/tools/toolutil/uparse.cpp similarity index 100% rename from icu4c/source/tools/toolutil/uparse.c rename to icu4c/source/tools/toolutil/uparse.cpp diff --git a/icu4c/source/tools/toolutil/writesrc.c b/icu4c/source/tools/toolutil/writesrc.cpp similarity index 100% rename from icu4c/source/tools/toolutil/writesrc.c rename to icu4c/source/tools/toolutil/writesrc.cpp