Skip to content

Commit

Permalink
Unsigned comparison to 0 warning avoidance (#869)
Browse files Browse the repository at this point in the history
* Added int variable for comparison with H5_VERS_RELEASE in H5.c to avoid
warning that unsigned comparison < 0 is always false, which is known,
        but for later versions the comparison can possibly be true.

* Better solution for avoiding warning that unsigned comparison < 0.
  • Loading branch information
lrknox committed Aug 11, 2021
1 parent 6686942 commit 49d1022
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/H5.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,11 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
disable_version_check = (unsigned int)HDstrtol(s, NULL, 0);
}

if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE != relnum) {
/* H5_VERS_MAJOR and H5_VERS_MINOR must match */
/* 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

0 comments on commit 49d1022

Please sign in to comment.