summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-03-12 17:02:00 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-03-12 17:02:00 (GMT)
commit4f442a71e8e135c5e9d0a9aa34ba3ff9f0db53e0 (patch)
tree3febfe3b87c1487c89fa729761cdc94d94b1f5b5
parent92d4795c55f37c85c486378bf1e1940f6e87e4cd (diff)
downloadhdf5-4f442a71e8e135c5e9d0a9aa34ba3ff9f0db53e0.zip
hdf5-4f442a71e8e135c5e9d0a9aa34ba3ff9f0db53e0.tar.gz
hdf5-4f442a71e8e135c5e9d0a9aa34ba3ff9f0db53e0.tar.bz2
[svn-r14726] Removed unused code and make 1.8 and 1.6 code look equal or similar
Tested: windows, linux
-rw-r--r--tools/h5diff/h5diffgentest.c65
1 files changed, 37 insertions, 28 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 9333fc0..2fd6fa6 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -730,13 +730,13 @@ int test_datasets(const char *file,
write_dset_in(gid,"/dset",fid,make_diffs);
- /* Close */
+ /* close */
status = H5Dclose(did);
assert(status >= 0);
status = H5Gclose(gid);
assert(status >= 0);
- /* Close file */
+ /* close file */
status = H5Fclose(fid);
assert(status >= 0);
return status;
@@ -2613,31 +2613,35 @@ int write_attr(hid_t loc_id,
hid_t tid,
void *buf)
{
- hid_t aid;
- hid_t sid;
-
- /* create a space */
- if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
- goto out;
-
- /* create the attribute */
- if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto out;
-
- /* write */
- if(buf)
- if(H5Awrite(aid, tid, buf) < 0)
- goto out;
-
- /* close */
- H5Aclose(aid);
- H5Sclose(sid);
-
- return SUCCEED;
-
+ hid_t aid=-1;
+ hid_t sid=-1;
+
+ /* create a space */
+ if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ goto out;
+
+ /* create the attribute */
+ if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* write */
+ if(buf)
+ {
+ if(H5Awrite(aid, tid, buf) < 0)
+ goto out;
+ }
+
+ /* close */
+ H5Aclose(aid);
+ H5Sclose(sid);
+
+ return SUCCEED;
+
out:
-
- return FAIL;
+
+ H5Aclose(aid);
+ H5Sclose(sid);
+ return FAIL;
}
/*-------------------------------------------------------------------------
@@ -2655,8 +2659,8 @@ int write_dset( hid_t loc_id,
hid_t tid,
void *buf )
{
- hid_t did;
- hid_t sid;
+ hid_t did=-1;
+ hid_t sid=-1;
/* create a space */
if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
@@ -2668,8 +2672,10 @@ int write_dset( hid_t loc_id,
/* write */
if(buf)
+ {
if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
+ }
/* close */
H5Dclose(did);
@@ -2678,6 +2684,9 @@ int write_dset( hid_t loc_id,
return SUCCEED;
out:
+
+ H5Dclose(did);
+ H5Sclose(sid);
return FAIL;
}