Skip to content

Fix bug when reading zero DA from ascii file#55

Merged
abgandar merged 1 commit intodacelib:masterfrom
mmassari1974:master
Mar 24, 2025
Merged

Fix bug when reading zero DA from ascii file#55
abgandar merged 1 commit intodacelib:masterfrom
mmassari1974:master

Conversation

@mmassari1974
Copy link
Collaborator

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.

@abgandar
Copy link
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)?

@mmassari1974
Copy link
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).

@abgandar abgandar merged commit 2fa0ab6 into dacelib:master Mar 24, 2025
5 checks passed
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.

2 participants