summaryrefslogtreecommitdiffstats
path: root/src/H5P.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-12-05 20:26:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-12-05 20:26:39 (GMT)
commit6ecbcc1717aa79dbaa00926b7a5f095a921f8991 (patch)
tree6a5a949e3ef0419d9eb9ad05c90f083a8f49d066 /src/H5P.c
parent253123994aaecc1f1fc917383b663104d6630d0f (diff)
downloadhdf5-6ecbcc1717aa79dbaa00926b7a5f095a921f8991.zip
hdf5-6ecbcc1717aa79dbaa00926b7a5f095a921f8991.tar.gz
hdf5-6ecbcc1717aa79dbaa00926b7a5f095a921f8991.tar.bz2
[svn-r4676] Purpose:
Backward Compatibility Fix Description: One of H5P[gs]et_buffer's parameters changed between v1.4 and the development branch. Solution: Added v1.4 compat stuff around H5P[gs]et_buffer implementation and testing to allow v1.4.x users to continue to use their source code without modification. These changes are for everything except the FORTRAN wrappers - I spoke with Elena and she will make the FORTRAN wrapper changes. Platforms tested: FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'src/H5P.c')
-rw-r--r--src/H5P.c114
1 files changed, 114 insertions, 0 deletions
diff --git a/src/H5P.c b/src/H5P.c
index fd69e0f..052f7bf 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -2370,6 +2370,118 @@ done:
}
#endif /* H5_WANT_H5_V1_4_COMPAT */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_buffer
+ *
+ * Purpose: Given a dataset transfer property list, set the maximum size
+ * for the type conversion buffer and background buffer and
+ * optionally supply pointers to application-allocated buffers.
+ * If the buffer size is smaller than the entire amount of data
+ * being transfered between application and file, and a type
+ * conversion buffer or background buffer is required then
+ * strip mining will be used.
+ *
+ * If TCONV and/or BKG are null pointers then buffers will be
+ * allocated and freed during the data transfer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, March 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_buffer(hid_t plist_id, hsize_t _size, void *tconv, void *bkg)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t size=(size_t)_size; /* Work around size difference */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER (H5Pset_buffer, FAIL);
+ H5TRACE4("e","izxx",plist_id,_size,tconv,bkg);
+
+ /* Check arguments */
+ if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
+ if (size<=0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Update property list */
+ if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size");
+ if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer");
+ if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_buffer
+ *
+ * Purpose: Reads values previously set with H5Pset_buffer().
+ *
+ * Return: Success: Buffer size.
+ *
+ * Failure: 0
+ *
+ * Programmer: Robb Matzke
+ * Monday, March 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t size; /* Type conversion buffer size */
+ hsize_t ret_value=0; /* Type conversion buffer size */
+
+ FUNC_ENTER (H5Pget_buffer, 0);
+ H5TRACE3("z","ixx",plist_id,tconv,bkg);
+
+ /* Check arguments */
+ if (TRUE!=H5P_isa_class(plist_id,H5P_DATASET_XFER))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, 0, "not a dataset transfer property list");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID");
+
+ /* Return values */
+ if (tconv)
+ if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer");
+ if (bkg)
+ if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer");
+
+ /* Get the size */
+ if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size");
+
+ /* Set the return value */
+ ret_value=(hsize_t)size;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#else /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pset_buffer
@@ -2479,6 +2591,8 @@ done:
FUNC_LEAVE(ret_value);
}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
+
/*-------------------------------------------------------------------------
* Function: H5Pset_hyper_cache