diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2014-07-30 20:56:40 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2014-07-30 20:56:40 (GMT) |
commit | e8c162613b75fb3b269830defa769728f439db72 (patch) | |
tree | 7c02108c8d1012fb7e8a2b54c5503a5c2f5c019c /hl/src | |
parent | ff1a9ae0e74ded0274729313ba24df578ffaf678 (diff) | |
download | hdf5-e8c162613b75fb3b269830defa769728f439db72.zip hdf5-e8c162613b75fb3b269830defa769728f439db72.tar.gz hdf5-e8c162613b75fb3b269830defa769728f439db72.tar.bz2 |
[svn-r25497] Description:
Merge changes that correspond to the 64-bit ID changes (without the actual
switch to 64-bit IDs) to the 1.8 release branch. (Plus a few minor cleanups
and alignments with the trunk that aren't on the branch)
Tested on:
Mac OSX/64 10.9.4 (amazon) w/C++ & FORTRAN
(h5committested on branch already for a week)
Diffstat (limited to 'hl/src')
-rw-r--r-- | hl/src/H5DS.c | 103 | ||||
-rw-r--r-- | hl/src/H5DSprivate.h | 2 | ||||
-rw-r--r-- | hl/src/H5HLprivate2.h | 40 | ||||
-rw-r--r-- | hl/src/H5IM.c | 16 | ||||
-rw-r--r-- | hl/src/H5LTanalyze.l | 75 | ||||
-rw-r--r-- | hl/src/H5LTparse.y | 141 | ||||
-rw-r--r-- | hl/src/H5LTprivate.h | 2 | ||||
-rw-r--r-- | hl/src/H5PT.c | 36 | ||||
-rw-r--r-- | hl/src/H5TB.c | 34 |
9 files changed, 217 insertions, 232 deletions
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) |