diff options
author | Haavard <havardpe@yahoo-inc.com> | 2017-02-06 09:54:03 +0000 |
---|---|---|
committer | Haavard <havardpe@yahoo-inc.com> | 2017-02-06 09:54:03 +0000 |
commit | 78853d8c9902fb4a5b82fa0c8a95569471275dc5 (patch) | |
tree | d858f9a7df3dc423a67c1c532f037abd356a8eee /vespalib | |
parent | 604b545f86b7c8dd7ade8d96e785f80701f16c58 (diff) |
remove eof function from input reader
(clients should use obtain instead)
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/data/input_reader/input_reader_test.cpp | 9 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/data/input_reader.h | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/vespalib/src/tests/data/input_reader/input_reader_test.cpp b/vespalib/src/tests/data/input_reader/input_reader_test.cpp index 31b440f9800..54c0613b6da 100644 --- a/vespalib/src/tests/data/input_reader/input_reader_test.cpp +++ b/vespalib/src/tests/data/input_reader/input_reader_test.cpp @@ -101,26 +101,27 @@ TEST("require that reading a byte sequence crossing the end of input fails") { } } -TEST("expect that obtain sets eof but not failure state on input reader") { +TEST("expect that obtain does not set failure state on input reader") { const char *data = "12345"; for (bool byte_first: {true, false}) { MemoryInput input(data); InputReader src(input); EXPECT_EQUAL(src.obtain(), 5); + EXPECT_EQUAL(src.obtain(), 5); EXPECT_EQUAL(src.read(5), Memory("12345")); EXPECT_TRUE(!src.failed()); - EXPECT_TRUE(!src.eof()); EXPECT_EQUAL(src.obtain(), 0); - EXPECT_TRUE(src.eof()); + EXPECT_EQUAL(src.obtain(), 0); EXPECT_TRUE(!src.failed()); if (byte_first) { EXPECT_EQUAL(src.read(), 0); + EXPECT_TRUE(src.failed()); EXPECT_EQUAL(src.read(5), Memory()); } else { EXPECT_EQUAL(src.read(5), Memory()); + EXPECT_TRUE(src.failed()); EXPECT_EQUAL(src.read(), 0); } - EXPECT_TRUE(src.failed()); EXPECT_EQUAL(src.get_error_message(), vespalib::string("input underflow")); EXPECT_EQUAL(src.obtain(), 0); } diff --git a/vespalib/src/vespa/vespalib/data/input_reader.h b/vespalib/src/vespa/vespalib/data/input_reader.h index 38824f29139..a5e2d191147 100644 --- a/vespalib/src/vespa/vespalib/data/input_reader.h +++ b/vespalib/src/vespa/vespalib/data/input_reader.h @@ -39,7 +39,6 @@ public: : _input(input), _data(), _pos(0), _bytes_evicted(0), _eof(false), _error(), _space() {} ~InputReader(); - bool eof() const { return _eof; } bool failed() const { return !_error.empty(); } const vespalib::string &get_error_message() const { return _error; } size_t get_offset() const { return (_bytes_evicted + _pos); } |