ICU-3222 Fix some compiler warnings.
X-SVN-Rev: 13865
This commit is contained in:
parent
d15a671219
commit
96cd8f87e0
File diff suppressed because it is too large
Load Diff
@ -795,127 +795,128 @@ static void TestFileStream(void){
|
||||
}
|
||||
|
||||
static void TestGetSize(void) {
|
||||
const struct {
|
||||
const char* key;
|
||||
int32_t size;
|
||||
} test[] = {
|
||||
{ "zerotest", 1},
|
||||
{ "one", 1},
|
||||
{ "importtest", 1},
|
||||
{ "integerarray", 1},
|
||||
{ "emptyarray", 0},
|
||||
{ "emptytable", 0},
|
||||
{ "emptystring", 1}, /* empty string is still a string */
|
||||
{ "emptyint", 1},
|
||||
{ "emptybin", 1},
|
||||
{ "testinclude", 1},
|
||||
{ "collations", 1}, /* not 2 - there is hidden %%CollationBin */
|
||||
};
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
UResourceBundle *rb = NULL;
|
||||
UResourceBundle *res = NULL;
|
||||
UResourceBundle *helper = NULL;
|
||||
const char* testdatapath = loadTestData(&status);
|
||||
int32_t i = 0, j = 0;
|
||||
int32_t size = 0;
|
||||
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Could not load testdata.dat %s\n", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
rb = ures_open(testdatapath, "testtypes", &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Could not testtypes resource bundle %s\n", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < sizeof(test)/sizeof(test[0]); i++) {
|
||||
res = ures_getByKey(rb, test[i].key, res, &status);
|
||||
const struct {
|
||||
const char* key;
|
||||
int32_t size;
|
||||
} test[] = {
|
||||
{ "zerotest", 1},
|
||||
{ "one", 1},
|
||||
{ "importtest", 1},
|
||||
{ "integerarray", 1},
|
||||
{ "emptyarray", 0},
|
||||
{ "emptytable", 0},
|
||||
{ "emptystring", 1}, /* empty string is still a string */
|
||||
{ "emptyint", 1},
|
||||
{ "emptybin", 1},
|
||||
{ "testinclude", 1},
|
||||
{ "collations", 1}, /* not 2 - there is hidden %%CollationBin */
|
||||
};
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
UResourceBundle *rb = NULL;
|
||||
UResourceBundle *res = NULL;
|
||||
UResourceBundle *helper = NULL;
|
||||
const char* testdatapath = loadTestData(&status);
|
||||
int32_t i = 0, j = 0;
|
||||
int32_t size = 0;
|
||||
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Couldn't find the key %s. Error: %s\n", test[i].key, u_errorName(status));
|
||||
ures_close(rb);
|
||||
log_err("Could not load testdata.dat %s\n", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
size = ures_getSize(res);
|
||||
if(size != test[i].size) {
|
||||
log_err("Expected size %i, got size %i for key %s\n", test[i].size, size, test[i].key);
|
||||
for(j = 0; j < size; j++) {
|
||||
helper = ures_getByIndex(res, j, helper, &status);
|
||||
log_err("%s\n", ures_getKey(helper));
|
||||
}
|
||||
}
|
||||
}
|
||||
ures_close(helper);
|
||||
ures_close(res);
|
||||
ures_close(rb);
|
||||
}
|
||||
|
||||
static void TestGetLocaleByType(void) {
|
||||
const struct {
|
||||
char *requestedLocale;
|
||||
char *resourceKey;
|
||||
char *validLocale;
|
||||
char *actualLocale;
|
||||
} test[] = {
|
||||
{ "te_IN_BLAH", "string_only_in_te_IN", "te_IN", "te_IN" },
|
||||
{ "te_IN_BLAH", "string_only_in_te", "te_IN", "te" },
|
||||
{ "te_IN_BLAH", "string_only_in_Root", "te_IN", "root" },
|
||||
{ "te_IN_BLAH_01234567890_01234567890_01234567890_01234567890_01234567890_01234567890", "array_2d_only_in_Root", "te_IN", "root" },
|
||||
{ "te_IN_BLAH@currency=euro", "array_2d_only_in_te_IN", "te_IN", "te_IN" },
|
||||
{ "te_IN_BLAH@collation=phonebook;calendar=thai", "array_2d_only_in_te", "te_IN", "te" }
|
||||
};
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
UResourceBundle *rb = NULL;
|
||||
UResourceBundle *res = NULL;
|
||||
const char* testdatapath = loadTestData(&status);
|
||||
int32_t i = 0;
|
||||
const char *locale = NULL;
|
||||
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Could not load testdata.dat %s\n", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < sizeof(test)/sizeof(test[0]); i++) {
|
||||
rb = ures_open(testdatapath, test[i].requestedLocale, &status);
|
||||
rb = ures_open(testdatapath, "testtypes", &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Could not open resource bundle %s (error %s)\n", test[i].requestedLocale, u_errorName(status));
|
||||
status = U_ZERO_ERROR;
|
||||
continue;
|
||||
log_err("Could not testtypes resource bundle %s\n", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
res = ures_getByKey(rb, test[i].resourceKey, res, &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Couldn't find the key %s. Error: %s\n", test[i].resourceKey, u_errorName(status));
|
||||
ures_close(rb);
|
||||
status = U_ZERO_ERROR;
|
||||
continue;
|
||||
}
|
||||
|
||||
locale = ures_getLocaleByType(res, ULOC_REQUESTED_LOCALE, &status);
|
||||
if(locale) {
|
||||
log_err("Requested locale should return NULL\n");
|
||||
}
|
||||
locale = ures_getLocaleByType(res, ULOC_VALID_LOCALE, &status);
|
||||
if(!locale || strcmp(locale, test[i].validLocale) != 0) {
|
||||
log_err("Expected valid locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
||||
}
|
||||
locale = ures_getLocaleByType(res, ULOC_ACTUAL_LOCALE, &status);
|
||||
if(!locale || strcmp(locale, test[i].actualLocale) != 0) {
|
||||
log_err("Expected actual locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
||||
|
||||
for(i = 0; i < sizeof(test)/sizeof(test[0]); i++) {
|
||||
res = ures_getByKey(rb, test[i].key, res, &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Couldn't find the key %s. Error: %s\n", test[i].key, u_errorName(status));
|
||||
ures_close(rb);
|
||||
return;
|
||||
}
|
||||
size = ures_getSize(res);
|
||||
if(size != test[i].size) {
|
||||
log_err("Expected size %i, got size %i for key %s\n", test[i].size, size, test[i].key);
|
||||
for(j = 0; j < size; j++) {
|
||||
helper = ures_getByIndex(res, j, helper, &status);
|
||||
log_err("%s\n", ures_getKey(helper));
|
||||
}
|
||||
}
|
||||
}
|
||||
ures_close(helper);
|
||||
ures_close(res);
|
||||
ures_close(rb);
|
||||
}
|
||||
ures_close(res);
|
||||
}
|
||||
|
||||
static void TestGetLocaleByType(void) {
|
||||
static const struct {
|
||||
const char *requestedLocale;
|
||||
const char *resourceKey;
|
||||
const char *validLocale;
|
||||
const char *actualLocale;
|
||||
} test[] = {
|
||||
{ "te_IN_BLAH", "string_only_in_te_IN", "te_IN", "te_IN" },
|
||||
{ "te_IN_BLAH", "string_only_in_te", "te_IN", "te" },
|
||||
{ "te_IN_BLAH", "string_only_in_Root", "te_IN", "root" },
|
||||
{ "te_IN_BLAH_01234567890_01234567890_01234567890_01234567890_01234567890_01234567890", "array_2d_only_in_Root", "te_IN", "root" },
|
||||
{ "te_IN_BLAH@currency=euro", "array_2d_only_in_te_IN", "te_IN", "te_IN" },
|
||||
{ "te_IN_BLAH@collation=phonebook;calendar=thai", "array_2d_only_in_te", "te_IN", "te" }
|
||||
};
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
UResourceBundle *rb = NULL;
|
||||
UResourceBundle *res = NULL;
|
||||
const char* testdatapath = loadTestData(&status);
|
||||
int32_t i = 0;
|
||||
const char *locale = NULL;
|
||||
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Could not load testdata.dat %s\n", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < sizeof(test)/sizeof(test[0]); i++) {
|
||||
rb = ures_open(testdatapath, test[i].requestedLocale, &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Could not open resource bundle %s (error %s)\n", test[i].requestedLocale, u_errorName(status));
|
||||
status = U_ZERO_ERROR;
|
||||
continue;
|
||||
}
|
||||
|
||||
res = ures_getByKey(rb, test[i].resourceKey, res, &status);
|
||||
if(U_FAILURE(status))
|
||||
{
|
||||
log_err("Couldn't find the key %s. Error: %s\n", test[i].resourceKey, u_errorName(status));
|
||||
ures_close(rb);
|
||||
status = U_ZERO_ERROR;
|
||||
continue;
|
||||
}
|
||||
|
||||
locale = ures_getLocaleByType(res, ULOC_REQUESTED_LOCALE, &status);
|
||||
if(locale) {
|
||||
log_err("Requested locale should return NULL\n");
|
||||
}
|
||||
locale = ures_getLocaleByType(res, ULOC_VALID_LOCALE, &status);
|
||||
if(!locale || strcmp(locale, test[i].validLocale) != 0) {
|
||||
log_err("Expected valid locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
||||
}
|
||||
locale = ures_getLocaleByType(res, ULOC_ACTUAL_LOCALE, &status);
|
||||
if(!locale || strcmp(locale, test[i].actualLocale) != 0) {
|
||||
log_err("Expected actual locale to be %s. Got %s\n", test[i].requestedLocale, locale);
|
||||
}
|
||||
ures_close(rb);
|
||||
}
|
||||
ures_close(res);
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ static char *safeGetICUDataDirectory() {
|
||||
int gBlockCount = 0;
|
||||
const void *gContext;
|
||||
|
||||
void *myMemAlloc(const void *context, size_t size) {
|
||||
static void *myMemAlloc(const void *context, size_t size) {
|
||||
char *retPtr = (char *)malloc(size+8);
|
||||
if (retPtr != NULL) {
|
||||
retPtr += 8;
|
||||
@ -82,7 +82,7 @@ void *myMemAlloc(const void *context, size_t size) {
|
||||
return retPtr;
|
||||
}
|
||||
|
||||
void myMemFree(const void *context, void *mem) {
|
||||
static void myMemFree(const void *context, void *mem) {
|
||||
char *freePtr = (char *)mem;
|
||||
if (freePtr != NULL) {
|
||||
freePtr -= 8;
|
||||
@ -91,8 +91,8 @@ void myMemFree(const void *context, void *mem) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *myMemRealloc(const void *context, void *mem, size_t size) {
|
||||
|
||||
static void *myMemRealloc(const void *context, void *mem, size_t size) {
|
||||
char *p = (char *)mem;
|
||||
char *retPtr;
|
||||
|
||||
@ -194,7 +194,7 @@ typedef struct DummyMutex {
|
||||
} DummyMutex;
|
||||
|
||||
|
||||
void myMutexInit(const void *context, UMTX *mutex, UErrorCode *status) {
|
||||
static void myMutexInit(const void *context, UMTX *mutex, UErrorCode *status) {
|
||||
DummyMutex *theMutex;
|
||||
|
||||
TEST_STATUS(*status, U_ZERO_ERROR);
|
||||
@ -208,7 +208,7 @@ void myMutexInit(const void *context, UMTX *mutex, UErrorCode *status) {
|
||||
}
|
||||
|
||||
|
||||
void myMutexDestroy(const void *context, UMTX *mutex) {
|
||||
static void myMutexDestroy(const void *context, UMTX *mutex) {
|
||||
DummyMutex *This = *(DummyMutex **)mutex;
|
||||
|
||||
gTotalMutexesActive--;
|
||||
@ -219,7 +219,7 @@ void myMutexDestroy(const void *context, UMTX *mutex) {
|
||||
free(This);
|
||||
}
|
||||
|
||||
void myMutexLock(const void *context, UMTX *mutex) {
|
||||
static void myMutexLock(const void *context, UMTX *mutex) {
|
||||
DummyMutex *This = *(DummyMutex **)mutex;
|
||||
|
||||
TEST_ASSERT(This->fMagic == 123456);
|
||||
@ -227,7 +227,7 @@ void myMutexLock(const void *context, UMTX *mutex) {
|
||||
gAccumulatedLocks++;
|
||||
}
|
||||
|
||||
void myMutexUnlock(const void *context, UMTX *mutex) {
|
||||
static void myMutexUnlock(const void *context, UMTX *mutex) {
|
||||
DummyMutex *This = *(DummyMutex **)mutex;
|
||||
|
||||
TEST_ASSERT(This->fMagic == 123456);
|
||||
|
@ -3098,7 +3098,7 @@ void RBBITest::TestWordBreaks(void)
|
||||
// BreakIterator *bi = BreakIterator::createCharacterInstance(locale, status);
|
||||
BreakIterator *bi = BreakIterator::createWordInstance(locale, status);
|
||||
UChar str[300];
|
||||
char *strlist[] =
|
||||
static const char *strlist[] =
|
||||
{
|
||||
"\\U000e0032\\u0097\\u0f94\\uc2d8\\u05f4\\U000e0031\\u060d",
|
||||
"\\U000e0037\\u4666\\u1202\\u003a\\U000e0031\\u064d\\u0bea\\u591c\\U000e0040\\u003b",
|
||||
@ -3169,7 +3169,7 @@ void RBBITest::TestWordBoundary(void)
|
||||
// BreakIterator *bi = BreakIterator::createCharacterInstance(locale, status);
|
||||
BreakIterator *bi = BreakIterator::createWordInstance(locale, status);
|
||||
UChar str[50];
|
||||
char *strlist[] =
|
||||
static const char *strlist[] =
|
||||
{
|
||||
"\\u200e\\U000e0072\\u0a4b\\U000e003f\\ufd2b\\u2027\\u002e\\u002e",
|
||||
"\\U000e0042\\u002e\\u0fb8\\u09ef\\u0ed1\\u2044",
|
||||
@ -3242,7 +3242,7 @@ void RBBITest::TestLineBreaks(void)
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
BreakIterator *bi = BreakIterator::createLineInstance(locale, status);
|
||||
UChar str[50];
|
||||
char *strlist[] =
|
||||
static const char *strlist[] =
|
||||
{
|
||||
"\\ufeff\\ufffc\\u3289\\u0085\\u2772\\u0020\\U000e010a\\u0020\\u2025\\u000a\\U000e0123",
|
||||
"\\ufe3c\\u201c\\u000d\\u2025\\u2007\\u201c\\u002d\\u20a0\\u002d\\u30a7\\u17a4",
|
||||
@ -3307,7 +3307,7 @@ void RBBITest::TestSentBreaks(void)
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
BreakIterator *bi = BreakIterator::createSentenceInstance(locale, status);
|
||||
UChar str[100];
|
||||
char *strlist[] =
|
||||
static const char *strlist[] =
|
||||
{
|
||||
"Now\ris\nthe\r\ntime\n\rfor\r\r",
|
||||
"This\n",
|
||||
@ -3413,7 +3413,7 @@ void RBBITest::TestMonkey(char *params) {
|
||||
// seed - Seed for starting random number generator (parameter from user)
|
||||
// numIterations
|
||||
//
|
||||
void RBBITest::RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, char *name, uint32_t seed, int32_t numIterations) {
|
||||
void RBBITest::RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t seed, int32_t numIterations) {
|
||||
|
||||
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
|
||||
|
||||
|
@ -119,7 +119,7 @@ private:
|
||||
void doBreakInvariantTest(BreakIterator& tb, UnicodeString& testChars);
|
||||
void doOtherInvariantTest(BreakIterator& tb, UnicodeString& testChars);
|
||||
|
||||
void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, char *name, uint32_t seed, int32_t loopCount);
|
||||
void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t seed, int32_t loopCount);
|
||||
|
||||
};
|
||||
|
||||
|
@ -542,10 +542,10 @@ void
|
||||
ResourceBundleTest::TestGetLocaleByType(void)
|
||||
{
|
||||
const struct {
|
||||
char *requestedLocale;
|
||||
char *resourceKey;
|
||||
char *validLocale;
|
||||
char *actualLocale;
|
||||
const char *requestedLocale;
|
||||
const char *resourceKey;
|
||||
const char *validLocale;
|
||||
const char *actualLocale;
|
||||
} test[] = {
|
||||
{ "te_IN_BLAH", "string_only_in_te_IN", "te_IN", "te_IN" },
|
||||
{ "te_IN_BLAH", "string_only_in_te", "te_IN", "te" },
|
||||
|
Loading…
Reference in New Issue
Block a user