diff options
99 files changed, 2110 insertions, 2080 deletions
diff --git a/bin/genltanalyze b/bin/genltanalyze index 8bb0423..0b1b1e5 100644 --- a/bin/genltanalyze +++ b/bin/genltanalyze @@ -49,6 +49,17 @@ echo "Generate hl/src/H5LTparse.c from hl/src/H5LTparse.y" bison -pH5LTyy -o H5LTparse.c -d H5LTparse.y echo "Generate hl/src/H5LTanalyze.c from hl/src/H5LTanalyze.l" flex --nounistd -PH5LTyy -oH5LTanalyze.c H5LTanalyze.l + +# fix H5LTparse.c to declare H5LTyyparse return type as an hid_t +# instead of int. Currently the generated function H5LTyyparse is +# generated with a return value of type int, which is a mapping to the +# flex yyparse function. The return value in the HL library should be +# an hid_t. +# I propose to not use flex to generate this function, but for now I am +# adding a perl command to find and replace this function declaration in +# H5LTparse.c. +perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' H5LTparse.c +perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' H5LTparse.c cd ../.. exit 0 diff --git a/examples/h5_reference.c b/examples/h5_reference.c index 31aa2cf..afd550c 100644 --- a/examples/h5_reference.c +++ b/examples/h5_reference.c @@ -81,8 +81,8 @@ main(void) { * Create references to the group "A" and dataset "B" * and store them in the wbuf. */ - H5Rcreate(&wbuf[0], fid, "A", H5R_OBJECT, -1); - H5Rcreate(&wbuf[1], fid, "B", H5R_OBJECT, -1); + H5Rcreate(&wbuf[0], fid, "A", H5R_OBJECT, (hid_t)-1); + H5Rcreate(&wbuf[1], fid, "B", H5R_OBJECT, (hid_t)-1); /* * Write dataset R using default transfer properties. diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c index 77aab08..67d10e3 100644 --- a/fortran/src/H5Rf.c +++ b/fortran/src/H5Rf.c @@ -59,7 +59,7 @@ nh5rcreate_object_c(haddr_t_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) /* * Call H5Rcreate function. */ - if(H5Rcreate(&ref_c, *loc_id, c_name, H5R_OBJECT, -1) < 0) + if(H5Rcreate(&ref_c, *loc_id, c_name, H5R_OBJECT, (hid_t)-1) < 0) HGOTO_DONE(FAIL) /* Copy the reference created */ diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index e60d587..a743e90 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -22,6 +22,9 @@ #include "H5TBprivate.h" +/* Local routines */ +static herr_t H5DS_is_reserved(hid_t did); +static hid_t H5DS_get_REFLIST_type(void); /*------------------------------------------------------------------------- * Function: H5DSset_scale @@ -221,11 +224,11 @@ herr_t H5DSattach_scale(hid_t did, *------------------------------------------------------------------------- */ /* create a reference for the >>DS<< dataset */ - if (H5Rcreate(&ref_to_ds,dsid,".",H5R_OBJECT,-1) < 0) + if (H5Rcreate(&ref_to_ds, dsid, ".", H5R_OBJECT, (hid_t)-1) < 0) return FAIL; /* create a reference for the >>data<< dataset */ - if (H5Rcreate(&dsl.ref,did,".",H5R_OBJECT,-1) < 0) + if (H5Rcreate(&dsl.ref, did, ".", H5R_OBJECT, (hid_t)-1) < 0) return FAIL; /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ @@ -254,7 +257,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -265,7 +268,7 @@ herr_t H5DSattach_scale(hid_t did, /* store the REF information in the index of the dataset that has the DS */ buf[idx].len = 1; - buf[idx].p = malloc( 1 * sizeof(hobj_ref_t)); + buf[idx].p = HDmalloc( 1 * sizeof(hobj_ref_t)); ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; /* write the attribute with the reference */ @@ -282,7 +285,7 @@ herr_t H5DSattach_scale(hid_t did, if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } @@ -303,7 +306,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -343,13 +346,13 @@ herr_t H5DSattach_scale(hid_t did, if(buf[idx].len > 0) { buf[idx].len++; len = buf[idx].len; - buf[idx].p = realloc(buf[idx].p, len * sizeof(hobj_ref_t)); + buf[idx].p = HDrealloc(buf[idx].p, len * sizeof(hobj_ref_t)); ((hobj_ref_t *)buf[idx].p)[len - 1] = ref_to_ds; } /* end if */ else { /* store the REF information in the index of the dataset that has the DS */ buf[idx].len = 1; - buf[idx].p = malloc(sizeof(hobj_ref_t)); + buf[idx].p = HDmalloc(sizeof(hobj_ref_t)); ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; } /* end else */ } /* end if */ @@ -367,7 +370,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* has_dimlist */ @@ -447,7 +450,7 @@ herr_t H5DSattach_scale(hid_t did, nelmts++; - dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t)); + dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t)); if(dsbuf == NULL) goto out; @@ -497,7 +500,7 @@ herr_t H5DSattach_scale(hid_t did, if (H5Tclose(ntid) < 0) goto out; - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } /* has_reflist */ @@ -519,9 +522,9 @@ herr_t H5DSattach_scale(hid_t did, /* error zone */ out: if(buf) - free(buf); + HDfree(buf); if(dsbuf) - free(dsbuf); + HDfree(dsbuf); H5E_BEGIN_TRY { H5Sclose(sid); @@ -673,7 +676,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -718,7 +721,7 @@ herr_t H5DSdetach_scale(hid_t did, ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; len = --buf[idx].len; if(len == 0) { - free(buf[idx].p); + HDfree(buf[idx].p); buf[idx].p = NULL; } /* Since a reference to a dim. scale can be inserted only once, @@ -760,7 +763,7 @@ herr_t H5DSdetach_scale(hid_t did, if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; @@ -786,7 +789,7 @@ herr_t H5DSdetach_scale(hid_t did, if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) goto out; - dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t)); + dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t)); if(dsbuf == NULL) goto out; @@ -876,7 +879,7 @@ herr_t H5DSdetach_scale(hid_t did, if (H5Tclose(ntid) < 0) goto out; - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; return SUCCEED; @@ -890,7 +893,7 @@ out: H5Tclose(tid); if(dsbuf) { - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } if(buf) { @@ -898,9 +901,9 @@ out: free the pointers allocated when we read data in */ for(i = 0; i < rank; i++) { if(buf[i].p) - free(buf[i].p); + HDfree(buf[i].p); } - free(buf); + HDfree(buf); buf = NULL; } } H5E_END_TRY; @@ -1033,7 +1036,7 @@ htri_t H5DSis_attached(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -1079,7 +1082,7 @@ htri_t H5DSis_attached(hid_t did, goto out; if (H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* has_dimlist */ @@ -1116,7 +1119,7 @@ htri_t H5DSis_attached(hid_t did, if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) goto out; - dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t)); + dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t)); if (dsbuf == NULL) goto out; @@ -1170,7 +1173,7 @@ htri_t H5DSis_attached(hid_t did, if (H5Aclose(aid) < 0) goto out; - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } /* has_reflist */ @@ -1189,11 +1192,11 @@ out: } H5E_END_TRY; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } if(dsbuf) { - free(dsbuf); + HDfree(dsbuf); dsbuf = NULL; } return FAIL; @@ -1317,7 +1320,7 @@ herr_t H5DSiterate_scales(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -1380,7 +1383,7 @@ herr_t H5DSiterate_scales(hid_t did, if (H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* if has_dimlist */ @@ -1390,7 +1393,7 @@ out: H5E_BEGIN_TRY { if(buf) { H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf); - free(buf); + HDfree(buf); } H5Sclose(sid); H5Aclose(aid); @@ -1489,7 +1492,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; /* allocate and initialize */ - buf = (const char **) malloc((size_t) rank * sizeof(char *)); + buf = (const char **) HDmalloc((size_t) rank * sizeof(char *)); if (buf == NULL) goto out; @@ -1513,7 +1516,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } } @@ -1532,7 +1535,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; /* allocate and initialize */ - buf = (const char **) malloc((size_t) rank * sizeof(char *)); + buf = (const char **) HDmalloc((size_t) rank * sizeof(char *)); if (buf == NULL) goto out; @@ -1543,7 +1546,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) /* free the ptr that will be replaced by label */ if (buf[idx]) - free((void *)buf[idx]); + HDfree((void *)buf[idx]); /* store the label information in the required index */ buf[idx] = label; @@ -1559,7 +1562,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) for (i = 0; i < (unsigned int) rank; i++) { if (buf[i]) - free((void *)buf[i]); + HDfree((void *)buf[i]); } /* close */ @@ -1569,7 +1572,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } } @@ -1586,9 +1589,9 @@ out: for (i = 0; i < (unsigned int) rank; i++) { if (buf[i]) - free((void *)buf[i]); + HDfree((void *)buf[i]); } - free(buf); + HDfree(buf); } H5E_BEGIN_TRY { @@ -1692,7 +1695,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) goto out; /* allocate and initialize */ - buf = (char **) malloc((size_t) rank * sizeof(char *)); + buf = (char **) HDmalloc((size_t) rank * sizeof(char *)); if (buf == NULL) goto out; @@ -1724,7 +1727,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) for (i = 0; i < rank; i++) { if (buf[i]) - free(buf[i]); + HDfree(buf[i]); } /* close */ @@ -1734,7 +1737,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) goto out; if (buf) { - free(buf); + HDfree(buf); buf = NULL; } @@ -1748,9 +1751,9 @@ out: for (i = 0; i < rank; i++) { if (buf[i]) - free(buf[i]); + HDfree(buf[i]); } - free(buf); + HDfree(buf); } H5E_BEGIN_TRY { @@ -1845,7 +1848,7 @@ ssize_t H5DSget_scale_name(hid_t did, goto out; /* allocate a temporary buffer */ - buf = (char*)malloc(nbytes * sizeof(char)); + buf = (char*)HDmalloc(nbytes * sizeof(char)); if (buf == NULL) goto out; @@ -1872,7 +1875,7 @@ ssize_t H5DSget_scale_name(hid_t did, if (H5Sclose(sid) < 0) goto out; if (buf) - free(buf); + HDfree(buf); return (ssize_t)(nbytes - 1); @@ -1884,7 +1887,7 @@ out: H5Sclose(sid); } H5E_END_TRY; if (buf) - free(buf); + HDfree(buf); return FAIL; } @@ -2052,7 +2055,7 @@ int H5DSget_num_scales(hid_t did, goto out; /* allocate and initialize the VL */ - buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t)); + buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t)); if(buf == NULL) goto out; @@ -2071,7 +2074,7 @@ int H5DSget_num_scales(hid_t did, goto out; if(H5Aclose(aid) < 0) goto out; - free(buf); + HDfree(buf); buf = NULL; } /* has_dimlist */ @@ -2086,7 +2089,7 @@ out: } H5E_END_TRY; if(buf) - free(buf); + HDfree(buf); return FAIL; } @@ -2109,6 +2112,7 @@ out: *------------------------------------------------------------------------- */ +static herr_t H5DS_is_reserved(hid_t did) { int has_class; @@ -2179,6 +2183,7 @@ out: *------------------------------------------------------------------------- */ +static hid_t H5DS_get_REFLIST_type(void) { hid_t ntid_t = -1; diff --git a/hl/src/H5DSprivate.h b/hl/src/H5DSprivate.h index 5094208..61c0a1c 100644 --- a/hl/src/H5DSprivate.h +++ b/hl/src/H5DSprivate.h @@ -37,8 +37,6 @@ typedef struct ds_list_t { *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5DS_is_reserved( hid_t did); -H5_HLDLL hid_t H5DS_get_REFLIST_type(void); #endif diff --git a/hl/src/H5HLprivate2.h b/hl/src/H5HLprivate2.h index e2597db..1b67c70 100644 --- a/hl/src/H5HLprivate2.h +++ b/hl/src/H5HLprivate2.h @@ -22,44 +22,8 @@ /* Public High-Level header */ #include "hdf5_hl.h" -/* The following is copied from src/H5private.h */ - -/* - * Status return values for the `herr_t' type. - * Since some unix/c routines use 0 and -1 (or more precisely, non-negative - * vs. negative) as their return code, and some assumption had been made in - * the code about that, it is important to keep these constants the same - * values. When checking the success or failure of an integer-valued - * function, remember to compare against zero and not one of these two - * values. - */ -#define SUCCEED 0 -#define FAIL (-1) -#define UFAIL (unsigned)(-1) - -/* minimum of two, three, or four values */ -#undef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) -#define MIN2(a,b) MIN(a,b) -#define MIN3(a,b,c) MIN(a,MIN(b,c)) -#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d)) - -/* maximum of two, three, or four values */ -#undef MAX -#define MAX(a,b) (((a)>(b)) ? (a) : (b)) -#define MAX2(a,b) MAX(a,b) -#define MAX3(a,b,c) MAX(a,MAX(b,c)) -#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d)) - -/* - * HDF Boolean type. - */ -#ifndef FALSE -# define FALSE 0 -#endif -#ifndef TRUE -# define TRUE 1 -#endif +/* HDF5 private functions */ +#include "H5private.h" #endif /* _H5HLprivate2_H */ diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 2621ca4..0781e48 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -554,7 +554,7 @@ herr_t H5IMlink_palette( hid_t loc_id, goto out; /* Create a reference. The reference is created on the local id. */ - if(H5Rcreate(&ref, loc_id, pal_name, H5R_OBJECT, -1) < 0) + if(H5Rcreate(&ref, loc_id, pal_name, H5R_OBJECT, (hid_t)-1) < 0) goto out; /* Write the attribute with the reference */ @@ -594,7 +594,7 @@ herr_t H5IMlink_palette( hid_t loc_id, dim_ref = n_refs + 1; - refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref ); + refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref ); if ( H5Aread( aid, atid, refbuf ) < 0) goto out; @@ -604,7 +604,7 @@ herr_t H5IMlink_palette( hid_t loc_id, goto out; /* Create a new reference for this palette. */ - if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, -1 ) < 0) + if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, (hid_t)-1 ) < 0) goto out; refbuf[n_refs] = ref; @@ -635,7 +635,7 @@ herr_t H5IMlink_palette( hid_t loc_id, if(H5Aclose(aid) < 0) goto out; - free( refbuf ); + HDfree( refbuf ); } /* ok_pal == 1 */ @@ -901,7 +901,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, dim_ref = n_refs; - refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref ); + refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref ); if ( H5Aread( aid, atid, refbuf ) < 0) goto out; @@ -930,7 +930,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, goto out; if ( H5Aclose( aid ) < 0) goto out; - free( refbuf ); + HDfree( refbuf ); } @@ -1012,7 +1012,7 @@ herr_t H5IMget_palette( hid_t loc_id, dim_ref = n_refs; - refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref ); + refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref ); if ( H5Aread( aid, atid, refbuf ) < 0) goto out; @@ -1034,7 +1034,7 @@ herr_t H5IMget_palette( hid_t loc_id, goto out; if ( H5Aclose( aid ) < 0) goto out; - free( refbuf ); + HDfree( refbuf ); } /* Close the image dataset. */ diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 9682f78..6c883fc 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -23,6 +23,7 @@ int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) #define token(x) (int)x +#define hid(x) (hid_t)x #ifdef YY_BUF_SIZE #undef YY_BUF_SIZE @@ -71,43 +72,43 @@ hbool_t first_quote = 1; %% -H5T_STD_I8BE {return token(H5T_STD_I8BE_TOKEN);} -H5T_STD_I8LE {return token(H5T_STD_I8LE_TOKEN);} -H5T_STD_I16BE {return token(H5T_STD_I16BE_TOKEN);} -H5T_STD_I16LE {return token(H5T_STD_I16LE_TOKEN);} -H5T_STD_I32BE {return token(H5T_STD_I32BE_TOKEN);} -H5T_STD_I32LE {return token(H5T_STD_I32LE_TOKEN);} -H5T_STD_I64BE {return token(H5T_STD_I64BE_TOKEN);} -H5T_STD_I64LE {return token(H5T_STD_I64LE_TOKEN);} - -H5T_STD_U8BE {return token(H5T_STD_U8BE_TOKEN);} -H5T_STD_U8LE {return token(H5T_STD_U8LE_TOKEN);} -H5T_STD_U16BE {return token(H5T_STD_U16BE_TOKEN);} -H5T_STD_U16LE {return token(H5T_STD_U16LE_TOKEN);} -H5T_STD_U32BE {return token(H5T_STD_U32BE_TOKEN);} -H5T_STD_U32LE {return token(H5T_STD_U32LE_TOKEN);} -H5T_STD_U64BE {return token(H5T_STD_U64BE_TOKEN);} -H5T_STD_U64LE {return token(H5T_STD_U64LE_TOKEN);} - -H5T_NATIVE_CHAR {return token(H5T_NATIVE_CHAR_TOKEN);} -H5T_NATIVE_SCHAR {return token(H5T_NATIVE_SCHAR_TOKEN);} -H5T_NATIVE_UCHAR {return token(H5T_NATIVE_UCHAR_TOKEN);} -H5T_NATIVE_SHORT {return token(H5T_NATIVE_SHORT_TOKEN);} -H5T_NATIVE_USHORT {return token(H5T_NATIVE_USHORT_TOKEN);} -H5T_NATIVE_INT {return token(H5T_NATIVE_INT_TOKEN);} -H5T_NATIVE_UINT {return token(H5T_NATIVE_UINT_TOKEN);} -H5T_NATIVE_LONG {return token(H5T_NATIVE_LONG_TOKEN);} -H5T_NATIVE_ULONG {return token(H5T_NATIVE_ULONG_TOKEN);} -H5T_NATIVE_LLONG {return token(H5T_NATIVE_LLONG_TOKEN);} -H5T_NATIVE_ULLONG {return token(H5T_NATIVE_ULLONG_TOKEN);} - -H5T_IEEE_F32BE {return token(H5T_IEEE_F32BE_TOKEN);} -H5T_IEEE_F32LE {return token(H5T_IEEE_F32LE_TOKEN);} -H5T_IEEE_F64BE {return token(H5T_IEEE_F64BE_TOKEN);} -H5T_IEEE_F64LE {return token(H5T_IEEE_F64LE_TOKEN);} -H5T_NATIVE_FLOAT {return token(H5T_NATIVE_FLOAT_TOKEN);} -H5T_NATIVE_DOUBLE {return token(H5T_NATIVE_DOUBLE_TOKEN);} -H5T_NATIVE_LDOUBLE {return token(H5T_NATIVE_LDOUBLE_TOKEN);} +H5T_STD_I8BE {return hid(H5T_STD_I8BE_TOKEN);} +H5T_STD_I8LE {return hid(H5T_STD_I8LE_TOKEN);} +H5T_STD_I16BE {return hid(H5T_STD_I16BE_TOKEN);} +H5T_STD_I16LE {return hid(H5T_STD_I16LE_TOKEN);} +H5T_STD_I32BE {return hid(H5T_STD_I32BE_TOKEN);} +H5T_STD_I32LE {return hid(H5T_STD_I32LE_TOKEN);} +H5T_STD_I64BE {return hid(H5T_STD_I64BE_TOKEN);} +H5T_STD_I64LE {return hid(H5T_STD_I64LE_TOKEN);} + +H5T_STD_U8BE {return hid(H5T_STD_U8BE_TOKEN);} +H5T_STD_U8LE {return hid(H5T_STD_U8LE_TOKEN);} +H5T_STD_U16BE {return hid(H5T_STD_U16BE_TOKEN);} +H5T_STD_U16LE {return hid(H5T_STD_U16LE_TOKEN);} +H5T_STD_U32BE {return hid(H5T_STD_U32BE_TOKEN);} +H5T_STD_U32LE {return hid(H5T_STD_U32LE_TOKEN);} +H5T_STD_U64BE {return hid(H5T_STD_U64BE_TOKEN);} +H5T_STD_U64LE {return hid(H5T_STD_U64LE_TOKEN);} + +H5T_NATIVE_CHAR {return hid(H5T_NATIVE_CHAR_TOKEN);} +H5T_NATIVE_SCHAR {return hid(H5T_NATIVE_SCHAR_TOKEN);} +H5T_NATIVE_UCHAR {return hid(H5T_NATIVE_UCHAR_TOKEN);} +H5T_NATIVE_SHORT {return hid(H5T_NATIVE_SHORT_TOKEN);} +H5T_NATIVE_USHORT {return hid(H5T_NATIVE_USHORT_TOKEN);} +H5T_NATIVE_INT {return hid(H5T_NATIVE_INT_TOKEN);} +H5T_NATIVE_UINT {return hid(H5T_NATIVE_UINT_TOKEN);} +H5T_NATIVE_LONG {return hid(H5T_NATIVE_LONG_TOKEN);} +H5T_NATIVE_ULONG {return hid(H5T_NATIVE_ULONG_TOKEN);} +H5T_NATIVE_LLONG {return hid(H5T_NATIVE_LLONG_TOKEN);} +H5T_NATIVE_ULLONG {return hid(H5T_NATIVE_ULLONG_TOKEN);} + +H5T_IEEE_F32BE {return hid(H5T_IEEE_F32BE_TOKEN);} +H5T_IEEE_F32LE {return hid(H5T_IEEE_F32LE_TOKEN);} +H5T_IEEE_F64BE {return hid(H5T_IEEE_F64BE_TOKEN);} +H5T_IEEE_F64LE {return hid(H5T_IEEE_F64LE_TOKEN);} +H5T_NATIVE_FLOAT {return hid(H5T_NATIVE_FLOAT_TOKEN);} +H5T_NATIVE_DOUBLE {return hid(H5T_NATIVE_DOUBLE_TOKEN);} +H5T_NATIVE_LDOUBLE {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} H5T_STRING {return token(H5T_STRING_TOKEN);} STRSIZE {return token(STRSIZE_TOKEN);} diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index d4c786c..4c07533 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -66,20 +66,21 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ %} %union { - int ival; /*for integer token*/ - char *sval; /*for name string*/ + int ival; /*for integer token*/ + char *sval; /*for name string*/ + hid_t hid; /*for hid_t token*/ } -%token <ival> H5T_STD_I8BE_TOKEN H5T_STD_I8LE_TOKEN H5T_STD_I16BE_TOKEN H5T_STD_I16LE_TOKEN -%token <ival> H5T_STD_I32BE_TOKEN H5T_STD_I32LE_TOKEN H5T_STD_I64BE_TOKEN H5T_STD_I64LE_TOKEN -%token <ival> H5T_STD_U8BE_TOKEN H5T_STD_U8LE_TOKEN H5T_STD_U16BE_TOKEN H5T_STD_U16LE_TOKEN -%token <ival> H5T_STD_U32BE_TOKEN H5T_STD_U32LE_TOKEN H5T_STD_U64BE_TOKEN H5T_STD_U64LE_TOKEN -%token <ival> H5T_NATIVE_CHAR_TOKEN H5T_NATIVE_SCHAR_TOKEN H5T_NATIVE_UCHAR_TOKEN -%token <ival> H5T_NATIVE_SHORT_TOKEN H5T_NATIVE_USHORT_TOKEN H5T_NATIVE_INT_TOKEN H5T_NATIVE_UINT_TOKEN -%token <ival> H5T_NATIVE_LONG_TOKEN H5T_NATIVE_ULONG_TOKEN H5T_NATIVE_LLONG_TOKEN H5T_NATIVE_ULLONG_TOKEN +%token <hid> H5T_STD_I8BE_TOKEN H5T_STD_I8LE_TOKEN H5T_STD_I16BE_TOKEN H5T_STD_I16LE_TOKEN +%token <hid> H5T_STD_I32BE_TOKEN H5T_STD_I32LE_TOKEN H5T_STD_I64BE_TOKEN H5T_STD_I64LE_TOKEN +%token <hid> H5T_STD_U8BE_TOKEN H5T_STD_U8LE_TOKEN H5T_STD_U16BE_TOKEN H5T_STD_U16LE_TOKEN +%token <hid> H5T_STD_U32BE_TOKEN H5T_STD_U32LE_TOKEN H5T_STD_U64BE_TOKEN H5T_STD_U64LE_TOKEN +%token <hid> H5T_NATIVE_CHAR_TOKEN H5T_NATIVE_SCHAR_TOKEN H5T_NATIVE_UCHAR_TOKEN +%token <hid> H5T_NATIVE_SHORT_TOKEN H5T_NATIVE_USHORT_TOKEN H5T_NATIVE_INT_TOKEN H5T_NATIVE_UINT_TOKEN +%token <hid> H5T_NATIVE_LONG_TOKEN H5T_NATIVE_ULONG_TOKEN H5T_NATIVE_LLONG_TOKEN H5T_NATIVE_ULLONG_TOKEN -%token <ival> H5T_IEEE_F32BE_TOKEN H5T_IEEE_F32LE_TOKEN H5T_IEEE_F64BE_TOKEN H5T_IEEE_F64LE_TOKEN -%token <ival> H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN +%token <hid> H5T_IEEE_F32BE_TOKEN H5T_IEEE_F32LE_TOKEN H5T_IEEE_F64BE_TOKEN H5T_IEEE_F64LE_TOKEN +%token <hid> H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN %token <ival> H5T_STRING_TOKEN STRSIZE_TOKEN STRPAD_TOKEN CSET_TOKEN CTYPE_TOKEN H5T_VARIABLE_TOKEN %token <ival> H5T_STR_NULLTERM_TOKEN H5T_STR_NULLPAD_TOKEN H5T_STR_SPACEPAD_TOKEN @@ -98,7 +99,7 @@ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ %% start : { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } - | ddl_type { return $<ival>$;} + | ddl_type { return $<hid>$;} ; ddl_type : atomic_type | compound_type @@ -112,48 +113,48 @@ atomic_type : integer_type | opaque_type ; -integer_type : H5T_STD_I8BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I8BE); } - | H5T_STD_I8LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I8LE); } - | H5T_STD_I16BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I16BE); } - | H5T_STD_I16LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I16LE); } - | H5T_STD_I32BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I32BE); } - | H5T_STD_I32LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I32LE); } - | H5T_STD_I64BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I64BE); } - | H5T_STD_I64LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_I64LE); } - | H5T_STD_U8BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U8BE); } - | H5T_STD_U8LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U8LE); } - | H5T_STD_U16BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U16BE); } - | H5T_STD_U16LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U16LE); } - | H5T_STD_U32BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U32BE); } - | H5T_STD_U32LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U32LE); } - | H5T_STD_U64BE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U64BE); } - | H5T_STD_U64LE_TOKEN { $<ival>$ = H5Tcopy(H5T_STD_U64LE); } - | H5T_NATIVE_CHAR_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_CHAR); } - | H5T_NATIVE_SCHAR_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_SCHAR); } - | H5T_NATIVE_UCHAR_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_UCHAR); } - | H5T_NATIVE_SHORT_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_SHORT); } - | H5T_NATIVE_USHORT_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_USHORT); } - | H5T_NATIVE_INT_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_INT); } - | H5T_NATIVE_UINT_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_UINT); } - | H5T_NATIVE_LONG_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_LONG); } - | H5T_NATIVE_ULONG_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_ULONG); } - | H5T_NATIVE_LLONG_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_LLONG); } - | H5T_NATIVE_ULLONG_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_ULLONG); } +integer_type : H5T_STD_I8BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I8BE); } + | H5T_STD_I8LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I8LE); } + | H5T_STD_I16BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I16BE); } + | H5T_STD_I16LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I16LE); } + | H5T_STD_I32BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I32BE); } + | H5T_STD_I32LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I32LE); } + | H5T_STD_I64BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I64BE); } + | H5T_STD_I64LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I64LE); } + | H5T_STD_U8BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U8BE); } + | H5T_STD_U8LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U8LE); } + | H5T_STD_U16BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U16BE); } + | H5T_STD_U16LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U16LE); } + | H5T_STD_U32BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U32BE); } + | H5T_STD_U32LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U32LE); } + | H5T_STD_U64BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U64BE); } + | H5T_STD_U64LE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_U64LE); } + | H5T_NATIVE_CHAR_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_CHAR); } + | H5T_NATIVE_SCHAR_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_SCHAR); } + | H5T_NATIVE_UCHAR_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_UCHAR); } + | H5T_NATIVE_SHORT_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_SHORT); } + | H5T_NATIVE_USHORT_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_USHORT); } + | H5T_NATIVE_INT_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_INT); } + | H5T_NATIVE_UINT_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_UINT); } + | H5T_NATIVE_LONG_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_LONG); } + | H5T_NATIVE_ULONG_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_ULONG); } + | H5T_NATIVE_LLONG_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_LLONG); } + | H5T_NATIVE_ULLONG_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_ULLONG); } ; -fp_type : H5T_IEEE_F32BE_TOKEN { $<ival>$ = H5Tcopy(H5T_IEEE_F32BE); } - | H5T_IEEE_F32LE_TOKEN { $<ival>$ = H5Tcopy(H5T_IEEE_F32LE); } - | H5T_IEEE_F64BE_TOKEN { $<ival>$ = H5Tcopy(H5T_IEEE_F64BE); } - | H5T_IEEE_F64LE_TOKEN { $<ival>$ = H5Tcopy(H5T_IEEE_F64LE); } - | H5T_NATIVE_FLOAT_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_FLOAT); } - | H5T_NATIVE_DOUBLE_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_DOUBLE); } - | H5T_NATIVE_LDOUBLE_TOKEN { $<ival>$ = H5Tcopy(H5T_NATIVE_LDOUBLE); } +fp_type : H5T_IEEE_F32BE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F32BE); } + | H5T_IEEE_F32LE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F32LE); } + | H5T_IEEE_F64BE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F64BE); } + | H5T_IEEE_F64LE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F64LE); } + | H5T_NATIVE_FLOAT_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_FLOAT); } + | H5T_NATIVE_DOUBLE_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_DOUBLE); } + | H5T_NATIVE_LDOUBLE_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_LDOUBLE); } ; compound_type : H5T_COMPOUND_TOKEN { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } '{' memb_list '}' - { $<ival>$ = cmpd_stack[csindex].id; + { $<hid>$ = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; @@ -170,28 +171,28 @@ memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify le /*Adjust size and insert member, consider both member size and offset.*/ if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ - new_size = H5Tget_size($<ival>1) + $<ival>6; + new_size = H5Tget_size($<hid>1) + $<ival>6; H5Tset_size(dtype_id, new_size); /*member name is saved in yylval.sval by lexer*/ - H5Tinsert(dtype_id, $<sval>4, $<ival>6, $<ival>1); + H5Tinsert(dtype_id, $<sval>4, $<ival>6, $<hid>1); cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); if($<ival>6 == 0) { - new_size = origin_size + H5Tget_size($<ival>1); + new_size = origin_size + H5Tget_size($<hid>1); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, $<sval>4, origin_size, $<ival>1); + H5Tinsert(dtype_id, $<sval>4, origin_size, $<hid>1); } else { - new_size = $<ival>6 + H5Tget_size($<ival>1); + new_size = $<ival>6 + H5Tget_size($<hid>1); H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, $<sval>4, $<ival>6, $<ival>1); + H5Tinsert(dtype_id, $<sval>4, $<ival>6, $<hid>1); } } cmpd_stack[csindex].is_field = 0; - H5Tclose($<ival>1); + H5Tclose($<hid>1); new_size = H5Tget_size(dtype_id); } @@ -211,10 +212,10 @@ offset : NUMBER array_type : H5T_ARRAY_TOKEN { asindex++; /*pushd onto the stack*/ } '{' dim_list ddl_type '}' { - $<ival>$ = H5Tarray_create2($<ival>5, arr_stack[asindex].ndims, arr_stack[asindex].dims); + $<hid>$ = H5Tarray_create2($<hid>5, arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; - H5Tclose($<ival>5); + H5Tclose($<hid>5); } ; dim_list : @@ -232,7 +233,7 @@ dimsize : NUMBER ; vlen_type : H5T_VLEN_TOKEN '{' ddl_type '}' - { $<ival>$ = H5Tvlen_create($<ival>3); H5Tclose($<ival>3); } + { $<hid>$ = H5Tvlen_create($<hid>3); H5Tclose($<hid>3); } ; opaque_type : H5T_OPAQUE_TOKEN @@ -240,15 +241,15 @@ opaque_type : H5T_OPAQUE_TOKEN OPQ_SIZE_TOKEN { is_opq_size = 1; } opaque_size ';' { size_t size = (size_t)yylval.ival; - $<ival>$ = H5Tcreate(H5T_OPAQUE, size); + $<hid>$ = H5Tcreate(H5T_OPAQUE, size); is_opq_size = 0; } OPQ_TAG_TOKEN { is_opq_tag = 1; } '"' opaque_tag '"' ';' { - H5Tset_tag($<ival>7, yylval.sval); + H5Tset_tag($<hid>7, yylval.sval); is_opq_tag = 0; } - '}' { $<ival>$ = $<ival>7; } + '}' { $<hid>$ = $<hid>7; } ; opaque_size : NUMBER ; @@ -282,14 +283,14 @@ string_type : H5T_STRING_TOKEN } CTYPE_TOKEN ctype ';' { - if($<ival>17 == H5T_C_S1_TOKEN) - $<ival>$ = H5Tcopy(H5T_C_S1); - else if($<ival>17 == H5T_FORTRAN_S1_TOKEN) - $<ival>$ = H5Tcopy(H5T_FORTRAN_S1); + if($<hid>17 == H5T_C_S1_TOKEN) + $<hid>$ = H5Tcopy(H5T_C_S1); + else if($<hid>17 == H5T_FORTRAN_S1_TOKEN) + $<hid>$ = H5Tcopy(H5T_FORTRAN_S1); } '}' { - hid_t str_id = $<ival>19; + hid_t str_id = $<hid>19; /*set string size*/ if(is_variable) { @@ -302,7 +303,7 @@ string_type : H5T_STRING_TOKEN H5Tset_strpad(str_id, str_pad); H5Tset_cset(str_id, str_cset); - $<ival>$ = str_id; + $<hid>$ = str_id; } ; strsize : H5T_VARIABLE_TOKEN {$<ival>$ = H5T_VARIABLE_TOKEN;} @@ -315,14 +316,14 @@ strpad : H5T_STR_NULLTERM_TOKEN {$<ival>$ = H5T_STR_NULLTERM_TOKE cset : H5T_CSET_ASCII_TOKEN {$<ival>$ = H5T_CSET_ASCII_TOKEN;} | H5T_CSET_UTF8_TOKEN {$<ival>$ = H5T_CSET_UTF8_TOKEN;} ; -ctype : H5T_C_S1_TOKEN {$<ival>$ = H5T_C_S1_TOKEN;} - | H5T_FORTRAN_S1_TOKEN {$<ival>$ = H5T_FORTRAN_S1_TOKEN;} +ctype : H5T_C_S1_TOKEN {$<hid>$ = H5T_C_S1_TOKEN;} + | H5T_FORTRAN_S1_TOKEN {$<hid>$ = H5T_FORTRAN_S1_TOKEN;} ; enum_type : H5T_ENUM_TOKEN '{' integer_type ';' - { is_enum = 1; enum_id = H5Tenum_create($<ival>3); H5Tclose($<ival>3); } + { is_enum = 1; enum_id = H5Tenum_create($<hid>3); H5Tclose($<hid>3); } enum_list '}' - { is_enum = 0; /*reset*/ $<ival>$ = enum_id; } + { is_enum = 0; /*reset*/ $<hid>$ = enum_id; } ; enum_list : | enum_list enum_def diff --git a/hl/src/H5LTprivate.h b/hl/src/H5LTprivate.h index 0ee6b5c..98ac06e 100644 --- a/hl/src/H5LTprivate.h +++ b/hl/src/H5LTprivate.h @@ -48,6 +48,6 @@ H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); H5_HLDLL char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hbool_t no_user_buf); -H5_HLDLL int H5LTyyparse(void); +H5_HLDLL hid_t H5LTyyparse(void); #endif diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index ff4347a..d3a03cd 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -13,9 +13,10 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include <stdlib.h> + #include "H5PTprivate.h" #include "H5TBprivate.h" -#include <stdlib.h> /* Packet Table private data */ @@ -33,6 +34,7 @@ static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT; #define H5PT_HASH_TABLE_SIZE 64 /* Packet Table private functions */ +static herr_t H5PT_free_id(void *id); static herr_t H5PT_close( htbl_t* table ); static herr_t H5PT_create_index(htbl_t *table_id); static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index); @@ -84,11 +86,11 @@ hid_t H5PTcreate_fl ( hid_t loc_id, /* Register the packet table ID type if this is the first table created */ if(H5PT_ptable_id_type < 0) - if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0) + if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) goto out; /* Get memory for the table identifier */ - table = (htbl_t *)malloc(sizeof(htbl_t)); + table = (htbl_t *)HDmalloc(sizeof(htbl_t)); /* Create a simple data space with unlimited size */ dims[0] = 0; @@ -142,7 +144,7 @@ hid_t H5PTcreate_fl ( hid_t loc_id, H5Pclose(plist_id); H5Dclose(dset_id); if(table) - free(table); + HDfree(table); H5E_END_TRY return H5I_INVALID_HID; } @@ -232,10 +234,10 @@ hid_t H5PTopen( hid_t loc_id, /* Register the packet table ID type if this is the first table created */ if( H5PT_ptable_id_type < 0) - if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0) + if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) goto out; - table = (htbl_t *)malloc(sizeof(htbl_t)); + table = (htbl_t *)HDmalloc(sizeof(htbl_t)); if ( table == NULL ) { goto out; @@ -291,12 +293,26 @@ out: { H5Dclose(table->dset_id); H5Tclose(table->type_id); - free(table); + HDfree(table); } H5E_END_TRY return H5I_INVALID_HID; } +/*------------------------------------------------------------------------- + * Function: H5PT_free_id + * + * Purpose: Free an id. Callback for H5Iregister_type. + * + * Return: Success: 0, Failure: N/A + *------------------------------------------------------------------------- + */ +static herr_t +H5PT_free_id(void *id) +{ + HDfree(id); + return 0; +} /*------------------------------------------------------------------------- * Function: H5PT_close @@ -331,7 +347,7 @@ H5PT_close( htbl_t* table) if(H5Tclose(table->type_id) < 0) goto out; - free(table); + HDfree(table); return 0; @@ -342,7 +358,7 @@ out: H5Dclose(table->dset_id); H5Tclose(table->type_id); H5E_END_TRY - free(table); + HDfree(table); } return -1; } @@ -371,7 +387,7 @@ herr_t H5PTclose( hid_t table_id ) htbl_t * table; /* Remove the ID from the library */ - if((table = H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL) + if((table = (htbl_t *)H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL) goto out; /* If the library found the table, remove it */ diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index da2f372..a1456ea 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -15,7 +15,7 @@ #include <stdlib.h> #include <string.h> -#include "H5private.h" + #include "H5LTprivate.h" #include "H5TBprivate.h" @@ -1240,9 +1240,9 @@ herr_t H5TBdelete_record(hid_t loc_id, if(H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0) goto out; - if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; - if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; /* get field info */ @@ -1327,11 +1327,11 @@ herr_t H5TBdelete_record(hid_t loc_id, out: if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); if(mem_type_id > 0) if(H5Tclose(mem_type_id) < 0) ret_val = -1; @@ -1550,9 +1550,9 @@ herr_t H5TBadd_records_from(hid_t loc_id, if(H5TBget_table_info(loc_id, dset_name1, &nfields, &ntotal_records) < 0) goto out; - if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; - if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t)))) + if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t)))) goto out; /* get field info */ @@ -1608,11 +1608,11 @@ herr_t H5TBadd_records_from(hid_t loc_id, out: if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); if(tid > 0) if(H5Tclose(tid) < 0) ret_val = -1; @@ -1857,7 +1857,7 @@ herr_t H5TBcombine_tables(hid_t loc_id1, if(H5Sclose(m_sid) < 0) goto out; m_sid = H5I_BADID; - free(tmp_buf); + HDfree(tmp_buf); tmp_buf = NULL; /*------------------------------------------------------------------------- @@ -1920,13 +1920,13 @@ herr_t H5TBcombine_tables(hid_t loc_id1, out: if(tmp_buf) - free(tmp_buf); + HDfree(tmp_buf); if(tmp_fill_buf) - free(tmp_fill_buf); + HDfree(tmp_fill_buf); if(src_offset) - free(src_offset); + HDfree(src_offset); if(src_sizes) - free(src_sizes); + HDfree(src_sizes); if(member_type_id > 0) if(H5Tclose(member_type_id) < 0) ret_val = -1; @@ -3263,7 +3263,7 @@ hid_t H5TB_create_type(hid_t loc_id, hsize_t nfields = 0; char **fnames = NULL; unsigned i; - herr_t ret_val = -1; + hid_t ret_val = -1; /* get the number of fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, NULL) < 0) diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index a60a560..2fc8140 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -255,13 +255,13 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)malloc((size_t)name_len * sizeof (char)); + name_out = (char*)HDmalloc((size_t)name_len * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) { if(strcmp(scalename,name_out)==0) { ret_value = SUCCEED; } - free(name_out); + HDfree(name_out); name_out=NULL; } } diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c index 9a0ffb0..bddd162 100644 --- a/hl/test/test_dset_opt.c +++ b/hl/test/test_dset_opt.c @@ -176,7 +176,7 @@ test_direct_chunk_write (hid_t file) direct_buf[i][j] = n++; /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); + outbuf = HDmalloc(z_dst_nbytes); z_dst = (Bytef *)outbuf; /* Perform compression from the source to the destination buffer */ @@ -206,7 +206,7 @@ test_direct_chunk_write (hid_t file) } if(outbuf) - free(outbuf); + HDfree(outbuf); if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) goto error; @@ -249,7 +249,7 @@ test_direct_chunk_write (hid_t file) direct_buf[i][j] = i + j; /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); + outbuf = HDmalloc(z_dst_nbytes); z_dst = (Bytef *)outbuf; /* Perform compression from the source to the destination buffer */ @@ -280,7 +280,7 @@ test_direct_chunk_write (hid_t file) } if(outbuf) - free(outbuf); + HDfree(outbuf); if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) goto error; @@ -329,7 +329,7 @@ error: } H5E_END_TRY; if(outbuf) - free(outbuf); + HDfree(outbuf); return 1; } @@ -1016,13 +1016,13 @@ test_invalid_parameters(hid_t file) /* Check invalid dataset ID */ H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + if((status = H5DOwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) goto error; } H5E_END_TRY; /* Check invalid DXPL ID */ H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, -1, filter_mask, offset, buf_size, direct_buf)) != FAIL) + if((status = H5DOwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL) goto error; } H5E_END_TRY; diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index 9729421..831fa23 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -77,23 +77,23 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array of pointers for each of the open images */ - if (NULL == (buf_ptr = (void **)malloc(sizeof(void *) * open_images))) + if (NULL == (buf_ptr = (void **)HDmalloc(sizeof(void *) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array to store the name of each of the open images */ - if (NULL == (filename = (char **)malloc(sizeof(char *) * open_images))) + if (NULL == (filename = (char **)HDmalloc(sizeof(char *) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array to store the size of each of the open images */ - if (NULL == (buf_size = (ssize_t *)malloc(sizeof(ssize_t) * open_images))) + if (NULL == (buf_size = (ssize_t *)HDmalloc(sizeof(ssize_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array for each of the file identifiers */ - if (NULL == (file_id = (hid_t *)malloc(sizeof(hid_t) * open_images))) + if (NULL == (file_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); /* allocate array for each of the dataset identifiers */ - if (NULL == (dset_id = (hid_t *)malloc(sizeof(hid_t) * open_images))) + if (NULL == (dset_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); TESTING("get file images"); diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index a76f3d7..576d594 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1820,7 +1820,6 @@ out: static int test_valid_path(void) { hid_t file_id, group; - FILE *fp = NULL; htri_t path_valid; const char *data_string_in = "test"; @@ -177,17 +177,23 @@ H5A_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n = H5I_nmembers(H5I_ATTR))>0) { + if(H5I_nmembers(H5I_ATTR) > 0) { (void)H5I_clear_type(H5I_ATTR, FALSE, FALSE); - } else { + n++; /*H5I*/ + } /* end if */ + else { /* Close deprecated interface */ n += H5A__term_deprec_interface(); + /* Destroy the attribute object id group */ (void)H5I_dec_type_ref(H5I_ATTR); + n++; /*H5I*/ + + /* Mark closed */ H5_interface_initialize_g = 0; - n = 1; - } - } + } /* end else */ + } /* end if */ + FUNC_LEAVE_NOAPI(n) } /* H5A_term_interface() */ @@ -246,7 +252,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) @@ -329,7 +335,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -255,7 +255,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, /* * Cache the new B-tree node. */ - if (H5AC_insert_entry(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache") #ifdef H5B_DEBUG H5B_assert(f, dxpl_id, *addr_p, shared->type, udata); diff --git a/src/H5Dint.c b/src/H5Dint.c index dfad7d7..a354a16 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -224,12 +224,12 @@ done: int H5D_term_interface(void) { - int n=0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n=H5I_nmembers(H5I_DATASET))>0) { + if(H5I_nmembers(H5I_DATASET) > 0) { /* The dataset API uses the "force" flag set to true because it * is using the "file objects" (H5FO) API functions to track open * objects in the file. Using the H5FO code means that dataset @@ -252,19 +252,25 @@ H5D_term_interface(void) * * QAK - 5/13/03 */ - H5I_clear_type(H5I_DATASET, TRUE, FALSE); - } else { + (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE); + n++; /*H5I*/ + } /* end if */ + else { /* Close public interface */ n += H5D__term_pub_interface(); /* Close deprecated interface */ n += H5D__term_deprec_interface(); - H5I_dec_type_ref(H5I_DATASET); + /* Destroy the dataset object id group */ + (void)H5I_dec_type_ref(H5I_DATASET); + n++; /*H5I*/ + + /* Mark closed */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ - } - } + } /* end else */ + } /* end if */ + FUNC_LEAVE_NOAPI(n) } /* end H5D_term_interface() */ @@ -458,7 +464,7 @@ done: /*------------------------------------------------------------------------- * Function: H5D__get_space_status * - * Purpose: Returns the status of data space allocation. + * Purpose: Returns the status of dataspace allocation. * * Return: * Success: Non-negative @@ -2175,16 +2181,16 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) if(H5D__check_filters(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't apply filters") - /* Get the data space */ + /* Get the dataspace */ space = dset->shared->space; /* Check if we are shrinking or expanding any of the dimensions */ if((rank = H5S_get_simple_extent_dims(space, curr_dims, NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") - /* Modify the size of the data space */ + /* Modify the size of the dataspace */ if((changed = H5S_set_extent(space, size)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") /* Don't bother updating things, unless they've changed */ if(changed) { @@ -2382,7 +2388,6 @@ H5D__mark(const H5D_t *dataset, hid_t UNUSED dxpl_id, unsigned flags) if(flags & H5D_MARK_LAYOUT) dataset->shared->layout_dirty = TRUE; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__mark() */ @@ -144,8 +144,7 @@ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ }}; - - + /*------------------------------------------------------------------------- * Function: H5E_init * @@ -172,8 +171,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_init() */ - - + /*-------------------------------------------------------------------------- * Function: H5E_set_default_auto * @@ -211,8 +209,7 @@ H5E_set_default_auto(H5E_t *stk) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_set_default_auto() */ - - + /*-------------------------------------------------------------------------- * Function: H5E_init_interface * @@ -267,8 +264,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_init_interface() */ - - + /*------------------------------------------------------------------------- * Function: H5E_term_interface * @@ -299,15 +295,14 @@ H5E_term_interface(void) nmsg = H5I_nmembers(H5I_ERROR_MSG); nstk = H5I_nmembers(H5I_ERROR_STACK); - n = ncls + nmsg + nstk; - if(n > 0) { + if((ncls + nmsg + nstk) > 0) { /* Clear any outstanding error stacks */ if(nstk > 0) - H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE); + (void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE); /* Clear all the error classes */ if(ncls > 0) { - H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); + (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); /* Reset the HDF5 error class, if its been closed */ if(H5I_nmembers(H5I_ERROR_CLASS) == 0) @@ -316,7 +311,7 @@ H5E_term_interface(void) /* Clear all the error messages */ if(nmsg > 0) { - H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); + (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); /* Reset the HDF5 error messages, if they've been closed */ if(H5I_nmembers(H5I_ERROR_MSG) == 0) { @@ -324,27 +319,28 @@ H5E_term_interface(void) #include "H5Eterm.h" } /* end if */ } /* end if */ + + n++; /*H5I*/ } /* end if */ else { /* Close deprecated interface */ n += H5E__term_deprec_interface(); /* Destroy the error class, message, and stack id groups */ - H5I_dec_type_ref(H5I_ERROR_STACK); - H5I_dec_type_ref(H5I_ERROR_CLASS); - H5I_dec_type_ref(H5I_ERROR_MSG); + (void)H5I_dec_type_ref(H5I_ERROR_STACK); + (void)H5I_dec_type_ref(H5I_ERROR_CLASS); + (void)H5I_dec_type_ref(H5I_ERROR_MSG); + n++; /*H5I*/ /* Mark closed */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) } /* end H5E_term_interface() */ - - + #ifdef H5_HAVE_THREADSAFE /*------------------------------------------------------------------------- * Function: H5E_get_stack @@ -395,8 +391,7 @@ H5E_get_stack(void) } /* end H5E_get_stack() */ #endif /* H5_HAVE_THREADSAFE */ - - + /*------------------------------------------------------------------------- * Function: H5E_free_class * @@ -426,8 +421,7 @@ H5E_free_class(H5E_cls_t *cls) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_free_class() */ - - + /*------------------------------------------------------------------------- * Function: H5Eregister_class * @@ -465,8 +459,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eregister_class() */ - - + /*------------------------------------------------------------------------- * Function: H5E_register_class * @@ -515,8 +508,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_register_class() */ - - + /*------------------------------------------------------------------------- * Function: H5Eunregister_class * @@ -552,8 +544,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eunregister_class() */ - - + /*------------------------------------------------------------------------- * Function: H5E_unregister_class * @@ -588,8 +579,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_unregister_class() */ - - + /*------------------------------------------------------------------------- * Function: H5Eget_class_name * @@ -624,8 +614,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_class_name() */ - - + /*------------------------------------------------------------------------- * Function: H5E_get_class_name * @@ -663,8 +652,7 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) FUNC_LEAVE_NOAPI(len) } /* end H5E_get_class_name() */ - - + /*------------------------------------------------------------------------- * Function: H5E_close_msg_cb * @@ -702,8 +690,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_close_msg_cb() */ - - + /*------------------------------------------------------------------------- * Function: H5Eclose_msg * @@ -736,8 +723,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eclose_msg() */ - - + /*------------------------------------------------------------------------- * Function: H5E_close_msg * @@ -766,8 +752,7 @@ H5E_close_msg(H5E_msg_t *err) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_close_msg() */ - - + /*------------------------------------------------------------------------- * Function: H5Ecreate_msg * @@ -858,8 +843,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_create_msg() */ - - + /*------------------------------------------------------------------------- * Function: H5Eget_msg * @@ -894,8 +878,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_msg() */ - - + /*------------------------------------------------------------------------- * Function: H5Ecreate_stack * @@ -932,8 +915,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Ecreate_stack() */ - - + /*------------------------------------------------------------------------- * Function: H5Eget_current_stack * @@ -969,8 +951,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_current_stack() */ - - + /*------------------------------------------------------------------------- * Function: H5E_get_current_stack * @@ -1047,8 +1028,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_get_current_stack() */ - - + /*------------------------------------------------------------------------- * Function: H5Eset_current_stack * @@ -1096,8 +1076,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eset_current_stack() */ - - + /*------------------------------------------------------------------------- * Function: H5E_set_current_stack * @@ -1161,8 +1140,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_set_current_stack() */ - - + /*------------------------------------------------------------------------- * Function: H5Eclose_stack * @@ -1200,8 +1178,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eclose_stack() */ - - + /*------------------------------------------------------------------------- * Function: H5E_close_stack * @@ -1231,8 +1208,7 @@ H5E_close_stack(H5E_t *estack) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5E_close_stack() */ - - + /*------------------------------------------------------------------------- * Function: H5Eget_num * @@ -1277,8 +1253,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_num() */ - - + /*------------------------------------------------------------------------- * Function: H5E_get_num * @@ -1301,8 +1276,7 @@ H5E_get_num(const H5E_t *estack) FUNC_LEAVE_NOAPI((ssize_t)estack->nused) } /* end H5E_get_num() */ - - + /*------------------------------------------------------------------------- * Function: H5Epop * @@ -1351,8 +1325,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Epop() */ - - + /*------------------------------------------------------------------------- * Function: H5Epush2 * @@ -1466,8 +1439,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ - - + /*------------------------------------------------------------------------- * Function: H5Eclear2 * @@ -1509,8 +1481,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eclear2() */ - - + /*------------------------------------------------------------------------- * Function: H5Eprint2 * @@ -1557,8 +1528,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eprint2() */ - - + /*------------------------------------------------------------------------- * Function: H5Ewalk2 * @@ -1606,8 +1576,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Ewalk2() */ - - + /*------------------------------------------------------------------------- * Function: H5Eget_auto2 * @@ -1663,8 +1632,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eget_auto2() */ - - + /*------------------------------------------------------------------------- * Function: H5Eset_auto2 * @@ -1733,8 +1701,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Eset_auto2() */ - - + /*------------------------------------------------------------------------- * Function: H5Eauto_is_v2 * diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 932b857..17a35d9 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -26,7 +26,7 @@ #include "H5Ipublic.h" /* Value for the default error stack */ -#define H5E_DEFAULT 0 +#define H5E_DEFAULT (hid_t)0 /* Different kinds of error information */ typedef enum H5E_type_t { @@ -169,20 +169,25 @@ H5F_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n = H5I_nmembers(H5I_FILE)) != 0) { - H5I_clear_type(H5I_FILE, FALSE, FALSE); - } else { + if(H5I_nmembers(H5I_FILE) > 0) { + (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ + else { /* Make certain we've cleaned up all the shared file objects */ H5F_sfile_assert_num(0); - H5I_dec_type_ref(H5I_FILE); + /* Destroy the file object id group */ + (void)H5I_dec_type_ref(H5I_FILE); + n++; /*H5I*/ + + /* Mark closed */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* H5F_term_interface() */ +} /* end H5F_term_interface() */ /*------------------------------------------------------------------------- @@ -111,7 +111,7 @@ static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*o * object and the file is closed and re-opened, the 'fileno' value will * be different. */ -static unsigned long file_serial_no; +static unsigned long H5FD_file_serial_no_g; /* File driver ID class */ static const H5I_class_t H5I_VFL_CLS[1] = {{ @@ -176,7 +176,7 @@ H5FD_init_interface(void) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Reset the file serial numbers */ - file_serial_no = 0; + H5FD_file_serial_no_g = 0; done: FUNC_LEAVE_NOAPI(ret_value) @@ -211,8 +211,8 @@ H5FD_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n=H5I_nmembers(H5I_VFL))!=0) { - H5I_clear_type(H5I_VFL, FALSE, FALSE); + if(H5I_nmembers(H5I_VFL) > 0) { + (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); /* Reset the VFL drivers, if they've been closed */ if(H5I_nmembers(H5I_VFL)==0) { @@ -232,14 +232,21 @@ H5FD_term_interface(void) H5FD_mpio_term(); #endif /* H5_HAVE_PARALLEL */ } /* end if */ - } else { - H5I_dec_type_ref(H5I_VFL); + + n++; /*H5I*/ + } /* end if */ + else { + /* Destroy the VFL driver id group */ + (void)H5I_dec_type_ref(H5I_VFL); + n++; /*H5I*/ + + /* Mark closed */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ - } - } + } /* end else */ + } /* end if */ + FUNC_LEAVE_NOAPI(n) -} +} /* end H5FD_term_interface() */ /*------------------------------------------------------------------------- @@ -1003,11 +1010,11 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") /* Increment the global serial number & assign it to this H5FD_t object */ - if(++file_serial_no == 0) { + if(++H5FD_file_serial_no_g == 0) { /* (Just error out if we wrap around for now...) */ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number") } /* end if */ - file->fileno = file_serial_no; + file->fileno = H5FD_file_serial_no_g; /* Start with base address set to 0 */ /* (This will be changed later, when the superblock is located) */ @@ -224,18 +224,20 @@ H5G_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n = H5I_nmembers(H5I_GROUP))) - H5I_clear_type(H5I_GROUP, FALSE, FALSE); + if(H5I_nmembers(H5I_GROUP) > 0) { + (void)H5I_clear_type(H5I_GROUP, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ else { /* Close deprecated interface */ n += H5G__term_deprec_interface(); /* Destroy the group object id group */ - H5I_dec_type_ref(H5I_GROUP); + (void)H5I_dec_type_ref(H5I_GROUP); + n++; /*H5I*/ /* Mark closed */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ } /* end else */ } /* end if */ @@ -514,7 +516,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_create_plist() */ - /*------------------------------------------------------------------------- * Function: H5G_get_create_plist diff --git a/src/H5Gint.c b/src/H5Gint.c index fe8b995..6f42cc2 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -992,7 +992,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) /* Add the path separator to the current path */ HDassert(udata->path[udata->curr_path_len] == '\0'); - HDstrncpy(&(udata->path[udata->curr_path_len]), "/", 2); + HDstrncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2); udata->curr_path_len++; /* Attempt to get the link info for this group */ diff --git a/src/H5Gname.c b/src/H5Gname.c index 8e21109..277d08f 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -325,7 +325,7 @@ H5G_build_fullpath(const char *prefix, const char *name) /* Build full path */ HDstrncpy(full_path, prefix, orig_path_len + 1); if(need_sep) - HDstrncat(full_path, "/", 1); + HDstrncat(full_path, "/", (size_t)1); HDstrncat(full_path, name, name_len); /* Create reference counted string for path */ @@ -1331,7 +1331,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * /* If there's a buffer provided, copy into it, up to the limit of its size */ if(name) { /* Copy the initial path separator */ - HDstrncpy(name, "/", 2); + HDstrncpy(name, "/", (size_t)2); /* Append the rest of the path */ /* (less one character, for the initial path separator) */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 8ac6aab..dfe5172 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -276,7 +276,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, */ if(H5I_dec_ref(cb_return) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") - cb_return = (-1); + cb_return = (hid_t)(-1); done: /* Close location given to callback. */ @@ -208,7 +208,7 @@ HDmemset(heap->chunk, 0, size); HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS") /* Add the heap to the cache */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET)<0) + if(H5AC_insert_entry(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") ret_value = addr; @@ -68,8 +68,8 @@ #define MAX_FREE_ID_STRUCTS 1000 /* Combine a Type number and an atom index into an atom */ -#define H5I_MAKE(g,i) ((((hid_t)(g)&TYPE_MASK)<<ID_BITS)| \ - ((hid_t)(i)&ID_MASK)) +#define H5I_MAKE(g,i) ((((hid_t)(g) & TYPE_MASK) << ID_BITS) | \ + ((hid_t)(i) & ID_MASK)) /* Local typedefs */ @@ -454,7 +454,7 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members) if((members = H5I_nmembers(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members") - *num_members = (hsize_t)members; + H5_ASSIGN_OVERFLOW(*num_members, members, int, hsize_t); } /* end if */ done: diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index dc8e867..1666b76 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -44,7 +44,7 @@ * field sizes and masks are calculated from TYPE_BITS. */ #define TYPE_BITS 7 -#define TYPE_MASK ((1<<TYPE_BITS)-1) +#define TYPE_MASK (((hid_t)1 << TYPE_BITS) - 1) #define H5I_MAX_NUM_TYPES TYPE_MASK @@ -52,11 +52,11 @@ * Number of bits to use for the Atom index in each atom (assumes 8-bit * bytes). We don't use the sign bit. */ -#define ID_BITS ((sizeof(hid_t)*8)-(TYPE_BITS+1)) -#define ID_MASK ((1<<ID_BITS)-1) +#define ID_BITS ((sizeof(hid_t) * 8) - (TYPE_BITS + 1)) +#define ID_MASK (((hid_t)1 << ID_BITS) - 1) /* Map an atom to an ID type number */ -#define H5I_TYPE(a) ((H5I_type_t)(((hid_t)(a)>>ID_BITS) & TYPE_MASK)) +#define H5I_TYPE(a) ((H5I_type_t)(((hid_t)(a) >> ID_BITS) & TYPE_MASK)) /****************************/ diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 20b57e5..ff2322f 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -40,7 +40,7 @@ #define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */ /* Macro to indicate operation occurs on same location */ -#define H5L_SAME_LOC 0 +#define H5L_SAME_LOC (hid_t)0 /* Current version of the H5L_class_t struct */ #define H5L_LINK_CLASS_T_VERS 0 @@ -19,6 +19,7 @@ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5PL__init_interface + /***********/ /* Headers */ /***********/ diff --git a/src/H5Pint.c b/src/H5Pint.c index 4858e80..d6ca6bc 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -513,28 +513,27 @@ done: int H5P_term_interface(void) { - int nlist=0; - int nclass=0; - int n=0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { + int nlist, nclass; + /* Destroy HDF5 library property classes & lists */ /* Check if there are any open property list classes or lists */ nclass = H5I_nmembers(H5I_GENPROP_CLS); nlist = H5I_nmembers(H5I_GENPROP_LST); - n=nclass+nlist; /* If there are any open classes or groups, attempt to get rid of them. */ - if(n) { + if((nclass + nlist) > 0) { /* Clear the lists */ - if(nlist>0) { - H5I_clear_type(H5I_GENPROP_LST, FALSE, FALSE); + if(nlist > 0) { + (void)H5I_clear_type(H5I_GENPROP_LST, FALSE, FALSE); /* Reset the default property lists, if they've been closed */ - if(H5I_nmembers(H5I_GENPROP_LST)==0) { + if(H5I_nmembers(H5I_GENPROP_LST) == 0) { H5P_LST_FILE_CREATE_ID_g = H5P_LST_FILE_ACCESS_ID_g = H5P_LST_DATASET_CREATE_ID_g = @@ -553,11 +552,11 @@ H5P_term_interface(void) } /* end if */ /* Only attempt to close the classes after all the lists are closed */ - if(nlist==0 && nclass>0) { - H5I_clear_type(H5I_GENPROP_CLS, FALSE, FALSE); + if(nlist == 0 && nclass > 0) { + (void)H5I_clear_type(H5I_GENPROP_CLS, FALSE, FALSE); /* Reset the default property lists, if they've been closed */ - if(H5I_nmembers(H5I_GENPROP_CLS)==0) { + if(H5I_nmembers(H5I_GENPROP_CLS) == 0) { H5P_CLS_ROOT_g = H5P_CLS_OBJECT_CREATE_g = H5P_CLS_FILE_CREATE_g = @@ -595,6 +594,8 @@ H5P_term_interface(void) H5P_CLS_FILE_MOUNT_ID_g = (-1); } /* end if */ } /* end if */ + + n++; /*H5I*/ } else { /* Close public interface */ n += H5P__term_pub_interface(); @@ -602,16 +603,19 @@ H5P_term_interface(void) /* Close deprecated interface */ n += H5P__term_deprec_interface(); - H5I_dec_type_ref(H5I_GENPROP_LST); + /* Destroy the property list and class id groups */ + (void)H5I_dec_type_ref(H5I_GENPROP_LST); n++; /*H5I*/ - H5I_dec_type_ref(H5I_GENPROP_CLS); + (void)H5I_dec_type_ref(H5I_GENPROP_CLS); n++; /*H5I*/ + /* Mark closed */ H5_interface_initialize_g = 0; - } - } + } /* end else */ + } /* end if */ + FUNC_LEAVE_NOAPI(n) -} +} /* end H5P_term_interface() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 5c358ec..b47576c 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -92,6 +92,9 @@ #define H5P_CRT_ORDER_TRACKED 0x0001 #define H5P_CRT_ORDER_INDEXED 0x0002 +/* Default value for all property list classes */ +#define H5P_DEFAULT (hid_t)0 + #ifdef __cplusplus extern "C" { #endif @@ -159,25 +159,30 @@ done: int H5R_term_interface(void) { - int n=0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if (H5_interface_initialize_g) { - if ((n=H5I_nmembers(H5I_REFERENCE))) { - H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); - } else { + if(H5I_nmembers(H5I_REFERENCE) > 0) { + (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ + else { /* Close deprecated interface */ n += H5R__term_deprec_interface(); - H5I_dec_type_ref(H5I_REFERENCE); + /* Destroy the reference id group */ + (void)H5I_dec_type_ref(H5I_REFERENCE); + n++; /*H5I*/ + + /* Mark closed */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ - } - } + } /* end else */ + } /* end if */ FUNC_LEAVE_NOAPI(n) -} +} /* end H5R_term_interface() */ /*-------------------------------------------------------------------------- @@ -145,16 +145,17 @@ H5S_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { - if((n = H5I_nmembers(H5I_DATASPACE))) { - H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); + if(H5I_nmembers(H5I_DATASPACE) > 0) { + (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); + n++; /*H5I*/ } /* end if */ else { - /* Free data types */ - H5I_dec_type_ref(H5I_DATASPACE); + /* Destroy the dataspace object id group */ + (void)H5I_dec_type_ref(H5I_DATASPACE); + n++; /*H5I*/ /* Shut down interface */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ } /* end else */ } /* end if */ @@ -1303,8 +1304,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, /* Selection related cleanup */ /* Set offset to zeros */ - for(u = 0; u < space->extent.rank; u++) - space->select.offset[u] = 0; + HDmemset(space->select.offset, 0, sizeof(hsize_t) * space->extent.rank); space->select.offset_changed = FALSE; /* If the selection is 'all', update the number of elements selected */ diff --git a/src/H5Spublic.h b/src/H5Spublic.h index c62a7b7..097bf30 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -24,7 +24,7 @@ #include "H5Ipublic.h" /* Define atomic datatypes */ -#define H5S_ALL 0 +#define H5S_ALL (hid_t)0 #define H5S_UNLIMITED ((hsize_t)(hssize_t)(-1)) /* Define user-level maximum number of dimensions */ @@ -1048,11 +1048,9 @@ H5T_init_interface(void) status = 0; status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_dxpl_id, FALSE); @@ -1440,20 +1438,23 @@ H5T_unlock_cb(void *_dt, hid_t UNUSED id, void UNUSED *key) int H5T_term_interface(void) { - int i, nprint=0, n=0; - H5T_path_t *path = NULL; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_interface_initialize_g) { + int i, nprint = 0; + /* Unregister all conversion functions */ for(i = 0; i < H5T_g.npaths; i++) { + H5T_path_t *path; + path = H5T_g.path[i]; HDassert(path); if(path->func) { H5T__print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; - if((path->func)(FAIL, FAIL, &(path->cdata), (size_t)0, + if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL,H5AC_dxpl_id) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { @@ -1490,7 +1491,9 @@ H5T_term_interface(void) /* Close deprecated interface */ n += H5T__term_deprec_interface(); - H5I_dec_type_ref(H5I_DATATYPE); + /* Destroy the datatype object id group */ + (void)H5I_dec_type_ref(H5I_DATATYPE); + n++; /*H5I*/ /* Reset all the datatype IDs */ H5T_IEEE_F32BE_g = FAIL; @@ -1590,7 +1593,6 @@ H5T_term_interface(void) /* Mark interface as closed */ H5_interface_initialize_g = 0; - n = 1; /*H5I*/ } /* end if */ FUNC_LEAVE_NOAPI(n) @@ -2584,7 +2586,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, /* Shut down path */ H5T__print_stats(path, &nprint); path->cdata.command = H5T_CONV_FREE; - if((path->func)(FAIL, FAIL, &(path->cdata), + if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) { @@ -4398,7 +4400,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, HDsnprintf(H5T_g.path[0]->name, sizeof(H5T_g.path[0]->name), "no-op"); H5T_g.path[0]->func = H5T__conv_noop; H5T_g.path[0]->cdata.command = H5T_CONV_INIT; - if(H5T__conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { + if(H5T__conv_noop((hid_t)FAIL, (hid_t)FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); @@ -4557,7 +4559,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, HDassert(table == H5T_g.path[md]); H5T__print_stats(table, &nprint/*in,out*/); table->cdata.command = H5T_CONV_FREE; - if((table->func)(FAIL, FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { + if((table->func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free " diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 258a336..79cf3a6 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -46,9 +46,9 @@ void H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_offset, size_t size) { - unsigned shift; - unsigned mask_lo, mask_hi; - unsigned s_idx, d_idx; + size_t shift; + size_t mask_lo, mask_hi; + size_t s_idx, d_idx; FUNC_ENTER_PACKAGE_NOERR @@ -78,8 +78,8 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, * dst[d_idx+1] dst[d_idx] */ while(src_offset && size > 0) { - unsigned nbits = MIN3(size, 8 - dst_offset, 8 - src_offset); - unsigned mask = ((unsigned)1 << nbits) - 1; + size_t nbits = MIN3(size, 8 - dst_offset, 8 - src_offset); + size_t mask = ((size_t)1 << nbits) - 1; dst[d_idx] &= (uint8_t)~(mask << dst_offset); dst[d_idx] |= (uint8_t)(((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset); @@ -121,7 +121,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, * to line up with the destination. */ shift = dst_offset; - mask_lo = ((unsigned)1 << (8 - shift)) - 1; + mask_lo = ((size_t)1 << (8 - shift)) - 1; mask_hi = (~mask_lo) & 0xff; for(/*void*/; size > 8; size -= 8, d_idx++, s_idx++) { @@ -137,8 +137,8 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, /* Finish up */ while(size > 0) { - unsigned nbits = (unsigned)MIN3 (size, 8 - dst_offset, 8 - src_offset); - unsigned mask = ((unsigned)1 << nbits) - 1; + size_t nbits = (size_t)MIN3 (size, 8 - dst_offset, 8 - src_offset); + size_t mask = ((size_t)1 << nbits) - 1; dst[d_idx] &= (uint8_t)(~(mask << dst_offset)); dst[d_idx] |= (uint8_t)(((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset); @@ -408,27 +408,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Z_unregister(H5Z_filter_t id) +H5Z_unregister(H5Z_filter_t filter_id) { - size_t i; /* Local index variable */ + size_t filter_index; /* Local index variable for filter */ H5Z_object_t object; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(id >= 0 && id <= H5Z_FILTER_MAX); + HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX); /* Is the filter already registered? */ - for (i=0; i<H5Z_table_used_g; i++) - if (H5Z_table_g[i].id==id) + for (filter_index=0; filter_index<H5Z_table_used_g; filter_index++) + if (H5Z_table_g[filter_index].id==filter_id) break; /* Fail if filter not found */ - if (i>=H5Z_table_used_g) + if (filter_index>=H5Z_table_used_g) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered") /* Initialize the structure object for iteration */ - object.filter_id = id; + object.filter_id = filter_id; object.found = FALSE; /* Iterate through all opened datasets, returns a failure if any of them uses the filter */ @@ -451,9 +451,9 @@ H5Z_unregister(H5Z_filter_t id) /* Remove filter from table */ /* Don't worry about shrinking table size (for now) */ - HDmemmove(&H5Z_table_g[i],&H5Z_table_g[i+1],sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-i)); + HDmemmove(&H5Z_table_g[filter_index],&H5Z_table_g[filter_index+1],sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index)); #ifdef H5Z_DEBUG - HDmemmove(&H5Z_stat_table_g[i],&H5Z_stat_table_g[i+1],sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-i)); + HDmemmove(&H5Z_stat_table_g[filter_index],&H5Z_stat_table_g[filter_index+1],sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-filter_index)); #endif /* H5Z_DEBUG */ H5Z_table_used_g--; @@ -508,7 +508,7 @@ done: * FALSE otherwise. * * Programmer: Raymond Lu - * 13 May 2013 + * 6 May 2013 * *------------------------------------------------------------------------- */ @@ -612,7 +612,7 @@ done: * FAIL if there is an error * * Programmer: Raymond Lu - * 13 May 2013 + * 6 May 2013 * *------------------------------------------------------------------------- */ @@ -636,7 +636,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__flush_file_cb() */ - /*------------------------------------------------------------------------- * Function: H5Zfilter_avail @@ -851,7 +850,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type H5S_t *space; /* Dataspace describing chunk */ size_t u; /* Local index variable */ - /* Create a data space for a chunk & set the extent */ + /* Create a dataspace for a chunk & set the extent */ for(u = 0; u < dcpl_layout.u.chunk.ndims; u++) chunk_dims[u] = dcpl_layout.u.chunk.dim[u]; if(NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL))) @@ -972,7 +971,7 @@ H5Z_can_apply_direct(const H5O_pline_t *pline) HDassert(pline->nused > 0); /* Make "can apply" callbacks for filters in pipeline */ - if(H5Z_prelude_callback(pline, -1, -1, -1, H5Z_PRELUDE_CAN_APPLY) < 0) + if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") done: @@ -1009,7 +1008,7 @@ H5Z_set_local_direct(const H5O_pline_t *pline) HDassert(pline->nused > 0); /* Make "set local" callbacks for filters in pipeline */ - if(H5Z_prelude_callback(pline, -1, -1, -1, H5Z_PRELUDE_SET_LOCAL) < 0) + if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") done: @@ -1493,7 +1492,7 @@ done: * FAIL - error * * Programmer: Raymond Lu - * 14 May 2013 + * 26 April 2013 * * Modifications: * @@ -1523,6 +1522,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_filter_in_pline() */ + /*------------------------------------------------------------------------- * Function: H5Z_all_filters_avail diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 9bcbb1a..589b27b 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -190,7 +190,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get dataspace */ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Get dimensions for dataspace */ if((ndims = H5S_get_simple_extent_dims(ds, dims, NULL)) < 0) diff --git a/src/H5public.h b/src/H5public.h index e08bd73..4bfd1e0 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -282,9 +282,6 @@ H5_GCC_DIAG_ON(long-long) # error "nothing appropriate for uint64_t" #endif -/* Default value for all property list classes */ -#define H5P_DEFAULT 0 - /* Common iteration orders */ typedef enum { H5_ITER_UNKNOWN = -1, /* Unknown order */ diff --git a/src/H5trace.c b/src/H5trace.c index b8f0b6a..5e90ff6 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1181,7 +1181,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5I_DATASPACE: fprintf(out, "%ld (dspace)", (long)obj); - /* Save the rank of simple data spaces for arrays */ + /* Save the rank of simple dataspaces for arrays */ /* This may generate recursive call to the library... -QAK */ { H5S_t *space; diff --git a/src/H5version.h b/src/H5version.h index 58de2ab..02e4c36 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -22,7 +22,7 @@ /* Issue error if contradicting macros have been defined. */ #if defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) -#error "Can't choose old API versions when deprecated APIs are disabled" + #error "Can't choose old API versions when deprecated APIs are disabled" #endif /* defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) */ @@ -33,7 +33,7 @@ * API symbol, the individual API version macro takes priority. */ #if defined(H5_USE_16_API_DEFAULT) && !defined(H5_USE_16_API) -#define H5_USE_16_API 1 + #define H5_USE_16_API 1 #endif /* H5_USE_16_API_DEFAULT && !H5_USE_16_API */ #ifdef H5_USE_16_API @@ -43,87 +43,87 @@ /*************/ #if !defined(H5Acreate_vers) -#define H5Acreate_vers 1 + #define H5Acreate_vers 1 #endif /* !defined(H5Acreate_vers) */ #if !defined(H5Aiterate_vers) -#define H5Aiterate_vers 1 + #define H5Aiterate_vers 1 #endif /* !defined(H5Aiterate_vers) */ #if !defined(H5Dcreate_vers) -#define H5Dcreate_vers 1 + #define H5Dcreate_vers 1 #endif /* !defined(H5Dcreate_vers) */ #if !defined(H5Dopen_vers) -#define H5Dopen_vers 1 + #define H5Dopen_vers 1 #endif /* !defined(H5Dopen_vers) */ #if !defined(H5Eclear_vers) -#define H5Eclear_vers 1 + #define H5Eclear_vers 1 #endif /* !defined(H5Eclear_vers) */ #if !defined(H5Eget_auto_vers) -#define H5Eget_auto_vers 1 + #define H5Eget_auto_vers 1 #endif /* !defined(H5Eget_auto_vers) */ #if !defined(H5Eprint_vers) -#define H5Eprint_vers 1 + #define H5Eprint_vers 1 #endif /* !defined(H5Eprint_vers) */ #if !defined(H5Epush_vers) -#define H5Epush_vers 1 + #define H5Epush_vers 1 #endif /* !defined(H5Epush_vers) */ #if !defined(H5Eset_auto_vers) -#define H5Eset_auto_vers 1 + #define H5Eset_auto_vers 1 #endif /* !defined(H5Eset_auto_vers) */ #if !defined(H5Ewalk_vers) -#define H5Ewalk_vers 1 + #define H5Ewalk_vers 1 #endif /* !defined(H5Ewalk_vers) */ #if !defined(H5Gcreate_vers) -#define H5Gcreate_vers 1 + #define H5Gcreate_vers 1 #endif /* !defined(H5Gcreate_vers) */ #if !defined(H5Gopen_vers) -#define H5Gopen_vers 1 + #define H5Gopen_vers 1 #endif /* !defined(H5Gopen_vers) */ #if !defined(H5Pget_filter_vers) -#define H5Pget_filter_vers 1 + #define H5Pget_filter_vers 1 #endif /* !defined(H5Pget_filter_vers) */ #if !defined(H5Pget_filter_by_id_vers) -#define H5Pget_filter_by_id_vers 1 + #define H5Pget_filter_by_id_vers 1 #endif /* !defined(H5Pget_filter_by_id_vers) */ #if !defined(H5Pinsert_vers) -#define H5Pinsert_vers 1 + #define H5Pinsert_vers 1 #endif /* !defined(H5Pinsert_vers) */ #if !defined(H5Pregister_vers) -#define H5Pregister_vers 1 + #define H5Pregister_vers 1 #endif /* !defined(H5Pregister_vers) */ #if !defined(H5Rget_obj_type_vers) -#define H5Rget_obj_type_vers 1 + #define H5Rget_obj_type_vers 1 #endif /* !defined(H5Rget_obj_type_vers) */ #if !defined(H5Tarray_create_vers) -#define H5Tarray_create_vers 1 + #define H5Tarray_create_vers 1 #endif /* !defined(H5Tarray_create_vers) */ #if !defined(H5Tcommit_vers) -#define H5Tcommit_vers 1 + #define H5Tcommit_vers 1 #endif /* !defined(H5Tcommit_vers) */ #if !defined(H5Tget_array_dims_vers) -#define H5Tget_array_dims_vers 1 + #define H5Tget_array_dims_vers 1 #endif /* !defined(H5Tget_array_dims_vers) */ #if !defined(H5Topen_vers) -#define H5Topen_vers 1 + #define H5Topen_vers 1 #endif /* !defined(H5Topen_vers) */ /************/ @@ -131,11 +131,11 @@ /************/ #if !defined(H5E_auto_t_vers) -#define H5E_auto_t_vers 1 + #define H5E_auto_t_vers 1 #endif /* !defined(H5E_auto_t_vers) */ #if !defined(H5Z_class_t_vers) -#define H5Z_class_t_vers 1 + #define H5Z_class_t_vers 1 #endif /* !defined(H5Z_class_t_vers) */ #endif /* H5_USE_16_API */ @@ -152,240 +152,240 @@ /*************/ #if !defined(H5Acreate_vers) || H5Acreate_vers == 2 -#ifndef H5Acreate_vers -#define H5Acreate_vers 2 -#endif /* H5Acreate_vers */ -#define H5Acreate H5Acreate2 + #ifndef H5Acreate_vers + #define H5Acreate_vers 2 + #endif /* H5Acreate_vers */ + #define H5Acreate H5Acreate2 #elif H5Acreate_vers == 1 -#define H5Acreate H5Acreate1 + #define H5Acreate H5Acreate1 #else /* H5Acreate_vers */ -#error "H5Acreate_vers set to invalid value" + #error "H5Acreate_vers set to invalid value" #endif /* H5Acreate_vers */ #if !defined(H5Aiterate_vers) || H5Aiterate_vers == 2 -#ifndef H5Aiterate_vers -#define H5Aiterate_vers 2 -#endif /* H5Aiterate_vers */ -#define H5Aiterate H5Aiterate2 -#define H5A_operator_t H5A_operator2_t + #ifndef H5Aiterate_vers + #define H5Aiterate_vers 2 + #endif /* H5Aiterate_vers */ + #define H5Aiterate H5Aiterate2 + #define H5A_operator_t H5A_operator2_t #elif H5Aiterate_vers == 1 -#define H5Aiterate H5Aiterate1 -#define H5A_operator_t H5A_operator1_t + #define H5Aiterate H5Aiterate1 + #define H5A_operator_t H5A_operator1_t #else /* H5Aiterate_vers */ -#error "H5Aiterate_vers set to invalid value" + #error "H5Aiterate_vers set to invalid value" #endif /* H5Aiterate_vers */ #if !defined(H5Dcreate_vers) || H5Dcreate_vers == 2 -#ifndef H5Dcreate_vers -#define H5Dcreate_vers 2 -#endif /* H5Dcreate_vers */ -#define H5Dcreate H5Dcreate2 + #ifndef H5Dcreate_vers + #define H5Dcreate_vers 2 + #endif /* H5Dcreate_vers */ + #define H5Dcreate H5Dcreate2 #elif H5Dcreate_vers == 1 -#define H5Dcreate H5Dcreate1 + #define H5Dcreate H5Dcreate1 #else /* H5Dcreate_vers */ -#error "H5Dcreate_vers set to invalid value" + #error "H5Dcreate_vers set to invalid value" #endif /* H5Dcreate_vers */ #if !defined(H5Dopen_vers) || H5Dopen_vers == 2 -#ifndef H5Dopen_vers -#define H5Dopen_vers 2 -#endif /* H5Dopen_vers */ -#define H5Dopen H5Dopen2 + #ifndef H5Dopen_vers + #define H5Dopen_vers 2 + #endif /* H5Dopen_vers */ + #define H5Dopen H5Dopen2 #elif H5Dopen_vers == 1 -#define H5Dopen H5Dopen1 + #define H5Dopen H5Dopen1 #else /* H5Dopen_vers */ -#error "H5Dopen_vers set to invalid value" + #error "H5Dopen_vers set to invalid value" #endif /* H5Dopen_vers */ #if !defined(H5Eclear_vers) || H5Eclear_vers == 2 -#ifndef H5Eclear_vers -#define H5Eclear_vers 2 -#endif /* H5Eclear_vers */ -#define H5Eclear H5Eclear2 + #ifndef H5Eclear_vers + #define H5Eclear_vers 2 + #endif /* H5Eclear_vers */ + #define H5Eclear H5Eclear2 #elif H5Eclear_vers == 1 -#define H5Eclear H5Eclear1 + #define H5Eclear H5Eclear1 #else /* H5Eclear_vers */ -#error "H5Eclear_vers set to invalid value" + #error "H5Eclear_vers set to invalid value" #endif /* H5Eclear_vers */ #if !defined(H5Eget_auto_vers) || H5Eget_auto_vers == 2 -#ifndef H5Eget_auto_vers -#define H5Eget_auto_vers 2 -#endif /* H5Eget_auto_vers */ -#define H5Eget_auto H5Eget_auto2 + #ifndef H5Eget_auto_vers + #define H5Eget_auto_vers 2 + #endif /* H5Eget_auto_vers */ + #define H5Eget_auto H5Eget_auto2 #elif H5Eget_auto_vers == 1 -#define H5Eget_auto H5Eget_auto1 + #define H5Eget_auto H5Eget_auto1 #else /* H5Eget_auto_vers */ -#error "H5Eget_auto_vers set to invalid value" + #error "H5Eget_auto_vers set to invalid value" #endif /* H5Eget_auto_vers */ #if !defined(H5Eprint_vers) || H5Eprint_vers == 2 -#ifndef H5Eprint_vers -#define H5Eprint_vers 2 -#endif /* H5Eprint_vers */ -#define H5Eprint H5Eprint2 + #ifndef H5Eprint_vers + #define H5Eprint_vers 2 + #endif /* H5Eprint_vers */ + #define H5Eprint H5Eprint2 #elif H5Eprint_vers == 1 -#define H5Eprint H5Eprint1 + #define H5Eprint H5Eprint1 #else /* H5Eprint_vers */ -#error "H5Eprint_vers set to invalid value" + #error "H5Eprint_vers set to invalid value" #endif /* H5Eprint_vers */ #if !defined(H5Epush_vers) || H5Epush_vers == 2 -#ifndef H5Epush_vers -#define H5Epush_vers 2 -#endif /* H5Epush_vers */ -#define H5Epush H5Epush2 + #ifndef H5Epush_vers + #define H5Epush_vers 2 + #endif /* H5Epush_vers */ + #define H5Epush H5Epush2 #elif H5Epush_vers == 1 -#define H5Epush H5Epush1 + #define H5Epush H5Epush1 #else /* H5Epush_vers */ -#error "H5Epush_vers set to invalid value" + #error "H5Epush_vers set to invalid value" #endif /* H5Epush_vers */ #if !defined(H5Eset_auto_vers) || H5Eset_auto_vers == 2 -#ifndef H5Eset_auto_vers -#define H5Eset_auto_vers 2 -#endif /* H5Eset_auto_vers */ -#define H5Eset_auto H5Eset_auto2 + #ifndef H5Eset_auto_vers + #define H5Eset_auto_vers 2 + #endif /* H5Eset_auto_vers */ + #define H5Eset_auto H5Eset_auto2 #elif H5Eset_auto_vers == 1 -#define H5Eset_auto H5Eset_auto1 + #define H5Eset_auto H5Eset_auto1 #else /* H5Eset_auto_vers */ -#error "H5Eset_auto_vers set to invalid value" + #error "H5Eset_auto_vers set to invalid value" #endif /* H5Eset_auto_vers */ #if !defined(H5Ewalk_vers) || H5Ewalk_vers == 2 -#ifndef H5Ewalk_vers -#define H5Ewalk_vers 2 -#endif /* H5Ewalk_vers */ -#define H5Ewalk H5Ewalk2 -#define H5E_error_t H5E_error2_t -#define H5E_walk_t H5E_walk2_t + #ifndef H5Ewalk_vers + #define H5Ewalk_vers 2 + #endif /* H5Ewalk_vers */ + #define H5Ewalk H5Ewalk2 + #define H5E_error_t H5E_error2_t + #define H5E_walk_t H5E_walk2_t #elif H5Ewalk_vers == 1 -#define H5Ewalk H5Ewalk1 -#define H5E_error_t H5E_error1_t -#define H5E_walk_t H5E_walk1_t + #define H5Ewalk H5Ewalk1 + #define H5E_error_t H5E_error1_t + #define H5E_walk_t H5E_walk1_t #else /* H5Ewalk_vers */ -#error "H5Ewalk_vers set to invalid value" + #error "H5Ewalk_vers set to invalid value" #endif /* H5Ewalk_vers */ #if !defined(H5Gcreate_vers) || H5Gcreate_vers == 2 -#ifndef H5Gcreate_vers -#define H5Gcreate_vers 2 -#endif /* H5Gcreate_vers */ -#define H5Gcreate H5Gcreate2 + #ifndef H5Gcreate_vers + #define H5Gcreate_vers 2 + #endif /* H5Gcreate_vers */ + #define H5Gcreate H5Gcreate2 #elif H5Gcreate_vers == 1 -#define H5Gcreate H5Gcreate1 + #define H5Gcreate H5Gcreate1 #else /* H5Gcreate_vers */ -#error "H5Gcreate_vers set to invalid value" + #error "H5Gcreate_vers set to invalid value" #endif /* H5Gcreate_vers */ #if !defined(H5Gopen_vers) || H5Gopen_vers == 2 -#ifndef H5Gopen_vers -#define H5Gopen_vers 2 -#endif /* H5Gopen_vers */ -#define H5Gopen H5Gopen2 + #ifndef H5Gopen_vers + #define H5Gopen_vers 2 + #endif /* H5Gopen_vers */ + #define H5Gopen H5Gopen2 #elif H5Gopen_vers == 1 -#define H5Gopen H5Gopen1 + #define H5Gopen H5Gopen1 #else /* H5Gopen_vers */ -#error "H5Gopen_vers set to invalid value" + #error "H5Gopen_vers set to invalid value" #endif /* H5Gopen_vers */ #if !defined(H5Pget_filter_vers) || H5Pget_filter_vers == 2 -#ifndef H5Pget_filter_vers -#define H5Pget_filter_vers 2 -#endif /* H5Pget_filter_vers */ -#define H5Pget_filter H5Pget_filter2 + #ifndef H5Pget_filter_vers + #define H5Pget_filter_vers 2 + #endif /* H5Pget_filter_vers */ + #define H5Pget_filter H5Pget_filter2 #elif H5Pget_filter_vers == 1 -#define H5Pget_filter H5Pget_filter1 + #define H5Pget_filter H5Pget_filter1 #else /* H5Pget_filter_vers */ -#error "H5Pget_filter_vers set to invalid value" + #error "H5Pget_filter_vers set to invalid value" #endif /* H5Pget_filter_vers */ #if !defined(H5Pget_filter_by_id_vers) || H5Pget_filter_by_id_vers == 2 -#ifndef H5Pget_filter_by_id_vers -#define H5Pget_filter_by_id_vers 2 -#endif /* H5Pget_filter_by_id_vers */ -#define H5Pget_filter_by_id H5Pget_filter_by_id2 + #ifndef H5Pget_filter_by_id_vers + #define H5Pget_filter_by_id_vers 2 + #endif /* H5Pget_filter_by_id_vers */ + #define H5Pget_filter_by_id H5Pget_filter_by_id2 #elif H5Pget_filter_by_id_vers == 1 -#define H5Pget_filter_by_id H5Pget_filter_by_id1 + #define H5Pget_filter_by_id H5Pget_filter_by_id1 #else /* H5Pget_filter_by_id_vers */ -#error "H5Pget_filter_by_id_vers set to invalid value" + #error "H5Pget_filter_by_id_vers set to invalid value" #endif /* H5Pget_filter_by_id_vers */ #if !defined(H5Pinsert_vers) || H5Pinsert_vers == 2 -#ifndef H5Pinsert_vers -#define H5Pinsert_vers 2 -#endif /* H5Pinsert_vers */ -#define H5Pinsert H5Pinsert2 + #ifndef H5Pinsert_vers + #define H5Pinsert_vers 2 + #endif /* H5Pinsert_vers */ + #define H5Pinsert H5Pinsert2 #elif H5Pinsert_vers == 1 -#define H5Pinsert H5Pinsert1 + #define H5Pinsert H5Pinsert1 #else /* H5Pinsert_vers */ -#error "H5Pinsert_vers set to invalid value" + #error "H5Pinsert_vers set to invalid value" #endif /* H5Pinsert_vers */ #if !defined(H5Pregister_vers) || H5Pregister_vers == 2 -#ifndef H5Pregister_vers -#define H5Pregister_vers 2 -#endif /* H5Pregister_vers */ -#define H5Pregister H5Pregister2 + #ifndef H5Pregister_vers + #define H5Pregister_vers 2 + #endif /* H5Pregister_vers */ + #define H5Pregister H5Pregister2 #elif H5Pregister_vers == 1 -#define H5Pregister H5Pregister1 + #define H5Pregister H5Pregister1 #else /* H5Pregister_vers */ -#error "H5Pregister_vers set to invalid value" + #error "H5Pregister_vers set to invalid value" #endif /* H5Pregister_vers */ #if !defined(H5Rget_obj_type_vers) || H5Rget_obj_type_vers == 2 -#ifndef H5Rget_obj_type_vers -#define H5Rget_obj_type_vers 2 -#endif /* H5Rget_obj_type_vers */ -#define H5Rget_obj_type H5Rget_obj_type2 + #ifndef H5Rget_obj_type_vers + #define H5Rget_obj_type_vers 2 + #endif /* H5Rget_obj_type_vers */ + #define H5Rget_obj_type H5Rget_obj_type2 #elif H5Rget_obj_type_vers == 1 -#define H5Rget_obj_type H5Rget_obj_type1 + #define H5Rget_obj_type H5Rget_obj_type1 #else /* H5Rget_obj_type_vers */ -#error "H5Rget_obj_type_vers set to invalid value" + #error "H5Rget_obj_type_vers set to invalid value" #endif /* H5Rget_obj_type_vers */ #if !defined(H5Tarray_create_vers) || H5Tarray_create_vers == 2 -#ifndef H5Tarray_create_vers -#define H5Tarray_create_vers 2 -#endif /* H5Tarray_create_vers */ -#define H5Tarray_create H5Tarray_create2 + #ifndef H5Tarray_create_vers + #define H5Tarray_create_vers 2 + #endif /* H5Tarray_create_vers */ + #define H5Tarray_create H5Tarray_create2 #elif H5Tarray_create_vers == 1 -#define H5Tarray_create H5Tarray_create1 + #define H5Tarray_create H5Tarray_create1 #else /* H5Tarray_create_vers */ -#error "H5Tarray_create_vers set to invalid value" + #error "H5Tarray_create_vers set to invalid value" #endif /* H5Tarray_create_vers */ #if !defined(H5Tcommit_vers) || H5Tcommit_vers == 2 -#ifndef H5Tcommit_vers -#define H5Tcommit_vers 2 -#endif /* H5Tcommit_vers */ -#define H5Tcommit H5Tcommit2 + #ifndef H5Tcommit_vers + #define H5Tcommit_vers 2 + #endif /* H5Tcommit_vers */ + #define H5Tcommit H5Tcommit2 #elif H5Tcommit_vers == 1 -#define H5Tcommit H5Tcommit1 + #define H5Tcommit H5Tcommit1 #else /* H5Tcommit_vers */ -#error "H5Tcommit_vers set to invalid value" + #error "H5Tcommit_vers set to invalid value" #endif /* H5Tcommit_vers */ #if !defined(H5Tget_array_dims_vers) || H5Tget_array_dims_vers == 2 -#ifndef H5Tget_array_dims_vers -#define H5Tget_array_dims_vers 2 -#endif /* H5Tget_array_dims_vers */ -#define H5Tget_array_dims H5Tget_array_dims2 + #ifndef H5Tget_array_dims_vers + #define H5Tget_array_dims_vers 2 + #endif /* H5Tget_array_dims_vers */ + #define H5Tget_array_dims H5Tget_array_dims2 #elif H5Tget_array_dims_vers == 1 -#define H5Tget_array_dims H5Tget_array_dims1 + #define H5Tget_array_dims H5Tget_array_dims1 #else /* H5Tget_array_dims_vers */ -#error "H5Tget_array_dims_vers set to invalid value" + #error "H5Tget_array_dims_vers set to invalid value" #endif /* H5Tget_array_dims_vers */ #if !defined(H5Topen_vers) || H5Topen_vers == 2 -#ifndef H5Topen_vers -#define H5Topen_vers 2 -#endif /* H5Topen_vers */ -#define H5Topen H5Topen2 + #ifndef H5Topen_vers + #define H5Topen_vers 2 + #endif /* H5Topen_vers */ + #define H5Topen H5Topen2 #elif H5Topen_vers == 1 -#define H5Topen H5Topen1 + #define H5Topen H5Topen1 #else /* H5Topen_vers */ -#error "H5Topen_vers set to invalid value" + #error "H5Topen_vers set to invalid value" #endif /* H5Topen_vers */ /************/ @@ -393,26 +393,26 @@ /************/ #if !defined(H5E_auto_t_vers) || H5E_auto_t_vers == 2 -#ifndef H5E_auto_t_vers -#define H5E_auto_t_vers 2 -#endif /* H5E_auto_t_vers */ -#define H5E_auto_t H5E_auto2_t + #ifndef H5E_auto_t_vers + #define H5E_auto_t_vers 2 + #endif /* H5E_auto_t_vers */ + #define H5E_auto_t H5E_auto2_t #elif H5E_auto_t_vers == 1 -#define H5E_auto_t H5E_auto1_t + #define H5E_auto_t H5E_auto1_t #else /* H5E_auto_t_vers */ -#error "H5E_auto_t_vers set to invalid value" + #error "H5E_auto_t_vers set to invalid value" #endif /* H5E_auto_t_vers */ #if !defined(H5Z_class_t_vers) || H5Z_class_t_vers == 2 -#ifndef H5Z_class_t_vers -#define H5Z_class_t_vers 2 -#endif /* H5Z_class_t_vers */ -#define H5Z_class_t H5Z_class2_t + #ifndef H5Z_class_t_vers + #define H5Z_class_t_vers 2 + #endif /* H5Z_class_t_vers */ + #define H5Z_class_t H5Z_class2_t #elif H5Z_class_t_vers == 1 -#define H5Z_class_t H5Z_class1_t + #define H5Z_class_t H5Z_class1_t #else /* H5Z_class_t_vers */ -#error "H5Z_class_t_vers set to invalid value" + #error "H5Z_class_t_vers set to invalid value" #endif /* H5Z_class_t_vers */ #endif /* H5version_H */ diff --git a/test/cache_api.c b/test/cache_api.c index 66f8143..b1ccef1 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -3038,7 +3038,7 @@ check_fapl_mdc_api_errs(void) if ( pass ) { H5E_BEGIN_TRY { - result = H5Pget_mdc_config(-1, &scratch); + result = H5Pget_mdc_config((hid_t)-1, &scratch); } H5E_END_TRY; if ( result >= 0 ) { @@ -3109,7 +3109,7 @@ check_fapl_mdc_api_errs(void) if ( pass ) { H5E_BEGIN_TRY { - result = H5Pset_mdc_config(-1, &default_config); + result = H5Pset_mdc_config((hid_t)-1, &default_config); } H5E_END_TRY; if ( result >= 0 ) { @@ -3258,7 +3258,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fget_mdc_config(-1, &scratch); + result = H5Fget_mdc_config((hid_t)-1, &scratch); } H5E_END_TRY; if ( result >= 0 ) { @@ -3317,7 +3317,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fset_mdc_config(-1, &default_config); + result = H5Fset_mdc_config((hid_t)-1, &default_config); } H5E_END_TRY; if ( result >= 0 ) { @@ -3385,7 +3385,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fget_mdc_hit_rate(-1, &hit_rate); + result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate); } H5E_END_TRY; if ( result >= 0 ) { @@ -3425,7 +3425,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Freset_mdc_hit_rate_stats(-1); + result = H5Freset_mdc_hit_rate_stats((hid_t)-1); } H5E_END_TRY; if ( result >= 0 ) { @@ -3446,7 +3446,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fget_mdc_size(-1, &max_size, &min_clean_size, + result = H5Fget_mdc_size((hid_t)-1, &max_size, &min_clean_size, &cur_size, &cur_num_entries); } H5E_END_TRY; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 433c488..a782fb0 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -614,7 +614,7 @@ test_compound (char *filename, hid_t fapl) if ((s8_m_sid = H5Screate_simple (2, h_size, NULL)) < 0) goto error; /* Read the dataset */ - s8 = (s1_t *) calloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t)); + s8 = (s1_t *) HDcalloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t)); assert (s8); if (H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) { goto error; @@ -641,7 +641,7 @@ test_compound (char *filename, hid_t fapl) } } - free (s8); + HDfree (s8); s8 = NULL; PASSED(); @@ -781,7 +781,7 @@ test_compound (char *filename, hid_t fapl) f_offset[1] = NY/3; h_size[0] = 2*NX/3 - f_offset[0]; h_size[1] = 2*NY/3 - f_offset[1]; - s11 = (s4_t *) malloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t)); + s11 = (s4_t *) HDmalloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t)); assert (s11); /* Initialize */ @@ -793,7 +793,7 @@ test_compound (char *filename, hid_t fapl) if (H5Dwrite (dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11) < 0) { goto error; } - free (s11); + HDfree (s11); s11=NULL; /* Read the whole thing */ @@ -1380,12 +1380,12 @@ test_hdf5_src_subset(char *filename, hid_t fapl) goto error; /* Allocate space and initialize data */ - orig = (unsigned char*)malloc(NX * NY * sizeof(stype1)); + orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1)); initialize_stype1(orig, (size_t)NX*NY); - rbuf = (unsigned char*)malloc(NX * NY * sizeof(stype2)); + rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2)); - rew_buf = (unsigned char*)malloc(NX * NY * sizeof(stype3)); + rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype3)); initialize_stype3(rew_buf, (size_t)NX*NY); @@ -1515,9 +1515,9 @@ test_hdf5_src_subset(char *filename, hid_t fapl) if(H5Fclose(file) < 0) FAIL_STACK_ERROR - free(orig); - free(rbuf); - free(rew_buf); + HDfree(orig); + HDfree(rbuf); + HDfree(rew_buf); PASSED(); return 0; @@ -1585,12 +1585,12 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) goto error; /* Allocate space and initialize data */ - orig = (unsigned char*)malloc(NX * NY * sizeof(stype2)); + orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2)); initialize_stype2(orig, (size_t)NX*NY); - rbuf = (unsigned char*)malloc(NX * NY * sizeof(stype1)); + rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1)); - rew_buf = (unsigned char*)malloc(NX * NY * sizeof(stype4)); + rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype4)); initialize_stype4(rew_buf, (size_t)NX*NY); /* Create dataset creation property list */ @@ -1719,9 +1719,9 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) if(H5Fclose(file) < 0) goto error; - free(orig); - free(rbuf); - free(rew_buf); + HDfree(orig); + HDfree(rbuf); + HDfree(rew_buf); PASSED(); return 0; @@ -2183,7 +2183,7 @@ main (int argc, char *argv[]) fprintf(stderr, "usage: %s [--noopt]\n", argv[0]); exit(1); } - H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T__conv_struct_opt); + H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, H5T__conv_struct_opt); } /* Create the file */ diff --git a/test/dsets.c b/test/dsets.c index b41e883..8ba79c3 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -483,7 +483,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) HDclose(f); - free (tconv_buf); + HDfree (tconv_buf); PASSED(); } /* end if */ else { @@ -1854,13 +1854,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Dclose (dataset) < 0) goto error; if(H5Sclose (sid) < 0) goto error; if(H5Pclose (dxpl) < 0) goto error; - free (tconv_buf); + HDfree (tconv_buf); return(0); error: if(tconv_buf) - free (tconv_buf); + HDfree (tconv_buf); return -1; } @@ -3856,7 +3856,7 @@ test_nbit_compound_3(hid_t file) for(k = 0; k < (i+1); k++) ((unsigned int *)orig_data[i].v.p)[k] = (unsigned int)(i*100 + k); /* Create reference to the dataset "nbit_obj_ref" */ - if(H5Rcreate(&orig_data[i].r, file, "nbit_obj_ref", H5R_OBJECT, -1) < 0) goto error; + if(H5Rcreate(&orig_data[i].r, file, "nbit_obj_ref", H5R_OBJECT, (hid_t)-1) < 0) goto error; for(j = 0; j < 5; j++) orig_data[i].o[j] = (unsigned char)(i + j); } @@ -6547,7 +6547,7 @@ auxread_fdata(hid_t fid, const char *name) if(H5Dclose(dset_id) < 0) goto error; if(buf) - free(buf); + HDfree(buf); return 0; @@ -6559,7 +6559,7 @@ error: H5Tclose(ftype_id); H5Tclose(mtype_id); if(buf) - free(buf); + HDfree(buf); } H5E_END_TRY; return -1; } diff --git a/test/dt_arith.c b/test/dt_arith.c index be795dd..5ae401b 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -296,8 +296,8 @@ static int without_hardware_g = 0; HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ \ - tmp1 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \ - tmp2 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \ + tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ + tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \ \ buf_p = BUF; \ saved_p = SAVED; \ @@ -325,8 +325,8 @@ static int without_hardware_g = 0; buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ } \ - free(tmp1); \ - free(tmp2); \ + HDfree(tmp1); \ + HDfree(tmp2); \ } /* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity, @@ -348,7 +348,7 @@ static int without_hardware_g = 0; SAVED = (unsigned char*)aligned_malloc( NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ - value = (unsigned char*)calloc(SRC_SIZE, sizeof(unsigned char)); \ + value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \ \ buf_p = BUF; \ \ @@ -391,7 +391,7 @@ static int without_hardware_g = 0; } \ \ HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \ - free(value); \ + HDfree(value); \ } void some_dummy_func(float x); @@ -757,8 +757,8 @@ static int test_particular_fp_integer(void) endian = H5Tget_order(H5T_NATIVE_DOUBLE); src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE); dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR); - buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); - saved_buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); + buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); + saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); memcpy(buf1, &src_d, src_size1); memcpy(saved_buf1, &src_d, src_size1); @@ -807,8 +807,8 @@ static int test_particular_fp_integer(void) /* Test conversion from float (the value is INT_MAX) to int. */ src_size2 = H5Tget_size(H5T_NATIVE_FLOAT); dst_size2 = H5Tget_size(H5T_NATIVE_INT); - buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); - saved_buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); + buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); + saved_buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2)); HDmemcpy(buf2, &src_f, src_size2); HDmemcpy(saved_buf2, &src_f, src_size2); @@ -858,13 +858,13 @@ static int test_particular_fp_integer(void) } if(buf1) - free(buf1); + HDfree(buf1); if(buf2) - free(buf2); + HDfree(buf2); if(saved_buf1) - free(saved_buf1); + HDfree(saved_buf1); if(saved_buf2) - free(saved_buf2); + HDfree(saved_buf2); PASSED(); return 0; @@ -875,13 +875,13 @@ error: H5Pclose(dxpl_id); } H5E_END_TRY; if(buf1) - free(buf1); + HDfree(buf1); if(buf2) - free(buf2); + HDfree(buf2); if(saved_buf1) - free(saved_buf1); + HDfree(saved_buf1); if(saved_buf2) - free(saved_buf2); + HDfree(saved_buf2); reset_hdf5(); /*print statistics*/ return MAX((int)fails_this_test, 1); @@ -1111,9 +1111,9 @@ test_derived_flt(void) } fails_this_test = 0; - free(buf); - free(saved_buf); - free(aligned); + HDfree(buf); + HDfree(saved_buf); + HDfree(aligned); buf = NULL; saved_buf = NULL; aligned = NULL; @@ -1274,8 +1274,8 @@ test_derived_flt(void) } } - if (buf) free(buf); - if (saved_buf) free(saved_buf); + if (buf) HDfree(buf); + if (saved_buf) HDfree(saved_buf); if(H5Tclose(tid1) < 0) { H5_FAILED(); @@ -1307,9 +1307,9 @@ test_derived_flt(void) return 0; error: - if (buf) free(buf); - if (saved_buf) free(saved_buf); - if (aligned) free(aligned); + if (buf) HDfree(buf); + if (saved_buf) HDfree(saved_buf); + if (aligned) HDfree(aligned); HDfflush(stdout); H5E_BEGIN_TRY { H5Tclose (tid1); @@ -1600,8 +1600,8 @@ test_derived_integer(void) goto error; } /* end if */ - free(buf); - free(saved_buf); + HDfree(buf); + HDfree(saved_buf); PASSED(); reset_hdf5(); /*print statistics*/ @@ -1609,8 +1609,8 @@ test_derived_integer(void) return 0; error: - if (buf) free(buf); - if (saved_buf) free(saved_buf); + if (buf) HDfree(buf); + if (saved_buf) HDfree(saved_buf); HDfflush(stdout); H5E_BEGIN_TRY { H5Tclose (tid1); @@ -1859,6 +1859,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_UCHAR==dst_type) { @@ -1909,6 +1910,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_SHORT==dst_type) { @@ -1960,6 +1962,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_USHORT==dst_type) { @@ -2010,6 +2013,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_INT==dst_type) { @@ -2060,6 +2064,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_UINT==dst_type) { @@ -2110,6 +2115,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_LONG==dst_type) { @@ -2160,6 +2166,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_ULONG==dst_type) { @@ -2210,6 +2217,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_LLONG==dst_type) { @@ -2260,6 +2268,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_ULLONG==dst_type) { @@ -2310,6 +2319,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } @@ -2488,6 +2498,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } @@ -2541,6 +2552,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } @@ -2584,6 +2596,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } @@ -2777,7 +2790,7 @@ my_isinf(int endian, unsigned char *val, size_t size, int retval = 0; size_t i; - bits = (unsigned char*)calloc((size_t)1, size); + bits = (unsigned char*)HDcalloc((size_t)1, size); #ifdef H5_VMS if(H5T_ORDER_VAX==endian) { @@ -2801,7 +2814,7 @@ my_isinf(int endian, unsigned char *val, size_t size, H5T__bit_find(bits, epos, esize, H5T_BIT_LSB, 0) < 0) retval = 1; - free(bits); + HDfree(bits); return retval; } @@ -3881,6 +3894,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (FLT_DOUBLE==dst_type) { @@ -3933,6 +3947,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } #if H5_SIZEOF_LONG_DOUBLE !=0 @@ -3986,6 +4001,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case FLT_LDOUBLE: case OTHER: default: + HDassert(0 && "Unknown type"); break; } #endif @@ -4018,6 +4034,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_UCHAR==dst_type) { @@ -4049,6 +4066,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_SHORT==dst_type) { @@ -4080,6 +4098,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_USHORT==dst_type) { @@ -4111,6 +4130,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_INT==dst_type) { @@ -4142,6 +4162,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_UINT==dst_type) { @@ -4173,6 +4194,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_LONG==dst_type) { @@ -4204,6 +4226,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_ULONG==dst_type) { @@ -4235,6 +4258,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_LLONG==dst_type) { @@ -4266,6 +4290,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } else if (INT_ULLONG==dst_type) { @@ -4297,6 +4322,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) case INT_ULLONG: case OTHER: default: + HDassert(0 && "Unknown type"); break; } } @@ -4586,6 +4612,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) break; #endif case OTHER: + default: + HDassert(0 && "Unknown type"); break; } @@ -4649,6 +4677,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) break; #endif case OTHER: + default: + HDassert(0 && "Unknown type"); break; } @@ -4699,6 +4729,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) break; #endif case OTHER: + default: + HDassert(0 && "Unknown type"); break; } diff --git a/test/dtypes.c b/test/dtypes.c index de81bd5..52e7983 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -697,9 +697,9 @@ test_compound_2(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->a = i*8+0; @@ -762,9 +762,9 @@ test_compound_2(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs , st, dt) PASSED(); @@ -818,9 +818,9 @@ test_compound_3(void) FAIL_STACK_ERROR /* Initialize */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->a = i*8+0; @@ -880,9 +880,9 @@ test_compound_3(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs, st, dt) PASSED(); @@ -940,9 +940,9 @@ test_compound_4(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->a = i*8+0; @@ -1006,9 +1006,9 @@ test_compound_4(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs, st, dt) PASSED(); @@ -1066,14 +1066,7 @@ test_compound_5(void) void *bkg = HDcalloc((size_t)2, sizeof(dst_type_t)); int retval = 1; -#if 1 TESTING("optimized struct converter"); -#else - /* Turn off optimized compound conversion function to work around - * the problem. */ - TESTING("optimized struct converter bug workaround"); - H5Tunregister(H5T_PERS_DONTCARE, "struct(opt)", -1, -1, NULL); -#endif /* Build datatypes */ short_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(short)); @@ -1175,9 +1168,9 @@ test_compound_6(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt)); - orig = (unsigned char*)malloc(nelmts * sizeof(struct st)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)orig) + i; s_ptr->b = (i*8+1) & 0x7fff; @@ -1223,9 +1216,9 @@ test_compound_6(void) } /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); CHECK_NMEMBS(nmembs, st, dt) PASSED(); @@ -1408,8 +1401,7 @@ test_compound_8(void) char c; s1 d; } s2; - - hid_t tid1, tid1_copy, tid2, tid2_copy, tid3, arr_tid; + hid_t tid1, tid1_copy, tid2, tid2_copy, tid3, arr_tid; size_t tsize; hsize_t dims[1] = {ARRAY_DIM}; herr_t ret; @@ -1561,7 +1553,7 @@ test_compound_8(void) if(tsize != (sizeof(char) + sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed compound datatype is incorrect: tsize=%d\n", tsize); + printf("The size of the packed compound datatype is incorrect: tsize = %zu\n", tsize); goto error; } /* end if */ @@ -1791,7 +1783,7 @@ test_compound_9(void) } /* end if */ rdata.i1 = rdata.i2 = 0; - if(rdata.str) free(rdata.str); + if(rdata.str) HDfree(rdata.str); if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); @@ -1805,7 +1797,7 @@ test_compound_9(void) goto error; } /* end if */ - if(rdata.str) free(rdata.str); + if(rdata.str) HDfree(rdata.str); if(H5Dclose(dset_id) < 0) goto error; @@ -1984,10 +1976,10 @@ test_compound_10(void) goto error; } - free(t1); - free(t2); - free(wdata[i].str); - free(rdata[i].str); + HDfree(t1); + HDfree(t2); + HDfree(wdata[i].str); + HDfree(rdata[i].str); } /* end for */ if(H5Dclose(dset_id) < 0) @@ -4548,7 +4540,7 @@ test_conv_enum_2(void) H5Tenum_insert(dsttype, mname[i], &i); /* Source data */ - data = (int*)malloc(NTESTELEM*sizeof(int)); + data = (int*)HDmalloc(NTESTELEM*sizeof(int)); for (i=0; i<NTESTELEM; i++) { ((char*)data)[i*3+2] = (char)(i % 8); ((char*)data)[i*3+0] = 0; @@ -4570,7 +4562,7 @@ test_conv_enum_2(void) } /* Cleanup */ - free(data); + HDfree(data); H5Tclose(srctype); H5Tclose(dsttype); H5Tclose(oddsize); @@ -5387,7 +5379,7 @@ test_encode(void) printf("Can't close datatype\n"); goto error; } /* end if */ - free(cmpd_buf); + HDfree(cmpd_buf); cmpd_buf_size = 0; /* Commit enumeration datatype and close it */ @@ -5406,7 +5398,7 @@ test_encode(void) printf("Can't close datatype\n"); goto error; } /* end if */ - free(enum_buf); + HDfree(enum_buf); enum_buf_size = 0; /* Commit enumeration datatype and close it */ @@ -5425,7 +5417,7 @@ test_encode(void) printf("Can't close datatype\n"); goto error; } /* end if */ - free(vlstr_buf); + HDfree(vlstr_buf); vlstr_buf_size = 0; /* Open the dataytpe for query */ @@ -5543,7 +5535,7 @@ test_encode(void) printf("Can't decode VL string type\n"); goto error; } /* end if */ - free(vlstr_buf); + HDfree(vlstr_buf); /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid3, tid3)<=0) { @@ -5656,8 +5648,8 @@ test_encode(void) goto error; } /* end if */ - free(cmpd_buf); - free(enum_buf); + HDfree(cmpd_buf); + HDfree(enum_buf); PASSED(); return 0; diff --git a/test/dynlib2.c b/test/dynlib2.c index a853ed0..0d8be2b 100644 --- a/test/dynlib2.c +++ b/test/dynlib2.c @@ -71,6 +71,9 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts, if(cd_nelmts > 0) return(0); + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + if(flags & H5Z_FLAG_REVERSE) { /*read*/ /* Divide the original value with MULTIPLIER */ while(buf_left > 0) { diff --git a/test/dynlib3.c b/test/dynlib3.c index 9560b86..b3a02ed 100644 --- a/test/dynlib3.c +++ b/test/dynlib3.c @@ -71,6 +71,9 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, if(cd_nelmts > 0) return(0); + /* Assignment to eliminate unused parameter warning. */ + cd_values = cd_values; + if(flags & H5Z_FLAG_REVERSE) { /*read*/ ret_value = *buf_size = nbytes - SUFFIX_LEN; } /* end if */ diff --git a/test/err_compat.c b/test/err_compat.c index 346d397..576433e 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -40,7 +40,7 @@ const char *FILENAME[] = { int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; #define DSET_NAME "a_dataset" -#define FAKE_ID -1 +#define FAKE_ID (hid_t)-1 herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data); herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data); diff --git a/test/error_test.c b/test/error_test.c index 1ca9686..0d945d2 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -57,7 +57,7 @@ hid_t ERR_MIN_WRITE; hid_t ERR_MIN_GETNUM; #define DSET_NAME "a_dataset" -#define FAKE_ID 0 +#define FAKE_ID (hid_t)0 #define ERR_CLS_NAME "Error Test" #define ERR_CLS2_NAME "Second Test" diff --git a/test/file_image.c b/test/file_image.c index d4056a7..b1b9d47 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -557,7 +557,7 @@ test_core(void) /* Append ".copy" to the filename from the source directory */ VERIFY(HDstrlen(filename) < (1023 - 5), "file name too long."); - HDstrncpy(copied_filename, filename, 1023); + HDstrncpy(copied_filename, filename, (size_t)1023); copied_filename[1023] = '\0'; HDstrcat(copied_filename, ".copy"); diff --git a/test/fillval.c b/test/fillval.c index c69f409..b73ed17 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -469,7 +469,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* 6. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)!=FAIL) @@ -510,7 +510,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* 4. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)!=FAIL) goto error; @@ -1111,34 +1111,34 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0; nerrors += test_rdwr_cases(file, dcpl, "dset1", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset2", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset3", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset4", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */ /* This case has been tested in test_create() function */ /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset5", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined * as compound type */ @@ -1164,34 +1164,34 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0; nerrors += test_rdwr_cases(file, dcpl, "dset6", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset7", &fillval, H5D_FILL_TIME_NEVER, layout, - H5T_INTEGER, -1); + H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset8", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset9", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */ /* This case has been tested in test_create() function */ /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset10", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined * as compound type */ diff --git a/test/filter_fail.c b/test/filter_fail.c index 67e1dda..3dbb564 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -65,8 +65,8 @@ const H5Z_class2_t H5Z_FAIL_TEST[1] = {{ *------------------------------------------------------------------------- */ static size_t -filter_fail(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, +filter_fail(unsigned int flags, size_t UNUSED cd_nelmts, + const unsigned int UNUSED *cd_values, size_t nbytes, size_t *buf_size, void **buf) { int *dst = (int*)(*buf); @@ -387,6 +387,7 @@ int main(void) if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) TEST_ERROR + /* Run the test again. */ nerrors += (test_filter_write(filename, fapl, FALSE) < 0 ? 1 : 0); nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0); diff --git a/test/getname.c b/test/getname.c index 1abc04a..dac115c 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2487,30 +2487,30 @@ test_obj_ref(hid_t fapl) FAIL_STACK_ERROR /* Create reference to dataset */ - if(H5Rcreate(&wbuf[0], fid1, "/Dataset3", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[0], fid1, "/Dataset3", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to dataset */ - if(H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to group */ - if(H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to named datatype */ - if(H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR - if(H5Rcreate(&wbuf[4], fid1, "/Group1/Group2/Dataset4", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[4], fid1, "/Group1/Group2/Dataset4", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR - if(H5Rcreate(&wbuf[5], fid1, "/Group1/Group2", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[5], fid1, "/Group1/Group2", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR - if(H5Rcreate(&wbuf[6], fid1, "/Group1/Group2/Link/Dataset5", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[6], fid1, "/Group1/Group2/Link/Dataset5", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to root group */ - if(H5Rcreate(&wbuf[7], fid1, "/", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[7], fid1, "/", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Write selection to disk */ diff --git a/test/h5test.c b/test/h5test.c index 2afda36..fce8c9b 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -623,7 +623,7 @@ h5_fileaccess(void) void h5_no_hwconv(void) { - H5Tunregister(H5T_PERS_HARD, NULL, -1, -1, NULL); + H5Tunregister(H5T_PERS_HARD, NULL, (hid_t)-1, (hid_t)-1, NULL); } @@ -745,7 +745,7 @@ h5_set_info_object(void) /* copy key/value pair into temporary buffer */ len = strcspn(valp, ";"); next = &valp[len]; - key_val = (char *)calloc(1, len + 1); + key_val = (char *)HDcalloc(1, len + 1); /* increment the next pointer past the terminating semicolon */ if (*next == ';') @@ -1113,7 +1113,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) * *------------------------------------------------------------------------- */ -hid_t +int h5_make_local_copy(const char *origfilename, const char *local_copy_name) { int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ diff --git a/test/links.c b/test/links.c index 9d8b8b1..26bfaa8 100644 --- a/test/links.c +++ b/test/links.c @@ -558,8 +558,8 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { H5_FAILED(); - puts(" Hard link test failed. Link seems not to point to the "); - puts(" expected file location."); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); TEST_ERROR } /* end if */ if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -574,14 +574,14 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { H5_FAILED(); - puts(" Soft link test failed. Link seems not to point to the "); - puts(" expected file location."); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/d1")) { H5_FAILED(); - puts(" Soft link test failed. Wrong link value"); + HDputs(" Soft link test failed. Wrong link value"); TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -592,7 +592,7 @@ cklinks(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" H5Oget_info_by_name() should have failed for a dangling link."); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -608,7 +608,7 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ if(HDstrcmp(linkval, "foobar")) { H5_FAILED(); - puts(" Dangling link test failed. Wrong link value"); + HDputs(" Dangling link test failed. Wrong link value"); TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -619,7 +619,7 @@ cklinks(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" H5Oget_info_by_name() should have failed for a recursive link."); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -635,7 +635,7 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { H5_FAILED(); - puts(" Recursive link test failed. Wrong link value"); + HDputs(" Recursive link test failed. Wrong link value"); TEST_ERROR } /* end if */ @@ -700,8 +700,8 @@ ck_new_links(hid_t fapl, hbool_t new_format) } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { H5_FAILED(); - puts(" Hard link test failed. Link seems not to point to the "); - puts(" expected file location."); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); TEST_ERROR } @@ -905,7 +905,7 @@ toomany(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if(gid >= 0) { H5_FAILED(); - puts(" Should have failed for sequence of too many nested links."); + HDputs(" Should have failed for sequence of too many nested links."); TEST_ERROR } /* end if */ @@ -1189,7 +1189,7 @@ test_move(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if(moved_grp >= 0) { H5_FAILED(); - puts(" Group still in original location?"); + HDputs(" Group still in original location?"); TEST_ERROR } /* end if */ @@ -1684,8 +1684,8 @@ test_deprec(hid_t fapl, hbool_t new_format) if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); - puts(" Hard link test failed. Link seems not to point to the "); - puts(" expected file location."); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); TEST_ERROR } /* end if */ @@ -1695,8 +1695,8 @@ test_deprec(hid_t fapl, hbool_t new_format) if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); - puts(" Hard link test failed. Link seems not to point to the "); - puts(" expected file location."); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); TEST_ERROR } /* end if */ @@ -1812,19 +1812,19 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); - puts(" Unexpected object type - should have been an external link"); + HDputs(" Unexpected object type - should have been an external link"); goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { H5_FAILED(); - puts(" External link file name incorrect"); + HDputs(" External link file name incorrect"); goto error; } if(HDstrcmp(path, "/")) { H5_FAILED(); - puts(" External link path incorrect"); + HDputs(" External link path incorrect"); goto error; } @@ -1836,19 +1836,19 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); - puts(" Unexpected object type - should have been an external link"); + HDputs(" Unexpected object type - should have been an external link"); goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { H5_FAILED(); - puts(" External link file name incorrect"); + HDputs(" External link file name incorrect"); goto error; } if(HDstrcmp(path, "/")) { H5_FAILED(); - puts(" External link path incorrect"); + HDputs(" External link path incorrect"); goto error; } @@ -2693,7 +2693,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); - puts(" Should have failed for sequence of too many nested links."); + HDputs(" Should have failed for sequence of too many nested links."); goto error; } @@ -2703,7 +2703,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); - puts(" Should have failed for sequence of too many nested links."); + HDputs(" Should have failed for sequence of too many nested links."); goto error; } @@ -2713,7 +2713,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if (status >= 0) { H5_FAILED(); - puts(" Retreiving name of object by index through dangling file external link should have failed."); + HDputs(" Retreiving name of object by index through dangling file external link should have failed."); } /* end if */ /* Close root group */ @@ -2810,7 +2810,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp directory."); goto error; } @@ -2905,7 +2905,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from absolute path set for main file */ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp directory."); goto error; } @@ -2991,7 +2991,7 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the main file's relative pathname */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in current working directory"); + HDputs(" Should have found the file in current working directory"); goto error; } @@ -3083,7 +3083,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the current working directory */ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in current working directory"); + HDputs(" Should have found the file in current working directory"); goto error; } @@ -3179,7 +3179,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp directory."); goto error; } @@ -3273,7 +3273,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* should be able to find the target file from main file's current working directory */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in current working directory."); + HDputs(" Should have found the file in current working directory."); goto error; } @@ -3353,7 +3353,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { H5_FAILED(); - puts(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp directory."); goto error; } /* end if */ @@ -3450,7 +3450,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format) */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp directory."); goto error; } @@ -3625,7 +3625,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { H5_FAILED(); - puts(" Should succeed in opening family target file A in current working directory"); + HDputs(" Should succeed in opening family target file A in current working directory"); goto error; } @@ -3639,7 +3639,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { H5_FAILED(); - puts(" Should succeed in opening multi target file B in current working directory"); + HDputs(" Should succeed in opening multi target file B in current working directory"); goto error; } @@ -3785,7 +3785,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) did = H5Dopen2(fid, "ext_link", dapl_id); if(did < 0) { H5_FAILED(); - puts(" Should succeed in opening the target dataset"); + HDputs(" Should succeed in opening the target dataset"); goto error; } @@ -4372,7 +4372,7 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's CWD*/ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in CWD."); + HDputs(" Should have found the file in CWD."); goto error; } @@ -4466,7 +4466,7 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp."); goto error; } @@ -4559,7 +4559,7 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp."); goto error; } @@ -4648,7 +4648,7 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's absolute drive/relative path */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in CWD."); + HDputs(" Should have found the file in CWD."); goto error; } @@ -4744,7 +4744,7 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's rel drive/abs path */ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in CWD."); + HDputs(" Should have found the file in CWD."); goto error; } @@ -4837,7 +4837,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp."); goto error; } @@ -4924,7 +4924,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's local host/main drive*/ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in local host/main drive."); + HDputs(" Should have found the file in local host/main drive."); goto error; } @@ -5016,7 +5016,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp."); goto error; } @@ -5103,7 +5103,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's local host/main drive*/ if(gid < 0) { H5_FAILED(); - puts(" Should have found the file in local host/main drive."); + HDputs(" Should have found the file in local host/main drive."); goto error; } @@ -5174,7 +5174,7 @@ external_link_recursive(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); - puts(" Should have failed for recursive external links."); + HDputs(" Should have failed for recursive external links."); goto error; } @@ -5244,7 +5244,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); - puts(" Unexpected link class - should have been an external link"); + HDputs(" Unexpected link class - should have been an external link"); goto error; } @@ -5270,7 +5270,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); - puts(" Unexpected link class - should have been an external link"); + HDputs(" Unexpected link class - should have been an external link"); goto error; } @@ -5288,7 +5288,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name(fid, "src", &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { H5_FAILED(); - puts(" Unexpected object type - should have been a group"); + HDputs(" Unexpected object type - should have been a group"); goto error; } @@ -6077,7 +6077,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) } H5E_END_TRY /* Test H5Rcreate */ - if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (-1)) < 0) TEST_ERROR + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR /* Test unlink */ if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR @@ -6528,7 +6528,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support POSIX I/O calls"); + HDputs(" Current VFD doesn't support POSIX I/O calls"); } /* end else */ return 0; @@ -6548,7 +6548,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) return -1; #else /* H5_HAVE_SYMLINK */ SKIPPED(); - puts(" Current file system or operating system doesn't support symbolic links"); + HDputs(" Current file system or operating system doesn't support symbolic links"); return 0; #endif /* H5_HAVE_SYMLINK */ @@ -7587,7 +7587,7 @@ ud_hard_links(hid_t fapl) if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { H5_FAILED(); - puts(" Unexpected link class - should have been a UD hard link"); + HDputs(" Unexpected link class - should have been a UD hard link"); goto error; } /* end if */ @@ -8001,7 +8001,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { H5_FAILED(); - puts(" Unexpected link class - should have been a UD hard link"); + HDputs(" Unexpected link class - should have been a UD hard link"); goto error; } @@ -8649,7 +8649,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); - puts(" Should have failed for sequence of too many nested links."); + HDputs(" Should have failed for sequence of too many nested links."); goto error; } @@ -10173,7 +10173,7 @@ corder_create_empty(hid_t fapl) } H5E_END_TRY; if(ret > 0) { H5_FAILED(); - puts(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); TEST_ERROR } /* end if */ @@ -12626,13 +12626,13 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, /* Check for iteration w/bad location ID */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate((-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS H5E_BEGIN_TRY { - ret = H5Giterate((-1), ".", &gskip, group_iterate_old_cb, iter_info); + ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -14729,7 +14729,7 @@ main(void) if(nerrors) { printf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - exit(1); + HDexit(1); } printf("All link tests passed.\n"); @@ -14744,7 +14744,7 @@ main(void) return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } diff --git a/test/ntypes.c b/test/ntypes.c index 25060ec..a4ae4cf 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2148,7 +2148,7 @@ test_refer_dtype(hid_t file) TEST_ERROR; /* Create reference to named datatype */ - if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, -1) < 0) + if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR; if(H5Rget_obj_type2(dataset, H5R_OBJECT, wbuf, &obj_type) < 0) TEST_ERROR; @@ -2605,7 +2605,7 @@ test_bitfield_dtype(hid_t file) if((ntype_size = H5Tget_size(native_type)) == 0) TEST_ERROR; - rbuf = malloc((size_t)nelmts*ntype_size); + rbuf = HDmalloc((size_t)nelmts*ntype_size); /* Read the data and compare them */ if(H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; @@ -2624,7 +2624,7 @@ test_bitfield_dtype(hid_t file) if(H5Tclose(dtype) < 0) TEST_ERROR; if(H5Tclose(native_type) < 0) TEST_ERROR; if(H5Dclose(dataset1) < 0) TEST_ERROR; - if(rbuf) free(rbuf); + if(rbuf) HDfree(rbuf); /* Open dataset2 again to check H5Tget_native_type */ if((dataset2 = H5Dopen2(file, DSET2_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; diff --git a/test/objcopy.c b/test/objcopy.c index 7c86911..af0a835 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -269,8 +269,8 @@ attach_ref_attr(hid_t file_id, hid_t loc_id) if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR /* create an attribute with two object references */ - if(H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, -1) < 0) TEST_ERROR - if(H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, -1) < 0) TEST_ERROR + if(H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR + if(H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF_OBJ, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Awrite(aid, H5T_STD_REF_OBJ, ref) < 0) TEST_ERROR @@ -750,8 +750,8 @@ compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_ /* Check raw data read in against data written out */ if(wbuf) { - if(!compare_data(aid, 0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner)) TEST_ERROR - if(!compare_data(aid2, 0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner)) TEST_ERROR + if(!compare_data(aid, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner)) TEST_ERROR + if(!compare_data(aid2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner)) TEST_ERROR } /* end if */ /* Don't have written data, just compare data between the two attributes */ else @@ -1303,8 +1303,8 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) /* Check raw data read in against data written out */ if(wbuf) { - if(!compare_data(did, 0, pid, tid, (size_t)nelmts, wbuf, rbuf, did)) TEST_ERROR - if(!compare_data(did2, 0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2)) TEST_ERROR + if(!compare_data(did, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, did)) TEST_ERROR + if(!compare_data(did2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2)) TEST_ERROR } /* end if */ /* Don't have written data, just compare data between the two datasets */ else @@ -8053,8 +8053,8 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create references */ - if(H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, -1) < 0) TEST_ERROR - if(H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, -1) < 0) TEST_ERROR + if(H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR + if(H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR if(H5Rcreate(®_buf[0], did1, ".", H5R_DATASET_REGION, sid) < 0) TEST_ERROR if(H5Rcreate(®_buf[1], did2, ".", H5R_DATASET_REGION, sid) < 0) diff --git a/test/tarray.c b/test/tarray.c index 2d6581b..c2af58d 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1041,7 +1041,7 @@ test_array_vlen_atomic(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].p=malloc((i+j+1)*sizeof(unsigned int)); + wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int)); wdata[i][j].len=i+j+1; for(k=0; k<(i+j+1); k++) ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k; @@ -1252,7 +1252,7 @@ test_array_vlen_array(void) /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) for(j=0; j<ARRAY1_DIM1; j++) { - wdata[i][j].p=malloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1)); + wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1)); wdata[i][j].len=i+j+1; for(k=0; k<(i+j+1); k++) for(l=0; l<ARRAY1_DIM1; l++) @@ -1633,7 +1633,7 @@ test_array_bkg(void) /* Release memory resources */ /* ------------------------ */ for (i = 0; i < dtsinfo.nsubfields; i++) - free(dtsinfo.name[i]); + HDfree(dtsinfo.name[i]); /* Release IDs */ diff --git a/test/tattr.c b/test/tattr.c index e9430fe..57b3263 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -3261,12 +3261,12 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); /* Open first attribute for the dataset */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, 4, + attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Open attribute for the second time */ - attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, 4, + attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); @@ -3317,13 +3317,13 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); /* Open attribute of the dataset for the first time */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, 2, + attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); /* Delete a few attributes until the storage switches to compact */ for(u = max_compact; u >= min_dense - 1; u--) { - ret = H5Adelete_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, u, + ret = H5Adelete_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT); CHECK(ret, FAIL, "H5Adelete_by_idx"); } @@ -3333,7 +3333,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Open attribute for the second time */ - attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, 2, + attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)2, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); @@ -3384,7 +3384,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Open attribute of the dataset for the first time */ - attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, 3, + attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); @@ -3409,7 +3409,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); /* Open attribute for the second time */ - attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, 3, + attr2 = H5Aopen_by_idx(dataset, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)3, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); @@ -4086,7 +4086,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) /* Get number of attributes with bad ID */ - ret = H5Aget_num_attrs(-1); + ret = H5Aget_num_attrs((hid_t)-1); VERIFY(ret, FAIL, "H5Aget_num_attrs"); /* Get number of attributes */ @@ -6859,7 +6859,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = max_compact * 2; - visited = HDmalloc(sizeof(hbool_t) * iter_info.max_visit); + visited = (hbool_t*)HDmalloc(sizeof(hbool_t) * iter_info.max_visit); CHECK(visited, NULL, "HDmalloc"); iter_info.visited = visited; diff --git a/test/tconfig.c b/test/tconfig.c index 7978727..f3ac242 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -65,8 +65,8 @@ void test_exit_definitions(void); * 16 Dec 2009 * On Boeing's OpenVMS, the value of EXIT_FAILURE is 268435458. * (The test is in test_exit_definitions.) Their document says - * it's supposed to be 2. I commented it out for further - * consideration. + * it's supposed to be 2. I commented it out for OpenVMS for + * further consideration. *------------------------------------------------------------------------- */ void diff --git a/test/tcoords.c b/test/tcoords.c index abe63dd..306c6b2 100644 --- a/test/tcoords.c +++ b/test/tcoords.c @@ -143,7 +143,7 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked) /* ****** Case 1: ****** * Testing the full selection in the fastest-growing end */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ elmts_numb = 12; @@ -176,7 +176,7 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked) /* ****** Case 2: ****** * Testing the full selection in the slowest-growing end */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ elmts_numb = 6; @@ -209,7 +209,7 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked) /* ****** Case 3: ****** * Testing the full selection in the middle dimensions */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ elmts_numb = 18; @@ -298,7 +298,7 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked) /* ****** Case 1: ****** * Testing the full selection in the fastest-growing end */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem1_start, mem1_stride, mem1_count, mem1_block); @@ -329,7 +329,7 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked) /* ****** Case 2: ****** * Testing the full selection in the slowest-growing end */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem2_start, mem2_stride, mem2_count, mem2_block); @@ -360,7 +360,7 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked) /* ****** Case 3: ****** * Testing the full selection in the middle dimensions */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem3_start, mem3_stride, mem3_count, mem3_block); @@ -493,7 +493,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked) /* ****** Case 1: ****** * Testing the full selections in the fastest-growing end and in the middle dimensions*/ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem1_start, mem1_stride, mem1_count, mem1_block); @@ -525,7 +525,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked) /* ****** Case 2: ****** * Testing the full selections in the slowest-growing end and in the middle dimensions*/ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem2_start, mem2_stride, mem2_count, mem2_block); @@ -557,7 +557,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked) /* ****** Case 3: ****** * Testing two unadjacent full selections in the middle dimensions */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem3_start, mem3_stride, mem3_count, mem3_block); @@ -589,7 +589,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked) /* ****** Case 4: ****** * Testing the full selections in the fastest-growing end and the slowest-growing end */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem4_start, mem4_stride, mem4_count, mem4_block); @@ -623,7 +623,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked) * Testing the full selections in the fastest-growing end and the slowest-growing end, * and also in the middle dimensions */ did = H5Dopen2(file, dset_name, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dopen"); + CHECK(did, FAIL, "H5Dopen2"); /* Select the elements in the dataset */ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem5_start, mem5_stride, mem5_count, mem5_block); diff --git a/test/tfile.c b/test/tfile.c index bf4a8c2..82e0182 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1032,7 +1032,7 @@ test_get_obj_ids(void) H5Fclose(fid); /* Get the number of all opened objects */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, NDSETS, "H5Fget_obj_count"); @@ -1040,7 +1040,7 @@ test_get_obj_ids(void) CHECK(oid_list, NULL, "HDcalloc"); /* Get the list of all opened objects */ - ret_count = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); + ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, NDSETS, "H5Fget_obj_count"); @@ -1092,7 +1092,7 @@ test_get_file_id(void) CHECK(ret, FAIL, "H5Fclose"); /* Test H5Iget_file_id() */ - check_file_id(-1, group_id); + check_file_id((hid_t)-1, group_id); ret = H5Gclose(group_id); CHECK(ret, FAIL, "H5Gclose"); @@ -1231,32 +1231,32 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, CHECK(fid4, FAIL, "H5Fcreate"); /* test object count of all files IDs open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_FILE); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_FILE); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count"); /* test object count of all datasets open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATASET); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_1, "H5Fget_obj_count"); /* test object count of all groups open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_GROUP); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_GROUP); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_3, "H5Fget_obj_count"); /* test object count of all named datatypes open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATATYPE); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATATYPE); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count"); /* test object count of all attributes open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ATTR); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ATTR); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count"); /* test object count of all objects currently open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_8, "H5Fget_obj_count"); @@ -1267,7 +1267,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, if(oid_list != NULL) { int i; - ret_count = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); + ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); for(i = 0; i < oid_count; i++) { @@ -2815,7 +2815,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /**************************************************************** ** ** test_libver_bounds(): -** Verify that a file created and modified with various +** Verify that a file created and modified with various ** libver bounds is handled correctly. (Further testing ** welcome) ** diff --git a/test/tgenprop.c b/test/tgenprop.c index 4e93dd5..004e346 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1818,7 +1818,7 @@ test_genprop_path(void) VERIFY(ret, 1, "H5Pequal"); /* Release the path string */ - free(path); + HDfree(path); /* Close class */ ret = H5Pclose_class(cid3); @@ -56,7 +56,7 @@ static int basic_id_test(void) /* Try to access IDs with ficticious types */ H5E_BEGIN_TRY - testPtr = H5Iobject_verify(100, (H5I_type_t) 0); + testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0); H5E_END_TRY VERIFY(testPtr, NULL, "H5Iobject_verify"); @@ -64,7 +64,7 @@ static int basic_id_test(void) goto out; H5E_BEGIN_TRY - testPtr = H5Iobject_verify(700, (H5I_type_t) 700); + testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700); H5E_END_TRY VERIFY(testPtr, NULL, "H5Iobject_verify"); @@ -81,13 +81,13 @@ static int basic_id_test(void) /* Register an ID and retrieve the object it points to. * Once the ID has been registered, testObj will be freed when * its ID type is destroyed. */ - testObj = malloc(7 * sizeof(int)); + testObj = HDmalloc(7 * sizeof(int)); arrayID = H5Iregister(myType, testObj); CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); if(arrayID == H5I_INVALID_HID) { - free(testObj); + HDfree(testObj); goto out; } @@ -175,13 +175,13 @@ static int basic_id_test(void) * freed when the previous type was destroyed. Allocate new * memory for it. */ - testObj = malloc(7 * sizeof(int)); + testObj = HDmalloc(7 * sizeof(int)); arrayID = H5Iregister(myType, testObj); CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); if(arrayID == H5I_INVALID_HID) { - free(testObj); + HDfree(testObj); goto out; } @@ -250,7 +250,7 @@ static int id_predefined_test(void ) void * testPtr; herr_t testErr; - testObj = malloc(sizeof(int)); + testObj = HDmalloc(sizeof(int)); /* Try to perform illegal functions on various predefined types */ H5E_BEGIN_TRY @@ -319,14 +319,14 @@ static int id_predefined_test(void ) /* testObj was never registered as an atom, so it will not be * automatically freed. */ - free(testObj); + HDfree(testObj); return 0; out: if(typeID != H5I_INVALID_HID) H5Tclose(typeID); if(testObj != NULL) - free(testObj); + HDfree(testObj); return -1; } @@ -393,7 +393,7 @@ static int test_is_valid(void) goto out; /* Check that an id of -1 is invalid */ - tri_ret = H5Iis_valid(-1); + tri_ret = H5Iis_valid((hid_t)-1); VERIFY(tri_ret, FALSE, "H4Iis_valid"); if (tri_ret != FALSE) goto out; @@ -427,13 +427,13 @@ static int test_get_type(void) goto out; /* Check that the ID is correct */ - type_ret = H5Iget_type(H5T_STRING); + type_ret = H5Iget_type((hid_t)H5T_STRING); VERIFY(type_ret, H5I_BADID, "H5Iget_type"); if (type_ret != H5I_BADID) goto out; /* Check that the ID is correct */ - type_ret = H5Iget_type(-1); + type_ret = H5Iget_type((hid_t)-1); VERIFY(type_ret, H5I_BADID, "H5Iget_type"); if (type_ret != H5I_BADID) goto out; diff --git a/test/tmisc.c b/test/tmisc.c index d599199..fcb5eac 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1686,7 +1686,7 @@ test_misc8(void) /* Free the read & write buffers */ HDfree(wdata); #ifdef VERIFY_DATA - free(rdata); + HDfree(rdata); #endif /* VERIFY_DATA */ } /* end test_misc8() */ @@ -1910,7 +1910,7 @@ test_misc11(void) file = H5Fopen(MISC11_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); - /* Get the file's dataset creation property list */ + /* Get the file's creation property list */ fcpl = H5Fget_create_plist(file); CHECK(fcpl, FAIL, "H5Fget_create_plist"); diff --git a/test/trefer.c b/test/trefer.c index 376d2f5..bd105a3 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -89,9 +89,9 @@ test_reference_params(void) MESSAGE(5, ("Testing Reference Parameters\n")); /* Allocate write & read buffers */ - wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); - rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); - tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -163,23 +163,23 @@ test_reference_params(void) CHECK(ret, FAIL, "H5Dcreate2"); /* Test parameters to H5Rcreate */ - ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate ref"); - ret = H5Rcreate(&wbuf[0], -1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], (hid_t)-1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate loc_id"); - ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate name"); - ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate null name"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, -1); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate type"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, -1); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate region space"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, 0); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)0); VERIFY(ret, FAIL, "H5Rcreate space"); /* Test parameters to H5Rdereference */ - dset2 = H5Rdereference(-1, H5R_OBJECT, &rbuf[0]); + dset2 = H5Rdereference((hid_t)-1, H5R_OBJECT, &rbuf[0]); VERIFY(dset2, FAIL, "H5Rdereference loc_id"); dset2 = H5Rdereference(dataset, H5R_OBJECT, NULL); VERIFY(dset2, FAIL, "H5Rdereference ref"); @@ -187,7 +187,7 @@ test_reference_params(void) VERIFY(dset2, FAIL, "H5Rdereference type"); /* Test parameters to H5Rget_obj_type2 */ - ret = H5Rget_obj_type2(-1, H5R_OBJECT, &rbuf[0], NULL); + ret = H5Rget_obj_type2((hid_t)-1, H5R_OBJECT, &rbuf[0], NULL); VERIFY(ret, FAIL, "H5Rget_obj_type2 loc_id"); ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL); VERIFY(ret, FAIL, "H5Rget_obj_type2 ref"); @@ -195,15 +195,15 @@ test_reference_params(void) VERIFY(ret, FAIL, "H5Rget_obj_type2 type"); /* Test parameters to H5Rget_name */ - name_size = H5Rget_name(-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0); + name_size = H5Rget_name((hid_t)-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0); VERIFY(name_size, FAIL, "H5Rget_name loc_id"); name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0); - VERIFY(ret, FAIL, "H5Rget_name ref"); + VERIFY(name_size, FAIL, "H5Rget_name ref"); name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0); - VERIFY(ret, FAIL, "H5Rget_name type"); + VERIFY(name_size, FAIL, "H5Rget_name type"); /* Test parameters to H5Rget_region */ - ret = H5Rget_region(-1, H5R_OBJECT, &rbuf[0]); + ret = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]); VERIFY(ret, FAIL, "H5Rget_region loc_id"); ret = H5Rget_region(fid1, H5R_OBJECT, NULL); VERIFY(ret, FAIL, "H5Rget_region ref"); @@ -223,9 +223,9 @@ test_reference_params(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(tbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); } /* test_reference_obj() */ /**************************************************************** @@ -237,31 +237,31 @@ test_reference_params(void) static void test_reference_obj(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset, /* Dataset ID */ - dset2; /* Dereferenced dataset ID */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ hid_t group; /* Group ID */ hid_t sid1; /* Dataspace ID */ hid_t tid1; /* Datatype ID */ hsize_t dims1[] = {SPACE1_DIM1}; - hobj_ref_t *wbuf, /* buffer to write to disk */ - *rbuf, /* buffer read from disk */ - *tbuf; /* temp. buffer read from disk */ + hobj_ref_t *wbuf, /* buffer to write to disk */ + *rbuf, /* buffer read from disk */ + *tbuf; /* temp. buffer read from disk */ hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */ - unsigned *tu32; /* Temporary pointer to uint32 data */ - int i, j; /* counting variables */ + unsigned *tu32; /* Temporary pointer to uint32 data */ + int i, j; /* counting variables */ const char *write_comment="Foo!"; /* Comments for group */ char read_comment[10]; - H5O_type_t obj_type; /* Object type */ - herr_t ret; /* Generic return value */ + H5O_type_t obj_type; /* Object type */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Object Reference Functions\n")); /* Allocate write & read buffers */ - wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); - rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); - tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -333,28 +333,28 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[0], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[1], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); /* Create reference to group */ - ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[2], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type2"); /* Create reference to named datatype */ - ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[3], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); @@ -462,9 +462,9 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(tbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); } /* test_reference_obj() */ /**************************************************************** @@ -734,10 +734,10 @@ test_reference_region(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(dwbuf); - free(drbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); } /* test_reference_region() */ /**************************************************************** @@ -1010,10 +1010,10 @@ test_reference_region_1D(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(dwbuf); - free(drbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); } /* test_reference_region_1D() */ /**************************************************************** @@ -1054,7 +1054,7 @@ test_reference_obj_deleted(void) CHECK(dataset, FAIL, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &oref, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); @@ -1209,7 +1209,7 @@ test_reference_group(void) CHECK(did, FAIL, "H5Dcreate2"); /* Create reference to group */ - ret = H5Rcreate(&wref, fid, GROUPNAME, H5R_OBJECT, -1); + ret = H5Rcreate(&wref, fid, GROUPNAME, H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Write reference to disk */ @@ -1378,19 +1378,19 @@ test_reference_compat(void) CHECK(ret, FAIL, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Create reference to group */ - ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Create reference to named datatype */ - ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Write references to disk */ @@ -1517,7 +1517,6 @@ test_reference_compat(void) ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); - /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); diff --git a/test/tselect.c b/test/tselect.c index 7dfb6d7..4f15694 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -362,8 +362,8 @@ test_select_hyper(hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper() */ struct pnt_iter { @@ -645,8 +645,8 @@ test_select_point(hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_point() */ /**************************************************************** @@ -758,8 +758,8 @@ test_select_all(hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_all() */ /**************************************************************** @@ -898,8 +898,8 @@ test_select_all_hyper(hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_all_hyper() */ /**************************************************************** @@ -1640,8 +1640,8 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, /* Advance to next element */ cube_ptr++; expected_value++; - s++; - m++; + s++; + m++; } while((cube_rank > 0) && (m < edge_size)); l++; } while((cube_rank > 1) && (l < edge_size)); @@ -1658,10 +1658,10 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, /**************************************************************** ** -** test_select_hyper_contig_dr__run_test(): Test H5S (dataspace) -** selection code with contiguous source and target having +** test_select_hyper_contig_dr__run_test(): Test H5S (dataspace) +** selection code with contiguous source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5S_shape_same in isolation, so now we try to do ** I/O. ** ****************************************************************/ @@ -1765,13 +1765,13 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, CHECK(file_large_cube_sid, FAIL, "H5Screate_simple"); /* if chunk edge size is greater than zero, set up the small and - * large data set creation property lists to specify chunked + * large data set creation property lists to specify chunked * datasets. */ if(chunk_edge_size > 0) { hsize_t chunk_dims[SS_DR_MAX_RANK]; /* Chunk dimensions */ - chunk_dims[0] = chunk_dims[1] = + chunk_dims[0] = chunk_dims[1] = chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size; small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); @@ -1795,7 +1795,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } /* end if */ /* create the small cube dataset */ - small_cube_dataset = H5Dcreate2(fid1, "small_cube_dataset", dset_type, + small_cube_dataset = H5Dcreate2(fid1, "small_cube_dataset", dset_type, small_cube_sid, H5P_DEFAULT, small_cube_dcpl_id, H5P_DEFAULT); CHECK(small_cube_dataset, FAIL, "H5Dcreate2"); @@ -1806,7 +1806,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } /* end if */ /* create the large cube dataset */ - large_cube_dataset = H5Dcreate2(fid1, "large_cube_dataset", dset_type, + large_cube_dataset = H5Dcreate2(fid1, "large_cube_dataset", dset_type, file_large_cube_sid, H5P_DEFAULT, large_cube_dcpl_id, H5P_DEFAULT); CHECK(large_cube_dataset, FAIL, "H5Dcreate2"); @@ -1818,16 +1818,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* write initial data to the on disk datasets */ - ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, + ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, small_cube_sid, xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); - ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, + ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, file_large_cube_sid, xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); /* read initial data from disk and verify that it is as expected. */ - ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, + ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, small_cube_sid, xfer_plist, small_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); @@ -1835,7 +1835,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, verify_select_hyper_contig_dr__run_test(small_cube_buf_1, small_cube_size, edge_size, small_rank); - ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, + ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, file_large_cube_sid, xfer_plist, large_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); @@ -1848,12 +1848,12 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, * of different rank that H5S_select_shape_same() views as being of the * same shape. * - * Start by reading small_rank-D slice from the on disk large cube, and - * verifying that the data read is correct. Verify that H5S_select_shape_same() + * Start by reading small_rank-D slice from the on disk large cube, and + * verifying that the data read is correct. Verify that H5S_select_shape_same() * returns true on the memory and file selections. */ - + /* set up start, stride, count, and block -- note that we will * change start[] so as to read slices of the large cube. */ @@ -1885,18 +1885,18 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, start[3] = (hsize_t)x; start[4] = (hsize_t)0; - ret = H5Sselect_hyperslab(file_large_cube_sid, + ret = H5Sselect_hyperslab(file_large_cube_sid, H5S_SELECT_SET, - start_ptr, - stride_ptr, - count_ptr, + start_ptr, + stride_ptr, + count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S_select_shape_same_test(small_cube_sid, file_large_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); @@ -1933,7 +1933,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } while((large_rank >= 4) && (small_rank <= 3) && (v < edge_size)); u++; } while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size)); - + /* similarly, read the on disk small cube into slices through the in memory * large cube, and verify that the correct data (and only the correct data) @@ -1961,19 +1961,19 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, start[3] = (hsize_t)x; start[4] = (hsize_t)0; - ret = H5Sselect_hyperslab(mem_large_cube_sid, + ret = H5Sselect_hyperslab(mem_large_cube_sid, H5S_SELECT_SET, - start_ptr, - stride_ptr, - count_ptr, + start_ptr, + stride_ptr, + count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S_select_shape_same_test(small_cube_sid, mem_large_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); @@ -1988,7 +1988,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, CHECK(ret, FAIL, "H5Dread"); - /* verify that the expected data and only the + /* verify that the expected data and only the * expected data was read. */ start_index = (u * edge_size * edge_size * edge_size * edge_size) + @@ -2024,7 +2024,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* Zero out the buffer for the next pass */ HDmemset(large_cube_buf_1 + start_index, 0, small_cube_size * sizeof(uint16_t)); - + x++; } while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size)); w++; @@ -2035,16 +2035,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size)); - /* now we go in the opposite direction, verifying that we can write - * from memory to file using selections of different rank that + /* now we go in the opposite direction, verifying that we can write + * from memory to file using selections of different rank that * H5S_select_shape_same() views as being of the same shape. * - * Start by writing small_rank D slices from the in memory large cube, to + * Start by writing small_rank D slices from the in memory large cube, to * the the on disk small cube dataset. After each write, read the small * cube dataset back from disk, and verify that it contains the expected - * data. Verify that H5S_select_shape_same() returns true on the + * data. Verify that H5S_select_shape_same() returns true on the * memory and file selections. - */ + */ u = 0; do { @@ -2060,15 +2060,15 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, */ /* zero out the on disk small cube */ - ret = H5Dwrite(small_cube_dataset, - H5T_NATIVE_UINT16, - small_cube_sid, - small_cube_sid, - xfer_plist, + ret = H5Dwrite(small_cube_dataset, + H5T_NATIVE_UINT16, + small_cube_sid, + small_cube_sid, + xfer_plist, zero_buf); CHECK(ret, FAIL, "H5Dwrite"); - /* select the portion of the in memory large cube from which we + /* select the portion of the in memory large cube from which we * are going to write data. */ start[0] = (hsize_t)u; @@ -2077,40 +2077,40 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, start[3] = (hsize_t)x; start[4] = (hsize_t)0; - ret = H5Sselect_hyperslab(mem_large_cube_sid, + ret = H5Sselect_hyperslab(mem_large_cube_sid, H5S_SELECT_SET, - start_ptr, - stride_ptr, - count_ptr, + start_ptr, + stride_ptr, + count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the in - * memory slice through the cube selection and the + /* verify that H5S_select_shape_same() reports the in + * memory slice through the cube selection and the * on disk full small cube selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S_select_shape_same_test(small_cube_sid, mem_large_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* write the slice from the in memory large cube to the on disk small cube */ - ret = H5Dwrite(small_cube_dataset, - H5T_NATIVE_UINT16, - mem_large_cube_sid, - small_cube_sid, - xfer_plist, + ret = H5Dwrite(small_cube_dataset, + H5T_NATIVE_UINT16, + mem_large_cube_sid, + small_cube_sid, + xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); /* read the on disk small cube into memory */ - ret = H5Dread(small_cube_dataset, + ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, - small_cube_sid, - xfer_plist, + small_cube_sid, + xfer_plist, small_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); @@ -2130,7 +2130,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } /* end for */ if(mis_match ) TestErrPrintf("small cube data don't match! Line=%d\n",__LINE__); - + x++; } while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size)); w++; @@ -2141,10 +2141,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size)); - /* Now write the contents of the in memory small cube to slices of + /* Now write the contents of the in memory small cube to slices of * the on disk cube. After each write, read the on disk cube - * into memeory, and verify that it contains the expected - * data. Verify that H5S_select_shape_same() returns true on + * into memeory, and verify that it contains the expected + * data. Verify that H5S_select_shape_same() returns true on * the memory and file selections. */ @@ -2169,16 +2169,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, */ /* zero out the on disk cube */ - ret = H5Dwrite(large_cube_dataset, - H5T_NATIVE_USHORT, - mem_large_cube_sid, - file_large_cube_sid, - xfer_plist, + ret = H5Dwrite(large_cube_dataset, + H5T_NATIVE_USHORT, + mem_large_cube_sid, + file_large_cube_sid, + xfer_plist, zero_buf); CHECK(ret, FAIL, "H5Dwrite"); - /* select the portion of the in memory large cube to which we + /* select the portion of the in memory large cube to which we * are going to write data. */ start[0] = (hsize_t)u; @@ -2187,31 +2187,31 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, start[3] = (hsize_t)x; start[4] = (hsize_t)0; - ret = H5Sselect_hyperslab(file_large_cube_sid, + ret = H5Sselect_hyperslab(file_large_cube_sid, H5S_SELECT_SET, - start_ptr, - stride_ptr, - count_ptr, + start_ptr, + stride_ptr, + count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the in - * memory full selection of the small cube and the - * on disk slice through the large cube selection + /* verify that H5S_select_shape_same() reports the in + * memory full selection of the small cube and the + * on disk slice through the large cube selection * as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S_select_shape_same_test(small_cube_sid, file_large_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* write the cube from memory to the target slice of the disk cube */ - ret = H5Dwrite(large_cube_dataset, - H5T_NATIVE_UINT16, - small_cube_sid, - file_large_cube_sid, - xfer_plist, + ret = H5Dwrite(large_cube_dataset, + H5T_NATIVE_UINT16, + small_cube_sid, + file_large_cube_sid, + xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); @@ -2220,16 +2220,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, ret = H5Sselect_all(file_large_cube_sid); CHECK(ret, FAIL, "H5Sselect_all"); - ret = H5Dread(large_cube_dataset, + ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, - file_large_cube_sid, - xfer_plist, + file_large_cube_sid, + xfer_plist, large_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); - /* verify that the expected data and only the + /* verify that the expected data and only the * expected data was read. */ start_index = (u * edge_size * edge_size * edge_size * edge_size) + @@ -2262,7 +2262,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } /* end for */ if(mis_match) TestErrPrintf("large cube written from small cube has bad data! Line=%d\n", __LINE__); - + x++; } while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size)); w++; @@ -2305,10 +2305,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /**************************************************************** ** -** test_select_hyper_contig_dr(): Test H5S (dataspace) -** selection code with contiguous source and target having +** test_select_hyper_contig_dr(): Test H5S (dataspace) +** selection code with contiguous source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5S_shape_same in isolation, so now we try to do ** I/O. ** ****************************************************************/ @@ -2373,12 +2373,12 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) /**************************************************************** ** -** test_select_hyper_checker_board_dr__select_checker_board(): -** Given an n-cube data space with each edge of length +** test_select_hyper_checker_board_dr__select_checker_board(): +** Given an n-cube data space with each edge of length ** edge_size, and a checker_edge_size either select a checker ** board selection of the entire cube(if sel_rank == n), ** or select a checker board selection of a -** sel_rank dimensional slice through n-cube parallel to the +** sel_rank dimensional slice through n-cube parallel to the ** sel_rank fastest changing indices, with origin (in the ** higher indices) as indicated by the start array. ** @@ -2434,7 +2434,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, offset_count++; /* Now set up the stride and block arrays, and portions of the start - * and count arrays that will not be altered during the selection of + * and count arrays that will not be altered during the selection of * the checker board. */ u = 0; @@ -2463,7 +2463,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, u++; } /* end while */ - + i = 0; do { if(0 >= sel_offset) { @@ -2478,7 +2478,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, } /* end if */ j = 0; - do { + do { if(1 >= sel_offset) { if(j == 0 ) { start[1] = 0; @@ -2531,22 +2531,22 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, if(((i + j + k + l + m) % 2) == 0) { if(first_selection) { - first_selection = FALSE; + first_selection = FALSE; - ret = H5Sselect_hyperslab(tgt_n_cube_sid, + ret = H5Sselect_hyperslab(tgt_n_cube_sid, H5S_SELECT_SET, - &(start[n_cube_offset]), - &(stride[n_cube_offset]), - &(count[n_cube_offset]), + &(start[n_cube_offset]), + &(stride[n_cube_offset]), + &(count[n_cube_offset]), &(block[n_cube_offset])); CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end if */ else { - ret = H5Sselect_hyperslab(tgt_n_cube_sid, + ret = H5Sselect_hyperslab(tgt_n_cube_sid, H5S_SELECT_OR, - &(start[n_cube_offset]), - &(stride[n_cube_offset]), - &(count[n_cube_offset]), + &(start[n_cube_offset]), + &(stride[n_cube_offset]), + &(count[n_cube_offset]), &(block[n_cube_offset])); CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end else */ @@ -2584,21 +2584,21 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, /**************************************************************** ** -** test_select_hyper_checker_board_dr__verify_data(): +** test_select_hyper_checker_board_dr__verify_data(): ** -** Examine the supplied buffer to see if it contains the -** expected data. Return TRUE if it does, and FALSE +** Examine the supplied buffer to see if it contains the +** expected data. Return TRUE if it does, and FALSE ** otherwise. ** ** The supplied buffer is presumed to contain the results -** of read or writing a checkerboard selection of an +** of read or writing a checkerboard selection of an ** n-cube, or a checkerboard selection of an m (1 <= m < n) -** dimensional slice through an n-cube parallel to the -** fastest changing indices. +** dimensional slice through an n-cube parallel to the +** fastest changing indices. ** ** It is further presumed that the buffer was zeroed before -** the read, and that the n-cube was initialize with the -** natural numbers listed in order from the origin along +** the read, and that the n-cube was initialize with the +** natural numbers listed in order from the origin along ** the fastest changing axis. ** ** Thus for a 10x10x10 3-cube, the value stored in location @@ -2607,19 +2607,19 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, ** ** (10 * 10 * x) + (10 * y) + z ** -** Thus, if the buffer contains the result of reading a +** Thus, if the buffer contains the result of reading a ** checker board selection of a 10x10x10 3-cube, location ** (x, y, z) will contain zero if it is not in a checker, ** and 100x + 10y + z if (x, y, z) is in a checker. ** -** If the buffer contains the result of reading a 3 +** If the buffer contains the result of reading a 3 ** dimensional slice (parallel to the three fastest changing -** indices) through an n cube (n > 3), then the expected +** indices) through an n cube (n > 3), then the expected ** values in the buffer will be the same, save that we will -** add a constant determined by the origin of the 3-cube +** add a constant determined by the origin of the 3-cube ** in the n-cube. ** -** Finally, the function presumes that the first element +** Finally, the function presumes that the first element ** of the buffer resides either at the origin of either ** a selected or an unselected checker. ** @@ -2679,7 +2679,7 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr, l = 0; y = 0; start_in_checker[3] = start_in_checker[2]; - do { + do { if(y >= checker_edge_size) { start_in_checker[3] = ! start_in_checker[3]; y = 0; @@ -2693,7 +2693,7 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr, in_checker = ! in_checker; z = 0; } /* end if */ - + if(in_checker) { if(*val_ptr != expected_value) good_data = FALSE; @@ -2702,10 +2702,10 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr, if(*val_ptr != 0) good_data = FALSE; } /* end else */ - + val_ptr++; expected_value++; - + m++; z++; } while((rank >= (test_max_rank - 4)) && (m < edge_size)); @@ -2728,10 +2728,10 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr, /**************************************************************** ** -** test_select_hyper_checker_board_dr__run_test(): Test H5S -** (dataspace) selection code with checker board source and -** target selections having different ranks but the same -** shape. We have already tested H5S_shape_same in +** test_select_hyper_checker_board_dr__run_test(): Test H5S +** (dataspace) selection code with checker board source and +** target selections having different ranks but the same +** shape. We have already tested H5S_shape_same in ** isolation, so now we try to do I/O. ** ****************************************************************/ @@ -2856,11 +2856,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* if chunk edge size is greater than zero, set up the small and - * large data set creation property lists to specify chunked + * large data set creation property lists to specify chunked * datasets. */ if(chunk_edge_size > 0) { - chunk_dims[0] = chunk_dims[1] = + chunk_dims[0] = chunk_dims[1] = chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = chunk_edge_size; small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); @@ -2885,7 +2885,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* create the small cube dataset */ - small_cube_dataset = H5Dcreate2(fid, "small_cube_dataset", dset_type, + small_cube_dataset = H5Dcreate2(fid, "small_cube_dataset", dset_type, file_small_cube_sid, H5P_DEFAULT, small_cube_dcpl_id, H5P_DEFAULT); CHECK(small_cube_dataset, FAIL, "H5Dcreate2"); @@ -2896,7 +2896,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ } /* end if */ /* create the large cube dataset */ - large_cube_dataset = H5Dcreate2(fid, "large_cube_dataset", dset_type, + large_cube_dataset = H5Dcreate2(fid, "large_cube_dataset", dset_type, file_large_cube_sid, H5P_DEFAULT, large_cube_dcpl_id, H5P_DEFAULT); CHECK(large_cube_dataset, FAIL, "H5Dcreate2"); @@ -2908,17 +2908,17 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* write initial data to the on disk datasets */ - ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid, + ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid, full_small_cube_sid, xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); - ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid, + ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid, full_large_cube_sid, xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); /* read initial small cube data from disk and verify that it is as expected. */ - ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid, + ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid, full_small_cube_sid, xfer_plist, small_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); @@ -2927,7 +2927,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ edge_size, small_rank); /* read initial large cube data from disk and verify that it is as expected. */ - ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid, + ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid, full_large_cube_sid, xfer_plist, large_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); @@ -2940,11 +2940,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ * of different rank that H5S_select_shape_same() views as being of the * same shape. * - * Start by reading small_rank-D slice from the on disk large cube, and - * verifying that the data read is correct. Verify that H5S_select_shape_same() + * Start by reading small_rank-D slice from the on disk large cube, and + * verifying that the data read is correct. Verify that H5S_select_shape_same() * returns true on the memory and file selections. * - * The first step is to set up the needed checker board selection in the + * The first step is to set up the needed checker board selection in the * in memory small small cube */ @@ -2957,8 +2957,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ small_rank, sel_start); - /* now read slices from the large, on-disk cube into the small cube. - * Note how we adjust sel_start only in the dimensions peculiar to the + /* now read slices from the large, on-disk cube into the small cube. + * Note how we adjust sel_start only in the dimensions peculiar to the * large cube. */ @@ -3003,10 +3003,10 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(mem_small_cube_sid, + check = H5S_select_shape_same_test(mem_small_cube_sid, file_large_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); @@ -3041,18 +3041,18 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ TestErrPrintf("small cube read from largecube has bad data! Line=%d\n",__LINE__); x++; - } while((large_rank >= (test_max_rank - 3)) && + } while((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) && (x < edge_size)); w++; - } while((large_rank >= (test_max_rank - 2)) && + } while((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) && (w < edge_size)); v++; - } while((large_rank >= (test_max_rank - 1)) && + } while((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) && (v < edge_size)); u++; - } while((large_rank >= test_max_rank) && + } while((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size)); - + /* similarly, read the on disk small cube into slices through the in memory * large cube, and verify that the correct data (and only the correct data) @@ -3110,10 +3110,10 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_small_cube_sid, + check = H5S_select_shape_same_test(file_small_cube_sid, mem_large_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); @@ -3131,7 +3131,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ CHECK(ret, FAIL, "H5Dread"); - /* verify that the expected data and only the + /* verify that the expected data and only the * expected data was read. */ data_ok = TRUE; @@ -3179,29 +3179,29 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ TestErrPrintf("large cube read from small cube has bad data! Line=%d\n",__LINE__); x++; - } while((large_rank >= (test_max_rank - 3)) && + } while((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) && (x < edge_size)); w++; - } while((large_rank >= (test_max_rank - 2)) && + } while((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) && (w < edge_size)); v++; - } while((large_rank >= (test_max_rank - 1)) && + } while((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) && (v < edge_size)); u++; - } while((large_rank >= test_max_rank) && + } while((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size)); - /* now we go in the opposite direction, verifying that we can write - * from memory to file using selections of different rank that + /* now we go in the opposite direction, verifying that we can write + * from memory to file using selections of different rank that * H5S_select_shape_same() views as being of the same shape. * - * Start by writing small_rank D slices from the in memory large cube, to + * Start by writing small_rank D slices from the in memory large cube, to * the the on disk small cube dataset. After each write, read the small * cube dataset back from disk, and verify that it contains the expected - * data. Verify that H5S_select_shape_same() returns true on the + * data. Verify that H5S_select_shape_same() returns true on the * memory and file selections. - */ + */ /* select a checker board in the file small cube dataspace */ sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; @@ -3233,11 +3233,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start[3] = x; /* zero out the on disk small cube */ - ret = H5Dwrite(small_cube_dataset, - H5T_NATIVE_UINT16, - full_small_cube_sid, - full_small_cube_sid, - xfer_plist, + ret = H5Dwrite(small_cube_dataset, + H5T_NATIVE_UINT16, + full_small_cube_sid, + full_small_cube_sid, + xfer_plist, zero_buf); CHECK(ret, FAIL, "H5Dwrite"); @@ -3263,22 +3263,22 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_small_cube_sid, + check = H5S_select_shape_same_test(file_small_cube_sid, mem_large_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); - /* write the slice from the in memory large cube to the - * on disk small cube + /* write the slice from the in memory large cube to the + * on disk small cube */ - ret = H5Dwrite(small_cube_dataset, - H5T_NATIVE_UINT16, - mem_large_cube_sid, - file_small_cube_sid, - xfer_plist, + ret = H5Dwrite(small_cube_dataset, + H5T_NATIVE_UINT16, + mem_large_cube_sid, + file_small_cube_sid, + xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); @@ -3287,11 +3287,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size); /* read the on disk small cube into memory */ - ret = H5Dread(small_cube_dataset, + ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid, - full_small_cube_sid, - xfer_plist, + full_small_cube_sid, + xfer_plist, small_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); @@ -3314,24 +3314,24 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ TestErrPrintf("small cube read from largecube has bad data! Line=%d\n",__LINE__); x++; - } while((large_rank >= (test_max_rank - 3)) && + } while((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) && (x < edge_size)); w++; - } while((large_rank >= (test_max_rank - 2)) && + } while((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) && (w < edge_size)); v++; - } while((large_rank >= (test_max_rank - 1)) && + } while((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) && (v < edge_size)); u++; - } while((large_rank >= test_max_rank) && + } while((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size)); - /* Now write checker board selections of the entries in memory - * small cube to slices of the on disk cube. After each write, - * read the on disk large cube * into memeory, and verify that - * it contains the expected * data. Verify that - * H5S_select_shape_same() returns true on the memory and file + /* Now write checker board selections of the entries in memory + * small cube to slices of the on disk cube. After each write, + * read the on disk large cube * into memeory, and verify that + * it contains the expected * data. Verify that + * H5S_select_shape_same() returns true on the memory and file * selections. */ @@ -3365,11 +3365,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start[3] = x; /* zero out the on disk cube */ - ret = H5Dwrite(large_cube_dataset, - H5T_NATIVE_USHORT, - full_large_cube_sid, - full_large_cube_sid, - xfer_plist, + ret = H5Dwrite(large_cube_dataset, + H5T_NATIVE_USHORT, + full_large_cube_sid, + full_large_cube_sid, + xfer_plist, zero_buf); CHECK(ret, FAIL, "H5Dwrite"); @@ -3395,10 +3395,10 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_large_cube_sid, + check = H5S_select_shape_same_test(file_large_cube_sid, mem_small_cube_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); @@ -3407,11 +3407,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ * small cube to a slice through the on disk large * cube. */ - ret = H5Dwrite(large_cube_dataset, - H5T_NATIVE_UINT16, - mem_small_cube_sid, - file_large_cube_sid, - xfer_plist, + ret = H5Dwrite(large_cube_dataset, + H5T_NATIVE_UINT16, + mem_small_cube_sid, + file_large_cube_sid, + xfer_plist, cube_buf); CHECK(ret, FAIL, "H5Dwrite"); @@ -3420,16 +3420,16 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ HDmemset(large_cube_buf_1, 0, sizeof(*large_cube_buf_1) * large_cube_size); /* read the on disk large cube into memory */ - ret = H5Dread(large_cube_dataset, + ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid, - full_large_cube_sid, - xfer_plist, + full_large_cube_sid, + xfer_plist, large_cube_buf_1); CHECK(ret, FAIL, "H5Dread"); - /* verify that the expected data and only the + /* verify that the expected data and only the * expected data was written to the on disk large * cube. */ @@ -3479,18 +3479,18 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ TestErrPrintf("large cube written from small cube has bad data! Line=%d\n",__LINE__); x++; - } while((large_rank >= (test_max_rank - 3)) && + } while((large_rank >= (test_max_rank - 3)) && (small_rank <= (test_max_rank - 4)) && (x < edge_size)); w++; - } while((large_rank >= (test_max_rank - 2)) && + } while((large_rank >= (test_max_rank - 2)) && (small_rank <= (test_max_rank - 3)) && (w < edge_size)); v++; - } while((large_rank >= (test_max_rank - 1)) && + } while((large_rank >= (test_max_rank - 1)) && (small_rank <= (test_max_rank - 2)) && (v < edge_size)); u++; - } while((large_rank >= test_max_rank) && + } while((large_rank >= test_max_rank) && (small_rank <= (test_max_rank - 1)) && (u < edge_size)); - + /* Close memory dataspaces */ ret = H5Sclose(full_small_cube_sid); @@ -5409,8 +5409,8 @@ test_select_hyper_and_2d(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_and_2d() */ /**************************************************************** @@ -5540,8 +5540,8 @@ test_select_hyper_xor_2d(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_xor_2d() */ /**************************************************************** @@ -5670,8 +5670,8 @@ test_select_hyper_notb_2d(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_notb_2d() */ /**************************************************************** @@ -6443,8 +6443,8 @@ test_select_point_chunk(void) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - free(data); - free (data_out); + HDfree(data); + HDfree (data_out); } /* test_select_point_chunk() */ /**************************************************************** @@ -6671,7 +6671,7 @@ test_select_combine(void) none_id=H5Scopy(base_id); CHECK(none_id, FAIL, "H5Scopy"); error=H5Sselect_none(none_id); - CHECK(error, FAIL, "H5Sselect_all"); + CHECK(error, FAIL, "H5Sselect_none"); sel_type=H5Sget_select_type(none_id); VERIFY(sel_type, H5S_SEL_NONE, "H5Sget_select_type"); @@ -7623,8 +7623,8 @@ test_select_none(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_none() */ /**************************************************************** @@ -12344,7 +12344,7 @@ test_space_rebuild(void) ret = H5Sselect_hyperslab(sid_reg_ori5,H5S_SELECT_SET,start5,stride5,count5,block5); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* Build up four dimensional regular selection with H5_SELECT_OR, inside HDF5, + /* Build up five dimensional regular selection with H5_SELECT_OR, inside HDF5, it will be treated as an irregular selection. */ start5[4] = 1; count5[4] = 1; @@ -12494,6 +12494,7 @@ test_space_rebuild(void) CHECK(ret,FAIL,"H5S_hyper_rebuild"); }/* No need to do shape comparision */ + /* Add more selections to make it regular again */ start5[3] = 5; count5[3] = 1; stride5[3] = 4; diff --git a/test/ttsafe.c b/test/ttsafe.c index 253470b..d0ab81a 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -52,69 +52,71 @@ int main(void) #define NAME_OFFSET 6 /* offset for "name<num>" */ /* pre-condition: num must be a non-negative number */ -static int num_digits(int num) +static unsigned +num_digits(int num) { - int i; + unsigned u; - if (num == 0) - return 1; + if(num == 0) + return 1; - for (i = 0; num > 0; i++) - num = num / 10; + for(u = 0; num > 0; u++) + num = num / 10; - return i; + return u; } /* Routine to generate attribute names for numeric values */ char *gen_name(int value) { - char *temp; - int i, length; + char *temp; + unsigned length; + int i; - length = num_digits(MAX_NUM_NAME - 1); - temp = (char *)HDmalloc((NAME_OFFSET + length + 1) * sizeof(char)); - temp = HDstrcpy(temp, "attrib"); - temp[NAME_OFFSET + length] = '\0'; + length = num_digits(MAX_NUM_NAME - 1); + temp = (char *)HDmalloc(NAME_OFFSET + length + 1); + temp = HDstrcpy(temp, "attrib"); + temp[NAME_OFFSET + length] = '\0'; - for (i = length - 1; i >= 0; i--) { - temp[NAME_OFFSET + i] = (char)((int)'0' + value % 10); - value = value / 10; - } + for (i = (int)(length - 1); i >= 0; i--) { + temp[NAME_OFFSET + i] = (char)((int)'0' + value % 10); + value = value / 10; + } - return temp; + return temp; } int main(int argc, char *argv[]) { - /* Initialize testing framework */ - TestInit(argv[0], NULL, NULL); + /* Initialize testing framework */ + TestInit(argv[0], NULL, NULL); - /* Tests are generally arranged from least to most complexity... */ - AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation", NULL); - AddTest("error", tts_error, cleanup_error, "per-thread error stacks", NULL); + /* Tests are generally arranged from least to most complexity... */ + AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation", NULL); + AddTest("error", tts_error, cleanup_error, "per-thread error stacks", NULL); #ifdef H5_HAVE_PTHREAD_H - /* Thread cancellability only supported with pthreads ... */ - AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL); + /* Thread cancellability only supported with pthreads ... */ + AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL); #endif /* H5_HAVE_PTHREAD_H */ - AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL); + AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL); - /* Display testing information */ - TestInfo(argv[0]); + /* Display testing information */ + TestInfo(argv[0]); - /* Parse command line arguments */ - TestParseCmdLine(argc,argv); + /* Parse command line arguments */ + TestParseCmdLine(argc,argv); - /* Perform requested testing */ - PerformTests(); + /* Perform requested testing */ + PerformTests(); - /* Display test summary, if requested */ - if (GetTestSummary()) - TestSummary(); + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(); - /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) - TestCleanup(); + /* Clean up test files, if allowed */ + if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) + TestCleanup(); - return GetTestNumErrs(); + return GetTestNumErrs(); } /* end main() */ #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index 0efd02c..dec2eee 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -113,7 +113,7 @@ void tts_acreate(void) * with the dataset */ for(i = 0; i < NUM_THREADS; i++) { - attrib_data = malloc(sizeof(ttsafe_name_data_t)); + attrib_data = HDmalloc(sizeof(ttsafe_name_data_t)); attrib_data->dataset = dataset; attrib_data->datatype = datatype; attrib_data->dataspace = dataspace; @@ -170,7 +170,7 @@ void *tts_acreate_thread(void *client_data) H5P_DEFAULT, H5P_DEFAULT); /* Write data to the attribute */ - attribute_data = malloc(sizeof(int)); + attribute_data = HDmalloc(sizeof(int)); *attribute_data = attrib_data->current_index; H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); H5Aclose(attribute); diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 8264403..56f431e 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -145,7 +145,7 @@ void *tts_cancel_thread(void UNUSED *arg) assert(dataset >= 0); /* If thread is cancelled, make cleanup call */ - cleanup_structure = (cancel_cleanup_t*)malloc(sizeof(cancel_cleanup_t)); + cleanup_structure = (cancel_cleanup_t*)HDmalloc(sizeof(cancel_cleanup_t)); cleanup_structure->dataset = dataset; cleanup_structure->datatype = datatype; cleanup_structure->dataspace = dataspace; @@ -156,7 +156,7 @@ void *tts_cancel_thread(void UNUSED *arg) ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); assert(ret>=0); - buffer = malloc(sizeof(int)); + buffer = HDmalloc(sizeof(int)); ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); assert(ret>=0); ret=H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset); diff --git a/test/tunicode.c b/test/tunicode.c index 6f3e3a9..856c2cb 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -454,7 +454,7 @@ void test_objnames(hid_t fid, const char* string) CHECK(ret, FAIL, "H5Dcreate2"); /* Create reference to named datatype */ - ret = H5Rcreate(&obj_ref, grp2_id, string, H5R_OBJECT, -1); + ret = H5Rcreate(&obj_ref, grp2_id, string, H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Write selection and read it back*/ ret = H5Dwrite(dset_id, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &obj_ref); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 234df01..85315ce 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -2847,7 +2847,7 @@ expunge_entry(H5F_t * file_ptr, if ( nerrors == 0 ) { - result = H5AC_expunge_entry(file_ptr, -1, &(types[0]), + result = H5AC_expunge_entry(file_ptr, (hid_t)-1, &(types[0]), entry_ptr->header.addr, H5AC__NO_FLAGS_SET); if ( result < 0 ) { diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 133b91d..11d7b10 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -644,7 +644,7 @@ coll_chunktest(const char* filename, dims[1] = SPACE_DIM2; /* allocate memory for data buffer */ - data_array1 = (int *)malloc(dims[0] * dims[1] * sizeof(int)); + data_array1 = (int *)HDmalloc(dims[0] * dims[1] * sizeof(int)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* set up dimensions of the slab this process accesses */ @@ -910,11 +910,11 @@ coll_chunktest(const char* filename, /* Use collective read to verify the correctness of collective write. */ /* allocate memory for data buffer */ - data_array1 = (int *)malloc(dims[0]*dims[1]*sizeof(int)); + data_array1 = (int *)HDmalloc(dims[0]*dims[1]*sizeof(int)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* allocate memory for data buffer */ - data_origin1 = (int *)malloc(dims[0]*dims[1]*sizeof(int)); + data_origin1 = (int *)HDmalloc(dims[0]*dims[1]*sizeof(int)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); acc_plist = create_faccess_plist(comm, info, facc_type); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 96d3836..2bc3b09 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -302,8 +302,8 @@ dataset_writeInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ---------------------------------------- * CREATE AN HDF5 FILE WITH PARALLEL ACCESS @@ -412,7 +412,7 @@ MPI_Barrier(MPI_COMM_WORLD); H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(data_array1) HDfree(data_array1); } /* Example of using the parallel HDF5 library to read a dataset */ @@ -447,10 +447,10 @@ dataset_readInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* setup file access template */ acc_tpl = create_faccess_plist(comm, info, facc_type); @@ -520,8 +520,8 @@ dataset_readInd(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_origin1) free(data_origin1); + if(data_array1) HDfree(data_array1); + if(data_origin1) HDfree(data_origin1); } @@ -583,8 +583,8 @@ dataset_writeAll(void) VRFY((coords != NULL), "coords malloc succeeded"); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- * START AN HDF5 FILE @@ -1115,10 +1115,10 @@ dataset_readAll(void) VRFY((coords != NULL), "coords malloc succeeded"); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- * OPEN AN HDF5 FILE @@ -1527,8 +1527,8 @@ extend_writeInd(void) chunk_dims[1] = chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- * START AN HDF5 FILE @@ -1707,7 +1707,7 @@ extend_writeInd(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(data_array1) HDfree(data_array1); } /* @@ -1911,12 +1911,12 @@ extend_readInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- * OPEN AN HDF5 FILE @@ -2039,9 +2039,9 @@ extend_readInd(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_array2) free(data_array2); - if(data_origin1) free(data_origin1); + if(data_array1) HDfree(data_array1); + if(data_array2) HDfree(data_array2); + if(data_origin1) HDfree(data_origin1); } /* @@ -2098,8 +2098,8 @@ extend_writeAll(void) chunk_dims[1] = chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- * START AN HDF5 FILE @@ -2303,7 +2303,7 @@ extend_writeAll(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(data_array1) HDfree(data_array1); } /* Example of using the parallel HDF5 library to read an extendible dataset */ @@ -2341,12 +2341,12 @@ extend_readAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); + data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- * OPEN AN HDF5 FILE @@ -2493,9 +2493,9 @@ extend_readAll(void) H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_array2) free(data_array2); - if(data_origin1) free(data_origin1); + if(data_array1) HDfree(data_array1); + if(data_array2) HDfree(data_array2); + if(data_origin1) HDfree(data_origin1); } /* @@ -2534,9 +2534,9 @@ compress_readAll(void) /* Allocate data buffer */ data_orig = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE)); - VRFY((data_orig != NULL), "data_origin1 malloc succeeded"); + VRFY((data_orig != NULL), "data_origin1 HDmalloc succeeded"); data_read = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE)); - VRFY((data_read != NULL), "data_array1 malloc succeeded"); + VRFY((data_read != NULL), "data_array1 HDmalloc succeeded"); /* Initialize data buffers */ for(u=0; u<dim;u++) @@ -2766,11 +2766,11 @@ none_selection_chunk(void) /* allocate memory for data buffer. Only allocate enough buffer for * each processor's data. */ if(mpi_rank) { - data_origin = (DATATYPE *)malloc(block[0]*block[1]*sizeof(DATATYPE)); - VRFY((data_origin != NULL), "data_origin malloc succeeded"); + data_origin = (DATATYPE *)HDmalloc(block[0]*block[1]*sizeof(DATATYPE)); + VRFY((data_origin != NULL), "data_origin HDmalloc succeeded"); - data_array = (DATATYPE *)malloc(block[0]*block[1]*sizeof(DATATYPE)); - VRFY((data_array != NULL), "data_array malloc succeeded"); + data_array = (DATATYPE *)HDmalloc(block[0]*block[1]*sizeof(DATATYPE)); + VRFY((data_array != NULL), "data_array HDmalloc succeeded"); /* put some trivial data in the data_array */ mstart[0] = mstart[1] = 0; @@ -2867,8 +2867,8 @@ none_selection_chunk(void) H5Fclose(fid); /* release data buffers */ - if(data_origin) free(data_origin); - if(data_array) free(data_array); + if(data_origin) HDfree(data_origin); + if(data_array) HDfree(data_array); } @@ -3218,7 +3218,7 @@ test_actual_io_mode(int selection_mode) { /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "malloc of buffer succeeded"); + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -3649,7 +3649,7 @@ test_no_collective_cause_mode(int selection_mode) /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "malloc of buffer succeeded"); + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -3889,7 +3889,7 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "malloc of buffer succeeded"); + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -4073,11 +4073,11 @@ dataset_atomicity(void) buf_size = dim0 * dim1; /* allocate memory for data buffer */ - write_buf = (int *)calloc(buf_size, sizeof(int)); - VRFY((write_buf != NULL), "write_buf malloc succeeded"); + write_buf = (int *)HDcalloc(buf_size, sizeof(int)); + VRFY((write_buf != NULL), "write_buf HDcalloc succeeded"); /* allocate memory for data buffer */ - read_buf = (int *)calloc(buf_size, sizeof(int)); - VRFY((read_buf != NULL), "read_buf malloc succeeded"); + read_buf = (int *)HDcalloc(buf_size, sizeof(int)); + VRFY((read_buf != NULL), "read_buf HDcalloc succeeded"); /* setup file access template */ acc_tpl = create_faccess_plist(comm, info, facc_type); @@ -4219,19 +4219,19 @@ dataset_atomicity(void) VRFY((ret >= 0), "H5D close succeeded"); /* release data buffers */ - if(write_buf) free(write_buf); - if(read_buf) free(read_buf); + if(write_buf) HDfree(write_buf); + if(read_buf) HDfree(read_buf); /* open dataset2 (non-contiguous case) */ dataset2 = H5Dopen2(fid, DATASETNAME6, H5P_DEFAULT); VRFY((dataset2 >= 0), "H5Dopen2 succeeded"); /* allocate memory for data buffer */ - write_buf = (int *)calloc(buf_size, sizeof(int)); - VRFY((write_buf != NULL), "write_buf malloc succeeded"); + write_buf = (int *)HDcalloc(buf_size, sizeof(int)); + VRFY((write_buf != NULL), "write_buf HDcalloc succeeded"); /* allocate memory for data buffer */ - read_buf = (int *)calloc(buf_size, sizeof(int)); - VRFY((read_buf != NULL), "read_buf malloc succeeded"); + read_buf = (int *)HDcalloc(buf_size, sizeof(int)); + VRFY((read_buf != NULL), "read_buf HDcalloc succeeded"); for (i=0 ; i<buf_size ; i++) { write_buf[i] = 5; @@ -4341,8 +4341,8 @@ dataset_atomicity(void) VRFY((ret >= 0), "H5Sclose succeeded"); /* release data buffers */ - if(write_buf) free(write_buf); - if(read_buf) free(read_buf); + if(write_buf) HDfree(write_buf); + if(read_buf) HDfree(read_buf); ret = H5Fclose(fid); VRFY((ret >= 0), "H5Fclose succeeded"); diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index f38b30e..7e782ce 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -186,8 +186,8 @@ filter_read_internal(const char *filename, hid_t dcpl, hrc = H5Fclose (file); VRFY(hrc>=0, "H5Fclose"); - free(points); - free(check); + HDfree(points); + HDfree(check); MPI_Barrier(MPI_COMM_WORLD); } diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index cd61e1e..7bd2f58 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -31,11 +31,11 @@ /* FILENAME and filenames must have the same number of names */ const char *FILENAME[2]={ - "MPItest", - NULL}; -char filenames[2][200]; -int nerrors = 0; -hid_t fapl; /* file access property list */ + "MPItest", + NULL}; +char filenames[2][200]; +int nerrors = 0; +hid_t fapl; /* file access property list */ /* protocols */ static int errors_sum(int nerrs); @@ -49,10 +49,10 @@ test_mpio_overlap_writes(char *filename) MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; int color, mrc; - MPI_File fh; + MPI_File fh; int i; int vrfyerrs, nerrs; - unsigned char buf[4093]; /* use some prime number for size */ + unsigned char buf[4093]; /* use some prime number for size */ int bufsize = sizeof(buf); MPI_Offset stride; MPI_Offset mpi_off; @@ -60,8 +60,8 @@ test_mpio_overlap_writes(char *filename) if (VERBOSE_MED) - printf("MPIO independent overlapping writes test on file %s\n", - filename); + printf("MPIO independent overlapping writes test on file %s\n", + filename); nerrs = 0; /* set up MPI parameters */ @@ -70,10 +70,10 @@ test_mpio_overlap_writes(char *filename) /* Need at least 2 processes */ if (mpi_size < 2) { - if (MAINPROCESS) - printf("Need at least 2 processes to run MPIO test.\n"); - printf(" -SKIP- \n"); - return 0; + if (MAINPROCESS) + printf("Need at least 2 processes to run MPIO test.\n"); + printf(" -SKIP- \n"); + return 0; } /* splits processes 0 to n-2 into one comm. and the last one into another */ @@ -82,85 +82,85 @@ test_mpio_overlap_writes(char *filename) VRFY((mrc==MPI_SUCCESS), "Comm_split succeeded"); if (color==0){ - /* First n-1 processes (color==0) open a file and write it */ - mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = 1; - mpi_off = mpi_rank*stride; - while (mpi_off < MPIO_TEST_WRITE_SIZE){ - /* make sure the write does not exceed the TEST_WRITE_SIZE */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - - /* set data to some trivial pattern for easy verification */ - for (i=0; i<stride; i++) - buf[i] = (unsigned char)(mpi_off+i); - mrc = MPI_File_write_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, - &mpi_stat); - VRFY((mrc==MPI_SUCCESS), ""); - - /* move the offset pointer to last byte written by all processes */ - mpi_off += (mpi_size - 1 - mpi_rank) * stride; - - /* Increase chunk size without exceeding buffer size. */ - /* Then move the starting offset for next write. */ - stride *= 2; - if (stride > bufsize) - stride = bufsize; - mpi_off += mpi_rank*stride; - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - - /* sync with the other waiting processes */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - }else{ - /* last process waits till writes are done, - * then opens file to verify data. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - - mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = bufsize; - for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){ - /* make sure it does not read beyond end of data */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, - &mpi_stat); - VRFY((mrc==MPI_SUCCESS), ""); - vrfyerrs=0; - for (i=0; i<stride; i++){ - unsigned char expected; - expected = (unsigned char)(mpi_off+i); - if ((expected != buf[i]) && - (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { - printf("proc %d: found data error at [%ld], expect %u, got %u\n", - mpi_rank, (long)(mpi_off+i), expected, buf[i]); - } - } - if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); + /* First n-1 processes (color==0) open a file and write it */ + mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, + info, &fh); + VRFY((mrc==MPI_SUCCESS), ""); + + stride = 1; + mpi_off = mpi_rank*stride; + while (mpi_off < MPIO_TEST_WRITE_SIZE){ + /* make sure the write does not exceed the TEST_WRITE_SIZE */ + if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + + /* set data to some trivial pattern for easy verification */ + for (i=0; i<stride; i++) + buf[i] = (unsigned char)(mpi_off+i); + mrc = MPI_File_write_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, + &mpi_stat); + VRFY((mrc==MPI_SUCCESS), ""); + + /* move the offset pointer to last byte written by all processes */ + mpi_off += (mpi_size - 1 - mpi_rank) * stride; + + /* Increase chunk size without exceeding buffer size. */ + /* Then move the starting offset for next write. */ + stride *= 2; + if (stride > bufsize) + stride = bufsize; + mpi_off += mpi_rank*stride; + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - nerrs += vrfyerrs; - } + /* sync with the other waiting processes */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after writes"); + }else{ + /* last process waits till writes are done, + * then opens file to verify data. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after writes"); + + mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, + info, &fh); + VRFY((mrc==MPI_SUCCESS), ""); + + stride = bufsize; + for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){ + /* make sure it does not read beyond end of data */ + if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, + &mpi_stat); + VRFY((mrc==MPI_SUCCESS), ""); + vrfyerrs=0; + for (i=0; i<stride; i++){ + unsigned char expected; + expected = (unsigned char)(mpi_off+i); + if ((expected != buf[i]) && + (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { + printf("proc %d: found data error at [%ld], expect %u, got %u\n", + mpi_rank, (long)(mpi_off+i), expected, buf[i]); + } + } + if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); } /* @@ -194,12 +194,12 @@ test_mpio_gb_file(char *filename) int mpi_size, mpi_rank; MPI_Info info = MPI_INFO_NULL; int mrc; - MPI_File fh; + MPI_File fh; int i, j, n; int vrfyerrs; - int writerrs; /* write errors */ + int writerrs; /* write errors */ int nerrs; - int ntimes; /* how many times */ + int ntimes; /* how many times */ char *buf = NULL; char expected; MPI_Offset size; @@ -225,186 +225,186 @@ test_mpio_gb_file(char *filename) * Verify the sizeof MPI_Offset and correctness of handling multiple GB * sizes. */ - if (MAINPROCESS){ /* only process 0 needs to check it*/ - printf("MPI_Offset is %s %d bytes integeral type\n", - is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset)); - if (sizeof_mpi_offset <= 4 && is_signed){ - printf("Skipped 2GB range test " - "because MPI_Offset cannot support it\n"); - }else { - /* verify correctness of assigning 2GB sizes */ - mpi_off = 2 * 1024 * (MPI_Offset)MB; - INFO((mpi_off>0), "2GB OFFSET assignment no overflow"); - INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); - - /* verify correctness of increasing from below 2 GB to above 2GB */ - mpi_off = TWO_GB_LESS1; - for (i=0; i < 3; i++){ - mpi_off_old = mpi_off; - mpi_off = mpi_off + 1; - /* no overflow */ - INFO((mpi_off>0), "2GB OFFSET increment no overflow"); - /* correct inc. */ - INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed"); - } - } + if (MAINPROCESS){ /* only process 0 needs to check it*/ + printf("MPI_Offset is %s %d bytes integeral type\n", + is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset)); + if (sizeof_mpi_offset <= 4 && is_signed){ + printf("Skipped 2GB range test " + "because MPI_Offset cannot support it\n"); + }else { + /* verify correctness of assigning 2GB sizes */ + mpi_off = 2 * 1024 * (MPI_Offset)MB; + INFO((mpi_off>0), "2GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); + + /* verify correctness of increasing from below 2 GB to above 2GB */ + mpi_off = TWO_GB_LESS1; + for (i=0; i < 3; i++){ + mpi_off_old = mpi_off; + mpi_off = mpi_off + 1; + /* no overflow */ + INFO((mpi_off>0), "2GB OFFSET increment no overflow"); + /* correct inc. */ + INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed"); + } + } - if (sizeof_mpi_offset <= 4){ - printf("Skipped 4GB range test " - "because MPI_Offset cannot support it\n"); - }else { - /* verify correctness of assigning 4GB sizes */ - mpi_off = 4 * 1024 * (MPI_Offset)MB; - INFO((mpi_off>0), "4GB OFFSET assignment no overflow"); - INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); - - /* verify correctness of increasing from below 4 GB to above 4 GB */ - mpi_off = FOUR_GB_LESS1; - for (i=0; i < 3; i++){ - mpi_off_old = mpi_off; - mpi_off = mpi_off + 1; - /* no overflow */ - INFO((mpi_off>0), "4GB OFFSET increment no overflow"); - /* correct inc. */ - INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed"); - } - } + if (sizeof_mpi_offset <= 4){ + printf("Skipped 4GB range test " + "because MPI_Offset cannot support it\n"); + }else { + /* verify correctness of assigning 4GB sizes */ + mpi_off = 4 * 1024 * (MPI_Offset)MB; + INFO((mpi_off>0), "4GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); + + /* verify correctness of increasing from below 4 GB to above 4 GB */ + mpi_off = FOUR_GB_LESS1; + for (i=0; i < 3; i++){ + mpi_off_old = mpi_off; + mpi_off = mpi_off + 1; + /* no overflow */ + INFO((mpi_off>0), "4GB OFFSET increment no overflow"); + /* correct inc. */ + INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed"); + } + } } /* * Verify if we can write to a file of multiple GB sizes. */ if (VERBOSE_MED) - printf("MPIO GB file test %s\n", filename); + printf("MPIO GB file test %s\n", filename); if (sizeof_mpi_offset <= 4){ - printf("Skipped GB file range test " - "because MPI_Offset cannot support it\n"); + printf("Skipped GB file range test " + "because MPI_Offset cannot support it\n"); }else{ - buf = malloc(MB); - VRFY((buf!=NULL), "malloc succeed"); - - /* open a new file. Remove it first in case it exists. */ - /* Must delete because MPI_File_open does not have a Truncate mode. */ - /* Don't care if it has error. */ - MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ - - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN"); - - printf("MPIO GB file write test %s\n", filename); - - /* instead of writing every bytes of the file, we will just write - * some data around the 2 and 4 GB boundaries. That should cover - * potential integer overflow and filesystem size limits. - */ - writerrs = 0; - for (n=2; n <= 4; n+=2){ - ntimes = GB/MB*n/mpi_size + 1; - for (i=ntimes-2; i <= ntimes; i++){ - mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB; - if (VERBOSE_MED) - HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n", - mpi_rank, mpi_off, mpi_off); - /* set data to some trivial pattern for easy verification */ - for (j=0; j<MB; j++) - *(buf+j) = i*mpi_size + mpi_rank; - if (VERBOSE_MED) - HDfprintf(stdout,"proc %d: writing %d bytes at offset %lld\n", - mpi_rank, MB, mpi_off); - mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); - INFO((mrc==MPI_SUCCESS), "GB size file write"); - if (mrc!=MPI_SUCCESS) - writerrs++; - } - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - - /* - * Verify if we can read the multiple GB file just created. - */ - /* open it again to verify the data written */ - /* but only if there was no write errors */ - printf("MPIO GB file read test %s\n", filename); - if (errors_sum(writerrs)>0){ - printf("proc %d: Skip read test due to previous write errors\n", - mpi_rank); - goto finish; - } - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); + buf = HDmalloc(MB); + VRFY((buf!=NULL), "malloc succeed"); + + /* open a new file. Remove it first in case it exists. */ + /* Must delete because MPI_File_open does not have a Truncate mode. */ + /* Don't care if it has error. */ + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ + + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, + info, &fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN"); + + printf("MPIO GB file write test %s\n", filename); + + /* instead of writing every bytes of the file, we will just write + * some data around the 2 and 4 GB boundaries. That should cover + * potential integer overflow and filesystem size limits. + */ + writerrs = 0; + for (n=2; n <= 4; n+=2){ + ntimes = GB/MB*n/mpi_size + 1; + for (i=ntimes-2; i <= ntimes; i++){ + mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB; + if (VERBOSE_MED) + HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n", + mpi_rank, mpi_off, mpi_off); + /* set data to some trivial pattern for easy verification */ + for (j=0; j<MB; j++) + *(buf+j) = i*mpi_size + mpi_rank; + if (VERBOSE_MED) + HDfprintf(stdout,"proc %d: writing %d bytes at offset %lld\n", + mpi_rank, MB, mpi_off); + mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); + INFO((mrc==MPI_SUCCESS), "GB size file write"); + if (mrc!=MPI_SUCCESS) + writerrs++; + } + } - /* Only read back parts of the file that have been written. */ - for (n=2; n <= 4; n+=2){ - ntimes = GB/MB*n/mpi_size + 1; - for (i=ntimes-2; i <= ntimes; i++){ - mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB; - if (VERBOSE_MED) - HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n", - mpi_rank, mpi_off, mpi_off); - mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); - INFO((mrc==MPI_SUCCESS), "GB size file read"); - expected = i*mpi_size + (mpi_size - mpi_rank - 1); - vrfyerrs=0; - for (j=0; j<MB; j++){ - if ((*(buf+j) != expected) && - (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)){ - printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n", - mpi_rank, (long)mpi_off, j, expected, *(buf+j)); - } - } - if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); - - nerrs += vrfyerrs; - } - } + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync after writes"); + + /* + * Verify if we can read the multiple GB file just created. + */ + /* open it again to verify the data written */ + /* but only if there was no write errors */ + printf("MPIO GB file read test %s\n", filename); + if (errors_sum(writerrs)>0){ + printf("proc %d: Skip read test due to previous write errors\n", + mpi_rank); + goto finish; + } + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); + VRFY((mrc==MPI_SUCCESS), ""); + + /* Only read back parts of the file that have been written. */ + for (n=2; n <= 4; n+=2){ + ntimes = GB/MB*n/mpi_size + 1; + for (i=ntimes-2; i <= ntimes; i++){ + mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB; + if (VERBOSE_MED) + HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n", + mpi_rank, mpi_off, mpi_off); + mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); + INFO((mrc==MPI_SUCCESS), "GB size file read"); + expected = i*mpi_size + (mpi_size - mpi_rank - 1); + vrfyerrs=0; + for (j=0; j<MB; j++){ + if ((*(buf+j) != expected) && + (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)){ + printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n", + mpi_rank, (long)mpi_off, j, expected, *(buf+j)); + } + } + if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } + } - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + /* + * one more sync to ensure all processes have done reading + * before ending this test. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); printf("Test if MPI_File_get_size works correctly with %s\n", filename); - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); VRFY((mrc==MPI_SUCCESS), ""); - if (MAINPROCESS){ /* only process 0 needs to check it*/ + if (MAINPROCESS){ /* only process 0 needs to check it*/ mrc = MPI_File_get_size(fh, &size); - VRFY((mrc==MPI_SUCCESS), ""); + VRFY((mrc==MPI_SUCCESS), ""); VRFY((size == mpi_off+MB), "MPI_File_get_size doesn't return correct file size."); } - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + /* + * one more sync to ensure all processes have done reading + * before ending this test. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); } finish: if (buf) - HDfree(buf); + HDfree(buf); return (nerrs); } @@ -426,11 +426,11 @@ finish: * Each process writes something, then reads all data back. */ -#define DIMSIZE 32 /* Dimension size. */ +#define DIMSIZE 32 /* Dimension size. */ #define PRINTID printf("Proc %d: ", mpi_rank) #define USENONE 0 -#define USEATOM 1 /* request atomic I/O */ -#define USEFSYNC 2 /* request file_sync */ +#define USEATOM 1 /* request atomic I/O */ +#define USEFSYNC 2 /* request file_sync */ static int @@ -445,7 +445,7 @@ test_mpio_1wMr(char *filename, int special_request) unsigned char writedata[DIMSIZE], readdata[DIMSIZE]; unsigned char expect_val; int i, irank; - int nerrs = 0; /* number of errors */ + int nerrs = 0; /* number of errors */ int atomicity; MPI_Offset mpi_off; MPI_Status mpi_stat; @@ -455,35 +455,35 @@ test_mpio_1wMr(char *filename, int special_request) if (MAINPROCESS && VERBOSE_MED){ printf("Testing one process writes, all processes read.\n"); - printf("Using %d processes accessing file %s\n", mpi_size, filename); + printf("Using %d processes accessing file %s\n", mpi_size, filename); printf(" (Filename can be specified via program argument)\n"); } /* show the hostname so that we can tell where the processes are running */ if (VERBOSE_DEF){ - if (gethostname(hostname, 128) < 0){ - PRINTID; - printf("gethostname failed\n"); - return 1; - } - PRINTID; - printf("hostname=%s\n", hostname); + if (gethostname(hostname, 128) < 0){ + PRINTID; + printf("gethostname failed\n"); + return 1; + } + PRINTID; + printf("hostname=%s\n", hostname); } /* Delete any old file in order to start anew. */ /* Must delete because MPI_File_open does not have a Truncate mode. */ /* Don't care if it has error. */ MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ + MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_RDWR | MPI_MODE_CREATE , - MPI_INFO_NULL, &fh)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + MPI_MODE_RDWR | MPI_MODE_CREATE , + MPI_INFO_NULL, &fh)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } if (special_request & USEATOM){ @@ -492,31 +492,31 @@ if (special_request & USEATOM){ * should not need this. * ==================================================*/ if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); } if (VERBOSE_HI) - printf("Initial atomicity = %d\n", atomicity); + printf("Initial atomicity = %d\n", atomicity); if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); } if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); } if (VERBOSE_HI) - printf("After set_atomicity atomicity = %d\n", atomicity); + printf("After set_atomicity atomicity = %d\n", atomicity); } /* This barrier is not necessary but do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); if (VERBOSE_HI){ - PRINTID; - printf("between MPI_Barrier and MPI_File_write_at\n"); + PRINTID; + printf("between MPI_Barrier and MPI_File_write_at\n"); } /* ================================================== @@ -525,31 +525,31 @@ if (special_request & USEATOM){ * ==================================================*/ irank=0; for (i=0; i < DIMSIZE; i++) - writedata[i] = irank*DIMSIZE + i; + writedata[i] = irank*DIMSIZE + i; mpi_off = irank*DIMSIZE; /* Only one process writes */ if (mpi_rank==irank){ - if (VERBOSE_HI){ - PRINTID; printf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off); - } - if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, - MPI_BYTE, &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; - }; + if (VERBOSE_HI){ + PRINTID; printf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off); + } + if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, + MPI_BYTE, &mpi_stat)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; + }; }; /* Bcast the return code and */ /* make sure all writing are done before reading. */ MPI_Bcast(&mpi_err, 1, MPI_INT, irank, MPI_COMM_WORLD); if (VERBOSE_HI){ - PRINTID; - printf("MPI_Bcast: mpi_err = %d\n", mpi_err); + PRINTID; + printf("MPI_Bcast: mpi_err = %d\n", mpi_err); } if (special_request & USEFSYNC){ @@ -558,19 +558,19 @@ if (special_request & USEFSYNC){ * should not need this. * ==================================================*/ if (VERBOSE_HI) - printf("Apply MPI_File_sync\n"); + printf("Apply MPI_File_sync\n"); /* call file_sync to force the write out */ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); } MPI_Barrier(MPI_COMM_WORLD); /* call file_sync to force the write out */ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); } } @@ -578,8 +578,8 @@ if (special_request & USEFSYNC){ /* should take care of it. Do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); if (VERBOSE_HI){ - PRINTID; - printf("after MPI_Barrier\n"); + PRINTID; + printf("after MPI_Barrier\n"); } /* ================================================== @@ -588,29 +588,29 @@ if (special_request & USEFSYNC){ irank=0; mpi_off = irank*DIMSIZE; if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE, - &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; + &mpi_stat)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; }; for (i=0; i < DIMSIZE; i++){ - expect_val = irank*DIMSIZE + i; - if (readdata[i] != expect_val){ - PRINTID; - printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, - readdata[i], expect_val); - nerrs++; - } + expect_val = irank*DIMSIZE + i; + if (readdata[i] != expect_val){ + PRINTID; + printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, + readdata[i], expect_val); + nerrs++; + } } MPI_File_close(&fh); if (VERBOSE_HI){ - PRINTID; - printf("%d data errors detected\n", nerrs); + PRINTID; + printf("%d data errors detected\n", nerrs); } mpi_err = MPI_Barrier(MPI_COMM_WORLD); @@ -628,18 +628,18 @@ and this platform. 1. Details for the test: 1) Create two derived datatypes with MPI_Type_hindexed: datatype1: - count = 1, blocklens = 1, offsets = 0, - base type = MPI_BYTE(essentially a char) + count = 1, blocklens = 1, offsets = 0, + base type = MPI_BYTE(essentially a char) datatype2: - count = 1, blocklens = 1, offsets = 1(byte), - base type = MPI_BYTE + count = 1, blocklens = 1, offsets = 1(byte), + base type = MPI_BYTE 2) Using these two derived datatypes, Build another derived datatype with MPI_Type_struct: advtype: derived from datatype1 and datatype2 advtype: - count = 2, blocklens[0] = 1, blocklens[1]=1, - offsets[0] = 0, offsets[1] = 1(byte), + count = 2, blocklens[0] = 1, blocklens[1]=1, + offsets[0] = 0, offsets[1] = 1(byte), bas_type[0]=datatype1, bas_type[1] = datatype2; @@ -678,7 +678,7 @@ static int test_mpio_derived_dtype(char *filename) { int mpi_err_strlen; int mpi_err; int i; - int nerrors = 0; /* number of errors */ + int nerrors = 0; /* number of errors */ MPI_Datatype etype,filetype; MPI_Datatype adv_filetype,bas_filetype[2]; MPI_Datatype etypenew, filetypenew; @@ -702,12 +702,12 @@ static int test_mpio_derived_dtype(char *filename) { if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_RDWR | MPI_MODE_CREATE, - MPI_INFO_NULL, &fh)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + MPI_MODE_RDWR | MPI_MODE_CREATE, + MPI_INFO_NULL, &fh)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } disp = 0; @@ -719,15 +719,15 @@ static int test_mpio_derived_dtype(char *filename) { if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); - return 1; + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err=MPI_Type_commit(&filetype))!=MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } count = 1; @@ -735,15 +735,15 @@ static int test_mpio_derived_dtype(char *filename) { offsets[0] = 1; if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); - return 1; + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err=MPI_Type_commit(&filetypenew))!=MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } outcount = 2; @@ -756,48 +756,48 @@ static int test_mpio_derived_dtype(char *filename) { if((mpi_err= MPI_Type_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_struct failed (%s)\n", mpi_err_str); - return 1; + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_struct failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err=MPI_Type_commit(&adv_filetype))!=MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_set_view(fh,disp,etype,adv_filetype,"native",MPI_INFO_NULL))!= MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_write(fh,buf,3,MPI_BYTE,&Status))!= MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_write failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_write failed (%s)\n", mpi_err_str); + return 1; ; } if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_open(MPI_COMM_WORLD,filename,MPI_MODE_RDONLY,MPI_INFO_NULL,&fh)) != MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_set_view(fh,0,MPI_BYTE,MPI_BYTE,"native",MPI_INFO_NULL))!= MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } if((mpi_err = MPI_File_read(fh,outbuf,3,MPI_BYTE,&Status))!=MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); @@ -820,8 +820,8 @@ static int test_mpio_derived_dtype(char *filename) { if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; } @@ -1005,55 +1005,55 @@ static int parse_options(int argc, char **argv) { while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'v': if (*((*argv+1)+1)) - ParseTestVerbosity((*argv+1)+1); - else - SetTestVerbosity(VERBO_MED); - break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: nerrors++; - return(1); - } - } + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'v': if (*((*argv+1)+1)) + ParseTestVerbosity((*argv+1)+1); + else + SetTestVerbosity(VERBO_MED); + break; + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: nerrors++; + return(1); + } + } } /*while*/ /* compose the test filenames */ { - int i, n; - hid_t plist; - - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - H5Pclose(plist); - if (VERBOSE_MED){ - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); - } + int i, n; + hid_t plist; + + plist = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + H5Pclose(plist); + if (VERBOSE_MED){ + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); + } } return(0); @@ -1087,7 +1087,7 @@ errors_sum(int nerrs) int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ int ret_code; MPI_Init(&argc, &argv); @@ -1100,23 +1100,23 @@ main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); if (parse_options(argc, argv) != 0){ - if (MAINPROCESS) - usage(); - goto finish; + if (MAINPROCESS) + usage(); + goto finish; } if (MAINPROCESS){ - printf("===================================\n"); - printf("MPI functionality tests\n"); - printf("===================================\n"); + printf("===================================\n"); + printf("MPI functionality tests\n"); + printf("===================================\n"); } if (VERBOSE_MED) - h5_show_hostname(); + h5_show_hostname(); fapl = H5Pcreate (H5P_FILE_ACCESS); H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); @@ -1132,28 +1132,28 @@ main(int argc, char **argv) ret_code = test_mpio_1wMr(filenames[0], USENONE); ret_code = errors_sum(ret_code); if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /* test atomicity and file sync in high verbose mode only */ /* since they often hang when broken and PHDF5 does not use them. */ if (VERBOSE_HI){ - MPI_BANNER("MPIO 1 write Many read test with atomicity..."); - ret_code = test_mpio_1wMr(filenames[0], USEATOM); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } - - MPI_BANNER("MPIO 1 write Many read test with file sync..."); - ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } + MPI_BANNER("MPIO 1 write Many read test with atomicity..."); + ret_code = test_mpio_1wMr(filenames[0], USEATOM); + ret_code = errors_sum(ret_code); + if (mpi_rank==0 && ret_code > 0){ + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } + + MPI_BANNER("MPIO 1 write Many read test with file sync..."); + ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); + ret_code = errors_sum(ret_code); + if (mpi_rank==0 && ret_code > 0){ + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } } @@ -1173,7 +1173,6 @@ main(int argc, char **argv) printf(" will be skipped on Windows (JIRA HDDFV-8064)\n"); #endif - /*======================================= * MPIO independent overlapping writes *=======================================*/ @@ -1181,8 +1180,8 @@ main(int argc, char **argv) ret_code = test_mpio_overlap_writes(filenames[0]); ret_code = errors_sum(ret_code); if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= @@ -1192,8 +1191,8 @@ main(int argc, char **argv) ret_code = test_mpio_derived_dtype(filenames[0]); ret_code = errors_sum(ret_code); if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= @@ -1213,8 +1212,8 @@ main(int argc, char **argv) sc_finish: ret_code = errors_sum(ret_code); if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } @@ -1223,15 +1222,15 @@ finish: * and exit. */ MPI_Barrier(MPI_COMM_WORLD); - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors){ - printf("***MPI tests detected %d errors***\n", nerrors); - } - else{ - printf("MPI tests finished with no errors\n"); - } - printf("===================================\n"); + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors){ + printf("***MPI tests detected %d errors***\n", nerrors); + } + else{ + printf("MPI tests finished with no errors\n"); + } + printf("===================================\n"); } /* turn off alarm */ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 713d6e1..865d381 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -28,15 +28,15 @@ int dim0; int dim1; int chunkdim0; int chunkdim1; -int nerrors = 0; /* errors count */ -int ndatasets = 300; /* number of datasets to create*/ +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ int ngroups = 512; /* number of groups to create in root * group. */ -int facc_type = FACC_MPIO; /*Test file access type */ +int facc_type = FACC_MPIO; /*Test file access type */ int dxfer_coll_type = DXFER_COLLECTIVE_IO; -H5E_auto2_t old_func; /* previous error handler */ -void *old_client_data; /* previous error handler arg.*/ +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ /* other option flags */ @@ -48,10 +48,10 @@ void *old_client_data; /* previous error handler arg.*/ #define NFILENAME 2 #define PARATESTFILE filenames[0] const char *FILENAME[NFILENAME]={ - "ParaTest", - NULL}; -char filenames[NFILENAME][PATH_MAX]; -hid_t fapl; /* file access property list */ + "ParaTest", + NULL}; +char filenames[NFILENAME][PATH_MAX]; +hid_t fapl; /* file access property list */ #ifdef USE_PAUSE /* pause the process for a moment to allow debugger to attach if desired. */ @@ -64,7 +64,7 @@ void pause_proc(void) { int pid; - h5_stat_t statbuf; + h5_stat_t statbuf; char greenlight[] = "go"; int maxloop = 10; int loops = 0; @@ -82,14 +82,14 @@ void pause_proc(void) if (MAINPROCESS) while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){ - if (!loops++){ - printf("Proc %d (%*s, %d): to debug, attach %d\n", - mpi_rank, mpi_namelen, mpi_name, pid, pid); - } - printf("waiting(%ds) for file %s ...\n", time_int, greenlight); - fflush(stdout); - sleep(time_int); - } + if (!loops++){ + printf("Proc %d (%*s, %d): to debug, attach %d\n", + mpi_rank, mpi_namelen, mpi_name, pid, pid); + } + printf("waiting(%ds) for file %s ...\n", time_int, greenlight); + fflush(stdout); + sleep(time_int); + } MPI_Barrier(MPI_COMM_WORLD); } @@ -101,7 +101,7 @@ int MPI_Init(int *argc, char ***argv) pause_proc(); return (ret_code); } -#endif /* USE_PAUSE */ +#endif /* USE_PAUSE */ /* @@ -111,15 +111,15 @@ static void usage(void) { printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] " - "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n"); + "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n"); printf("\t-m<n_datasets>" - "\tset number of datasets for the multiple dataset test\n"); + "\tset number of datasets for the multiple dataset test\n"); printf("\t-n<n_groups>" "\tset number of groups for the multiple group test\n"); printf("\t-f <prefix>\tfilename prefix\n"); printf("\t-2\t\tuse Split-file together with MPIO\n"); printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n", - ROW_FACTOR, COL_FACTOR); + ROW_FACTOR, COL_FACTOR); printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); printf("\n"); } @@ -131,7 +131,7 @@ usage(void) static int parse_options(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -142,107 +142,107 @@ parse_options(int argc, char **argv) chunkdim1 = (dim1+9)/10; while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'm': ndatasets = atoi((*argv+1)+1); - if (ndatasets < 0){ - nerrors++; - return(1); - } - break; - case 'n': ngroups = atoi((*argv+1)+1); - if (ngroups < 0){ + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ + nerrors++; + return(1); + } + break; + case 'n': ngroups = atoi((*argv+1)+1); + if (ngroups < 0){ nerrors++; return(1); - } + } break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'i': /* Collective MPI-IO access with independent IO */ - dxfer_coll_type = DXFER_INDEPENDENT_IO; - break; - case '2': /* Use the split-file driver with MPIO access */ - /* Can use $HDF5_METAPREFIX to define the */ - /* meta-file-prefix. */ - facc_type = FACC_MPIO | FACC_SPLIT; - break; - case 'd': /* dimensizes */ - if (--argc < 2){ - nerrors++; - return(1); - } - dim0 = atoi(*(++argv))*mpi_size; - argc--; - dim1 = atoi(*(++argv))*mpi_size; - /* set default chunkdim sizes too */ - chunkdim0 = (dim0+9)/10; - chunkdim1 = (dim1+9)/10; - break; - case 'c': /* chunk dimensions */ - if (--argc < 2){ - nerrors++; - return(1); - } - chunkdim0 = atoi(*(++argv)); - argc--; - chunkdim1 = atoi(*(++argv)); - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: printf("Illegal option(%s)\n", *argv); - nerrors++; - return(1); - } - } + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'i': /* Collective MPI-IO access with independent IO */ + dxfer_coll_type = DXFER_INDEPENDENT_IO; + break; + case '2': /* Use the split-file driver with MPIO access */ + /* Can use $HDF5_METAPREFIX to define the */ + /* meta-file-prefix. */ + facc_type = FACC_MPIO | FACC_SPLIT; + break; + case 'd': /* dimensizes */ + if (--argc < 2){ + nerrors++; + return(1); + } + dim0 = atoi(*(++argv))*mpi_size; + argc--; + dim1 = atoi(*(++argv))*mpi_size; + /* set default chunkdim sizes too */ + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + break; + case 'c': /* chunk dimensions */ + if (--argc < 2){ + nerrors++; + return(1); + } + chunkdim0 = atoi(*(++argv)); + argc--; + chunkdim1 = atoi(*(++argv)); + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: printf("Illegal option(%s)\n", *argv); + nerrors++; + return(1); + } + } } /*while*/ /* check validity of dimension and chunk sizes */ if (dim0 <= 0 || dim1 <= 0){ - printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); - nerrors++; - return(1); + printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + nerrors++; + return(1); } if (chunkdim0 <= 0 || chunkdim1 <= 0){ - printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); - nerrors++; - return(1); + printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + nerrors++; + return(1); } /* Make sure datasets can be divided into equal portions by the processes */ if ((dim0 % mpi_size) || (dim1 % mpi_size)){ - if (MAINPROCESS) - printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", - dim0, dim1, mpi_size); - nerrors++; - return(1); + if (MAINPROCESS) + printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + dim0, dim1, mpi_size); + nerrors++; + return(1); } /* compose the test filenames */ { - int i, n; - - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); + int i, n; + + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); } return(0); @@ -257,7 +257,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) { hid_t ret_pl = -1; herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ + int mpi_rank; /* mpi variables */ /* need the rank for error checking macros */ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -266,32 +266,32 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); if (l_facc_type == FACC_DEFAULT) - return (ret_pl); + return (ret_pl); if (l_facc_type == FACC_MPIO){ - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); - return(ret_pl); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); + return(ret_pl); } if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return(ret_pl); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); } /* unknown file access types */ @@ -301,7 +301,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ H5Ptest_param_t ndsets_params, ngroups_params; H5Ptest_param_t collngroups_params; H5Ptest_param_t io_mode_confusion_params; @@ -319,9 +319,9 @@ int main(int argc, char **argv) dim1 = COL_FACTOR*mpi_size; if (MAINPROCESS){ - printf("===================================\n"); - printf("PHDF5 TESTS START\n"); - printf("===================================\n"); + printf("===================================\n"); + printf("PHDF5 TESTS START\n"); + printf("===================================\n"); } /* Attempt to turn off atexit post processing so that in case errors @@ -340,41 +340,41 @@ int main(int argc, char **argv) /* Tests are generally arranged from least to most complexity... */ AddTest("mpiodup", test_fapl_mpio_dup, NULL, - "fapl_mpio duplicate", NULL); + "fapl_mpio duplicate", NULL); AddTest("split", test_split_comm_access, NULL, - "dataset using split communicators", PARATESTFILE); + "dataset using split communicators", PARATESTFILE); AddTest("idsetw", dataset_writeInd, NULL, - "dataset independent write", PARATESTFILE); + "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, - "dataset independent read", PARATESTFILE); + "dataset independent read", PARATESTFILE); AddTest("cdsetw", dataset_writeAll, NULL, - "dataset collective write", PARATESTFILE); + "dataset collective write", PARATESTFILE); AddTest("cdsetr", dataset_readAll, NULL, - "dataset collective read", PARATESTFILE); + "dataset collective read", PARATESTFILE); AddTest("eidsetw", extend_writeInd, NULL, - "extendible dataset independent write", PARATESTFILE); + "extendible dataset independent write", PARATESTFILE); AddTest("eidsetr", extend_readInd, NULL, - "extendible dataset independent read", PARATESTFILE); + "extendible dataset independent read", PARATESTFILE); AddTest("ecdsetw", extend_writeAll, NULL, - "extendible dataset collective write", PARATESTFILE); + "extendible dataset collective write", PARATESTFILE); AddTest("ecdsetr", extend_readAll, NULL, - "extendible dataset collective read", PARATESTFILE); + "extendible dataset collective read", PARATESTFILE); AddTest("eidsetw2", extend_writeInd2, NULL, - "extendible dataset independent write #2", PARATESTFILE); + "extendible dataset independent write #2", PARATESTFILE); AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); AddTest("calloc", test_chunk_alloc, NULL, - "parallel extend Chunked allocation on serial file", PARATESTFILE); + "parallel extend Chunked allocation on serial file", PARATESTFILE); AddTest("fltread", test_filter_read, NULL, - "parallel read of dataset written serially with filters", PARATESTFILE); + "parallel read of dataset written serially with filters", PARATESTFILE); #ifdef H5_HAVE_FILTER_DEFLATE AddTest("cmpdsetr", compress_readAll, NULL, - "compressed dataset collective read", PARATESTFILE); + "compressed dataset collective read", PARATESTFILE); #endif /* H5_HAVE_FILTER_DEFLATE */ AddTest("zerodsetr", zero_dim_dset, NULL, @@ -383,22 +383,22 @@ int main(int argc, char **argv) ndsets_params.name = PARATESTFILE; ndsets_params.count = ndatasets; AddTest("ndsetw", multiple_dset_write, NULL, - "multiple datasets write", &ndsets_params); + "multiple datasets write", &ndsets_params); ngroups_params.name = PARATESTFILE; ngroups_params.count = ngroups; AddTest("ngrpw", multiple_group_write, NULL, - "multiple groups write", &ngroups_params); + "multiple groups write", &ngroups_params); AddTest("ngrpr", multiple_group_read, NULL, - "multiple groups read", &ngroups_params); + "multiple groups read", &ngroups_params); AddTest("compact", compact_dataset, NULL, - "compact dataset test", PARATESTFILE); + "compact dataset test", PARATESTFILE); collngroups_params.name = PARATESTFILE; collngroups_params.count = ngroups; AddTest("cngrpw", collective_group_write, NULL, - "collective group and dataset write", &collngroups_params); + "collective group and dataset write", &collngroups_params); AddTest("ingrpr", independent_group_read, NULL, "independent group and dataset read", &collngroups_params); #ifndef H5_HAVE_WIN32_API @@ -408,71 +408,71 @@ int main(int argc, char **argv) printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n"); #endif AddTest("fill", dataset_fillvalue, NULL, - "dataset fill value", PARATESTFILE); + "dataset fill value", PARATESTFILE); AddTest("cchunk1", - coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); + coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); AddTest("cchunk2", - coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); + coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); AddTest("cchunk3", - coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); + coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); AddTest("cchunk4", coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE); if((mpi_size < 3)&& MAINPROCESS ) { - printf("Collective chunk IO optimization APIs "); - printf("needs at least 3 processes to participate\n"); - printf("Collective chunk IO API tests will be skipped \n"); + printf("Collective chunk IO optimization APIs "); + printf("needs at least 3 processes to participate\n"); + printf("Collective chunk IO API tests will be skipped \n"); } AddTest((mpi_size <3)? "-cchunk5":"cchunk5" , coll_chunk5,NULL, - "linked chunk collective IO without optimization",PARATESTFILE); + "linked chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6", - coll_chunk6,NULL, - "multi-chunk collective IO with direct request",PARATESTFILE); + coll_chunk6,NULL, + "multi-chunk collective IO with direct request",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7", - coll_chunk7,NULL, - "linked chunk collective IO with optimization",PARATESTFILE); + coll_chunk7,NULL, + "linked chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8", - coll_chunk8,NULL, - "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); + coll_chunk8,NULL, + "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9", - coll_chunk9,NULL, - "multiple chunk collective IO with optimization",PARATESTFILE); + coll_chunk9,NULL, + "multiple chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10", - coll_chunk10,NULL, - "multiple chunk collective IO transferring to independent IO",PARATESTFILE); + coll_chunk10,NULL, + "multiple chunk collective IO transferring to independent IO",PARATESTFILE); /* irregular collective IO tests*/ AddTest("ccontw", - coll_irregular_cont_write,NULL, - "collective irregular contiguous write",PARATESTFILE); + coll_irregular_cont_write,NULL, + "collective irregular contiguous write",PARATESTFILE); AddTest("ccontr", - coll_irregular_cont_read,NULL, - "collective irregular contiguous read",PARATESTFILE); + coll_irregular_cont_read,NULL, + "collective irregular contiguous read",PARATESTFILE); AddTest("cschunkw", - coll_irregular_simple_chunk_write,NULL, - "collective irregular simple chunk write",PARATESTFILE); + coll_irregular_simple_chunk_write,NULL, + "collective irregular simple chunk write",PARATESTFILE); AddTest("cschunkr", - coll_irregular_simple_chunk_read,NULL, - "collective irregular simple chunk read",PARATESTFILE); + coll_irregular_simple_chunk_read,NULL, + "collective irregular simple chunk read",PARATESTFILE); AddTest("ccchunkw", - coll_irregular_complex_chunk_write,NULL, - "collective irregular complex chunk write",PARATESTFILE); + coll_irregular_complex_chunk_write,NULL, + "collective irregular complex chunk write",PARATESTFILE); AddTest("ccchunkr", - coll_irregular_complex_chunk_read,NULL, - "collective irregular complex chunk read",PARATESTFILE); + coll_irregular_complex_chunk_read,NULL, + "collective irregular complex chunk read",PARATESTFILE); AddTest("null", null_dataset, NULL, - "null dataset test", PARATESTFILE); + "null dataset test", PARATESTFILE); io_mode_confusion_params.name = PARATESTFILE; io_mode_confusion_params.count = 0; /* value not used */ AddTest("I/Omodeconf", io_mode_confusion, NULL, - "I/O mode confusion test -- hangs quickly on failure", + "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); if((mpi_size < 3) && MAINPROCESS) { @@ -539,9 +539,9 @@ int main(int argc, char **argv) TestParseCmdLine(argc, argv); if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ - printf("===================================\n" - " Using Independent I/O with file set view to replace collective I/O \n" - "===================================\n"); + printf("===================================\n" + " Using Independent I/O with file set view to replace collective I/O \n" + "===================================\n"); } @@ -566,16 +566,16 @@ int main(int argc, char **argv) { int temp; MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - nerrors=temp; + nerrors=temp; } - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors) - printf("***PHDF5 tests detected %d errors***\n", nerrors); - else - printf("PHDF5 tests finished with no errors\n"); - printf("===================================\n"); + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) + printf("***PHDF5 tests detected %d errors***\n", nerrors); + else + printf("PHDF5 tests finished with no errors\n"); + printf("===================================\n"); } /* close HDF5 library */ H5close(); diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c index e45d24a..49204f5 100644 --- a/tools/h5copy/h5copygentest.c +++ b/tools/h5copy/h5copygentest.c @@ -237,10 +237,10 @@ static void gent_named_vl(hid_t loc_id) /* allocate and initialize VL dataset to write */ buf[0].len = 1; - buf[0].p = malloc( 1 * sizeof(int)); + buf[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf[0].p)[0]=1; buf[1].len = 2; - buf[1].p = malloc( 2 * sizeof(int)); + buf[1].p = HDmalloc( 2 * sizeof(int)); ((int *)buf[1].p)[0]=2; ((int *)buf[1].p)[1]=3; @@ -283,16 +283,16 @@ static void gent_nested_vl(hid_t loc_id) /* allocate and initialize VL dataset to write */ buf[0].len = 1; - buf[0].p = malloc( 1 * sizeof(hvl_t)); + buf[0].p = HDmalloc( 1 * sizeof(hvl_t)); tvl = (hvl_t *)buf[0].p; - tvl->p = malloc( 1 * sizeof(int) ); + tvl->p = HDmalloc( 1 * sizeof(int) ); tvl->len = 1; ((int *)tvl->p)[0]=1; buf[1].len = 1; - buf[1].p = malloc( 1 * sizeof(hvl_t)); + buf[1].p = HDmalloc( 1 * sizeof(hvl_t)); tvl = (hvl_t *)buf[1].p; - tvl->p = malloc( 2 * sizeof(int) ); + tvl->p = HDmalloc( 2 * sizeof(int) ); tvl->len = 2; ((int *)tvl->p)[0]=2; ((int *)tvl->p)[1]=3; @@ -454,23 +454,23 @@ static herr_t gen_obj_ref(hid_t loc_id) /*-------------- * add group */ - oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid < 0) { fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } - H5Gclose(oid); + H5Gclose(oid); - status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, -1); + status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } - status = H5Rcreate (&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, -1); + status = H5Rcreate (&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index d554abd..80405e9 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -978,8 +978,8 @@ int test_attributes(const char *file, */ write_attr_in(did,"dset",fid,make_diffs); - write_attr_in(gid,NULL,0,make_diffs); - write_attr_in(root_id,NULL,0,make_diffs); + write_attr_in(gid,NULL,(hid_t)0,make_diffs); + write_attr_in(root_id,NULL,(hid_t)0,make_diffs); /* Close */ @@ -4127,9 +4127,9 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* obj references */ - status=H5Rcreate(&(comp9_buf.objref1),gid,"Compound_dset2",H5R_OBJECT,-1); - status=H5Rcreate(&(comp9_buf.objref2),gid,"Compound_dset3",H5R_OBJECT,-1); - status=H5Rcreate(&(comp9_buf.objref3),gid,"Compound_dset4",H5R_OBJECT,-1); + status=H5Rcreate(&(comp9_buf.objref1),gid,"Compound_dset2",H5R_OBJECT,(hid_t)-1); + status=H5Rcreate(&(comp9_buf.objref2),gid,"Compound_dset3",H5R_OBJECT,(hid_t)-1); + status=H5Rcreate(&(comp9_buf.objref3),gid,"Compound_dset4",H5R_OBJECT,(hid_t)-1); status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); if (status < 0) @@ -5416,8 +5416,8 @@ void write_attr_in(hid_t loc_id, /* Create references to dataset */ if (dset_name) { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); + status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); } @@ -5698,7 +5698,7 @@ void write_attr_in(hid_t loc_id, { for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); @@ -6094,7 +6094,7 @@ void write_attr_in(hid_t loc_id, for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); @@ -6460,8 +6460,8 @@ void write_dset_in(hid_t loc_id, /* Create references to dataset */ if (dset_name) { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); + status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); } @@ -6675,7 +6675,7 @@ void write_dset_in(hid_t loc_id, { for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); @@ -6886,7 +6886,7 @@ void write_dset_in(hid_t loc_id, for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index c081ee0..64667cb 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -1937,7 +1937,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU datactx.need_prefix = TRUE; datactx.indent_level = ctx.indent_level; datactx.cur_column = ctx.cur_column; - status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id, -1, NULL); + status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id, NULL); } } else { diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 884670e..046c5e1 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -2043,16 +2043,16 @@ static void gent_objref(void) dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Create reference to dataset */ - H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); /* Create reference to dataset */ - H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1); + H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1); /* Create reference to group */ - H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, -1); + H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1); /* Create reference to named datatype */ - H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1); + H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1); /* Write selection to disk */ H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -3913,8 +3913,8 @@ static void write_attr_in(hid_t loc_id, /* Create references to dataset */ if(dset_name) { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); + status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); } @@ -4020,7 +4020,7 @@ static void write_attr_in(hid_t loc_id, { for(i = 0; i < 3; i++) { for(j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); @@ -4151,7 +4151,7 @@ static void write_attr_in(hid_t loc_id, for(i = 0; i < 4; i++) { for(j = 0; j < 3; j++) { for(k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); @@ -4355,8 +4355,8 @@ static void write_dset_in(hid_t loc_id, /* Create references to dataset */ if(dset_name) { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1); + status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1); write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); } @@ -4462,7 +4462,7 @@ static void write_dset_in(hid_t loc_id, { for(i = 0; i < 3; i++) { for(j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); @@ -4605,7 +4605,7 @@ static void write_dset_in(hid_t loc_id, for(i = 0; i < 4; i++) { for(j = 0; j < 3; j++) { for(k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1); } } write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); @@ -4730,8 +4730,8 @@ static void gent_attr_all(void) */ write_attr_in(did,"dset",fid); - write_attr_in(group_id,NULL,0); - write_attr_in(root_id,NULL,0); + write_attr_in(group_id,NULL,(hid_t)0); + write_attr_in(root_id,NULL,(hid_t)0); /*------------------------------------------------------------------------- * write a series of datasets on group 2 diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index afb0da6..776eaeb 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -162,7 +162,7 @@ main (int argc, const char *argv[]) if (res < (long)size) { if (buf) - free (buf); + HDfree (buf); HDclose (fd); exit (EXIT_FAILURE); } @@ -170,7 +170,7 @@ main (int argc, const char *argv[]) HDwrite (1, buf, (unsigned)size); if (buf) - free (buf); + HDfree (buf); HDclose (fd); return (EXIT_SUCCESS); } diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index d8768fb..4b8a50b 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1464,7 +1464,7 @@ dump_dataset_values(hid_t dset) h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; ctx.cur_column = (size_t)curr_pos; - if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, -1, NULL) < 0) { + if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, NULL) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Unable to print data."); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 63b5373..a25e789 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -39,7 +39,7 @@ #define CHECK_H5DRW_ERROR(_fun, _did, _mtid, _msid, _fsid, _pid, _buf) { \ H5E_BEGIN_TRY { \ if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \ - int _err_num = 0; \ + hid_t _err_num = 0; \ char _msg[80]; \ H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index c25b7ea..3d4de6f 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -21,6 +21,8 @@ #define PROGRAMNAME "h5repack" static int parse_command_line(int argc, const char **argv, pack_opt_t* options); +static void leave(int ret); + /* module-scoped variables */ static int has_i_o = 0; @@ -520,7 +522,6 @@ done: int main(int argc, const char **argv) { pack_opt_t options; /*the global options */ - int ret = -1; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index b844280..2b39249 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -189,7 +189,7 @@ int do_copy_refobjs(hid_t fidin, */ if((refname = MapIdToName(refobj_id, travt)) != NULL) { /* create the reference, -1 parameter for objects */ - if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, -1) < 0) + if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0) goto error; if(options->verbose) { diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 4510bd5..a32f33a 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -2271,7 +2271,7 @@ int make_deflate(hid_t loc_id) /* create a reference to the dataset, test second seeep of file for references */ - if (H5Rcreate(&bufref[0],loc_id,"dset_deflate",H5R_OBJECT,-1) < 0) + if (H5Rcreate(&bufref[0],loc_id,"dset_deflate",H5R_OBJECT,(hid_t)-1) < 0) goto out; if (write_dset(loc_id,1,dims1r,"ref",H5T_STD_REF_OBJ,bufref) < 0) goto out; @@ -3322,7 +3322,7 @@ int make_big(hid_t loc_id) goto out; /* initialize buffer to 0 */ - buf=(signed char *) calloc( nelmts, size); + buf=(signed char *) HDcalloc( nelmts, size); if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0) goto out; @@ -3769,7 +3769,7 @@ int write_dset_in(hid_t loc_id, buf4[1]=0; if (dset_name) { - if (H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,-1) < 0) + if (H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,(hid_t)-1) < 0) goto out; if (write_dset(loc_id,1,dims1r,"refobj",H5T_STD_REF_OBJ,buf4) < 0) goto out; @@ -3803,10 +3803,10 @@ int write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); + buf5[1].p = HDmalloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -3865,7 +3865,7 @@ int write_dset_in(hid_t loc_id, /* allocate and initialize array data to write */ size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double); - dbuf = (double*)malloc( size ); + dbuf = (double*)HDmalloc( size ); if (NULL == dbuf) { printf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); @@ -4004,7 +4004,7 @@ int write_dset_in(hid_t loc_id, /* Create references to dataset */ if (dset_name) { - if (H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, -1) < 0) + if (H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0) goto out; if (write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42) < 0) goto out; @@ -4039,7 +4039,7 @@ int write_dset_in(hid_t loc_id, { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) { @@ -4223,7 +4223,7 @@ int write_dset_in(hid_t loc_id, /* Create references to dataset */ if (dset_name) { - if (H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, -1) < 0) + if (H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0) goto out; if (write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43) < 0) goto out; @@ -4260,7 +4260,7 @@ int write_dset_in(hid_t loc_id, { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) { @@ -4390,8 +4390,8 @@ int make_dset_reg_ref(hid_t loc_id) int retval = -1; /* return value */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - dwbuf = (int *)malloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); + wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); /* Create dataspace for datasets */ if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) @@ -4681,9 +4681,9 @@ int write_attr_in(hid_t loc_id, /* object references ( H5R_OBJECT */ if (dset_name) { - if (H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1) < 0) + if (H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) goto out; - if (H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1) < 0) + if (H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) goto out; if (make_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4) < 0) goto out; @@ -4731,10 +4731,10 @@ int write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc(2 * sizeof(int)); + buf5[1].p = HDmalloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -4995,7 +4995,7 @@ int write_attr_in(hid_t loc_id, { for (j = 0; j < 2; j++) { - if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1) < 0) + if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) goto out; } } @@ -5051,7 +5051,7 @@ int write_attr_in(hid_t loc_id, for (j = 0; j < 2; j++) { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs)((int *)buf52[i][j].p)[l] = 0; @@ -5430,7 +5430,7 @@ int write_attr_in(hid_t loc_id, 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) + if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) goto out; } } @@ -5517,7 +5517,7 @@ int write_attr_in(hid_t loc_id, for (k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)i + 1; for (l = 0; l < i + 1; l++) if (make_diffs) @@ -5939,7 +5939,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) * add attribute with obj ref type */ /* ref to dset */ - status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,-1); + status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -5948,7 +5948,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) } /* ref to group */ - status = H5Rcreate(&data_attr_objref[1],file_id,NAME_OBJ_GRP,H5R_OBJECT,-1); + status = H5Rcreate(&data_attr_objref[1],file_id,NAME_OBJ_GRP,H5R_OBJECT,(hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -5957,7 +5957,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) } /* ref to datatype */ - status = H5Rcreate(&data_attr_objref[2],file_id,NAME_OBJ_NDTYPE,H5R_OBJECT,-1); + status = H5Rcreate(&data_attr_objref[2],file_id,NAME_OBJ_NDTYPE,H5R_OBJECT,(hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6210,7 +6210,7 @@ static herr_t gen_obj_ref(hid_t loc_id) * Passing -1 as reference is an object.*/ /* obj ref to dataset */ - status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, -1); + status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6219,7 +6219,7 @@ static herr_t gen_obj_ref(hid_t loc_id) } /* obj ref to group */ - status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, -1); + status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6228,7 +6228,7 @@ static herr_t gen_obj_ref(hid_t loc_id) } /* obj ref to named-datatype */ - status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, -1); + status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6650,7 +6650,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) * Create the object references into compound type */ /* references to dataset */ - status = H5Rcreate (&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT,-1); + status = H5Rcreate (&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT,(hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6660,7 +6660,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) comp_objref_data[0].val_int = 0; /* references to group */ - status = H5Rcreate (&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT,-1); + status = H5Rcreate (&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT,(hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6670,7 +6670,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) comp_objref_data[1].val_int = 10; /* references to datatype */ - status = H5Rcreate (&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT,-1); + status = H5Rcreate (&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT,(hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6743,17 +6743,17 @@ static herr_t make_complex_attr_references(hid_t loc_id) * prepare vlen data */ vlen_objref_data[0].len = LEN0_VLEN_OBJREF; - vlen_objref_data[0].p = malloc (vlen_objref_data[0].len * sizeof(hobj_ref_t)); + vlen_objref_data[0].p = HDmalloc (vlen_objref_data[0].len * sizeof(hobj_ref_t)); vlen_objref_data[1].len = LEN1_VLEN_OBJREF; - vlen_objref_data[1].p = malloc (vlen_objref_data[1].len * sizeof(hobj_ref_t)); + vlen_objref_data[1].p = HDmalloc (vlen_objref_data[1].len * sizeof(hobj_ref_t)); vlen_objref_data[2].len = LEN2_VLEN_OBJREF; - vlen_objref_data[2].p = malloc (vlen_objref_data[2].len * sizeof(hobj_ref_t)); + vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t)); /* * create obj references */ /* reference to dataset */ - status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, -1); + status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6761,7 +6761,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) goto out; } /* reference to group */ - status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, -1); + status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6769,7 +6769,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) goto out; } /* reference to datatype */ - status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, -1); + status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); @@ -6812,7 +6812,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) * prepare vlen data */ vlen_regref_data[0].len = LEN0_VLEN_REGREF; - vlen_regref_data[0].p = malloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); + vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); /* * create region reference diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index de36c19..a3a0d13 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -32,9 +32,9 @@ #define DEF_SIZE_SMALL_DSETS 10 #define DEF_SIZE_SMALL_ATTRS 10 -#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to - accommodate for user-define filters + one - to accomodate datasets whithout any filters */ +#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to + accommodate for user-define filters + one + to accomodate datasets whithout any filters */ @@ -855,7 +855,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) error_msg("Invalid threshold for small datasets\n"); goto error; } - } else + } else error_msg("Missing threshold for small datasets\n"); break; @@ -878,7 +878,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) goto error; } } else - error_msg("Missing threshold for small # of attributes\n"); + error_msg("Missing threshold for small # of attributes\n"); break; @@ -1592,9 +1592,9 @@ main(int argc, const char *argv[]) iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size; } /* end else */ - iter.num_small_groups = (unsigned long *)calloc((size_t)sgroups_threshold, sizeof(unsigned long)); - iter.num_small_attrs = (unsigned long *)calloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); - iter.small_dset_dims = (unsigned long *)calloc((size_t)sdsets_threshold, sizeof(unsigned long)); + iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); + iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); + iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index fb12408..a7b0e5e 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -844,18 +844,18 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); } } if (elmtno == 0 && secnum == 0 && info->line_1st) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); } else if (secnum && info->line_cont) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); } else { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); } templength = h5tools_str_len(&prefix); @@ -863,7 +863,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -937,22 +937,22 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) for (i = 0; i < indentlevel - 1; i++) { - PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); } if (elmtno == 0 && secnum == 0 && info->line_1st) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); } else if (secnum && info->line_cont) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); } else - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); templength = h5tools_str_len(&prefix); for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -1009,7 +1009,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, if (stream == NULL) return dimension_break; - s = h5tools_str_fmt(buffer, 0, "%s"); + s = h5tools_str_fmt(buffer, (size_t)0, "%s"); /* * If the element would split on multiple lines if printed at our @@ -1163,7 +1163,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, int secnum; /*section sequence number */ int multiline; /*datum was multiline */ - s = h5tools_str_fmt(buffer, 0, "%s"); + s = h5tools_str_fmt(buffer, (size_t)0, "%s"); /* * If the element would split on multiple lines if printed at our diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index f11065c..5ab066e 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1748,11 +1748,11 @@ CATCH */ int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - hid_t dset, hid_t _p_type, struct subset_t *sset) + hid_t dset, struct subset_t *sset) { - hid_t f_space; - hid_t p_type = _p_type; - hid_t f_type; + hid_t f_space = -1; + hid_t p_type = -1; + hid_t f_type = -1; H5S_class_t space_type; int status = FAIL; h5tool_format_t info_dflt; @@ -1765,26 +1765,26 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t * info = &info_dflt; } - if (p_type < 0) { - f_type = H5Dget_type(dset); - - if (info->raw || bin_form == 1) - p_type = H5Tcopy(f_type); - else if (bin_form == 2) - p_type = h5tools_get_little_endian_type(f_type); - else if (bin_form == 3) - p_type = h5tools_get_big_endian_type(f_type); - else - p_type = h5tools_get_native_type(f_type); + f_type = H5Dget_type(dset); + if (f_type < 0) + goto done; - H5Tclose(f_type); + if (info->raw || bin_form == 1) + p_type = H5Tcopy(f_type); + else if (bin_form == 2) + p_type = h5tools_get_little_endian_type(f_type); + else if (bin_form == 3) + p_type = h5tools_get_big_endian_type(f_type); + else + p_type = h5tools_get_native_type(f_type); - if (p_type < 0) - goto done; - } + if (p_type < 0) + goto done; /* Check the data space */ f_space = H5Dget_space(dset); + if (f_space < 0) + goto done; space_type = H5Sget_simple_extent_type(f_space); @@ -1799,12 +1799,13 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t * /* space is H5S_NULL */ status = SUCCEED; - /* Close the dataspace */ - H5Sclose(f_space); - done: - if (p_type != _p_type) + if (f_type > 0) + H5Tclose(f_type); + if (p_type > 0) H5Tclose(p_type); + if (f_space > 0) + H5Sclose(f_space); return status; } @@ -3859,7 +3860,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } else datactx.need_prefix = TRUE; - status = h5tools_dump_dset(stream, info, &datactx, obj_id, -1, sset); + status = h5tools_dump_dset(stream, info, &datactx, obj_id, sset); if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h index 061a3db..b05f226 100644 --- a/tools/lib/h5tools_dump.h +++ b/tools/lib/h5tools_dump.h @@ -40,7 +40,7 @@ H5TOOLS_DLL void h5tools_dump_init(void); H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t dset, - hid_t p_typ, struct subset_t *sset); + struct subset_t *sset); H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t obj_id, hid_t type, hid_t space, void *mem); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index d43fc33..ac191d6 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -352,7 +352,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, } /* Add prefix and suffix to the index */ - return h5tools_str_fmt(str, 0, OPT(info->idx_fmt, "%s: ")); + return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); } /*------------------------------------------------------------------------- @@ -412,7 +412,7 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, } /* Add prefix and suffix to the index */ - return h5tools_str_fmt(str, 0, OPT(info->idx_fmt, "%s: ")); + return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); } /*------------------------------------------------------------------------- diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 6b043ba..9c9153a 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -21,33 +21,31 @@ * * Purpose: Debugs an existing HDF5 file at a low level. * - * Modifications: - * *------------------------------------------------------------------------- */ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ -#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ +#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ #define H5D_PACKAGE /*suppress error about including H5Dpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ - -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5B2pkg.h" /* v2 B-trees */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FSprivate.h" /* Free space manager */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HFpkg.h" /* Fractal heaps */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMpkg.h" /* Implicitly shared messages */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5B2pkg.h" /* v2 B-trees */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FSprivate.h" /* Free space manager */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HFpkg.h" /* Fractal heaps */ +#include "H5HGprivate.h" /* Global Heaps */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMpkg.h" /* Implicitly shared messages */ /* File drivers */ #include "H5FDfamily.h" @@ -192,13 +190,13 @@ main(int argc, char *argv[]) * Parse command arguments. */ if(argc > 2) - addr = HDstrtoll(argv[2], NULL, 0); + addr = (haddr_t)HDstrtoll(argv[2], NULL, 0); if(argc > 3) - extra = HDstrtoll(argv[3], NULL, 0); + extra = (haddr_t)HDstrtoll(argv[3], NULL, 0); if(argc > 4) - extra2 = HDstrtoll(argv[4], NULL, 0); + extra2 = (haddr_t)HDstrtoll(argv[4], NULL, 0); if(argc > 5) - extra3 = HDstrtoll(argv[5], NULL, 0); + extra3 = (haddr_t)HDstrtoll(argv[5], NULL, 0); if(argc > 6) extra4 = (haddr_t)HDstrtoll(argv[6], NULL, 0); diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 07f6bfd..ffd52e8 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -290,7 +290,7 @@ main (int argc, char *argv[]) if (argno<argc) usage (prog_name); /* Now the real work, split the file */ - buf = malloc (blk_size); + buf = HDmalloc (blk_size); while (src_offset<src_size) { /* Read a block. The amount to read is the minimum of: @@ -498,6 +498,6 @@ main (int argc, char *argv[]) } /* Free resources and return */ - free (buf); + HDfree (buf); return EXIT_SUCCESS; } diff --git a/tools/misc/talign.c b/tools/misc/talign.c index 3fd1694..2d0a9d1 100644 --- a/tools/misc/talign.c +++ b/tools/misc/talign.c @@ -126,7 +126,7 @@ int main(void) H5Dclose(set); /* Now open the set, and read it back in */ - data = (char *)malloc(H5Tget_size(fix)); + data = (char *)HDmalloc(H5Tget_size(fix)); if(!data) { perror("malloc() failed"); @@ -192,7 +192,7 @@ out: } if(data) - free(data); + HDfree(data); H5Sclose(spc); H5Tclose(cmp); H5Tclose(cmp1); |