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

FileSink::IsolatedFlush returns false on success #1178

Open
nickledeg opened this issue Nov 23, 2022 · 2 comments
Open

FileSink::IsolatedFlush returns false on success #1178

nickledeg opened this issue Nov 23, 2022 · 2 comments

Comments

@nickledeg
Copy link

The documentation for IsolatedFlush in BufferedTransformation states that IsolatedFlush should return true on success.

The FileSink code returns false on success:

bool FileSink::IsolatedFlush(bool hardFlush, bool blocking)
{
	CRYPTOPP_UNUSED(hardFlush), CRYPTOPP_UNUSED(blocking);
	if (!m_stream)
		throw Err("FileSink: output stream not opened");

	m_stream->flush();
	if (!m_stream->good())
		throw WriteErr();

	return false;
}

The only place where this has a consequence in the library is in FIlter::Flush, where there may be an unintended fallthrough:

bool Filter::Flush(bool hardFlush, int propagation, bool blocking)
{
  switch (m_continueAt)
  {
  case 0:
    if (IsolatedFlush(hardFlush, blocking))
      return true;
    // fall through
  case 1:
    if (OutputFlush(1, hardFlush, propagation, blocking))
      return true;
    // fall through
  default: ;
  }
  return false;
}
@nickledeg
Copy link
Author

@maruthiaws, I don't understand your reply. All I see is the code for Filter::Flush which appears to be an exact copy of what I quoted, excluding formatting.

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

No branches or pull requests

2 participants
@nickledeg and others