diff --git a/Tests/Test_EncryptedStream.cpp b/Tests/Test_EncryptedStream.cpp index afb9f6f..654d81f 100644 --- a/Tests/Test_EncryptedStream.cpp +++ b/Tests/Test_EncryptedStream.cpp @@ -38,6 +38,8 @@ TEST_CASE("EncryptedStream known values", "[streams]") REQUIRE(stream.getEncType() == DS::EncryptedStream::Type::e_xxtea); REQUIRE(stream.size() == resultsz); + REQUIRE_FALSE(stream.atEof()); + char test[sizeof(result)]; stream.readBytes(test, resultsz); test[sizeof(test) - 1] = 0; @@ -59,6 +61,8 @@ TEST_CASE("EncryptedStream known values", "[streams]") REQUIRE(stream.getEncType() == DS::EncryptedStream::Type::e_tea); REQUIRE(stream.size() == resultsz); + REQUIRE_FALSE(stream.atEof()); + char test[sizeof(result)]; stream.readBytes(test, resultsz); test[sizeof(test) - 1] = 0; diff --git a/streams.cpp b/streams.cpp index 5def001..00bf446 100644 --- a/streams.cpp +++ b/streams.cpp @@ -155,7 +155,7 @@ uint32_t DS::FileStream::size() const bool DS::FileStream::atEof() { int ch = fgetc(m_file); - fputc(ch, m_file); + ungetc(ch, m_file); return (ch == EOF); }