mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Clean up off_t --> HDoff_t stragglers (#4555)
* off_t --> HDoff_t in test * off_t --> HDoff_t in h5ls, h5dump, & h5repack * Minor off_t tweak to configure.ac * off_t --> HDoff_t fixes in src This changes the type of the offset parameter in H5Pget_external() to HDoff_t to match H5Pset_external(), along with other minor tweaks. * off_t --> HDoff_t in C++ wrappers * Fix off_t usage in Java wrapper
This commit is contained in:
@@ -16851,7 +16851,7 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height:
|
||||
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, off_t offset,
|
||||
normal'>void DSetCreatPropList::setExternal(const char* name, HDoff_t offset,
|
||||
hsize_t size)</p>
|
||||
</td>
|
||||
<td width=35 valign=top style='width:26.05pt;border-top:none;border-left:
|
||||
@@ -16925,7 +16925,7 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height:
|
||||
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, off_t& offset, hsize_t& size)</p>
|
||||
char* name, HDoff_t& offset, hsize_t& 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;
|
||||
|
||||
@@ -645,11 +645,14 @@ DSetCreatPropList::setFletcher32() const
|
||||
/// the total size is larger than the size of a dataset then the
|
||||
/// dataset can be extended (provided the data space also allows
|
||||
/// the extending).
|
||||
///\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.
|
||||
///\note In 1.14.x and earlier, the offset parameter was of type off_t,
|
||||
/// which is a 32-bit signed long value on Windows, which limited
|
||||
/// the valid offset that can be set to 2 GiB.
|
||||
///
|
||||
///\version 1.16.0 \p offset parameter type changed to HDoff_t from off_t.
|
||||
//--------------------------------------------------------------------------
|
||||
void
|
||||
DSetCreatPropList::setExternal(const char *name, off_t offset, hsize_t size) const
|
||||
DSetCreatPropList::setExternal(const char *name, HDoff_t offset, hsize_t size) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_external(id, name, offset, size);
|
||||
if (ret_value < 0) {
|
||||
@@ -695,11 +698,15 @@ DSetCreatPropList::getExternalCount() const
|
||||
/// external file name will not be returned. If \a offset or
|
||||
/// \a size are null pointers then the corresponding information
|
||||
/// will not be returned.
|
||||
///\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.
|
||||
///\note In 1.14.x and earlier, the offset parameter was of type off_t,
|
||||
/// which is a 32-bit signed long value on Windows, which limited
|
||||
/// the valid offset that can be returned to 2 GiB.
|
||||
///
|
||||
///\version 1.16.0 \p offset parameter type changed to HDoff_t from off_t.
|
||||
//--------------------------------------------------------------------------
|
||||
void
|
||||
DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const
|
||||
DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, HDoff_t &offset,
|
||||
hsize_t &size) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size);
|
||||
if (ret_value < 0) {
|
||||
|
||||
@@ -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, off_t &offset, hsize_t &size) const;
|
||||
void getExternal(unsigned idx, size_t name_size, char *name, HDoff_t &offset, hsize_t &size) const;
|
||||
|
||||
// Returns the number of external files for a dataset.
|
||||
int getExternalCount() const;
|
||||
@@ -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, off_t offset, hsize_t size) const;
|
||||
void setExternal(const char *name, HDoff_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,
|
||||
|
||||
+2
-2
@@ -2575,8 +2575,8 @@ case "X-$ASSERTS" in
|
||||
esac
|
||||
|
||||
## Incorporate the potentially warning-to-error promoting flags after
|
||||
## feature tests. Some of the tests (e.g., `off_t`) generate compilation
|
||||
## errors with the flags we chose for the HDF5 library and tools.
|
||||
## feature tests. Some of the tests generate compilation errors with the
|
||||
## flags we chose for the HDF5 library and tools.
|
||||
##
|
||||
H5_CFLAGS="$H5_CFLAGS $H5_ECFLAGS"
|
||||
H5_CXXFLAGS="$H5_CXXFLAGS $H5_ECXXFLAGS"
|
||||
|
||||
@@ -1067,7 +1067,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, (off_t)offset, (hsize_t)size)) < 0)
|
||||
if ((status = H5Pset_external((hid_t)plist, fileName, (HDoff_t)offset, (hsize_t)size)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
done:
|
||||
@@ -1089,7 +1089,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint
|
||||
jboolean isCopy;
|
||||
jstring str;
|
||||
hsize_t s;
|
||||
off_t o;
|
||||
HDoff_t o;
|
||||
jsize arrLen;
|
||||
jlong *theArray = NULL;
|
||||
char *file = NULL;
|
||||
@@ -1111,8 +1111,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint
|
||||
if (NULL == (file = (char *)malloc(sizeof(char) * (size_t)name_size)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: memory allocation failed");
|
||||
|
||||
if ((status = H5Pget_external((hid_t)plist, (unsigned)idx, (size_t)name_size, file, (off_t *)&o,
|
||||
(hsize_t *)&s)) < 0)
|
||||
if ((status = H5Pget_external((hid_t)plist, (unsigned)idx, (size_t)name_size, file, &o, (hsize_t *)&s)) <
|
||||
0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if (NULL != size) {
|
||||
|
||||
@@ -1018,7 +1018,7 @@ ioc_file_write_data(int fd, int64_t file_offset, void *data_buffer, int64_t data
|
||||
(void)ioc_idx;
|
||||
#endif
|
||||
|
||||
HDcompile_assert(H5_SIZEOF_OFF_T == sizeof(file_offset));
|
||||
HDcompile_assert(sizeof(HDoff_t) == sizeof(file_offset));
|
||||
|
||||
while (bytes_remaining) {
|
||||
errno = 0;
|
||||
@@ -1066,7 +1066,7 @@ ioc_file_read_data(int fd, int64_t file_offset, void *data_buffer, int64_t data_
|
||||
(void)ioc_idx;
|
||||
#endif
|
||||
|
||||
HDcompile_assert(H5_SIZEOF_OFF_T == sizeof(file_offset));
|
||||
HDcompile_assert(sizeof(HDoff_t) == sizeof(file_offset));
|
||||
|
||||
while (bytes_remaining) {
|
||||
errno = 0;
|
||||
@@ -1146,7 +1146,7 @@ ioc_file_truncate(sf_work_request_t *msg)
|
||||
|
||||
fd = sf_context->sf_fids[subfile_idx];
|
||||
|
||||
if (HDftruncate(fd, (off_t)length) != 0)
|
||||
if (HDftruncate(fd, (HDoff_t)length) != 0)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_SEEKERROR, -1, "HDftruncate failed");
|
||||
|
||||
/*
|
||||
|
||||
+1
-2
@@ -931,8 +931,7 @@
|
||||
* access property list for each member of the file family. memb_size specifies the logical size, in
|
||||
* bytes, of each family member. memb_size is used only when creating a new file or truncating an
|
||||
* existing file; otherwise the member size is determined by the size of the first member of the
|
||||
* family being opened. Note: If the size of the off_t type is four bytes, the maximum family
|
||||
* member size is usually 2^31-1 because the byte at offset 2,147,483,647 is generally inaccessible.
|
||||
* family being opened.
|
||||
*
|
||||
* #H5Pget_fapl_family is used to retrieve file family properties. If the file access property list is set
|
||||
* to use the Family driver, member_properties will be returned with a pointer to a copy of the
|
||||
|
||||
+4
-6
@@ -372,9 +372,8 @@ H5F_get_fcpl(const H5F_t *f)
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_sizeof_addr
|
||||
*
|
||||
* Purpose: Quick and dirty routine to retrieve the size of the file's size_t
|
||||
* (Mainly added to stop non-file routines from poking about in the
|
||||
* H5F_t data structure)
|
||||
* Purpose: Quick and dirty routine to retrieve the size of the file's size
|
||||
* of addresses
|
||||
*
|
||||
* Return: 'sizeof_addr' on success/abort on failure (shouldn't fail)
|
||||
*-------------------------------------------------------------------------
|
||||
@@ -394,9 +393,8 @@ H5F_sizeof_addr(const H5F_t *f)
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_sizeof_size
|
||||
*
|
||||
* Purpose: Quick and dirty routine to retrieve the size of the file's off_t
|
||||
* (Mainly added to stop non-file routines from poking about in the
|
||||
* H5F_t data structure)
|
||||
* Purpose: Quick and dirty routine to retrieve the size of the file's size
|
||||
* of sizes
|
||||
*
|
||||
* Return: 'sizeof_size' on success/abort on failure (shouldn't fail)
|
||||
*-------------------------------------------------------------------------
|
||||
|
||||
+36
-45
@@ -1400,14 +1400,14 @@ done:
|
||||
} /* end H5P__dcrt_ext_file_list_get() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__dcrt_ext_file_list_enc
|
||||
* Function: H5P__dcrt_ext_file_list_enc
|
||||
*
|
||||
* Purpose: Callback routine which is called whenever the efl
|
||||
* property in the dataset creation property list is
|
||||
* encoded.
|
||||
* Purpose: Callback routine which is called whenever the efl
|
||||
* property in the dataset creation property list is
|
||||
* encoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1426,7 +1426,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size)
|
||||
/* Sanity check */
|
||||
assert(efl);
|
||||
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
|
||||
HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t));
|
||||
HDcompile_assert(sizeof(HDoff_t) <= sizeof(uint64_t));
|
||||
HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t));
|
||||
assert(size);
|
||||
|
||||
@@ -1459,14 +1459,14 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size)
|
||||
*(*pp)++ = (uint8_t)enc_size;
|
||||
UINT64ENCODE_VAR(*pp, enc_value, enc_size);
|
||||
|
||||
/* encode size */
|
||||
/* Encode size */
|
||||
enc_value = (uint64_t)efl->slot[u].size;
|
||||
enc_size = H5VM_limit_enc_size(enc_value);
|
||||
assert(enc_size < 256);
|
||||
*(*pp)++ = (uint8_t)enc_size;
|
||||
UINT64ENCODE_VAR(*pp, enc_value, enc_size);
|
||||
} /* end for */
|
||||
} /* end if */
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculate size needed for encoding */
|
||||
*size += (1 + H5VM_limit_enc_size((uint64_t)efl->nused));
|
||||
@@ -1476,20 +1476,20 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size)
|
||||
*size += len;
|
||||
*size += (1 + H5VM_limit_enc_size((uint64_t)efl->slot[u].offset));
|
||||
*size += (1 + H5VM_limit_enc_size((uint64_t)efl->slot[u].size));
|
||||
} /* end for */
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5P__dcrt_ext_file_list_enc() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P__dcrt_ext_file_list_dec
|
||||
* Function: H5P__dcrt_ext_file_list_dec
|
||||
*
|
||||
* Purpose: Callback routine which is called whenever the efl
|
||||
* property in the dataset creation property list is
|
||||
* decoded.
|
||||
* Purpose: Callback routine which is called whenever the efl
|
||||
* property in the dataset creation property list is
|
||||
* decoded.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1510,7 +1510,7 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value)
|
||||
assert(*pp);
|
||||
assert(efl);
|
||||
HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t));
|
||||
HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t));
|
||||
HDcompile_assert(sizeof(HDoff_t) <= sizeof(uint64_t));
|
||||
HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t));
|
||||
|
||||
/* Set property to default value */
|
||||
@@ -1533,7 +1533,7 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value)
|
||||
|
||||
efl->nalloc = na;
|
||||
efl->slot = x;
|
||||
} /* end if */
|
||||
}
|
||||
|
||||
/* Decode length of slot name */
|
||||
enc_size = *(*pp)++;
|
||||
@@ -1545,13 +1545,13 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value)
|
||||
efl->slot[u].name = H5MM_xstrdup((const char *)(*pp));
|
||||
*pp += len;
|
||||
|
||||
/* decode offset */
|
||||
/* Decode offset */
|
||||
enc_size = *(*pp)++;
|
||||
assert(enc_size < 256);
|
||||
UINT64DECODE_VAR(*pp, enc_value, enc_size);
|
||||
efl->slot[u].offset = (HDoff_t)enc_value;
|
||||
|
||||
/* decode size */
|
||||
/* Decode size */
|
||||
enc_size = *(*pp)++;
|
||||
assert(enc_size < 256);
|
||||
UINT64DECODE_VAR(*pp, enc_value, enc_size);
|
||||
@@ -1559,7 +1559,7 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value)
|
||||
|
||||
efl->slot[u].name_offset = 0; /*not entered into heap yet*/
|
||||
efl->nused++;
|
||||
} /* end for */
|
||||
}
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@@ -2680,28 +2680,28 @@ done:
|
||||
} /* end H5Pget_external_count() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_external
|
||||
* Function: H5Pget_external
|
||||
*
|
||||
* Purpose: Returns information about an external file. External files
|
||||
* are numbered from zero to N-1 where N is the value returned
|
||||
* by H5Pget_external_count(). At most NAME_SIZE characters are
|
||||
* copied into the NAME array. If the external file name is
|
||||
* longer than NAME_SIZE with the null terminator, then the
|
||||
* return value is not null terminated (similar to strncpy()).
|
||||
* Purpose: Returns information about an external file. External files
|
||||
* are numbered from zero to N-1 where N is the value returned
|
||||
* by H5Pget_external_count(). At most NAME_SIZE characters are
|
||||
* copied into the NAME array. If the external file name is
|
||||
* longer than NAME_SIZE with the null terminator, then the
|
||||
* return value is not null terminated (similar to strncpy()).
|
||||
*
|
||||
* If NAME_SIZE is zero or NAME is the null pointer then the
|
||||
* external file name is not returned. If OFFSET or SIZE are
|
||||
* null pointers then the corresponding information is not
|
||||
* returned.
|
||||
* If NAME_SIZE is zero or NAME is the null pointer then the
|
||||
* external file name is not returned. If OFFSET or SIZE are
|
||||
* null pointers then the corresponding information is not
|
||||
* returned.
|
||||
*
|
||||
* See Also: H5Pset_external()
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out*/, off_t *offset /*out*/,
|
||||
H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out*/, HDoff_t *offset /*out*/,
|
||||
hsize_t *size /*out*/)
|
||||
{
|
||||
H5O_efl_t efl;
|
||||
@@ -2724,17 +2724,8 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out
|
||||
/* Return values */
|
||||
if (name_size > 0 && name)
|
||||
strncpy(name, efl.slot[idx].name, name_size);
|
||||
/* XXX: Badness!
|
||||
*
|
||||
* The offset parameter is of type off_t and the offset field of H5O_efl_entry_t
|
||||
* is HDoff_t which is a different type on Windows (off_t is a 32-bit long,
|
||||
* HDoff_t is __int64, a 64-bit type).
|
||||
*
|
||||
* In a future API reboot, we'll either want to make this parameter a haddr_t
|
||||
* or define a 64-bit HDF5-specific offset type that is platform-independent.
|
||||
*/
|
||||
if (offset)
|
||||
*offset = (off_t)efl.slot[idx].offset;
|
||||
*offset = efl.slot[idx].offset;
|
||||
if (size)
|
||||
*size = efl.slot[idx].size;
|
||||
|
||||
|
||||
+10
-5
@@ -6033,15 +6033,17 @@ H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize);
|
||||
* are null pointers then the corresponding information is not
|
||||
* returned.
|
||||
*
|
||||
* \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.
|
||||
* \note In 1.14.x and earlier, the offset parameter was of type off_t,
|
||||
* which is a 32-bit signed long value on Windows, which limited
|
||||
* the valid offset that can be returned to 2 GiB.
|
||||
*
|
||||
* \version 1.16.0 \p offset parameter type changed to HDoff_t from off_t.
|
||||
* \version 1.6.4 \p idx parameter type changed to unsigned.
|
||||
* \since 1.0.0
|
||||
*
|
||||
*/
|
||||
H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out*/,
|
||||
off_t *offset /*out*/, hsize_t *size /*out*/);
|
||||
HDoff_t *offset /*out*/, hsize_t *size /*out*/);
|
||||
/**
|
||||
* \ingroup DCPL
|
||||
*
|
||||
@@ -6527,9 +6529,12 @@ H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize);
|
||||
* when H5Dwrite() is called to write data to it, the library
|
||||
* will create the file.
|
||||
*
|
||||
* \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.
|
||||
*
|
||||
* \note In 1.14.x and earlier, the offset parameter was of type off_t,
|
||||
* which is a 32-bit signed long value on Windows, which limited
|
||||
* the valid offset that can be set to 2 GiB.
|
||||
*
|
||||
* \version 1.16.0 \p offset parameter type changed to HDoff_t from off_t.
|
||||
* \since 1.0.0
|
||||
*
|
||||
*/
|
||||
|
||||
+1
-1
@@ -7189,7 +7189,7 @@ test_copy_dcpl(hid_t file, hid_t fapl)
|
||||
TEST_ERROR;
|
||||
if (H5Premove_filter(dcpl, H5Z_FILTER_FLETCHER32) < 0)
|
||||
TEST_ERROR;
|
||||
if (H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, (off_t)0, (hsize_t)(500 * 4096 * sizeof(int))) < 0)
|
||||
if (H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, 0, (hsize_t)(500 * 4096 * sizeof(int))) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Create second dataset of contiguous layout with external storage */
|
||||
|
||||
+11
-11
@@ -97,7 +97,7 @@ test_non_extendible(hid_t file)
|
||||
hsize_t cur_size[1] = {100}; /* data space current size */
|
||||
hsize_t max_size[1] = {100}; /* data space maximum size */
|
||||
int n = 0; /* number of external files */
|
||||
off_t file_offset = 0; /* external file offset */
|
||||
HDoff_t file_offset = 0; /* external file offset */
|
||||
hsize_t file_size = 0; /* sizeof external file segment */
|
||||
haddr_t dset_addr = HADDR_UNDEF; /* address of dataset */
|
||||
|
||||
@@ -363,7 +363,7 @@ test_unlimited(hid_t file)
|
||||
hsize_t cur_size[1] = {100}; /* data space current size */
|
||||
hsize_t max_size[1] = {H5S_UNLIMITED}; /* data space maximum size */
|
||||
int n; /* number of external files */
|
||||
off_t file_offset; /* external file offset */
|
||||
HDoff_t file_offset; /* external file offset */
|
||||
hsize_t file_size; /* sizeof external file segment */
|
||||
|
||||
TESTING("unlimited dataspace, unlimited external storage");
|
||||
@@ -446,7 +446,7 @@ error:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, hsize_t max_ext_size)
|
||||
add_external_files(hid_t dcpl_id, unsigned int n_external_files, HDoff_t offset, hsize_t max_ext_size)
|
||||
{
|
||||
char exname[AEF_EXNAME_MAX_LEN + 1];
|
||||
unsigned int i = 0;
|
||||
@@ -704,7 +704,7 @@ test_read_file_set(hid_t fapl)
|
||||
FAIL_STACK_ERROR;
|
||||
for (i = 0; i < N_EXT_FILES; i++) {
|
||||
snprintf(filename, sizeof(filename), "extern_%dr.raw", (int)i + 1);
|
||||
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
if (H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
}
|
||||
|
||||
@@ -823,7 +823,7 @@ test_write_file_set(hid_t fapl)
|
||||
else
|
||||
size = H5F_UNLIMITED;
|
||||
|
||||
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), size) < 0)
|
||||
if (H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), size) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
} /* end for */
|
||||
|
||||
@@ -946,9 +946,9 @@ test_path_absolute(hid_t fapl)
|
||||
if (i == 1)
|
||||
snprintf(filename, sizeof(filename), "%s%sextern_%zur.raw", cwdpath + 2, H5_DIR_SEPS, i + 1);
|
||||
#endif
|
||||
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
if (H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
} /* end for */
|
||||
}
|
||||
|
||||
/* create the dataspace */
|
||||
cur_size = TOTAL_SIZE;
|
||||
@@ -1036,9 +1036,9 @@ test_path_relative(hid_t fapl)
|
||||
FAIL_STACK_ERROR;
|
||||
for (i = 0; i < N_EXT_FILES; i++) {
|
||||
snprintf(filename, sizeof(filename), "extern_%dr.raw", (int)i + 1);
|
||||
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
if (H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
} /* end for */
|
||||
}
|
||||
|
||||
cur_size = TOTAL_SIZE;
|
||||
if ((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
|
||||
@@ -1130,9 +1130,9 @@ test_path_relative_cwd(hid_t fapl)
|
||||
FAIL_STACK_ERROR;
|
||||
for (i = 0; i < N_EXT_FILES; i++) {
|
||||
snprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int)i + 1);
|
||||
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
if (H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
} /* end for */
|
||||
}
|
||||
|
||||
cur_size = TOTAL_SIZE;
|
||||
if ((space = H5Screate_simple(1, &cur_size, NULL)) < 0)
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ test_path_env(hid_t fapl)
|
||||
FAIL_STACK_ERROR;
|
||||
for (i = 0; i < N_EXT_FILES; i++) {
|
||||
snprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int)i + 1);
|
||||
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
if (H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
} /* end for */
|
||||
|
||||
|
||||
+1
-1
@@ -1839,7 +1839,7 @@ test_external(hid_t fapl, bool use_select_io)
|
||||
{
|
||||
|
||||
char name[256]; /*external file name */
|
||||
off_t file_offset; /*external file offset */
|
||||
HDoff_t file_offset; /*external file offset */
|
||||
hsize_t file_size; /*sizeof external file segment */
|
||||
|
||||
if (H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset, &file_size) < 0)
|
||||
|
||||
@@ -3144,7 +3144,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
|
||||
H5D_layout_t stl = H5D_LAYOUT_ERROR;
|
||||
size_t ncols = 80; /* available output width */
|
||||
size_t cd_nelmts; /* filter client number of values */
|
||||
off_t offset; /* offset of external file */
|
||||
HDoff_t offset; /* offset of external file */
|
||||
char f_name[256]; /* filter name */
|
||||
char name[256]; /* external or virtual file name */
|
||||
hsize_t chsize[64]; /* chunk size in elements */
|
||||
|
||||
@@ -1841,7 +1841,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
|
||||
size_t cd_num; /* filter client data counter */
|
||||
char f_name[256]; /* filter/file name */
|
||||
char s[64]; /* temporary string buffer */
|
||||
off_t f_offset; /* offset in external file */
|
||||
HDoff_t f_offset; /* offset in external file */
|
||||
hsize_t f_size; /* bytes used in external file */
|
||||
hsize_t total, used; /* total size or offset */
|
||||
int ndims; /* dimensionality */
|
||||
|
||||
+28
-35
@@ -65,28 +65,28 @@ usage(const char *progname)
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: get_size
|
||||
*
|
||||
* Purpose: Reads a size option of the form `-XNS' where `X' is any
|
||||
* letter, `N' is a multi-character positive decimal number, and
|
||||
* `S' is an optional suffix letter in the set [GgMmk]. The
|
||||
* option may also be split among two arguments as: `-X NS'.
|
||||
* The input value of ARGNO is the argument number for the
|
||||
* switch in the ARGV vector and ARGC is the number of entries
|
||||
* in that vector.
|
||||
* Purpose: Reads a size option of the form `-XNS' where `X' is any
|
||||
* letter, `N' is a multi-character positive decimal number, and
|
||||
* `S' is an optional suffix letter in the set [GgMmk]. The
|
||||
* option may also be split among two arguments as: `-X NS'.
|
||||
* The input value of ARGNO is the argument number for the
|
||||
* switch in the ARGV vector and ARGC is the number of entries
|
||||
* in that vector.
|
||||
*
|
||||
* Return: Success: The value N multiplied according to the
|
||||
* suffix S. On return ARGNO will be the number
|
||||
* of the next argument to process.
|
||||
* Return: Success: The value N multiplied according to the
|
||||
* suffix S. On return ARGNO will be the number
|
||||
* of the next argument to process.
|
||||
*
|
||||
* Failure: Calls usage() which exits with a non-zero
|
||||
* status.
|
||||
* Failure: Calls usage() which exits with a non-zero
|
||||
* status.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static off_t
|
||||
static HDoff_t
|
||||
get_size(const char *progname, int *argno, int argc, char *argv[])
|
||||
{
|
||||
off_t retval = -1;
|
||||
char *suffix = NULL;
|
||||
HDoff_t retval = -1;
|
||||
char *suffix = NULL;
|
||||
|
||||
if (isdigit((int)(argv[*argno][2]))) {
|
||||
retval = strtol(argv[*argno] + 2, &suffix, 10);
|
||||
@@ -126,13 +126,6 @@ get_size(const char *progname, int *argno, int argc, char *argv[])
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Split an hdf5 file
|
||||
*
|
||||
* Return: Success:
|
||||
*
|
||||
* Failure:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
|
||||
@@ -163,12 +156,12 @@ main(int argc, char *argv[])
|
||||
int dst_is_family; /*is dst name a family name? */
|
||||
int dst_membno = 0; /*destination member number */
|
||||
|
||||
off_t left_overs = 0; /*amount of zeros left over */
|
||||
off_t src_offset = 0; /*offset in source member */
|
||||
off_t dst_offset = 0; /*offset in destination member */
|
||||
off_t src_size; /*source logical member size */
|
||||
off_t src_act_size; /*source actual member size */
|
||||
off_t dst_size = 1 GB; /*destination logical memb size */
|
||||
HDoff_t left_overs = 0; /*amount of zeros left over */
|
||||
HDoff_t src_offset = 0; /*offset in source member */
|
||||
HDoff_t dst_offset = 0; /*offset in destination member */
|
||||
HDoff_t src_size; /*source logical member size */
|
||||
HDoff_t src_act_size; /*source actual member size */
|
||||
HDoff_t dst_size = 1 GB; /*destination logical memb size */
|
||||
hid_t fapl; /*file access property list */
|
||||
hid_t file;
|
||||
hsize_t hdsize; /*destination logical memb size */
|
||||
@@ -283,14 +276,14 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
n = blk_size;
|
||||
if (dst_is_family)
|
||||
n = (size_t)MIN((off_t)n, dst_size - dst_offset);
|
||||
n = (size_t)MIN((HDoff_t)n, dst_size - dst_offset);
|
||||
if (left_overs) {
|
||||
n = (size_t)MIN((off_t)n, left_overs);
|
||||
left_overs = left_overs - (off_t)n;
|
||||
n = (size_t)MIN((HDoff_t)n, left_overs);
|
||||
left_overs = left_overs - (HDoff_t)n;
|
||||
need_write = false;
|
||||
}
|
||||
else if (src_offset < src_act_size) {
|
||||
n = (size_t)MIN((off_t)n, src_act_size - src_offset);
|
||||
n = (size_t)MIN((HDoff_t)n, src_act_size - src_offset);
|
||||
if ((nio = HDread(src, buf, n)) < 0) {
|
||||
perror("read");
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -343,16 +336,16 @@ main(int argc, char *argv[])
|
||||
* loop. The destination offset must be updated so we can fix
|
||||
* trailing holes.
|
||||
*/
|
||||
src_offset = src_offset + (off_t)n;
|
||||
src_offset = src_offset + (HDoff_t)n;
|
||||
if (src_offset == src_act_size) {
|
||||
HDclose(src);
|
||||
if (!src_is_family) {
|
||||
dst_offset = dst_offset + (off_t)n;
|
||||
dst_offset = dst_offset + (HDoff_t)n;
|
||||
break;
|
||||
}
|
||||
snprintf(src_name, NAMELEN, src_gen_name, ++src_membno);
|
||||
if ((src = HDopen(src_name, O_RDONLY)) < 0 && ENOENT == errno) {
|
||||
dst_offset = dst_offset + (off_t)n;
|
||||
dst_offset = dst_offset + (HDoff_t)n;
|
||||
break;
|
||||
}
|
||||
else if (src < 0) {
|
||||
|
||||
Reference in New Issue
Block a user