mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-3222 Fix some compiler warnings.
X-SVN-Rev: 13901
This commit is contained in:
parent
f0a074123a
commit
96377ea243
9 changed files with 40 additions and 53 deletions
|
@ -46,7 +46,7 @@ inline CharString::CharString(const UnicodeString& str, const char *codepage) {
|
|||
ptr = buf;
|
||||
len = str.extract(0, 0x7FFFFFFF, buf ,sizeof(buf)-1, codepage);
|
||||
buf[sizeof(buf)-1] = 0; // extract does not add null if it thinks there is no space for it.
|
||||
if (len >= sizeof(buf)-1) {
|
||||
if (len >= (int32_t)(sizeof(buf)-1)) {
|
||||
ptr = (char *)uprv_malloc(len+1);
|
||||
str.extract(0, 0x7FFFFFFF, ptr, len+1, codepage);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ typedef union {
|
|||
* This is used to determine whether ICU is in an initial, unused state.
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
cmemory_inUse();
|
||||
cmemory_inUse(void);
|
||||
|
||||
/**
|
||||
* Mark the ICU heap as not being in use, even if it is.
|
||||
|
@ -79,7 +79,7 @@ cmemory_inUse();
|
|||
* TODO: this is awkward. Think about something cleaner.
|
||||
*/
|
||||
U_CFUNC void
|
||||
cmemory_clearInUse();
|
||||
cmemory_clearInUse(void);
|
||||
|
||||
/**
|
||||
* Heap clean up function, called from u_cleanup()
|
||||
|
|
|
@ -165,25 +165,6 @@ typedef struct ILcidPosixMap
|
|||
const struct ILcidPosixElement* const regionMaps;
|
||||
} ILcidPosixMap;
|
||||
|
||||
static const char* posixID(const ILcidPosixMap *this_0, uint32_t fromHostID);
|
||||
|
||||
/**
|
||||
* Searches for a Windows LCID
|
||||
*
|
||||
* @param posixid the Posix style locale id.
|
||||
* @param status gets set to U_ILLEGAL_ARGUMENT_ERROR when the Posix ID has
|
||||
* no equivalent Windows LCID.
|
||||
* @return the LCID
|
||||
*/
|
||||
static uint32_t hostID(const ILcidPosixMap *this_0, const char* fromPosixID, UErrorCode* status);
|
||||
|
||||
/**
|
||||
* Do not call this function. It is called by hostID.
|
||||
* The function is not private because this struct must stay as a C struct,
|
||||
* and this is an internal class.
|
||||
*/
|
||||
static int32_t idCmp(const char* id1, const char* id2);
|
||||
|
||||
|
||||
/*
|
||||
/////////////////////////////////////////////////
|
||||
|
@ -592,6 +573,11 @@ static const ILcidPosixMap gPosixIDmap[] = {
|
|||
|
||||
static const uint32_t gLocaleCount = sizeof(gPosixIDmap)/sizeof(ILcidPosixMap);
|
||||
|
||||
/**
|
||||
* Do not call this function. It is called by hostID.
|
||||
* The function is not private because this struct must stay as a C struct,
|
||||
* and this is an internal class.
|
||||
*/
|
||||
static int32_t
|
||||
idCmp(const char* id1, const char* id2)
|
||||
{
|
||||
|
@ -613,7 +599,7 @@ idCmp(const char* id1, const char* id2)
|
|||
* @return the LCID
|
||||
*/
|
||||
static uint32_t
|
||||
hostID(const ILcidPosixMap *this_0, const char* posixID, UErrorCode* status)
|
||||
getHostID(const ILcidPosixMap *this_0, const char* posixID, UErrorCode* status)
|
||||
{
|
||||
int32_t bestIdx = 0;
|
||||
int32_t bestIdxDiff = 0;
|
||||
|
@ -642,7 +628,7 @@ hostID(const ILcidPosixMap *this_0, const char* posixID, UErrorCode* status)
|
|||
}
|
||||
|
||||
static const char*
|
||||
posixID(const ILcidPosixMap *this_0, uint32_t hostID)
|
||||
getPosixID(const ILcidPosixMap *this_0, uint32_t hostID)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i <= this_0->numRegions; i++)
|
||||
|
@ -676,7 +662,7 @@ uprv_convertToPosix(uint32_t hostid, UErrorCode* status)
|
|||
{
|
||||
if (langID == gPosixIDmap[index].regionMaps->hostID)
|
||||
{
|
||||
return posixID(&gPosixIDmap[index], hostid);
|
||||
return getPosixID(&gPosixIDmap[index], hostid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,7 +686,7 @@ uprv_convertToLCID(const char* posixID, UErrorCode* status)
|
|||
uint32_t low = 0;
|
||||
uint32_t high = gLocaleCount;
|
||||
uint32_t mid = high;
|
||||
uint32_t oldmid =0;
|
||||
uint32_t oldmid = 0;
|
||||
int32_t compVal;
|
||||
char langID[ULOC_FULLNAME_CAPACITY];
|
||||
|
||||
|
@ -736,7 +722,7 @@ uprv_convertToLCID(const char* posixID, UErrorCode* status)
|
|||
low = mid;
|
||||
}
|
||||
else /*we found it*/{
|
||||
return hostID(&gPosixIDmap[mid], posixID, status);
|
||||
return getHostID(&gPosixIDmap[mid], posixID, status);
|
||||
}
|
||||
oldmid = mid;
|
||||
}
|
||||
|
@ -747,7 +733,7 @@ uprv_convertToLCID(const char* posixID, UErrorCode* status)
|
|||
*/
|
||||
for (idx = 0; idx < gLocaleCount; idx++ ) {
|
||||
myStatus = U_ZERO_ERROR;
|
||||
value = hostID(&gPosixIDmap[idx], posixID, &myStatus);
|
||||
value = getHostID(&gPosixIDmap[idx], posixID, &myStatus);
|
||||
if (myStatus == U_ZERO_ERROR) {
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ U_NAMESPACE_BEGIN
|
|||
RuleCharacterIterator::RuleCharacterIterator(const UnicodeString& theText, const SymbolTable* theSym,
|
||||
ParsePosition& thePos) :
|
||||
text(theText),
|
||||
sym(theSym),
|
||||
pos(thePos),
|
||||
sym(theSym),
|
||||
buf(0)
|
||||
{}
|
||||
|
||||
|
@ -128,7 +128,7 @@ UChar32 RuleCharacterIterator::_current() const {
|
|||
return buf->char32At(bufPos);
|
||||
} else {
|
||||
int i = pos.getIndex();
|
||||
return (i < text.length()) ? text.char32At(i) : DONE;
|
||||
return (i < text.length()) ? text.char32At(i) : (UChar32)DONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,9 @@ static UMTX gIncDecMutex = NULL;
|
|||
|
||||
|
||||
/* Detect Recursive locking of the global mutex. For debugging only. */
|
||||
#if defined(WIN32) && defined(_DEBUG) && (ICU_USE_THREADS==1)
|
||||
static int32_t gRecursionCount = 0;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -271,7 +271,7 @@ public:
|
|||
* @stable ICU 2.0
|
||||
*/
|
||||
#ifdef U_CYGWIN
|
||||
U_COMMON_API static const int32_t DONE;
|
||||
static U_COMMON_API const int32_t DONE;
|
||||
#else
|
||||
static const int32_t DONE;
|
||||
#endif
|
||||
|
|
|
@ -61,7 +61,7 @@ utrace_setLevel(int32_t traceLevel);
|
|||
* @draft ICU 2.8
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrace_getLevel();
|
||||
utrace_getLevel(void);
|
||||
|
||||
/* Trace function pointers types ----------------------------- */
|
||||
|
||||
|
|
|
@ -1268,7 +1268,7 @@ ures_getByKeyWithFallback(const UResourceBundle *resB,
|
|||
UResourceBundle *fillIn,
|
||||
UErrorCode *status) {
|
||||
Resource res = RES_BOGUS;
|
||||
UResourceDataEntry *realData = NULL;
|
||||
/*UResourceDataEntry *realData = NULL;*/
|
||||
const char *key = inKey;
|
||||
|
||||
if (status==NULL || U_FAILURE(*status)) {
|
||||
|
@ -1487,21 +1487,20 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle,
|
|||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
} else {
|
||||
const UResourceBundle *parent = NULL;
|
||||
switch(type) {
|
||||
case ULOC_ACTUAL_LOCALE:
|
||||
return resourceBundle->fData->fName;
|
||||
break;
|
||||
case ULOC_VALID_LOCALE:
|
||||
return resourceBundle->fTopLevelData->fName;
|
||||
break;
|
||||
case ULOC_REQUESTED_LOCALE:
|
||||
return NULL;
|
||||
break;
|
||||
default:
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
switch(type) {
|
||||
case ULOC_ACTUAL_LOCALE:
|
||||
return resourceBundle->fData->fName;
|
||||
break;
|
||||
case ULOC_VALID_LOCALE:
|
||||
return resourceBundle->fTopLevelData->fName;
|
||||
break;
|
||||
case ULOC_REQUESTED_LOCALE:
|
||||
return NULL;
|
||||
break;
|
||||
default:
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "utracimp.h"
|
||||
#include "cstring.h"
|
||||
#include "uassert.h"
|
||||
#include "ucln_cmn.h"
|
||||
|
||||
|
||||
static UTraceEntry *pTraceEntryFunc = NULL;
|
||||
|
@ -96,8 +97,8 @@ static void outputChar(char c, char *outBuf, int32_t *outIx, int32_t capacity, i
|
|||
* buffer size needed. No harm done.
|
||||
*/
|
||||
if (*outIx==0 || /* case 1. */
|
||||
c!='\n' && c!=0 && *outIx < capacity && outBuf[(*outIx)-1]=='\n' || /* case 2. */
|
||||
c=='\n' && *outIx>=capacity) /* case 3 */
|
||||
(c!='\n' && c!=0 && *outIx < capacity && outBuf[(*outIx)-1]=='\n') || /* case 2. */
|
||||
(c=='\n' && *outIx>=capacity)) /* case 3 */
|
||||
{
|
||||
/* At the start of a line. Indent. */
|
||||
for(i=0; i<indent; i++) {
|
||||
|
@ -187,11 +188,10 @@ U_CAPI int32_t U_EXPORT2
|
|||
utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, va_list args) {
|
||||
int32_t outIx = 0;
|
||||
int32_t fmtIx = 0;
|
||||
int32_t tbufIx = 0;
|
||||
char fmtC;
|
||||
char c;
|
||||
int32_t intArg;
|
||||
int64_t longArg;
|
||||
int64_t longArg = 0;
|
||||
char *ptrArg;
|
||||
|
||||
/* Loop runs once for each character in the format string.
|
||||
|
@ -283,7 +283,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
|
|||
int32_t *i32Ptr;
|
||||
int64_t *i64Ptr;
|
||||
void **ptrPtr;
|
||||
int32_t charsToOutput;
|
||||
int32_t charsToOutput = 0;
|
||||
int32_t i;
|
||||
|
||||
vectorType = fmt[fmtIx]; /* b, h, d, l, p, etc. */
|
||||
|
|
Loading…
Add table
Reference in a new issue