Fix bug when reading zero DA from ascii file#55
Merged
abgandar merged 1 commit intodacelib:masterfrom Mar 24, 2025
Merged
Conversation
Collaborator
|
Does this ensure that if there is a valid DA in the stream (whether it's empty, binary, or text) we never read past the end of that DA (and thus break following reads)? |
Collaborator
Author
|
@abgandar yes, this fix addresses exactly that problem. In the current code, when you have a zero DA in a text file it reads past the last line. With this fix the behaviour is the same for all the cases, allowing the correct reading in all the cases (Binary and text, both full or zero DA). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should address issue #54. The problem is that when reading the ifstream the first string is used to initialize a storeDA, which fetch a string of size headersize, meant to tackle with the binary format. Usually the actual line in the file is longer than headersize, and it is necessary to fetch the remaining characters of the line. However, in the case of a zero DA the actual line is shorter than headersize and the code fetch also the terminator line. With the proposed modification a check that the last line fetched is the terminator line is introduced.