ICU-3905 Fix some compiler warnings
X-SVN-Rev: 16754
This commit is contained in:
parent
2df1c8eff4
commit
287852e706
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1126,37 +1126,36 @@ doOpenChoice(const char *path, const char *type, const char *name,
|
||||
|
||||
|
||||
if(path==NULL) {
|
||||
TinyString_append(&pkgName, U_ICUDATA_NAME);
|
||||
TinyString_append(&pkgName, U_ICUDATA_NAME);
|
||||
} else {
|
||||
const char *pkg;
|
||||
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 */
|
||||
/* see if this is an /absolute/path/to/package path */
|
||||
if(pkg) {
|
||||
TinyString_append(&pkgName, pkg+1);
|
||||
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);
|
||||
} else {
|
||||
TinyString_append(&pkgName, path);
|
||||
}
|
||||
} else {
|
||||
TinyString_append(&pkgName, path);
|
||||
treeChar = uprv_strchr(path, U_TREE_SEPARATOR);
|
||||
if(treeChar) {
|
||||
TinyString_append(&treeName, treeChar+1); /* following '-' */
|
||||
if(!isICUData) {
|
||||
TinyString_appendn(&pkgName, path, (int32_t)(treeChar-path));
|
||||
} else {
|
||||
TinyString_append(&pkgName, U_ICUDATA_NAME);
|
||||
}
|
||||
} else {
|
||||
if(!isICUData) {
|
||||
TinyString_append(&pkgName, path);
|
||||
} else {
|
||||
TinyString_append(&pkgName, U_ICUDATA_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
treeChar = uprv_strchr(path, U_TREE_SEPARATOR);
|
||||
if(treeChar) {
|
||||
TinyString_append(&treeName, treeChar+1); /* following '-' */
|
||||
if(!isICUData) {
|
||||
TinyString_appendn(&pkgName, path, treeChar-path);
|
||||
} else {
|
||||
TinyString_append(&pkgName, U_ICUDATA_NAME);
|
||||
}
|
||||
} else {
|
||||
if(!isICUData) {
|
||||
TinyString_append(&pkgName, path);
|
||||
} else {
|
||||
TinyString_append(&pkgName, U_ICUDATA_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UDATA_DEBUG
|
||||
@ -1174,11 +1173,11 @@ doOpenChoice(const char *path, const char *type, const char *name,
|
||||
tocEntrySuffixIndex = tocEntryName.length;
|
||||
|
||||
if(treeName.s[0]) {
|
||||
TinyString_append(&tocEntryName, U_TREE_ENTRY_SEP_STRING);
|
||||
TinyString_append(&tocEntryName, treeName.s);
|
||||
TinyString_append(&tocEntryName, U_TREE_ENTRY_SEP_STRING);
|
||||
TinyString_append(&tocEntryName, treeName.s);
|
||||
|
||||
TinyString_append(&tocEntryPath, U_FILE_SEP_STRING);
|
||||
TinyString_append(&tocEntryPath, treeName.s);
|
||||
TinyString_append(&tocEntryPath, U_FILE_SEP_STRING);
|
||||
TinyString_append(&tocEntryPath, treeName.s);
|
||||
}
|
||||
|
||||
TinyString_append(&oldIndFileName, "_");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -593,44 +593,44 @@ allocString(uint32_t length) {
|
||||
|
||||
static char *
|
||||
pathToFullPath(const char *path) {
|
||||
int32_t length;
|
||||
int32_t newLength;
|
||||
char *fullPath;
|
||||
int32_t n;
|
||||
int32_t length;
|
||||
int32_t newLength;
|
||||
char *fullPath;
|
||||
int32_t n;
|
||||
|
||||
length = (uint32_t)(uprv_strlen(path) + 1);
|
||||
newLength = (length + 1 + uprv_strlen(options[10].value));
|
||||
fullPath = uprv_malloc(newLength);
|
||||
if(options[10].doesOccur) {
|
||||
uprv_strcpy(fullPath, options[10].value);
|
||||
uprv_strcat(fullPath, U_FILE_SEP_STRING);
|
||||
} else {
|
||||
fullPath[0] = 0;
|
||||
}
|
||||
n = uprv_strlen(fullPath);
|
||||
uprv_strcat(fullPath, path);
|
||||
|
||||
if(!embed) {
|
||||
length = (uint32_t)(uprv_strlen(path) + 1);
|
||||
newLength = (length + 1 + (int32_t)uprv_strlen(options[10].value));
|
||||
fullPath = uprv_malloc(newLength);
|
||||
if(options[10].doesOccur) {
|
||||
uprv_strcpy(fullPath, options[10].value);
|
||||
uprv_strcat(fullPath, U_FILE_SEP_STRING);
|
||||
} else {
|
||||
fullPath[0] = 0;
|
||||
}
|
||||
n = (int32_t)uprv_strlen(fullPath);
|
||||
uprv_strcat(fullPath, path);
|
||||
|
||||
if(!embed) {
|
||||
#if (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
|
||||
#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR)
|
||||
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
|
||||
for(;fullPath[n];n++) {
|
||||
if(fullPath[n] == U_FILE_ALT_SEP_CHAR) {
|
||||
fullPath[n] = U_FILE_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
|
||||
for(;fullPath[n];n++) {
|
||||
if(fullPath[n] == U_FILE_ALT_SEP_CHAR) {
|
||||
fullPath[n] = U_FILE_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
|
||||
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
|
||||
for(;fullPath[n];n++) {
|
||||
if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) {
|
||||
fullPath[n] = U_FILE_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
|
||||
for(;fullPath[n];n++) {
|
||||
if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) {
|
||||
fullPath[n] = U_FILE_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return fullPath;
|
||||
}
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user