ICU-2699 Fix some compiler warnings.

X-SVN-Rev: 12376
This commit is contained in:
George Rhoten 2003-06-09 04:57:01 +00:00
parent 9c631fd3f2
commit 92842673da
20 changed files with 75 additions and 88 deletions

View File

@ -546,7 +546,6 @@ static void doTestDisplayNames(const char* displayLocale, int32_t compareIndex)
UChar* expectedCtry = 0;
UChar* expectedVar = 0;
UChar* expectedName = 0;
const char* defaultDefaultLocale=" ";
setUpDataTable();

View File

@ -110,6 +110,8 @@ const static char* compatTests[][3] = {
};
void addNormTest(TestNode** root);
void addNormTest(TestNode** root)
{
addTest(root, &TestAPI, "tscoll/cnormtst/TestAPI");

View File

@ -22,6 +22,8 @@ void TestMessageCatalog(void);
/**********************************************************************/
/* Add our tests into the hierarchy */
void addPosixTest(TestNode** root);
void addPosixTest(TestNode** root)
{
addTest(root, &TestMessageCatalog, "tsutil/cposxtst/TestMessageCatalog");

View File

@ -529,6 +529,16 @@ static void TestFileStream(void){
char* buf = (char*) uprv_malloc(bufLen);
int32_t retLen = 0;
if(pStdin==NULL){
log_err("failed to get T_FileStream_stdin()");
}
if(pStdout==NULL){
log_err("failed to get T_FileStream_stdout()");
}
if(pStderr==NULL){
log_err("failed to get T_FileStream_stderr()");
}
uprv_strcpy(fileName,testdatapath);
uprv_strcat(fileName,".dat");
stream = T_FileStream_open(fileName, "r");

View File

@ -279,9 +279,7 @@ void TestUScriptCodeAPI(){
}
}
{
UScriptCode code = USCRIPT_INVALID_CODE;
int32_t i =0;
for(;(UScriptCode)i< USCRIPT_CODE_LIMIT; i++){
for(i=0; (UScriptCode)i< USCRIPT_CODE_LIMIT; i++){
const char* name = uscript_getName((UScriptCode)i);
if(name==NULL || strcmp(name,"")==0){
log_err("uscript_getName failed for code : %i\n",i);

View File

@ -2392,7 +2392,7 @@ TestNumericProperties(void) {
*/
static void
TestPropertyNames(void) {
int32_t p, v, choice, rev;
int32_t p, v, choice=0, rev;
UBool atLeastSomething = FALSE;
for (p=0; ; ++p) {

View File

@ -42,6 +42,8 @@ static void TestCountChar32(void);
static void TestUCharIterator(void);
static void TestUNormIterator(void);
void addUStringTest(TestNode** root);
void addUStringTest(TestNode** root)
{
addTest(root, &TestStringCopy, "tsutil/custrtst/TestStringCopy");

View File

@ -1932,7 +1932,7 @@ TestUnicodeSet() {
name, u_errorName(errorCode));
} else if(
!uset_containsRange(set, nameRanges[i].start, nameRanges[i].end) ||
nameRanges[i].start2>=0 && !uset_containsRange(set, nameRanges[i].start2, nameRanges[i].end2)
(nameRanges[i].start2>=0 && !uset_containsRange(set, nameRanges[i].start2, nameRanges[i].end2))
) {
log_err("error: ucnv_getUnicodeSet(%s) does not contain the expected ranges\n", name);
} else if(nameRanges[i].notStart>=0) {

View File

@ -551,11 +551,11 @@ CollationAPITest::TestCollationKey(/* char* par */)
doAssert(sortkEmpty.compareTo(sortk1) == Collator::LESS, "Result should be (empty key) <<< \"Abcda\"");
doAssert(sortk1.compareTo(sortkEmpty) == Collator::GREATER, "Result should be \"Abcda\" >>> (empty key)");
doAssert(sortkEmpty.compareTo(sortkEmpty) == Collator::EQUAL, "Result should be (empty key) == (empty key)");
doAssert(sortk1.compareTo(sortk3, success) == Collator::GREATER, "Result should be \"Abcda\" >>> \"abcda\"");
doAssert(sortk2.compareTo(sortk3, success) == Collator::EQUAL, "Result should be \"abcda\" == \"abcda\"");
doAssert(sortkEmpty.compareTo(sortk1, success) == Collator::LESS, "Result should be (empty key) <<< \"Abcda\"");
doAssert(sortk1.compareTo(sortkEmpty, success) == Collator::GREATER, "Result should be \"Abcda\" >>> (empty key)");
doAssert(sortkEmpty.compareTo(sortkEmpty, success) == Collator::EQUAL, "Result should be (empty key) == (empty key)");
doAssert(sortk1.compareTo(sortk3, success) == UCOL_GREATER, "Result should be \"Abcda\" >>> \"abcda\"");
doAssert(sortk2.compareTo(sortk3, success) == UCOL_EQUAL, "Result should be \"abcda\" == \"abcda\"");
doAssert(sortkEmpty.compareTo(sortk1, success) == UCOL_LESS, "Result should be (empty key) <<< \"Abcda\"");
doAssert(sortk1.compareTo(sortkEmpty, success) == UCOL_GREATER, "Result should be \"Abcda\" >>> (empty key)");
doAssert(sortkEmpty.compareTo(sortkEmpty, success) == UCOL_EQUAL, "Result should be (empty key) == (empty key)");
int32_t cnt1, cnt2, cnt3, cnt4;

View File

@ -46,7 +46,7 @@ public:
static UClassID getStaticClassID(void){
return (UClassID)(&fgClassID);
}
virtual UBool operator==(const ForwardCharacterIterator& that) const{
virtual UBool operator==(const ForwardCharacterIterator& /*that*/) const{
return TRUE;
}
@ -63,8 +63,8 @@ public:
virtual UChar32 first32(){return DONE;};
virtual UChar last(){return DONE;};
virtual UChar32 last32(){return DONE;};
virtual UChar setIndex(int32_t pos){return DONE;};
virtual UChar32 setIndex32(int32_t pos){return DONE;};
virtual UChar setIndex(int32_t /*pos*/){return DONE;};
virtual UChar32 setIndex32(int32_t /*pos*/){return DONE;};
virtual UChar current() const{return DONE;};
virtual UChar32 current32() const{return DONE;};
virtual UChar next(){return DONE;};
@ -135,7 +135,7 @@ private:
};
const char SCharacterIterator::fgClassID=0;
#define LENGTHOF(array) (sizeof(array)/sizeof((array)[0]))
#define LENGTHOF(array) ((int32_t)(sizeof(array)/sizeof((array)[0])))
CharIterTest::CharIterTest()
{
@ -1092,11 +1092,11 @@ public:
return 0;
}
virtual int32_t move(int32_t delta, EOrigin origin) {
virtual int32_t move(int32_t /*delta*/, EOrigin /*origin*/) {
return 0;
}
virtual int32_t move32(int32_t delta, EOrigin origin) {
virtual int32_t move32(int32_t /*delta*/, EOrigin /*origin*/) {
return 0;
}

View File

@ -69,13 +69,13 @@ class TestHexFilter : public UnicodeFilter {
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
};
void HexToUniTransliteratorTest::TestConstruction(){
UErrorCode status=U_ZERO_ERROR;

View File

@ -136,7 +136,7 @@ NamePrepTransform::~NamePrepTransform(){
int32_t NamePrepTransform::map(const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
UBool allowUnassigned,
UParseError* parseError,
UParseError* /*parseError*/,
UErrorCode& status ){
if(U_FAILURE(status)){
@ -160,7 +160,7 @@ int32_t NamePrepTransform::map(const UChar* src, int32_t srcLength,
int32_t bufIndex=0;
UChar32 ch =0 ;
for(;bufIndex<bufLen;){
U16_NEXT(buffer, bufIndex, bufLen, ch);
U16_NEXT(buffer, bufIndex, bufLen, ch);
if(unassigned.contains(ch)){
status = U_IDNA_UNASSIGNED_CODEPOINT_FOUND_ERROR;
rsource.releaseBuffer();

View File

@ -197,7 +197,7 @@ public:
/* do nothing */
}
virtual void copy(int32_t start, int32_t limit, int32_t dest) {
virtual void copy(int32_t /*start*/, int32_t /*limit*/, int32_t /*dest*/) {
/* do nothing */
}

View File

@ -68,11 +68,11 @@ fCases(NULL)
fSettingsSize = ures_getSize(fSettings);
UResourceBundle *info = ures_getByKey(data, "Info", NULL, &intStatus);
if(U_SUCCESS(intStatus)) {
fInfo = new RBDataMap(info, intStatus);
fInfo = new RBDataMap(info, status);
} else {
intStatus = U_ZERO_ERROR;
}
fCases = ures_getByKey(data, "Cases", NULL, &intStatus);
fCases = ures_getByKey(data, "Cases", NULL, &status);
fCasesSize = ures_getSize(fCases);
ures_close(info);
@ -87,7 +87,7 @@ RBTestData::~RBTestData()
ures_close(fCases);
}
UBool RBTestData::getInfo(const DataMap *& info, UErrorCode &status) const
UBool RBTestData::getInfo(const DataMap *& info, UErrorCode &/*status*/) const
{
if(fInfo) {
info = fInfo;

View File

@ -38,10 +38,6 @@
#include "sprpimpl.h"
#include "testidna.h"
#ifdef WIN32
# pragma warning(disable: 4100)
#endif
UBool beVerbose=FALSE, haveCopyright=TRUE;
/* prototypes --------------------------------------------------------------- */
@ -69,11 +65,11 @@ static UBool cleanup();
static void
compareMapping(uint32_t codepoint, uint32_t* mapping, int32_t mapLength,
UBool withNorm, UErrorCode *status);
UBool withNorm);
static void
compareFlagsForRange(uint32_t start, uint32_t end,
UBool isUnassigned, UErrorCode *status);
UBool isUnassigned);
static void
testAllCodepoints(TestIDNA& test);
@ -89,16 +85,6 @@ static const char* fileNames[] = {
};
/* -------------------------------------------------------------------------- */
static UOption options[]={
UOPTION_HELP_H,
UOPTION_HELP_QUESTION_MARK,
UOPTION_VERBOSE,
UOPTION_COPYRIGHT,
UOPTION_DESTDIR,
UOPTION_SOURCEDIR,
{ "unicode", NULL, NULL, NULL, 'u', UOPT_REQUIRES_ARG, 0 }
};
/* file definitions */
#define DATA_NAME "uidna"
#define DATA_TYPE "icu"
@ -109,7 +95,7 @@ extern int
testData(TestIDNA& test) {
char* filename = (char*) malloc(strlen(IntlTest::pathToDataDirectory())*3);
//TODO get the srcDir dynamically
const char *srcDir=IntlTest::pathToDataDirectory(), *destDir=NULL, *suffix=NULL;
const char *srcDir=IntlTest::pathToDataDirectory();
char *basename=NULL;
UErrorCode errorCode=U_ZERO_ERROR;
char *saveBasename =NULL;
@ -187,7 +173,7 @@ testData(TestIDNA& test) {
U_CDECL_BEGIN
static void U_CALLCONV
caseMapLineFn(void *context,
char *fields[][2], int32_t fieldCount,
char *fields[][2], int32_t /*fieldCount*/,
UErrorCode *pErrorCode) {
uint32_t mapping[40];
char *end, *s;
@ -208,7 +194,7 @@ caseMapLineFn(void *context,
/* store the mapping */
compareMapping(code,mapping, length, *mapWithNorm, pErrorCode);
compareMapping(code,mapping, length, *mapWithNorm);
}
U_CDECL_END
@ -234,7 +220,7 @@ U_CDECL_BEGIN
static void U_CALLCONV
unicodeDataLineFn(void *context,
char *fields[][2], int32_t fieldCount,
char *fields[][2], int32_t /*fieldCount*/,
UErrorCode *pErrorCode) {
uint32_t rangeStart=0,rangeEnd =0;
UBool* isUnassigned = (UBool*) context;
@ -247,7 +233,7 @@ unicodeDataLineFn(void *context,
}
compareFlagsForRange(rangeStart,rangeEnd,*isUnassigned, pErrorCode);
compareFlagsForRange(rangeStart,rangeEnd,*isUnassigned);
}
@ -256,7 +242,6 @@ U_CDECL_END
static void
parseTable(const char *filename,UBool isUnassigned,TestIDNA& test, UErrorCode *pErrorCode) {
char *fields[2][2];
int32_t len=0;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return;
}
@ -326,7 +311,7 @@ static inline void getValues(uint32_t result, int8_t& flag,
static void
compareMapping(uint32_t codepoint, uint32_t* mapping,int32_t mapLength,
UBool withNorm, UErrorCode *status){
UBool withNorm){
if(isDataLoaded){
uint32_t result = 0;
UTRIE_GET16(&idnTrie,codepoint, result);
@ -387,7 +372,7 @@ compareMapping(uint32_t codepoint, uint32_t* mapping,int32_t mapLength,
static void
compareFlagsForRange(uint32_t start, uint32_t end,
UBool isUnassigned, UErrorCode *status){
UBool isUnassigned){
if(isDataLoaded){
uint32_t result =0 ;
while(start < end+1){

View File

@ -533,7 +533,8 @@ static struct ConformanceTestCases
{
"Bidi: RandALCat character U+FB38 and LCat characters",
"\x66\x6F\x6F\xEF\xB9\xB6\x62\x61\x72", "\x66\x6F\x6F \xd9\x8e\x62\x61\x72",
UIDNA_DEFAULT, U_ZERO_ERROR
"Nameprep", UIDNA_DEFAULT,
U_ZERO_ERROR
},
{ "Bidi: RandALCat without trailing RandALCat U+0627 U+0031",
"\xD8\xA7\x31", NULL,
@ -543,7 +544,8 @@ static struct ConformanceTestCases
{
"Bidi: RandALCat character U+0627 U+0031 U+0628",
"\xD8\xA7\x31\xD8\xA8", "\xD8\xA7\x31\xD8\xA8",
UIDNA_DEFAULT, U_ZERO_ERROR
"Nameprep", UIDNA_DEFAULT,
U_ZERO_ERROR
},
{
"Unassigned code point U+E0002",
@ -585,7 +587,7 @@ void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* test
UErrorCode status = U_ZERO_ERROR;
UChar destStack[MAX_DEST_SIZE];
int32_t destLen = 0, destCapacity = MAX_DEST_SIZE;
int32_t destLen = 0;
UChar* dest = NULL;
int32_t expectedLen = u_strlen(expected);
int32_t options = (useSTD3ASCIIRules == TRUE) ? UIDNA_USE_STD3_RULES : UIDNA_DEFAULT;

View File

@ -705,13 +705,13 @@ class TestFilter1 : public UnicodeFilter {
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
};
class TestFilter2 : public UnicodeFilter {
UClassID getDynamicClassID()const { return &gTestFilter2ClassID; }
@ -726,13 +726,13 @@ class TestFilter2 : public UnicodeFilter {
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
};
class TestFilter3 : public UnicodeFilter {
UClassID getDynamicClassID()const { return &gTestFilter3ClassID; }
@ -747,13 +747,13 @@ class TestFilter3 : public UnicodeFilter {
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
};

View File

@ -613,13 +613,13 @@ class TestFilter : public UnicodeFilter {
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
public:
UClassID getDynamicClassID() const { return (UClassID)&gTestFilterClassID; }
};
@ -3598,7 +3598,7 @@ void TransliteratorTest::TestMulticharStringSet() {
Transliterator* _TUFF[4];
UnicodeString* _TUFID[4];
static Transliterator* _TUFFactory(const UnicodeString& ID,
static Transliterator* _TUFFactory(const UnicodeString& /*ID*/,
Transliterator::Token context) {
return _TUFF[context.integer]->clone();
}
@ -3866,19 +3866,6 @@ void TransliteratorTest::TestAllCodepoints(){
}
//#define TESTCLASSID_DEFAULT(cls) { \
// if (cls().getDynamicClassID() != cls::getStaticClassID()) { \
// errln("FAIL: " ## cls ## " dynamic and static class ID mismatch from default constructor"); \
// } \
//}
//#define TESTCLASSID_FACTORY(cls, fact) { \
// cls* x = fact; \
// if (x->getDynamicClassID() != cls::getStaticClassID()) { \
// errln("FAIL: " ## cls ## " dynamic and static class ID mismatch from " ## fact); \
// } \
// delete x; \
//}
#define TEST_TRANSLIT_ID(id, cls) { \
UErrorCode ec = U_ZERO_ERROR; \
Transliterator* t = Transliterator::createInstance(id, UTRANS_FORWARD, ec); \

View File

@ -47,13 +47,13 @@ class Filter1: public UnicodeFilter{
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
};
uint32_t gFilter2ClassID = 0;
class Filter2: public UnicodeFilter{
@ -69,13 +69,13 @@ class Filter2: public UnicodeFilter{
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
};

View File

@ -85,13 +85,13 @@ class TestUniFilter : public UnicodeFilter {
}
// Stubs
virtual UnicodeString& toPattern(UnicodeString& result,
UBool escapeUnprintable) const {
UBool /*escapeUnprintable*/) const {
return result;
}
virtual UBool matchesIndexValue(uint8_t v) const {
virtual UBool matchesIndexValue(uint8_t /*v*/) const {
return FALSE;
}
virtual void addMatchSetTo(UnicodeSet& toUnionTo) const {}
virtual void addMatchSetTo(UnicodeSet& /*toUnionTo*/) const {}
};
void UniToHexTransliteratorTest::TestConstruction(){
UErrorCode status=U_ZERO_ERROR;