Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why doesn't kstream::close() close the underlying std::istream? #49

Open
generalmimon opened this issue Feb 26, 2022 · 1 comment
Open
Labels

Comments

@generalmimon
Copy link
Member

@GreyCat Is there a reason m_io->close() is commented out here?

void kaitai::kstream::close() {
// m_io->close();
}

This "implementation" comes from the initial commit in 2016 when the C++/STL runtime was started (8d533f3:kaitai/kaitaistream.cpp:8), so perhaps it was disabled just for debugging reasons during the initial testing, but I don't see any reason why kstream::close() should be a no-op - makes no sense to me.

@generalmimon
Copy link
Member Author

m_io has type std::istream, which is defined as std::basic_istream<char>. I see that std::basic_istream is an abstract class that doesn't have any close() method, so it's no surprise that it can't be called.

If kaitai::kstream::close() is impossible to implement, it should be removed, otherwise it looks like the runtime library is capable of something it in fact isn't.

This is, of course, a potential breaking change, but I think for the better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant