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

Move ASCII range checks to writeDigitAscii() #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dmadison
Copy link
Contributor

@dmadison dmadison commented Oct 7, 2021

This prevents the writeDigitAscii() function from reading outside the bounds of the font table. Values outside the printable range are printed as blanks.

This also fixes a -Wtype-limits warning accidentally introduced in #41, on platforms where char is a signed 8 bit value. This was caused by the range comparison to 127 always being 'true' due to the limits of the type.

This prevents the `writeDigitAscii()` function from reading outside the bounds of the font table. Values outside the printable range are printed as blanks.
if ((c >= ' ') && (c <= 127)) {
writeDigitAscii(position, c);
r = 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its purpose was to check whether the character is present in the font table. That functionality has been moved to writeDigitAscii() where the font table is accessed.

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