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

tinystdio: ungetc decrements file position indicator correctly #6

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

HanaMAshour
Copy link
Collaborator

According to the ISO/IEC_9899_1999, section: J.5.16 it is mentioned that there is a file position indicator that is decremented by each call of the ungetc function.

The value of the file position indicator was not directed to the right position, this issue is now handled in the ftell function so the file indicator is placed correctly after the function ungetc is called.
An "if" condition is added which checks on the value of unget and if it is not equal zero then ungetc function is called so the indicator will be decremented.

According to the ISO/IEC_9899_1999, section: J.5.16 it is mentioned that there is a file position indicator that is decremented by each call of the ungetc function.

The value of the file position indicator was not directed to the right position, this issue is now handled in the ftell function
so the file indicator is placed correctly after the function
ungetc is called.
An "if" condition is added which checks on the value of unget and if it is not equal zero then ungetc function is called so the indicator will be decremented.

Signed-off-by: Hana Ashour <[email protected]>
@HanaMAshour HanaMAshour force-pushed the hanaa_fix_ungetc_position_indicator branch from a6b446f to 89eb6c3 Compare April 24, 2024 13:57
keith-packard and others added 4 commits April 24, 2024 16:32
This allows fetching the unget value using stdatomic interfaces to
ensure atomicity wrt other unget operations.

Signed-off-by: Keith Packard <[email protected]>
A pending unget value means that the underlying reported seek position
will be off by one.

Signed-off-by: Keith Packard <[email protected]>
Make sure ungetc affects ftell value correctly.

Signed-off-by: Keith Packard <[email protected]>
pulled the changes from PR picolibc#719 and changed the copyrights in the test

Signed-off-by: Hana Ashour <[email protected]>
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