diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:29:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:29:13 (GMT) |
commit | fd70b2afa883f94718ffb7f4f33d104d76e3fe0a (patch) | |
tree | c1add8db2a4848202d86a9b274bfaf8c7b80e961 /tools/lib | |
parent | 35b0159a0a5f1f4b80e305204ea51a742b052403 (diff) | |
download | hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.zip hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.tar.gz hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.tar.bz2 |
[svn-r18197] Description:
Trim trailing whitespace from source code files with this command:
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.f90" \) -print |xargs -n 1 sed -i "" 's/[[:blank:]]*$//'
Tested on:
None - eyeballed only
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 96 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 78 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 250 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 4 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 314 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 18 | ||||
-rw-r--r-- | tools/lib/h5tools_error.h | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 36 | ||||
-rw-r--r-- | tools/lib/h5tools_str.h | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 12 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 2 |
11 files changed, 409 insertions, 409 deletions
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); |