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

Unsigned comparison to 0 warning avoidance #869

Merged
merged 3 commits into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/H5.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,6 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */
static const char * version_mismatch_warning = VERSION_MISMATCH_WARNING;
herr_t ret_value = SUCCEED; /* Return value */
int releasenum = relnum; /* To avoid warning for unsigned < 0
comparison in first release versions */

FUNC_ENTER_API_NOINIT_NOERR_NOFS
H5TRACE3("e", "IuIuIu", majnum, minnum, relnum);
Expand All @@ -933,7 +931,10 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
}

/* H5_VERS_MAJOR and H5_VERS_MINOR must match */
if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > releasenum) {
/* Cast relnum to int to avoid warning for unsigned < 0 comparison
* in first release versions */
if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > (int)relnum) {

switch (disable_version_check) {
case 0:
HDfprintf(stderr, "%s%s", version_mismatch_warning,
Expand Down