summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>2000-05-18 16:40:20 (GMT)
committerRobb Matzke <matzke@llnl.gov>2000-05-18 16:40:20 (GMT)
commitbc520e88b4ad3b175c0aeca2c90e021956676533 (patch)
tree814fa010e05cff2b586c3b947616f4af8b363cf4 /src/H5T.c
parent356495d12608a896fdc67bef0ab446cb1a74f8f8 (diff)
downloadhdf5-bc520e88b4ad3b175c0aeca2c90e021956676533.zip
hdf5-bc520e88b4ad3b175c0aeca2c90e021956676533.tar.gz
hdf5-bc520e88b4ad3b175c0aeca2c90e021956676533.tar.bz2
[svn-r2262] * 2000-05-18
** src/H5Tconv.c ** src/H5Tpkg.h ** src/H5Tpublic.h The H5T_conv_struct_opt() function had a design flaw -- it didn't keep information about the stride to use to step through the temporary/background-value buffer and thus nested invocations would clobber each other's temp buffers. This was fixed by splitting the `stride' argument into `buf_stride' and `bkg_stride' arguments for all the conversion functions. THIS IS AN API CHANGE, but users will get a compiler warning when they pass their conversion function pointer to H5Tregister(). ** src/H5T.c ** src/H5Tprivate.h Added a bkg_stride argument to the H5T_convert() definition in order to fix a bug related to the optimized compound datatype conversion function. ** src/H5T.c ** src/H5A.c ** src/H5D.c ** src/H5Ofill.c ** src/H5P.c Added bkg_stride=0 argument to the H5T_convert() calls. ** test/dtypes.c Added a test for the H5T_conv_struct_opt() bug fixed above. ** src/H5FL.c The H5FL_term() function should return non-zero even when it couldn't free all the free lists do to their being used by some other package. When that other package terminates it will return non-zero, causing H5FL_term() to be called again. This fixes some of the `infinite loop closing library' messages. ** tools/pdb2hdf Uses print_version() instead of doing that itself. ** src/H5Ppublic.h Renamed H5Pget_gc_reference() declaration to make it match the definition. ** src/H5FDlog.c Added API tracing macros. Removed `const' qualifier from a `char*' member of a struct which was allocated on the heap. ** src/H5TB.c Added curly braces to a couple deeply-nested `if' statements to make them clearer and to shut up the increadibly stupid and just plain incorrect gcc warning about ambiguous `else'. ** test/titerate.c Removed incomplete initialization in favor of memset() for one auto variable to stop compiler warnings. ** tools/Depencencies Regenerated to remove references to h5dumputil.c
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c59
1 files changed, 39 insertions, 20 deletions
diff --git a/src/H5T.c b/src/H5T.c
index d6d9a86..1139fd1 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1372,7 +1372,7 @@ H5T_term_interface(void)
H5T_print_stats(path, &nprint/*in,out*/);
path->cdata.command = H5T_CONV_FREE;
if ((path->func)(FAIL, FAIL, &(path->cdata),
- 0, 0, NULL, NULL,H5P_DEFAULT)<0) {
+ 0, 0, 0, NULL, NULL,H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
fprintf (H5DEBUG(T), "H5T: conversion function "
@@ -4173,7 +4173,8 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
}
HDmemset(&cdata, 0, sizeof cdata);
cdata.command = H5T_CONV_INIT;
- if ((func)(tmp_sid, tmp_did, &cdata, 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
+ if ((func)(tmp_sid, tmp_did, &cdata, 0, 0, 0, NULL, NULL,
+ H5P_DEFAULT)<0) {
H5I_dec_ref(tmp_sid);
H5I_dec_ref(tmp_did);
tmp_sid = tmp_did = -1;
@@ -4189,7 +4190,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
HDstrncpy(new_path->name, name, H5T_NAMELEN);
new_path->name[H5T_NAMELEN-1] = '\0';
if (NULL==(new_path->src=H5T_copy(old_path->src, H5T_COPY_ALL)) ||
- NULL==(new_path->dst=H5T_copy(old_path->dst, H5T_COPY_ALL))) {
+ NULL==(new_path->dst=H5T_copy(old_path->dst, H5T_COPY_ALL))) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to copy data types");
}
@@ -4205,7 +4206,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
H5T_print_stats(old_path, &nprint);
old_path->cdata.command = H5T_CONV_FREE;
if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata),
- 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
+ 0, 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx "
@@ -4308,7 +4309,8 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
/* Shut down path */
H5T_print_stats(path, &nprint);
path->cdata.command = H5T_CONV_FREE;
- if ((path->func)(FAIL, FAIL, &(path->cdata), 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
+ if ((path->func)(FAIL, FAIL, &(path->cdata), 0, 0, 0, NULL, NULL,
+ H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed "
@@ -4364,8 +4366,9 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type");
}
- if (H5T_unregister(pers,name,src,dst,func)<0)
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed");
+ if (H5T_unregister(pers,name,src,dst,func)<0)
+ HRETURN_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL,
+ "internal unregister function failed");
FUNC_LEAVE(SUCCEED);
}
@@ -4474,7 +4477,8 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf,
"unable to convert between src and dst data types");
}
- if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, buf, background, plist_id)<0) {
+ if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, buf, background,
+ plist_id)<0) {
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
"data type conversion failed");
}
@@ -6543,7 +6547,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
HDstrcpy(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), 0, 0,
+ if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0, 0, 0,
NULL, NULL, H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
@@ -6635,7 +6639,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
"query");
}
path->cdata.command = H5T_CONV_INIT;
- if ((func)(src_id, dst_id, &(path->cdata), 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
+ if ((func)(src_id, dst_id, &(path->cdata), 0, 0, 0, NULL, NULL,
+ H5P_DEFAULT)<0) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
"unable to initialize conversion function");
}
@@ -6667,7 +6672,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
}
path->cdata.command = H5T_CONV_INIT;
if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata),
- 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
+ 0, 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t));
H5E_clear(); /*ignore the error*/
} else {
@@ -6689,7 +6694,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
assert(table==H5T_g.path[md]);
H5T_print_stats(table, &nprint/*in,out*/);
table->cdata.command = H5T_CONV_FREE;
- if ((table->func)(FAIL, FAIL, &(table->cdata), 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
+ if ((table->func)(FAIL, FAIL, &(table->cdata), 0, 0, 0, NULL, NULL,
+ H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free "
@@ -6758,19 +6764,32 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
* runtime in addition to compile time.
*
* Robb Matzke, 1999-06-16
- * Added support for non-zero strides. If STRIDE is non-zero
+ * Added support for non-zero strides. If BUF_STRIDE is non-zero
* then convert one value at each memory location advancing
- * STRIDE bytes each time; otherwise assume both source and
+ * BUF_STRIDE bytes each time; otherwise assume both source and
* destination values are packed.
*
- * Quincey Koziol, 1999-07-01
- * Added dataset transfer properties, to allow custom VL datatype
- * allocation function to be passed down to VL conversion routine.
+ * Quincey Koziol, 1999-07-01
+ * Added dataset transfer properties, to allow custom VL
+ * datatype allocation function to be passed down to VL
+ * conversion routine.
+ *
+ * Robb Matzke, 2000-05-17
+ * Added the BKG_STRIDE argument which gets passed to all the
+ * conversion functions. If BUF_STRIDE is non-zero then each
+ * data element is at a multiple of BUF_STRIDE bytes in BUF
+ * (on both input and output). If BKG_STRIDE is also set then
+ * the BKG buffer is used in such a way that temporary space
+ * for each element is aligned on a BKG_STRIDE byte boundary.
+ * If either BUF_STRIDE or BKG_STRIDE are zero then the BKG
+ * buffer will be accessed as though it were a packed array
+ * of destination datatype.
*-------------------------------------------------------------------------
*/
herr_t
H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts,
- size_t stride, void *buf, void *bkg, hid_t dset_xfer_plist)
+ size_t buf_stride, size_t bkg_stride, void *buf, void *bkg,
+ hid_t dset_xfer_plist)
{
#ifdef H5T_DEBUG
H5_timer_t timer;
@@ -6782,8 +6801,8 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts,
if (H5DEBUG(T)) H5_timer_begin(&timer);
#endif
tpath->cdata.command = H5T_CONV_CONV;
- if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, stride, buf,
- bkg, dset_xfer_plist)<0) {
+ if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, buf_stride,
+ bkg_stride, buf, bkg, dset_xfer_plist)<0) {
HRETURN_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}