From 77aa0e2a5ef8e6d00570dbeb7a12aeb23e9e5cf0 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 11 Jun 2014 11:43:12 +0200 Subject: [PATCH] Fix build of unit-tests with gcc4. --- .../stxttranslator/STXTTranslatorTest.cpp | 23 +++++++------ .../kits/app/broster/LaunchTesterHelper.cpp | 2 +- src/tests/kits/interface/balert/AlertTest.cpp | 4 ++- .../interface/bdeskbar/DeskbarAddItemTest.cpp | 2 ++ .../interface/bdeskbar/DeskbarGetItemTest.cpp | 2 ++ .../bdeskbar/DeskbarLocationTest.cpp | 2 ++ .../interface/bpolygon/CreatePolygonTest.cpp | 2 ++ .../interface/bpolygon/MapPolygonTest.cpp | 2 ++ .../interface/bregion/RegionConstruction.cpp | 2 ++ .../kits/interface/bregion/RegionExclude.cpp | 2 ++ .../kits/interface/bregion/RegionInclude.cpp | 2 ++ .../interface/bregion/RegionIntersect.cpp | 2 ++ .../kits/interface/bregion/RegionOffsetBy.cpp | 2 ++ .../kits/interface/bregion/RegionTestcase.cpp | 2 ++ src/tests/kits/storage/BasicTest.cpp | 6 ++-- src/tests/kits/storage/BasicTest.h | 7 +++- src/tests/kits/storage/DirectoryTest.cpp | 5 ++- src/tests/kits/storage/EntryTest.cpp | 11 +++++-- src/tests/kits/storage/FindDirectoryTest.cpp | 5 ++- src/tests/kits/storage/MimeSnifferTest.cpp | 13 +++++--- src/tests/kits/storage/NodeInfoTest.cpp | 5 ++- src/tests/kits/storage/PathTest.cpp | 6 +++- src/tests/kits/storage/QueryTest.cpp | 2 ++ src/tests/kits/storage/ResourcesTest.cpp | 6 +++- src/tests/kits/storage/StatableTest.h | 12 +++---- src/tests/kits/storage/SymLinkTest.cpp | 3 ++ src/tests/kits/storage/TestApp.cpp | 1 + .../kits/translation/BitmapStreamTest.cpp | 5 ++- .../kits/translation/TranslationUtilsTest.cpp | 4 ++- .../kits/translation/TranslatorRosterTest.cpp | 1 + .../kernel/util/DoublyLinkedListTest.cpp | 3 +- src/tests/system/kernel/util/OrderedMapTest.h | 32 ++----------------- .../system/kernel/util/VectorMapTest.cpp | 2 +- .../system/kernel/util/VectorSetTest.cpp | 5 +-- src/tests/system/kernel/util/VectorTest.cpp | 23 ++++++------- 35 files changed, 126 insertions(+), 82 deletions(-) diff --git a/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.cpp b/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.cpp index c9c452a8f0..62cc598685 100644 --- a/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.cpp +++ b/src/tests/add-ons/translators/stxttranslator/STXTTranslatorTest.cpp @@ -212,18 +212,21 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster, styled_path = new char[nlongest + 6]; plain_path = new char[nlongest + 6]; + BFile styled_file, plain_file; + // Perform translations on every file in the array for (int32 i = 0; i < len; i++) { strcpy(styled_path, paths[i]); strcat(styled_path, ".stxt"); strcpy(plain_path, paths[i]); strcat(plain_path, ".txt"); - - // Setup input files + + // Setup input files ptest->NextSubTest(); - BFile styled_file, plain_file, *pinput_file; CPPUNIT_ASSERT(styled_file.SetTo(styled_path, B_READ_ONLY) == B_OK); CPPUNIT_ASSERT(plain_file.SetTo(plain_path, B_READ_ONLY) == B_OK); + + BFile *pinput_file; if (bplain) { printf(" [%s] ", plain_path); pinput_file = &plain_file; @@ -231,9 +234,9 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster, printf(" [%s] ", styled_path); pinput_file = &styled_file; } - + BMallocIO mallio, dmallio; - + // Convert to B_TRANSLATOR_ANY_TYPE (should be B_TRANSLATOR_TEXT) ptest->NextSubTest(); CPPUNIT_ASSERT(mallio.Seek(0, SEEK_SET) == 0); @@ -241,7 +244,7 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster, CPPUNIT_ASSERT(proster->Translate(pinput_file, NULL, NULL, &mallio, B_TRANSLATOR_ANY_TYPE) == B_OK); CPPUNIT_ASSERT(CompareStreams(mallio, plain_file) == true); - + // Convert to B_TRANSLATOR_TEXT ptest->NextSubTest(); CPPUNIT_ASSERT(mallio.Seek(0, SEEK_SET) == 0); @@ -249,7 +252,7 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster, CPPUNIT_ASSERT(proster->Translate(pinput_file, NULL, NULL, &mallio, B_TRANSLATOR_TEXT) == B_OK); CPPUNIT_ASSERT(CompareStreams(mallio, plain_file) == true); - + // Convert plain mallio to B_TRANSLATOR_TEXT dmallio ptest->NextSubTest(); CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0); @@ -257,7 +260,7 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster, CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio, B_TRANSLATOR_TEXT) == B_OK); CPPUNIT_ASSERT(CompareStreams(dmallio, plain_file) == true); - + // Convert to B_STYLED_TEXT_FORMAT ptest->NextSubTest(); CPPUNIT_ASSERT(mallio.Seek(0, SEEK_SET) == 0); @@ -265,7 +268,7 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster, CPPUNIT_ASSERT(proster->Translate(pinput_file, NULL, NULL, &mallio, B_STYLED_TEXT_FORMAT) == B_OK); CPPUNIT_ASSERT(CompareStreams(mallio, styled_file) == true); - + // Convert styled mallio to B_TRANSLATOR_TEXT dmallio ptest->NextSubTest(); CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0); @@ -273,7 +276,7 @@ TranslateTests(STXTTranslatorTest *ptest, BTranslatorRoster *proster, CPPUNIT_ASSERT(proster->Translate(&mallio, NULL, NULL, &dmallio, B_TRANSLATOR_TEXT) == B_OK); CPPUNIT_ASSERT(CompareStreams(dmallio, plain_file) == true); - + // Convert styled mallio to B_STYLED_TEXT_FORMAT dmallio ptest->NextSubTest(); CPPUNIT_ASSERT(dmallio.Seek(0, SEEK_SET) == 0); diff --git a/src/tests/kits/app/broster/LaunchTesterHelper.cpp b/src/tests/kits/app/broster/LaunchTesterHelper.cpp index c72771cb7c..d75707dbcb 100644 --- a/src/tests/kits/app/broster/LaunchTesterHelper.cpp +++ b/src/tests/kits/app/broster/LaunchTesterHelper.cpp @@ -341,7 +341,7 @@ LaunchContext::AppMessengerFor(team_id team) const { BAutolock _lock(fLock); BMessenger result; - if (AppInfo *info = AppInfoFor(team)) { + if (AppInfoFor(team)) { // We need to do some hacking. BMessenger messenger; struct fake_messenger { diff --git a/src/tests/kits/interface/balert/AlertTest.cpp b/src/tests/kits/interface/balert/AlertTest.cpp index d4bd6bf93e..07b27fceb2 100644 --- a/src/tests/kits/interface/balert/AlertTest.cpp +++ b/src/tests/kits/interface/balert/AlertTest.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -13,6 +12,9 @@ #include #include +#include +using std::ostream; + #define ASSERT_DEQUAL(x,y) CPPUNIT_ASSERT_DOUBLES_EQUAL((x),(y),0.01) const char *k20X = "XXXXXXXXXXXXXXXXXXXX"; diff --git a/src/tests/kits/interface/bdeskbar/DeskbarAddItemTest.cpp b/src/tests/kits/interface/bdeskbar/DeskbarAddItemTest.cpp index 50208133b7..9f74871b03 100644 --- a/src/tests/kits/interface/bdeskbar/DeskbarAddItemTest.cpp +++ b/src/tests/kits/interface/bdeskbar/DeskbarAddItemTest.cpp @@ -17,6 +17,8 @@ #include #include +#include + const char *appName = "application/x-vnd.jsr-additemtest"; const char *pulsePath = "/boot/system/apps/Pulse"; diff --git a/src/tests/kits/interface/bdeskbar/DeskbarGetItemTest.cpp b/src/tests/kits/interface/bdeskbar/DeskbarGetItemTest.cpp index 2c27f96751..23161acbbb 100644 --- a/src/tests/kits/interface/bdeskbar/DeskbarGetItemTest.cpp +++ b/src/tests/kits/interface/bdeskbar/DeskbarGetItemTest.cpp @@ -14,6 +14,8 @@ #include "DeskbarGetItemTest.h" #include +#include + /* * Method: DeskbarGetItemTest::DeskbarGetItemTest() diff --git a/src/tests/kits/interface/bdeskbar/DeskbarLocationTest.cpp b/src/tests/kits/interface/bdeskbar/DeskbarLocationTest.cpp index f0b74ebaf7..47718a4e84 100644 --- a/src/tests/kits/interface/bdeskbar/DeskbarLocationTest.cpp +++ b/src/tests/kits/interface/bdeskbar/DeskbarLocationTest.cpp @@ -15,6 +15,8 @@ #include #include +#include + /* * Method: DeskbarLocationTest::DeskbarLocationTest() diff --git a/src/tests/kits/interface/bpolygon/CreatePolygonTest.cpp b/src/tests/kits/interface/bpolygon/CreatePolygonTest.cpp index 874f62543f..6cc13edc17 100644 --- a/src/tests/kits/interface/bpolygon/CreatePolygonTest.cpp +++ b/src/tests/kits/interface/bpolygon/CreatePolygonTest.cpp @@ -22,6 +22,8 @@ #include #include +#include + /* * Method: CreatePolygonTest::CreatePolygonTest() diff --git a/src/tests/kits/interface/bpolygon/MapPolygonTest.cpp b/src/tests/kits/interface/bpolygon/MapPolygonTest.cpp index 67db3550e8..282483b03c 100644 --- a/src/tests/kits/interface/bpolygon/MapPolygonTest.cpp +++ b/src/tests/kits/interface/bpolygon/MapPolygonTest.cpp @@ -15,6 +15,8 @@ #include #include +#include + /* * Method: MapPolygonTest::MapPolygonTest() diff --git a/src/tests/kits/interface/bregion/RegionConstruction.cpp b/src/tests/kits/interface/bregion/RegionConstruction.cpp index 3f742da5b4..ab0fb94820 100644 --- a/src/tests/kits/interface/bregion/RegionConstruction.cpp +++ b/src/tests/kits/interface/bregion/RegionConstruction.cpp @@ -11,6 +11,8 @@ #include #include +#include + /* * Method: RegionConstruction::RegionConstruction() diff --git a/src/tests/kits/interface/bregion/RegionExclude.cpp b/src/tests/kits/interface/bregion/RegionExclude.cpp index 22075616ef..d14e79b799 100644 --- a/src/tests/kits/interface/bregion/RegionExclude.cpp +++ b/src/tests/kits/interface/bregion/RegionExclude.cpp @@ -11,6 +11,8 @@ #include #include +#include + /* * Method: RegionExclude::RegionExclude() diff --git a/src/tests/kits/interface/bregion/RegionInclude.cpp b/src/tests/kits/interface/bregion/RegionInclude.cpp index e82eeb00c4..2bf3eff246 100644 --- a/src/tests/kits/interface/bregion/RegionInclude.cpp +++ b/src/tests/kits/interface/bregion/RegionInclude.cpp @@ -11,6 +11,8 @@ #include #include +#include + /* * Method: RegionInclude::RegionInclude() diff --git a/src/tests/kits/interface/bregion/RegionIntersect.cpp b/src/tests/kits/interface/bregion/RegionIntersect.cpp index a820111b43..f4c662352b 100644 --- a/src/tests/kits/interface/bregion/RegionIntersect.cpp +++ b/src/tests/kits/interface/bregion/RegionIntersect.cpp @@ -11,6 +11,8 @@ #include #include +#include + /* * Method: RegionIntersect::RegionIntersect() diff --git a/src/tests/kits/interface/bregion/RegionOffsetBy.cpp b/src/tests/kits/interface/bregion/RegionOffsetBy.cpp index 2c06792df5..66910a19a0 100644 --- a/src/tests/kits/interface/bregion/RegionOffsetBy.cpp +++ b/src/tests/kits/interface/bregion/RegionOffsetBy.cpp @@ -11,6 +11,8 @@ #include #include +#include + /* * Method: RegionOffsetBy::RegionOffsetBy() diff --git a/src/tests/kits/interface/bregion/RegionTestcase.cpp b/src/tests/kits/interface/bregion/RegionTestcase.cpp index fe869244f6..10ad624c4c 100644 --- a/src/tests/kits/interface/bregion/RegionTestcase.cpp +++ b/src/tests/kits/interface/bregion/RegionTestcase.cpp @@ -10,6 +10,8 @@ #include "RegionTestcase.h" #include #include + +#include #include diff --git a/src/tests/kits/storage/BasicTest.cpp b/src/tests/kits/storage/BasicTest.cpp index 95adf562b9..d52d4bd009 100644 --- a/src/tests/kits/storage/BasicTest.cpp +++ b/src/tests/kits/storage/BasicTest.cpp @@ -1,13 +1,15 @@ // BasicTest.cpp #include +#include #include -#include + +#include +using std::set; #include "BasicTest.h" // count_available_fds -#include static int32 count_available_fds() diff --git a/src/tests/kits/storage/BasicTest.h b/src/tests/kits/storage/BasicTest.h index 36758c05bd..01fb3c0343 100644 --- a/src/tests/kits/storage/BasicTest.h +++ b/src/tests/kits/storage/BasicTest.h @@ -6,9 +6,14 @@ #include #include #include -#include #include +#include +using std::set; +#include +using std::string; + + class BasicTest : public BTestCase { public: diff --git a/src/tests/kits/storage/DirectoryTest.cpp b/src/tests/kits/storage/DirectoryTest.cpp index 19fe6bcdca..3ba05922e5 100644 --- a/src/tests/kits/storage/DirectoryTest.cpp +++ b/src/tests/kits/storage/DirectoryTest.cpp @@ -1,10 +1,13 @@ // DirectoryTest.cpp #include -#include +#include #include #include +#include +using std::string; + #include #include #include diff --git a/src/tests/kits/storage/EntryTest.cpp b/src/tests/kits/storage/EntryTest.cpp index d4f2e53f17..0e0220f243 100644 --- a/src/tests/kits/storage/EntryTest.cpp +++ b/src/tests/kits/storage/EntryTest.cpp @@ -1,12 +1,17 @@ // EntryTest.cpp #include -#include -#include -#include #include +#include #include +#include +using std::list; +#include +using std::map; +#include +using std::set; + #include #include diff --git a/src/tests/kits/storage/FindDirectoryTest.cpp b/src/tests/kits/storage/FindDirectoryTest.cpp index 7952c94b3f..63c75794e1 100644 --- a/src/tests/kits/storage/FindDirectoryTest.cpp +++ b/src/tests/kits/storage/FindDirectoryTest.cpp @@ -2,9 +2,12 @@ #include #include -#include +#include #include +#include +using std::string; + #include "FindDirectoryTest.h" #include diff --git a/src/tests/kits/storage/MimeSnifferTest.cpp b/src/tests/kits/storage/MimeSnifferTest.cpp index e00157953e..68ee26f1b0 100644 --- a/src/tests/kits/storage/MimeSnifferTest.cpp +++ b/src/tests/kits/storage/MimeSnifferTest.cpp @@ -13,7 +13,10 @@ #include #include -#include + +#include +using std::cout; +using std::endl; using namespace BPrivate::Storage::Sniffer; @@ -736,10 +739,10 @@ MimeSnifferTest::ScannerTest() { }; // Undefine our nasty macros -#undef T(type) -#undef S(str) -#undef I(val) -#undef F(val) +#undef T +#undef S +#undef I +#undef F const int testCaseCount = sizeof(testCases) / sizeof(test_case); for (int i = 0; i < testCaseCount; i++) { diff --git a/src/tests/kits/storage/NodeInfoTest.cpp b/src/tests/kits/storage/NodeInfoTest.cpp index 1aab249012..de118b51e4 100644 --- a/src/tests/kits/storage/NodeInfoTest.cpp +++ b/src/tests/kits/storage/NodeInfoTest.cpp @@ -1,9 +1,12 @@ // NodeInfoTest.cpp #include -#include +#include #include +#include +using std::string; + #include #include #include diff --git a/src/tests/kits/storage/PathTest.cpp b/src/tests/kits/storage/PathTest.cpp index f51572a27d..d3952cb276 100644 --- a/src/tests/kits/storage/PathTest.cpp +++ b/src/tests/kits/storage/PathTest.cpp @@ -9,9 +9,13 @@ #include #include #include -#include +#include #include +#include +using std::string; + + // Suite CppUnit::Test* PathTest::Suite() { diff --git a/src/tests/kits/storage/QueryTest.cpp b/src/tests/kits/storage/QueryTest.cpp index 896149e045..b645b0921b 100644 --- a/src/tests/kits/storage/QueryTest.cpp +++ b/src/tests/kits/storage/QueryTest.cpp @@ -95,6 +95,7 @@ public: }; // float specialization +template<> BString ValueNode::toString() const { @@ -104,6 +105,7 @@ ValueNode::toString() const } // double specialization +template<> BString ValueNode::toString() const { diff --git a/src/tests/kits/storage/ResourcesTest.cpp b/src/tests/kits/storage/ResourcesTest.cpp index 17ef3a343f..f7e33c7ddb 100644 --- a/src/tests/kits/storage/ResourcesTest.cpp +++ b/src/tests/kits/storage/ResourcesTest.cpp @@ -1,9 +1,13 @@ // ResourcesTest.cpp #include -#include +#include #include + +#include +using std::string; #include +using std::vector; #include #include diff --git a/src/tests/kits/storage/StatableTest.h b/src/tests/kits/storage/StatableTest.h index faa02a9ac3..0eaca735cb 100644 --- a/src/tests/kits/storage/StatableTest.h +++ b/src/tests/kits/storage/StatableTest.h @@ -7,7 +7,7 @@ #include #include -#include +using std::list; #include "BasicTest.h" @@ -27,7 +27,7 @@ struct TestEntries void delete_all() { - for (list::iterator it = entries.begin(); + for (typename list::iterator it = entries.begin(); it != entries.end(); it++) { // Arghh, BStatable has no virtual destructor! @@ -74,10 +74,10 @@ struct TestEntries entryNameIt = entryNames.begin(); } - list entries; - list entryNames; - list::iterator entryIt; - list::iterator entryNameIt; + list entries; + list entryNames; + typename list::iterator entryIt; + typename list::iterator entryNameIt; }; typedef TestEntries TestStatables; diff --git a/src/tests/kits/storage/SymLinkTest.cpp b/src/tests/kits/storage/SymLinkTest.cpp index 8b1db5f67b..782944c70a 100644 --- a/src/tests/kits/storage/SymLinkTest.cpp +++ b/src/tests/kits/storage/SymLinkTest.cpp @@ -1,7 +1,10 @@ // SymLinkTest.cpp #include +#include + #include +using std::string; #include #include diff --git a/src/tests/kits/storage/TestApp.cpp b/src/tests/kits/storage/TestApp.cpp index 90d2ba6bc3..9909bf35dc 100644 --- a/src/tests/kits/storage/TestApp.cpp +++ b/src/tests/kits/storage/TestApp.cpp @@ -1,6 +1,7 @@ // TestApp.cpp #include +#include #include #include diff --git a/src/tests/kits/translation/BitmapStreamTest.cpp b/src/tests/kits/translation/BitmapStreamTest.cpp index 9a00ce4796..a72eb8a4af 100644 --- a/src/tests/kits/translation/BitmapStreamTest.cpp +++ b/src/tests/kits/translation/BitmapStreamTest.cpp @@ -31,11 +31,14 @@ // DEALINGS IN THE SOFTWARE. /*****************************************************************************/ #include "BitmapStreamTest.h" -#include + #include #include #include +#include +#include + /* cppunit framework */ #include #include diff --git a/src/tests/kits/translation/TranslationUtilsTest.cpp b/src/tests/kits/translation/TranslationUtilsTest.cpp index 4eff435c40..80c7c405a1 100644 --- a/src/tests/kits/translation/TranslationUtilsTest.cpp +++ b/src/tests/kits/translation/TranslationUtilsTest.cpp @@ -31,7 +31,6 @@ // DEALINGS IN THE SOFTWARE. /*****************************************************************************/ #include "TranslationUtilsTest.h" -#include #include // for B_TRANSLATOR_EXT_* #include @@ -44,6 +43,9 @@ #include #include +#include +#include + /* cppunit framework */ #include #include diff --git a/src/tests/kits/translation/TranslatorRosterTest.cpp b/src/tests/kits/translation/TranslatorRosterTest.cpp index adf57c650d..6b61db5fdf 100644 --- a/src/tests/kits/translation/TranslatorRosterTest.cpp +++ b/src/tests/kits/translation/TranslatorRosterTest.cpp @@ -33,6 +33,7 @@ #include "TranslatorRosterTest.h" #include +#include #include #include diff --git a/src/tests/system/kernel/util/DoublyLinkedListTest.cpp b/src/tests/system/kernel/util/DoublyLinkedListTest.cpp index 5d6489fc50..90e93bfcc0 100644 --- a/src/tests/system/kernel/util/DoublyLinkedListTest.cpp +++ b/src/tests/system/kernel/util/DoublyLinkedListTest.cpp @@ -106,7 +106,8 @@ DoublyLinkedListTest::TestList() // count items in list int count = 0; - DoublyLinkedList >::Iterator + typename DoublyLinkedList >::Iterator iterator = list.GetIterator(); while (iterator.Next() != NULL) count++; diff --git a/src/tests/system/kernel/util/OrderedMapTest.h b/src/tests/system/kernel/util/OrderedMapTest.h index dbdbba631f..4eb49c9eb4 100644 --- a/src/tests/system/kernel/util/OrderedMapTest.h +++ b/src/tests/system/kernel/util/OrderedMapTest.h @@ -6,6 +6,8 @@ #include #include +using std::map; + #include #include #include @@ -601,7 +603,7 @@ public: typedef typename KeyStrategy::Value Key; typedef typename ValueStrategy::Value Value; // typedef _CompareStrategy Compare; - typedef typename CompareStrategyWrapper::Strategy Compare; + typedef typename CompareStrategyWrapper::template Strategy Compare; typedef CompareWrapper BoolCompare; typedef _MyMap MyMap; typedef map ReferenceMap; @@ -664,8 +666,6 @@ void GenericInsertTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; typedef typename _TestStrategy::Key Key; typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; @@ -707,8 +707,6 @@ void GenericPutTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; typedef typename _TestStrategy::Key Key; typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; @@ -750,13 +748,10 @@ void GenericGetTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; typedef typename _TestStrategy::Key Key; typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; typedef typename TestClass::Iterator Iterator; - typedef typename TestClass::ConstIterator ConstIterator; EntryStrategy entryStrategy; TestClass v; GenericFill(v, entryStrategy, maxNumber); @@ -818,10 +813,7 @@ void GenericRemoveTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; typedef typename _TestStrategy::Key Key; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; EntryStrategy entryStrategy; TestClass v; @@ -862,10 +854,6 @@ void GenericEraseTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; - typedef typename _TestStrategy::Key Key; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; EntryStrategy entryStrategy; TestClass v; @@ -904,10 +892,6 @@ void GenericMakeEmptyTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; - typedef typename _TestStrategy::Key Key; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; EntryStrategy entryStrategy; TestClass v; @@ -945,10 +929,7 @@ void GenericFindTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; typedef typename _TestStrategy::Key Key; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; typedef typename TestClass::Iterator Iterator; typedef typename TestClass::ConstIterator ConstIterator; @@ -1010,10 +991,7 @@ void GenericFindCloseTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; typedef typename _TestStrategy::Key Key; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; typedef typename TestClass::Iterator Iterator; typedef typename TestClass::ConstIterator ConstIterator; @@ -1093,10 +1071,6 @@ void GenericIteratorTest(int32 maxNumber) { typedef typename _TestStrategy::EntryStrategy EntryStrategy; - typedef typename _TestStrategy::KeyStrategy KeyStrategy; - typedef typename _TestStrategy::ValueStrategy ValueStrategy; - typedef typename _TestStrategy::Key Key; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; typedef typename TestClass::Iterator Iterator; typedef typename TestClass::ConstIterator ConstIterator; diff --git a/src/tests/system/kernel/util/VectorMapTest.cpp b/src/tests/system/kernel/util/VectorMapTest.cpp index c7551e4552..1546030229 100644 --- a/src/tests/system/kernel/util/VectorMapTest.cpp +++ b/src/tests/system/kernel/util/VectorMapTest.cpp @@ -83,7 +83,7 @@ string_hash(const char *name) { uint32 h = 0; for (; *name; name++) { - if (uint32 g = g & 0xf0000000) + if (uint32 g = h & 0xf0000000) h ^= g >> 24; h = (h << 4) + *name; } diff --git a/src/tests/system/kernel/util/VectorSetTest.cpp b/src/tests/system/kernel/util/VectorSetTest.cpp index 4fdfcc9304..74d1d13c43 100644 --- a/src/tests/system/kernel/util/VectorSetTest.cpp +++ b/src/tests/system/kernel/util/VectorSetTest.cpp @@ -3,6 +3,7 @@ #include #include +using std::set; #include #include @@ -518,7 +519,6 @@ void GenericInsertTest(int32 maxNumber) { typedef typename _TestStrategy::ValueStrategy ValueStrategy; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; ValueStrategy strategy; TestClass v; @@ -610,7 +610,6 @@ void GenericEraseTest(int32 maxNumber) { typedef typename _TestStrategy::ValueStrategy ValueStrategy; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; ValueStrategy strategy; TestClass v; @@ -650,7 +649,6 @@ void GenericMakeEmptyTest(int32 maxNumber) { typedef typename _TestStrategy::ValueStrategy ValueStrategy; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; ValueStrategy strategy; TestClass v; @@ -810,7 +808,6 @@ void GenericIteratorTest(int32 maxNumber) { typedef typename _TestStrategy::ValueStrategy ValueStrategy; - typedef typename _TestStrategy::Value Value; typedef typename _TestStrategy::TestClass TestClass; typedef typename TestClass::Iterator Iterator; typedef typename TestClass::ConstIterator ConstIterator; diff --git a/src/tests/system/kernel/util/VectorTest.cpp b/src/tests/system/kernel/util/VectorTest.cpp index 3d77972467..ddc07e0ac7 100644 --- a/src/tests/system/kernel/util/VectorTest.cpp +++ b/src/tests/system/kernel/util/VectorTest.cpp @@ -190,10 +190,10 @@ public: template class TestVector { public: - typedef Vector::Iterator MyIterator; - typedef vector::iterator ReferenceIterator; - typedef Vector::ConstIterator MyConstIterator; - typedef vector::const_iterator ReferenceConstIterator; + typedef typename Vector::Iterator MyIterator; + typedef typename vector::iterator ReferenceIterator; + typedef typename Vector::ConstIterator MyConstIterator; + typedef typename vector::const_iterator ReferenceConstIterator; typedef TestIterator, MyIterator, ReferenceIterator> Iterator; typedef TestIterator, MyConstIterator, @@ -238,7 +238,7 @@ public: { if (index >= 0 && index <= Count()) { CHK(fMyVector.Insert(value, index) == B_OK); - vector::iterator it = fReferenceVector.begin(); + typename vector::iterator it = fReferenceVector.begin(); for (int32 i = 0; i < index; i++) ++it; fReferenceVector.insert(it, value); @@ -873,9 +873,10 @@ GenericFindTest(ValueStrategy strategy, int32 maxNumber) // find the values in the vector const TestVector &cv = v; for (int32 i = 0; i < maxNumber; i++) { - TestVector::ConstIterator cit = cv.Begin(); + typename TestVector::ConstIterator cit = cv.Begin(); int32 index = 0; - for (TestVector::Iterator it = v.Begin(); it != v.End(); ) { + for (typename TestVector::Iterator it = v.Begin(); + it != v.End(); ) { CHK(&v[index] == &*it); CHK(&cv[index] == &*cit); CHK(*it == *cit); @@ -887,8 +888,8 @@ GenericFindTest(ValueStrategy strategy, int32 maxNumber) // try to find some random values for (int32 i = 0; i < maxNumber; i++) { Value value = strategy.Generate(); - TestVector::Iterator it = v.Find(value); - TestVector::ConstIterator cit = cv.Find(value); + typename TestVector::Iterator it = v.Find(value); + typename TestVector::ConstIterator cit = cv.Find(value); if (it != v.End()) CHK(&*it == &*cit); } @@ -926,8 +927,8 @@ GenericIteratorTest(ValueStrategy strategy, int32 maxNumber) TestVector v; GenericFill(v, strategy, maxNumber); const TestVector &cv = v; - TestVector::Iterator it = v.Begin(); - TestVector::ConstIterator cit = cv.Begin(); + typename TestVector::Iterator it = v.Begin(); + typename TestVector::ConstIterator cit = cv.Begin(); for (; it != v.End(); ++it, ++cit) { CHK(&*it == &*cit); CHK(&*it == it.operator->());