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

Discard trailing entries of a line in a MM-format file #1628

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

MarcelKoch
Copy link
Member

This PR will discard any character in a line of a MM-format file after the values have been read in. This addresses #1627, using multiple columns within the MM-file will now lead to an exception. However, the exception is thrown by the read_entry function and thus the exception message is not very helpful.

@MarcelKoch MarcelKoch self-assigned this Jun 19, 2024
@MarcelKoch MarcelKoch linked an issue Jun 19, 2024 that may be closed by this pull request
@ginkgo-bot ginkgo-bot added reg:testing This is related to testing. mod:core This is related to the core module. labels Jun 19, 2024
@thoasm thoasm self-requested a review June 21, 2024 11:39
Copy link
Member

@thoasm thoasm left a comment

Choose a reason for hiding this comment

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

LGTM!
I just have one question: Does the GKO_CHECK_STREAM also throw in case we don't read enough elements?

Comment on lines +522 to +523
content.ignore(max_streamsize,
'\n'); // discards rest of the line
Copy link
Member

Choose a reason for hiding this comment

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

nit: I would move the comment above the line to increase the readability.
Additionally, I added an article (the) in the comment:

Suggested change
content.ignore(max_streamsize,
'\n'); // discards rest of the line
// discards the rest of the line
content.ignore(max_streamsize, '\n');

Comment on lines +592 to +593
content.ignore(max_streamsize,
'\n'); // discards rest of the line
Copy link
Member

Choose a reason for hiding this comment

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

same here:

Suggested change
content.ignore(max_streamsize,
'\n'); // discards rest of the line
// discards the rest of the line
content.ignore(max_streamsize, '\n');

@nbeams
Copy link
Collaborator

nbeams commented Jun 21, 2024

LGTM! I just have one question: Does the GKO_CHECK_STREAM also throw in case we don't read enough elements?

With the current develop (not this PR) I tried a case where I left off one element, and it threw a read error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod:core This is related to the core module. reg:testing This is related to testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MM-Format IO Checking
4 participants