diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5P.c | 10 | ||||
-rw-r--r-- | src/H5Pfapl.c | 114 | ||||
-rw-r--r-- | src/H5Pfcpl.c | 2 | ||||
-rw-r--r-- | src/H5Pgcpl.c | 18 | ||||
-rw-r--r-- | src/H5Pint.c | 210 | ||||
-rw-r--r-- | src/H5Plapl.c | 9 | ||||
-rw-r--r-- | src/H5Pocpl.c | 55 | ||||
-rw-r--r-- | src/H5Pocpypl.c | 201 | ||||
-rw-r--r-- | src/H5Ppkg.h | 7 | ||||
-rw-r--r-- | src/H5Pprivate.h | 2 | ||||
-rw-r--r-- | src/H5Pstrcpl.c | 33 | ||||
-rw-r--r-- | src/H5Zprivate.h | 2 | ||||
-rw-r--r-- | src/H5Ztrans.c | 8 |
13 files changed, 335 insertions, 336 deletions
@@ -990,8 +990,13 @@ H5Pequal(hid_t id1, hid_t id2) /* Compare property lists */ if(H5I_GENPROP_LST == H5I_get_type(id1)) { - if(H5P_cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2) == 0) - ret_value = TRUE; + int cmp_ret = 0; + + if(H5P_cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOMPARE, FAIL, "can't compare property lists") + + /* Set return value */ + ret_value = cmp_ret == 0 ? TRUE : FALSE; } /* end if */ /* Must be property classes */ else { @@ -1062,6 +1067,7 @@ done: void *udata; IN/OUT: Pointer to iteration data from user RETURNS Success: Returns the return value of the last call to ITER_FUNC + Failure: negative value DESCRIPTION This routine calls the actual callback routine for the property in the property list or class. diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 9707357..889cdc6 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -67,7 +67,7 @@ #define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF (1024*1024) /* Definition for preemption read chunks first */ #define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) -#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75 +#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75f /* Definition for threshold for alignment */ #define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t) #define H5F_ACS_ALIGN_THRHD_DEF 1 @@ -155,6 +155,7 @@ static herr_t H5P_file_image_info_del(hid_t prop_id, const char *name, size_t si static herr_t H5P_file_image_info_copy(const char *name, size_t size, void *value); static herr_t H5P_file_image_info_close(const char *name, size_t size, void *value); + /*********************/ /* Package Variables */ /*********************/ @@ -508,18 +509,18 @@ H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment) H5TRACE3("e", "ihh", fapl_id, threshold, alignment); /* Check args */ - if (alignment<1) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "alignment must be positive"); + if(alignment < 1) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "alignment must be positive") /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ if(H5P_set(plist, H5F_ACS_ALIGN_THRHD_NAME, &threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set threshold"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set threshold") if(H5P_set(plist, H5F_ACS_ALIGN_NAME, &alignment) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment") done: FUNC_LEAVE_API(ret_value) @@ -692,10 +693,10 @@ H5P_get_driver(H5P_genplist_t *plist) /* Get the current driver ID */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if(H5FD_VFD_DEFAULT == ret_value) ret_value = H5_DEFAULT_VFD; @@ -1002,17 +1003,6 @@ done: * Programmer: Robb Matzke * Tuesday, May 19, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property list. - * - * J. Mainzer - * Thurs. 3/17/05 - * The mdc_nelmts entry is no more in the FAPL, so I modified - * the code to ignore it. - * *------------------------------------------------------------------------- */ herr_t @@ -1027,24 +1017,24 @@ H5Pset_cache(hid_t plist_id, int UNUSED mdc_nelmts, rdcc_w0); /* Check arguments */ - if (rdcc_w0<0.0 || rdcc_w0>1.0) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive"); + if(rdcc_w0 < 0.0 || rdcc_w0 > 1.0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive") /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set sizes */ if(H5P_set(plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache number of slots"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache number of slots") if(H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size") if(H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_cache() */ /*------------------------------------------------------------------------- @@ -1061,18 +1051,6 @@ done: * Programmer: Robb Matzke * Tuesday, May 19, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * - * J Mainzer - * Thurs, 3/17/05 - * The mdc_nelmts fapl entry is no more, so we now just - * return a constant when that value is requested. - * *------------------------------------------------------------------------- */ herr_t @@ -1088,27 +1066,27 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get sizes */ /* the mdc_nelmts FAPL entry no longer exists, so just return a constant */ - if (mdc_nelmts) + if(mdc_nelmts) *mdc_nelmts = 0; - if (rdcc_nslots) + if(rdcc_nslots) if(H5P_get(plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, rdcc_nslots) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache number of slots"); - if (rdcc_nbytes) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache number of slots") + if(rdcc_nbytes) if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size"); - if (rdcc_w0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size") + if(rdcc_w0) if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_cache() */ /*------------------------------------------------------------------------- @@ -1248,11 +1226,11 @@ H5Pset_gc_references(hid_t plist_id, unsigned gc_ref) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ if(H5P_set(plist, H5F_ACS_GARBG_COLCT_REF_NAME, &gc_ref) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference") done: FUNC_LEAVE_API(ret_value) @@ -1290,12 +1268,12 @@ H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref/*out*/) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get values */ - if (gc_ref) + if(gc_ref) if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME, gc_ref) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get garbage collect reference"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get garbage collect reference") done: FUNC_LEAVE_API(ret_value) @@ -1413,11 +1391,11 @@ H5Pset_meta_block_size(hid_t plist_id, hsize_t size) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ if(H5P_set(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data block size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data block size") done: FUNC_LEAVE_API(ret_value) @@ -1455,12 +1433,12 @@ H5Pget_meta_block_size(hid_t plist_id, hsize_t *size/*out*/) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get values */ - if (size) { + if(size) { if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size") } /* end if */ done: @@ -1508,11 +1486,11 @@ H5Pset_sieve_buf_size(hid_t plist_id, size_t size) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ if(H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size") done: FUNC_LEAVE_API(ret_value) @@ -1550,12 +1528,12 @@ H5Pget_sieve_buf_size(hid_t plist_id, size_t *size/*out*/) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get values */ - if (size) + if(size) if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size") done: FUNC_LEAVE_API(ret_value) @@ -1597,11 +1575,11 @@ H5Pset_small_data_block_size(hid_t plist_id, hsize_t size) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ if(H5P_set(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' block size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' block size") done: FUNC_LEAVE_API(ret_value) @@ -1634,12 +1612,12 @@ H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size/*out*/) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get values */ - if (size) { + if(size) { if(H5P_get(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'small data' block size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'small data' block size") } /* end if */ done: @@ -1911,7 +1889,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) /* validate parameters */ if(!(((buf_ptr == NULL) && (buf_len == 0)) || ((buf_ptr != NULL) && (buf_len > 0)))) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistant buf_ptr and buf_len"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistant buf_ptr and buf_len") /* Get the plist structure */ if(NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index cd6a7cd..21d45df 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -99,6 +99,7 @@ /* Property class callbacks */ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); + /*********************/ /* Package Variables */ /*********************/ @@ -207,6 +208,7 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) /* Register the free space section threshold */ if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &free_space_threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_fcrt_reg_prop() */ diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 737976e..394cf8b 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -58,7 +58,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_gcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass); /*********************/ @@ -72,7 +72,7 @@ const H5P_libclass_t H5P_CLS_GCRT[1] = {{ &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */ &H5P_CLS_GROUP_CREATE_g, /* Pointer to class ID */ &H5P_LST_GROUP_CREATE_g, /* Pointer to default property list ID */ - H5P_gcrt_reg_prop, /* Default property registration routine */ + H5P__gcrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ NULL, /* Class copy callback */ @@ -94,7 +94,7 @@ const H5P_libclass_t H5P_CLS_GCRT[1] = {{ /*------------------------------------------------------------------------- - * Function: H5P_gcrt_reg_prop + * Function: H5P__gcrt_reg_prop * * Purpose: Initialize the group creation property list class * @@ -105,25 +105,25 @@ const H5P_libclass_t H5P_CLS_GCRT[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5P_gcrt_reg_prop(H5P_genclass_t *pclass) +H5P__gcrt_reg_prop(H5P_genclass_t *pclass) { H5O_ginfo_t ginfo = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */ H5O_linfo_t linfo = H5G_CRT_LINK_INFO_DEF; /* Default link info settings */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register group info property */ if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &ginfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register link info property */ if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &linfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_gcrt_reg_prop() */ +} /* end H5P__gcrt_reg_prop() */ /*------------------------------------------------------------------------- @@ -156,7 +156,7 @@ H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") /* Update field */ - ginfo.lheap_size_hint = size_hint; + H5_ASSIGN_OVERFLOW(ginfo.lheap_size_hint, size_hint, size_t, uint32_t); /* Set value */ if(H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) diff --git a/src/H5Pint.c b/src/H5Pint.c index b2d5860..57fe001 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -59,7 +59,7 @@ typedef struct { typedef struct { H5P_iterate_int_t cb_func; /* Iterator callback */ void *udata; /* Iterator callback pointer */ - H5P_genplist_t *plist; /* Property list pointer */ + const H5P_genplist_t *plist; /* Property list pointer */ H5SL_t *seen; /* Skip list to hold names of properties already seen */ int *curr_idx_ptr; /* Pointer to current iteration index */ int prev_idx; /* Previous iteration index */ @@ -73,6 +73,12 @@ typedef struct { int prev_idx; /* Previous iteration index */ } H5P_iter_pclass_ud_t; +/* Typedef for property list comparison callback */ +typedef struct { + const H5P_genplist_t *plist2; /* Pointer to second property list */ + int cmp_value; /* Value from property comparison */ +} H5P_plist_cmp_ud_t; + /********************/ /* Local Prototypes */ @@ -1101,7 +1107,7 @@ done: Internal routine to check for a property in a property list's skip list USAGE H5P_genprop_t *H5P_find_prop(plist, name) - H5P_genplist_t *plist; IN: Pointer to property list to check + const H5P_genplist_t *plist; IN: Pointer to property list to check const char *name; IN: Name of property to check for RETURNS Returns pointer to property on success, NULL on failure. @@ -1113,7 +1119,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genprop_t * -H5P__find_prop_plist(H5P_genplist_t *plist, const char *name) +H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) { H5P_genprop_t *ret_value; /* Property pointer return value */ @@ -2572,7 +2578,7 @@ done: Internal routine to query the existance of a property in a property list. USAGE herr_t H5P_exist_plist(plist, name) - H5P_genplist_t *plist; IN: Property list to check + const H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to check for RETURNS Success: Positive if the property exists in the property list, zero @@ -2587,7 +2593,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5P_exist_plist(H5P_genplist_t *plist, const char *name) +H5P_exist_plist(const H5P_genplist_t *plist, const char *name) { htri_t ret_value = FAIL; /* return value */ @@ -2687,7 +2693,7 @@ done: Internal routine to query the size of a property in a property list. USAGE herr_t H5P_get_size_plist(plist, name) - H5P_genplist_t *plist; IN: Property list to check + const H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query size_t *size; OUT: Size of property RETURNS @@ -2703,7 +2709,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size) +H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ @@ -3086,105 +3092,141 @@ done: /*-------------------------------------------------------------------------- NAME + H5P__cmp_plist_cb + PURPOSE + Internal callback routine when iterating over properties in property list + to compare them for equality + USAGE + int H5P__cmp_plist_cb(prop, udata) + H5P_genprop_t *prop; IN: Pointer to the property + void *udata; IN/OUT: Pointer to iteration data from user + RETURNS + Success: Returns whether to continue (H5_ITER_CONT) or stop (H5_ITER_STOP) + iterating over the property lists. + Failure: Negative value (H5_ITER_ERROR) + DESCRIPTION + This routine compares a property from one property list (the one being + iterated over, to a property from the second property list (which is + looked up). Iteration is stopped if the comparison is non-equal. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static int +H5P__cmp_plist_cb(H5P_genprop_t *prop, void *_udata) +{ + H5P_plist_cmp_ud_t *udata = (H5P_plist_cmp_ud_t *)_udata; /* Pointer to user data */ + htri_t prop2_exist; /* Whether the property exists in the second property list */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(prop); + HDassert(udata); + + /* Check if the property exists in the second property list */ + if((prop2_exist = H5P_exist_plist(udata->plist2, prop->name)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "can't lookup existance of property?") + if(prop2_exist) { + const H5P_genprop_t *prop2; /* Pointer to property in second plist */ + + /* Look up same property in second property list */ + if(NULL == (prop2 = H5P__find_prop_plist(udata->plist2, prop->name))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "property doesn't exist") + + /* Compare the two properties */ + if((udata->cmp_value = H5P_cmp_prop(prop, prop2)) != 0) + HGOTO_DONE(H5_ITER_STOP); + } /* end if */ + else { + /* Property exists in first list, but not second */ + udata->cmp_value = 1; + HGOTO_DONE(H5_ITER_STOP); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__cmp_plist_cb() */ + + +/*-------------------------------------------------------------------------- + NAME H5P_cmp_plist PURPOSE Internal routine to compare two generic property lists USAGE - int H5P_cmp_plist(plist1, plist2) + herr_t H5P_cmp_plist(plist1, plist2, cmp_ret) H5P_genplist_t *plist1; IN: 1st property list to compare H5P_genplist_t *plist2; IN: 2nd property list to compare + int *cmp_ret; OUT: Comparison value for two property lists + Negative if list1 "less" than list2, + positive if list1 "greater" than list2, + zero if list1 is "equal" to list2 RETURNS - Success: negative if list1 "less" than list2, positive if list1 "greater" - than list2, zero if list1 is "equal" to list2 - Failure: can't fail + Success: non-negative value + Failure: negative value DESCRIPTION This function compares two generic property lists together to see if - they are the same list. - + they are equal. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -int -H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2) +herr_t +H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, + int *cmp_ret) { - H5SL_node_t *tnode1, *tnode2; /* Temporary pointer to property nodes */ - int cmp_value; /* Value from comparison */ - int ret_value = 0; /* return value */ + H5P_plist_cmp_ud_t udata; /* User data for callback */ + int idx = 0; /* Index of property to begin with */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT HDassert(plist1); HDassert(plist2); + HDassert(cmp_ret); /* Check the number of properties */ - if(plist1->nprops < plist2->nprops) HGOTO_DONE(-1); - if(plist1->nprops > plist2->nprops) HGOTO_DONE(1); + if(plist1->nprops < plist2->nprops) { + *cmp_ret = -1; + HGOTO_DONE(SUCCEED); + } /* end if */ + if(plist1->nprops > plist2->nprops) { + *cmp_ret = 1; + HGOTO_DONE(SUCCEED); + } /* end if */ /* Check whether they've been initialized */ - if(plist1->class_init < plist2->class_init) HGOTO_DONE(-1); - if(plist1->class_init > plist2->class_init) HGOTO_DONE(1); - - /* Check for identical deleted properties */ - if(H5SL_count(plist1->del) > 0) { - /* Check for no deleted properties in plist2 */ - if(H5SL_count(plist2->del) == 0) HGOTO_DONE(1); - - tnode1 = H5SL_first(plist1->del); - tnode2 = H5SL_first(plist2->del); - while(tnode1 || tnode2) { - const char *name1, *name2; /* Name for node */ - - /* Check if they both have properties in this node */ - if(tnode1 == NULL && tnode2 != NULL) HGOTO_DONE(-1); - if(tnode1 != NULL && tnode2 == NULL) HGOTO_DONE(1); - - /* Compare the two deleted properties */ - name1 = (const char *)H5SL_item(tnode1); - name2 = (const char *)H5SL_item(tnode2); - if((cmp_value = HDstrcmp(name1, name2)) != 0) - HGOTO_DONE(cmp_value); - - /* Advance the pointers */ - tnode1 = H5SL_next(tnode1); - tnode2 = H5SL_next(tnode2); - } /* end while */ + if(plist1->class_init < plist2->class_init) { + *cmp_ret = -1; + HGOTO_DONE(SUCCEED); } /* end if */ - else - if(H5SL_count(plist2->del) > 0) HGOTO_DONE (-1); - - /* Cycle through the changed properties and compare them also */ - if(H5SL_count(plist1->props) > 0) { - /* Check for no changed properties in plist2 */ - if(H5SL_count(plist2->props) == 0) HGOTO_DONE(1); - - tnode1 = H5SL_first(plist1->props); - tnode2 = H5SL_first(plist2->props); - while(tnode1 || tnode2) { - H5P_genprop_t *prop1, *prop2; /* Property for node */ - - /* Check if they both have properties in this node */ - if(tnode1 == NULL && tnode2 != NULL) HGOTO_DONE(-1); - if(tnode1 != NULL && tnode2 == NULL) HGOTO_DONE(1); - - /* Compare the two properties */ - prop1 = (H5P_genprop_t *)H5SL_item(tnode1); - prop2 = (H5P_genprop_t *)H5SL_item(tnode2); - if((cmp_value = H5P_cmp_prop(prop1, prop2)) != 0) - HGOTO_DONE(cmp_value); - - /* Advance the pointers */ - tnode1 = H5SL_next(tnode1); - tnode2 = H5SL_next(tnode2); - } /* end while */ + if(plist1->class_init > plist2->class_init) { + *cmp_ret = 1; + HGOTO_DONE(SUCCEED); + } /* end if */ + + /* Set up iterator callback info */ + udata.cmp_value = 0; + udata.plist2 = plist2; + + /* Iterate over properties in first property list */ + if((ret_value = H5P_iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list") + if(ret_value != 0) { + *cmp_ret = udata.cmp_value; + HGOTO_DONE(SUCCEED); } /* end if */ - else - if(H5SL_count(plist2->props)>0) HGOTO_DONE (-1); /* Check the parent classes */ - if((cmp_value = H5P_cmp_class(plist1->pclass, plist2->pclass)) != 0) - HGOTO_DONE(cmp_value); + if((*cmp_ret = H5P_cmp_class(plist1->pclass, plist2->pclass)) != 0) + HGOTO_DONE(SUCCEED); + + /* Property lists must be equal, set comparison value to 0 */ + *cmp_ret = 0; done: FUNC_LEAVE_NOAPI(ret_value) @@ -3363,7 +3405,7 @@ H5P__iterate_plist_cb(void *_item, void *_key, void *_udata) H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */ char *key = (char *)_key; /* Pointer to the property's name */ H5P_iter_plist_ud_t *udata = (H5P_iter_plist_ud_t *)_udata; /* Pointer to user data */ - int ret_value = 0; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -3382,9 +3424,9 @@ H5P__iterate_plist_cb(void *_item, void *_key, void *_udata) /* Increment the current index */ (*udata->curr_idx_ptr)++; - /* Add property name to "seen" list */ + /* Add property name to 'seen' list */ if(H5SL_insert(udata->seen, key, key) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert property into 'seen' skip list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3417,7 +3459,7 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata) H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */ char *key = (char *)_key; /* Pointer to the property's name */ H5P_iter_plist_ud_t *udata = (H5P_iter_plist_ud_t *)_udata; /* Pointer to user data */ - int ret_value = 0; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -3662,7 +3704,7 @@ H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, int curr_idx = 0; /* Current iteration index */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(pclass); diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 8d8ee15..0697130 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -48,6 +48,7 @@ /* Definitions for number of soft links to traverse */ #define H5L_ACS_NLINKS_SIZE sizeof(size_t) #define H5L_ACS_NLINKS_DEF H5L_NUM_LINKS /*max symlinks to follow per lookup */ + /* Definitions for external link prefix */ #define H5L_ACS_ELINK_PREFIX_SIZE sizeof(char *) #define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */ @@ -297,8 +298,12 @@ H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t UNUSED si /* Check for NULL property lists */ if(obj1 == NULL && obj2 != NULL) HGOTO_DONE(1); if(obj1 != NULL && obj2 == NULL) HGOTO_DONE(-1); - if(obj1 && obj2) - ret_value = H5P_cmp_plist(obj1, obj2); + if(obj1 && obj2) { + herr_t status; + + status = H5P_cmp_plist(obj1, obj2, &ret_value); + HDassert(status >= 0); + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 024f79b..5eba335 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -54,7 +54,7 @@ #define H5O_CRT_OHDR_FLAGS_SIZE sizeof(uint8_t) /* Definitions for filter pipeline */ #define H5O_CRT_PIPELINE_SIZE sizeof(H5O_pline_t) -#define H5O_CRT_PIPELINE_CMP H5P_ocrt_pipeline_cmp +#define H5O_CRT_PIPELINE_CMP H5P__ocrt_pipeline_cmp /******************/ @@ -72,12 +72,12 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_ocrt_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P_ocrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); -static herr_t H5P_ocrt_close(hid_t dxpl_id, void *close_data); +static herr_t H5P__ocrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__ocrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); +static herr_t H5P__ocrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ -static int H5P_ocrt_pipeline_cmp(const void *value1, const void *value2, size_t size); +static int H5P__ocrt_pipeline_cmp(const void *value1, const void *value2, size_t size); /*********************/ @@ -91,12 +91,12 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class ID */ NULL, /* Pointer to default property list ID */ - H5P_ocrt_reg_prop, /* Default property registration routine */ + H5P__ocrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P_ocrt_copy, /* Class copy callback */ + H5P__ocrt_copy, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P_ocrt_close, /* Class close callback */ + H5P__ocrt_close, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -114,7 +114,7 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ /*------------------------------------------------------------------------- - * Function: H5P_ocrt_reg_prop + * Function: H5P__ocrt_reg_prop * * Purpose: Initialize the object creation property list class * @@ -126,7 +126,7 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5P_ocrt_reg_prop(H5P_genclass_t *pclass) +H5P__ocrt_reg_prop(H5P_genclass_t *pclass) { unsigned attr_max_compact = H5O_CRT_ATTR_MAX_COMPACT_DEF; /* Default max. compact attribute storage settings */ unsigned attr_min_dense = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */ @@ -134,7 +134,7 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass) H5O_pline_t pline = H5O_CRT_PIPELINE_DEF; /* Default I/O pipeline setting */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register max. compact attribute storage property */ if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) @@ -150,15 +150,15 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass) /* Register the pipeline property */ if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocrt_reg_prop() */ +} /* end H5P__ocrt_reg_prop() */ /*------------------------------------------------------------------------- - * Function: H5P_ocrt_copy + * Function: H5P__ocrt_copy * * Purpose: Callback routine which is called whenever any object * creation property list is copied. This routine copies @@ -174,14 +174,14 @@ done: */ /* ARGSUSED */ static herr_t -H5P_ocrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) +H5P__ocrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) { H5O_pline_t src_pline, dst_pline; /* Source & destination pipelines */ H5P_genplist_t *src_plist; /* Pointer to source property list */ H5P_genplist_t *dst_plist; /* Pointer to destination property list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Verify property list IDs */ if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) @@ -203,11 +203,11 @@ H5P_ocrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocrt_copy() */ +} /* end H5P__ocrt_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_ocrt_close + * Function: H5P__ocrt_close * * Purpose: Callback routine which is called whenever any object create * property list is closed. This routine performs any generic @@ -223,13 +223,13 @@ done: */ /* ARGSUSED */ static herr_t -H5P_ocrt_close(hid_t dcpl_id, void UNUSED *close_data) +H5P__ocrt_close(hid_t dcpl_id, void UNUSED *close_data) { H5O_pline_t pline; /* I/O pipeline */ H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) @@ -245,7 +245,7 @@ H5P_ocrt_close(hid_t dcpl_id, void UNUSED *close_data) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocrt_close() */ +} /* end H5P__ocrt_close() */ /*------------------------------------------------------------------------- @@ -1330,7 +1330,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, /*------------------------------------------------------------------------- - * Function: H5P_ocrt_pipeline_cmp + * Function: H5P__ocrt_pipeline_cmp * * Purpose: Callback routine which is called whenever a filter pipeline * property in a property list is compared. @@ -1345,24 +1345,20 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, *------------------------------------------------------------------------- */ static int -H5P_ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size) +H5P__ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size) { const H5O_pline_t *pline1 = (const H5O_pline_t *)_pline1, /* Create local aliases for values */ *pline2 = (const H5O_pline_t *)_pline2; int cmp_value; /* Value from comparison */ herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(pline1); HDassert(pline2); HDassert(size == sizeof(H5O_pline_t)); - /* Check the number of allocated pipeline entries */ - if(pline1->nalloc < pline2->nalloc) HGOTO_DONE(-1); - if(pline1->nalloc > pline2->nalloc) HGOTO_DONE(1); - /* Check the number of used pipeline entries */ if(pline1->nused < pline2->nused) HGOTO_DONE(-1); if(pline1->nused > pline2->nused) HGOTO_DONE(1); @@ -1412,7 +1408,7 @@ H5P_ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED si done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocrt_pipeline_cmp() */ +} /* end H5P__ocrt_pipeline_cmp() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1566,6 +1562,5 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_filter_by_id1() */ - #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index adea906..0ba5625 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -52,11 +52,14 @@ /* Definitions for merge committed dtype list */ #define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(char *) #define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL -#define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P_ocpy_merge_comm_dt_list_cmp +#define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy +#define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp +#define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close /* Definitions for callback function when completing the search for a matching committed datatype from the committed dtype list */ #define H5O_CPY_MCDT_SEARCH_CB_SIZE sizeof(H5O_mcdt_cb_info_t) #define H5O_CPY_MCDT_SEARCH_CB_DEF {NULL,NULL} + /******************/ /* Local Typedefs */ /******************/ @@ -72,16 +75,15 @@ /********************/ /* General routines */ -static H5O_copy_dtype_merge_list_t *H5P_free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list); +static H5O_copy_dtype_merge_list_t *H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list); /* Property class callbacks */ -static herr_t H5P_ocpy_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P_ocpy_copy(hid_t dst_plist_id, hid_t src_plist_id, - void *copy_data); -static herr_t H5P_ocpy_close(hid_t ocpypl_id, void *close_data); +static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static int H5P_ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char* name, size_t size, void* value); +static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size, void* value); /*********************/ @@ -95,12 +97,12 @@ const H5P_libclass_t H5P_CLS_OCPY[1] = {{ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */ &H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */ - H5P_ocpy_reg_prop, /* Default property registration routine */ + H5P__ocpy_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P_ocpy_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P_ocpy_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -120,7 +122,7 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t); /*------------------------------------------------------------------------- - * Function: H5P_ocpy_reg_prop + * Function: H5P__ocpy_reg_prop * * Purpose: Initialize the object copy property list class * @@ -131,21 +133,21 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t); *------------------------------------------------------------------------- */ static herr_t -H5P_ocpy_reg_prop(H5P_genclass_t *pclass) +H5P__ocpy_reg_prop(H5P_genclass_t *pclass) { unsigned ocpy_option = H5O_CPY_OPTION_DEF; /* Default object copy flags */ H5O_copy_dtype_merge_list_t *merge_comm_dtype_list = H5O_CPY_MERGE_COMM_DT_LIST_DEF; /* Default merge committed dtype list */ H5O_mcdt_cb_info_t mcdt_cb = H5O_CPY_MCDT_SEARCH_CB_DEF; /* Default callback before searching the global list of committed datatypes at destination */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Register copy options property */ if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register merge named dtype list property */ - if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_CMP, NULL) < 0) + if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ @@ -154,47 +156,68 @@ H5P_ocpy_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_reg_prop() */ +} /* end H5P__ocpy_reg_prop() */ /*------------------------------------------------------------------------- - * Function: H5P_ocpy_copy - * - * Purpose: Callback routine which is called whenever any object - * copy property list is copied. This routine copies - * the properties from the old list to the new list. + * Function: H5P__free_merge_comm_dtype_list * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Frees the provided merge named dtype list * - * Programmer: Neil Fortner - * Friday, October 28, 2011 + * Return: NULL * + * Programmer: Neil Fortner + * October 27, 2011 *------------------------------------------------------------------------- */ +static H5O_copy_dtype_merge_list_t * +H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) +{ + H5O_copy_dtype_merge_list_t *tmp_node; + + FUNC_ENTER_STATIC_NOERR + + /* Free the list */ + while(dt_list) { + tmp_node = dt_list->next; + (void)H5MM_xfree(dt_list->path); + (void)H5FL_FREE(H5O_copy_dtype_merge_list_t, dt_list); + dt_list = tmp_node; + } /* end while */ + + FUNC_LEAVE_NOAPI(NULL); +} /* H5P__free_merge_comm_dtype_list */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_copy + * + * Purpose: Copy the merge committed datatype list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *-------------------------------------------------------------------------- + */ /* ARGSUSED */ static herr_t -H5P_ocpy_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) +H5P__ocpy_merge_comm_dt_list_copy(const char UNUSED *name, size_t UNUSED size, + void *value) { - H5O_copy_dtype_merge_list_t *src_dt_list, *dst_dt_list = NULL; /* Source & destination merge named datatype lists */ + const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */ + H5O_copy_dtype_merge_list_t *dst_dt_list = NULL; /* Destination merge named datatype lists */ H5O_copy_dtype_merge_list_t *dst_dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */ - H5P_genplist_t *src_plist; /* Pointer to source property list */ - H5P_genplist_t *dst_plist; /* Pointer to destination property list */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - /* Verify property list IDs */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object copy property list") - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object copy property list") - - /* Get the merge committed dtype list property from the old property list */ - if(H5P_get(src_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &src_dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list") + HDassert(value); /* Make copy of merge committed dtype list */ + src_dt_list = *(const H5O_copy_dtype_merge_list_t **)value; while(src_dt_list) { /* Copy src_dt_list */ if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) @@ -217,14 +240,12 @@ H5P_ocpy_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) src_dt_list = src_dt_list->next; } /* end while */ - /* Set the merge named dtype list property for the destination property list - */ - if(H5P_set(dst_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dst_dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge committed dtype list") + /* Set the merge named dtype list property for the destination property list */ + *(H5O_copy_dtype_merge_list_t **)value = dst_dt_list; done: if(ret_value < 0) { - dst_dt_list = H5P_free_merge_comm_dtype_list(dst_dt_list); + dst_dt_list = H5P__free_merge_comm_dtype_list(dst_dt_list); if(tmp_dt_list) { tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path); tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list); @@ -232,53 +253,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_ocpy_close - * - * Purpose: Callback routine which is called whenever any object copy - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the - * list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * Friday, October 28, 2011 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_ocpy_close(hid_t ocpypl_id, void UNUSED *close_data) -{ - H5O_copy_dtype_merge_list_t *dt_list; /* Merge named datatype list */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(ocpypl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object copy property list") - - /* Get the merge named dtype list property from the old property list */ - if(H5P_get(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list") - - /* Free the merge named dtype list */ - dt_list = H5P_free_merge_comm_dtype_list(dt_list); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_close() */ +} /* end H5P__ocpy_merge_comm_dt_list_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_ocpy_merge_comm_dt_list_cmp + * Function: H5P__ocpy_merge_comm_dt_list_cmp * * Purpose: Callback routine which is called whenever the merge * named dtype property in the object copy property list @@ -294,14 +273,14 @@ done: *------------------------------------------------------------------------- */ static int -H5P_ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, +H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, size_t UNUSED size) { const H5O_copy_dtype_merge_list_t *dt_list1 = *(H5O_copy_dtype_merge_list_t * const *)_dt_list1, /* Create local aliases for values */ *dt_list2 = *(H5O_copy_dtype_merge_list_t * const *)_dt_list2; herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(_dt_list1); @@ -326,37 +305,35 @@ H5P_ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_ocpy_merge_comm_dt_list_cmp() */ +} /* end H5P__ocpy_merge_comm_dt_list_cmp() */ -/*------------------------------------------------------------------------- - * Function: H5P_free_merge_comm_dtype_list +/*-------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_close * - * Purpose: Frees the provided merge named dtype list + * Purpose: Close the merge common datatype list property * - * Return: NULL + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Neil Fortner - * October 27, 2011 - *------------------------------------------------------------------------- + * Programmer: Quincey Koziol + * Friday, August 31, 2012 + * + *--------------------------------------------------------------------------- */ -static H5O_copy_dtype_merge_list_t * -H5P_free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) +/* ARGSUSED */ +static herr_t +H5P__ocpy_merge_comm_dt_list_close(const char UNUSED *name, size_t UNUSED size, void *value) { - H5O_copy_dtype_merge_list_t *tmp_node; + FUNC_ENTER_STATIC_NOERR - FUNC_ENTER_NOAPI_NOINIT + HDassert(value); - /* Free the list */ - while(dt_list) { - tmp_node = dt_list->next; - (void)H5MM_xfree(dt_list->path); - (void)H5FL_FREE(H5O_copy_dtype_merge_list_t, dt_list); - dt_list = tmp_node; - } /* end while */ + /* Free the merge named dtype list */ + H5P__free_merge_comm_dtype_list(*(H5O_copy_dtype_merge_list_t **)value); - FUNC_LEAVE_NOAPI(NULL); -} /* H5P_free_merge_comm_dtype_list */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__ocpy_merge_comm_dt_list_close() */ /*------------------------------------------------------------------------- @@ -541,7 +518,7 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed dtype list") /* Free dtype list */ - dt_list = H5P_free_merge_comm_dtype_list(dt_list); + dt_list = H5P__free_merge_comm_dtype_list(dt_list); /* Update the list stored in the property list (to NULL) */ if(H5P_set(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 803abfd..7768eec 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -171,14 +171,15 @@ H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t siz H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); H5_DLL htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name); -H5_DLL herr_t H5P_get_size_plist(H5P_genplist_t *plist, const char *name, +H5_DLL herr_t H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size); H5_DLL herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size); H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist); H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); -H5_DLL int H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2); +H5_DLL herr_t H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, + int *cmp_ret); H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, H5P_iterate_int_t iter_func, void *iter_data); H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, @@ -193,7 +194,7 @@ H5_DLL herr_t H5P_close_class(void *_pclass); H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); -H5_DLL H5P_genprop_t *H5P__find_prop_plist(H5P_genplist_t *plist, const char *name); +H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name); /* Testing functions */ #ifdef H5P_TESTING diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 849a533..c750070 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -87,7 +87,7 @@ H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); H5_DLL herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name); -H5_DLL htri_t H5P_exist_plist(H5P_genplist_t *plist, const char *name); +H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 8573985..505e35f 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -63,7 +63,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_strcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass); /*********************/ @@ -77,7 +77,7 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_STRING_CREATE_g, /* Pointer to class ID */ NULL, /* Pointer to default property list ID */ - H5P_strcrt_reg_prop, /* Default property registration routine */ + H5P__strcrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ NULL, /* Class copy callback */ @@ -99,9 +99,9 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ /*------------------------------------------------------------------------- - * Function: H5P_strcrt_reg_prop + * Function: H5P__strcrt_reg_prop * - * Purpose: Register the dataset creation property list class's properties + * Purpose: Register the string creation property list class's properties * * Return: Non-negative on success/Negative on failure * @@ -110,41 +110,38 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5P_strcrt_reg_prop(H5P_genclass_t *pclass) +H5P__strcrt_reg_prop(H5P_genclass_t *pclass) { H5T_cset_t char_encoding = H5P_STRCRT_CHAR_ENCODING_DEF; /* Default character set encoding */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Register character encoding */ if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &char_encoding, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_strcrt_reg_prop() */ +} /* end H5P__strcrt_reg_prop() */ /*------------------------------------------------------------------------- - * Function: H5Pset_char_encoding + * Function: H5Pset_char_encoding * - * Purpose: Sets the character encoding of the string. + * Purpose: Sets the character encoding of the string. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Wednesday, October 26, 2005 - * - * Modifications: + * Return: Non-negative on success/Negative on failure * + * Programmer: James Laird + * Wednesday, October 26, 2005 *------------------------------------------------------------------------- */ herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iTc", plist_id, encoding); @@ -154,7 +151,7 @@ H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "character encoding is not valid") /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_STRING_CREATE))) + if(NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set the character encoding */ diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index c2d6f7e..c1528b3 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -103,6 +103,6 @@ H5_DLL herr_t H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop); H5_DLL herr_t H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, size_t array_size, const H5T_t *buf_type); H5_DLL hbool_t H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop); -H5_DLL char* H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop); +H5_DLL const char *H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop); #endif diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 9fa3863..498db03 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -1732,11 +1732,9 @@ H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop) * *------------------------------------------------------------------------- */ -char * +const char * H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop) { - char* ret_value; - FUNC_ENTER_NOAPI_NOINIT_NOERR /* There should be no way that this can be NULL since the function @@ -1744,8 +1742,6 @@ H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop) * pasing them */ assert(data_xform_prop); - ret_value = data_xform_prop->xform_exp; - - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(data_xform_prop->xform_exp) } /* H5Z_xform_extract_xform_str() */ |