ICU-3905 Fix some compiler warnings

X-SVN-Rev: 16754
This commit is contained in:
George Rhoten 2004-11-04 21:51:57 +00:00
parent 2df1c8eff4
commit 287852e706
4 changed files with 70 additions and 71 deletions

View File

@ -65,7 +65,7 @@ ucnv_getDisplayName(const UConverter *cnv,
} else {
/* convert the internal name into a Unicode string */
*pErrorCode=U_ZERO_ERROR;
length=uprv_strlen(cnv->sharedData->staticData->name);
length=(int32_t)uprv_strlen(cnv->sharedData->staticData->name);
u_charsToUChars(cnv->sharedData->staticData->name, displayName, uprv_min(length, displayNameCapacity));
}
return u_terminateUChars(displayName, displayNameCapacity, length, pErrorCode);

View File

@ -358,7 +358,7 @@ static void TinyString_init(TinyString *This) {
static void TinyString_append(TinyString *This, const char *what) {
int32_t newLen;
newLen = This->length + uprv_strlen(what);
newLen = This->length + (int32_t)uprv_strlen(what);
if (newLen >= This->fCapacity) {
int32_t newCapacity = newLen * 2;
char *newBuf = (char *)uprv_malloc(newCapacity+1);
@ -481,7 +481,7 @@ static void udata_pathiter_init(UDataPathIterator *iter, const char *path, const
}
iter->packageStub[0] = U_FILE_SEP_CHAR;
uprv_strcpy(iter->packageStub+1, pkg);
iter->packageStubLen = uprv_strlen(iter->packageStub);
iter->packageStubLen = (int32_t)uprv_strlen(iter->packageStub);
#ifdef UDATA_DEBUG
fprintf(stderr, "STUB=%s [%d]\n", iter->packageStub, iter->packageStubLen);
@ -490,7 +490,7 @@ static void udata_pathiter_init(UDataPathIterator *iter, const char *path, const
/** Item **/
iter->basename = findBasename(item);
iter->basenameLen = uprv_strlen(iter->basename);
iter->basenameLen = (int32_t)uprv_strlen(iter->basename);
if(iter->basename == NULL) {
iter->nextPath = NULL;
@ -503,7 +503,7 @@ static void udata_pathiter_init(UDataPathIterator *iter, const char *path, const
iter->itemPath[0] = 0;
iter->nextPath = iter->path;
} else {
int32_t itemPathLen = iter->basename-item;
int32_t itemPathLen = (int32_t)(iter->basename-item);
if (itemPathLen >= U_DATA_PATHITER_BUFSIZ) {
char *t = (char *)uprv_malloc(itemPathLen+1);
if (t != NULL) {
@ -534,7 +534,7 @@ static void udata_pathiter_init(UDataPathIterator *iter, const char *path, const
* Get an upper bound of possible string size, and make sure that the buffer
* is big enough (sum of length of each piece, 2 extra delimiters, + trailing NULL) */
{
int32_t maxPathLen = uprv_strlen(iter->path) + uprv_strlen(item) + uprv_strlen(iter->suffix) + iter->packageStubLen + 3;
int32_t maxPathLen = (int32_t)uprv_strlen(iter->path) + uprv_strlen(item) + uprv_strlen(iter->suffix) + iter->packageStubLen + 3;
iter->pathBuffer = iter->pathBufferA;
if (maxPathLen >= U_DATA_PATHITER_BUFSIZ) {
iter->pathBuffer = (char *)uprv_malloc(maxPathLen);
@ -586,16 +586,16 @@ static const char *udata_pathiter_next(UDataPathIterator *iter, int32_t *outPath
if(iter->nextPath == iter->itemPath) { /* we were processing item's path. */
iter->nextPath = iter->path; /* start with regular path next tm. */
pathLen = uprv_strlen(path);
pathLen = (int32_t)uprv_strlen(path);
} else {
/* fix up next for next time */
iter->nextPath = uprv_strchr(path, U_PATH_SEP_CHAR);
if(iter->nextPath == NULL) {
/* segment: entire path */
pathLen = uprv_strlen(path);
pathLen = (int32_t)uprv_strlen(path);
} else {
/* segment: until next segment */
pathLen = iter->nextPath - path;
pathLen = (int32_t)(iter->nextPath - path);
if(*iter->nextPath) { /* skip divider */
iter->nextPath ++;
}
@ -671,7 +671,7 @@ static const char *udata_pathiter_next(UDataPathIterator *iter, int32_t *outPath
{
uprv_strcpy(iter->pathBuffer + pathLen,
iter->suffix);
pathLen += uprv_strlen(iter->suffix);
pathLen += (int32_t)uprv_strlen(iter->suffix);
}
}
@ -1132,8 +1132,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
const char *first;
pkg = uprv_strrchr(path, U_FILE_SEP_CHAR);
first = uprv_strchr(path, U_FILE_SEP_CHAR);
if(uprv_pathIsAbsolute(path) ||
(pkg != first)) { /* more than one slash in the path- not a tree name */
if(uprv_pathIsAbsolute(path) || (pkg != first)) { /* more than one slash in the path- not a tree name */
/* see if this is an /absolute/path/to/package path */
if(pkg) {
TinyString_append(&pkgName, pkg+1);
@ -1145,7 +1144,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
if(treeChar) {
TinyString_append(&treeName, treeChar+1); /* following '-' */
if(!isICUData) {
TinyString_appendn(&pkgName, path, treeChar-path);
TinyString_appendn(&pkgName, path, (int32_t)(treeChar-path));
} else {
TinyString_append(&pkgName, U_ICUDATA_NAME);
}

View File

@ -95,7 +95,7 @@ UnicodeString *
StringEnumeration::setChars(const char *s, int32_t length, UErrorCode &status) {
if(U_SUCCESS(status) && s!=NULL) {
if(length<0) {
length=uprv_strlen(s);
length=(int32_t)uprv_strlen(s);
}
UChar *buffer=unistr.getBuffer(length+1);
@ -269,7 +269,7 @@ ucharstrenum_next(UEnumeration* en,
}
const char* result = ((const char**)e->uenum.context)[e->index++];
if (resultLength) {
*resultLength = uprv_strlen(result);
*resultLength = (int32_t)uprv_strlen(result);
}
return result;
}

View File

@ -599,7 +599,7 @@ pathToFullPath(const char *path) {
int32_t n;
length = (uint32_t)(uprv_strlen(path) + 1);
newLength = (length + 1 + uprv_strlen(options[10].value));
newLength = (length + 1 + (int32_t)uprv_strlen(options[10].value));
fullPath = uprv_malloc(newLength);
if(options[10].doesOccur) {
uprv_strcpy(fullPath, options[10].value);
@ -607,7 +607,7 @@ pathToFullPath(const char *path) {
} else {
fullPath[0] = 0;
}
n = uprv_strlen(fullPath);
n = (int32_t)uprv_strlen(fullPath);
uprv_strcat(fullPath, path);
if(!embed) {