Browse Source

[2371] define END_OF_STREAM within InputSource to avoid duplicate def.

unfortunately this requires another usual workaround in the test, so
it was also made.
JINMEI Tatuya 12 years ago
parent
commit
d0a51e7f91

+ 1 - 3
src/lib/dns/master_lexer_inputsource.h

@@ -38,7 +38,7 @@ namespace master_lexer_internal {
 class InputSource {
 public:
     /// \brief Returned by getChar() when end of stream is reached.
-    static const int END_OF_STREAM;
+    static const int END_OF_STREAM = -1;
 
     /// \brief Exception thrown when ungetChar() is made to go before
     /// the start of buffer.
@@ -139,8 +139,6 @@ private:
     std::istream& input_;
 };
 
-const int InputSource::END_OF_STREAM = -1;
-
 } // namespace master_lexer_internal
 } // namespace dns
 } // namespace isc

+ 4 - 0
src/lib/dns/tests/master_lexer_inputsource_unittest.cc

@@ -27,6 +27,10 @@ using namespace std;
 using namespace isc::dns;
 using namespace isc::dns::master_lexer_internal;
 
+// Some compilers cannot find symbols of class constants when used in the
+// EXPECT_xxx macros, so we need explicit declaration.
+const int InputSource::END_OF_STREAM;
+
 namespace {
 
 class InputSourceTest : public ::testing::Test {