summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-30 13:55:10 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-30 13:55:10 (GMT)
commitc50c23d387121f2acaf364fa3c1f5d407c4ffb43 (patch)
tree70719be38921637a74c90894d837973017bc68f0 /tools
parent926a033b139974a8a9fd6ddec7150bcbdb556675 (diff)
downloadhdf5-c50c23d387121f2acaf364fa3c1f5d407c4ffb43.zip
hdf5-c50c23d387121f2acaf364fa3c1f5d407c4ffb43.tar.gz
hdf5-c50c23d387121f2acaf364fa3c1f5d407c4ffb43.tar.bz2
[svn-r14129] Description:
Add H5O{set|get}_comment routines, which were overlooked before. Move H5G{set|get}_comment routines to deprecated code section, replacing internal calls with H5O{set|get}_comment. Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) Solaris/32 5.10 (linew) AIX/32 5.3 (copper) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c14
-rw-r--r--tools/h5dump/h5dumpgentest.c88
-rw-r--r--tools/h5ls/h5ls.c44
3 files changed, 74 insertions, 72 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 0f863f8..d8fe56b 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2291,21 +2291,21 @@ dump_oid(hid_t oid)
*
*-------------------------------------------------------------------------
*/
-
-static void dump_comment(hid_t obj_id)
+static void
+dump_comment(hid_t obj_id)
{
char comment[50];
comment[0] = '\0';
- H5Gget_comment(obj_id, ".", sizeof(comment), comment);
+ H5Oget_comment(obj_id, ".", comment, sizeof(comment), H5P_DEFAULT);
- if (comment[0]) {
+ if(comment[0]) {
indentation(indent);
printf("COMMENT \"%s\"\n", comment);
- }
-}
-
+ } /* end if */
+} /* end dump_comment() */
+
/*-------------------------------------------------------------------------
* Function: dump_fill_value
*
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 914cfbf..e6d0d6d 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -1643,12 +1643,12 @@ static void gent_objref(void)
*tbuf; /* temp. buffer read from disk */
uint32_t *tu32; /* Temporary pointer to uint32 data */
int i; /* counting variables */
- const char *write_comment="Foo!"; /* Comments for group */
+ const char *write_comment = "Foo!"; /* Comments for group */
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1);
- rbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1);
- tbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1);
+ wbuf = malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ rbuf = malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ tbuf = malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1660,38 +1660,38 @@ static void gent_objref(void)
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Set group's comment */
- H5Gset_comment(group,".",write_comment);
+ H5Oset_comment(group, ".", write_comment, H5P_DEFAULT);
/* Create a dataset (inside Group1) */
- dataset=H5Dcreate(group,"Dataset1",H5T_STD_U32BE,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT);
- for(tu32=(uint32_t *)((void*)wbuf),i=0; i<SPACE1_DIM1; i++)
- *tu32++=i*3;
+ for(tu32 = (uint32_t *)((void*)wbuf), i = 0; i < SPACE1_DIM1; i++)
+ *tu32++ = i * 3;
/* Write selection to disk */
- H5Dwrite(dataset,H5T_NATIVE_UINT,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/* Close Dataset */
H5Dclose(dataset);
/* Create another dataset (inside Group1) */
- dataset=H5Dcreate(group,"Dataset2",H5T_STD_U8BE,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(group, "Dataset2", H5T_STD_U8BE, sid1, H5P_DEFAULT);
/* Close Dataset */
H5Dclose(dataset);
/* Create a datatype to refer to */
- tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
/* Insert fields */
- H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_STD_I32BE);
+ H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_STD_I32BE);
- H5Tinsert (tid1, "b", HOFFSET(s1_t,b), H5T_IEEE_F32BE);
+ H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_IEEE_F32BE);
- H5Tinsert (tid1, "c", HOFFSET(s1_t,c), H5T_IEEE_F32BE);
+ H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_IEEE_F32BE);
/* Save datatype for later */
- H5Tcommit (group, "Datatype1", tid1);
+ H5Tcommit(group, "Datatype1", tid1);
/* Close datatype */
H5Tclose(tid1);
@@ -1700,22 +1700,22 @@ static void gent_objref(void)
H5Gclose(group);
/* Create a dataset */
- dataset=H5Dcreate(fid1,"Dataset3",H5T_STD_REF_OBJ,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT);
/* Create reference to dataset */
- H5Rcreate(&wbuf[0],fid1,"/Group1/Dataset1",H5R_OBJECT,-1);
+ H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, -1);
/* Create reference to dataset */
- H5Rcreate(&wbuf[1],fid1,"/Group1/Dataset2",H5R_OBJECT,-1);
+ H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1);
/* Create reference to group */
- H5Rcreate(&wbuf[2],fid1,"/Group1",H5R_OBJECT,-1);
+ H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, -1);
/* Create reference to named datatype */
- H5Rcreate(&wbuf[3],fid1,"/Group1/Datatype1",H5R_OBJECT,-1);
+ H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1);
/* Write selection to disk */
- H5Dwrite(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/* Close disk dataspace */
H5Sclose(sid1);
@@ -1730,7 +1730,6 @@ static void gent_objref(void)
free(wbuf);
free(rbuf);
free(tbuf);
-
}
static void gent_datareg(void)
@@ -2870,7 +2869,8 @@ static void gent_empty(void)
assert(ret>=0);
}
-static void gent_group_comments(void)
+static void
+gent_group_comments(void)
{
hid_t fid, group;
@@ -2878,51 +2878,51 @@ static void gent_group_comments(void)
/* / */
group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g1", "Comment for group /g1");
+ H5Oset_comment(group, "/g1", "Comment for group /g1", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g2", "Comment for group /g2");
+ H5Oset_comment(group, "/g2", "Comment for group /g2", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g3", "Comment for group /g3");
+ H5Oset_comment(group, "/g3", "Comment for group /g3", H5P_DEFAULT);
H5Gclose(group);
/* /g1 */
group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g1/g1.1", "Comment for group /g1/g1.1");
+ H5Oset_comment(group, "/g1/g1.1", "Comment for group /g1/g1.1", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g1/g1.2", "Comment for group /g1/g1.2");
+ H5Oset_comment(group, "/g1/g1.2", "Comment for group /g1/g1.2", H5P_DEFAULT);
H5Gclose(group);
/* /g2 */
group = H5Gcreate2(fid, "/g2/g2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g2/g2.1", "Comment for group /g2/g2.1");
+ H5Oset_comment(group, "/g2/g2.1", "Comment for group /g2/g2.1", H5P_DEFAULT);
H5Gclose(group);
/* /g3 */
group = H5Gcreate2(fid, "/g3/g3.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g3/g3.1", "Comment for group /g3/g3.1");
+ H5Oset_comment(group, "/g3/g3.1", "Comment for group /g3/g3.1", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g3/g3.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g3/g3.2", "Comment for group /g3/g3.2");
+ H5Oset_comment(group, "/g3/g3.2", "Comment for group /g3/g3.2", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g3/g3.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g3/g3.3", "Comment for group /g3/g3.3");
+ H5Oset_comment(group, "/g3/g3.3", "Comment for group /g3/g3.3", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g3/g3.4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g3/g3.4", "Comment for group /g3/g3.4");
+ H5Oset_comment(group, "/g3/g3.4", "Comment for group /g3/g3.4", H5P_DEFAULT);
H5Gclose(group);
/* /g2/g2.1 */
group = H5Gcreate2(fid, "/g2/g2.1/g2.1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g2/g2.1/g2.1.1", "Comment for group /g2/g2.1/g2.1.1");
+ H5Oset_comment(group, "/g2/g2.1/g2.1.1", "Comment for group /g2/g2.1/g2.1.1", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g2/g2.1/g2.1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g2/g2.1/g2.1.2", "Comment for group /g2/g2.1/g2.1.2");
+ H5Oset_comment(group, "/g2/g2.1/g2.1.2", "Comment for group /g2/g2.1/g2.1.2", H5P_DEFAULT);
H5Gclose(group);
group = H5Gcreate2(fid, "/g2/g2.1/g2.1.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gset_comment(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3");
+ H5Oset_comment(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3", H5P_DEFAULT);
H5Gclose(group);
H5Fclose(fid);
@@ -4654,8 +4654,8 @@ static void gent_filters(void)
ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1);
assert(ret>=0);
- ret=H5Gset_comment(fid,"compact", "This is a dataset with compact storage");
- assert(ret>=0);
+ ret = H5Oset_comment(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT);
+ assert(ret >= 0);
ret=H5Pset_layout(dcpl, H5D_CONTIGUOUS);
assert(ret>=0);
@@ -4663,8 +4663,8 @@ static void gent_filters(void)
ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1);
assert(ret>=0);
- ret=H5Gset_comment(fid,"contiguous", "This is a dataset with contiguous storage");
- assert(ret>=0);
+ ret = H5Oset_comment(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT);
+ assert(ret >= 0);
ret=H5Pset_layout(dcpl, H5D_CHUNKED);
assert(ret>=0);
@@ -4675,8 +4675,8 @@ static void gent_filters(void)
ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1);
assert(ret>=0);
- ret=H5Gset_comment(fid,"chunked", "This is a dataset with chunked storage");
- assert(ret>=0);
+ ret = H5Oset_comment(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT);
+ assert(ret >= 0);
/*-------------------------------------------------------------------------
* make several dataset with filters
@@ -4906,8 +4906,8 @@ static void gent_filters(void)
ret=H5Tcommit(fid, "mytype", tid);
assert(ret>=0);
- ret=H5Gset_comment(fid,"mytype", "This is a commited datatype");
- assert(ret>=0);
+ ret = H5Oset_comment(fid, "mytype", "This is a commited datatype", H5P_DEFAULT);
+ assert(ret >= 0);
ret=H5Tclose(tid);
assert(ret>=0);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index f127f3f..9dce3f9 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1894,40 +1894,42 @@ list (hid_t group, const char *name, void *_iter)
/* Show detailed information about the object, beginning with information
* which is common to all objects. */
- if (verbose_g>0 && H5G_LINK!=sb.type && H5G_UDLINK!=sb.type) {
- if (sb.type>=0)
+ if(verbose_g > 0 && H5G_LINK != sb.type && H5G_UDLINK != sb.type) {
+ if(sb.type >= 0)
H5Aiterate(obj, NULL, list_attr, NULL);
printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", sb.fileno[0], objno);
printf(" %-10s %u\n", "Links:", sb.nlink);
- if (sb.mtime>0) {
- if (simple_output_g) tm=gmtime(&(sb.mtime));
- else tm=localtime(&(sb.mtime));
- if (tm) {
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
+ if(sb.mtime > 0) {
+ if(simple_output_g)
+ tm = HDgmtime(&(sb.mtime));
+ else
+ tm = HDlocaltime(&(sb.mtime));
+ if(tm) {
+ HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
printf(" %-10s %s\n", "Modified:", buf);
- }
- }
+ } /* end if */
+ } /* end if */
comment[0] = '\0';
- H5Gget_comment(group, name, sizeof(comment), comment);
- strcpy(comment+sizeof(comment)-4, "...");
- if (comment[0]) {
+ H5Oget_comment(group, name, comment, sizeof(comment), H5P_DEFAULT);
+ HDstrcpy(comment + sizeof(comment) - 4, "...");
+ if(comment[0]) {
printf(" %-10s \"", "Comment:");
display_string(stdout, comment, FALSE);
puts("\"");
- }
- }
- if (sb.type>=0 && dispatch_g[sb.type].list2) {
+ } /* end if */
+ } /* end if */
+ if(sb.type>=0 && dispatch_g[sb.type].list2)
(dispatch_g[sb.type].list2)(obj, fullname);
- }
- /* Close the object. */
done:
- if (sb.type>=0 && obj>=0 && dispatch_g[sb.type].close) {
+ /* Close the object. */
+ if(sb.type >= 0 && obj >= 0 && dispatch_g[sb.type].close)
(dispatch_g[sb.type].close)(obj);
- }
- if (fullname) free(fullname);
+
+ if (fullname)
+ free(fullname);
return 0;
-}
+} /* end list() */
/*-------------------------------------------------------------------------