diff options
Diffstat (limited to 'tools')
30 files changed, 733 insertions, 733 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 64b0097..9e3b86e 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -114,7 +114,7 @@ void parse_command_line(int argc, h5diff_exit(EXIT_FAILURE); } options->delta = atof( opt_arg ); - + /* -d 0 is the same as default */ if (options->delta == 0) options->d=0; @@ -227,8 +227,8 @@ void parse_command_line(int argc, printf("--------------------------------\n"); printf("Use -c for a list of objects.\n"); } - - + + } } @@ -378,7 +378,7 @@ void usage(void) printf(" DBL_EPSILON = 2.22045E-16 for double\n"); printf(" -d, -p, and --use-system-epsilon options are used for comparing floating point values.\n"); - printf(" By default, strict equality is used. Use -p or -d to set specific tolerance.\n"); + printf(" By default, strict equality is used. Use -p or -d to set specific tolerance.\n"); printf("\n"); printf(" Modes of output:\n"); diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index cae79b6..e4f9691 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -334,7 +334,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) } /*------------------------------------------------------------------------ - * INFINITY values + * INFINITY values *------------------------------------------------------------------------ */ { @@ -2385,7 +2385,7 @@ void write_dset_in(hid_t loc_id, n = 0; for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) + for(j = 0; j < 2; j++) { buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; @@ -2431,7 +2431,7 @@ void write_dset_in(hid_t loc_id, */ - if (make_diffs) + if (make_diffs) { memset(buf72, 0, sizeof buf72); memset(buf82, 0, sizeof buf82); @@ -2501,13 +2501,13 @@ void write_dset_in(hid_t loc_id, n=1; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) + for (k = 0; k < 2; k++) { - if (make_diffs) + if (make_diffs) buf23[i][j][k]=0; else buf23[i][j][k]=n++; } @@ -2534,13 +2534,13 @@ void write_dset_in(hid_t loc_id, */ n=1; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) + for (k = 0; k < 2; k++) { - if (make_diffs) + if (make_diffs) { buf33[i][j][k].a=0; buf33[i][j][k].b=0; @@ -2598,7 +2598,7 @@ void write_dset_in(hid_t loc_id, { for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) + for(k = 0; k < 2; k++) { buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 0f25efe..3af66ee 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -717,7 +717,7 @@ usage(const char *prog) /*------------------------------------------------------------------------- * Function: table_list_add * - * Purpose: Add a new set of tables + * Purpose: Add a new set of tables * * Return: index of added table on success, -1 on failure * @@ -1191,17 +1191,17 @@ print_datatype(hid_t type,unsigned in_group) case H5T_REFERENCE: printf("H5T_REFERENCE"); - /* The BNF document states that the type of reference should be - * displayed after "H5T_REFERENCE". Therefore add the missing - * reference type if the region command line option is used. This + /* The BNF document states that the type of reference should be + * displayed after "H5T_REFERENCE". Therefore add the missing + * reference type if the region command line option is used. This * reference type will not be displayed if the region option is not used. */ if(display_region) { if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { printf(" { H5T_STD_REF_DSETREG }"); - } + } else { printf(" { H5T_STD_REF_OBJECT }"); - } + } } break; @@ -2500,14 +2500,14 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth); H5Tclose(f_type); - } + } else { /* need to call h5tools_dump_mem for the attribute data */ space = H5Aget_space(obj_id); space_type = H5Sget_simple_extent_type(space); if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) { status = SUCCEED; - } + } else { char string_prefix[64]; h5tool_format_t string_dataformat; @@ -3278,7 +3278,7 @@ set_binary_form(const char *form) int bform=-1; if (strcmp(form,"NATIVE")==0 || - strcmp(form,"MEMORY")==0) + strcmp(form,"MEMORY")==0) {/* native form */ bform = 0; } @@ -4384,7 +4384,7 @@ main(int argc, const char *argv[]) d_status = EXIT_FAILURE; goto done; } - + /* Initialize object tables */ if(table_list_add(fid, oi.fileno) < 0) { error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index ddee2c3..f8c7d11 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -247,7 +247,7 @@ typedef struct s1_t { /* File 65 macros */ #define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ -#define THRESHOLD10 10 /* Free space section threshold */ +#define THRESHOLD10 10 /* Free space section threshold */ static void gent_group(void) diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index e9e7dac..24428cb 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -766,7 +766,7 @@ readFloatData(FILE **strm, struct Input *in) /* same as TEXTFP */ case 2: /*TEXTFPE */ - + for (i = 0; i < len; i++, fp32++) { if (fscanf(*strm, "%f", fp32) != 1) @@ -775,7 +775,7 @@ readFloatData(FILE **strm, struct Input *in) return (-1); } } - + fp32 = (H5DT_FLOAT32 *) in->data; break; @@ -815,7 +815,7 @@ readFloatData(FILE **strm, struct Input *in) /* same as TEXTFP */ case 2: /*TEXTFPE */ - + for (i = 0; i < len; i++, fp64++) { if (fscanf(*strm, "%lf", fp64) != 1) @@ -824,7 +824,7 @@ readFloatData(FILE **strm, struct Input *in) return (-1); } } - + fp64 = (H5DT_FLOAT64 *) in->data; break; @@ -1437,7 +1437,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[COMPRESS] == 0) in->compressionType = 0; - + break; case 12: /* EXTERNAL-STORAGE */ @@ -1587,16 +1587,16 @@ static int parsePathInfo(struct path_info *path, char *temp) { const char delimiter[] = "/"; - char *token; + char *token; int i=0; const char *err1 = "Path string larger than MAX_PATH_NAME_LENGTH.\n"; token = HDstrtok (temp, delimiter); - if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) + if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) { (void) fprintf(stderr, err1); return (-1); - } + } HDstrcpy(path->group[i++],token); @@ -1609,7 +1609,7 @@ parsePathInfo(struct path_info *path, char *temp) { (void) fprintf(stderr, err1); return (-1); - } + } HDstrcpy(path->group[i++],token); } path->count = i; @@ -1621,7 +1621,7 @@ parseDimensions(struct Input *in, char *strm) { const char delimiter[] = ","; char temp[255]; - char *token; + char *token; int i=0; const char *err1 = "Unable to allocate dynamic memory.\n"; diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index cbc6bf2..9e4f6e8 100755 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h @@ -38,7 +38,7 @@ #define ERR 20 /* invalid token */ #define MAX_GROUPS_IN_PATH 20 -#define MAX_PATH_NAME_LENGTH 255 +#define MAX_PATH_NAME_LENGTH 255 #define NUM_KEYS 14 #define MIN_NUM_DIMENSION 1 #define MAX_NUM_DIMENSION 32 diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 96d113e..ec79215 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -345,7 +345,7 @@ create_textfile(const char *name, size_t size) HDwrite(fd, buf, size); - free(buf); + free(buf); HDclose(fd); } diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 9bc0448..c969670 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1544,7 +1544,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) printf(" %-10s ", "Storage:"); switch (tclass) { - + case H5T_VLEN: printf("information not available"); break; @@ -1555,20 +1555,20 @@ dataset_list2(hid_t dset, const char UNUSED *name) printf("information not available"); } break; - + default: printf("%lu logical byte%s, %lu allocated byte%s", (unsigned long)total, 1==total?"":"s", (unsigned long)used, 1==used?"":"s"); - if (used>0) + if (used>0) { utilization = (total*100.0)/used; printf(", %1.2f%% utilization", utilization); } - + } - - + + putchar('\n'); /* Print information about external strorage */ @@ -1937,7 +1937,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) hbool_t orig_grp_literal = grp_literal_g; HDfputc(' ', stdout); - + /* Check if we have already seen this elink */ if(elink_trav_visited(iter->elink_list, filename, path)) { HDfputs("{Already Visited}\n", stdout); @@ -2028,7 +2028,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) } /* end if */ /* Delay specifying the name start point so the original object name is - * displayed if it is a link or non-group object */ + * displayed if it is a link or non-group object */ iter->name_start = iter->base_len; /* Specified name is a group. List the complete contents of the group. */ @@ -2420,7 +2420,7 @@ main(int argc, const char *argv[]) } *x = '\0'; /* Delay specifying the name start point so the original object name - * is displayed if it is a link or non-group object */ + * is displayed if it is a link or non-group object */ iter.name_start = 1; } if(!oname || !*oname) { diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 473090f..db0b158 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -90,7 +90,7 @@ int h5repack(const char* infile, *------------------------------------------------------------------------- */ -int +int h5repack_init(pack_opt_t *options, int verbose, H5F_file_space_type_t strategy, hsize_t threshold) { int k, n; @@ -271,7 +271,7 @@ static int check_options(pack_opt_t *options) if (options->verbose && have_request(options) /* only print if requested */) { printf("Objects to modify layout are...\n"); - if (options->all_layout==1) + if (options->all_layout==1) { switch (options->layout_g) { @@ -293,7 +293,7 @@ static int check_options(pack_opt_t *options) return -1; } printf(" Apply %s layout to all\n", slayout); - if (H5D_CHUNKED==options->layout_g) + if (H5D_CHUNKED==options->layout_g) { printf("with dimension ["); for ( j = 0; j < options->chunk_g.rank; j++) @@ -399,24 +399,24 @@ static int check_options(pack_opt_t *options) *------------------------------------------------------------------------- */ - if (options->grp_compact < 0) + if (options->grp_compact < 0) { error_msg(progname, "invalid maximum number of links to store as header messages\n"); return -1; } - if (options->grp_indexed < 0) + if (options->grp_indexed < 0) { error_msg(progname, "invalid minimum number of links to store in the indexed format\n"); return -1; } - if (options->grp_indexed > options->grp_compact) + if (options->grp_indexed > options->grp_compact) { error_msg(progname, "minimum indexed size is greater than the maximum compact size\n"); return -1; } - for (i=0; i<8; i++) + for (i=0; i<8; i++) { - if (options->msg_size[i]<0) + if (options->msg_size[i]<0) { error_msg(progname, "invalid shared message size\n"); return -1; @@ -516,14 +516,14 @@ static int check_objects(const char* fname, if(options->verbose) printf("Opening file <%s>. Searching for objects to modify...\n", fname); - for(i = 0; i < options->op_tbl->nelems; i++) + for(i = 0; i < options->op_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; if(options->verbose) printf(" <%s>",name); /* the input object names are present in the file and are valid */ - if(h5trav_getindext(name, travt) < 0) + if(h5trav_getindext(name, travt) < 0) { error_msg(progname, "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose?"\n":""),name,fname); @@ -533,7 +533,7 @@ static int check_objects(const char* fname, printf("...Found\n"); /* check for extra filter conditions */ - switch(options->op_tbl->objs[i].filter->filtn) + switch(options->op_tbl->objs[i].filter->filtn) { /* chunk size must be smaller than pixels per block */ case H5Z_FILTER_SZIP: diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 16f438c..4a35dd1 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -102,11 +102,11 @@ typedef struct { H5D_layout_t layout_g; /*global layout information for the ALL case */ int verbose; /*verbose mode */ hsize_t min_comp; /*minimum size to compress, in bytes */ - int use_native; /*use a native type in write */ + int use_native; /*use a native type in write */ int latest; /*pack file with the latest file format */ int grp_compact; /* Set the maximum number of links to store as header messages in the group */ int grp_indexed; /* Set the minimum number of links to store in the indexed format */ - int msg_size[8]; /* Minimum size of shared messages: dataspace, + int msg_size[8]; /* Minimum size of shared messages: dataspace, datatype, fill value, filter pipleline, attribute */ const char *ublock_filename; /* user block file name */ hsize_t ublock_size; /* user block size */ @@ -160,7 +160,7 @@ int copy_objects (const char* fnamein, int do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options); + pack_opt_t *options); /*------------------------------------------------------------------------- * filters and verify module diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 77c03d2..f95db63 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -55,7 +55,7 @@ static hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named trav_table_t *travt, pack_opt_t *options); static int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err); static int copy_user_block(const char *infile, const char *outfile, hsize_t size); -#if defined (H5REPACK_DEBUG_USER_BLOCK) +#if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif @@ -98,7 +98,7 @@ int copy_objects(const char* fnamein, * open input file *------------------------------------------------------------------------- */ - if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { error_msg(progname, "<%s>: %s\n", fnamein, H5FOPENERROR ); goto out; @@ -108,17 +108,17 @@ int copy_objects(const char* fnamein, { hid_t fcpl_in; /* file creation property list ID for input file */ - if((fcpl_in = H5Fget_create_plist(fidin)) < 0) + if((fcpl_in = H5Fget_create_plist(fidin)) < 0) { error_msg(progname, "failed to retrieve file creation property list\n"); goto out; - } + } - if(H5Pget_userblock(fcpl_in, &ub_size) < 0) + if(H5Pget_userblock(fcpl_in, &ub_size) < 0) { error_msg(progname, "failed to retrieve userblock size\n"); goto out; - } + } if(!options->fs_strategy) { @@ -138,49 +138,49 @@ int copy_objects(const char* fnamein, } } - if(H5Pclose(fcpl_in) < 0) + if(H5Pclose(fcpl_in) < 0) { error_msg(progname, "failed to close property list\n"); goto out; - } - } + } + } /* Check if we need to create a non-default file creation property list */ - if(options->latest || ub_size > 0) + if(options->latest || ub_size > 0) { /* Create file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg(progname, "fail to create a file creation property list\n"); goto out; - } + } if(ub_size > 0) { - if(H5Pset_userblock(fcpl, ub_size) < 0) + if(H5Pset_userblock(fcpl, ub_size) < 0) { error_msg(progname, "failed to set non-default userblock size\n"); goto out; - } + } } - if(options->latest) + if(options->latest) { unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; /* Adjust group creation parameters for root group */ /* (So that it is created in "dense storage" form) */ - if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) + if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) { error_msg(progname, "fail to adjust group creation parameters for root group\n"); goto out; - } + } - for(i = 0; i < 5; i++) + for(i = 0; i < 5; i++) { - if(options->msg_size[i] > 0) + if(options->msg_size[i] > 0) { - switch(i) + switch(i) { case 0: mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; @@ -210,16 +210,16 @@ int copy_objects(const char* fnamein, } /* end if */ } /* end for */ - if(nindex > 0) + if(nindex > 0) { - if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) + if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { error_msg(progname, "fail to set the number of shared object header message indexes\n"); goto out; - } + } /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ - for(i = 0; i < (nindex - 1); i++) + for(i = 0; i < (nindex - 1); i++) { if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) { error_msg(progname, "fail to configure the specified shared object header message index\n"); @@ -229,13 +229,13 @@ int copy_objects(const char* fnamein, } /* if (nindex>0) */ /* Create file access property list */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg(progname, "Could not create file access property list\n"); goto out; } /* end if */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { error_msg(progname, "Could not set property for using latest version of the format\n"); goto out; @@ -246,7 +246,7 @@ int copy_objects(const char* fnamein, -#if defined (H5REPACK_DEBUG_USER_BLOCK) +#if defined (H5REPACK_DEBUG_USER_BLOCK) print_user_block(fnamein,fidin); #endif @@ -262,11 +262,11 @@ int copy_objects(const char* fnamein, if(fcpl != H5P_DEFAULT) { /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) + if(H5Pset_userblock(fcpl, options->ublock_size) < 0) { error_msg(progname, "failed to set userblock size\n"); goto out; - } + } } @@ -274,18 +274,18 @@ int copy_objects(const char* fnamein, { /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg(progname, "fail to create a file creation property list\n"); goto out; - } + } /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) + if(H5Pset_userblock(fcpl, options->ublock_size) < 0) { error_msg(progname, "failed to set userblock size\n"); goto out; - } + } } @@ -318,11 +318,11 @@ int copy_objects(const char* fnamein, { /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg(progname, "Could not create file access property list\n"); goto out; - } + } if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { @@ -330,7 +330,7 @@ int copy_objects(const char* fnamein, goto out; } - } + } } @@ -338,27 +338,27 @@ int copy_objects(const char* fnamein, if(fcpl != H5P_DEFAULT) { /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) + if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { error_msg(progname, "failed to set file space strategy & threshold\n"); goto out; - } + } } else { /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg(progname, "fail to create a file creation property list\n"); goto out; - } + } /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) + if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { error_msg(progname, "failed to set file space strategy & threshold \n"); goto out; - } + } } /*------------------------------------------------------------------------- @@ -371,11 +371,11 @@ int copy_objects(const char* fnamein, printf("Making file <%s>...\n",fnameout); - if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) + if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) { error_msg(progname, "<%s>: Could not create file\n", fnameout ); goto out; - } + } /*------------------------------------------------------------------------- @@ -383,7 +383,7 @@ int copy_objects(const char* fnamein, *------------------------------------------------------------------------- */ if ( options->ublock_size > 0 ) - { + { if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 ) { error_msg(progname, "Could not copy user block. Exiting...\n"); @@ -408,7 +408,7 @@ int copy_objects(const char* fnamein, * do the copy *------------------------------------------------------------------------- */ - if(do_copy_objects(fidin, fidout, travt, options) < 0) + if(do_copy_objects(fidin, fidout, travt, options) < 0) { error_msg(progname, "<%s>: Could not copy data to: %s\n", fnamein, fnameout); goto out; @@ -419,11 +419,11 @@ int copy_objects(const char* fnamein, * and create hard links *------------------------------------------------------------------------- */ - if ( do_copy_refobjs(fidin, fidout, travt, options) < 0 ) + if ( do_copy_refobjs(fidin, fidout, travt, options) < 0 ) { printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); goto out; - } + } /*------------------------------------------------------------------------- * close @@ -466,7 +466,7 @@ int copy_objects(const char* fnamein, */ out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(fapl); H5Pclose(fcpl); @@ -490,7 +490,7 @@ out: * * Date: October, 23, 2003 * -* Modifications: +* Modifications: * * July 2004: Introduced the extra EC or NN option for SZIP * @@ -502,47 +502,47 @@ out: * October 2006: Read by hyperslabs for big datasets. * * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done -* i.e., if the memory needed to read a dataset is greater than this limit, -* then hyperslab I/O is done instead of one operation I/O +* i.e., if the memory needed to read a dataset is greater than this limit, +* then hyperslab I/O is done instead of one operation I/O * For each dataset, the memory needed is calculated according to * * memory needed = number of elements * size of each element * -* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations +* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations * are done * * H5Dread( input_dataset1 ) * H5Dread( input_dataset2 ) * -* with all elements in the datasets selected. If the memory needed is greater than +* with all elements in the datasets selected. If the memory needed is greater than * H5TOOLS_MALLOCSIZE, then the following operations are done instead: * -* a strip mine is defined for each dimension k (a strip mine is defined as a +* a strip mine is defined for each dimension k (a strip mine is defined as a * hyperslab whose size is memory manageable) according to the formula * * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) * -* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures -* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip -* mine size k is simply defined as its dimension k, but for larger datasets the +* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures +* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip +* mine size k is simply defined as its dimension k, but for larger datasets the * hyperslab size is still memory manageable. -* a cycle is done until the number of elements in the dataset is reached. In each -* iteration, two parameters are defined for the function H5Sselect_hyperslab, +* a cycle is done until the number of elements in the dataset is reached. In each +* iteration, two parameters are defined for the function H5Sselect_hyperslab, * the start and size of each hyperslab, according to * * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) * -* where hyperslab_offset [k] is initially set to zero, and later incremented in -* hyperslab_size[k] offsets. The reason for the operation +* where hyperslab_offset [k] is initially set to zero, and later incremented in +* hyperslab_size[k] offsets. The reason for the operation * * dimension[k] - hyperslab_offset[k] * -* in (2) is that, when using the strip mine size, it assures that the "remaining" part +* in (2) is that, when using the strip mine size, it assures that the "remaining" part * of the dataset that does not fill an entire strip mine is processed. * -* November 2006: Use H5Ocopy in the copy of objects. The logic for using -* H5Ocopy or not is if a change of filters or layout is requested by the user -* then use read/write else use H5Ocopy. +* November 2006: Use H5Ocopy in the copy of objects. The logic for using +* H5Ocopy or not is if a change of filters or layout is requested by the user +* then use read/write else use H5Ocopy. * * May, 1, 2008: Add a printing of the compression ratio of old size / new size * @@ -591,18 +591,18 @@ int do_copy_objects(hid_t fidin, *------------------------------------------------------------------------- */ - if (options->verbose) + if (options->verbose) { printf("-----------------------------------------\n"); printf(" Type Filter (Compression) Name\n"); printf("-----------------------------------------\n"); } - for ( i = 0; i < travt->nobjs; i++) + for ( i = 0; i < travt->nobjs; i++) { buf = NULL; - switch ( travt->objs[i].type ) + switch ( travt->objs[i].type ) { case H5TRAV_TYPE_UNKNOWN: @@ -644,7 +644,7 @@ int do_copy_objects(hid_t fidin, * and copy its attributes using that ID *------------------------------------------------------------------------- */ - if(HDstrcmp(travt->objs[i].name, "/") == 0) + if(HDstrcmp(travt->objs[i].name, "/") == 0) { if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) goto error; @@ -653,7 +653,7 @@ int do_copy_objects(hid_t fidin, else { - if (options->grp_compact>0 || options->grp_indexed>0) + if (options->grp_compact>0 || options->grp_indexed>0) { if(H5Pset_link_phase_change(gcpl_out, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) goto error; @@ -699,7 +699,7 @@ int do_copy_objects(hid_t fidin, /* check if filters were requested for individual objects */ for( u = 0; u < options->op_tbl->nelems; u++) { - int k; + int k; for( k = 0; k < options->op_tbl->objs[u].nfilters; k++) { @@ -740,11 +740,11 @@ int do_copy_objects(hid_t fidin, * otherwise we do a copy using H5Ocopy *------------------------------------------------------------------------- */ - if ( options->op_tbl->nelems || - options->all_filter == 1 || - options->all_layout == 1 || + if ( options->op_tbl->nelems || + options->all_filter == 1 || + options->all_layout == 1 || is_ref || - is_named) + is_named) { int j; @@ -809,7 +809,7 @@ int do_copy_objects(hid_t fidin, apply_s=0; /* apply the filter */ - if (apply_s) + if (apply_s) { if (apply_filters(travt->objs[i].name, rank, @@ -831,7 +831,7 @@ int do_copy_objects(hid_t fidin, dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); } H5E_END_TRY; - if(dset_out == FAIL) + if(dset_out == FAIL) { if(options->verbose) printf(" warning: could not create dataset <%s>. Applying original settings\n", @@ -858,7 +858,7 @@ int do_copy_objects(hid_t fidin, goto error; if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) goto error; - } + } else /* possibly not enough memory, read/write by hyperslabs */ { @@ -879,7 +879,7 @@ int do_copy_objects(hid_t fidin, hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ hsize_t hs_nelmts; /*elements in request */ hsize_t zero[8]; /*vector of zeros */ - int k; + int k; /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) @@ -891,7 +891,7 @@ int do_copy_objects(hid_t fidin, */ sm_nbytes = p_type_nbytes; - for (k = rank; k > 0; --k) + for (k = rank; k > 0; --k) { hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ @@ -909,12 +909,12 @@ int do_copy_objects(hid_t fidin, memset(hs_offset, 0, sizeof hs_offset); memset(zero, 0, sizeof zero); - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ - if (rank > 0) + if (rank > 0) { - for (k = 0, hs_nelmts = 1; k < rank; k++) + for (k = 0, hs_nelmts = 1; k < rank; k++) { hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); hs_nelmts *= hs_size[k]; @@ -924,8 +924,8 @@ int do_copy_objects(hid_t fidin, goto error; if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) goto error; - } - else + } + else { H5Sselect_all(f_space_id); H5Sselect_all(sm_space); @@ -933,9 +933,9 @@ int do_copy_objects(hid_t fidin, } /* rank */ /* read/write */ - if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) goto error; - if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) goto error; /* reclaim any VL memory, if necessary */ @@ -943,7 +943,7 @@ int do_copy_objects(hid_t fidin, H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); /* calculate the next hyperslab offset */ - for (k = rank, carry = 1; k > 0 && carry; --k) + for (k = rank, carry = 1; k > 0 && carry; --k) { hs_offset[k - 1] += hs_size[k - 1]; if (hs_offset[k - 1] == dims[k - 1]) @@ -967,7 +967,7 @@ int do_copy_objects(hid_t fidin, * amount of compression used *------------------------------------------------------------------------- */ - if (options->verbose) + if (options->verbose) { double ratio=0; @@ -986,7 +986,7 @@ int do_copy_objects(hid_t fidin, else print_dataset_info(dcpl_id,travt->objs[i].name,ratio,0); - /* print a message that the filter was not applied + /* print a message that the filter was not applied (in case there was a filter) */ if ( has_filter && apply_s == 0 ) @@ -1037,16 +1037,16 @@ int do_copy_objects(hid_t fidin, * we do not have request for filter/chunking use H5Ocopy instead *------------------------------------------------------------------------- */ - else + else { hid_t pid; /* create property to pass copy options */ - if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) goto error; /* set options for object copy */ - if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) goto error; /*------------------------------------------------------------------------- @@ -1059,7 +1059,7 @@ int do_copy_objects(hid_t fidin, fidout, /* Destination file or group identifier */ travt->objs[i].name, /* Name of the destination object */ pid, /* Properties which apply to the copy */ - H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ + H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ goto error; /* close property */ @@ -1320,7 +1320,7 @@ int copy_attr(hid_t loc_in, { ; } - else + else { /*------------------------------------------------------------------------- * read to memory @@ -1626,13 +1626,13 @@ error: /*------------------------------------------------------------------------- -* Function: copy_user_block +* Function: copy_user_block * * Purpose: copy user block from one file to another * * Return: 0, ok, -1 no * -* Programmer: Peter Cao +* Programmer: Peter Cao * * Date: October, 25, 2007 * @@ -1706,26 +1706,26 @@ done: if(outfid > 0) HDclose(outfid); - return status; + return status; } /*------------------------------------------------------------------------- -* Function: print_user_block +* Function: print_user_block * * Purpose: print user block * * Return: 0, ok, -1 no * -* Programmer: Pedro Vicente +* Programmer: Pedro Vicente * * Date: August, 20, 2008 * *------------------------------------------------------------------------- */ -#if defined (H5REPACK_DEBUG_USER_BLOCK) -static +#if defined (H5REPACK_DEBUG_USER_BLOCK) +static void print_user_block(const char *filename, hid_t fid) { int fh; /* file handle */ @@ -1734,27 +1734,27 @@ void print_user_block(const char *filename, hid_t fid) hid_t fcpl; /* file creation property list ID for HDF5 file */ int i; - /* get user block size */ - if(( fcpl = H5Fget_create_plist(fid)) < 0) + /* get user block size */ + if(( fcpl = H5Fget_create_plist(fid)) < 0) { error_msg(progname, "failed to retrieve file creation property list\n"); goto done; - } + } - if(H5Pget_userblock(fcpl, &ub_size) < 0) + if(H5Pget_userblock(fcpl, &ub_size) < 0) { error_msg(progname, "failed to retrieve userblock size\n"); goto done; - } + } - if(H5Pclose(fcpl) < 0) + if(H5Pclose(fcpl) < 0) { error_msg(progname, "failed to close property list\n"); goto done; - } + } /* open file */ - if((fh = HDopen(filename, O_RDONLY, 0)) < 0) + if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { goto done; } @@ -1762,7 +1762,7 @@ void print_user_block(const char *filename, hid_t fid) size = ub_size; /* read file */ - while(size > 0) + while(size > 0) { ssize_t nread; /* # of bytes read */ char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ @@ -1773,7 +1773,7 @@ void print_user_block(const char *filename, hid_t fid) else nread = HDread(fh, rbuf, (size_t)size); - for(i = 0; i < nread; i++) + for(i = 0; i < nread; i++) { printf("%c ", rbuf[i]); @@ -1781,22 +1781,22 @@ void print_user_block(const char *filename, hid_t fid) } printf("\n"); - if(nread < 0) + if(nread < 0) { goto done; - } + } /* update size of userblock left to transfer */ size -= nread; - } + } done: if(fh > 0) HDclose(fh); - return; + return; } #endif diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 92b263b..8075a77 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -300,7 +300,7 @@ int apply_filters(const char* name, /* object name from traverse list */ */ if (obj.layout==-1) { - + /* stripmine info */ hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ hsize_t sm_nbytes; /*bytes per stripmine */ @@ -312,10 +312,10 @@ int apply_filters(const char* name, /* object name from traverse list */ * a hyperslab whose size is manageable. */ - - + + sm_nbytes = msize; - for ( i = rank; i > 0; --i) + for ( i = rank; i > 0; --i) { hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ @@ -445,18 +445,18 @@ int apply_filters(const char* name, /* object name from traverse list */ if (H5Pset_layout(dcpl_id, obj.layout)<0) return -1; - if (H5D_CHUNKED == obj.layout) - { + if (H5D_CHUNKED == obj.layout) + { if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; } - else if (H5D_COMPACT == obj.layout) + else if (H5D_COMPACT == obj.layout) { if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0) return -1; } /* remove filters for the H5D_CONTIGUOUS case */ - else if (H5D_CONTIGUOUS == obj.layout) + else if (H5D_CONTIGUOUS == obj.layout) { if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0) return -1; diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 40ddf45..03aaa46 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -103,33 +103,33 @@ static struct long_options l_opts[] = { */ int main(int argc, const char **argv) { - + pack_opt_t options; /*the global options */ int ret=-1; - + /* initialize options */ - h5repack_init (&options, 0, 0, (hsize_t)0); - + h5repack_init (&options, 0, 0, (hsize_t)0); + parse_command_line(argc, argv, &options); - + /* get file names if they were not yet got */ if ( has_i_o == 0 ) { - + if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) { infile = argv[ opt_ind ]; outfile = argv[ opt_ind + 1 ]; - + if ( strcmp( infile, outfile ) == 0 ) { error_msg(progname, "file names cannot be the same\n"); usage(progname); exit(EXIT_FAILURE); - + } } - + else { error_msg(progname, "file names missing\n"); @@ -137,14 +137,14 @@ int main(int argc, const char **argv) exit(EXIT_FAILURE); } } - - + + /* pack it */ ret=h5repack(infile,outfile,&options); - + /* free tables */ h5repack_end(&options); - + if (ret==-1) return 1; else @@ -291,7 +291,7 @@ static void usage(const char *prog) *------------------------------------------------------------------------- */ -static +static void parse_command_line(int argc, const char **argv, pack_opt_t* options) { diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 15dc812..2d8f040 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -449,7 +449,7 @@ obj_list_t* parse_filter(const char *str, default: break; - + }; return obj_list; diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index cd725cd..fddcf0e 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -74,7 +74,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ for(i = 0; i < travt->nobjs; i++) { - switch(travt->objs[i].type) + switch(travt->objs[i].type) { /*------------------------------------------------------------------------- * H5TRAV_TYPE_GROUP @@ -194,8 +194,8 @@ int do_copy_refobjs(hid_t fidin, goto error; if(options->verbose) { - - + + printf(FORMAT_OBJ,"dset",travt->objs[i].name ); printf("object <%s> object reference created to <%s>\n", travt->objs[i].name, @@ -278,9 +278,9 @@ int do_copy_refobjs(hid_t fidin, goto error; if(options->verbose) { - - - + + + printf(FORMAT_OBJ,"dset",travt->objs[i].name ); printf("object <%s> region reference created to <%s>\n", travt->objs[i].name, @@ -441,7 +441,7 @@ static int copy_refs_attr(hid_t loc_in, if(H5Oget_info(loc_in, &oinfo) < 0) goto error; - for(u = 0; u < (unsigned)oinfo.num_attrs; u++) + for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { /*------------------------------------------------------------------------- * open @@ -488,7 +488,7 @@ static int copy_refs_attr(hid_t loc_in, * we cannot just copy the buffers, but instead we recreate the reference *------------------------------------------------------------------------- */ - if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) + if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { hid_t refobj_id; hobj_ref_t *refbuf = NULL; @@ -501,10 +501,10 @@ static int copy_refs_attr(hid_t loc_in, *------------------------------------------------------------------------- */ - if (nelmts) + if (nelmts) { buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); - if(buf == NULL) + if(buf == NULL) { printf("cannot read into memory\n"); goto error; @@ -513,15 +513,15 @@ static int copy_refs_attr(hid_t loc_in, goto error; refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); - if(refbuf == NULL) + if(refbuf == NULL) { printf( "cannot allocate memory\n" ); goto error; } /* end if */ - for(k = 0; k < nelmts; k++) + for(k = 0; k < nelmts; k++) { - H5E_BEGIN_TRY + H5E_BEGIN_TRY { if((refobj_id = H5Rdereference(attr_id, H5R_OBJECT, &buf[k])) < 0) goto error; @@ -530,7 +530,7 @@ static int copy_refs_attr(hid_t loc_in, /* get the name. a valid name could only occur in the * second traversal of the file */ - if((refname = MapIdToName(refobj_id, travt)) != NULL) + if((refname = MapIdToName(refobj_id, travt)) != NULL) { /* create the reference */ if(H5Rcreate(&refbuf[k], fidout, refname, H5R_OBJECT, -1) < 0) @@ -565,7 +565,7 @@ static int copy_refs_attr(hid_t loc_in, * dataset region references *------------------------------------------------------------------------- */ - else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) + else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) { hid_t refobj_id; hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */ @@ -577,10 +577,10 @@ static int copy_refs_attr(hid_t loc_in, * read input to memory *------------------------------------------------------------------------- */ - if(nelmts) + if(nelmts) { buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); - if(buf == NULL) + if(buf == NULL) { printf( "cannot read into memory\n" ); goto error; @@ -593,15 +593,15 @@ static int copy_refs_attr(hid_t loc_in, *------------------------------------------------------------------------- */ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ - if(refbuf == NULL) + if(refbuf == NULL) { printf( "cannot allocate memory\n" ); goto error; } /* end if */ - for(k = 0; k < nelmts; k++) + for(k = 0; k < nelmts; k++) { - H5E_BEGIN_TRY + H5E_BEGIN_TRY { if((refobj_id = H5Rdereference(attr_id, H5R_DATASET_REGION, &buf[k])) < 0) continue; @@ -610,7 +610,7 @@ static int copy_refs_attr(hid_t loc_in, /* get the name. a valid name could only occur in the * second traversal of the file */ - if((refname = MapIdToName(refobj_id, travt)) != NULL) + if((refname = MapIdToName(refobj_id, travt)) != NULL) { hid_t region_id; /* region id of the referenced dataset */ @@ -692,9 +692,9 @@ static const char* MapIdToName(hid_t refobj_id, unsigned int i; /* linear search */ - for(i = 0; i < travt->nobjs; i++) + for(i = 0; i < travt->nobjs; i++) { - if(travt->objs[i].type == H5O_TYPE_DATASET) + if(travt->objs[i].type == H5O_TYPE_DATASET) { H5O_info_t ref_oinfo; /* Stat for the refobj id */ diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index fe94148..385deee 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -230,13 +230,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options goto error; } - /* - * If the strategy option is not set, - * file space handling strategy should be the same for both + /* + * If the strategy option is not set, + * file space handling strategy should be the same for both * input & output files. - * If the strategy option is set, + * If the strategy option is set, * the output file's file space handling strategy should be the same - * as what is set via the strategy option + * as what is set via the strategy option */ if(!options->fs_strategy && out_strat != in_strat) { error_msg(progname, "file space strategy not set as unexpected\n"); @@ -247,11 +247,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options goto error; } - /* - * If the threshold option is not set, - * the free space section threshold should be the same for both + /* + * If the threshold option is not set, + * the free space section threshold should be the same for both * input & output files. - * If the threshold option is set, + * If the threshold option is set, * the output file's free space section threshold should be the same * as what is set via the threshold option. */ @@ -411,7 +411,7 @@ int h5repack_cmp_pl(const char *fname1, trav_table_init(&trav); if(h5trav_gettable(fid1, trav) < 0) goto error; - + /*------------------------------------------------------------------------- * traverse the suppplied object list *------------------------------------------------------------------------- @@ -551,7 +551,7 @@ error: *------------------------------------------------------------------------- */ -static +static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) { int nfilters_dcpl; /* number of filters in DCPL*/ diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 3283ddd..17ece99 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -1569,10 +1569,10 @@ error: * *------------------------------------------------------------------------- */ -static +static int make_testfiles(void) { - hid_t fid; + hid_t fid; /*------------------------------------------------------------------------- * create a file for general copy test @@ -1779,7 +1779,7 @@ out: * *------------------------------------------------------------------------- */ -static +static int make_all_objects(hid_t loc_id) { hid_t did=-1; @@ -1787,7 +1787,7 @@ int make_all_objects(hid_t loc_id) hid_t tid=-1; hid_t rid=-1; hid_t sid=-1; - hid_t gcplid=-1; + hid_t gcplid=-1; hsize_t dims[1]={2}; /* compound datatype */ typedef struct s_t @@ -1804,7 +1804,7 @@ int make_all_objects(hid_t loc_id) goto out; if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /*------------------------------------------------------------------------- * H5G_GROUP @@ -1813,7 +1813,7 @@ int make_all_objects(hid_t loc_id) if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if (H5Gclose(gid) < 0) - goto out; + goto out; /* create a group "g2" with H5P_CRT_ORDER_TRACKED set */ if ((gcplid = H5Pcreate(H5P_GROUP_CREATE)) < 0) @@ -1881,7 +1881,7 @@ int make_all_objects(hid_t loc_id) return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Dclose(did); H5Gclose(gid); @@ -1901,7 +1901,7 @@ out: * *------------------------------------------------------------------------- */ -static +static int make_attributes(hid_t loc_id) { hid_t did=-1; @@ -1917,7 +1917,7 @@ int make_attributes(hid_t loc_id) if ((sid = H5Screate_simple(1, dims, NULL)) < 0) goto out; if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + goto out; /*------------------------------------------------------------------------- * H5G_GROUP @@ -1949,11 +1949,11 @@ int make_attributes(hid_t loc_id) goto out; if (H5Sclose(sid) < 0) goto out; - + return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Dclose(did); H5Gclose(gid); @@ -1971,7 +1971,7 @@ out: * *------------------------------------------------------------------------- */ -static +static int make_hlinks(hid_t loc_id) { hid_t g1id=-1; @@ -2019,11 +2019,11 @@ int make_hlinks(hid_t loc_id) goto out; if (H5Gclose(g3id) < 0) goto out; - + return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Gclose(g1id); H5Gclose(g2id); @@ -2042,7 +2042,7 @@ out: *------------------------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_SZIP -static +static int make_szip(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2077,19 +2077,19 @@ int make_szip(hid_t loc_id) *------------------------------------------------------------------------- */ /* Make sure encoding is enabled */ - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { szip_can_encode = 1; } - if (szip_can_encode) + if (szip_can_encode) { /* set szip data */ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0) goto out; if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0) goto out; - } - else + } + else { /* WARNING? SZIP is decoder only, can't generate test files */ } @@ -2119,7 +2119,7 @@ out: * *------------------------------------------------------------------------- */ -static +static int make_deflate(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2196,7 +2196,7 @@ out: * *------------------------------------------------------------------------- */ -static +static int make_shuffle(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2262,7 +2262,7 @@ out: * *------------------------------------------------------------------------- */ -static +static int make_fletcher32(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2332,7 +2332,7 @@ out: * *------------------------------------------------------------------------- */ -static +static int make_nbit(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -2573,11 +2573,11 @@ int make_all_filters(hid_t loc_id) #endif #if defined (H5_HAVE_FILTER_SZIP) - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { szip_can_encode = 1; } - if (szip_can_encode) + if (szip_can_encode) { /* set szip data */ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0) @@ -2610,7 +2610,7 @@ int make_all_filters(hid_t loc_id) /* Make sure encoding is enabled */ #if defined (H5_HAVE_FILTER_SZIP) - if (szip_can_encode) + if (szip_can_encode) { /* remove the filters from the dcpl */ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) @@ -2620,7 +2620,7 @@ int make_all_filters(hid_t loc_id) goto out; if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0) goto out; - } else + } else { /* WARNING? SZIP is decoder only, can't generate test dataset */ } @@ -2684,7 +2684,7 @@ int make_all_filters(hid_t loc_id) return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(sid); @@ -2729,7 +2729,7 @@ int make_early(void) if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto out; - for(i = 0; i < iter; i++) + for(i = 0; i < iter; i++) { if ((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; @@ -2758,7 +2758,7 @@ int make_early(void) if ((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; - for(i = 0; i < iter; i++) + for(i = 0; i < iter; i++) { if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) goto out; @@ -2779,7 +2779,7 @@ int make_early(void) return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Tclose(tid); H5Pclose(dcpl); @@ -2888,7 +2888,7 @@ int make_layout(hid_t loc_id) return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(sid); @@ -3074,7 +3074,7 @@ int make_external(hid_t loc_id) return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(sid); @@ -3628,9 +3628,9 @@ int write_dset_in(hid_t loc_id, if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) goto out; if (write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0) - goto out; + goto out; if (H5Tclose(tid) < 0) - goto out; + goto out; /*------------------------------------------------------------------------- * H5T_OPAQUE @@ -3639,7 +3639,7 @@ int write_dset_in(hid_t loc_id, if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) goto out; if (H5Tset_tag(tid, "1-byte opaque type") < 0) - goto out; + goto out; if (write_dset(loc_id,2,dims2,"opaque2D",tid,buf22) < 0) goto out; if (H5Tclose(tid) < 0) @@ -3704,7 +3704,7 @@ int write_dset_in(hid_t loc_id, n = 0; for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) + for(j = 0; j < 2; j++) { int l; @@ -3925,7 +3925,7 @@ int write_dset_in(hid_t loc_id, { for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) + for(k = 0; k < 2; k++) { int l; @@ -3953,7 +3953,7 @@ int write_dset_in(hid_t loc_id, if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0) goto out; - + if (H5Dclose(did) < 0) goto out; if (H5Tclose(tid) < 0) @@ -4015,7 +4015,7 @@ int write_dset_in(hid_t loc_id, out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(pid); H5Sclose(sid); @@ -4025,7 +4025,7 @@ out: return -1; } - + /*------------------------------------------------------------------------- * Function: make_dset_reg_ref @@ -4120,7 +4120,7 @@ out: if(dwbuf) free(dwbuf); - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); @@ -4485,7 +4485,7 @@ int write_attr_in(hid_t loc_id, if(make_diffs) { - for(i = 0; i < 2; i++) + for(i = 0; i < 2; i++) { buf7[i]=0; buf8[i]=0; @@ -4660,9 +4660,9 @@ int write_attr_in(hid_t loc_id, /* Create references to dataset */ if (dset_name) { - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) { - for (j = 0; j < 2; j++) + for (j = 0; j < 2; j++) { if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1) < 0) goto out; @@ -4715,9 +4715,9 @@ int write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ n=0; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) { - for (j = 0; j < 2; j++) + for (j = 0; j < 2; j++) { int l; buf52[i][j].p = malloc((i + 1) * sizeof(int)); @@ -4812,7 +4812,7 @@ int write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if(make_diffs) + if(make_diffs) { HDmemset(buf72, 0, sizeof buf72); HDmemset(buf82, 0, sizeof buf82); @@ -4933,11 +4933,11 @@ int write_attr_in(hid_t loc_id, */ n=1; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) + for (k = 0; k < 2; k++) { if (make_diffs) buf23[i][j][k]=0; else buf23[i][j][k]=n++; @@ -5002,18 +5002,18 @@ int write_attr_in(hid_t loc_id, */ n=1; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) + for (k = 0; k < 2; k++) { - if (make_diffs) + if (make_diffs) { buf33[i][j][k].a=0; buf33[i][j][k].b=0; } - else + else { buf33[i][j][k].a=n++; buf33[i][j][k].b=n++; @@ -5094,9 +5094,9 @@ int write_attr_in(hid_t loc_id, /* Create references to dataset */ if (dset_name) { - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1) < 0) @@ -5112,17 +5112,17 @@ int write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) + for (k = 0; k < 2; k++) { - if (make_diffs) + if (make_diffs) { - buf453[i][j][k]=RED; + buf453[i][j][k]=RED; } - else + else { buf453[i][j][k]=GREEN; } @@ -5179,11 +5179,11 @@ int write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ n=0; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) + for (k = 0; k < 2; k++) { int l; buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); @@ -5193,7 +5193,7 @@ int write_attr_in(hid_t loc_id, { ((int *)buf53[i][j][k].p)[l] = 0; } - else + else ((int *)buf53[i][j][k].p)[l] = n++; } } @@ -5238,9 +5238,9 @@ int write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ n=1; - for (i = 0; i < 24; i++) + for (i = 0; i < 24; i++) { - for (j = 0; j < (int)dimarray[0]; j++) + for (j = 0; j < (int)dimarray[0]; j++) { if (make_diffs) buf63[i][j]=0; else buf63[i][j]=n++; @@ -5278,12 +5278,12 @@ int write_attr_in(hid_t loc_id, { for(k = 0; k < 2; k++) { - if(make_diffs) + if(make_diffs) { buf73[i][j][k] = 0; buf83[i][j][k] = 0; } - else + else { buf73[i][j][k] = n++; buf83[i][j][k] = f++; @@ -5316,7 +5316,7 @@ int write_attr_in(hid_t loc_id, return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Aclose(aid); H5Sclose(sid); @@ -5572,7 +5572,7 @@ int make_named_dtype(hid_t loc_id) return 0; out: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Tclose(tid); H5Aclose(aid); diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index a4e32f7..3c8242a 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -34,7 +34,7 @@ /* File space management strategies: see H5Fpublic.h for declarations */ const char *FS_STRATEGY_NAME[] = { - "unknown", + "unknown", "H5F_FILE_SPACE_ALL_PERSIST", "H5F_FILE_SPACE_ALL", "H5F_FILE_SPACE_AGGR_VFD", @@ -781,7 +781,7 @@ freespace_stats(hid_t fid, iter_t *iter) * Programmer: Elena Pourmal * Saturday, August 12, 2006 * - * Modifications: + * Modifications: * Vailin Choi; October 2009 * Turn on display_group_metadata, display_dset_metadata * Add 'S' & 's' for printing free space info (previous checkin) @@ -1149,13 +1149,13 @@ print_dataset_info(const iter_t *iter) /*------------------------------------------------------------------------- * Function: print_dset_dtype_info * - * Purpose: Prints datasets' datatype information + * Purpose: Prints datasets' datatype information * * Return: Success: 0 * * Failure: Never fails * - * Programmer: + * Programmer: * * Modifications: * Vailin Choi; October 2009 @@ -1178,7 +1178,7 @@ print_dset_dtype_info(const iter_t *iter) for(u = 0; u < iter->dset_ntypes; u++) { H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); printf("\tDataset datatype #%u:\n", u); - printf("\t\tCount (total/named) = (%lu/%lu)\n", + printf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count, iter->dset_type_info[u].named); printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); @@ -1284,7 +1284,7 @@ print_storage_summary(const iter_t *iter) percent = ((float)iter->free_space / (float)iter->filesize) * 100; HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n", - iter->free_space, percent); + iter->free_space, percent); if(iter->filesize < (total_meta+iter->dset_storage_size+iter->free_space)) { unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize; @@ -1295,7 +1295,7 @@ print_storage_summary(const iter_t *iter) HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount); } - HDfprintf(stdout, "Total space: %Hu bytes\n", + HDfprintf(stdout, "Total space: %Hu bytes\n", total_meta+iter->dset_storage_size+iter->free_space+unaccount); if(iter->nexternal) @@ -1331,7 +1331,7 @@ print_file_metadata(const iter_t *iter) HDfprintf(stdout, "\tObject headers: (total/unused)\n"); HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); - HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n", + HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n", iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size, @@ -1367,7 +1367,7 @@ print_file_metadata(const iter_t *iter) /*------------------------------------------------------------------------- * Function: print_group_metadata * - * Purpose: Prints file space information for groups' metadata + * Purpose: Prints file space information for groups' metadata * * Return: Success: 0 * @@ -1395,7 +1395,7 @@ print_group_metadata(const iter_t *iter) /*------------------------------------------------------------------------- * Function: print_dataset_metadata * - * Purpose: Prints file space information for datasets' metadata + * Purpose: Prints file space information for datasets' metadata * * Return: Success: 0 * @@ -1559,7 +1559,7 @@ main(int argc, const char *argv[]) if(H5Fget_filesize(fid, &iter.filesize) < 0) warn_msg(progname, "Unable to retrieve file size\n"); assert(iter.filesize != 0); - + /* Get storge info for file-level structures */ if(H5Fget_info2(fid, &finfo) < 0) warn_msg(progname, "Unable to retrieve file info\n"); @@ -1593,7 +1593,7 @@ main(int argc, const char *argv[]) u = 0; while(hand[u].obj) { - if (h5trav_visit(fid, hand[u].obj, TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0) + if (h5trav_visit(fid, hand[u].obj, TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0) warn_msg(progname, "Unable to traverse object \"%s\"\n", hand[u].obj); else print_statistics(hand[u].obj, &iter); diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 4b7b796..26e769c 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -30,10 +30,10 @@ typedef struct { int mode; } h5tool_opt_t; -/* To return link's target info +/* To return link's target info * Functions: * H5tools_get_softlink_target_info() - * H5tools_get_extlink_target_info() + * H5tools_get_extlink_target_info() * Note: this may be move to h5tools code if used by other tools */ typedef struct { @@ -203,7 +203,7 @@ static void print_incoming_data(void) * - [IN] h5li : soft-link's source H5L_info_t * - [OUT] trg_info: returning target info (refer to struct) * - * Return: + * Return: * Success - 1 and return data via trg_info struct * Fail - 0 * @@ -221,15 +221,15 @@ static int H5tools_get_softlink_target_info(hid_t file_id, const char * linkpath H5O_info_t oinfo; H5L_info_t linfo; int ret = 0; /* init to fail */ - - if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0)) + + if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0)) { parallel_print("error: \"%s\" doesn't exist \n",linkpath); goto out; } - if(H5Lget_info(file_id, linkpath, &linfo, H5P_DEFAULT) < 0) + if(H5Lget_info(file_id, linkpath, &linfo, H5P_DEFAULT) < 0) { parallel_print("error: unable to get link info from \"%s\"\n",linkpath); goto out; @@ -238,7 +238,7 @@ static int H5tools_get_softlink_target_info(hid_t file_id, const char * linkpath /* get target name for softlink */ if(linfo.type == H5L_TYPE_SOFT) { - /* s_trg_info->buf should be already allocated out of + /* s_trg_info->buf should be already allocated out of * this function and free when done */ if(H5Lget_val(file_id, linkpath, s_trg_info->buf, h5li.u.val_size, H5P_DEFAULT) < 0) { @@ -247,7 +247,7 @@ static int H5tools_get_softlink_target_info(hid_t file_id, const char * linkpath } /* target path */ s_trg_info->path = s_trg_info->buf; - } + } /* if obj is hard link, will still get the type */ else if (linfo.type == H5L_TYPE_HARD) { @@ -257,10 +257,10 @@ static int H5tools_get_softlink_target_info(hid_t file_id, const char * linkpath /*-------------------------------------------------------------- * if link target or object exit, get type */ - if((H5Lexists(file_id, s_trg_info->path, H5P_DEFAULT) == TRUE)) + if((H5Lexists(file_id, s_trg_info->path, H5P_DEFAULT) == TRUE)) { - if(H5Oget_info_by_name(file_id, s_trg_info->path, &oinfo, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name(file_id, s_trg_info->path, &oinfo, H5P_DEFAULT) < 0) { parallel_print("error: unable to get object information for \"%s\"\n", s_trg_info->path); goto out; @@ -268,13 +268,13 @@ static int H5tools_get_softlink_target_info(hid_t file_id, const char * linkpath otype = oinfo.type; - + /* check unknown type */ if (otype < H5O_TYPE_GROUP || otype >=H5O_TYPE_NTYPES) { parallel_print("<%s> is unknown type\n", s_trg_info->path); goto out; - } + } } else { @@ -302,7 +302,7 @@ out: * - [IN] h5li : external-link source H5L_info_t * - [OUT] trg_info : returning target info (refer to struct) * - * Return: + * Return: * Success - 1 and return data via trg_info struct * Fail - 0 * @@ -310,7 +310,7 @@ out: * - trg_info->buf must be allocated along with H5Lget_info[li.u.val_size] * before passing to this function. * - if target is soft-link, trg_info->path will be malloced. so check if - * trg_info->is_path_malloced==TRUE, then free trg_info->path along with freeing + * trg_info->is_path_malloced==TRUE, then free trg_info->path along with freeing * trg_info->buf outside of this function. * * Programmer: Jonathan Kim @@ -319,7 +319,7 @@ out: *-------------------------------------------------------------------------*/ static int H5tools_get_extlink_target_info(hid_t fileid, const char *linkpath, H5L_info_t h5li, h5tool_link_trg_info_t *trg_info) { - + hid_t extfile_id; const char *extlink_file; const char *extlink_path; @@ -330,8 +330,8 @@ static int H5tools_get_extlink_target_info(hid_t fileid, const char *linkpath, H /* init */ HDmemset(&soft_trg_info, 0, sizeof(h5tool_link_trg_info_t)); trg_info->type = H5O_TYPE_UNKNOWN; - - if(H5Lget_val(fileid, linkpath, trg_info->buf, h5li.u.val_size, H5P_DEFAULT) < 0) + + if(H5Lget_val(fileid, linkpath, trg_info->buf, h5li.u.val_size, H5P_DEFAULT) < 0) { parallel_print("error: unable to get link value from \"%s\"\n",linkpath); goto out; @@ -339,7 +339,7 @@ static int H5tools_get_extlink_target_info(hid_t fileid, const char *linkpath, H /*--------------------------------------- * get target filename and object path */ - if(H5Lunpack_elink_val(trg_info->buf, h5li.u.val_size, NULL, &extlink_file, &extlink_path)<0) + if(H5Lunpack_elink_val(trg_info->buf, h5li.u.val_size, NULL, &extlink_file, &extlink_path)<0) { parallel_print("error: unable to unpack external link value\n"); goto out; @@ -348,16 +348,16 @@ static int H5tools_get_extlink_target_info(hid_t fileid, const char *linkpath, H /* return target filename and obj path */ trg_info->path = extlink_path; trg_info->extfile = extlink_file; - + /* --------------------------------- * get file id from external file * mimicked from h5diff() for Parallel code - * , but not sure if it's needed + * , but not sure if it's needed */ H5E_BEGIN_TRY { /* open file */ - if((extfile_id = h5tools_fopen(extlink_file, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + if((extfile_id = h5tools_fopen(extlink_file, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("error: <%s>: unable to open file\n", extlink_file); #ifdef H5_HAVE_PARALLEL @@ -373,14 +373,14 @@ static int H5tools_get_extlink_target_info(hid_t fileid, const char *linkpath, H trg_info->extfile_id = extfile_id; /* -------------------------------------------------- - * check if target is soft link, if so allocate buffer + * check if target is soft link, if so allocate buffer */ - if((H5Lexists(trg_info->extfile_id, trg_info->path, H5P_DEFAULT) <= 0)) + if((H5Lexists(trg_info->extfile_id, trg_info->path, H5P_DEFAULT) <= 0)) { parallel_print("error: \"%s\" doesn't exist \n", trg_info->path); goto out; } - if(H5Lget_info(trg_info->extfile_id, trg_info->path, &slinfo, H5P_DEFAULT) < 0) + if(H5Lget_info(trg_info->extfile_id, trg_info->path, &slinfo, H5P_DEFAULT) < 0) { parallel_print("error: unable to get link info from \"%s\"\n", trg_info->path); goto out; @@ -468,7 +468,7 @@ hsize_t h5diff(const char *fname1, { /* open file 1 */ - if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname1); @@ -484,8 +484,8 @@ hsize_t h5diff(const char *fname1, /* open file 2 */ - - if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) + + if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname2); @@ -715,14 +715,14 @@ hsize_t diff_match(hid_t file1_id, * 2) the graph must match, i.e same names (absolute path) * 3) objects with the same name must be of the same type *------------------------------------------------------------------------- - */ - + */ + /* number of different objects */ if ( info1->nused != info2->nused ) { options->contents = 0; } - + /* objects in one file and not the other */ for( i = 0; i < table->nobjs; i++) { @@ -733,7 +733,7 @@ hsize_t diff_match(hid_t file1_id, } /* objects with the same name but different HDF5 types */ - for( i = 0; i < table->nobjs; i++) + for( i = 0; i < table->nobjs; i++) { if ( table->objs[i].flags[0] && table->objs[i].flags[1] ) { @@ -1135,7 +1135,7 @@ hsize_t diff_compare(hid_t file1_id, obj2type = info2->paths[j].type; /*----------------------------------------------------------------- - * follow link option, compare with target object + * follow link option, compare with target object */ if (options->linkfollow) { @@ -1170,7 +1170,7 @@ hsize_t diff_compare(hid_t file1_id, obj1type = softlinkinfo1.type; obj1name = softlinkinfo1.path; } - + /*------------------------ * if object2 is softlink */ @@ -1282,7 +1282,7 @@ hsize_t diff_compare(hid_t file1_id, } } } /* end of linkfollow */ - + /* objects are not the same type */ if (obj1type != obj2type) { @@ -1321,7 +1321,7 @@ out: if(extlinkinfo2.is_path_malloced) HDfree(extlinkinfo2.path); } - + /* close external file */ H5E_BEGIN_TRY { @@ -1375,7 +1375,7 @@ hsize_t diff(hid_t file1_id, /*init */ HDmemset(&softlinkinfo1,0,sizeof(h5tool_link_trg_info_t)); HDmemset(&softlinkinfo2,0,sizeof(h5tool_link_trg_info_t)); - + switch(type) { @@ -1404,7 +1404,7 @@ hsize_t diff(hid_t file1_id, if (!options->not_cmp && nfound) { do_print_objname("dataset", path1, path2); - print_found(nfound); + print_found(nfound); } } break; @@ -1539,8 +1539,8 @@ hsize_t diff(hid_t file1_id, goto out; } - nfound += diff(file1_id, softlinkinfo1.path, - file2_id, softlinkinfo2.path, + nfound += diff(file1_id, softlinkinfo1.path, + file2_id, softlinkinfo2.path, options, softlinkinfo1.type); } @@ -1573,7 +1573,7 @@ hsize_t diff(hid_t file1_id, } /* Only external links will have a query function registered */ - if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) + if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) { extlinkbuf1 = (char*)HDcalloc(li1.u.val_size, sizeof(char)); @@ -1581,19 +1581,19 @@ hsize_t diff(hid_t file1_id, extlinkbuf2 = (char*)HDcalloc(li2.u.val_size, sizeof(char)); HDassert(extlinkbuf2); - if(H5Lget_val(file1_id, path1, extlinkbuf1, li1.u.val_size, H5P_DEFAULT) < 0) + if(H5Lget_val(file1_id, path1, extlinkbuf1, li1.u.val_size, H5P_DEFAULT) < 0) { parallel_print("error: unable to get link value from \"%s\"\n",path1); goto out; } /* end if */ - if(H5Lget_val(file2_id, path2, extlinkbuf2, li2.u.val_size, H5P_DEFAULT) < 0) + if(H5Lget_val(file2_id, path2, extlinkbuf2, li2.u.val_size, H5P_DEFAULT) < 0) { parallel_print("error: unable to get link value from \"%s\"\n",path2); goto out; } /* end if */ /* If the buffers are the same size, compare them */ - if(li1.u.val_size == li2.u.val_size) + if(li1.u.val_size == li2.u.val_size) { ret = HDmemcmp(extlinkbuf1, extlinkbuf2, li1.u.val_size); } @@ -1614,27 +1614,27 @@ hsize_t diff(hid_t file1_id, const char *extlink_path2; /* get file name and obj path */ - if(H5Lunpack_elink_val(extlinkbuf1, li1.u.val_size, NULL, &extlink_file1, &extlink_path1)<0) + if(H5Lunpack_elink_val(extlinkbuf1, li1.u.val_size, NULL, &extlink_file1, &extlink_path1)<0) { parallel_print("error: unable to unpack external link value of obj1\n"); goto out; } /* get file name and obj path */ - if(H5Lunpack_elink_val(extlinkbuf2, li2.u.val_size, NULL, &extlink_file2, &extlink_path2)<0) + if(H5Lunpack_elink_val(extlinkbuf2, li2.u.val_size, NULL, &extlink_file2, &extlink_path2)<0) { parallel_print("error: unable to unpack external link value of obj2\n"); goto out; } - nfound = h5diff(extlink_file1, extlink_file2, + nfound = h5diff(extlink_file1, extlink_file2, extlink_path1, extlink_path2, options); - } + } HDfree(extlinkbuf1); HDfree(extlinkbuf2); } /* end if */ - else + else { /* If one or both of these links isn't an external link, we can only * compare information from H5Lget_info since we don't have a query diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 91acb10..6572594 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -74,7 +74,7 @@ #define ULLI_FORMAT_P_NOTCOMP "%-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"d not comparable\n" -/* if system EPSILON is defined, use the system EPSILON; otherwise, use +/* if system EPSILON is defined, use the system EPSILON; otherwise, use constants that are close to most EPSILON values */ #ifndef FLT_EPSILON @@ -167,7 +167,7 @@ static void h5diff_print_char(char ch); #if H5_SIZEOF_LONG_DOUBLE !=0 typedef enum dtype_t { - FLT_FLOAT, + FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE } dtype_t; @@ -175,7 +175,7 @@ typedef enum dtype_t typedef enum dtype_t { - FLT_FLOAT, + FLT_FLOAT, FLT_DOUBLE } dtype_t; #endif @@ -227,7 +227,7 @@ hsize_t diff_array( void *_mem1, if ( rank > 0 ) { - + acc[rank-1]=1; for(j=(rank-2); j>=0; j--) { @@ -275,7 +275,7 @@ hsize_t diff_array( void *_mem1, */ case H5T_FLOAT: - + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) @@ -283,7 +283,7 @@ hsize_t diff_array( void *_mem1, #if H5_SIZEOF_LONG_DOUBLE !=0 else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) nfound=diff_ldouble(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); -#endif +#endif break; case H5T_INTEGER: @@ -1862,7 +1862,7 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -1925,7 +1925,7 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -1991,7 +1991,7 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -2074,7 +2074,7 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -2139,7 +2139,7 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -2205,7 +2205,7 @@ hsize_t diff_datum(void *_mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -2889,7 +2889,7 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -2961,7 +2961,7 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -3036,7 +3036,7 @@ hsize_t diff_float(unsigned char *mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -3163,7 +3163,7 @@ hsize_t diff_double(unsigned char *mem1, } nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -3235,7 +3235,7 @@ hsize_t diff_double(unsigned char *mem1, } nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -3310,7 +3310,7 @@ hsize_t diff_double(unsigned char *mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -3446,7 +3446,7 @@ hsize_t diff_ldouble(unsigned char *mem1, } nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -3518,7 +3518,7 @@ hsize_t diff_ldouble(unsigned char *mem1, } nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -3593,7 +3593,7 @@ hsize_t diff_ldouble(unsigned char *mem1, nfound++; } - } + } /* one is NaN, assume difference */ else if ( isnan1==1 || isnan2==1) { @@ -5511,14 +5511,14 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) { if ( options->do_nans ) { - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ int isnan1 = my_isnan(FLT_DOUBLE,&value); int isnan2 = my_isnan(FLT_DOUBLE,&expected); - + /*------------------------------------------------------------------------- * we consider NaN == NaN to be true *------------------------------------------------------------------------- @@ -5527,7 +5527,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) { return TRUE; } - + /*------------------------------------------------------------------------- * one is a NaN, do not compare but assume difference *------------------------------------------------------------------------- @@ -5535,7 +5535,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) { return FALSE; - } + } } if (value == expected) @@ -5564,14 +5564,14 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio { if ( options->do_nans ) { - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ int isnan1 = my_isnan(FLT_LDOUBLE,&value); int isnan2 = my_isnan(FLT_LDOUBLE,&expected); - + /*------------------------------------------------------------------------- * we consider NaN == NaN to be true *------------------------------------------------------------------------- @@ -5580,7 +5580,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio { return TRUE; } - + /*------------------------------------------------------------------------- * one is a NaN, do not compare but assume difference *------------------------------------------------------------------------- @@ -5588,7 +5588,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) { return FALSE; - } + } } if (value == expected) @@ -5603,7 +5603,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio } #endif /* #if H5_SIZEOF_LONG_DOUBLE !=0 */ - + /*------------------------------------------------------------------------- * Function: equal_float @@ -5621,14 +5621,14 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) { if ( options->do_nans ) { - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ int isnan1 = my_isnan(FLT_FLOAT,&value); int isnan2 = my_isnan(FLT_FLOAT,&expected); - + /*------------------------------------------------------------------------- * we consider NaN == NaN to be true *------------------------------------------------------------------------- @@ -5637,7 +5637,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) { return TRUE; } - + /*------------------------------------------------------------------------- * one is a NaN, do not compare but assume difference *------------------------------------------------------------------------- @@ -5645,7 +5645,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) { return FALSE; - } + } } if (value == expected) @@ -5946,13 +5946,13 @@ void print_char_pos( int *ph, /* print header */ parallel_print("[ " ); if ( rank > 0 ) { - + for ( i = 0; i < rank; i++) { parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]); parallel_print(" "); } - + } else { @@ -5970,8 +5970,8 @@ void print_char_pos( int *ph, /* print header */ */ static void h5diff_print_char(char ch) { - - switch (ch) + + switch (ch) { case '"': parallel_print("\\\""); @@ -5999,7 +5999,7 @@ static void h5diff_print_char(char ch) parallel_print( "%c", ch); else parallel_print( "\\%03o", ch); - + break; } } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 2cc84ca..8e25b6d 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -44,36 +44,36 @@ hsize_t diff_dataset( hid_t file1_id, hid_t dcpl1 = -1; hid_t dcpl2 = -1; hsize_t nfound = 0; - + /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- */ /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { /* Open the datasets */ - if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) + if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj1_name); goto error; } - if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) + if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj2_name); goto error; } /* enable error reporting */ } H5E_END_TRY; - - + + if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; if((dcpl2 = H5Dget_create_plist(did2)) < 0) { goto error; } - + /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that * are not registered in the current configuration @@ -103,9 +103,9 @@ hsize_t diff_dataset( hid_t file1_id, /* enable error reporting */ } H5E_END_TRY; - + return nfound; - + error: options->err_stat=1; /* disable error reporting */ @@ -116,7 +116,7 @@ error: H5Dclose(did2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -214,56 +214,56 @@ hsize_t diff_datasetid( hid_t did1, void *sm_buf2=NULL; size_t need; /* bytes needed for malloc */ int i; - + /* Get the dataspace handle */ if ( (sid1 = H5Dget_space(did1)) < 0 ) goto error; - + /* Get rank */ if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 ) goto error; - + /* Get the dataspace handle */ if ( (sid2 = H5Dget_space(did2)) < 0 ) goto error; - + /* Get rank */ if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 ) goto error; - + /* Get dimensions */ if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 ) goto error; - + /* Get dimensions */ if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 ) { goto error; } - + /*------------------------------------------------------------------------- * get the file data type *------------------------------------------------------------------------- */ - + /* Get the data type */ if ( (f_tid1 = H5Dget_type(did1)) < 0 ) goto error; - + /* Get the data type */ if ( (f_tid2 = H5Dget_type(did2)) < 0 ) { goto error; } - + /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- */ - + storage_size1=H5Dget_storage_size(did1); storage_size2=H5Dget_storage_size(did2); - + if (storage_size1==0 || storage_size2==0) { if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) @@ -271,12 +271,12 @@ hsize_t diff_datasetid( hid_t did1, can_compare=0; options->not_cmp=1; } - + /*------------------------------------------------------------------------- * check for comparable TYPE and SPACE *------------------------------------------------------------------------- */ - + if (diff_can_type(f_tid1, f_tid2, rank1, @@ -292,46 +292,46 @@ hsize_t diff_datasetid( hid_t did1, { can_compare=0; } - + /*------------------------------------------------------------------------- * memory type and sizes *------------------------------------------------------------------------- */ if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) goto error; - + if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0) goto error; - + m_size1 = H5Tget_size( m_tid1 ); m_size2 = H5Tget_size( m_tid2 ); - + /*------------------------------------------------------------------------- * check for different signed/unsigned types *------------------------------------------------------------------------- */ - + sign1=H5Tget_sign(m_tid1); sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) { - if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - + can_compare=0; options->not_cmp=1; } - + /*------------------------------------------------------------------------- * only attempt to compare if possible *------------------------------------------------------------------------- */ if (can_compare ) /* it is possible to compare */ { - + /*------------------------------------------------------------------------- * get number of elements *------------------------------------------------------------------------- @@ -341,43 +341,43 @@ hsize_t diff_datasetid( hid_t did1, { nelmts1 *= dims1[i]; } - + nelmts2 = 1; for (i = 0; i < rank2; i++) { nelmts2 *= dims2[i]; } - + assert(nelmts1==nelmts2); - + /*------------------------------------------------------------------------- * "upgrade" the smaller memory size *------------------------------------------------------------------------- */ - + if ( m_size1 != m_size2 ) { if ( m_size1 < m_size2 ) { H5Tclose(m_tid1); - + if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0) goto error; - + m_size1 = H5Tget_size( m_tid1 ); } else { H5Tclose(m_tid2); - + if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0) goto error; - + m_size2 = H5Tget_size( m_tid2 ); } } assert(m_size1==m_size2); - + /* print names */ if (obj1_name) { name1=diff_basename(obj1_name); @@ -385,27 +385,27 @@ hsize_t diff_datasetid( hid_t did1, if (obj2_name) { name2=diff_basename(obj2_name); } - - + + /*------------------------------------------------------------------------- * read/compare *------------------------------------------------------------------------- */ - + need = (size_t)(nelmts1*m_size1); /* bytes needed */ if ( need < H5TOOLS_MALLOCSIZE) { buf1 = HDmalloc(need); buf2 = HDmalloc(need); } - + if ( buf1!=NULL && buf2!=NULL) { if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 ) goto error; if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 ) goto error; - + /* array diff */ nfound = diff_array(buf1, buf2, @@ -420,39 +420,39 @@ hsize_t diff_datasetid( hid_t did1, did1, did2); } - + else /* possibly not enough memory, read/compare by hyperslabs */ - + { size_t p_type_nbytes = m_size1; /*size of memory type */ hsize_t p_nelmts = nelmts1; /*total selected elmts */ hsize_t elmtno; /*counter */ int carry; /*counter carry value */ unsigned int vl_data = 0; /*contains VL datatypes */ - + /* stripmine info */ hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ hsize_t sm_nbytes; /*bytes per stripmine */ hsize_t sm_nelmts; /*elements per stripmine*/ hid_t sm_space; /*stripmine data space */ - + /* hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */ hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ hsize_t hs_nelmts; /*elements in request */ hsize_t zero[8]; /*vector of zeros */ - + /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE) vl_data = TRUE; - + /* * determine the strip mine size and allocate a buffer. The strip mine is * a hyperslab whose size is manageable. */ sm_nbytes = p_type_nbytes; - - for (i = rank1; i > 0; --i) + + for (i = rank1; i > 0; --i) { hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ @@ -461,7 +461,7 @@ hsize_t diff_datasetid( hid_t did1, sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } - + /* malloc return code should be verified. * If fail, need to handle the error. * This else branch should be recoded as a separate function. @@ -473,14 +473,14 @@ hsize_t diff_datasetid( hid_t did1, assert(sm_buf1); sm_buf2 = malloc((size_t)sm_nbytes); assert(sm_buf2); - + sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - + /* the stripmine loop */ memset(hs_offset, 0, sizeof hs_offset); memset(zero, 0, sizeof zero); - + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ @@ -505,12 +505,12 @@ hsize_t diff_datasetid( hid_t did1, H5Sselect_all(sm_space); hs_nelmts = 1; } /* rank */ - + if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 ) goto error; if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 ) goto error; - + /* get array differences. in the case of hyperslab read, increment the number of differences found in each hyperslab and pass the position at the beggining for printing */ nfound += diff_array(sm_buf1, @@ -525,14 +525,14 @@ hsize_t diff_datasetid( hid_t did1, m_tid1, did1, did2); - + /* reclaim any VL memory, if necessary */ if(vl_data) { H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); } - + /* calculate the next hyperslab offset */ for (i = rank1, carry = 1; i > 0 && carry; --i) { @@ -543,27 +543,27 @@ hsize_t diff_datasetid( hid_t did1, carry = 0; } /* i */ } /* elmtno */ - + H5Sclose(sm_space); } /* hyperslab read */ }/*can_compare*/ - + /*------------------------------------------------------------------------- * compare attributes * the if condition refers to cases when the dataset is a referenced object *------------------------------------------------------------------------- */ - + if (obj1_name) { nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); } - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + /* free */ if (buf1!=NULL) { @@ -585,7 +585,7 @@ hsize_t diff_datasetid( hid_t did1, free(sm_buf2); sm_buf2=NULL; } - + H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); @@ -594,12 +594,12 @@ hsize_t diff_datasetid( hid_t did1, H5Tclose(m_tid1); H5Tclose(m_tid2); } H5E_END_TRY; - + return nfound; - + error: options->err_stat=1; - + /* free */ if (buf1!=NULL) { @@ -621,7 +621,7 @@ error: free(sm_buf2); sm_buf2=NULL; } - + /* disable error reporting */ H5E_BEGIN_TRY { H5Sclose(sid1); @@ -632,7 +632,7 @@ error: H5Tclose(m_tid2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -666,64 +666,64 @@ int diff_can_type( hid_t f_tid1, /* file data type */ diff_opt_t *options, int is_compound) { - - + + H5T_class_t tclass1; H5T_class_t tclass2; int maxdim_diff=0; /* maximum dimensions are different */ int dim_diff=0; /* current dimensions are different */ int i; int can_compare = 1; /* return value */ - + /*------------------------------------------------------------------------- * check for the same class *------------------------------------------------------------------------- */ - + if ((tclass1=H5Tget_class(f_tid1)) < 0) return -1; - + if ((tclass2=H5Tget_class(f_tid2)) < 0) return -1; - + if ( tclass1 != tclass2 ) { if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { - + if ( is_compound ) { - + parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n", obj1_name, get_class(tclass1), obj2_name, get_class(tclass2) ); - + } - + else - + { - + parallel_print("Not comparable: <%s> is of class %s and <%s> is of class %s\n", obj1_name, get_class(tclass1), obj2_name, get_class(tclass2) ); - + } } - + can_compare = 0; options->not_cmp = 1; return can_compare; } - + /*------------------------------------------------------------------------- * check for non supported classes *------------------------------------------------------------------------- */ - + assert(tclass1==tclass2); switch (tclass1) { @@ -737,11 +737,11 @@ int diff_can_type( hid_t f_tid1, /* file data type */ case H5T_ENUM: case H5T_VLEN: case H5T_REFERENCE: - + break; - + default: /*H5T_TIME */ - + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { @@ -752,18 +752,18 @@ int diff_can_type( hid_t f_tid1, /* file data type */ options->not_cmp = 1; return can_compare; } - + /*------------------------------------------------------------------------- * check for equal file datatype; warning only *------------------------------------------------------------------------- */ - + if ( (H5Tequal(f_tid1, f_tid2)==0) && (options->m_verbose) && obj1_name && obj2_name) { - + H5T_class_t cl = H5Tget_class(f_tid1); - + parallel_print("Warning: different storage datatype\n"); if ( cl == H5T_INTEGER || cl == H5T_FLOAT ) @@ -777,14 +777,14 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } - + } - + /*------------------------------------------------------------------------- * check for the same rank *------------------------------------------------------------------------- */ - + if ( rank1 != rank2 ) { @@ -807,12 +807,12 @@ int diff_can_type( hid_t f_tid1, /* file data type */ options->not_cmp = 1; return can_compare; } - + /*------------------------------------------------------------------------- * check for different dimensions *------------------------------------------------------------------------- */ - + assert(rank1==rank2); for ( i=0; i<rank1; i++) { @@ -824,19 +824,19 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( dims1[i] != dims2[i] ) dim_diff=1; } - + /*------------------------------------------------------------------------- * current dimensions *------------------------------------------------------------------------- */ - + if (dim_diff==1) { if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); - if (maxdim1 && maxdim2) + if (maxdim1 && maxdim2) { parallel_print(", max dimensions "); print_dimensions(rank1,maxdim1); @@ -848,7 +848,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ parallel_print("\n"); } } - + can_compare = 0; options->not_cmp = 1; @@ -857,7 +857,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } - + /*------------------------------------------------------------------------- * maximum dimensions; just give a warning *------------------------------------------------------------------------- @@ -878,7 +878,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( tclass1 == H5T_COMPOUND ) { - + int nmembs1; int nmembs2; int j; @@ -890,7 +890,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( nmembs1 != nmembs2 ) { - + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1); @@ -902,7 +902,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ options->not_cmp = 1; return can_compare; } - + for (j = 0; j < nmembs1; j++) { memb_type1 = H5Tget_member_type(f_tid1, (unsigned)j); @@ -927,22 +927,22 @@ int diff_can_type( hid_t f_tid1, /* file data type */ H5Tclose(memb_type2); return can_compare; } - + H5Tclose(memb_type1); H5Tclose(memb_type2); - + } - - - - - + + + + + } - - - + + + return can_compare; } @@ -966,12 +966,12 @@ void print_sizes( const char *obj1, { size_t f_size1, f_size2; /* size of type in file */ size_t m_size1, m_size2; /* size of type in memory */ - + f_size1 = H5Tget_size( f_tid1 ); f_size2 = H5Tget_size( f_tid2 ); m_size1 = H5Tget_size( m_tid1 ); m_size2 = H5Tget_size( m_tid2 ); - + parallel_print("\n"); parallel_print("------------------\n"); parallel_print("sizeof(char) %u\n", sizeof(char) ); @@ -983,18 +983,18 @@ void print_sizes( const char *obj1, print_type(f_tid1); parallel_print("\n"); parallel_print("size on file %u\n", f_size1 ); - + parallel_print("type on memory "); print_type(m_tid1); parallel_print("\n"); parallel_print("size on memory %u\n", m_size1 ); - + parallel_print("<%s> ------------------\n", obj2); parallel_print("type on file "); print_type(f_tid2); parallel_print("\n"); parallel_print("size on file %u\n", f_size2 ); - + parallel_print("type on memory "); print_type(m_tid2); parallel_print("\n"); diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 1acc493..721c3d7 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -106,14 +106,14 @@ print_dimensions (int rank, hsize_t *dims) if ( rank > 0 ) { - + parallel_print("[" ); for ( i = 0; i < rank-1; i++) { parallel_print(HSIZE_T_FORMAT, dims[i]); parallel_print("x"); } - + parallel_print(HSIZE_T_FORMAT, dims[rank-1]); parallel_print("]" ); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 7f1019a..e997d03 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -43,7 +43,7 @@ int bin_output; /* binary output */ int bin_form; /* binary form */ int region_output; /* region output */ -static h5tool_format_t h5tools_dataformat = { +static h5tool_format_t h5tools_dataformat = { 0, /*raw */ "", /*fmt_raw */ @@ -112,7 +112,7 @@ NULL, /*fmt_ullong */ 1 /*escape non printable characters */ }; -static const h5tools_dump_header_t h5tools_standardformat = { +static const h5tools_dump_header_t h5tools_standardformat = { "standardformat", /*name */ "HDF5", /*fileebgin */ "", /*fileend */ @@ -217,8 +217,8 @@ hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, hsize_t elmt_counter); int h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, @@ -230,8 +230,8 @@ hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, hsize_t elmt_counter); int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer, size_t ncols, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, @@ -299,13 +299,13 @@ void h5tools_init(void) { char lib_str[256]; - + if (!h5tools_init_g) { /* register the error class */ sprintf(lib_str, "%d.%d.%d",H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - + H5TOOLS_INIT_ERROR() - + if (!rawdatastream) rawdatastream = stdout; @@ -346,7 +346,7 @@ h5tools_close(void) term_ref_path_table(); H5TOOLS_CLOSE_ERROR() - + /* Shut down the library */ H5close(); @@ -445,7 +445,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if(drivernum) *drivernum = MPIO_IDX; } /* end if */ - } + } else if (!strcmp(driver, drivernames[MPIPOSIX_IDX])) { /* MPI-I/O Driver */ /* check if MPI has been initialized. */ @@ -727,9 +727,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, * None *------------------------------------------------------------------------- */ -static void +static void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum) + h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum) { h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ @@ -841,7 +841,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, * new field sm_pos in h5tools_context_t, the current stripmine element position *------------------------------------------------------------------------- */ -void +void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, h5tools_context_t *ctx/*in,out*/, unsigned flags, hsize_t nelmts, hid_t type, void *_mem) @@ -928,13 +928,13 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai if(H5Sclose(region_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); } /* end if (region_space >= 0) */ - else + else HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); if(H5Dclose(region_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); } /* if (region_id >= 0) */ - else + else HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); ctx->need_prefix = TRUE; @@ -966,17 +966,17 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * Purpose: Render an element to output STREAM. * Description: * Prints the string buffer to the output STREAM. The string is - * printed according to the format described in INFO. The CTX struct - * contains context information shared between calls to this function. - * + * printed according to the format described in INFO. The CTX struct + * contains context information shared between calls to this function. + * * Return: * False if a dimension end is reached, otherwise true - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * h5tools_str_t *buffer * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -985,10 +985,10 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, - size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter) + size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter) { hbool_t dimension_break = TRUE; char *s; @@ -1002,9 +1002,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * If the element would split on multiple lines if printed at our * current location... */ - if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + (ctx->cur_column + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* @@ -1013,8 +1013,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + else if ((ctx->prev_prefix_len + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we @@ -1045,11 +1045,11 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * is too long to fit on a line then start this element at the * beginning of the line. */ - if (info->line_multi_new == 1 && - ctx->prev_multiline && - (ctx->cur_column + - h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + ctx->prev_multiline && + (ctx->cur_column + + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; @@ -1066,8 +1066,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * one-at a time. */ multiline = 0; - for (secnum = 0, multiline = 0; - (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); + for (secnum = 0, multiline = 0; + (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { /* * If the current section plus possible suffix and end-of-line @@ -1079,10 +1079,10 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * Added the info->skip_first because the dumper does not want * this check to happen for the first line */ - if ((!info->skip_first || local_elmt_counter) && - (ctx->cur_column + - strlen(section) + - strlen(OPT(info->elmt_suf2, " ")) + + if ((!info->skip_first || local_elmt_counter) && + (ctx->cur_column + + strlen(section) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; @@ -1122,17 +1122,17 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * Purpose: Render a region element to output STREAM. * Description: * Prints the string buffer to the output STREAM. The string is - * printed according to the format described in INFO. The CTX struct - * contains context information shared between calls to this function. - * + * printed according to the format described in INFO. The CTX struct + * contains context information shared between calls to this function. + * * Return: * False if a dimension end is reached, otherwise true - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * h5tools_str_t *buffer * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -1142,10 +1142,10 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, - size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter) + size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter) { hbool_t dimension_break = TRUE; char *s; @@ -1159,9 +1159,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * If the element would split on multiple lines if printed at our * current location... */ - if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + (ctx->cur_column + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* @@ -1170,8 +1170,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + else if ((ctx->prev_prefix_len + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we @@ -1202,11 +1202,11 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * is too long to fit on a line then start this element at the * beginning of the line. */ - if (info->line_multi_new == 1 && - ctx->prev_multiline && - (ctx->cur_column + - h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + + if (info->line_multi_new == 1 && + ctx->prev_multiline && + (ctx->cur_column + + h5tools_ncols(s) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; @@ -1235,10 +1235,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * Added the info->skip_first because the dumper does not want * this check to happen for the first line */ - if ((!info->skip_first || local_elmt_counter) && - (ctx->cur_column + - strlen(section) + - strlen(OPT(info->elmt_suf2, " ")) + + if ((!info->skip_first || local_elmt_counter) && + (ctx->cur_column + + strlen(section) + + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; @@ -1276,13 +1276,13 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * Audience: Public * Chapter: H5Tools Library * Purpose: Print the data values from a dataset referenced by region blocks. - * + * * Description: * This is a special case subfunction to print the data in a region reference of type blocks. - * + * * Return: * The function returns FAIL if there was an error, otherwise SUCEED - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * size_t ncols @@ -1290,10 +1290,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * hssize_t nblocks is the number of blocks in the region *------------------------------------------------------------------------- */ -int +int h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) { HERR_INIT(int, SUCCEED) hbool_t dimension_break = TRUE; @@ -1364,12 +1364,12 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, ctx.indent_level++; if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - + /* assume entire data space to be printed */ for (jndx = 0; jndx < (size_t) ctx.ndims; jndx++) ctx.p_min_idx[jndx] = start[jndx]; init_acc_pos(&ctx, total_size); - + /* print the data */ region_flags = START_OF_DATA; if (blkndx == nblocks - 1) @@ -1390,7 +1390,7 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); - h5tools_str_sprint(buffer, info, region_id, type_id, + h5tools_str_sprint(buffer, info, region_id, type_id, ((char*)region_buf + jndx * type_size), &ctx); if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0) @@ -1399,7 +1399,7 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, ncols, ptdata, jndx, elmtno); /* Render the region data element end */ - + if(FALSE == dimension_break) elmtno = 0; } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ @@ -1412,12 +1412,12 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id, HDfree(count); HDfree(region_buf); HDfree(dims1); - + if(H5Sclose(mem_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); if(H5Sclose(sid1) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - + CATCH return ret_value; } @@ -1426,17 +1426,17 @@ CATCH * Audience: Public * Chapter: H5Tools Library * Purpose: Print some values from a dataset referenced by region blocks. - * + * * Description: * This is a special case subfunction to dump a region reference using blocks. - * + * * Return: * The function returns False if the last dimension has been reached, otherwise True - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -1445,7 +1445,7 @@ CATCH * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, @@ -1469,7 +1469,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, /* Print block information */ if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - + /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -1483,7 +1483,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, ctx->indent_level++; ctx->need_prefix = TRUE; h5tools_str_append(buffer, "REGION_TYPE BLOCK "); - + alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL) @@ -1580,10 +1580,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, done: free(ptdata); - + if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - + if(H5Tclose(dtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -1594,7 +1594,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_str_append(buffer, "%s %s ", h5tools_dump_header_format->dataend, h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the dataend element end */ @@ -1604,7 +1604,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, /* Render the region } element begin */ h5tools_str_reset(buffer); h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the region } element end */ @@ -1618,13 +1618,13 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, * Audience: Public * Chapter: H5Tools Library * Purpose: Print the data values from a dataset referenced by region points. - * + * * Description: * This is a special case subfunction to print the data in a region reference of type points. - * + * * Return: * The function returns FAIL on error, otherwise SUCCEED - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * size_t ncols @@ -1632,10 +1632,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, * hssize_t npoints is the number of points in the region *------------------------------------------------------------------------- */ -int +int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, - h5tools_str_t *buffer, size_t ncols, + FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx, + h5tools_str_t *buffer, size_t ncols, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) { HERR_INIT(int, SUCCEED) hbool_t dimension_break = TRUE; @@ -1688,7 +1688,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if (ctx.ndims > 0) { ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } + } else ctx.size_last_dim = 0; @@ -1702,17 +1702,17 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, curr_pos = 0; /* points requires constant 0 */ ctx.sm_pos = jndx * ndims; - + h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - h5tools_str_sprint(buffer, info, region_id, type_id, + h5tools_str_sprint(buffer, info, region_id, type_id, ((char*)region_buf + jndx * type_size), &ctx); if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0) h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); - dimension_break = - h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, + dimension_break = + h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, ncols, ptdata, 0, elmtno); /* Render the point element end */ @@ -1724,7 +1724,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, done: HDfree(region_buf); HDfree(dims1); - + if(H5Sclose(mem_space) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); CATCH @@ -1735,17 +1735,17 @@ CATCH * Audience: Public * Chapter: H5Tools Library * Purpose: Print some values from a dataset referenced by region points. - * + * * Description: * This is a special case subfunction to dump a region reference using points. - * + * * Return: * The function returns False if the last dimension has been reached, otherwise True - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * hsize_t *curr_pos - * + * * Parameters Description: * h5tools_str_t *buffer is the string into which to render * hsize_t curr_pos is the total data element position @@ -1754,9 +1754,9 @@ CATCH * hsize_t elmt_count is the data element loop counter *------------------------------------------------------------------------- */ -hbool_t +hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter) { HERR_INIT(hbool_t, TRUE) @@ -1819,7 +1819,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, if((dtype = H5Dget_type(region_id)) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); - + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); @@ -1882,7 +1882,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, done: free(ptdata); - + if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -1896,7 +1896,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, h5tools_str_append(buffer, "%s %s ", h5tools_dump_header_format->dataend, h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the dataend element end*/ @@ -1906,7 +1906,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, /* Render the region } element begin */ h5tools_str_reset(buffer); h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); /* Render the region } element end */ @@ -1948,7 +1948,7 @@ CATCH *------------------------------------------------------------------------- */ static herr_t -h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, +h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type, struct subset_t *sset, hid_t f_space, hsize_t hyperslab_count, hsize_t *temp_start,/* start inside offset count loop */ @@ -1987,7 +1987,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { /* jump rows if size of block exceeded cases where block > 1 only and stride > block */ - if (size_row_block > 1 + if (size_row_block > 1 && row_counter == size_row_block && sset->stride[row_dim] > sset->block[row_dim]) { @@ -2001,7 +2001,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* calculate the potential number of elements we're going to print */ if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - + if((sm_nelmts = H5Sget_select_npoints(f_space)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); @@ -2012,7 +2012,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c */ if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - + if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; @@ -2022,35 +2022,35 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } - + assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if((sm_buf = HDmalloc((size_t) sm_nelmts * p_type_nbytes)) == NULL) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); - + if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - + if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - + /* read the data */ if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - + /* print the data */ flags = START_OF_DATA; - + if (hyperslab_count == 1) flags |= END_OF_DATA; - + for (i = 0; i < ctx->ndims; i++) ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]); - + /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ if(H5Sget_select_bounds(f_space, low, high) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); - + elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { hsize_t offset = 1; /* accumulation of the previous dimensions */ @@ -2059,11 +2059,11 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c elmtno += low[i] * offset; } elmtno += low[ctx->ndims - 1]; - + /* initialize the current stripmine position; this is necessary to print the array indices */ ctx->sm_pos = elmtno; - + h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); if(H5Sclose(sm_space) < 0) @@ -2121,7 +2121,7 @@ CATCH *------------------------------------------------------------------------- */ static herr_t -h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, +h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type, struct subset_t *sset, hid_t f_space, hsize_t *total_size) { @@ -2192,11 +2192,11 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools else { count = 1; } - + h5tools_print_simple_subset(stream, info, ctx, dset, p_type, sset, - f_space, count, temp_start, temp_count, + f_space, count, temp_start, temp_count, temp_block, temp_stride, total_size, row_dim); - + if (ctx->ndims > 2) { /* dimension for start */ current_outer_dim = (ctx->ndims - 2) - 1; @@ -2337,9 +2337,9 @@ CATCH * returns FAIL. *------------------------------------------------------------------------- */ -static int +static int h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, - hid_t dset, hid_t p_type, int indentlevel) + hid_t dset, hid_t p_type, int indentlevel) { hid_t f_space; /* file data space */ hsize_t elmtno; /* counter */ @@ -2612,9 +2612,9 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, * *------------------------------------------------------------------------- */ -int +int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t _p_type, struct subset_t *sset, int indentlevel) + hid_t _p_type, struct subset_t *sset, int indentlevel) { hid_t f_space; hid_t p_type = _p_type; @@ -2727,9 +2727,9 @@ CATCH * *------------------------------------------------------------------------- */ -int -h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) +int +h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) { HERR_INIT(int, FAIL) char *mname; @@ -3081,7 +3081,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, case H5T_COMPOUND: if((nmembers = H5Tget_nmembers(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - + h5tools_str_append(buffer, "H5T_COMPOUND %s\n", h5tools_dump_header_format->structblockbegin); for (i = 0; i < nmembers; i++) { @@ -3089,12 +3089,12 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, if((mtype = H5Tget_member_type(type, i))>=0) { if (H5Tget_class(mtype) == H5T_COMPOUND) ctx->indent_level++; - + h5tools_print_datatype(buffer, info, ctx, mtype); - + if (H5Tget_class(mtype) == H5T_COMPOUND) ctx->indent_level--; - + h5tools_str_append(buffer, " \"%s\";\n", mname); if(H5Tclose(mtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -3129,10 +3129,10 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, h5tools_print_datatype(buffer, info, ctx, super); if(H5Tclose(super) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - + h5tools_str_append(buffer, ";\n"); h5tools_print_enum(buffer, type); - + ctx->indent_level--; h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); @@ -3161,7 +3161,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, /* Print array dimensions */ for (i = 0; i < ndims; i++) h5tools_str_append(buffer, "[%d]", (int) dims[i]); - + h5tools_str_append(buffer, " "); } else @@ -3206,8 +3206,8 @@ CATCH * *------------------------------------------------------------------------- */ -int -h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) +int +h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) { HERR_INIT(int, SUCCEED) hsize_t size[H5TOOLS_DUMP_MAX_RANK]; @@ -3282,8 +3282,8 @@ CATCH * h5tools_context_t *ctx * *-----------------------------------------------------------------------*/ -int -h5tools_print_enum(h5tools_str_t *buffer, hid_t type) +int +h5tools_print_enum(h5tools_str_t *buffer, hid_t type) { HERR_INIT(int, SUCCEED) char **name = NULL; /*member names */ @@ -3293,7 +3293,7 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) int nchars; /*number of output characters */ hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer datatype */ - H5T_sign_t sign_type; /*sign of value type */ + H5T_sign_t sign_type; /*sign of value type */ size_t type_size; /*value type size */ size_t dst_size; /*destination value type size */ int snmembs; @@ -3303,10 +3303,10 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); nmembs = (unsigned)snmembs; assert(nmembs > 0); - + if((super = H5Tget_super(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); - + if((type_size = H5Tget_size(type)) <= 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); @@ -3410,13 +3410,13 @@ CATCH * atomic datatype or committed/transient datatype. * * Return: void - * + * * In/Out: h5tools_context_t *ctx *------------------------------------------------------------------------- */ -void +void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) + h5tools_context_t *ctx, hid_t type) { size_t ncols = 80; /* available output width */ h5tools_str_t buffer; /* string into which to render */ @@ -3470,8 +3470,8 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, * Return: void *------------------------------------------------------------------------- */ -void -init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) +void +init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) { int i; @@ -3525,7 +3525,7 @@ CATCH * Failure: FAIL *------------------------------------------------------------------------- */ -static int +static int render_bin_output(FILE *stream, hid_t tid, void *_mem) { HERR_INIT(int, SUCCEED) @@ -3880,8 +3880,8 @@ CATCH * Return: TRUE if all bytes are zero; FALSE otherwise *------------------------------------------------------------------------- */ -static -hbool_t h5tools_is_zero(const void *_mem, size_t size) +static +hbool_t h5tools_is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *) _mem; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 2b1e4bf..7d207ba 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -53,9 +53,9 @@ #define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK -/* - * Strings for output - these were duplicated from the h5dump.h - * file in order to support region reference data display +/* + * Strings for output - these were duplicated from the h5dump.h + * file in order to support region reference data display */ #define ATTRIBUTE "ATTRIBUTE" #define BLOCK "BLOCK" @@ -105,9 +105,9 @@ #define BEGIN "{" #define END "}" -/* - * dump structure for output - this was duplicated from the h5dump.h - * file in order to support region reference data display +/* + * dump structure for output - this was duplicated from the h5dump.h + * file in order to support region reference data display */ typedef struct h5tools_dump_header_t { const char *name; @@ -515,7 +515,7 @@ struct subset_t { hsize_t *block; }; -/* The following include, h5tools_str.h, must be after the +/* The following include, h5tools_str.h, must be after the * above stucts are defined. There is a dependency in the following * include that hasn't been identified yet. */ @@ -554,11 +554,11 @@ extern int h5tools_canreadf(const char* name, extern int h5tools_can_encode(H5Z_filter_t filtn); void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); -/* +/* * new functions needed to display region reference data */ void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t type); + h5tools_context_t *ctx/*in,out*/, hid_t type); int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/, hid_t space); int h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index dc5f87b..a7c0d3c 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -87,7 +87,7 @@ extern hid_t H5E_tools_min_id_g; } /* - * H5E_THROW macro, used to facilitate error reporting within a function body. + * H5E_THROW macro, used to facilitate error reporting within a function body. * The arguments are the minor error number, and an error string. * The return value is assigned to a variable `ret_value' and control branches * to the `catch_except' label, if we're not already past it. @@ -109,8 +109,8 @@ extern hid_t H5E_tools_min_id_g; } /* - * HGOTO_DONE macro, used to facilitate normal return within a function body. - * The argument is the return value which is assigned to the `ret_value' + * HGOTO_DONE macro, used to facilitate normal return within a function body. + * The argument is the return value which is assigned to the `ret_value' * variable. Control branches to the `done' label. */ #define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3567975..55596cd 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -350,8 +350,8 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, * * Return: Success: Pointer to the prefix. * Failure: NULL - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * h5tools_str_t *str *------------------------------------------------------------------------- @@ -359,7 +359,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, char * h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t min_idx[], hsize_t max_idx[], - h5tools_context_t *ctx) + h5tools_context_t *ctx) { hsize_t p_prod[H5S_MAX_RANK]; size_t i = 0; @@ -406,15 +406,15 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, * the information to the specified string. * * Return: none - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * h5tools_str_t *str *------------------------------------------------------------------------- */ -void +void h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region, - const h5tool_format_t *info, h5tools_context_t *ctx) + const h5tool_format_t *info, h5tools_context_t *ctx) { hssize_t nblocks; hsize_t alloc_size; @@ -422,7 +422,7 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region, int ndims = H5Sget_simple_extent_ndims(region); /* - * This function fails if the region does not have blocks. + * This function fails if the region does not have blocks. */ H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); @@ -467,15 +467,15 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region, * the information to the specified string. * * Return: none - * - * In/Out: + * + * In/Out: * h5tools_context_t *ctx * h5tools_str_t *str *------------------------------------------------------------------------- */ -void +void h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region, - const h5tool_format_t *info, h5tools_context_t *ctx) + const h5tool_format_t *info, h5tools_context_t *ctx) { hssize_t npoints; hsize_t alloc_size; @@ -699,7 +699,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, "%Lf", templdouble); #endif } - else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || + else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) { h5tools_print_char(str, info, (char) (*ucp_vp)); } @@ -788,13 +788,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else if (H5Tequal(type, H5T_NATIVE_UINT)) { HDmemcpy(&tempuint, vp, sizeof(unsigned int)); h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); - } + } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { h5tools_str_append(str, OPT(info->fmt_schar, "%d"), *cp_vp); - } + } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp); - } + } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { short tempshort; @@ -1110,9 +1110,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai * Return: Nothing *------------------------------------------------------------------------- */ -void +void h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info, - hid_t container, void *vp, h5tools_context_t *ctx) + hid_t container, void *vp, h5tools_context_t *ctx) { hid_t obj, region; char ref_name[1024]; diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 61b7905..98dd065 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -35,7 +35,7 @@ extern char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fm extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info, hsize_t elmtno, unsigned ndims, hsize_t min_idx[], hsize_t max_idx[], h5tools_context_t *ctx); -/* +/* * new functions needed to display region reference data */ extern char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 46b425b..82e9ab9 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -232,8 +232,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } sp = 1; - } - + } + /* wildcard argument */ else if (*cp == '*') { @@ -249,16 +249,16 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_arg = NULL; } } - - else + + else { /* set up to look at next char in token, next time */ if (argv[opt_ind][++sp] == '\0') { /* no more in current token, so setup next token */ opt_ind++; sp = 1; - - + + } opt_arg = NULL; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 69b4512..287af29 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -150,7 +150,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(udata->is_absolute) { size_t base_len = HDstrlen(udata->base_grp_name); size_t add_slash = base_len ? ((udata->base_grp_name)[base_len-1] != '/') : 1; - + if(NULL == (new_name = HDmalloc(base_len + add_slash + HDstrlen(path) + 1))) return(H5_ITER_ERROR); HDstrcpy(new_name, udata->base_grp_name); diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index b7b71d1..b45cfce 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -540,9 +540,9 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if(extra == 0) { + if(extra == 0) { fprintf(stderr, "ERROR: Need object header address containing the layout messagein order to dump header\n"); - fprintf(stderr, "Fixed array header block usage:\n"); + fprintf(stderr, "Fixed array header block usage:\n"); fprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n"); HDexit(4); } /* end if */ |