mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-3905 Fix some compiler warnings
X-SVN-Rev: 16767
This commit is contained in:
parent
b8deff5e50
commit
4cc513278c
11 changed files with 200 additions and 198 deletions
|
@ -2776,36 +2776,36 @@ uloc_getISOCountries()
|
|||
}
|
||||
|
||||
typedef struct {
|
||||
float q;
|
||||
char *locale;
|
||||
float q;
|
||||
char *locale;
|
||||
} _acceptLangItem;
|
||||
|
||||
static int uloc_acceptLanguageCompare(const void *a, const void *b)
|
||||
{
|
||||
const _acceptLangItem *aa = (const _acceptLangItem*)a;
|
||||
const _acceptLangItem *bb = (const _acceptLangItem*)b;
|
||||
const _acceptLangItem *aa = (const _acceptLangItem*)a;
|
||||
const _acceptLangItem *bb = (const _acceptLangItem*)b;
|
||||
|
||||
int rc = 0;
|
||||
if(bb->q < aa->q) {
|
||||
rc = -1; /* A > B */
|
||||
} else if(bb->q > aa->q) {
|
||||
rc = 1; /* A < B */
|
||||
} else {
|
||||
rc = 0; /* A = B */
|
||||
}
|
||||
int rc = 0;
|
||||
if(bb->q < aa->q) {
|
||||
rc = -1; /* A > B */
|
||||
} else if(bb->q > aa->q) {
|
||||
rc = 1; /* A < B */
|
||||
} else {
|
||||
rc = 0; /* A = B */
|
||||
}
|
||||
|
||||
if(rc==0) {
|
||||
rc = uprv_stricmp(aa->locale, bb->locale);
|
||||
}
|
||||
|
||||
if(rc==0) {
|
||||
rc = uprv_stricmp(aa->locale, bb->locale);
|
||||
}
|
||||
|
||||
#if defined(ULOC_DEBUG)
|
||||
/* fprintf(stderr, "a:[%s:%g], b:[%s:%g] -> %d\n",
|
||||
aa->locale, aa->q,
|
||||
bb->locale, bb->q,
|
||||
rc);*/
|
||||
/* fprintf(stderr, "a:[%s:%g], b:[%s:%g] -> %d\n",
|
||||
aa->locale, aa->q,
|
||||
bb->locale, bb->q,
|
||||
rc);*/
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2814,92 +2814,92 @@ mt-mt, ja;q=0.76, en-us;q=0.95, en;q=0.92, en-gb;q=0.89, fr;q=0.87, iu-ca;q=0.84
|
|||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult *outResult,
|
||||
const char *httpAcceptLanguage,
|
||||
UEnumeration* availableLocales,
|
||||
UErrorCode *status)
|
||||
const char *httpAcceptLanguage,
|
||||
UEnumeration* availableLocales,
|
||||
UErrorCode *status)
|
||||
{
|
||||
_acceptLangItem j[200];
|
||||
char **strs;
|
||||
char tmp[ULOC_FULLNAME_CAPACITY +1];
|
||||
int32_t n = 0;
|
||||
const char *itemEnd;
|
||||
const char *paramEnd;
|
||||
const char *s;
|
||||
const char *t;
|
||||
int32_t res;
|
||||
int32_t i;
|
||||
int32_t l = uprv_strlen(httpAcceptLanguage);
|
||||
_acceptLangItem j[200];
|
||||
char **strs;
|
||||
char tmp[ULOC_FULLNAME_CAPACITY +1];
|
||||
int32_t n = 0;
|
||||
const char *itemEnd;
|
||||
const char *paramEnd;
|
||||
const char *s;
|
||||
const char *t;
|
||||
int32_t res;
|
||||
int32_t i;
|
||||
int32_t l = uprv_strlen(httpAcceptLanguage);
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return -1;
|
||||
}
|
||||
if(U_FAILURE(*status)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(s=httpAcceptLanguage;s&&*s;) {
|
||||
while(isspace(*s)) /* eat space at the beginning */
|
||||
s++;
|
||||
itemEnd=uprv_strchr(s,',');
|
||||
paramEnd=uprv_strchr(s,';');
|
||||
if(!itemEnd) {
|
||||
itemEnd = httpAcceptLanguage+l; /* end of string */
|
||||
}
|
||||
if(paramEnd && paramEnd<itemEnd) {
|
||||
/* semicolon (;) is closer than end (,) */
|
||||
t = paramEnd+1;
|
||||
if(*t=='q') {
|
||||
t++;
|
||||
}
|
||||
while(isspace(*t)) {
|
||||
t++;
|
||||
}
|
||||
if(*t=='=') {
|
||||
t++;
|
||||
}
|
||||
while(isspace(*t)) {
|
||||
t++;
|
||||
}
|
||||
j[n].q = atof(t);
|
||||
} else {
|
||||
/* no semicolon - it's 1.0 */
|
||||
j[n].q = 1.0;
|
||||
paramEnd = itemEnd;
|
||||
}
|
||||
/* eat spaces prior to semi */
|
||||
for(t=(paramEnd-1);(paramEnd>s)&&isspace(*t);t--)
|
||||
;
|
||||
j[n].locale = uprv_strndup(s,(t+1)-s);
|
||||
uloc_canonicalize(j[n].locale,tmp,sizeof(tmp)/sizeof(tmp[0]),status);
|
||||
if(strcmp(j[n].locale,tmp)) {
|
||||
uprv_free(j[n].locale);
|
||||
j[n].locale=uprv_strdup(tmp);
|
||||
}
|
||||
for(s=httpAcceptLanguage;s&&*s;) {
|
||||
while(isspace(*s)) /* eat space at the beginning */
|
||||
s++;
|
||||
itemEnd=uprv_strchr(s,',');
|
||||
paramEnd=uprv_strchr(s,';');
|
||||
if(!itemEnd) {
|
||||
itemEnd = httpAcceptLanguage+l; /* end of string */
|
||||
}
|
||||
if(paramEnd && paramEnd<itemEnd) {
|
||||
/* semicolon (;) is closer than end (,) */
|
||||
t = paramEnd+1;
|
||||
if(*t=='q') {
|
||||
t++;
|
||||
}
|
||||
while(isspace(*t)) {
|
||||
t++;
|
||||
}
|
||||
if(*t=='=') {
|
||||
t++;
|
||||
}
|
||||
while(isspace(*t)) {
|
||||
t++;
|
||||
}
|
||||
j[n].q = atof(t);
|
||||
} else {
|
||||
/* no semicolon - it's 1.0 */
|
||||
j[n].q = 1.0;
|
||||
paramEnd = itemEnd;
|
||||
}
|
||||
/* eat spaces prior to semi */
|
||||
for(t=(paramEnd-1);(paramEnd>s)&&isspace(*t);t--)
|
||||
;
|
||||
j[n].locale = uprv_strndup(s,(t+1)-s);
|
||||
uloc_canonicalize(j[n].locale,tmp,sizeof(tmp)/sizeof(tmp[0]),status);
|
||||
if(strcmp(j[n].locale,tmp)) {
|
||||
uprv_free(j[n].locale);
|
||||
j[n].locale=uprv_strdup(tmp);
|
||||
}
|
||||
#if defined(ULOC_DEBUG)
|
||||
/*fprintf(stderr,"%d: s <%s> q <%g>\n", n, j[n].locale, j[n].q);*/
|
||||
/*fprintf(stderr,"%d: s <%s> q <%g>\n", n, j[n].locale, j[n].q);*/
|
||||
#endif
|
||||
n++;
|
||||
s = itemEnd;
|
||||
while(*s==',') { /* eat duplicate commas */
|
||||
s++;
|
||||
n++;
|
||||
s = itemEnd;
|
||||
while(*s==',') { /* eat duplicate commas */
|
||||
s++;
|
||||
}
|
||||
if(n>=(sizeof(j)/sizeof(j[0]))) { /* overflowed */
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if(n>=(sizeof(j)/sizeof(j[0]))) { /* overflowed */
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
qsort(j, n, sizeof(j[0]), uloc_acceptLanguageCompare);
|
||||
strs = uprv_malloc((size_t)(sizeof(strs[0])*n));
|
||||
for(i=0;i<n;i++) {
|
||||
qsort(j, n, sizeof(j[0]), uloc_acceptLanguageCompare);
|
||||
strs = uprv_malloc((size_t)(sizeof(strs[0])*n));
|
||||
for(i=0;i<n;i++) {
|
||||
#if defined(ULOC_DEBUG)
|
||||
/*fprintf(stderr,"%d: s <%s> q <%g>\n", i, j[i].locale, j[i].q);*/
|
||||
/*fprintf(stderr,"%d: s <%s> q <%g>\n", i, j[i].locale, j[i].q);*/
|
||||
#endif
|
||||
strs[i]=j[i].locale;
|
||||
}
|
||||
res = uloc_acceptLanguage(result, resultAvailable, outResult,
|
||||
(const char**)strs, n, availableLocales, status);
|
||||
for(i=0;i<n;i++) {
|
||||
uprv_free(strs[i]);
|
||||
}
|
||||
uprv_free(strs);
|
||||
return res;
|
||||
strs[i]=j[i].locale;
|
||||
}
|
||||
res = uloc_acceptLanguage(result, resultAvailable, outResult,
|
||||
(const char**)strs, n, availableLocales, status);
|
||||
for(i=0;i<n;i++) {
|
||||
uprv_free(strs[i]);
|
||||
}
|
||||
uprv_free(strs);
|
||||
return res;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
|
@ -2907,102 +2907,103 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
|
|||
UAcceptResult *outResult, const char **acceptList,
|
||||
int32_t acceptListCount,
|
||||
UEnumeration* availableLocales,
|
||||
UErrorCode *status) {
|
||||
int32_t i,j;
|
||||
int32_t len;
|
||||
size_t maxLen=0;
|
||||
char tmp[ULOC_FULLNAME_CAPACITY+1];
|
||||
const char *l;
|
||||
char **fallbackList;
|
||||
if(U_FAILURE(*status)) {
|
||||
return -1;
|
||||
}
|
||||
fallbackList = uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount));
|
||||
for(i=0;i<acceptListCount;i++) {
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr,"%02d: %s\n", i, acceptList[i]);
|
||||
#endif
|
||||
while((l=uenum_next(availableLocales, NULL, status))) {
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr," %s\n", l);
|
||||
#endif
|
||||
len = uprv_strlen(l);
|
||||
if(!uprv_strcmp(acceptList[i], l)) {
|
||||
if(outResult) {
|
||||
*outResult = ULOC_ACCEPT_VALID;
|
||||
}
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr, "MATCH! %s\n", l);
|
||||
#endif
|
||||
if(len>0) {
|
||||
uprv_strncpy(result, l, uprv_min(len, resultAvailable));
|
||||
}
|
||||
for(j=0;j<i;j++) {
|
||||
uprv_free(fallbackList[j]);
|
||||
}
|
||||
uprv_free(fallbackList);
|
||||
return u_terminateChars(result, resultAvailable, len, status);
|
||||
}
|
||||
if(len>maxLen) {
|
||||
maxLen = len;
|
||||
}
|
||||
UErrorCode *status)
|
||||
{
|
||||
int32_t i,j;
|
||||
int32_t len;
|
||||
int32_t maxLen=0;
|
||||
char tmp[ULOC_FULLNAME_CAPACITY+1];
|
||||
const char *l;
|
||||
char **fallbackList;
|
||||
if(U_FAILURE(*status)) {
|
||||
return -1;
|
||||
}
|
||||
uenum_reset(availableLocales, status);
|
||||
/* save off parent info */
|
||||
if(uloc_getParent(acceptList[i], tmp, sizeof(tmp)/sizeof(tmp[0]), status)!=0) {
|
||||
fallbackList[i] = uprv_strdup(tmp);
|
||||
} else {
|
||||
fallbackList[i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
for(maxLen--;maxLen>0;maxLen--) {
|
||||
fallbackList = uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount));
|
||||
for(i=0;i<acceptListCount;i++) {
|
||||
if(fallbackList[i] && (uprv_strlen(fallbackList[i])==maxLen)) {
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr,"Try: [%s]", fallbackList[i]);
|
||||
fprintf(stderr,"%02d: %s\n", i, acceptList[i]);
|
||||
#endif
|
||||
while((l=uenum_next(availableLocales, NULL, status))) {
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr," %s\n", l);
|
||||
fprintf(stderr," %s\n", l);
|
||||
#endif
|
||||
len = uprv_strlen(l);
|
||||
if(!uprv_strcmp(fallbackList[i], l)) {
|
||||
if(outResult) {
|
||||
*outResult = ULOC_ACCEPT_FALLBACK;
|
||||
}
|
||||
len = uprv_strlen(l);
|
||||
if(!uprv_strcmp(acceptList[i], l)) {
|
||||
if(outResult) {
|
||||
*outResult = ULOC_ACCEPT_VALID;
|
||||
}
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr, "fallback MATCH! %s\n", l);
|
||||
fprintf(stderr, "MATCH! %s\n", l);
|
||||
#endif
|
||||
if(len>0) {
|
||||
uprv_strncpy(result, l, uprv_min(len, resultAvailable));
|
||||
if(len>0) {
|
||||
uprv_strncpy(result, l, uprv_min(len, resultAvailable));
|
||||
}
|
||||
for(j=0;j<i;j++) {
|
||||
uprv_free(fallbackList[j]);
|
||||
}
|
||||
uprv_free(fallbackList);
|
||||
return u_terminateChars(result, resultAvailable, len, status);
|
||||
}
|
||||
for(i=0;i<acceptListCount;i++) {
|
||||
uprv_free(fallbackList[i]);
|
||||
if(len>maxLen) {
|
||||
maxLen = len;
|
||||
}
|
||||
uprv_free(fallbackList);
|
||||
return u_terminateChars(result, resultAvailable, len, status);
|
||||
}
|
||||
}
|
||||
uenum_reset(availableLocales, status);
|
||||
|
||||
if(uloc_getParent(fallbackList[i], tmp, sizeof(tmp)/sizeof(tmp[0]), status)!=0) {
|
||||
fallbackList[i] = uprv_strdup(tmp);
|
||||
/* save off parent info */
|
||||
if(uloc_getParent(acceptList[i], tmp, sizeof(tmp)/sizeof(tmp[0]), status)!=0) {
|
||||
fallbackList[i] = uprv_strdup(tmp);
|
||||
} else {
|
||||
fallbackList[i]=0;
|
||||
fallbackList[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(outResult) {
|
||||
*outResult = ULOC_ACCEPT_FAILED;
|
||||
|
||||
for(maxLen--;maxLen>0;maxLen--) {
|
||||
for(i=0;i<acceptListCount;i++) {
|
||||
if(fallbackList[i] && ((int32_t)uprv_strlen(fallbackList[i])==maxLen)) {
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr,"Try: [%s]", fallbackList[i]);
|
||||
#endif
|
||||
while((l=uenum_next(availableLocales, NULL, status))) {
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr," %s\n", l);
|
||||
#endif
|
||||
len = uprv_strlen(l);
|
||||
if(!uprv_strcmp(fallbackList[i], l)) {
|
||||
if(outResult) {
|
||||
*outResult = ULOC_ACCEPT_FALLBACK;
|
||||
}
|
||||
#if defined(ULOC_DEBUG)
|
||||
fprintf(stderr, "fallback MATCH! %s\n", l);
|
||||
#endif
|
||||
if(len>0) {
|
||||
uprv_strncpy(result, l, uprv_min(len, resultAvailable));
|
||||
}
|
||||
for(i=0;i<acceptListCount;i++) {
|
||||
uprv_free(fallbackList[i]);
|
||||
}
|
||||
uprv_free(fallbackList);
|
||||
return u_terminateChars(result, resultAvailable, len, status);
|
||||
}
|
||||
}
|
||||
uenum_reset(availableLocales, status);
|
||||
|
||||
if(uloc_getParent(fallbackList[i], tmp, sizeof(tmp)/sizeof(tmp[0]), status)!=0) {
|
||||
fallbackList[i] = uprv_strdup(tmp);
|
||||
} else {
|
||||
fallbackList[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(outResult) {
|
||||
*outResult = ULOC_ACCEPT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* *status = not found? */
|
||||
for(i=0;i<acceptListCount;i++) {
|
||||
uprv_free(fallbackList[i]);
|
||||
}
|
||||
uprv_free(fallbackList);
|
||||
return -1;
|
||||
/* *status = not found? */
|
||||
for(i=0;i<acceptListCount;i++) {
|
||||
uprv_free(fallbackList[i]);
|
||||
}
|
||||
uprv_free(fallbackList);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*eof*/
|
||||
|
|
|
@ -1586,8 +1586,8 @@ void TestGetTailoredSet() {
|
|||
}
|
||||
|
||||
static int tMemCmp(const uint8_t *first, const uint8_t *second) {
|
||||
int32_t firstLen = strlen((const char *)first);
|
||||
int32_t secondLen = strlen((const char *)second);
|
||||
int32_t firstLen = (int32_t)strlen((const char *)first);
|
||||
int32_t secondLen = (int32_t)strlen((const char *)second);
|
||||
return memcmp(first, second, uprv_min(firstLen, secondLen));
|
||||
}
|
||||
static const char * strengthsC[] = {
|
||||
|
|
|
@ -189,7 +189,7 @@ static void TestDemo1()
|
|||
UCollator *myCollation;
|
||||
int32_t j, n;
|
||||
const char *rules = "& Z < p, P";
|
||||
int32_t len=strlen(rules);
|
||||
int32_t len=(int32_t)strlen(rules);
|
||||
UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
u_uastrcpy(temp, rules);
|
||||
|
@ -221,7 +221,7 @@ static void TestDemo2()
|
|||
UCollator *myCollation;
|
||||
int32_t j, n;
|
||||
const char *rules = "& C < ch , cH, Ch, CH";
|
||||
int32_t len=strlen(rules);
|
||||
int32_t len=(int32_t)strlen(rules);
|
||||
UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
u_uastrcpy(temp, rules);
|
||||
|
@ -251,7 +251,7 @@ static void TestDemo3()
|
|||
UCollator *myCollation;
|
||||
int32_t j, n;
|
||||
const char *rules = "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'";
|
||||
int32_t len=strlen(rules);
|
||||
int32_t len=(int32_t)strlen(rules);
|
||||
UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
u_uastrcpy(temp, rules);
|
||||
|
@ -282,7 +282,7 @@ static void TestDemo4()
|
|||
UCollator *myCollation;
|
||||
int32_t j, n;
|
||||
const char *rules = " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' ";
|
||||
int32_t len=strlen(rules);
|
||||
int32_t len=(int32_t)strlen(rules);
|
||||
UChar *temp = (UChar*)malloc(sizeof(UChar) * (len+1));
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
u_uastrcpy(temp, rules);
|
||||
|
|
|
@ -695,7 +695,7 @@ static void TestFileStream(void){
|
|||
FileStream* pStderr = T_FileStream_stderr();
|
||||
|
||||
const char* testline = "This is a test line";
|
||||
int32_t bufLen =uprv_strlen(testline)+10;
|
||||
int32_t bufLen = (int32_t)strlen(testline)+10;
|
||||
char* buf = (char*) malloc(bufLen);
|
||||
int32_t retLen = 0;
|
||||
|
||||
|
@ -786,7 +786,7 @@ static void TestFileStream(void){
|
|||
}
|
||||
|
||||
T_FileStream_rewind(stream);
|
||||
T_FileStream_write(stream,testline,uprv_strlen(testline));
|
||||
T_FileStream_write(stream,testline,(int32_t)strlen(testline));
|
||||
T_FileStream_rewind(stream);
|
||||
retLen = T_FileStream_read(stream, buf, bufLen);
|
||||
if(uprv_strncmp(testline, buf,retLen)!=0){
|
||||
|
|
|
@ -526,7 +526,7 @@ static void TestMisc()
|
|||
/* Tests the ICU version #*/
|
||||
u_getVersion(realVersion);
|
||||
u_versionToString(realVersion, icuVersion);
|
||||
if (strncmp(icuVersion, U_ICU_VERSION, uprv_min(strlen(icuVersion), strlen(U_ICU_VERSION))) != 0)
|
||||
if (strncmp(icuVersion, U_ICU_VERSION, uprv_min((int32_t)strlen(icuVersion), (int32_t)strlen(U_ICU_VERSION))) != 0)
|
||||
{
|
||||
log_err("ICU version test failed. Header says=%s, got=%s \n", U_ICU_VERSION, icuVersion);
|
||||
}
|
||||
|
@ -1426,7 +1426,8 @@ static int32_t MakeProp(char* str)
|
|||
log_err("unrecognized type letter ");
|
||||
log_err(str);
|
||||
}
|
||||
else result = ((matchPosition - tagStrings) / 2);
|
||||
else
|
||||
result = (int32_t)((matchPosition - tagStrings) / 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 2001-2003, International Business Machines Corporation and
|
||||
* Copyright (c) 2001-2004, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/********************************************************************************
|
||||
|
@ -677,7 +677,7 @@ static void Test_widestrs()
|
|||
log_err("u_strToWCS: ustr = %s, ul = %d, ws = %S, wl = %d!\n", u_austrcpy(astr, ustr), ul, ws, wl);
|
||||
}
|
||||
err = U_ZERO_ERROR;
|
||||
wl = uprv_wcslen(wcs);
|
||||
wl = (int32_t)uprv_wcslen(wcs);
|
||||
cp = u_strFromWCS(rts, rtcap, &rtl, wcs, wl, &err);
|
||||
if (U_FAILURE(err)) {
|
||||
errname = u_errorName(err);
|
||||
|
|
|
@ -1765,7 +1765,7 @@ TestUNormIterator() {
|
|||
testUNormIteratorWithText(text, length, length, "UCharIterEnd", "UNormIterEnd1");
|
||||
|
||||
/* test again, this time with an insane string to cause internal buffer overflows */
|
||||
middle=u_strchr(text, 0x327)-text; /* see comment at text[] */
|
||||
middle=(int32_t)(u_strchr(text, 0x327)-text); /* see comment at text[] */
|
||||
memcpy(longText, text, middle*U_SIZEOF_UCHAR);
|
||||
for(i=0; i<150; ++i) {
|
||||
longText[middle+i]=0x30a; /* insert many rings between 'A-ring' and cedilla */
|
||||
|
|
|
@ -71,7 +71,7 @@ chArrayUNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
|
|||
}
|
||||
|
||||
cont->currChar = (cont->array)[cont->currIndex];
|
||||
*resultLength = uprv_strlen(cont->currChar);
|
||||
*resultLength = (int32_t)strlen(cont->currChar);
|
||||
u_charsToUChars(cont->currChar, cont->currUChar, *resultLength);
|
||||
cont->currIndex++;
|
||||
return cont->currUChar;
|
||||
|
@ -84,7 +84,7 @@ chArrayNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
|
|||
}
|
||||
|
||||
cont->currChar = (cont->array)[cont->currIndex];
|
||||
*resultLength = uprv_strlen(cont->currChar);
|
||||
*resultLength = (int32_t)strlen(cont->currChar);
|
||||
cont->currIndex++;
|
||||
return cont->currChar;
|
||||
}
|
||||
|
|
|
@ -1703,8 +1703,8 @@ LocaleTest::TestGetBaseName(void) {
|
|||
* prefix + '_' + x, then return 1. Otherwise return a value < 0.
|
||||
*/
|
||||
static UBool _loccmp(const char* string, const char* prefix) {
|
||||
int32_t slen = uprv_strlen(string),
|
||||
plen = uprv_strlen(prefix);
|
||||
int32_t slen = (int32_t)strlen(string),
|
||||
plen = (int32_t)strlen(prefix);
|
||||
int32_t c = uprv_strncmp(string, prefix, plen);
|
||||
/* 'root' is "less than" everything */
|
||||
if (uprv_strcmp(prefix, "root") == 0) {
|
||||
|
|
|
@ -1099,7 +1099,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
UnicodeString str = theBundle.getStringEx("testescape",status);
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
if(U_SUCCESS(status)){
|
||||
u_charsToUChars(expect,uExpect,uprv_strlen(expect)+1);
|
||||
u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
|
||||
if(str.compare(uExpect)!=0){
|
||||
errln("Did not get the expected string for testescape expected. Expected : "
|
||||
+UnicodeString(uExpect )+ " Got: " + str);
|
||||
|
@ -1111,7 +1111,7 @@ NewResourceBundleTest::TestNewTypes() {
|
|||
UnicodeString str = theBundle.getStringEx("test_underscores",status);
|
||||
expect ="test message ....";
|
||||
CONFIRM_UErrorCode(status, U_ZERO_ERROR);
|
||||
u_charsToUChars(expect,uExpect,uprv_strlen(expect)+1);
|
||||
u_charsToUChars(expect,uExpect,(int32_t)uprv_strlen(expect)+1);
|
||||
if(str.compare(uExpect)!=0){
|
||||
errln("Did not get the expected string for test_underscores.\n");
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ void UCAConformanceTest::openTestFile(const char *type)
|
|||
char buffer[1024];
|
||||
uprv_strcpy(buffer, testDataPath);
|
||||
uprv_strcat(buffer, type);
|
||||
int32_t bufLen = uprv_strlen(buffer);
|
||||
int32_t bufLen = (int32_t)uprv_strlen(buffer);
|
||||
|
||||
// we try to open 3 files:
|
||||
// path/CollationTest_type.txt
|
||||
|
|
Loading…
Add table
Reference in a new issue