Skip to content

Commit 54bc8cb

Browse files
committed
H5I_INVALID_HID throughout in bit{round,groom} test code
1 parent 1229ed8 commit 54bc8cb

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

BITGROOM/example/h5filter_specials_bitgroom.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
* access to this file, you may request a copy from help@hdfgroup.org. *
1010
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1111

12-
#include "hdf5.h"
13-
#include <stdint.h>
14-
#include <stdio.h>
15-
#include <string.h>
16-
1712
/*
1813
* Round-trip test for special floating-point values through the BitGroom
1914
* filter. Verifies that NaN, +Inf, -Inf, -0.0, and +0.0 are passed through
@@ -28,6 +23,11 @@
2823
* positions to exercise both loops.
2924
*/
3025

26+
#include <stdint.h>
27+
#include <stdio.h>
28+
#include <string.h>
29+
#include "hdf5.h"
30+
3131
#define FILENAME "h5filter_specials_bitgroom.h5"
3232
#define DSET_F32 "f32"
3333
#define DSET_F64 "f64"
@@ -128,11 +128,11 @@ roundtrip_f32(hid_t file_id)
128128
ret = 0;
129129

130130
done:
131-
if (dset_id > 0)
131+
if (dset_id != H5I_INVALID_HID)
132132
H5Dclose(dset_id);
133-
if (dcpl_id > 0)
133+
if (dcpl_id != H5I_INVALID_HID)
134134
H5Pclose(dcpl_id);
135-
if (space_id > 0)
135+
if (space_id != H5I_INVALID_HID)
136136
H5Sclose(space_id);
137137
return ret;
138138
}
@@ -194,11 +194,11 @@ roundtrip_f64(hid_t file_id)
194194
ret = 0;
195195

196196
done:
197-
if (dset_id > 0)
197+
if (dset_id != H5I_INVALID_HID)
198198
H5Dclose(dset_id);
199-
if (dcpl_id > 0)
199+
if (dcpl_id != H5I_INVALID_HID)
200200
H5Pclose(dcpl_id);
201-
if (space_id > 0)
201+
if (space_id != H5I_INVALID_HID)
202202
H5Sclose(space_id);
203203
return ret;
204204
}

BITROUND/example/h5filter_specials_bitround.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
* access to this file, you may request a copy from help@hdfgroup.org. *
1010
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1111

12-
#include "hdf5.h"
13-
#include <stdint.h>
14-
#include <stdio.h>
15-
#include <string.h>
16-
1712
/*
1813
* Round-trip test for special floating-point values through the Granular
1914
* BitRound filter. Verifies that NaN, +Inf, -Inf, -0.0, and +0.0 are passed
@@ -24,6 +19,11 @@
2419
* platform NaN/Inf printf formatting cannot affect the result.
2520
*/
2621

22+
#include <stdint.h>
23+
#include <stdio.h>
24+
#include <string.h>
25+
#include "hdf5.h"
26+
2727
#define FILENAME "h5filter_specials_bitround.h5"
2828
#define DSET_F32 "f32"
2929
#define DSET_F64 "f64"
@@ -124,11 +124,11 @@ roundtrip_f32(hid_t file_id)
124124
ret = 0;
125125

126126
done:
127-
if (dset_id > 0)
127+
if (dset_id != H5I_INVALID_HID)
128128
H5Dclose(dset_id);
129-
if (dcpl_id > 0)
129+
if (dcpl_id != H5I_INVALID_HID)
130130
H5Pclose(dcpl_id);
131-
if (space_id > 0)
131+
if (space_id != H5I_INVALID_HID)
132132
H5Sclose(space_id);
133133
return ret;
134134
}
@@ -190,11 +190,11 @@ roundtrip_f64(hid_t file_id)
190190
ret = 0;
191191

192192
done:
193-
if (dset_id > 0)
193+
if (dset_id != H5I_INVALID_HID)
194194
H5Dclose(dset_id);
195-
if (dcpl_id > 0)
195+
if (dcpl_id != H5I_INVALID_HID)
196196
H5Pclose(dcpl_id);
197-
if (space_id > 0)
197+
if (space_id != H5I_INVALID_HID)
198198
H5Sclose(space_id);
199199
return ret;
200200
}

0 commit comments

Comments
 (0)