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

Eliminate some warnings #101

Open
wants to merge 12 commits into
base: next
Choose a base branch
from
Open

Conversation

hramrach
Copy link
Contributor

@hramrach hramrach commented Nov 4, 2024

The bulk of the warnings is signed vs unsigned comparison.

While this is dodgy because there is no clear semantic for such comparison the warning is not all that helpful in itself.

A value can be automatically promoted between signed and unsigned when passed as function argument, for example.

The string is terminated by explicit NUL assignement below, use memcpy
instead of strncpy.
The documentation sttes that the element size should come second but
it's passed first.
There is no point to it being signed other than the trick of negating to
record removal.

It is compared to unsigned values in a number of places leading to a
warning.
output_level is compared to say_level enumeration values which are all
non-negative, making the enumeration type unsigned. This comparison
triggers a warning.
Property size is compared with file size returned from the stat() call
which is signed.
The structures that store nid values store them as unsigned, causing
different signedness comparison warnings.
The token value is comparted to an unsigned value, and the string
representation is assumed to start with a number, not a sign.
They are compared to an unsigned value causing a different sign
comparison warning.

These start from zero and only increase, there is no use for negative
values.
This avoids different signedness warning.
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.

1 participant