summaryrefslogtreecommitdiffstats
path: root/test/tattr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-09-13 15:44:56 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-09-13 15:44:56 (GMT)
commit579284f422b6ed25b7a5f4a518c19740fff297c8 (patch)
tree564b2a7b4c13854a19ffaf465f94e6abd52d6340 /test/tattr.c
parent15d118faedd8e61e8ec2a715cf8fcea5b1afab35 (diff)
downloadhdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.zip
hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.gz
hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.bz2
[svn-r14144] Description:
Move H5Gget_objinfo() to deprecated symbols section and retarget internal usage to H5Lget_info()/H5Oget_info(). Misc. other code cleanups... Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) AIX/32 5.3 (copper) Solaris/32 2.10 (linew) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'test/tattr.c')
-rw-r--r--test/tattr.c105
1 files changed, 53 insertions, 52 deletions
diff --git a/test/tattr.c b/test/tattr.c
index d987994..96f6051 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -1595,9 +1595,9 @@ test_attr_dtype_shared(hid_t fapl)
hid_t space_id; /* Dataspace ID for dataset & attribute */
hid_t type_id; /* Datatype ID for named datatype */
hid_t attr_id; /* Attribute ID */
- int data=8; /* Data to write */
- int rdata=0; /* Read read in */
- H5G_stat_t statbuf; /* Object's information */
+ int data = 8; /* Data to write */
+ int rdata = 0; /* Read read in */
+ H5O_info_t oinfo; /* Object's information */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
herr_t ret; /* Generic return value */
@@ -1606,153 +1606,154 @@ test_attr_dtype_shared(hid_t fapl)
MESSAGE(5, ("Testing Shared Datatypes with Attributes\n"));
/* Create a file */
- file_id=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file_id, FAIL, "H5Fopen");
/* Close file */
- ret=H5Fclose(file_id);
+ ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
/* Get size of file */
- empty_filesize=h5_get_file_size(FILENAME);
- if(empty_filesize<0)
- TestErrPrintf("Line %d: file size wrong!\n",__LINE__);
+ empty_filesize = h5_get_file_size(FILENAME);
+ if(empty_filesize < 0)
+ TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
/* Re-open file */
- file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl);
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(file_id, FAIL, "H5Fopen");
/* Create a datatype to commit and use */
- type_id=H5Tcopy(H5T_NATIVE_INT);
+ type_id = H5Tcopy(H5T_NATIVE_INT);
CHECK(type_id, FAIL, "H5Tcopy");
/* Commit datatype to file */
- ret=H5Tcommit(file_id,TYPE1_NAME,type_id);
+ ret = H5Tcommit(file_id, TYPE1_NAME, type_id);
CHECK(ret, FAIL, "H5Tcommit");
/* Check reference count on named datatype */
- ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf);
- CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.nlink, 1, "H5Tcommit");
+ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.rc, 1, "H5Tcommit");
/* Create dataspace for dataset */
- space_id=H5Screate(H5S_SCALAR);
+ space_id = H5Screate(H5S_SCALAR);
CHECK(space_id, FAIL, "H5Screate");
/* Create dataset */
- dset_id=H5Dcreate(file_id,DSET1_NAME,type_id,space_id,H5P_DEFAULT);
+ dset_id = H5Dcreate(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate");
/* Check reference count on named datatype */
- ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf);
- CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.nlink, 2, "H5Dcreate");
+ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.rc, 2, "H5Dcreate");
/* Create attribute on dataset */
- attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT);
+ attr_id = H5Acreate(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
/* Check reference count on named datatype */
- ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf);
- CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.nlink, 3, "H5Acreate");
+ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.rc, 3, "H5Acreate");
/* Close attribute */
- ret=H5Aclose(attr_id);
+ ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
/* Delete attribute */
- ret=H5Adelete(dset_id,ATTR1_NAME);
+ ret = H5Adelete(dset_id, ATTR1_NAME);
CHECK(ret, FAIL, "H5Adelete");
/* Check reference count on named datatype */
- ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf);
- CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.nlink, 2, "H5Adelete");
+ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.rc, 2, "H5Adelete");
/* Create attribute on dataset */
- attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT);
+ attr_id = H5Acreate(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
/* Check reference count on named datatype */
- ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf);
- CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.nlink, 3, "H5Acreate");
+ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.rc, 3, "H5Acreate");
/* Write data into the attribute */
- ret=H5Awrite(attr_id,H5T_NATIVE_INT,&data);
+ ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data);
CHECK(ret, FAIL, "H5Awrite");
/* Close attribute */
- ret=H5Aclose(attr_id);
+ ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
/* Close dataset */
- ret=H5Dclose(dset_id);
+ ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
/* Close dataspace */
- ret=H5Sclose(space_id);
+ ret = H5Sclose(space_id);
CHECK(ret, FAIL, "H5Sclose");
/* Close datatype */
- ret=H5Tclose(type_id);
+ ret = H5Tclose(type_id);
CHECK(ret, FAIL, "H5Tclose");
/* Close file */
- ret=H5Fclose(file_id);
+ ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
+
/* Re-open file */
- file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl);
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(file_id, FAIL, "H5Fopen");
/* Open dataset */
- dset_id=H5Dopen(file_id,DSET1_NAME);
+ dset_id = H5Dopen(file_id, DSET1_NAME);
CHECK(dset_id, FAIL, "H5Dopen");
/* Open attribute */
- attr_id=H5Aopen_name(dset_id,ATTR1_NAME);
+ attr_id = H5Aopen_name(dset_id, ATTR1_NAME);
CHECK(attr_id, FAIL, "H5Aopen_name");
/* Read data from the attribute */
- ret=H5Aread(attr_id,H5T_NATIVE_INT,&rdata);
+ ret = H5Aread(attr_id, H5T_NATIVE_INT, &rdata);
CHECK(ret, FAIL, "H5Aread");
VERIFY(data, rdata, "H5Aread");
/* Close attribute */
- ret=H5Aclose(attr_id);
+ ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
/* Close dataset */
- ret=H5Dclose(dset_id);
+ ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
/* Check reference count on named datatype */
- ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf);
- CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.nlink, 3, "H5Gget_objinfo");
+ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.rc, 3, "H5Oget_info");
/* Unlink the dataset */
ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
/* Check reference count on named datatype */
- ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf);
- CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.nlink, 1, "H5Gget_objinfo");
+ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.rc, 1, "H5Ldelete");
/* Unlink the named datatype */
ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
/* Close file */
- ret=H5Fclose(file_id);
+ ret = H5Fclose(file_id);
CHECK(ret, FAIL, "H5Fclose");
/* Check size of file */
- filesize=h5_get_file_size(FILENAME);
+ filesize = h5_get_file_size(FILENAME);
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dtype_shared() */