diff options
author | David Young <dyoung@hdfgroup.org> | 2022-04-30 03:29:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-30 03:29:20 (GMT) |
commit | c4d70e3571262df0fcf381f5804b671dc9f86bc1 (patch) | |
tree | d5942228d0e2b320b23fdae7c5de278063d77955 /src/H5private.h | |
parent | ffd311cf36814c2742234b8a02f47078cb7c8158 (diff) | |
download | hdf5-c4d70e3571262df0fcf381f5804b671dc9f86bc1.zip hdf5-c4d70e3571262df0fcf381f5804b671dc9f86bc1.tar.gz hdf5-c4d70e3571262df0fcf381f5804b671dc9f86bc1.tar.bz2 |
Be a bit safer with signed arithmetic, thus quieting some signed-overflow warnings from GCC (#1706)
* Avoid a signed overflow: check the range of `entry_ptr->age` before
increasing it instead of increasing it and then checking the range.
This quiets a GCC warning.
* Avoid the potential for signed overflow by rewriting expressions
`MAX(0, fwidth - n)` as `MAX(n, fwidth) - n` for various `n`.
This change quiets some GCC warnings.
* Change some local variables that cannot take sensible negative values
from signed to unsigned. This quiets GCC warnings about potential
signed overflow.
* In a handful of instances, check the range of a signed integer before
increasing/decreasing it, just in case the increase/decrease overflows.
This quiets a handful of GCC signed-overflow warnings.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5private.h')
0 files changed, 0 insertions, 0 deletions