diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-08-02 03:07:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 03:07:01 (GMT) |
commit | 48a05aa887ae7d18512756bf1eeb177e08d0feaf (patch) | |
tree | 7a0ba6aadb63594267b040f7b17cee5ae6c75a07 /src | |
parent | 9fd356e2408b6f91bfbe6820cdb979b6fade3fb3 (diff) | |
download | hdf5-48a05aa887ae7d18512756bf1eeb177e08d0feaf.zip hdf5-48a05aa887ae7d18512756bf1eeb177e08d0feaf.tar.gz hdf5-48a05aa887ae7d18512756bf1eeb177e08d0feaf.tar.bz2 |
Unsigned comparison to 0 warning avoidance (#869)
* 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.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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); @@ -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, |