diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-22 19:09:56 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-22 19:09:56 (GMT) |
commit | cac6687a6a4adcfff526d91f3b57671089ef10b5 (patch) | |
tree | 391d2fc52cf29624237cbdd4e8a2e1314e186658 | |
parent | edf83e5d1f1e38288cecba33bb7e6b11729050be (diff) | |
download | hdf5-cac6687a6a4adcfff526d91f3b57671089ef10b5.zip hdf5-cac6687a6a4adcfff526d91f3b57671089ef10b5.tar.gz hdf5-cac6687a6a4adcfff526d91f3b57671089ef10b5.tar.bz2 |
[svn-r22707] Description:
Bring back some more cleanups from the plist_encode_decode branch, clean up
some formatting and compiler errors, and add a few more property comparison
routines that we've skipped implementing in the past.
Tested on:
Mac OSX/64 10.7.4 (amazon) w/debug
(Too minor to require h5committest)
-rw-r--r-- | src/H5FDmulti.c | 8 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 6 | ||||
-rw-r--r-- | src/H5Pdxpl.c | 73 | ||||
-rw-r--r-- | src/H5Pfapl.c | 208 | ||||
-rw-r--r-- | src/H5Pfcpl.c | 26 | ||||
-rw-r--r-- | src/H5Plapl.c | 51 |
6 files changed, 171 insertions, 201 deletions
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 08529e2..16934e3 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -657,16 +657,16 @@ H5FD_multi_dxpl_cmp_cb(const void *_dx1, const void *_dx2, size_t size) return(cmp_status); } /* end if */ else - return(1); + return(-1); } /* end if */ else { if(dx2->memb_dxpl[mt] >= 0) - return(-1); + return(1); else if(dx1->memb_dxpl[mt] > dx2->memb_dxpl[mt]) - return(1); - else if(dx1->memb_dxpl[mt] < dx2->memb_dxpl[mt]) return(-1); + else if(dx1->memb_dxpl[mt] < dx2->memb_dxpl[mt]) + return(1); else continue; } /* end else */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 56db4cb..6e7e820 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -76,7 +76,7 @@ /* Definitions for storage layout property */ #define H5D_CRT_LAYOUT_SIZE sizeof(H5O_layout_t) #define H5D_CRT_LAYOUT_DEF H5D_DEF_LAYOUT_CONTIG -#define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp +#define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp /* Definitions for fill value. size=0 means fill value will be 0 as * library default; size=-1 means fill value is undefined. */ #define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) @@ -187,11 +187,11 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) /* Register the storage layout property */ if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, H5D_CRT_LAYOUT_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") /* Register the fill value property */ if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_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") /* Register the space allocation time state property */ if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 3eeb7d5..d0e728c 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -124,6 +124,7 @@ #define H5D_XFER_XFORM_DEF NULL #define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del #define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy +#define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp #define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close /******************/ @@ -146,6 +147,7 @@ static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value); +static int H5P__dxfr_xform_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__dxfr_xform_close(const char* name, size_t size, void* value); @@ -294,7 +296,6 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) if(H5P_register_real(pclass, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE, &ftype, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - #endif /* H5_HAVE_PARALLEL */ /* Register the EDC property */ @@ -310,7 +311,7 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data transform property */ - if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &def_xfer_xform, NULL, NULL, NULL, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, NULL, H5D_XFER_XFORM_CLOSE) < 0) + if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &def_xfer_xform, NULL, NULL, NULL, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -384,6 +385,60 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_cmp + * + * Purpose: Compare two data transforms. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is + * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static int +H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t UNUSED size) +{ + const H5Z_data_xform_t * const *xform1 = (const H5Z_data_xform_t * const *)_xform1; /* Create local aliases for values */ + const H5Z_data_xform_t * const *xform2 = (const H5Z_data_xform_t * const *)_xform2; /* Create local aliases for values */ + const char *pexp1, *pexp2; /* Pointers to transform expressions */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(xform1); + HDassert(xform2); + HDassert(size == sizeof(H5Z_data_xform_t *)); + + /* Check for a property being set */ + if(*xform1 == NULL && *xform2 != NULL) HGOTO_DONE(-1); + if(*xform1 != NULL && *xform2 == NULL) HGOTO_DONE(1); + + if(*xform1) { + HDassert(*xform2); + + /* Get the transform expressions */ + pexp1 = H5Z_xform_extract_xform_str(*xform1); + pexp2 = H5Z_xform_extract_xform_str(*xform2); + + /* Check for property expressions */ + if(pexp1 == NULL && pexp2 != NULL) HGOTO_DONE(-1); + if(pexp1 != NULL && pexp2 == NULL) HGOTO_DONE(1); + + if(pexp1) { + HDassert(pexp2); + ret_value = HDstrcmp(pexp1, pexp2); + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_xform_copy() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dxfr_xform_close * * Purpose: Frees memory allocated by H5P_dxfr_xform_set @@ -445,8 +500,12 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* See if a data transform is already set, and free it if it is */ - if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) >= 0) - H5Z_xform_destroy(data_xform_prop); + if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") + + /* Destroy previous data transform property */ + if(H5Z_xform_destroy(data_xform_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") /* Create data transform info from expression */ if(NULL == (data_xform_prop = H5Z_xform_create(expression))) @@ -494,7 +553,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) H5P_genplist_t *plist; /* Property list pointer */ H5Z_data_xform_t *data_xform_prop = NULL; /* New data xform property */ size_t len; - char* pexp; + const char* pexp; ssize_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) @@ -508,11 +567,11 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") if(NULL == data_xform_prop) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "data transform has not been set") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "data transform has not been set") /* Get the data transform string */ if(NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "failed to retrieve transform expression") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression") len = HDstrlen(pexp); if(expression) { diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index adf1364..9707357 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -145,12 +145,6 @@ /* Local Prototypes */ /********************/ -/* General routines */ -static herr_t H5P_set_family_offset(H5P_genplist_t *plist, hsize_t offset); -static herr_t H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset); -static herr_t H5P_set_multi_type(H5P_genplist_t *plist, H5FD_mem_t type); -static herr_t H5P_get_multi_type(H5P_genplist_t *plist, H5FD_mem_t *type); - /* Property class callbacks */ static herr_t H5P_facc_reg_prop(H5P_genclass_t *pclass); static herr_t H5P_facc_create(hid_t fapl_id, void *copy_data); @@ -234,88 +228,88 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) /* Register the initial metadata cache resize configuration */ if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, 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 the size of raw data chunk cache (elements) */ if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, 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 the size of raw data chunk cache(bytes) */ if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, 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 the preemption for reading chunks */ if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, 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 the threshold for alignment */ if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &threshold, 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 the alignment */ if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &alignment, 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 the minimum metadata allocation block size */ if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size, 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 the maximum sieve buffer size */ if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size, 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 the minimum "small data" allocation block size */ if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size, 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 the garbage collection reference */ if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref, 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 the file driver ID */ if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &driver_id, 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 the file driver info */ if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info, 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 the file close degree */ if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &close_degree, 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 the offset of family driver info */ if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset, 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 the private property of new family file size. It's used by h5repart only. */ if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize, 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 the private property of whether convert family to sec2 driver. It's used by h5repart only. */ if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2, 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 the data type of multi driver info */ if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &mem_type, 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 the 'use the latest version of the format' flag */ if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, 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 the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &want_posix_fd, 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 the external file cache size */ if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &efc_size, 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 the initial file image info */ if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &file_image_info, NULL, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, NULL, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 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) @@ -856,11 +850,11 @@ H5Pset_family_offset(hid_t fapl_id, hsize_t offset) if(H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") 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 value */ - if((ret_value = H5P_set_family_offset(plist, offset)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set family offset") + if(H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file") done: FUNC_LEAVE_API(ret_value) @@ -868,39 +862,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_set_family_offset - * - * Purpose: Set offset for family driver. Private function for - * H5Pset_family_offset - * - * Return: Success: Non-negative value. - * Failure: Negative value. - * - * Programmer: Raymond Lu - * Sep 17, 2002 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P_set_family_offset(H5P_genplist_t *plist, hsize_t offset) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - if(H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file") - } /* end if */ - else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_set_family_offset() */ - - -/*------------------------------------------------------------------------- * Function: H5Pget_family_offset * * Purpose: Get offset for family driver. This file access property @@ -928,48 +889,17 @@ H5Pget_family_offset(hid_t fapl_id, hsize_t *offset) if(H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") 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") /* Get value */ - if((ret_value = H5P_get_family_offset(plist, offset)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get family offset") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_family_offset() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_get_family_offset - * - * Purpose: Get offset for family driver. Private function for - * H5Pget_family_offset - * - * Return: Success: Non-negative value. - * Failure: Negative value. - * - * Programmer: Raymond Lu - * Sep 17, 2002 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + if(offset) { if(H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, offset) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file") } /* end if */ - else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_family_offset() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_family_offset() */ /*------------------------------------------------------------------------- @@ -1000,11 +930,11 @@ H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) if(H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") 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 value */ - if((ret_value = H5P_set_multi_type(plist, type)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data type for multi driver") + if(H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type for multi driver") done: FUNC_LEAVE_API(ret_value) @@ -1012,39 +942,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_set_multi_type - * - * Purpose: Set data type for multi file driver. Private function for - * H5Pset_multi_type. - * - * Return: Success: Non-negative value. - * Failure: Negative value. - * - * Programmer: Raymond Lu - * Sep 17, 2002 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P_set_multi_type(H5P_genplist_t *plist, H5FD_mem_t type) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - if(H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type for multi driver") - } /* end if */ - else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_set_multi_type() */ - - -/*------------------------------------------------------------------------- * Function: H5Pget_multi_type * * Purpose: Get data type for multi driver. This file access property @@ -1072,11 +969,13 @@ H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type) if(H5P_DEFAULT == fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") 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") /* Get value */ - if((ret_value = H5P_get_multi_type(plist, type)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get data type for multi driver") + if(type) { + if(H5P_get(plist, H5F_ACS_MULTI_TYPE_NAME, type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get type for multi driver") + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1084,39 +983,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_multi_type - * - * Purpose: Get data type for multi file driver. Private function for - * H5Pget_multi_type. - * - * Return: Success: Non-negative value. - * Failure: Negative value. - * - * Programmer: Raymond Lu - * Sep 17, 2002 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P_get_multi_type(H5P_genplist_t *plist, H5FD_mem_t *type) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - if(H5P_get(plist, H5F_ACS_MULTI_TYPE_NAME, type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get type for multi driver") - } /* end if */ - else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_multi_type() */ - - -/*------------------------------------------------------------------------- * Function: H5Pset_cache * * Purpose: Set the number of objects in the meta data cache and the diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 7351beb..cd6a7cd 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -164,49 +164,49 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) /* Register the user block size */ if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &userblock_size, 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 the 1/2 rank for symbol table leaf nodes */ if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k, 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 the 1/2 rank for btree internal nodes */ if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, btree_k, 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 the byte number for an address */ if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr, 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 the byte number for object size */ if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &sizeof_size, 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 the superblock version number */ if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &superblock_ver, 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 the shared OH message information */ if(H5P_register_real(pclass,H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &num_sohm_indexes,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") if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &sohm_index_flags,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") if(H5P_register_real(pclass,H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &sohm_index_minsizes,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 the shared OH cutoff size information */ if(H5P_register_real(pclass,H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &sohm_list_max,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") if(H5P_register_real(pclass,H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &sohm_btree_min,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 the file space handling strategy */ if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &file_space_strategy, 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 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") + 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/H5Plapl.c b/src/H5Plapl.c index ba5f9d7..8d8ee15 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -61,6 +61,7 @@ #define H5L_ACS_ELINK_FAPL_DEF H5P_DEFAULT #define H5L_ACS_ELINK_FAPL_DEL H5P_lacc_elink_fapl_del #define H5L_ACS_ELINK_FAPL_COPY H5P_lacc_elink_fapl_copy +#define H5L_ACS_ELINK_FAPL_CMP H5P_lacc_elink_fapl_cmp #define H5L_ACS_ELINK_FAPL_CLOSE H5P_lacc_elink_fapl_close /* Definitions for file access flags for external link traversal */ @@ -96,6 +97,7 @@ static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_ static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value); static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value); +static int H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* value); @@ -169,7 +171,7 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &def_fapl_id, NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, NULL, H5L_ACS_ELINK_FAPL_CLOSE) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &def_fapl_id, NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file access flags */ @@ -260,6 +262,49 @@ done: } /* end H5P_lacc_elink_fapl_copy() */ +/*------------------------------------------------------------------------- + * Function: H5P_lacc_elink_fapl_cmp + * + * Purpose: Callback routine which is called whenever the elink FAPL + * property in the link access property list is + * compared. + * + * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. + * + * Programmer: Quincey Koziol + * Wednesday, August 15, 2012 + * + *------------------------------------------------------------------------- + */ +static int +H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t UNUSED size) +{ + const hid_t *fapl1 = (const hid_t *)value1; + const hid_t *fapl2 = (const hid_t *)value2; + H5P_genplist_t *obj1, *obj2; /* Property lists to compare */ + int ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check for comparison with default value */ + if(*fapl1 == 0 && *fapl2 > 0) HGOTO_DONE(1); + if(*fapl1 > 0 && *fapl2 == 0) HGOTO_DONE(-1); + + /* Get the property list objects */ + obj1 = (H5P_genplist_t *)H5I_object(*fapl1); + obj2 = (H5P_genplist_t *)H5I_object(*fapl2); + + /* 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); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_lacc_elink_fapl_cmp() */ + + /*-------------------------------------------------------------------------- * Function: H5P_lacc_elink_fapl_close * @@ -362,8 +407,8 @@ H5P_lacc_elink_pref_copy(const char UNUSED *name, size_t UNUSED size, void *valu static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t UNUSED size) { - const char *pref1 = *(const char **)value1; - const char *pref2 = *(const char **)value2; + const char *pref1 = *(const char * const *)value1; + const char *pref2 = *(const char * const *)value2; int ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR |