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

add readEOS flag to BlobReader and BlobIO so that EOF read logic work… #538

Merged
merged 1 commit into from
Sep 3, 2021

Conversation

mdejong
Copy link
Contributor

@mdejong mdejong commented Jul 5, 2019

…s like FileIO, the isEOF method only returns true after a read operation that returns an EOF condition

…s like FileIO, the isEOF method only returns true after a read operation that returns an EOF condition
@mdejong
Copy link
Contributor Author

mdejong commented Jul 5, 2019

Note that this is my first patch, CLA is here: FLIF-hub/FLIF-CLAs#22

{
}

bool isEOF() const {
return seek_pos >= data_array_size;
if(readEOS) {
Copy link
Contributor

@lehitoskin lehitoskin Jul 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to return readEOS;

Copy link
Contributor Author

@mdejong mdejong Jul 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the form you describe makes it more difficult to actually debug the code when a developer wants to set a breakpoint that would get hit only in the EOF returns true case. By actually writing out the if block, the code can then be debugged with a breakpoint as is.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that most debuggers like gdb let you set conditional breakpoints for this purpose.

@@ -200,14 +214,20 @@ class BlobIO
// nothing to do
}
bool isEOF() const {
return seek_pos >= bytes_used;
if(readEOS) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be simplified (identical to line 94).

@jonsneyers jonsneyers merged commit 732849b into FLIF-hub:master Sep 3, 2021
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

Successfully merging this pull request may close these issues.

4 participants