summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorkmu <kmu@hdfgroup.org>2019-11-25 18:48:51 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:20:23 (GMT)
commitbb53a566e8a45490b3179290774c3f1450d7d8dd (patch)
treef63980b1e4a4aed7a0a3cf4c3d7a3f83496c10e1 /tools/src
parent540e50df2898be8cacc151f9e2930d250337a62f (diff)
downloadhdf5-bb53a566e8a45490b3179290774c3f1450d7d8dd.zip
hdf5-bb53a566e8a45490b3179290774c3f1450d7d8dd.tar.gz
hdf5-bb53a566e8a45490b3179290774c3f1450d7d8dd.tar.bz2
fix issues from previous PR comments
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5import/h5import.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 40b812f..2cd826b 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -4707,14 +4707,20 @@ static int process(struct Options *opt)
return (0);
}
-uint16_t swap_uint16( uint16_t val)
+uint16_t swap_uint16(uint16_t val)
{
- return (uint16_t)((val << 8) | (val >> 8));
+ uint16_t ret;
+
+ ASSIGN_TO_SMALLER_SIZE(ret, uint16_t, (val << 8) | (val >> 8), int);
+ return ret;
}
int16_t swap_int16(int16_t val)
{
- return (uint16_t)((val << 8) | ((val >> 8) & 0xFF));
+ uint16_t ret;
+
+ ASSIGN_TO_SMALLER_SIZE(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int);
+ return ret;
}
uint32_t swap_uint32(uint32_t val)