diff options
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 448 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 74 |
2 files changed, 257 insertions, 265 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ac4c1d2..ec89210 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -28,10 +28,12 @@ const char *progname = "h5dump"; /* Macros for displaying objects */ #define begin_obj(obj,name,begin) \ - if (name) \ - printf("%s \"%s\" %s\n", (obj), (name), (begin)); \ - else \ - printf("%s %s\n", (obj), (begin)); + do { \ + if (name) \ + printf("%s \"%s\" %s\n", (obj), (name), (begin)); \ + else \ + printf("%s %s\n", (obj), (begin)); \ + } while(0); #define end_obj(obj,end) \ if(HDstrlen(end)) { \ @@ -1294,99 +1296,95 @@ dump_selected_attr(hid_t loc_id, const char *name) dump_header_format->attributeblockbegin); H5Gget_objinfo(loc_id, obj_name, FALSE, &statbuf); - switch (statbuf.type) { - case H5G_GROUP: - if ((oid = H5Gopen(loc_id, obj_name)) < 0) { - indentation(COL); - error_msg(progname, "unable to open group \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } - break; + switch(statbuf.type) { + case H5G_GROUP: + if((oid = H5Gopen2(loc_id, obj_name, H5P_DEFAULT)) < 0) { + indentation(COL); + error_msg(progname, "unable to open group \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - case H5G_DATASET: - if ((oid = H5Dopen(loc_id, obj_name)) < 0) { - indentation(COL); - error_msg(progname, "unable to open dataset \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } - break; + case H5G_DATASET: + if((oid = H5Dopen(loc_id, obj_name)) < 0) { + indentation(COL); + error_msg(progname, "unable to open dataset \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - case H5G_TYPE: - if ((oid = H5Topen(loc_id, obj_name)) < 0) { - indentation(COL); - error_msg(progname, "unable to open datatype \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } - break; + case H5G_TYPE: + if((oid = H5Topen(loc_id, obj_name)) < 0) { + indentation(COL); + error_msg(progname, "unable to open datatype \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - default: - indentation(COL); - error_msg(progname, "unable to open unknown \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } + default: + indentation(COL); + error_msg(progname, "unable to open unknown \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end switch */ - if ((attr_id = H5Aopen_name(oid, attr_name)) >= 0) { - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - dump_datatype(type); - dump_dataspace(space); + if((attr_id = H5Aopen_name(oid, attr_name)) >= 0) { + type = H5Aget_type(attr_id); + space = H5Aget_space(attr_id); + dump_datatype(type); + dump_dataspace(space); - if (display_oid) - dump_oid(attr_id); + if(display_oid) + dump_oid(attr_id); - if (display_data || display_attr_data) - dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); + if(display_data || display_attr_data) + dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); - end_obj(dump_header_format->attributeend, + H5Tclose(type); + H5Sclose(space); + H5Aclose(attr_id); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); } else { - indentation(COL); + indentation(COL); error_msg(progname, "unable to open attribute \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - } - - switch (statbuf.type) { - case H5G_GROUP: - if (H5Gclose(oid) < 0) { + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); d_status = EXIT_FAILURE; - return FAIL; } - break; - case H5G_DATASET: - if (H5Dclose(oid) < 0) { - d_status = EXIT_FAILURE; - return FAIL; - } - break; + switch(statbuf.type) { + case H5G_GROUP: + if(H5Gclose(oid) < 0) { + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - case H5G_TYPE: - if (H5Tclose(oid) < 0) { - d_status = EXIT_FAILURE; - return FAIL; - } - break; - default: - d_status = EXIT_FAILURE; - return FAIL; - } + case H5G_DATASET: + if(H5Dclose(oid) < 0) { + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; + + case H5G_TYPE: + if(H5Tclose(oid) < 0) { + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; + + default: + d_status = EXIT_FAILURE; + return FAIL; + } /* end switch */ free(obj_name); return SUCCEED; @@ -1542,130 +1540,124 @@ dump_all(hid_t group, const char *name, void * op_data) break; } case H5G_UDLINK: - { indentation(indent); switch(linfo.type) { - case H5L_TYPE_EXTERNAL: - { - char *targbuf; - - targbuf = HDmalloc(statbuf.linklen); - HDassert(targbuf); - if(!doxml) { - begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin); - } /* end if */ + case H5L_TYPE_EXTERNAL: + { + char *targbuf; - if(H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) { - error_msg(progname, "unable to get external link value\n"); - d_status = EXIT_FAILURE; - ret = FAIL; - } else { - const char *filename; - const char *targname; + targbuf = HDmalloc(statbuf.linklen); + HDassert(targbuf); + if(!doxml) + begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin); - if(H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &targname) < 0) { - error_msg(progname, "unable to unpack external link value\n"); - d_status = EXIT_FAILURE; - ret = FAIL; + if(H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) { + error_msg(progname, "unable to get external link value\n"); + d_status = EXIT_FAILURE; + ret = FAIL; } else { - if (!doxml) { - indentation(indent + COL); - printf("LINKCLASS %d\n", linfo.type); - indentation(indent + COL); - printf("TARGETFILE \"%s\"\n", filename); - indentation(indent + COL); - printf("TARGETPATH \"%s\"\n", targname); - } - else /* XML */ - { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_filename = xml_escape_the_name(filename); - char *t_targname = xml_escape_the_name(targname); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - printf("<%sExternalLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetFilename=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - filename, /* TargetFilename */ - targname, /* TargetPath*/ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_filename); - HDfree(t_targname); - HDfree(t_obj_path); - } + const char *filename; + const char *targname; + + if(H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &targname) < 0) { + error_msg(progname, "unable to unpack external link value\n"); + d_status = EXIT_FAILURE; + ret = FAIL; + } else { + if (!doxml) { + indentation(indent + COL); + printf("LINKCLASS %d\n", linfo.type); + indentation(indent + COL); + printf("TARGETFILE \"%s\"\n", filename); + indentation(indent + COL); + printf("TARGETPATH \"%s\"\n", targname); + } + /* XML */ + else { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_filename = xml_escape_the_name(filename); + char *t_targname = xml_escape_the_name(targname); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + printf("<%sExternalLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetFilename=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + filename, /* TargetFilename */ + targname, /* TargetPath*/ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_filename); + HDfree(t_targname); + HDfree(t_obj_path); + } + } } - } - if (!doxml) { - end_obj(dump_header_format->extlinkend, - dump_header_format->extlinkblockend); - } - HDfree(targbuf); - } - break; + if (!doxml) + end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend); + HDfree(targbuf); + } + break; + default: if (!doxml) { - begin_obj(dump_header_format->udlinkbegin, name, - dump_header_format->udlinkblockbegin); + begin_obj(dump_header_format->udlinkbegin, name, dump_header_format->udlinkblockbegin); indentation(indent + COL); } - if (!doxml) { + if (!doxml) printf("LINKCLASS %d\n", linfo.type); - } else /* XML */ { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - printf("<%sUserDefined LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "LinkClass=\"%d\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - linfo.type, /* LinkClass */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_obj_path); + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + printf("<%sUserDefined LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "LinkClass=\"%d\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + linfo.type, /* LinkClass */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_obj_path); } if (!doxml) { indentation(indent); - end_obj(dump_header_format->udlinkend, - dump_header_format->udlinkblockend); + end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend); } } break; - } + case H5G_GROUP: - if ((obj = H5Gopen(group, name)) < 0) { + if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { error_msg(progname, "unable to dump group \"%s\"\n", name); d_status = EXIT_FAILURE; ret = FAIL; @@ -1689,7 +1681,6 @@ dump_all(hid_t group, const char *name, void * op_data) /* Close group */ H5Gclose(obj); } - break; case H5G_DATASET: @@ -3173,29 +3164,27 @@ handle_groups(hid_t fid, char *group, void UNUSED * data) { hid_t gid; - if ((gid = H5Gopen(fid, group)) < 0) { - begin_obj(dump_header_format->groupbegin, group, - dump_header_format->groupblockbegin); + if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { + begin_obj(dump_header_format->groupbegin, group, dump_header_format->groupblockbegin); indentation(COL); error_msg(progname, "unable to open group \"%s\"\n", group); - end_obj(dump_header_format->groupend, - dump_header_format->groupblockend); + end_obj(dump_header_format->groupend, dump_header_format->groupblockend); d_status = EXIT_FAILURE; } else { size_t new_len = HDstrlen(group) + 1; - if (prefix_len <= new_len) { + if(prefix_len <= new_len) { prefix_len = new_len; prefix = HDrealloc(prefix, prefix_len); - } + } /* end if */ HDstrcpy(prefix, group); dump_group(gid, group); - if (H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) d_status = EXIT_FAILURE; - } -} + } /* end else */ +} /* end handle_groups() */ /*------------------------------------------------------------------------- * Function: handle_links @@ -3797,32 +3786,31 @@ main(int argc, const char *argv[]) init_ref_path_table(fid); /* Insert the root group into the ref. path table */ H5Giterate(fid, (const char *)"/", NULL, fill_ref_path_table, (void *)""); - if (doxml) { - /* initialize XML */ + if(doxml) { + /* initialize XML */ - /* reset prefix! */ - HDstrcpy(prefix, ""); + /* reset prefix! */ + HDstrcpy(prefix, ""); - /* make sure the URI is initialized to something */ - if (xml_dtd_uri == NULL) { - if (useschema) { - xml_dtd_uri = DEFAULT_XSD; + /* make sure the URI is initialized to something */ + if (xml_dtd_uri == NULL) { + if (useschema) { + xml_dtd_uri = DEFAULT_XSD; + } else { + xml_dtd_uri = DEFAULT_DTD; + xmlnsprefix = ""; + } } else { - xml_dtd_uri = DEFAULT_DTD; - xmlnsprefix = ""; - } - } else { - if (useschema && strcmp(xmlnsprefix,"")) { - error_msg(progname, "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); - leave(EXIT_FAILURE); + if (useschema && strcmp(xmlnsprefix,"")) { + error_msg(progname, "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); + leave(EXIT_FAILURE); + } } } - } /* find all shared objects */ if(init_objs(fid, &info, &group_table, &dset_table, &type_table) < 0) { - error_msg(progname, "internal error (file %s:line %d)\n", - __FILE__, __LINE__); + error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__); d_status = EXIT_FAILURE; goto done; } @@ -3882,42 +3870,40 @@ main(int argc, const char *argv[]) dump_fcpl(fid); } - if (display_all) { - if ((gid = H5Gopen(fid, "/")) < 0) { + if(display_all) { + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { error_msg(progname, "unable to open root group\n"); d_status = EXIT_FAILURE; } else { - dump_function_table->dump_group_function(gid, "/"); + dump_function_table->dump_group_function(gid, "/"); } - if (H5Gclose(gid) < 0) { + if(H5Gclose(gid) < 0) { error_msg(progname, "unable to close root group\n"); d_status = EXIT_FAILURE; } } else { - if (doxml) { /* Note: this option is not supported for XML */ - error_msg(progname, "internal error (file %s:line %d)\n", - __FILE__, __LINE__); + if(doxml) { + error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__); d_status = EXIT_FAILURE; - goto done; - } + goto done; + } /* end if */ - for (i = 0; i < argc; i++) - if (hand[i].func) + for(i = 0; i < argc; i++) + if(hand[i].func) hand[i].func(fid, hand[i].obj, hand[i].subset_info); } if (!doxml) { - end_obj(dump_header_format->fileend, - dump_header_format->fileblockend); + end_obj(dump_header_format->fileend, dump_header_format->fileblockend); } else { - printf("</%sHDF5-File>\n", xmlnsprefix); + printf("</%sHDF5-File>\n", xmlnsprefix); } done: if (H5Fclose(fid) < 0) - d_status = EXIT_FAILURE; + d_status = EXIT_FAILURE; free_handler(hand, argc); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 321a15d..38b1f27 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -225,7 +225,8 @@ typedef struct s1_t { /* "File 51" macros */ #define F51_MAX_NAME_LEN ((64*1024)+1024) -static void gent_group(void) +static void +gent_group(void) { hid_t fid, group; @@ -270,7 +271,8 @@ static void gent_group(void) H5Fclose(fid); } -static void gent_dataset(void) +static void +gent_dataset(void) { hid_t fid, dataset, space; hsize_t dims[2]; @@ -309,7 +311,8 @@ static void gent_dataset(void) H5Fclose(fid); } -static void gent_dataset2(void) +static void +gent_dataset2(void) { hid_t fid, dataset, space, create_plist; hsize_t dims[2]; @@ -356,7 +359,8 @@ static void gent_dataset2(void) } -static void gent_attribute(void) +static void +gent_attribute(void) { hid_t fid, root, space, attr, type; hsize_t dims[2]; @@ -367,7 +371,7 @@ static void gent_attribute(void) int point = 100; fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - root = H5Gopen (fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); /* attribute 1 */ dims[0] = 24; @@ -426,7 +430,7 @@ static void gent_softlink(void) hid_t fid, root; fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - root = H5Gopen (fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); H5Glink (root, H5L_TYPE_SOFT, "somevalue", "slink1"); H5Glink (root, H5L_TYPE_SOFT, "linkvalue", "slink2"); @@ -472,7 +476,7 @@ static void gent_hardlink(void) H5Glink (group, H5L_TYPE_HARD, "/dset1", "dset3"); H5Gclose(group); - group = H5Gopen(fid, "/g1"); + group = H5Gopen2(fid, "/g1", H5P_DEFAULT); H5Glink (group, H5L_TYPE_HARD, "/g2", "g1.1"); H5Gclose(group); @@ -921,7 +925,7 @@ static void gent_all(void) H5Gclose(group); /* root attributes */ - group = H5Gopen (fid, "/"); + group = H5Gopen2(fid, "/", H5P_DEFAULT); dims[0] = 10; space = H5Screate_simple(1, dims, NULL); @@ -941,7 +945,7 @@ static void gent_all(void) H5Gclose(group); - group = H5Gopen (fid, "/g1/g1.1"); + group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT); /* dset1.1.1 */ dims[0] = 10; dims[1] = 10; @@ -988,11 +992,11 @@ static void gent_all(void) H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT); /* soft link */ - group = H5Gopen (fid, "/g1/g1.2/g1.2.1"); + group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT); H5Glink (group, H5L_TYPE_SOFT, "somevalue", "slink"); H5Gclose(group); - group = H5Gopen (fid, "/g2"); + group = H5Gopen2(fid, "/g2", H5P_DEFAULT); /* dset2.1 */ dims[0] = 10; @@ -1238,7 +1242,7 @@ static void gent_many(void) H5Sclose(space); H5Gclose(group); - group = H5Gopen(fid, "/g3"); + group = H5Gopen2(fid, "/g3", H5P_DEFAULT); H5Glink (group, H5L_TYPE_HARD, "/g4/dset2", "link3"); H5Gclose(group); @@ -1261,7 +1265,7 @@ static void gent_many(void) H5Sclose(space); H5Gclose(group); - group = H5Gopen(fid, "/g5"); + group = H5Gopen2(fid, "/g5", H5P_DEFAULT); H5Glink (group, H5L_TYPE_SOFT, "/g6/dset3", "slink4"); H5Gclose(group); H5Pclose(create_plist); @@ -2937,7 +2941,7 @@ void gent_split_file(void) fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT); fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - root = H5Gopen(fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); atype = H5Tcopy(H5T_C_S1); H5Tset_size(atype, strlen(meta) + 1); @@ -3112,7 +3116,7 @@ static void gent_vlstr(void) H5Tcommit(fid1, "vl_string_type", tid1); /* Create an group attribute of VL string type */ - root = H5Gopen(fid1, "/"); + root = H5Gopen2(fid1, "/", H5P_DEFAULT); dataspace = H5Screate(H5S_SCALAR); att = H5Acreate(root, "test_scalar", tid1, dataspace, H5P_DEFAULT); @@ -4094,7 +4098,7 @@ static void gent_attr_all(void) /* Create groups */ group_id = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); group2_id = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen(fid, "/"); + root_id = H5Gopen2(fid, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group @@ -4497,7 +4501,7 @@ static void gent_null_space(void) int point = 4; fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - root = H5Gopen (fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); /* null space */ space = H5Screate(H5S_NULL); @@ -5017,7 +5021,7 @@ static void gent_fcontents(void) /* hard link to "g2" */ - gid1 = H5Gopen(fid, "/g1"); + gid1 = H5Gopen2(fid, "/g1", H5P_DEFAULT); H5Glink (gid1, H5L_TYPE_HARD, "/g2", "g1.1"); H5Gclose(gid1); @@ -5626,7 +5630,8 @@ gent_binary(void) #define GB4LL ((unsigned long_long) 4*1024*1024*1024) #define DIM_4GB (GB4LL + 10) -static void gent_bigdims(void) +static void +gent_bigdims(void) { hid_t fid; hid_t did; @@ -5727,27 +5732,28 @@ out: * *------------------------------------------------------------------------- */ -static void gent_hyperslab(void) +static void +gent_hyperslab(void) { - hid_t fid; /* file id */ - hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */ - double *buf; - int i, ret; + hid_t fid; /* file id */ + hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */ + double *buf; + int i, ret; - buf = malloc(32 * 4097 * sizeof(double) ); - for (i = 0; i < 32 * 4097; i++) - buf[i] = 1; + buf = malloc(32 * 4097 * sizeof(double) ); + for (i = 0; i < 32 * 4097; i++) + buf[i] = 1; - /* create a file */ - fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + /* create a file */ + fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid>=0); - write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf); + write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf); - ret=H5Fclose(fid); - assert(ret>=0); + ret=H5Fclose(fid); + assert(ret>=0); - free(buf); + free(buf); } |