diff --git a/icu4c/source/common/putil.cpp b/icu4c/source/common/putil.cpp index 5f09288613d..599dad9c975 100644 --- a/icu4c/source/common/putil.cpp +++ b/icu4c/source/common/putil.cpp @@ -882,7 +882,7 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil if (tzInfo->defaultTZBuffer == NULL) { rewind(tzInfo->defaultTZFilePtr); tzInfo->defaultTZBuffer = (char*)uprv_malloc(sizeof(char) * tzInfo->defaultTZFileSize); - sizeFileRead = fread(tzInfo->defaultTZBuffer, 1, tzInfo->defaultTZFileSize, tzInfo->defaultTZFilePtr); + fread(tzInfo->defaultTZBuffer, 1, tzInfo->defaultTZFileSize, tzInfo->defaultTZFilePtr); } rewind(file); while(sizeFileLeft > 0) { diff --git a/icu4c/source/common/ucnvhz.c b/icu4c/source/common/ucnvhz.c index ef8334c07a8..3760c3913d0 100644 --- a/icu4c/source/common/ucnvhz.c +++ b/icu4c/source/common/ucnvhz.c @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2000-2011, International Business Machines +* Copyright (C) 2000-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: ucnvhz.c @@ -340,12 +340,11 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args, int32_t myTargetIndex = 0; int32_t targetLength = (int32_t)(args->targetLimit - myTarget); int32_t mySourceLength = (int32_t)(args->sourceLimit - args->source); - int32_t length=0; uint32_t targetUniChar = 0x0000; UChar32 mySourceChar = 0x0000; UConverterDataHZ *myConverterData=(UConverterDataHZ*)args->converter->extraInfo; UBool isTargetUCharDBCS = (UBool) myConverterData->isTargetUCharDBCS; - UBool oldIsTargetUCharDBCS = isTargetUCharDBCS; + UBool oldIsTargetUCharDBCS; int len =0; const char* escSeq=NULL; @@ -373,10 +372,9 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args, CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex); continue; } else if(mySourceChar <= 0x7f) { - length = 1; targetUniChar = mySourceChar; } else { - length= ucnv_MBCSFromUChar32(myConverterData->gbConverter->sharedData, + int32_t length= ucnv_MBCSFromUChar32(myConverterData->gbConverter->sharedData, mySourceChar,&targetUniChar,args->converter->useFallback); /* we can only use lead bytes 21..7D and trail bytes 21..7E */ if( length == 2 && diff --git a/icu4c/source/common/ucol_swp.cpp b/icu4c/source/common/ucol_swp.cpp index 13e467364c4..0625dd35a8a 100644 --- a/icu4c/source/common/ucol_swp.cpp +++ b/icu4c/source/common/ucol_swp.cpp @@ -307,7 +307,6 @@ swapFormatVersion3(const UDataSwapper *ds, * if UCAConsts!=0 then contractionUCACombos because we are swapping * the UCA data file, and we know that the UCA contains contractions */ - count=header.contractionUCACombos-header.UCAConsts; ds->swapArray32(ds, inBytes+header.UCAConsts, header.contractionUCACombos-header.UCAConsts, outBytes+header.UCAConsts, pErrorCode); } diff --git a/icu4c/source/common/uidna.cpp b/icu4c/source/common/uidna.cpp index b7780b84e6c..c9ab8026258 100644 --- a/icu4c/source/common/uidna.cpp +++ b/icu4c/source/common/uidna.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003-2009, International Business Machines + * Copyright (C) 2003-2014, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -408,13 +408,12 @@ _internal_toUnicode(const UChar* src, int32_t srcLength, //initialize pointers to stack buffers UChar *b1 = b1Stack, *b2 = b2Stack, *b1Prime=NULL, *b3=b3Stack; - int32_t b1Len, b2Len, b1PrimeLen, b3Len, + int32_t b1Len = 0, b2Len, b1PrimeLen, b3Len, b1Capacity = MAX_LABEL_BUFFER_SIZE, b2Capacity = MAX_LABEL_BUFFER_SIZE, b3Capacity = MAX_LABEL_BUFFER_SIZE, reqLength=0; - b1Len = 0; UBool* caseFlags = NULL; UBool srcIsASCII = TRUE; diff --git a/icu4c/source/common/ulist.c b/icu4c/source/common/ulist.c index aa506584e71..6b5013b0ecd 100644 --- a/icu4c/source/common/ulist.c +++ b/icu4c/source/common/ulist.c @@ -1,6 +1,6 @@ /* ****************************************************************************** -* Copyright (C) 2009-2012, International Business Machines +* Copyright (C) 2009-2014, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** */ @@ -174,18 +174,16 @@ U_CAPI void U_EXPORT2 ulist_resetList(UList *list) { U_CAPI void U_EXPORT2 ulist_deleteList(UList *list) { UListNode *listHead = NULL; - UListNode *listPointer = NULL; - + if (list != NULL) { listHead = list->head; - listPointer = listHead; while (listHead != NULL) { - listPointer = listHead->next; - + UListNode *listPointer = listHead->next; + if (listHead->forceDelete) { uprv_free(listHead->data); } - + uprv_free(listHead); listHead = listPointer; } diff --git a/icu4c/source/common/usc_impl.c b/icu4c/source/common/usc_impl.c index 71fdf94c8be..e30c7f5ad27 100644 --- a/icu4c/source/common/usc_impl.c +++ b/icu4c/source/common/usc_impl.c @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2009, International Business Machines +* Copyright (C) 1999-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -146,7 +146,7 @@ highBit(int32_t value) } if (value >= 1 << 1) { - value >>= 1; + //value >>= 1; bit += 1; } diff --git a/icu4c/source/common/uscript.c b/icu4c/source/common/uscript.c index 799f28e2bda..3700099cd2a 100644 --- a/icu4c/source/common/uscript.c +++ b/icu4c/source/common/uscript.c @@ -55,11 +55,11 @@ getCodesFromLocale(const char *locale, UErrorCode internalErrorCode = U_ZERO_ERROR; char lang[8]; char script[8]; - int32_t langLength, scriptLength; + int32_t scriptLength; if(U_FAILURE(*err)) { return 0; } // Multi-script languages, equivalent to the LocaleScript data // that we used to load from locale resource bundles. - langLength = uloc_getLanguage(locale, lang, UPRV_LENGTHOF(lang), &internalErrorCode); + /*length = */ uloc_getLanguage(locale, lang, UPRV_LENGTHOF(lang), &internalErrorCode); if(U_FAILURE(internalErrorCode) || internalErrorCode == U_STRING_NOT_TERMINATED_WARNING) { return 0; } diff --git a/icu4c/source/common/usprep.cpp b/icu4c/source/common/usprep.cpp index 9e5d70c2668..2427c0a4e25 100644 --- a/icu4c/source/common/usprep.cpp +++ b/icu4c/source/common/usprep.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003-2013, International Business Machines + * Copyright (C) 2003-2014, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -903,7 +903,7 @@ usprep_swap(const UDataSwapper *ds, /* swap the uint16_t mappingTable[] */ count=indexes[_SPREP_INDEX_MAPPING_DATA_SIZE]; ds->swapArray16(ds, inBytes+offset, count, outBytes+offset, pErrorCode); - offset+=count; + //offset+=count; } return headerSize+size; diff --git a/icu4c/source/i18n/calendar.cpp b/icu4c/source/i18n/calendar.cpp index ba515e9646d..062a9e9c30a 100644 --- a/icu4c/source/i18n/calendar.cpp +++ b/icu4c/source/i18n/calendar.cpp @@ -3410,10 +3410,12 @@ int32_t Calendar::handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t w if (first < 0) { first += 7; } - int32_t nextFirst = julianDayToDayOfWeek(nextJan1Start + 1) - firstDayOfWeek; - if (nextFirst < 0) { - nextFirst += 7; - } + + //// (nextFirst was not used below) + // int32_t nextFirst = julianDayToDayOfWeek(nextJan1Start + 1) - firstDayOfWeek; + // if (nextFirst < 0) { + // nextFirst += 7; + //} int32_t minDays = getMinimalDaysInFirstWeek(); UBool jan1InPrevYear = FALSE; // January 1st in the year of WOY is the 1st week? (i.e. first week is < minimal ) diff --git a/icu4c/source/i18n/filteredbrk.cpp b/icu4c/source/i18n/filteredbrk.cpp index 4f2c47b6d7b..3c5fe6c33be 100644 --- a/icu4c/source/i18n/filteredbrk.cpp +++ b/icu4c/source/i18n/filteredbrk.cpp @@ -161,15 +161,15 @@ public: /* -- ITERATION -- */ virtual int32_t first(void) { return fDelegate->first(); } - virtual int32_t preceding(int32_t offset) { /* TODO: not implemented */ return UBRK_DONE; } + virtual int32_t preceding(int32_t /*offset*/) { /* TODO: not implemented */ return UBRK_DONE; } virtual int32_t previous(void) { /* TODO: not implemented */ return UBRK_DONE; } virtual UBool isBoundary(int32_t offset) { return fDelegate->isBoundary(offset); } virtual int32_t current(void) const { return fDelegate->current(); } virtual int32_t next(void); - virtual int32_t next(int32_t n) { /* TODO: not implemented */ return UBRK_DONE; } - virtual int32_t following(int32_t offset) { /* TODO: not implemented */ return UBRK_DONE; } + virtual int32_t next(int32_t /*n*/) { /* TODO: not implemented */ return UBRK_DONE; } + virtual int32_t following(int32_t /*offset*/) { /* TODO: not implemented */ return UBRK_DONE; } virtual int32_t last(void) { return fDelegate->last(); } }; diff --git a/icu4c/source/i18n/ucol_res.cpp b/icu4c/source/i18n/ucol_res.cpp index 4558468d006..b8d7ee7e971 100644 --- a/icu4c/source/i18n/ucol_res.cpp +++ b/icu4c/source/i18n/ucol_res.cpp @@ -465,7 +465,7 @@ CollationLoader::getCacheEntry(UErrorCode &errorCode) { const CollationCacheEntry * CollationLoader::makeCacheEntryFromRoot( - const Locale &loc, + const Locale &/*loc*/, UErrorCode &errorCode) const { if (U_FAILURE(errorCode)) { return NULL; diff --git a/icu4c/source/i18n/ucurr.cpp b/icu4c/source/i18n/ucurr.cpp index 021ad724249..5ee8ceef8cd 100644 --- a/icu4c/source/i18n/ucurr.cpp +++ b/icu4c/source/i18n/ucurr.cpp @@ -2533,7 +2533,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key, char loc[ULOC_FULLNAME_CAPACITY] = ""; uloc_addLikelySubtags(locale, loc, sizeof(loc), status); - prefRegionLength = uloc_getCountry(loc, prefRegion, sizeof(prefRegion), status); + /*prefRegionLength = */ uloc_getCountry(loc, prefRegion, sizeof(prefRegion), status); } // Read value from supplementalData diff --git a/icu4c/source/layoutex/ParagraphLayout.cpp b/icu4c/source/layoutex/ParagraphLayout.cpp index d57c67bb559..cc32bc3b12c 100644 --- a/icu4c/source/layoutex/ParagraphLayout.cpp +++ b/icu4c/source/layoutex/ParagraphLayout.cpp @@ -383,7 +383,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, } else { // initialize - for (runStart = 0, run = 0; run < fStyleRunCount; run += 1) { + for (run = 0; run < fStyleRunCount; run += 1) { fStyleRunInfo[run].font = NULL; fStyleRunInfo[run].runBase = 0; fStyleRunInfo[run].runLimit = 0; diff --git a/icu4c/source/test/cintltst/cbiditst.c b/icu4c/source/test/cintltst/cbiditst.c index b1d1ede56c4..dd39b027442 100644 --- a/icu4c/source/test/cintltst/cbiditst.c +++ b/icu4c/source/test/cintltst/cbiditst.c @@ -4907,7 +4907,6 @@ testBracketOverflow(void) { UErrorCode status = U_ZERO_ERROR; UBiDi* bidi; UChar src[100]; - UChar dest[100]; int32_t len; bidi = ubidi_open(); diff --git a/icu4c/source/test/intltest/dcfmapts.cpp b/icu4c/source/test/intltest/dcfmapts.cpp index e98cdd8d749..17f7f8fc43f 100644 --- a/icu4c/source/test/intltest/dcfmapts.cpp +++ b/icu4c/source/test/intltest/dcfmapts.cpp @@ -834,8 +834,6 @@ void IntlTestDecimalFormatAPI::TestBadFastpath() { void IntlTestDecimalFormatAPI::TestRequiredDecimalPoint() { UErrorCode status = U_ZERO_ERROR; UnicodeString text("99"); - double expected = 99; - double whatIGot = 0.0; Formattable result1; UnicodeString pat1("##.0000"); UnicodeString pat2("00.0"); @@ -845,7 +843,7 @@ void IntlTestDecimalFormatAPI::TestRequiredDecimalPoint() { dataerrln("Error creating new DecimalFormat - %s", u_errorName(status)); return; } - + status = U_ZERO_ERROR; df->applyPattern(pat1, status); if(U_FAILURE(status)) { @@ -860,8 +858,8 @@ void IntlTestDecimalFormatAPI::TestRequiredDecimalPoint() { if(U_SUCCESS(status)) { errln((UnicodeString)"ERROR: unexpected parse()"); } - - + + status = U_ZERO_ERROR; df->applyPattern(pat2, status); df->setDecimalPatternMatchRequired(FALSE); diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index abefd8569d6..ee1d246cb3b 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -43,6 +43,7 @@ #include "pkg_gencmn.h" #include "flagparser.h" #include "filetools.h" +#include "charstr.h" #if U_HAVE_POPEN # include @@ -2078,32 +2079,33 @@ static void loadLists(UPKGOptions *o, UErrorCode *status) FILE *p = NULL; size_t n; static char buf[512] = ""; - char cmdBuf[1024]; + CharString cmdBuf; UErrorCode status = U_ZERO_ERROR; const char cmd[] = "icu-config --incpkgdatafile"; - + char dirBuf[1024] = ""; /* #1 try the same path where pkgdata was called from. */ - findDirname(progname, cmdBuf, 1024, &status); + findDirname(progname, dirBuf, UPRV_LENGTHOF(dirBuf), &status); if(U_SUCCESS(status)) { + cmdBuf.append(dirBuf, status); if (cmdBuf[0] != 0) { - uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024); + cmdBuf.append( U_FILE_SEP_STRING, status ); } - uprv_strncat(cmdBuf, cmd, 1023); + cmdBuf.append( cmd, status ); if(verbose) { - fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf); + fprintf(stdout, "# Calling icu-config: %s\n", cmdBuf.data()); } - p = popen(cmdBuf, "r"); + p = popen(cmdBuf.data(), "r"); } - if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) { + if(p == NULL || (n = fread(buf, 1, UPRV_LENGTHOF(buf)-1, p)) <= 0) { if(verbose) { fprintf(stdout, "# Calling icu-config: %s\n", cmd); } pclose(p); p = popen(cmd, "r"); - if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) { + if(p == NULL || (n = fread(buf, 1, UPRV_LENGTHOF(buf)-1, p)) <= 0) { fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname); return -1; }