ICU-10881 merge from branch - conservative fixes to some warnings

X-SVN-Rev: 36449
This commit is contained in:
Steven R. Loomis 2014-09-11 05:25:13 +00:00
parent 1a2ae33299
commit 4345b76644
16 changed files with 43 additions and 48 deletions

View file

@ -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) {

View file

@ -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 &&

View file

@ -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);
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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 )

View file

@ -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(); }
};

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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();

View file

@ -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);

View file

@ -43,6 +43,7 @@
#include "pkg_gencmn.h"
#include "flagparser.h"
#include "filetools.h"
#include "charstr.h"
#if U_HAVE_POPEN
# include <unistd.h>
@ -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;
}