diff options
author | David Young <dyoung@hdfgroup.org> | 2019-12-09 16:30:58 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2019-12-09 16:30:58 (GMT) |
commit | c8f533cfc33ac743227cbed8eba361c715a2976f (patch) | |
tree | bcae5320f80bac774647cacbbd8493604f9384d2 /src/H5Tnative.c | |
parent | adcf8a315e82c0848d126e7e46b662930c081896 (diff) | |
download | hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.zip hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.gz hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.bz2 |
Merge all of my changes from merge-back-to-feature-vfd_swmr-attempt-1,
including the merge of `hdffv/hdf5/develop`, back to the branch that Vailin and
I share.
Now I need to put this branch on a fork with a less confusing name than
vchoi_fork!
Diffstat (limited to 'src/H5Tnative.c')
-rw-r--r-- | src/H5Tnative.c | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/src/H5Tnative.c b/src/H5Tnative.c index c9ad01a..1d203c7 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -126,7 +126,6 @@ static H5T_t * H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_align, size_t *offset, size_t *comp_size) { - H5T_t *dt; /* Datatype to make native */ H5T_t *super_type; /* Super type of VL, array and enum datatypes */ H5T_t *nat_super_type; /* Native form of VL, array & enum super datatype */ H5T_t *new_type = NULL; /* New native datatype */ @@ -218,26 +217,36 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali case H5T_REFERENCE: { + H5T_t *dt; /* Datatype to make native */ size_t align; size_t ref_size; - int not_equal; if(NULL == (ret_value = H5T_copy(dtype, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy reference type") - /* Decide if the data type is object or dataset region reference. */ + /* Decide if the data type is object reference. */ if(NULL == (dt = (H5T_t *)H5I_object(H5T_STD_REF_OBJ_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") - not_equal = H5T_cmp(ret_value, dt, FALSE); /* Update size, offset and compound alignment for parent. */ - if(!not_equal) { + if(0 == H5T_cmp(ret_value, dt, FALSE)) { align = H5T_HOBJREF_COMP_ALIGN_g; ref_size = sizeof(hobj_ref_t); } /* end if */ else { - align = H5T_HDSETREGREF_COMP_ALIGN_g; - ref_size = sizeof(hdset_reg_ref_t); + /* Decide if the data type is dataset region reference. */ + if(NULL == (dt = (H5T_t *)H5I_object(H5T_STD_REF_DSETREG_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + + if (0 == H5T_cmp(ret_value, dt, FALSE)) { + align = H5T_HDSETREGREF_COMP_ALIGN_g; + ref_size = sizeof(hdset_reg_ref_t); + } /* end if */ + else { + /* Only pointers to underlying opaque reference types */ + align = H5T_REF_COMP_ALIGN_g; + ref_size = sizeof(H5R_ref_t); + } /* end else */ } /* end else */ if(H5T__cmp_offset(comp_size, offset, ref_size, (size_t)1, align, struct_align) < 0) @@ -369,7 +378,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name") if(H5T__get_member_value(dtype, u, tmp_memb_value) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") - HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); + H5MM_memcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") @@ -515,6 +524,14 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_type() */ +/* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_integer @@ -655,7 +672,16 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_integer() */ +#pragma GCC diagnostic pop +/* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_float @@ -780,7 +806,16 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_float() */ +#pragma GCC diagnostic pop +/* Disable warning for intentional identical branches here -QAK */ +/* + * This pragma only needs to surround the "duplicated branches" in + * the code below, but early (4.4.7, at least) gcc only allows + * diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_bitfield @@ -866,6 +901,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_bitfield() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- |