mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 23:10:40 +00:00
ICU-4707 Fix some compiler warnings
X-SVN-Rev: 19440
This commit is contained in:
parent
0b0d6328ab
commit
4763cb63a0
2 changed files with 7 additions and 75 deletions
|
@ -3,14 +3,14 @@
|
|||
* Copyright (c) 1997-2006, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/********************************************************************************
|
||||
/*******************************************************************************
|
||||
*
|
||||
* File CLOCTST.C
|
||||
*
|
||||
* Modification History:
|
||||
* Name Description
|
||||
* Madhu Katragadda Ported for C API
|
||||
*********************************************************************************
|
||||
********************************************************************************
|
||||
*/
|
||||
#include "cloctst.h"
|
||||
#include <stdlib.h>
|
||||
|
@ -208,7 +208,6 @@ void addLocaleTest(TestNode** root)
|
|||
TESTCASE(TestUninstalledISO3Names);
|
||||
TESTCASE(TestSimpleDisplayNames);
|
||||
TESTCASE(TestVariantParsing);
|
||||
/*TESTCASE(MoreVariants);*/
|
||||
TESTCASE(TestKeywordVariants);
|
||||
TESTCASE(TestKeywordVariantParsing);
|
||||
TESTCASE(TestCanonicalization);
|
||||
|
@ -1356,35 +1355,6 @@ static void TestObsoleteNames(void)
|
|||
|
||||
}
|
||||
|
||||
static void MoreVariants(void)
|
||||
{
|
||||
struct {
|
||||
const char *localeID;
|
||||
const char *keyword;
|
||||
const char *expectedValue;
|
||||
} testCases[] = {
|
||||
{ "de_DE_EURO@collation=PHONEBOOK", "collation", "PHONEBOOK" },
|
||||
{ "es_ES.utf8@euro", "collation", ""},
|
||||
{ "es_ES.hello.utf8@euro", "", "" },
|
||||
{ " s pa c e d _ more spaces _ spaced variant ", "", ""}
|
||||
};
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
int32_t i = 0;
|
||||
int32_t resultLen = 0;
|
||||
char buffer[256];
|
||||
|
||||
for(i = 0; i < sizeof(testCases)/sizeof(testCases[0]); i++) {
|
||||
*buffer = 0;
|
||||
resultLen = uloc_getName(testCases[i].localeID, buffer, 256, &status);
|
||||
if(uprv_strcmp(testCases[i].expectedValue, buffer) != 0) {
|
||||
log_err("Expected to extract \"%s\" from \"%s\" for keyword \"%s\". Got \"%s\" instead\n",
|
||||
testCases[i].expectedValue, testCases[i].localeID, testCases[i].keyword, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void TestKeywordVariants(void)
|
||||
{
|
||||
struct {
|
||||
|
@ -2485,11 +2455,12 @@ static void TestCollation() {
|
|||
for (i=0; i<LENGTHOF(LOCALE_ALIAS); i++) {
|
||||
const char* oldLoc = LOCALE_ALIAS[i][0];
|
||||
const char* newLoc = LOCALE_ALIAS[i][1];
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UCollator* c1 = NULL;
|
||||
UCollator* c2 = NULL;
|
||||
const char* l1 = NULL;
|
||||
const char* l2 = NULL;
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
if(!isLocaleAvailable(resIndex, newLoc)){
|
||||
continue;
|
||||
}
|
||||
|
@ -2525,10 +2496,11 @@ static void TestULocale() {
|
|||
for (i=0; i<LENGTHOF(LOCALE_ALIAS); i++) {
|
||||
const char* oldLoc = LOCALE_ALIAS[i][0];
|
||||
const char* newLoc = LOCALE_ALIAS[i][1];
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UChar name1[256], name2[256];
|
||||
char names1[256], names2[256];
|
||||
int32_t capacity = 256;
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
if(!isLocaleAvailable(resIndex, newLoc)){
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003, International Business Machines
|
||||
* Copyright (C) 2003-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -132,46 +132,6 @@ CLEANUP:
|
|||
return u_terminateChars(dest, destCapacity, reqLength, status);
|
||||
}
|
||||
|
||||
static void
|
||||
syntaxError( const UChar* rules,
|
||||
int32_t pos,
|
||||
int32_t rulesLen,
|
||||
UParseError* parseError){
|
||||
int32_t start, stop;
|
||||
if(parseError == NULL){
|
||||
return;
|
||||
}
|
||||
if(pos == rulesLen && rulesLen >0){
|
||||
pos--;
|
||||
}
|
||||
parseError->offset = pos;
|
||||
parseError->line = 0 ; /* we are not using line numbers */
|
||||
|
||||
/* for pre-context */
|
||||
start = (pos <=U_PARSE_CONTEXT_LEN)? 0 : (pos - (U_PARSE_CONTEXT_LEN-1));
|
||||
stop = pos;
|
||||
|
||||
u_memcpy(parseError->preContext,rules+start,stop-start);
|
||||
/* null terminate the buffer */
|
||||
parseError->preContext[stop-start] = 0;
|
||||
|
||||
/* for post-context */
|
||||
start = pos;
|
||||
if(start<rulesLen) {
|
||||
U16_FWD_1(rules, start, rulesLen);
|
||||
}
|
||||
|
||||
stop = ((pos+U_PARSE_CONTEXT_LEN)<= rulesLen )? (pos+(U_PARSE_CONTEXT_LEN)) :
|
||||
rulesLen;
|
||||
if(start < stop){
|
||||
u_memcpy(parseError->postContext,rules+start,stop-start);
|
||||
/* null terminate the buffer */
|
||||
parseError->postContext[stop-start]= 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* sorted array for binary search*/
|
||||
static const char* special_prefixes[]={
|
||||
"\x0041\x004e\x004f\x004e\x0059\x004d\x004f\x0055\x0053",
|
||||
|
|
Loading…
Add table
Reference in a new issue