summaryrefslogtreecommitdiffstats
path: root/test/gheap.c
diff options
context:
space:
mode:
authorQuincey Koziol <quincey@koziol.cc>2016-09-27 17:29:16 (GMT)
committerQuincey Koziol <quincey@koziol.cc>2016-09-27 17:29:16 (GMT)
commitfa66428a6dd3e9250497618afa6402008c7ed409 (patch)
tree33d2e0c499f90fbd137607a01ae35d9058d058a3 /test/gheap.c
parent6d5ee49ff3a33b30b9a7baf0af4f1929ad8d3b72 (diff)
downloadhdf5-fa66428a6dd3e9250497618afa6402008c7ed409.zip
hdf5-fa66428a6dd3e9250497618afa6402008c7ed409.tar.gz
hdf5-fa66428a6dd3e9250497618afa6402008c7ed409.tar.bz2
Description:
Further warning cleanups: from 667 warnings to 503.
Diffstat (limited to 'test/gheap.c')
-rw-r--r--test/gheap.c51
1 files changed, 47 insertions, 4 deletions
diff --git a/test/gheap.c b/test/gheap.c
index 317e306..3e88ca6 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -78,7 +78,7 @@ test_1 (hid_t fapl)
{
hid_t file = -1;
H5F_t *f = NULL;
- H5HG_t obj[1024];
+ H5HG_t *obj = NULL;
uint8_t out[1024];
uint8_t in[1024];
size_t u;
@@ -89,6 +89,10 @@ test_1 (hid_t fapl)
TESTING("monotonically increasing lengths");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
@@ -138,6 +142,10 @@ test_1 (hid_t fapl)
}
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if(H5Fclose(file) < 0) goto error;
if(nerrors) goto error;
@@ -148,6 +156,8 @@ error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}
@@ -174,7 +184,7 @@ test_2 (hid_t fapl)
{
hid_t file = -1;
H5F_t *f = NULL;
- H5HG_t obj[1024];
+ H5HG_t *obj = NULL;
uint8_t out[1024];
uint8_t in[1024];
size_t u;
@@ -184,6 +194,10 @@ test_2 (hid_t fapl)
TESTING("monotonically decreasing lengths");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
@@ -226,8 +240,13 @@ test_2 (hid_t fapl)
}
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
+
PASSED();
return 0;
@@ -235,6 +254,8 @@ test_2 (hid_t fapl)
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}
@@ -261,7 +282,7 @@ test_3 (hid_t fapl)
{
hid_t file = -1;
H5F_t *f = NULL;
- H5HG_t obj[1024];
+ H5HG_t *obj = NULL;
uint8_t out[1024];
size_t u;
size_t size;
@@ -271,6 +292,10 @@ test_3 (hid_t fapl)
TESTING("complete object removal");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
@@ -304,8 +329,13 @@ test_3 (hid_t fapl)
}
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
+
PASSED();
return 0;
@@ -313,6 +343,8 @@ test_3 (hid_t fapl)
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}
@@ -340,7 +372,7 @@ test_4 (hid_t fapl)
{
hid_t file = -1;
H5F_t *f = NULL;
- H5HG_t obj[1024];
+ H5HG_t *obj = NULL;
uint8_t out[1024];
size_t u;
size_t size;
@@ -350,6 +382,10 @@ test_4 (hid_t fapl)
TESTING("partial object removal");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * 1024)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
@@ -389,8 +425,13 @@ test_4 (hid_t fapl)
}
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
+
PASSED();
return 0;
@@ -398,6 +439,8 @@ test_4 (hid_t fapl)
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}