From 5b3ae62bfd87c5721285602ec1dc52cd4589b663 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 10 Feb 2009 19:31:24 +0000 Subject: [PATCH] ICU-6727 fix failures in strict mode, add make check X-SVN-Rev: 25393 --- .../test/perf/collationperf/Makefile.in | 3 +- .../test/perf/collationperf/collperf.cpp | 64 ++++++++++--------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/icu4c/source/test/perf/collationperf/Makefile.in b/icu4c/source/test/perf/collationperf/Makefile.in index ba74d5a700..a59327124a 100644 --- a/icu4c/source/test/perf/collationperf/Makefile.in +++ b/icu4c/source/test/perf/collationperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/collationperf -## Copyright (c) 2001-2008, International Business Machines Corporation and +## Copyright (c) 2001-2009, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -55,6 +55,7 @@ distclean-local: clean-local $(RMV) Makefile check-local: all-local + $(INVOKE) ./$(TARGET) -loop 200 -file $(top_srcdir)/extra/uconv/samples/utf8/utf-8-demo.txt -keygen -shifted Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ diff --git a/icu4c/source/test/perf/collationperf/collperf.cpp b/icu4c/source/test/perf/collationperf/collperf.cpp index a518254d6e..10f93435fb 100644 --- a/icu4c/source/test/perf/collationperf/collperf.cpp +++ b/icu4c/source/test/perf/collationperf/collperf.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (C) 2001-2008 IBM, Inc. All Rights Reserved. + * Copyright (C) 2001-2009 IBM, Inc. All Rights Reserved. * ********************************************************************/ /******************************************************************************** @@ -81,7 +81,7 @@ const char gUsageString[] = // Stubs for Windows API functions when building on UNIXes. // typedef int DWORD; -inline int CompareStringW(DWORD, DWORD, UChar *, int, UChar *, int) {return 0;}; +inline int CompareStringW(DWORD, DWORD, UChar *, int, UChar *, int) {return 0;} #include unsigned long timeGetTime() { struct timeval t; @@ -89,8 +89,8 @@ unsigned long timeGetTime() { unsigned long val = t.tv_sec * 1000; // Let it overflow. Who cares. val += t.tv_usec / 1000; return val; -}; -inline int LCMapStringW(DWORD, DWORD, UChar *, int, UChar *, int) {return 0;}; +} +inline int LCMapStringW(DWORD, DWORD, UChar *, int, UChar *, int) {return 0;} const int LCMAP_SORTKEY = 0; #define MAKELCID(a,b) 0 const int SORT_DEFAULT = 0; @@ -103,7 +103,7 @@ const int SORT_DEFAULT = 0; // These global variables are set according to the options specified // on the command line by the user. char * opt_fName = 0; -char * opt_locale = "en_US"; +const char * opt_locale = "en_US"; int opt_langid = 0; // Defaults to value corresponding to opt_locale. char * opt_rules = 0; UBool opt_help = FALSE; @@ -368,7 +368,7 @@ int ICURandomCmp(const void *a, const void *b) { void doKeyGen() { int line; - int loops; + int loops = 0; int iLoop; int t; int len=-1; @@ -465,9 +465,9 @@ void doBinarySearch() gCount = 0; int line; - int loops; - int iLoop; - unsigned long elapsedTime; + int loops = 0; + int iLoop = 0; + unsigned long elapsedTime = 0; // Adjust loop count to compensate for file size. Should be order n (lookups) * log n (compares/lookup) // Accurate timings do not depend on this being perfect. The correction is just to try to @@ -490,7 +490,7 @@ void doBinarySearch() //if (opt_strcmp && opt_win) {pf = (PF)wcscmp;} // Damn the difference between int32_t and int // which forces the use of a cast here. - int r; + int r = 0; for (loops=0; loopsicuSortKey, (gSortedLines[guess])->icuSortKey); @@ -574,7 +574,7 @@ void doBinarySearch() if (opt_win) { unsigned long startTime = timeGetTime(); - int r; + int r = 0; for (loops=0; loops sizeof(buf)) { + if (t > (int32_t)sizeof(buf)) { t = ucol_getSortKey(gCol, gFileLines[line].name, -1, (unsigned char *)gFileLines[line].icuSortKey , t); } else @@ -1620,7 +1624,7 @@ int main(int argc, const char** argv) { for (line=0; line sizeof(buf)) { + if (t > (int32_t)sizeof(buf)) { t = LCMapStringW(gWinLCID, LCMAP_SORTKEY, gFileLines[line].name, -1, (unsigned short *)(gFileLines[line].winSortKey), t); } else @@ -1636,7 +1640,7 @@ int main(int argc, const char** argv) { for (line=0; line sizeof(buf)) { + if (t > (int32_t)sizeof(buf)) { t = strxfrm(gFileLines[line].unixSortKey, gFileLines[line].unixName, sizeof(buf)); } else