summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c10
-rw-r--r--src/H5Dpublic.h13
-rw-r--r--src/H5Dscatgath.c204
-rw-r--r--src/H5FDcore.c8
-rw-r--r--src/H5FDmulti.c246
-rw-r--r--src/H5FDmulti.h3
-rw-r--r--src/H5FDstdio.c58
-rw-r--r--src/H5Gint.c4
-rw-r--r--src/H5Gname.c55
-rw-r--r--src/H5Gtest.c2
-rw-r--r--src/H5HFdbg.c18
-rw-r--r--src/H5Lexternal.c47
-rw-r--r--src/H5Ocopy.c2
-rw-r--r--src/H5Oname.c12
-rw-r--r--src/H5T.c4
-rw-r--r--src/H5Tconv.c19
-rw-r--r--src/H5private.h55
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5system.c536
-rw-r--r--src/Makefile.in4
20 files changed, 725 insertions, 579 deletions
diff --git a/src/H5.c b/src/H5.c
index 9a30244..8c0be08 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -717,14 +717,14 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
if (!disable_version_check){
/*
- *verify if H5_VERS_INFO is consistent with the other version information.
- *Check only the first sizeof(lib_str) char. Assume the information
- *will fit within this size or enough significance.
+ * Verify if H5_VERS_INFO is consistent with the other version information.
+ * Check only the first sizeof(lib_str) char. Assume the information
+ * will fit within this size or enough significance.
*/
- sprintf(lib_str, "HDF5 library version: %d.%d.%d",
+ HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d",
H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
if(*substr) {
- HDstrcat(lib_str, "-");
+ HDstrncat(lib_str, "-", 1);
HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
} /* end if */
if (HDstrcmp(lib_str, H5_lib_vers_info_g)){
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 523f2b2..484b176 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -107,6 +107,15 @@ extern "C" {
typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim,
const hsize_t *point, void *operator_data);
+/* Define the operator function pointer for H5Dscatter() */
+typedef herr_t (*H5D_scatter_func_t)(void **src_buf/*out*/,
+ size_t *src_buf_bytes_used/*out*/,
+ void *op_data);
+
+/* Define the operator function pointer for H5Dgather() */
+typedef herr_t (*H5D_gather_func_t)(const void *dst_buf,
+ size_t dst_buf_bytes_used, void *op_data);
+
H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id,
hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id);
H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id,
@@ -131,6 +140,10 @@ H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_
H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf,
hid_t buf_type, hid_t space);
H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
+H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
+ hid_t dst_space_id, void *dst_buf);
+H5_DLL herr_t H5Dgather(hid_t src_space_id, void *src_buf, hid_t type_id,
+ size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data);
H5_DLL herr_t H5Ddebug(hid_t dset_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 49b6132..60a8800 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -27,6 +27,7 @@
#include "H5Dpkg.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
/****************/
@@ -361,7 +362,7 @@ done:
* copies them into the gather buffer TGATH_BUF.
* Each element is ELMT_SIZE bytes and arranged in application
* memory according to SPACE.
- * The caller is requesting that at most NELMTS be gathered.
+ * The caller is requesting that exactly NELMTS be gathered.
*
* Return: Success: Number of elements copied.
* Failure: 0
@@ -899,3 +900,204 @@ H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__compound_opt_write() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dscatter
+ *
+ * Purpose: Scatters data provided by the callback op to the
+ * destination buffer dst_buf, where the dimensions of
+ * dst_buf and the selection to be scattered to are specified
+ * by the dataspace dst_space_id. The type of the data to be
+ * scattered is specified by type_id.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 14 Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
+ hid_t dst_space_id, void *dst_buf)
+{
+ H5T_t *type; /* Datatype */
+ H5S_t *dst_space; /* Dataspace */
+ H5S_sel_iter_t iter; /* Selection iteration info*/
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ void *src_buf = NULL; /* Source (contiguous) data buffer */
+ size_t src_buf_nbytes = 0; /* Size of src_buf */
+ size_t type_size; /* Datatype element size */
+ hssize_t nelmts; /* Number of remaining elements in selection */
+ size_t nelmts_scatter = 0; /* Number of elements to scatter to dst_buf */
+ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
+ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "x*xii*x", op, op_data, type_id, dst_space_id, dst_buf);
+
+ /* Check args */
+ if(op == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback function pointer")
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(NULL == (dst_space= (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(dst_buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
+
+ /* Fill the DXPL cache values for later use */
+ if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+
+ /* Get datatype element size */
+ if(0 == (type_size = H5T_GET_SIZE(type)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
+
+ /* Get number of elements in dataspace */
+ if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+
+ /* Initialize selection iterator */
+ if(H5S_select_iter_init(&iter, dst_space, type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
+ iter_init = TRUE;
+
+ /* Loop until all data has been scattered */
+ while(nelmts > 0) {
+ /* Make callback to retrieve data */
+ if(op(&src_buf, &src_buf_nbytes, op_data) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
+
+ /* Calculate number of elements */
+ nelmts_scatter = src_buf_nbytes / type_size;
+
+ /* Check callback results */
+ if(!src_buf)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback did not return a buffer")
+ if(src_buf_nbytes == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned a buffer size of 0")
+ if(src_buf_nbytes % type_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size is not a multiple of datatype size")
+ if(nelmts_scatter > (size_t)nelmts)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection")
+
+ /* Scatter data */
+ if(H5D__scatter_mem(src_buf, dst_space, &iter, nelmts_scatter, dxpl_cache, dst_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
+
+ nelmts -= (hssize_t)nelmts_scatter;
+ } /* end while */
+
+done:
+ /* Release selection iterator */
+ if(iter_init) {
+ if(H5S_SELECT_ITER_RELEASE(&iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ } /* end if */
+
+ FUNC_LEAVE_API(ret_value)
+} /* H5Dscatter() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dgather
+ *
+ * Purpose: Gathers data provided from the source buffer src_buf to
+ * contiguous buffer dst_buf, then calls the callback op.
+ * The dimensions of src_buf and the selection to be gathered
+ * are specified by the dataspace src_space_id. The type of
+ * the data to be gathered is specified by type_id.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * 16 Jan 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dgather(hid_t src_space_id, void *src_buf, hid_t type_id, size_t dst_buf_size,
+ void *dst_buf, H5D_gather_func_t op, void *op_data)
+{
+ H5T_t *type; /* Datatype */
+ H5S_t *src_space; /* Dataspace */
+ H5S_sel_iter_t iter; /* Selection iteration info*/
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ size_t type_size; /* Datatype element size */
+ hssize_t nelmts; /* Number of remaining elements in selection */
+ size_t dst_buf_nelmts; /* Number of elements that can fit in dst_buf */
+ size_t nelmts_gathered; /* Number of elements gathered from src_buf */
+ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
+ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "i*xiz*xx*x", src_space_id, src_buf, type_id, dst_buf_size,
+ dst_buf, op, op_data);
+
+ /* Check args */
+ if(NULL == (src_space= (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(src_buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source buffer provided")
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ if(dst_buf_size == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0")
+ if(dst_buf == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided")
+
+ /* Fill the DXPL cache values for later use */
+ if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+
+ /* Get datatype element size */
+ if(0 == (type_size = H5T_GET_SIZE(type)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size")
+
+ /* Get number of elements in dst_buf_size */
+ dst_buf_nelmts = dst_buf_size / type_size;
+ if(dst_buf_nelmts == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer is not large enough to hold one element")
+
+ /* Get number of elements in dataspace */
+ if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(src_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+
+ /* If dst_buf is not large enough to hold all the elements, make sure there
+ * is a callback */
+ if(((size_t)nelmts > dst_buf_nelmts) && (op == NULL))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small")
+
+ /* Initialize selection iterator */
+ if(H5S_select_iter_init(&iter, src_space, type_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
+ iter_init = TRUE;
+
+ /* Loop until all data has been scattered */
+ while(nelmts > 0) {
+ /* Gather data */
+ if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, src_space, &iter, MIN(dst_buf_nelmts, (size_t)nelmts), dxpl_cache, dst_buf)))
+ HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed")
+ HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));
+
+ /* Make callback to process dst_buf */
+ if(op && op(dst_buf, nelmts_gathered * type_size, op_data) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure")
+
+ nelmts -= (hssize_t)nelmts_gathered;
+ HDassert(op || (nelmts == 0));
+ } /* end while */
+
+done:
+ /* Release selection iterator */
+ if(iter_init) {
+ if(H5S_SELECT_ITER_RELEASE(&iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ } /* end if */
+
+ FUNC_LEAVE_API(ret_value)
+} /* H5Dgather() */
+
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 03cc15e..43c8945 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -570,6 +570,14 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
ret_value = (H5FD_t *)file;
done:
+ if(!ret_value && file) {
+ if(file->fd >= 0)
+ HDclose(file->fd);
+ H5MM_xfree(file->name);
+ H5MM_xfree(file->mem);
+ H5MM_xfree(file);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_core_open() */
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 16934e3..9d6e065 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -77,6 +77,7 @@
#define H5FD_MULTI_DXPL_PROP_NAME "H5FD_MULTI_DXPL"
#define H5FD_MULTI_DXPL_PROP_SIZE sizeof(H5FD_multi_dxpl_t)
+#define H5FD_MULT_MAX_FILE_NAME_LEN 1024
/* The driver identification number, initialized at runtime */
static hid_t H5FD_MULTI_g = 0;
@@ -207,12 +208,14 @@ static char *
my_strdup(const char *s)
{
char *x;
+ size_t str_len;
if(!s)
return NULL;
- if(NULL == (x = (char *)malloc(strlen(s) + 1)))
+ str_len = strlen(s) + 1;
+ if(NULL == (x = (char *)malloc(str_len)))
return NULL;
- strcpy(x, s);
+ memcpy(x, s, str_len);
return x;
}
@@ -301,7 +304,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id,
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
const char *memb_name[H5FD_MEM_NTYPES];
- char meta_name[1024], raw_name[1024];
+ char meta_name[H5FD_MULT_MAX_FILE_NAME_LEN], raw_name[H5FD_MULT_MAX_FILE_NAME_LEN];
haddr_t memb_addr[H5FD_MEM_NTYPES];
/*NO TRACE*/
@@ -324,25 +327,39 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id,
/* The names */
/* process meta filename */
- if (meta_ext){
- if (strstr(meta_ext, "%s"))
- strcpy(meta_name, meta_ext);
+ if(meta_ext) {
+ if(strstr(meta_ext, "%s")) {
+ /* Note: this doesn't accommodate for when the '%s' in the user's
+ * string is at a position >sizeof(meta_name) - QK & JK - 2013/01/17
+ */
+ strncpy(meta_name, meta_ext, sizeof(meta_name));
+ meta_name[sizeof(meta_name) - 1] = '\0';
+ }
else
sprintf(meta_name, "%%s%s", meta_ext);
}
- else
- strcpy(meta_name, "%s.meta");
+ else {
+ strncpy(meta_name, "%s.meta", sizeof(meta_name));
+ meta_name[sizeof(meta_name) - 1] = '\0';
+ }
memb_name[H5FD_MEM_SUPER] = meta_name;
/* process raw filename */
- if (raw_ext){
- if (strstr(raw_ext, "%s"))
- strcpy(raw_name, raw_ext);
+ if(raw_ext) {
+ if(strstr(raw_ext, "%s")) {
+ /* Note: this doesn't accommodate for when the '%s' in the user's
+ * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17
+ */
+ strncpy(raw_name, raw_ext, sizeof(raw_name));
+ raw_name[sizeof(raw_name) - 1] = '\0';
+ }
else
sprintf(raw_name, "%%s%s", raw_ext);
}
- else
- strcpy(raw_name, "%s.raw");
+ else {
+ strncpy(raw_name, "%s.raw", sizeof(raw_name));
+ raw_name[sizeof(raw_name) - 1] = '\0';
+ }
memb_name[H5FD_MEM_DRAW] = raw_name;
/* The sizes */
@@ -573,12 +590,11 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/,
memb_fapl[mt] = fa->memb_fapl[mt]; /*default or bad ID*/
}
}
- if (memb_name) {
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
- if (fa->memb_name[mt]) {
- memb_name[mt] = (char *)malloc(strlen(fa->memb_name[mt])+1);
- strcpy(memb_name[mt], fa->memb_name[mt]);
- } else
+ if(memb_name) {
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if(fa->memb_name[mt])
+ memb_name[mt] = my_strdup(fa->memb_name[mt]);
+ else
memb_name[mt] = NULL;
}
}
@@ -710,150 +726,6 @@ H5FD_multi_dxpl_cls_cb(const char *name, size_t size, void *_dx)
return 0;
} /* end H5FD_multi_dxpl_cls_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_dxpl_multi
- *
- * Purpose: Set the data transfer property list DXPL_ID to use the multi
- * driver with the specified data transfer properties for each
- * memory usage type MEMB_DXPL[] (after the usage map is
- * applied).
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Tuesday, August 10, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
-{
- H5FD_multi_dxpl_t dx;
- H5FD_mem_t mt;
- htri_t prop_exists; /* Whether the multi VFD DXPL property already exists */
- static const char *func = "H5FDset_dxpl_multi"; /* Function Name for error reporting */
-
- /*NO TRACE*/
-
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
- /* Check arguments */
- if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
- if(!memb_dxpl)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1)
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
- if(memb_dxpl[mt] != H5P_DEFAULT && TRUE != H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
- } /* end for */
-
- /* Check for existence of multi VFD DXPL property in DXPL */
- if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
-
- /* Copy the DXPLs to internal property, converting "generic" default
- * property lists into default dataset transfer property lists */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
- if(memb_dxpl[mt] == H5P_DEFAULT)
- dx.memb_dxpl[mt] = H5P_DATASET_XFER_DEFAULT;
- else {
- if((dx.memb_dxpl[mt] = H5Pcopy(memb_dxpl[mt])) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTCOPY, "can't copy dataset transfer property list", -1)
- } /* end else */
- } /* end for */
-
- /* Clear previous property, if it exists */
- if(prop_exists) {
- H5FD_multi_dxpl_t old_dx;
-
- /* Get the old DXPL value */
- if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &old_dx) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get previous property value", -1)
-
- ALL_MEMBERS(mt) {
- if(old_dx.memb_dxpl[mt] >= 0)
- if(H5Pclose(old_dx.memb_dxpl[mt]) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTCLOSEOBJ, "can't close property list", -1)
- } END_MEMBERS;
-
- /* Set the new value */
- if(H5Pset(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get previous property value", -1)
- } /* end if */
- else {
- /* Insert multi VFD DXPL property into property list */
- if(H5Pinsert2(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, H5FD_MULTI_DXPL_PROP_SIZE, &dx, NULL, NULL, NULL, H5FD_multi_dxpl_copy_cb, H5FD_multi_dxpl_cmp_cb, H5FD_multi_dxpl_cls_cb) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTINSERT, "can't insert multi VFD DXPL property", -1)
- } /* end else */
-
- return 0;
-} /* end H5Pset_dxpl_multi() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_dxpl_multi
- *
- * Purpose: Returns information which was set with H5Pset_dxpl_multi()
- * above.
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Tuesday, August 10, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/)
-{
- H5FD_multi_dxpl_t dx;
- H5FD_mem_t mt;
- htri_t prop_exists; /* Whether the multi VFD DXPL property already exists */
- static const char *func = "H5FDget_dxpl_multi"; /* Function Name for error reporting */
-
- /*NO TRACE*/
-
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
- /* Argument checking */
- if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
-
- if(memb_dxpl) {
- /* Check for existence of multi VFD DXPL property in DXPL */
- if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
- if(!prop_exists)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "multi VFD DXPL property not set", -1)
-
- /* Get the DXPL value */
- if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get property value", -1)
-
- /* Deep copy the multi VFD DXPL value */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
- if(dx.memb_dxpl[mt] >= 0)
- memb_dxpl[mt] = H5Pcopy(dx.memb_dxpl[mt]);
- else
- memb_dxpl[mt] = dx.memb_dxpl[mt]; /*default or bad ID */
- } /* end for */
- } /* end if */
-
- return 0;
-} /* end H5Pget_dxpl_multi() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_multi_sb_size
@@ -969,17 +841,17 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/,
p += sizeof(haddr_t);
nseen++;
} END_MEMBERS;
- if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen*2, buf+8, NULL,
- H5P_DEFAULT)<0)
+ if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen*2, buf+8, NULL, H5P_DEFAULT)<0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1)
/* Encode all name templates */
p = buf + 8 + nseen*2*8;
UNIQUE_MEMBERS(file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt]) + 1;
- strcpy((char *)p, file->fa.memb_name[mt]);
+ strncpy((char *)p, file->fa.memb_name[mt], n);
p += n;
- for (i=n; i%8; i++) *p++ = '\0';
+ for (i=n; i%8; i++)
+ *p++ = '\0';
} END_MEMBERS;
return 0;
@@ -1209,19 +1081,21 @@ H5FD_multi_fapl_copy(const void *_old_fa)
ALL_MEMBERS(mt) {
if (old_fa->memb_fapl[mt]>=0) {
new_fa->memb_fapl[mt] = H5Pcopy(old_fa->memb_fapl[mt]);
- if (new_fa->memb_fapl[mt]<0) nerrors++;
+ if(new_fa->memb_fapl[mt]<0)
+ nerrors++;
}
if (old_fa->memb_name[mt]) {
- new_fa->memb_name[mt] = (char *)malloc(strlen(old_fa->memb_name[mt])+1);
+ new_fa->memb_name[mt] = my_strdup(old_fa->memb_name[mt]);
assert(new_fa->memb_name[mt]);
- strcpy(new_fa->memb_name[mt], old_fa->memb_name[mt]);
}
} END_MEMBERS;
if (nerrors) {
ALL_MEMBERS(mt) {
- if (new_fa->memb_fapl[mt]>=0) (void)H5Pclose(new_fa->memb_fapl[mt]);
- if (new_fa->memb_name[mt]) free(new_fa->memb_name[mt]);
+ if (new_fa->memb_fapl[mt]>=0)
+ (void)H5Pclose(new_fa->memb_fapl[mt]);
+ if (new_fa->memb_name[mt])
+ free(new_fa->memb_name[mt]);
} END_MEMBERS;
free(new_fa);
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL)
@@ -2191,7 +2065,7 @@ compute_next(H5FD_multi_t *file)
static int
open_members(H5FD_multi_t *file)
{
- char tmp[1024];
+ char tmp[H5FD_MULT_MAX_FILE_NAME_LEN];
int nerrors=0;
static const char *func="(H5FD_multi)open_members"; /* Function Name for error reporting */
@@ -2199,30 +2073,28 @@ open_members(H5FD_multi_t *file)
H5Eclear2(H5E_DEFAULT);
UNIQUE_MEMBERS(file->fa.memb_map, mt) {
- if (file->memb[mt]) continue; /*already open*/
+ if(file->memb[mt])
+ continue; /*already open*/
assert(file->fa.memb_name[mt]);
+ /* Note: This truncates the user's filename down to only sizeof(tmp)
+ * characters. -QK & JK, 2013/01/17
+ */
sprintf(tmp, file->fa.memb_name[mt], file->name);
#ifdef H5FD_MULTI_DEBUG
- if (file->flags & H5F_ACC_DEBUG) {
- fprintf(stderr, "H5FD_MULTI: open member %d \"%s\"\n",
- (int)mt, tmp);
- }
+ if(file->flags & H5F_ACC_DEBUG)
+ fprintf(stderr, "H5FD_MULTI: open member %d \"%s\"\n", (int)mt, tmp);
#endif
H5E_BEGIN_TRY {
- file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt],
- HADDR_UNDEF);
+ file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF);
} H5E_END_TRY;
- if (!file->memb[mt]) {
+ if(!file->memb[mt]) {
#ifdef H5FD_MULTI_DEBUG
- if (file->flags & H5F_ACC_DEBUG) {
- fprintf(stderr, "H5FD_MULTI: open failed for member %d\n",
- (int)mt);
- }
+ if(file->flags & H5F_ACC_DEBUG)
+ fprintf(stderr, "H5FD_MULTI: open failed for member %d\n", (int)mt);
#endif
- if (!file->fa.relax || (file->flags & H5F_ACC_RDWR)) {
+ if(!file->fa.relax || (file->flags & H5F_ACC_RDWR))
nerrors++;
- }
}
} END_MEMBERS;
if (nerrors)
diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h
index da16b0c..e819e74 100644
--- a/src/H5FDmulti.h
+++ b/src/H5FDmulti.h
@@ -34,9 +34,6 @@ H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/,
hid_t *memb_fapl/*out*/, char **memb_name/*out*/,
haddr_t *memb_addr/*out*/, hbool_t *relax/*out*/);
-H5_DLL herr_t H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl);
-H5_DLL herr_t H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/);
-
H5_DLL herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext,
hid_t meta_plist_id, const char *raw_ext,
hid_t raw_plist_id);
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 43bf6b9..8f4f7f0 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -365,26 +365,35 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
if (ADDR_OVERFLOW(maxaddr))
H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL)
- /* Attempt to open/create the file */
- if (access(name, F_OK) < 0) {
- if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_RDWR)) {
+ /* Tentatively open file in read-only mode, to check for existence */
+ if(flags & H5F_ACC_RDWR)
+ f = fopen(name, "rb+");
+ else
+ f = fopen(name, "rb");
+
+ if(!f) {
+ /* File doesn't exist */
+ if(flags & H5F_ACC_CREAT) {
+ assert(flags & H5F_ACC_RDWR);
f = fopen(name, "wb+");
write_access = 1; /* Note the write access */
}
else
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "file doesn't exist and CREAT wasn't specified", NULL)
- } else if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_EXCL)) {
+ } else if(flags & H5F_ACC_EXCL) {
+ /* File exists, but EXCL is passed. Fail. */
+ assert(flags & H5F_ACC_CREAT);
+ fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FILEEXISTS, "file exists but CREAT and EXCL were specified", NULL)
- } else if (flags & H5F_ACC_RDWR) {
- if (flags & H5F_ACC_TRUNC)
- f = fopen(name, "wb+");
- else
- f = fopen(name, "rb+");
+ } else if(flags & H5F_ACC_RDWR) {
+ if(flags & H5F_ACC_TRUNC)
+ f = freopen(name, "wb+", f);
write_access = 1; /* Note the write access */
- } else {
- f = fopen(name, "rb");
- }
- if (!f)
+ } /* end if */
+ /* Note there is no need to reopen if neither TRUNC nor EXCL are specified,
+ * as the tentative open will work */
+
+ if(!f)
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL)
/* Build the return value */
@@ -406,23 +415,36 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
/* Get the file descriptor (needed for truncate and some Windows information) */
file->fd = fileno(file->fp);
- if(file->fd < 0)
+ if(file->fd < 0) {
+ free(file);
+ fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get file descriptor", NULL);
+ } /* end if */
#ifdef H5_HAVE_WIN32_API
file->hFile = (HANDLE)_get_osfhandle(file->fd);
- if(INVALID_HANDLE_VALUE == file->hFile)
+ if(INVALID_HANDLE_VALUE == file->hFile) {
+ free(file);
+ fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file handle", NULL);
+ } /* end if */
- if(!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file desinformationcriptor", NULL);
+ if(!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) {
+ free(file);
+ fclose(f);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file descriptor information", NULL);
+ } /* end if */
file->nFileIndexHigh = fileinfo.nFileIndexHigh;
file->nFileIndexLow = fileinfo.nFileIndexLow;
file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber;
#else /* H5_HAVE_WIN32_API */
- fstat(file->fd, &sb);
+ if(fstat(file->fd, &sb) < 0) {
+ free(file);
+ fclose(f);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL)
+ } /* end if */
file->device = sb.st_dev;
#ifdef H5_VMS
file->inode[0] = sb.st_ino[0];
diff --git a/src/H5Gint.c b/src/H5Gint.c
index a38cac3..3eb374c 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -926,7 +926,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata)
/* Build the link's relative path name */
HDassert(udata->path[old_path_len] == '\0');
- HDstrcpy(&(udata->path[old_path_len]), lnk->name);
+ HDstrncpy(&(udata->path[old_path_len]), lnk->name, link_name_len + 1);
udata->curr_path_len += link_name_len;
/* Construct the link info from the link message */
@@ -990,7 +990,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata)
/* Add the path separator to the current path */
HDassert(udata->path[udata->curr_path_len] == '\0');
- HDstrcpy(&(udata->path[udata->curr_path_len]), "/");
+ HDstrncpy(&(udata->path[udata->curr_path_len]), "/", 2);
udata->curr_path_len++;
/* Attempt to get the link info for this group */
diff --git a/src/H5Gname.c b/src/H5Gname.c
index eb9cf10..fd8bf92 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -293,7 +293,9 @@ static H5RS_str_t *
H5G_build_fullpath(const char *prefix, const char *name)
{
char *full_path; /* Full user path built */
+ size_t orig_path_len; /* Original length of the path */
size_t path_len; /* Length of the path */
+ size_t name_len; /* Length of the name */
unsigned need_sep; /* Flag to indicate if separator is needed */
H5RS_str_t *ret_value; /* Return value */
@@ -304,7 +306,7 @@ H5G_build_fullpath(const char *prefix, const char *name)
HDassert(name);
/* Get the length of the prefix */
- path_len = HDstrlen(prefix);
+ orig_path_len = path_len = HDstrlen(prefix);
/* Determine if there is a trailing separator in the name */
if(prefix[path_len - 1] == '/')
@@ -313,20 +315,21 @@ H5G_build_fullpath(const char *prefix, const char *name)
need_sep = 1;
/* Add in the length needed for the '/' separator and the relative path */
- path_len += HDstrlen(name) + need_sep;
+ name_len = HDstrlen(name);
+ path_len += name_len + need_sep;
/* Allocate space for the path */
if(NULL == (full_path = (char *)H5FL_BLK_MALLOC(str_buf, path_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Build full path */
- HDstrcpy(full_path, prefix);
+ HDstrncpy(full_path, prefix, orig_path_len + 1);
if(need_sep)
- HDstrcat(full_path, "/");
- HDstrcat(full_path, name);
+ HDstrncat(full_path, "/", 1);
+ HDstrncat(full_path, name, name_len);
/* Create reference counted string for path */
- if((ret_value = H5RS_own(full_path)) == NULL)
+ if(NULL == (ret_value = H5RS_own(full_path)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
done:
@@ -423,7 +426,7 @@ H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *n
herr_t
H5G__name_init(H5G_name_t *name, const char *path)
{
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments */
HDassert(name);
@@ -717,6 +720,7 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char
path_len = HDstrlen(path);
if(full_suffix_len < path_len) {
const char *dst_suffix; /* Destination suffix that changes */
+ size_t dst_suffix_len; /* Length of destination suffix */
const char *src_suffix; /* Source suffix that changes */
size_t path_prefix_len; /* Length of path prefix */
const char *path_prefix2; /* 2nd prefix for path */
@@ -747,25 +751,26 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char
/* Determine destination suffix */
dst_suffix = dst_path + (common_prefix_len - 1);
+ dst_suffix_len = HDstrlen(dst_suffix);
/* Compute path prefix before src suffix*/
path_prefix2 = path;
path_prefix2_len = path_prefix_len - HDstrlen(src_suffix);
/* Allocate space for the new path */
- new_path_len = path_prefix2_len + HDstrlen(dst_suffix) + full_suffix_len;
+ new_path_len = path_prefix2_len + dst_suffix_len + full_suffix_len;
if(NULL == (new_path = (char *)H5FL_BLK_MALLOC(str_buf, new_path_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the new path */
if(path_prefix2_len > 0) {
- HDstrncpy(new_path, path_prefix2, path_prefix2_len);
- HDstrcpy(new_path + path_prefix2_len, dst_suffix);
+ HDstrncpy(new_path, path_prefix2, path_prefix2_len + 1);
+ HDstrncpy(new_path + path_prefix2_len, dst_suffix, dst_suffix_len + 1);
} /* end if */
else
- HDstrcpy(new_path, dst_suffix);
+ HDstrncpy(new_path, dst_suffix, dst_suffix_len + 1);
if(full_suffix_len > 0)
- HDstrcat(new_path, full_suffix);
+ HDstrncat(new_path, full_suffix, full_suffix_len);
/* Release previous path */
H5RS_decr(*path_r_ptr);
@@ -896,23 +901,25 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
if(obj_in_child) {
const char *full_path; /* Full path of current object */
const char *src_path; /* Full path of source object */
+ size_t src_path_len; /* Length of source full path */
char *new_full_path; /* New full path of object */
size_t new_full_len; /* Length of new full path */
/* Get pointers to paths of interest */
full_path = H5RS_get_str(obj_path->full_path_r);
src_path = H5RS_get_str(names->src_full_path_r);
+ src_path_len = HDstrlen(src_path);
/* Build new full path */
/* Allocate space for the new full path */
- new_full_len = HDstrlen(src_path) + HDstrlen(full_path);
+ new_full_len = src_path_len + HDstrlen(full_path);
if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, new_full_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the new full path */
- HDstrcpy(new_full_path, src_path);
- HDstrcat(new_full_path, full_path);
+ HDstrncpy(new_full_path, src_path, src_path_len + 1);
+ HDstrncat(new_full_path, full_path, new_full_len);
/* Release previous full path */
H5RS_decr(obj_path->full_path_r);
@@ -940,6 +947,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
if(obj_in_child) {
const char *full_path; /* Full path of current object */
const char *full_suffix; /* Full path after source path */
+ size_t full_suffix_len; /* Length of full path after source path */
const char *src_path; /* Full path of source object */
char *new_full_path; /* New full path of object */
@@ -949,13 +957,14 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Construct full path suffix */
full_suffix = full_path + HDstrlen(src_path);
+ full_suffix_len = HDstrlen(full_suffix);
/* Build new full path */
/* Create the new full path */
- if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, HDstrlen(full_suffix) + 1)))
+ if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, full_suffix_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- HDstrcpy(new_full_path, full_suffix);
+ HDstrncpy(new_full_path, full_suffix, full_suffix_len + 1);
/* Release previous full path */
H5RS_decr(obj_path->full_path_r);
@@ -1001,10 +1010,12 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r)) {
const char *full_path; /* Full path of current object */
const char *full_suffix; /* Suffix of full path, after src_path */
+ size_t full_suffix_len; /* Length of suffix of full path after src_path*/
char *new_full_path; /* New full path of object */
size_t new_full_len; /* Length of new full path */
const char *src_path; /* Full path of source object */
const char *dst_path; /* Full path of destination object */
+ size_t dst_path_len; /* Length of destination's full path */
/* Sanity check */
HDassert(names->dst_full_path_r);
@@ -1013,6 +1024,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
full_path = H5RS_get_str(obj_path->full_path_r);
src_path = H5RS_get_str(names->src_full_path_r);
dst_path = H5RS_get_str(names->dst_full_path_r);
+ dst_path_len = HDstrlen(dst_path);
/* Make certain that the source and destination names are full (not relative) paths */
HDassert(*src_path == '/');
@@ -1020,6 +1032,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Get pointer to "full suffix" */
full_suffix = full_path + HDstrlen(src_path);
+ full_suffix_len = HDstrlen(full_suffix);
/* Update the user path, if one exists */
if(obj_path->user_path_r)
@@ -1029,13 +1042,13 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Build new full path */
/* Allocate space for the new full path */
- new_full_len = HDstrlen(dst_path) + HDstrlen(full_suffix);
+ new_full_len = dst_path_len + full_suffix_len;
if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, new_full_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the new full path */
- HDstrcpy(new_full_path, dst_path);
- HDstrcat(new_full_path, full_suffix);
+ HDstrncpy(new_full_path, dst_path, dst_path_len + 1);
+ HDstrncat(new_full_path, full_suffix, full_suffix_len);
/* Release previous full path */
H5RS_decr(obj_path->full_path_r);
@@ -1327,7 +1340,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t *
/* If there's a buffer provided, copy into it, up to the limit of its size */
if(name) {
/* Copy the initial path separator */
- HDstrcpy(name, "/");
+ HDstrncpy(name, "/", 2);
/* Append the rest of the path */
/* (less one character, for the initial path separator) */
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index bb0fefa..4bd87f5 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -575,7 +575,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
/* Set the user path, if given */
if(user_path)
- HDstrcpy(user_path, H5RS_get_str(obj_path->user_path_r));
+ HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (size_t)(len + 1));
/* Set the length of the path */
*user_path_len = (size_t)len;
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index 76c7b96..5d68fd1 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -187,7 +187,7 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi
void
H5HF_hdr_print(const H5HF_hdr_t *hdr, hid_t dxpl_id, hbool_t dump_internal, FILE *stream, int indent, int fwidth)
{
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/*
* Check arguments.
@@ -381,7 +381,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata)
size_t start, end; /* Start & end of the overlapping area */
size_t len; /* Length of the overlapping area */
size_t overlap; /* Track any overlaps */
- unsigned u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Calculate the starting & ending */
if(sect_start < dblock_start)
@@ -396,7 +396,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata)
/* Calculate the length */
len = end - start;
- sprintf(temp_str, "Section #%u:", (unsigned)udata->sect_count);
+ HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count);
HDfprintf(udata->stream, "%*s%-*s %8Zu, %8Zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9),
temp_str,
start, len);
@@ -530,7 +530,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth,
"Percent of available space for data used:",
- (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) / (double)(dblock->size - blk_prefix_size)));
+ ((double)100.0f * (double)((dblock->size - blk_prefix_size) - amount_free) / (double)(dblock->size - blk_prefix_size)));
/*
* Print the data in a VMS-style octal dump.
@@ -569,7 +569,7 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock,
char temp_str[64]; /* Temporary string, for formatting */
size_t u, v; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/*
* Check arguments.
@@ -614,13 +614,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock,
else
HDfprintf(stream, "%*sDirect Block Entries: (address)\n", indent, "");
for(u = 0; u < hdr->man_dtable.max_direct_rows && u < iblock->nrows; u++) {
- sprintf(temp_str, "Row #%u: (block size: %lu)", (unsigned)u, (unsigned long)hdr->man_dtable.row_block_size[u]);
+ HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (block size: %lu)", (unsigned)u, (unsigned long)hdr->man_dtable.row_block_size[u]);
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
for(v = 0; v < hdr->man_dtable.cparam.width; v++) {
size_t off = (u * hdr->man_dtable.cparam.width) + v;
- sprintf(temp_str, "Col #%u:", (unsigned)v);
+ HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
if(hdr->filter_len > 0)
HDfprintf(stream, "%*s%-*s %9a/%6Zu/%x\n", indent + 6, "", MAX(0, fwidth - 6),
temp_str,
@@ -642,13 +642,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock,
H5V_log2_of2(hdr->man_dtable.cparam.width);
for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) {
num_indirect_rows = (H5V_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1;
- sprintf(temp_str, "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows);
+ HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows);
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
for(v = 0; v < hdr->man_dtable.cparam.width; v++) {
size_t off = (u * hdr->man_dtable.cparam.width) + v;
- sprintf(temp_str, "Col #%u:", (unsigned)v);
+ HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6),
temp_str,
iblock->ents[off].addr);
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index ce3ded3..0739daf 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -104,7 +104,7 @@ H5L_getenv_prefix_name(char **env_prefix/*in,out*/)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- strret = HDstrchr(*env_prefix, COLON_SEPC);
+ strret = HDstrchr(*env_prefix, H5_COLON_SEPC);
if (strret == NULL) {
retptr = *env_prefix;
*env_prefix = strret;
@@ -146,14 +146,9 @@ H5L_build_name(char *prefix, char *file_name, char **full_name/*out*/)
if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer")
- /* Copy the prefix into the buffer */
- HDstrcpy(*full_name, prefix);
-
- if (!CHECK_DELIMITER(prefix[prefix_len-1]))
- HDstrcat(*full_name, DIR_SEPS);
-
- /* Add the external link's filename to the prefix supplied */
- HDstrcat(*full_name, file_name);
+ /* Compose the full file name */
+ HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix,
+ (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -321,24 +316,32 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* target file_name is an absolute pathname: see RM for detailed description */
- if(CHECK_ABSOLUTE(file_name) || CHECK_ABS_PATH(file_name)) {
+ if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) {
/* Try opening file */
if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) {
- char *ptr = NULL;
+ char *ptr;
H5E_clear_stack(NULL);
/* get last component of file_name */
- GET_LAST_DELIMITER(file_name, ptr)
+ H5_GET_LAST_DELIMITER(file_name, ptr)
HDassert(ptr);
- HDstrcpy(temp_file_name, ++ptr);
+
+ /* Increment past delimiter */
+ ptr++;
+
+ /* Copy into the temp. file name */
+ HDstrncpy(temp_file_name, ptr, HDstrlen(ptr) + 1);
} /* end if */
} /* end if */
- else if(CHECK_ABS_DRIVE(file_name)) {
+ else if(H5_CHECK_ABS_DRIVE(file_name)) {
+ /* Try opening file */
if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) {
+
H5E_clear_stack(NULL);
+
/* strip "<drive-letter>:" */
- HDstrcpy(temp_file_name, &file_name[2]);
+ HDstrncpy(temp_file_name, &file_name[2], (HDstrlen(file_name) - 2) + 1);
} /* end if */
} /* end if */
@@ -416,7 +419,7 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't duplicate resolved file name string")
/* get last component of file_name */
- GET_LAST_DELIMITER(actual_file_name, ptr)
+ H5_GET_LAST_DELIMITER(actual_file_name, ptr)
if(!ptr)
HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name)
@@ -557,6 +560,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
char *norm_obj_name = NULL; /* Pointer to normalized current name */
void *ext_link_buf = NULL; /* Buffer to contain external link */
size_t buf_size; /* Size of buffer to hold external link */
+ size_t file_name_len; /* Length of file name string */
+ size_t norm_obj_name_len; /* Length of normalized object name string */
uint8_t *p; /* Pointer into external link buffer */
void *obj = NULL; /* object token of loc_id */
H5VL_t *vol_plugin; /* VOL plugin information */
@@ -586,16 +591,18 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize object name")
/* Combine the filename and link name into a single buffer to give to the UD link */
- buf_size = 1 + (HDstrlen(file_name) + 1) + (HDstrlen(norm_obj_name) + 1);
+ file_name_len = HDstrlen(file_name) + 1;
+ norm_obj_name_len = HDstrlen(norm_obj_name) + 1;
+ buf_size = 1 + file_name_len + norm_obj_name_len;
if(NULL == (ext_link_buf = H5MM_malloc(buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer")
/* Encode the external link information */
p = (uint8_t *)ext_link_buf;
*p++ = (H5L_EXT_VERSION << 4) | H5L_EXT_FLAGS_ALL; /* External link version & flags */
- HDstrcpy((char *)p, file_name); /* Name of file containing external link's object */
- p += HDstrlen(file_name) + 1;
- HDstrcpy((char *)p, norm_obj_name); /* External link's object */
+ HDstrncpy((char *)p, file_name, file_name_len); /* Name of file containing external link's object */
+ p += file_name_len;
+ HDstrncpy((char *)p, norm_obj_name, norm_obj_name_len); /* External link's object */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = link_name;
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 149199f..597c7e1 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -1285,7 +1285,7 @@ H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id, H5O_loc_t *dst_oloc,
new_oloc.addr = dst_oloc->addr;
/* Pick a default name for the new object */
- sprintf(tmp_obj_name, "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr);
+ HDsnprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr);
/* Create a link to the newly copied object */
/* Note: since H5O_copy_header_map actually copied the target object, it
diff --git a/src/H5Oname.c b/src/H5Oname.c
index fb44000..c1cb8c8 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -97,10 +97,10 @@ H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
HDassert(p);
/* decode */
- if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t))) ||
- NULL == (mesg->s = (char *)H5MM_malloc(HDstrlen((const char *)p) + 1)))
+ if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (mesg->s = (char *)H5MM_strdup((const char *)p)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDstrcpy(mesg->s, (const char *)p);
/* Set return value */
ret_value = mesg;
@@ -138,9 +138,9 @@ H5O_name_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, cons
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(f);
- assert(p);
- assert(mesg && mesg->s);
+ HDassert(f);
+ HDassert(p);
+ HDassert(mesg && mesg->s);
/* encode */
HDstrcpy((char*)p, mesg->s);
diff --git a/src/H5T.c b/src/H5T.c
index b01519a..359d5b5 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -4394,7 +4394,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
H5T_g.apaths = 128;
if(NULL == (H5T_g.path[0] = H5FL_CALLOC(H5T_path_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path")
- HDstrcpy(H5T_g.path[0]->name, "no-op");
+ HDsnprintf(H5T_g.path[0]->name, sizeof(H5T_g.path[0]->name), "no-op");
H5T_g.path[0]->func = H5T__conv_noop;
H5T_g.path[0]->cdata.command = H5T_CONV_INIT;
if(H5T__conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) {
@@ -4462,7 +4462,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
path->name[H5T_NAMELEN - 1] = '\0';
} /* end if */
else
- HDstrcpy(path->name, "NONAME");
+ HDsnprintf(path->name, sizeof(path->name), "NONAME");
if(NULL == (path->src = H5T_copy(src, H5T_COPY_ALL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path")
if(NULL == (path->dst = H5T_copy(dst, H5T_COPY_ALL)))
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 6f379cd..4e5d1f0 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -3014,17 +3014,17 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
{
H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */
H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */
- H5T_path_t *tpath; /* Type conversion path */
+ H5T_path_t *tpath = NULL; /* Type conversion path */
hbool_t noop_conv = FALSE; /* Flag to indicate a noop conversion */
hbool_t write_to_file = FALSE; /* Flag to indicate writing to file */
hbool_t parent_is_vlen; /* Flag to indicate parent is vlen datatyp */
hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */
- H5T_t *src; /*source datatype */
- H5T_t *dst; /*destination datatype */
+ H5T_t *src = NULL; /*source datatype */
+ H5T_t *dst = NULL; /*destination datatype */
H5HG_t bg_hobjid, parent_hobjid;
- uint8_t *s; /*source buffer */
- uint8_t *d; /*destination buffer */
- uint8_t *b; /*background buffer */
+ uint8_t *s = NULL; /*source buffer */
+ uint8_t *d = NULL; /*destination buffer */
+ uint8_t *b = NULL; /*background buffer */
ssize_t s_stride, d_stride; /*src and dst strides */
ssize_t b_stride; /*bkg stride */
size_t safe; /*how many elements are safe to process in each pass */
@@ -3120,7 +3120,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if(tpath->cdata.need_bkg || parent_is_vlen) {
/* Set up initial background buffer */
tmp_buf_size = MAX(src_base_size, dst_base_size);
- if(NULL == (tmp_buf = H5FL_BLK_MALLOC(vlen_seq,tmp_buf_size)))
+ if(NULL == (tmp_buf = H5FL_BLK_CALLOC(vlen_seq,tmp_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
@@ -3200,7 +3200,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
*/
if(!seq_len && !conv_buf) {
conv_buf_size = ((1 / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
- if(NULL == (conv_buf = H5FL_BLK_MALLOC(vlen_seq, conv_buf_size)))
+ if(NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
}
else if(conv_buf_size < MAX(src_size, dst_size)) {
@@ -3208,6 +3208,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
conv_buf_size = ((MAX(src_size, dst_size) / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
if(NULL == (conv_buf = H5FL_BLK_REALLOC(vlen_seq, conv_buf, conv_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HDmemset(conv_buf, 0, conv_buf_size);
} /* end if */
/* Read in VL sequence */
@@ -3223,6 +3224,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
tmp_buf_size = conv_buf_size;
if(NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HDmemset(tmp_buf, 0, tmp_buf_size);
} /* end if */
/* If we are writing and there is a nested VL type, read
@@ -3236,6 +3238,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
tmp_buf_size = (bg_seq_len * MAX(src_base_size, dst_base_size));
if(NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HDmemset(tmp_buf, 0, tmp_buf_size);
} /* end if */
H5F_addr_decode(dst->shared->u.vlen.f, (const uint8_t **)&tmp, &(bg_hobjid.addr));
INT32DECODE(tmp, bg_hobjid.idx);
diff --git a/src/H5private.h b/src/H5private.h
index ef239b8..46c02e7 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1473,19 +1473,20 @@ extern char *strdup(const char *s);
#if defined(H5_HAVE_WINDOW_PATH)
/* directory delimiter for Windows: slash and backslash are acceptable on Windows */
-#define DIR_SLASH_SEPC '/'
-#define DIR_SEPC '\\'
-#define DIR_SEPS "\\"
-#define CHECK_DELIMITER(SS) ((SS == DIR_SEPC)||(SS == DIR_SLASH_SEPC))
-#define CHECK_ABSOLUTE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':') && (CHECK_DELIMITER(NAME[2])))
-#define CHECK_ABS_DRIVE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':'))
-#define CHECK_ABS_PATH(NAME) (CHECK_DELIMITER(NAME[0]))
-
-#define GET_LAST_DELIMITER(NAME, ptr) { \
+#define H5_DIR_SLASH_SEPC '/'
+#define H5_DIR_SEPC '\\'
+#define H5_DIR_SEPS "\\"
+#define H5_CHECK_DELIMITER(SS) ((SS == H5_DIR_SEPC) || (SS == H5_DIR_SLASH_SEPC))
+#define H5_CHECK_ABSOLUTE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':') && (H5_CHECK_DELIMITER(NAME[2])))
+#define H5_CHECK_ABS_DRIVE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':'))
+#define H5_CHECK_ABS_PATH(NAME) (H5_CHECK_DELIMITER(NAME[0]))
+
+#define H5_GET_LAST_DELIMITER(NAME, ptr) { \
char *slash, *backslash; \
- slash = strrchr(NAME, DIR_SLASH_SEPC); \
- backslash = strrchr(NAME, DIR_SEPC); \
- if (backslash > slash) \
+ \
+ slash = HDstrrchr(NAME, H5_DIR_SLASH_SEPC); \
+ backslash = HDstrrchr(NAME, H5_DIR_SEPC); \
+ if(backslash > slash) \
(ptr = backslash); \
else \
(ptr = slash); \
@@ -1495,27 +1496,27 @@ extern char *strdup(const char *s);
/* OpenVMS pathname: <disk name>$<partition>:[path]<file name>
* i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c */
-#define DIR_SEPC ']'
-#define DIR_SEPS "]"
-#define CHECK_DELIMITER(SS) (SS == DIR_SEPC)
-#define CHECK_ABSOLUTE(NAME) (strrchr(NAME, ':') && strrchr(NAME, '['))
-#define CHECK_ABS_DRIVE(NAME) (0)
-#define CHECK_ABS_PATH(NAME) (0)
-#define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, DIR_SEPC);
+#define H5_DIR_SEPC ']'
+#define H5_DIR_SEPS "]"
+#define H5_CHECK_DELIMITER(SS) (SS == H5_DIR_SEPC)
+#define H5_CHECK_ABSOLUTE(NAME) (HDstrrchr(NAME, ':') && HDstrrchr(NAME, '['))
+#define H5_CHECK_ABS_DRIVE(NAME) (0)
+#define H5_CHECK_ABS_PATH(NAME) (0)
+#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC);
#else
-#define DIR_SEPC '/'
-#define DIR_SEPS "/"
-#define CHECK_DELIMITER(SS) (SS == DIR_SEPC)
-#define CHECK_ABSOLUTE(NAME) (CHECK_DELIMITER(*NAME))
-#define CHECK_ABS_DRIVE(NAME) (0)
-#define CHECK_ABS_PATH(NAME) (0)
-#define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, DIR_SEPC);
+#define H5_DIR_SEPC '/'
+#define H5_DIR_SEPS "/"
+#define H5_CHECK_DELIMITER(SS) (SS == H5_DIR_SEPC)
+#define H5_CHECK_ABSOLUTE(NAME) (H5_CHECK_DELIMITER(*NAME))
+#define H5_CHECK_ABS_DRIVE(NAME) (0)
+#define H5_CHECK_ABS_PATH(NAME) (0)
+#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC);
#endif
-#define COLON_SEPC ':'
+#define H5_COLON_SEPC ':'
/* Use FUNC to safely handle variations of C99 __func__ keyword handling */
diff --git a/src/H5public.h b/src/H5public.h
index bd9d859..deb4587 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -75,10 +75,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 142 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 149 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.142" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.149" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5system.c b/src/H5system.c
index c0baee1..3ffe411 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -122,24 +122,24 @@ HDfprintf(FILE *stream, const char *fmt, ...)
va_start (ap, fmt);
while (*fmt) {
- fwidth = prec = 0;
- zerofill = 0;
- leftjust = 0;
- plussign = 0;
- prefix = 0;
- ldspace = 0;
- modifier[0] = '\0';
-
- if ('%'==fmt[0] && '%'==fmt[1]) {
- HDputc ('%', stream);
- fmt += 2;
- nout++;
- } else if ('%'==fmt[0]) {
- s = fmt + 1;
-
- /* Flags */
- while(HDstrchr ("-+ #", *s)) {
- switch(*s) {
+ fwidth = prec = 0;
+ zerofill = 0;
+ leftjust = 0;
+ plussign = 0;
+ prefix = 0;
+ ldspace = 0;
+ modifier[0] = '\0';
+
+ if ('%'==fmt[0] && '%'==fmt[1]) {
+ HDputc ('%', stream);
+ fmt += 2;
+ nout++;
+ } else if ('%'==fmt[0]) {
+ s = fmt + 1;
+
+ /* Flags */
+ while(HDstrchr ("-+ #", *s)) {
+ switch(*s) {
case '-':
leftjust = 1;
break;
@@ -155,244 +155,251 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case '#':
prefix = 1;
break;
- } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */
- s++;
- } /* end while */
-
- /* Field width */
- if (HDisdigit (*s)) {
- zerofill = ('0'==*s);
- fwidth = (int)HDstrtol (s, &rest, 10);
- s = rest;
- } else if ('*'==*s) {
- fwidth = va_arg (ap, int);
- if (fwidth<0) {
- leftjust = 1;
- fwidth = -fwidth;
- }
- s++;
- }
+ } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */
+ s++;
+ } /* end while */
+
+ /* Field width */
+ if(HDisdigit(*s)) {
+ zerofill = ('0' == *s);
+ fwidth = (int)HDstrtol (s, &rest, 10);
+ s = rest;
+ } /* end if */
+ else if ('*'==*s) {
+ fwidth = va_arg (ap, int);
+ if(fwidth < 0) {
+ leftjust = 1;
+ fwidth = -fwidth;
+ }
+ s++;
+ }
+
+ /* Precision */
+ if('.'==*s) {
+ s++;
+ if(HDisdigit(*s)) {
+ prec = (int)HDstrtol(s, &rest, 10);
+ s = rest;
+ } else if('*'==*s) {
+ prec = va_arg(ap, int);
+ s++;
+ }
+ if(prec < 1)
+ prec = 1;
+ }
+
+ /* Extra type modifiers */
+ if(HDstrchr("ZHhlqLI", *s)) {
+ switch(*s) {
+ /*lint --e{506} Don't issue warnings about constant value booleans */
+ /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
+ case 'H':
+ if(sizeof(hsize_t) < sizeof(long))
+ modifier[0] = '\0';
+ else if(sizeof(hsize_t) == sizeof(long))
+ HDstrncpy(modifier, "l", 2);
+ else
+ HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1);
+ break;
- /* Precision */
- if ('.'==*s) {
- s++;
- if (HDisdigit (*s)) {
- prec = (int)HDstrtol (s, &rest, 10);
- s = rest;
- } else if ('*'==*s) {
- prec = va_arg (ap, int);
- s++;
- }
- if (prec<1) prec = 1;
- }
+ case 'Z':
+ if(sizeof(size_t) < sizeof(long))
+ modifier[0] = '\0';
+ else if(sizeof(size_t) == sizeof(long))
+ HDstrncpy(modifier, "l", 2);
+ else
+ HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1);
+ break;
- /* Extra type modifiers */
- if (HDstrchr ("ZHhlqLI", *s)) {
- switch (*s) {
- /*lint --e{506} Don't issue warnings about constant value booleans */
- /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
- case 'H':
- if (sizeof(hsize_t)<sizeof(long)) {
- modifier[0] = '\0';
- } else if (sizeof(hsize_t)==sizeof(long)) {
- HDstrcpy (modifier, "l");
- } else {
- HDstrcpy (modifier, H5_PRINTF_LL_WIDTH);
- }
- break;
- case 'Z':
- if (sizeof(size_t)<sizeof(long)) {
- modifier[0] = '\0';
- } else if (sizeof(size_t)==sizeof(long)) {
- HDstrcpy (modifier, "l");
- } else {
- HDstrcpy (modifier, H5_PRINTF_LL_WIDTH);
- }
- break;
- default:
- /* Handle 'I64' modifier for Microsoft's "__int64" type */
- if(*s=='I' && *(s+1)=='6' && *(s+2)=='4') {
- modifier[0] = *s;
- modifier[1] = *(s+1);
- modifier[2] = *(s+2);
- modifier[3] = '\0';
- s+=2; /* Increment over 'I6', the '4' is taken care of below */
- } /* end if */
- else {
- /* Handle 'll' for long long types */
- if(*s=='l' && *(s+1)=='l') {
+ default:
+ /* Handle 'I64' modifier for Microsoft's "__int64" type */
+ if(*s=='I' && *(s+1)=='6' && *(s+2)=='4') {
modifier[0] = *s;
- modifier[1] = *s;
- modifier[2] = '\0';
- s++; /* Increment over first 'l', second is taken care of below */
+ modifier[1] = *(s+1);
+ modifier[2] = *(s+2);
+ modifier[3] = '\0';
+ s += 2; /* Increment over 'I6', the '4' is taken care of below */
} /* end if */
else {
- modifier[0] = *s;
- modifier[1] = '\0';
+ /* Handle 'll' for long long types */
+ if(*s=='l' && *(s+1)=='l') {
+ modifier[0] = *s;
+ modifier[1] = *s;
+ modifier[2] = '\0';
+ s++; /* Increment over first 'l', second is taken care of below */
+ } /* end if */
+ else {
+ modifier[0] = *s;
+ modifier[1] = '\0';
+ } /* end else */
} /* end else */
- } /* end else */
- break;
- }
- s++;
- }
-
- /* Conversion */
- conv = *s++;
-
- /* Create the format template */
- sprintf (format_templ, "%%%s%s%s%s%s",
- leftjust?"-":"", plussign?"+":"",
- ldspace?" ":"", prefix?"#":"", zerofill?"0":"");
- if (fwidth>0)
- sprintf (format_templ+HDstrlen(format_templ), "%d", fwidth);
- if (prec>0)
- sprintf (format_templ+HDstrlen(format_templ), ".%d", prec);
- if (*modifier)
- sprintf (format_templ+HDstrlen(format_templ), "%s", modifier);
- sprintf (format_templ+HDstrlen(format_templ), "%c", conv);
-
-
- /* Conversion */
- switch (conv) {
- case 'd':
- case 'i':
- if (!HDstrcmp(modifier, "h")) {
- short x = (short)va_arg (ap, int);
- n = fprintf (stream, format_templ, x);
- } else if (!*modifier) {
- int x = va_arg (ap, int);
- n = fprintf (stream, format_templ, x);
- } else if (!HDstrcmp (modifier, "l")) {
- long x = va_arg (ap, long);
- n = fprintf (stream, format_templ, x);
- } else {
- int64_t x = va_arg(ap, int64_t);
- n = fprintf (stream, format_templ, x);
- }
- break;
-
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- if (!HDstrcmp (modifier, "h")) {
- unsigned short x = (unsigned short)va_arg (ap, unsigned int);
- n = fprintf (stream, format_templ, x);
- } else if (!*modifier) {
- unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */
- n = fprintf (stream, format_templ, x);
- } else if (!HDstrcmp (modifier, "l")) {
- unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
- n = fprintf (stream, format_templ, x);
- } else {
- uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */
- n = fprintf (stream, format_templ, x);
- }
- break;
-
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- if (!HDstrcmp (modifier, "h")) {
- float x = (float) va_arg (ap, double);
- n = fprintf (stream, format_templ, x);
- } else if (!*modifier || !HDstrcmp (modifier, "l")) {
- double x = va_arg (ap, double);
- n = fprintf (stream, format_templ, x);
- } else {
- /*
- * Some compilers complain when `long double' and
- * `double' are the same thing.
- */
+ break;
+ }
+ s++;
+ }
+
+ /* Conversion */
+ conv = *s++;
+
+ /* Create the format template */
+ sprintf(format_templ, "%%%s%s%s%s%s", (leftjust ? "-" : ""),
+ (plussign ? "+" : ""), (ldspace ? " " : ""),
+ (prefix ? "#" : ""), (zerofill ? "0" : ""));
+ if(fwidth > 0)
+ sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth);
+ if(prec > 0)
+ sprintf(format_templ+HDstrlen(format_templ), ".%d", prec);
+ if(*modifier)
+ sprintf(format_templ+HDstrlen(format_templ), "%s", modifier);
+ sprintf (format_templ+HDstrlen(format_templ), "%c", conv);
+
+
+ /* Conversion */
+ switch (conv) {
+ case 'd':
+ case 'i':
+ if(!HDstrcmp(modifier, "h")) {
+ short x = (short)va_arg (ap, int);
+ n = fprintf (stream, format_templ, x);
+ } else if(!*modifier) {
+ int x = va_arg (ap, int);
+ n = fprintf (stream, format_templ, x);
+ } else if(!HDstrcmp (modifier, "l")) {
+ long x = va_arg (ap, long);
+ n = fprintf (stream, format_templ, x);
+ } else {
+ int64_t x = va_arg(ap, int64_t);
+ n = fprintf (stream, format_templ, x);
+ }
+ break;
+
+ case 'o':
+ case 'u':
+ case 'x':
+ case 'X':
+ if(!HDstrcmp(modifier, "h")) {
+ unsigned short x = (unsigned short)va_arg (ap, unsigned int);
+ n = fprintf(stream, format_templ, x);
+ } else if(!*modifier) {
+ unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */
+ n = fprintf(stream, format_templ, x);
+ } else if(!HDstrcmp(modifier, "l")) {
+ unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
+ n = fprintf(stream, format_templ, x);
+ } else {
+ uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */
+ n = fprintf(stream, format_templ, x);
+ }
+ break;
+
+ case 'f':
+ case 'e':
+ case 'E':
+ case 'g':
+ case 'G':
+ if(!HDstrcmp(modifier, "h")) {
+ float x = (float)va_arg(ap, double);
+ n = fprintf(stream, format_templ, x);
+ } else if(!*modifier || !HDstrcmp(modifier, "l")) {
+ double x = va_arg(ap, double);
+ n = fprintf(stream, format_templ, x);
+ } else {
+ /*
+ * Some compilers complain when `long double' and
+ * `double' are the same thing.
+ */
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- long double x = va_arg (ap, long double);
- n = fprintf (stream, format_templ, x);
+ long double x = va_arg(ap, long double);
+ n = fprintf(stream, format_templ, x);
#else
- double x = va_arg (ap, double);
- n = fprintf (stream, format_templ, x);
+ double x = va_arg(ap, double);
+ n = fprintf(stream, format_templ, x);
#endif
- }
- break;
-
- case 'a':
- {
- haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
- if (H5F_addr_defined(x)) {
- sprintf(format_templ, "%%%s%s%s%s%s",
- leftjust?"-":"", plussign?"+":"",
- ldspace?" ":"", prefix?"#":"",
- zerofill?"0":"");
- if (fwidth>0)
- sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth);
-
- /*lint --e{506} Don't issue warnings about constant value booleans */
- /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
- if (sizeof(x)==H5_SIZEOF_INT) {
- HDstrcat(format_templ, "u");
- } else if (sizeof(x)==H5_SIZEOF_LONG) {
- HDstrcat(format_templ, "lu");
- } else if (sizeof(x)==H5_SIZEOF_LONG_LONG) {
- HDstrcat(format_templ, H5_PRINTF_LL_WIDTH);
- HDstrcat(format_templ, "u");
- }
- n = fprintf(stream, format_templ, x);
+ }
+ break;
+
+ case 'a':
+ {
+ haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
+
+ if(H5F_addr_defined(x)) {
+ sprintf(format_templ, "%%%s%s%s%s%s",
+ (leftjust ? "-" : ""), (plussign ? "+" : ""),
+ (ldspace ? " " : ""), (prefix ? "#" : ""),
+ (zerofill ? "0" : ""));
+ if(fwidth > 0)
+ sprintf(format_templ + HDstrlen(format_templ), "%d", fwidth);
+
+ /*lint --e{506} Don't issue warnings about constant value booleans */
+ /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
+ if(sizeof(x) == H5_SIZEOF_INT)
+ HDstrcat(format_templ, "u");
+ else if(sizeof(x) == H5_SIZEOF_LONG)
+ HDstrcat(format_templ, "lu");
+ else if(sizeof(x) == H5_SIZEOF_LONG_LONG) {
+ HDstrcat(format_templ, H5_PRINTF_LL_WIDTH);
+ HDstrcat(format_templ, "u");
+ }
+ n = fprintf(stream, format_templ, x);
+ } else {
+ HDstrcpy(format_templ, "%");
+ if(leftjust)
+ HDstrcat(format_templ, "-");
+ if(fwidth)
+ sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth);
+ HDstrcat(format_templ, "s");
+ fprintf(stream, format_templ, "UNDEF");
+ }
+ }
+ break;
+
+ case 'c':
+ {
+ char x = (char)va_arg(ap, int);
+ n = fprintf(stream, format_templ, x);
+ }
+ break;
+
+ case 's':
+ case 'p':
+ {
+ char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occuring */
+ n = fprintf(stream, format_templ, x);
+ }
+ break;
+
+ case 'n':
+ format_templ[HDstrlen(format_templ) - 1] = 'u';
+ n = fprintf(stream, format_templ, nout);
+ break;
+
+ case 't':
+ {
+ htri_t tri_var = va_arg(ap, htri_t);
+
+ if(tri_var > 0)
+ fprintf (stream, "TRUE");
+ else if(!tri_var)
+ fprintf(stream, "FALSE");
+ else
+ fprintf(stream, "FAIL(%d)", (int)tri_var);
+ }
+ break;
+
+ default:
+ HDfputs(format_templ, stream);
+ n = (int)HDstrlen(format_templ);
+ break;
+ }
+ nout += n;
+ fmt = s;
} else {
- HDstrcpy(format_templ, "%");
- if (leftjust)
- HDstrcat(format_templ, "-");
- if (fwidth)
- sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth);
- HDstrcat(format_templ, "s");
- fprintf(stream, format_templ, "UNDEF");
+ HDputc(*fmt, stream);
+ fmt++;
+ nout++;
}
}
- break;
-
- case 'c':
- {
- char x = (char)va_arg (ap, int);
- n = fprintf (stream, format_templ, x);
- }
- break;
-
- case 's':
- case 'p':
- {
- char *x = va_arg (ap, char*); /*lint !e64 Type mismatch not really occuring */
- n = fprintf (stream, format_templ, x);
- }
- break;
-
- case 'n':
- format_templ[HDstrlen(format_templ)-1] = 'u';
- n = fprintf (stream, format_templ, nout);
- break;
-
- case 't':
- {
- htri_t tri_var = va_arg (ap, htri_t);
- if (tri_var > 0) fprintf (stream, "TRUE");
- else if (!tri_var) fprintf (stream, "FALSE");
- else fprintf (stream, "FAIL(%d)", (int)tri_var);
- }
- break;
-
- default:
- HDfputs (format_templ, stream);
- n = (int)HDstrlen (format_templ);
- break;
- }
- nout += n;
- fmt = s;
- } else {
- HDputc (*fmt, stream);
- fmt++;
- nout++;
- }
- }
- va_end (ap);
+ va_end(ap);
return nout;
} /* end HDfprintf() */
@@ -700,7 +707,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
* OpenVMS: <disk name>$<partition>:[path]<file name>
* i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c
*/
- if(CHECK_ABSOLUTE(name)) {
+ if(H5_CHECK_ABSOLUTE(name)) {
if(NULL == (full_path = (char *)H5MM_strdup(name)))
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end if */
@@ -713,24 +720,24 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
if(NULL == (new_name = (char *)H5MM_strdup(name)))
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
- /*
- * Windows: name[0-1] is "<drive-letter>:"
- * Get current working directory on the drive specified in NAME
- * Unix: does not apply
+ /*
+ * Windows: name[0-1] is "<drive-letter>:"
+ * Get current working directory on the drive specified in NAME
+ * Unix: does not apply
* OpenVMS: does not apply
- */
- if(CHECK_ABS_DRIVE(name)) {
+ */
+ if(H5_CHECK_ABS_DRIVE(name)) {
drive = name[0] - 'A' + 1;
retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN);
HDstrcpy(new_name, &name[2]);
} /* end if */
- /*
- * Windows: name[0] is a '/' or '\'
- * Get current drive
- * Unix: does not apply
- * OpenVMS: does not apply
- */
- else if(CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) {
+ /*
+ * Windows: name[0] is a '/' or '\'
+ * Get current drive
+ * Unix: does not apply
+ * OpenVMS: does not apply
+ */
+ else if(H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) {
sprintf(cwdpath, "%c:%c", (drive+'A'-1), name[0]);
retcwd = cwdpath;
HDstrcpy(new_name, &name[1]);
@@ -749,7 +756,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
if(NULL == (full_path = (char *)H5MM_malloc(path_len)))
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
- HDstrcpy(full_path, cwdpath);
+ HDstrncpy(full_path, cwdpath, cwdlen + 1);
#ifdef H5_VMS
/* If the file name contains relative path, cut off the beginning bracket. Also cut off the
* ending bracket of CWDPATH to combine the full path name. i.g.
@@ -759,15 +766,16 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
*/
if(new_name[0] == '[') {
char *tmp = new_name;
+
full_path[cwdlen - 1] = '\0';
HDstrcat(full_path, ++tmp);
} /* end if */
else
- HDstrcat(full_path, new_name);
+ HDstrncat(full_path, new_name, HDstrlen(new_name));
#else
- if(!CHECK_DELIMITER(cwdpath[cwdlen - 1]))
- HDstrcat(full_path, DIR_SEPS);
- HDstrcat(full_path, new_name);
+ if(!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1]))
+ HDstrncat(full_path, H5_DIR_SEPS, HDstrlen(H5_DIR_SEPS));
+ HDstrncat(full_path, new_name, HDstrlen(new_name));
#endif
} /* end if */
} /* end else */
@@ -776,7 +784,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
if(full_path) {
char *ptr = NULL;
- GET_LAST_DELIMITER(full_path, ptr)
+ H5_GET_LAST_DELIMITER(full_path, ptr)
HDassert(ptr);
*++ptr = '\0';
*extpath = full_path;
diff --git a/src/Makefile.in b/src/Makefile.in
index 9dff326..d04c4e1 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -316,6 +316,7 @@ H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_PTHREAD = @HAVE_PTHREAD@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF_CXX = @HDF_CXX@
@@ -367,7 +368,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PARALLEL = @PARALLEL@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
-PTHREAD = @PTHREAD@
RANLIB = @RANLIB@
ROOT = @ROOT@
RUNPARALLEL = @RUNPARALLEL@
@@ -514,7 +514,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 132
+LT_VERS_REVISION = 139
LT_VERS_AGE = 0
H5detect_CFLAGS = -g $(AM_CFLAGS)