From: Vadim Zeitlin Date: Wed, 19 Nov 2008 09:55:27 +0000 (+0000) Subject: minor icc warning fixes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/93a800a95e67a38284a2980543c4b0b1a792573c minor icc warning fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/cppunit.h b/include/wx/cppunit.h index e96196343c..5d5e7406bf 100644 --- a/include/wx/cppunit.h +++ b/include/wx/cppunit.h @@ -123,7 +123,7 @@ assertEquals(const wchar_t *expected, // and another to be able to specify (usually literal) ints as expected values // for functions returning size_t -WX_CPPUNIT_ASSERT_EQUALS(int, size_t); +WX_CPPUNIT_ASSERT_EQUALS(int, size_t) // special section with VC6 workarounds: due to incorrect resolution of // overloaded/template functions in this compiler (it basically doesn't use the @@ -131,8 +131,8 @@ WX_CPPUNIT_ASSERT_EQUALS(int, size_t); // none of them matches fully) we also need #ifdef __VISUALC6__ -WX_CPPUNIT_ASSERT_EQUALS(int, int); -WX_CPPUNIT_ASSERT_EQUALS(size_t, size_t); +WX_CPPUNIT_ASSERT_EQUALS(int, int) +WX_CPPUNIT_ASSERT_EQUALS(size_t, size_t) #endif // VC6 diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index 0885346bfe..1d8853945a 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -1243,11 +1243,10 @@ void CorruptionTestCase::ExtractArchive(wxInputStream& in) { auto_ptr arc(m_factory->NewStream(in)); auto_ptr entry(arc->GetNextEntry()); - + while (entry.get() != NULL) { - wxString name = entry->GetName(); char buf[1024]; - + while (arc->IsOk()) arc->Read(buf, sizeof(buf)); @@ -1329,7 +1328,7 @@ ArchiveTestSuite *ArchiveTestSuite::makeSuite() addTest(test); } - for (int options = 0; options <= PipeIn; options += PipeIn) + for (int options = 0; options <= PipeIn; options += PipeIn) { wxObject *pObj = wxCreateDynamicObject(m_name + _T("ClassFactory")); wxArchiveClassFactory *factory; diff --git a/tests/arrays/arrays.cpp b/tests/arrays/arrays.cpp index 3df8126846..1cd0537457 100644 --- a/tests/arrays/arrays.cpp +++ b/tests/arrays/arrays.cpp @@ -94,7 +94,7 @@ size_t Bar::ms_bars = 0; WX_DECLARE_OBJARRAY(Bar, ArrayBars); #include "wx/arrimpl.cpp" -WX_DEFINE_OBJARRAY(ArrayBars); +WX_DEFINE_OBJARRAY(ArrayBars) // ---------------------------------------------------------------------------- // helpers for sorting arrays and comparing items @@ -125,9 +125,9 @@ int wxCMPFUNC_CONV name ## RevCompare(T* first, T* second) \ typedef unsigned short ushort; -DEFINE_COMPARE(Char, char); -DEFINE_COMPARE(UShort, ushort); -DEFINE_COMPARE(Int, int); +DEFINE_COMPARE(Char, char) +DEFINE_COMPARE(UShort, ushort) +DEFINE_COMPARE(Int, int) WX_DEFINE_ARRAY_CHAR(char, wxArrayChar); WX_DEFINE_SORTED_ARRAY_CHAR(char, wxSortedArrayCharNoCmp); @@ -539,11 +539,11 @@ void ArraysTestCase::wxArray ## name ## Test() \ CPPUNIT_ASSERT( b.Index( 17 ) == 3 ); \ } -TestArrayOf(UShort); +TestArrayOf(UShort) -TestArrayOf(Char); +TestArrayOf(Char) -TestArrayOf(Int); +TestArrayOf(Int) void ArraysTestCase::Alloc() { diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index b9a3b9caf3..f4f87df2f4 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -281,10 +281,10 @@ void DateTimeTestCase::TestTimeJDN() // JDNs must be computed for UTC times double jdn = dt.FromUTC().GetJulianDayNumber(); - CPPUNIT_ASSERT( jdn == d.jdn ); + CPPUNIT_ASSERT_EQUAL( d.jdn, jdn ); dt.Set(jdn); - CPPUNIT_ASSERT( dt.GetJulianDayNumber() == jdn ); + CPPUNIT_ASSERT_EQUAL( jdn, dt.GetJulianDayNumber() ); } } @@ -879,7 +879,6 @@ void DateTimeTestCase::TestDateParse() for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ ) { - wxDateTime dt; if ( dt.ParseDate(parseTestDates[n].str) ) { CPPUNIT_ASSERT( parseTestDates[n].good ); @@ -984,7 +983,6 @@ void DateTimeTestCase::TestDateTimeParse() wxDateTime dt; for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ ) { - wxDateTime dt; if ( dt.ParseDateTime(parseTestDates[n].str) ) { CPPUNIT_ASSERT( parseTestDates[n].good ); diff --git a/tests/longlong/longlongtest.cpp b/tests/longlong/longlongtest.cpp index e59e8bbb48..a9142a6fb5 100644 --- a/tests/longlong/longlongtest.cpp +++ b/tests/longlong/longlongtest.cpp @@ -237,7 +237,7 @@ void LongLongTestCase::Division() void LongLongTestCase::BitOperations() { - for ( size_t n = 0; n < ITEMS; n++ ) + for ( size_t m = 0; m < ITEMS; m++ ) { wxLongLong a = RAND_LL(); diff --git a/tests/mbconv/mbconvtest.cpp b/tests/mbconv/mbconvtest.cpp index be18289a77..5260887d7c 100644 --- a/tests/mbconv/mbconvtest.cpp +++ b/tests/mbconv/mbconvtest.cpp @@ -254,7 +254,7 @@ wxString CByteArrayFormat( const void* data, size_t len, const wxChar* name ) const unsigned char* bytes = (unsigned char*)data; wxString result; - result.Printf( _T("const static unsigned char %s[%i] = \n{"), name, (int)len ); + result.Printf( _T("static const unsigned char %s[%i] = \n{"), name, (int)len ); for ( size_t i = 0; i < len; i++ ) { @@ -277,7 +277,7 @@ wxString CByteArrayFormat( const void* data, size_t len, const wxChar* name ) // characters, encoded in several different formats. // encoded by iconv -const static unsigned char welcome_utf7_iconv[84] = +static const unsigned char welcome_utf7_iconv[84] = { 0x57,0x65,0x6c,0x63,0x6f,0x6d,0x65,0x20,0x74,0x6f,0x20,0x6f,0x75,0x72,0x20,0x63, 0x79,0x62,0x65,0x72,0x20,0x73,0x70,0x61,0x63,0x65,0x20,0x66,0x6f,0x72,0x63,0x65, @@ -287,7 +287,7 @@ const static unsigned char welcome_utf7_iconv[84] = 0x57,0x54,0x41,0x43 }; // encoded by wxWindows (iconv can decode this successfully) -const static unsigned char welcome_utf7_wx[109] = +static const unsigned char welcome_utf7_wx[109] = { 0x57,0x65,0x6c,0x63,0x6f,0x6d,0x65,0x2b,0x41,0x43,0x41,0x2d,0x74,0x6f,0x2b,0x41, 0x43,0x41,0x2d,0x6f,0x75,0x72,0x2b,0x41,0x43,0x41,0x2d,0x63,0x79,0x62,0x65,0x72, @@ -298,7 +298,7 @@ const static unsigned char welcome_utf7_wx[109] = 0x51,0x77,0x52,0x44,0x42,0x6e,0x4d,0x46,0x6b,0x77,0x41,0x67,0x2d }; // encoded by iconv -const static unsigned char welcome_utf8[89] = +static const unsigned char welcome_utf8[89] = { 0x57,0x65,0x6c,0x63,0x6f,0x6d,0x65,0x20,0x74,0x6f,0x20,0x6f,0x75,0x72,0x20,0x63, 0x79,0x62,0x65,0x72,0x20,0x73,0x70,0x61,0x63,0x65,0x20,0x66,0x6f,0x72,0x63,0x65, @@ -308,7 +308,7 @@ const static unsigned char welcome_utf8[89] = 0xe3,0x81,0xa7,0xe3,0x81,0x99,0xe3,0x80,0x82 }; // encoded by iconv -const static unsigned char welcome_utf16le[106] = +static const unsigned char welcome_utf16le[106] = { 0x57,0x00,0x65,0x00,0x6c,0x00,0x63,0x00,0x6f,0x00,0x6d,0x00,0x65,0x00,0x20,0x00, 0x74,0x00,0x6f,0x00,0x20,0x00,0x6f,0x00,0x75,0x00,0x72,0x00,0x20,0x00,0x63,0x00, @@ -319,7 +319,7 @@ const static unsigned char welcome_utf16le[106] = 0x44,0x30,0x44,0x30,0x67,0x30,0x59,0x30,0x02,0x30 }; // encoded by iconv -const static unsigned char welcome_utf16be[106] = +static const unsigned char welcome_utf16be[106] = { 0x00,0x57,0x00,0x65,0x00,0x6c,0x00,0x63,0x00,0x6f,0x00,0x6d,0x00,0x65,0x00,0x20, 0x00,0x74,0x00,0x6f,0x00,0x20,0x00,0x6f,0x00,0x75,0x00,0x72,0x00,0x20,0x00,0x63, @@ -330,7 +330,7 @@ const static unsigned char welcome_utf16be[106] = 0x30,0x44,0x30,0x44,0x30,0x67,0x30,0x59,0x30,0x02 }; // encoded by iconv -const static unsigned char welcome_utf32le[212] = +static const unsigned char welcome_utf32le[212] = { 0x57,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x63,0x00,0x00,0x00, 0x6f,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x20,0x00,0x00,0x00, @@ -348,7 +348,7 @@ const static unsigned char welcome_utf32le[212] = 0x02,0x30,0x00,0x00 }; // encoded by iconv -const static unsigned char welcome_utf32be[212] = +static const unsigned char welcome_utf32be[212] = { 0x00,0x00,0x00,0x57,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x63, 0x00,0x00,0x00,0x6f,0x00,0x00,0x00,0x6d,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x20, @@ -366,7 +366,7 @@ const static unsigned char welcome_utf32be[212] = 0x00,0x00,0x30,0x02 }; // encoded by iconv -const static unsigned char welcome_cp932[71] = +static const unsigned char welcome_cp932[71] = { 0x57,0x65,0x6c,0x63,0x6f,0x6d,0x65,0x20,0x74,0x6f,0x20,0x6f,0x75,0x72,0x20,0x63, 0x79,0x62,0x65,0x72,0x20,0x73,0x70,0x61,0x63,0x65,0x20,0x66,0x6f,0x72,0x63,0x65, @@ -676,6 +676,9 @@ static const unsigned char CP1252_utf8[386] = 0x84,0xa2 }; +// this is unused currently so avoid warnings about this +#if 0 + // a character sequence encoded as iso8859-5 (iconv) static const unsigned char iso8859_5[251] = { @@ -724,6 +727,7 @@ static const unsigned char iso8859_5_utf8[380] = 0x92,0xd1,0x93,0xd1,0x94,0xd1,0x95,0xd1,0x96,0xd1,0x97,0xd1,0x98,0xd1,0x99,0xd1, 0x9a,0xd1,0x9b,0xd1,0x9c,0xd1,0x9e,0xd1,0x9f,0xe2,0x84,0x96 }; +#endif // 0 // DecodeUTF8 // decodes the specified *unterminated* UTF-8 byte array @@ -896,7 +900,7 @@ void MBConvTestCase::Latin1Tests() static const char nulstr[] = "foo\0bar\0"; static const size_t mbLen = WXSIZEOF(nulstr) - 1; size_t wcLen; - wxWCharBuffer wbuf(wxConvISO8859_1.cMB2WC(nulstr, mbLen, &wcLen)); + wxConvISO8859_1.cMB2WC(nulstr, mbLen, &wcLen); CPPUNIT_ASSERT_EQUAL( mbLen, wcLen ); } diff --git a/tests/regex/wxregextest.cpp b/tests/regex/wxregextest.cpp index 1d9c75acc8..38286da82c 100644 --- a/tests/regex/wxregextest.cpp +++ b/tests/regex/wxregextest.cpp @@ -327,7 +327,7 @@ wxString wxRegExTestSuite::FlagStr(int flags) } return _T(" (") + str.Mid(3) + _T(")"); -}; +} // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION(wxRegExTestSuite); diff --git a/tests/streams/textstreamtest.cpp b/tests/streams/textstreamtest.cpp index efc8ee8d33..16cbcdee94 100644 --- a/tests/streams/textstreamtest.cpp +++ b/tests/streams/textstreamtest.cpp @@ -185,7 +185,7 @@ void TextStreamTestCase::TestULongLong() #if wxUSE_UNICODE -const static wchar_t txtWchar[4] = +static const wchar_t txtWchar[4] = { 0x0041, // LATIN CAPITAL LETTER A 0x0100, // A WITH BREVE, LATIN SMALL LETTER @@ -193,28 +193,28 @@ const static wchar_t txtWchar[4] = 0x0100, // A WITH BREVE, LATIN SMALL LETTER }; -const static unsigned char txtUtf8[6] = +static const unsigned char txtUtf8[6] = { 0x41, 0xc4, 0x80, 0x41, 0xc4, 0x80, }; -const static unsigned char txtUtf16le[8] = +static const unsigned char txtUtf16le[8] = { 0x41, 0x00, 0x00, 0x01, 0x41, 0x00, 0x00, 0x01, }; -const static unsigned char txtUtf16be[8] = +static const unsigned char txtUtf16be[8] = { 0x00, 0x41, 0x01, 0x00, 0x00, 0x41, 0x01, 0x00, }; -const static unsigned char txtUtf32le[16] = +static const unsigned char txtUtf32le[16] = { 0x41, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, }; -const static unsigned char txtUtf32be[16] = +static const unsigned char txtUtf32be[16] = { 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x01, 0x00, diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 9fb5c5490b..f937121091 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -531,7 +531,7 @@ enum Number_Unsigned = 2, // if not specified, works for signed conversion Number_Signed = 4, // if not specified, works for unsigned Number_LongLong = 8, // only for long long tests - Number_Long = 16, // only for long tests + Number_Long = 16 // only for long tests }; static const struct ToLongData diff --git a/tests/strings/unicode.cpp b/tests/strings/unicode.cpp index b79c987438..1110b3f29d 100644 --- a/tests/strings/unicode.cpp +++ b/tests/strings/unicode.cpp @@ -243,12 +243,12 @@ void UnicodeTestCase::ConversionEmpty() size_t len; #if wxUSE_UNICODE - wxCharBuffer buf = wxConvLibc.cWC2MB(L"", 0, &len); + wxConvLibc.cWC2MB(L"", 0, &len); #else // !wxUSE_UNICODE - wxWCharBuffer wbuf = wxConvLibc.cMB2WC("", 0, &len); + wxConvLibc.cMB2WC("", 0, &len); #endif // wxUSE_UNICODE/!wxUSE_UNICODE - CPPUNIT_ASSERT(len == 0); + CPPUNIT_ASSERT_EQUAL( 0, len ); } void UnicodeTestCase::ConversionWithNULs() @@ -368,8 +368,8 @@ void UnicodeTestCase::ConversionUTF16() // terminate the string, this exposed a bug in our conversion code which // got confused in this case size_t len; - wxWCharBuffer wbuf(conv.cMB2WC("\x01\0\0B\0C" /* A macron BC */, 6, &len)); - CPPUNIT_ASSERT_EQUAL( (size_t)3, len ); + conv.cMB2WC("\x01\0\0B\0C" /* A macron BC */, 6, &len); + CPPUNIT_ASSERT_EQUAL( 3, len ); } void UnicodeTestCase::ConversionUTF32() @@ -392,9 +392,8 @@ void UnicodeTestCase::ConversionUTF32() } size_t len; - wxWCharBuffer wbuf(conv.cMB2WC("\0\0\x01\0\0\0\0B\0\0\0C" /* A macron BC */, - 12, &len)); - CPPUNIT_ASSERT_EQUAL( (size_t)3, len ); + conv.cMB2WC("\0\0\x01\0\0\0\0B\0\0\0C" /* A macron BC */, 12, &len); + CPPUNIT_ASSERT_EQUAL( 3, len ); } void UnicodeTestCase::IsConvOk() diff --git a/tests/textfile/textfiletest.cpp b/tests/textfile/textfiletest.cpp index aa93472894..b85e9444b5 100644 --- a/tests/textfile/textfiletest.cpp +++ b/tests/textfile/textfiletest.cpp @@ -89,8 +89,8 @@ void TextFileTestCase::CreateTestFile(size_t len, const char *contents) FILE *f = fopen(GetTestFileName(), "wb"); CPPUNIT_ASSERT( f ); - CPPUNIT_ASSERT( fwrite(contents, 1, len, f) >= 0 ); - CPPUNIT_ASSERT( fclose(f) == 0 ); + CPPUNIT_ASSERT_EQUAL( len, fwrite(contents, 1, len, f) ); + CPPUNIT_ASSERT_EQUAL( 0, fclose(f) ); } void TextFileTestCase::ReadEmpty()