Skip to content

Commit

Permalink
Update wrappers with HDoff_t --> haddr_t changes
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins committed Nov 8, 2024
1 parent 9d82169 commit 70ee459
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 53 deletions.
4 changes: 2 additions & 2 deletions c++/src/C2Cppfunction_map.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16851,7 +16851,7 @@
mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>void DSetCreatPropList::setExternal(const char* name, HDoff_t offset,
normal'>void DSetCreatPropList::setExternal(const char* name, haddr_t offset,
hsize_t size)</p>
</td>
<td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
Expand Down Expand Up @@ -16925,7 +16925,7 @@
mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>void DSetCreatPropList::getExternal(unsigned idx, size_t name_size,
char* name, HDoff_t&amp; offset, hsize_t&amp; size)</p>
char* name, haddr_t&amp; offset, hsize_t&amp; size)</p>
</td>
<td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
Expand Down
8 changes: 4 additions & 4 deletions c++/src/H5DcreatProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,10 @@ DSetCreatPropList::setFletcher32() const
/// which is a 32-bit signed long value on Windows, which limited
/// the valid offset that can be set to 2 GiB.
///
///\version 2.0.0 \p offset parameter type changed to HDoff_t from off_t.
///\version 2.0.0 \p offset parameter type changed to haddr_t from off_t.
//--------------------------------------------------------------------------
void
DSetCreatPropList::setExternal(const char *name, HDoff_t offset, hsize_t size) const
DSetCreatPropList::setExternal(const char *name, haddr_t offset, hsize_t size) const
{
herr_t ret_value = H5Pset_external(id, name, offset, size);
if (ret_value < 0) {
Expand Down Expand Up @@ -702,10 +702,10 @@ DSetCreatPropList::getExternalCount() const
/// which is a 32-bit signed long value on Windows, which limited
/// the valid offset that can be returned to 2 GiB.
///
///\version 2.0.0 \p offset parameter type changed to HDoff_t from off_t.
///\version 2.0.0 \p offset parameter type changed to haddr_t from off_t.
//--------------------------------------------------------------------------
void
DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, HDoff_t &offset,
DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, haddr_t &offset,
hsize_t &size) const
{
herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size);
Expand Down
4 changes: 2 additions & 2 deletions c++/src/H5DcreatProp.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
void setChunk(int ndims, const hsize_t *dim) const;

// Returns information about an external file.
void getExternal(unsigned idx, size_t name_size, char *name, HDoff_t &offset, hsize_t &size) const;
void getExternal(unsigned idx, size_t name_size, char *name, haddr_t &offset, hsize_t &size) const;

// Returns the number of external files for a dataset.
int getExternalCount() const;
Expand Down Expand Up @@ -101,7 +101,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
void setDeflate(int level) const;

// Adds an external file to the list of external files.
void setExternal(const char *name, HDoff_t offset, hsize_t size) const;
void setExternal(const char *name, haddr_t offset, hsize_t size) const;

// Adds a filter to the filter pipeline.
void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0,
Expand Down
12 changes: 6 additions & 6 deletions fortran/src/H5Pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ h5pget_filter_c(hid_t_f *prp_id, int_f *filter_number, int_f *flags, size_t_f *c
* SOURCE
*/
int_f
h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, off_t_f *offset, hsize_t_f *bytes)
h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, haddr_t_f *offset, hsize_t_f *bytes)
/******/
{
int ret_value = -1;
Expand All @@ -1525,9 +1525,9 @@ h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, off_t_f *offset, h
hsize_t c_bytes;
char *c_name;
size_t c_namelen = (size_t)*namelen;
off_t c_offset;
haddr_t c_offset;
c_bytes = (hsize_t)*bytes;
c_offset = (off_t)*offset;
c_offset = (haddr_t)*offset;

c_name = (char *)HD5f2cstring(name, c_namelen);
if (c_name == NULL)
Expand Down Expand Up @@ -1600,7 +1600,7 @@ h5pget_external_count_c(hid_t_f *prp_id, int_f *count)
* SOURCE
*/
int_f
h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, off_t_f *offset,
h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, haddr_t_f *offset,
hsize_t_f *bytes)
/******/
{
Expand All @@ -1610,7 +1610,7 @@ h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, o
herr_t status;
size_t c_namelen;
char *c_name = NULL;
HDoff_t c_offset;
haddr_t c_offset;
hsize_t size;

c_namelen = (size_t)*name_size;
Expand All @@ -1632,7 +1632,7 @@ h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, o
if (status < 0)
goto DONE;

*offset = (off_t_f)c_offset;
*offset = (haddr_t_f)c_offset;
*bytes = (hsize_t_f)size;
/* Note: if the size of the fortran buffer is larger then the returned string
* from the function then we need to give HD5packFstring the fortran buffer size so
Expand Down
18 changes: 6 additions & 12 deletions fortran/src/H5Pff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1623,16 +1623,13 @@ END SUBROUTINE h5pget_filter_f
!! \param bytes Size of the external file data.
!! \param hdferr \fortran_error
!!
!! \note On Windows, off_t is typically a 32-bit signed long value, which
!! limits the valid offset that can be set to 2 GiB.
!!
!! See C API: @ref H5Pset_external()
!!
SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
CHARACTER(LEN=*), INTENT(IN) :: name
INTEGER(OFF_T), INTENT(IN) :: offset
INTEGER(HADDR_T), INTENT(IN) :: offset
INTEGER(HSIZE_T), INTENT(IN) :: bytes
INTEGER, INTENT(OUT) :: hdferr
INTEGER :: namelen
Expand All @@ -1641,12 +1638,12 @@ SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr)
INTEGER FUNCTION h5pset_external_c(prp_id, name,namelen, offset, bytes) &
BIND(C,NAME='h5pset_external_c')
IMPORT :: C_CHAR
IMPORT :: HID_T, OFF_T, HSIZE_T
IMPORT :: HID_T, HADDR_T, HSIZE_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
INTEGER :: namelen
INTEGER(OFF_T), INTENT(IN) :: offset
INTEGER(HADDR_T), INTENT(IN) :: offset
INTEGER(HSIZE_T), INTENT(IN) :: bytes
END FUNCTION h5pset_external_c
END INTERFACE
Expand Down Expand Up @@ -1697,9 +1694,6 @@ END SUBROUTINE h5pget_external_count_f
!! \param bytes Size of the external file data.
!! \param hdferr \fortran_error
!!
!! \note On Windows, off_t is typically a 32-bit signed long value, which
!! limits the valid offset that can be returned to 2 GiB.
!!
!! See C API: @ref H5Pget_external()
!!
SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset, bytes, hdferr)
Expand All @@ -1708,20 +1702,20 @@ SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset, bytes, hdferr
INTEGER, INTENT(IN) :: idx
INTEGER(SIZE_T), INTENT(IN) :: name_size
CHARACTER(LEN=*), INTENT(OUT) :: name
INTEGER(OFF_T), INTENT(OUT) :: offset
INTEGER(HADDR_T), INTENT(OUT) :: offset
INTEGER(HSIZE_T), INTENT(OUT) :: bytes
INTEGER, INTENT(OUT) :: hdferr
INTERFACE
INTEGER FUNCTION h5pget_external_c(prp_id, idx, name_size, name, offset, bytes) &
BIND(C,NAME='h5pget_external_c')
IMPORT :: C_CHAR
IMPORT :: HID_T, SIZE_T, HSIZE_T, OFF_T
IMPORT :: HID_T, SIZE_T, HSIZE_T, HADDR_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER, INTENT(IN) :: idx
INTEGER(SIZE_T), INTENT(IN) :: name_size
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name
INTEGER(OFF_T), INTENT(OUT) :: offset
INTEGER(HADDR_T), INTENT(OUT) :: offset
INTEGER(HSIZE_T), INTENT(OUT) :: bytes
END FUNCTION h5pget_external_c
END INTERFACE
Expand Down
4 changes: 2 additions & 2 deletions fortran/src/H5f90proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ H5_FCDLL int_f h5pget_filter_c(hid_t_f *prp_id, int_f *filter_number, int_f *fla
int_f *cd_values, size_t_f *namelen, _fcd name, int_f *filter_id);
H5_FCDLL int_f h5pget_filter_by_id_c(hid_t_f *prp_id, int_f *filter_id, int_f *flags, size_t_f *cd_nelmts,
int_f *cd_values, size_t_f *namelen, _fcd name);
H5_FCDLL int_f h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, off_t_f *offset,
H5_FCDLL int_f h5pset_external_c(hid_t_f *prp_id, _fcd name, int_f *namelen, haddr_t_f *offset,
hsize_t_f *bytes);
H5_FCDLL int_f h5pget_external_count_c(hid_t_f *prp_id, int_f *count);
H5_FCDLL int_f h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, off_t_f *offset,
H5_FCDLL int_f h5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f *name_size, _fcd name, haddr_t_f *offset,
hsize_t_f *bytes);
H5_FCDLL int_f h5pget_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right);
H5_FCDLL int_f h5pset_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *right);
Expand Down
11 changes: 0 additions & 11 deletions fortran/src/H5match_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,6 @@ main(void)
return -1;
}

/* off_t */
for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
if (IntKinds_SizeOf[i] == H5_SIZEOF_OFF_T) {
writeToFiles("int", "OFF_T", "off_t_f", IntKinds[i]);
break;
}
if (i == (FORTRAN_NUM_INTEGER_KINDS - 1))
/* Error: couldn't find a size for off_t */
return -1;
}

/* size_t */
for (i = 0; i < FORTRAN_NUM_INTEGER_KINDS; i++) {
if (IntKinds_SizeOf[i] == H5_SIZEOF_SIZE_T) {
Expand Down
4 changes: 2 additions & 2 deletions fortran/test/tH5P.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SUBROUTINE external_test(cleanup, total_error)
INTEGER(HSIZE_T), DIMENSION(1) :: cur_size !data space current size
INTEGER(HSIZE_T), DIMENSION(1) :: max_size !data space maximum size
CHARACTER(LEN=256) :: name !external file name
INTEGER(OFF_T) :: file_offset !external file offset
INTEGER(HADDR_T) :: file_offset !external file offset
INTEGER(HSIZE_T) :: file_size !sizeof external file segment
INTEGER :: error !error code
INTEGER(SIZE_T) :: int_size !size of integer
Expand Down Expand Up @@ -134,7 +134,7 @@ SUBROUTINE external_test(cleanup, total_error)
CALL h5tget_size_f(H5T_NATIVE_INTEGER, int_size, error)
CALL check("h5tget_size_f",error,total_error)
file_size = int_size * max_size(1)
CALL h5pset_external_f(plist_id, "ext1.data", INT(0,off_t), file_size, error)
CALL h5pset_external_f(plist_id, "ext1.data", INT(0,haddr_t), file_size, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5screate_simple_f(RANK, cur_size, space_id, error, max_size)
CALL check("h5screate_simple_f", error, total_error)
Expand Down
8 changes: 4 additions & 4 deletions fortran/test/tH5P_F03.F90
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,13 @@ SUBROUTINE external_test_offset(cleanup,total_error)

CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error)
CALL check("h5pcreate_f", error, total_error)
CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,haddr_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,haddr_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,haddr_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)
CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,off_t), sizeof_part, error)
CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,haddr_t), sizeof_part, error)
CALL check("h5pset_external_f",error,total_error)

cur_size(1) = 100
Expand Down
6 changes: 3 additions & 3 deletions java/src/jni/h5pDCPLImp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1external(JNIEnv *env, jclass clss, jlong plist, jstr

PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Pset_external: file name not pinned");

if ((status = H5Pset_external((hid_t)plist, fileName, (HDoff_t)offset, (hsize_t)size)) < 0)
if ((status = H5Pset_external((hid_t)plist, fileName, (haddr_t)offset, (hsize_t)size)) < 0)
H5_LIBRARY_ERROR(ENVONLY);

done:
Expand All @@ -1083,7 +1083,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint
jboolean isCopy;
jstring str;
hsize_t s;
HDoff_t o;
haddr_t o;
jsize arrLen;
jlong *theArray = NULL;
char *file = NULL;
Expand Down Expand Up @@ -1112,7 +1112,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint
if (NULL != size) {
PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_external: size array not pinned");

theArray[0] = o;
theArray[0] = (jlong)o;
theArray[1] = (jlong)s;
}

Expand Down
4 changes: 0 additions & 4 deletions tools/lib/h5tools_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -3342,10 +3342,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *

h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "FILENAME %s SIZE %" PRIuHSIZE, name, size);
/* Using %lld with a cast to (long long) is probably the only portable
* way to print off_t values. There's no real standard for off_t other
* than it must be signed, according to POSIX.
*/
h5tools_str_append(&buffer, " OFFSET %" PRIuHADDR "", offset);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
(hsize_t)0);
Expand Down
2 changes: 1 addition & 1 deletion tools/src/misc/h5repart.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ main(int argc, char *argv[])
* needed. The first member is extended to the logical member size
* but other members might be smaller if they end with a hole.
*/
dst_offset = dst_offset + (off_t)n;
dst_offset = dst_offset + (HDoff_t)n;
if (dst_is_family && dst_offset == dst_size) {
if (0 == dst_membno) {
if (HDlseek(dst, dst_size - 1, SEEK_SET) < 0) {
Expand Down

0 comments on commit 70ee459

Please sign in to comment.