summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-27 16:48:50 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-27 16:48:50 (GMT)
commiteb5e01d37ca2570afc50756c9ed6a0be214502ec (patch)
tree08281269dc5b2eeef48286fb991bd6a05f71f6a3 /src/H5D.c
parent11f1b67c878b17abc225d09fb2a2019f338f92b2 (diff)
downloadhdf5-eb5e01d37ca2570afc50756c9ed6a0be214502ec.zip
hdf5-eb5e01d37ca2570afc50756c9ed6a0be214502ec.tar.gz
hdf5-eb5e01d37ca2570afc50756c9ed6a0be214502ec.tar.bz2
[svn-r620] Changes since 19980825
---------------------- ./MANIFEST ./src/H5R.c [NEW] ./src/H5Rprivate.h [NEW] ./src/H5Rpublic.h [NEW] ./src/Makefile.in ./src/hdf5.h ./test/ragged.c [NEW] Preliminary support for 2d ragged arrays for Mark Miller and Jim Reus. Not fully implemented yet. The test is not actually part of `make test' because we still have some memory problems. ./src/H5E.c ./src/H5Epublic.h Added H5E_RAGGED as a major error number. ./bin/release Checks the MANIFEST file against `svf ls' on systems that have it. ./bin/trace Fixed a bug that caused arguments of type `void *x[]' to not be handled. ./src/H5.c Removed unused variables and changed a couple types to fix compiler warnings. Added tracing support for ragged array object ID's and arrays of pointers. ./src/H5D.c H5Dcreate() will complain if either of the property lists are invalid (instead of using the default). ./src/H5D.c ./src/H5Dprivate.h Split H5Dget_space() into an API and internal function so it can be called from the new ragged array layer. ./src/H5Fistore.c Fixed warnings about unsigned vs. signed comparisons. ./src/H5Flow.c Fixed a warning about a variable being shadowed in the MPI-IO stuff. ./src/H5Iprivate.h ./src/H5Ipublic.h Added the H5_RAGGED atom group. ./src/H5Shyper.c Fixed some freeing-free-memory errors that resulted when certain arrays were freed but the pointers were left in the data structures. I simply set the pointers to null after they were freed. ./src/H5Sprivate.h ./src/H5Sselect.c Split the H5Sselect_hyperslab() function into an API and a private function so it could be called from the ragged array layer. Added H5S_SEL_ERROR and H5S_SEL_N to the switch statements to get rid or compiler warnings. ./src/H5Tconv.c Removed a misleading comment. ./test/bittests.c Fixed a warning about a printf(). ./test/cmpd_dset.c Fixed warnings about unused variables because of test #11 being commented out. ./bin/trace Shortened the right margin for the output to allow room for the `);' at the end of the TRACE() macros.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c69
1 files changed, 50 insertions, 19 deletions
diff --git a/src/H5D.c b/src/H5D.c
index c1f5eca..d9d0b78 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -178,7 +178,7 @@ H5D_term_interface(void)
*-------------------------------------------------------------------------
*/
hid_t
-H5Dcreate (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
+H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t plist_id)
{
H5G_t *loc = NULL;
@@ -206,14 +206,12 @@ H5Dcreate (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
NULL == (space = H5I_object(space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
}
- if (plist_id >= 0) {
- if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
- NULL == (create_parms = H5I_object(plist_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a dataset creation property list");
- }
- } else {
+ if (H5P_DEFAULT==plist_id) {
create_parms = &H5D_create_dflt;
+ } else if (H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
+ NULL == (create_parms = H5I_object(plist_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not a dataset creation property list");
}
/* build and open the new dataset */
@@ -222,7 +220,7 @@ H5Dcreate (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to create dataset");
}
- /* Register the new datatype and get an ID for it */
+ /* Register the new dataset to get an ID for it */
if ((ret_value = H5I_register(H5_DATASET, new_dset)) < 0) {
H5D_close(new_dset);
HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL,
@@ -253,7 +251,7 @@ H5Dcreate (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
*-------------------------------------------------------------------------
*/
hid_t
-H5Dopen (hid_t loc_id, const char *name)
+H5Dopen(hid_t loc_id, const char *name)
{
H5G_t *loc = NULL; /*location holding the dataset */
H5D_t *dataset = NULL; /*the dataset */
@@ -307,7 +305,7 @@ H5Dopen (hid_t loc_id, const char *name)
*-------------------------------------------------------------------------
*/
herr_t
-H5Dclose (hid_t dset_id)
+H5Dclose(hid_t dset_id)
{
H5D_t *dset = NULL; /* dataset object to release */
@@ -351,7 +349,7 @@ H5Dclose (hid_t dset_id)
*-------------------------------------------------------------------------
*/
hid_t
-H5Dget_space (hid_t dset_id)
+H5Dget_space(hid_t dset_id)
{
H5D_t *dset = NULL;
H5S_t *space = NULL;
@@ -367,9 +365,9 @@ H5Dget_space (hid_t dset_id)
}
/* Read the data space message and return a data space object */
- if (NULL==(space=H5S_read (&(dset->ent)))) {
+ if (NULL==(space=H5D_get_space (dset))) {
HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
- "unable to load space info from dataset header");
+ "unable to get data space");
}
/* Create an atom */
@@ -384,6 +382,39 @@ H5Dget_space (hid_t dset_id)
/*-------------------------------------------------------------------------
+ * Function: H5D_get_space
+ *
+ * Purpose: Returns the data space associated with the dataset.
+ *
+ * Return: Success: Ptr to a copy of the data space.
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, August 25, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5S_t *
+H5D_get_space(H5D_t *dset)
+{
+ H5S_t *space = NULL;
+
+ FUNC_ENTER(H5D_get_space, NULL);
+ assert(dset);
+
+ if (NULL==(space=H5S_read(&(dset->ent)))) {
+ HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
+ "unable to load space info from dataset header");
+ }
+
+ FUNC_LEAVE(space);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5Dget_type
*
* Purpose: Returns a copy of the file data type for a dataset.
@@ -407,7 +438,7 @@ H5Dget_space (hid_t dset_id)
*-------------------------------------------------------------------------
*/
hid_t
-H5Dget_type (hid_t dset_id)
+H5Dget_type(hid_t dset_id)
{
H5D_t *dset = NULL;
@@ -464,7 +495,7 @@ H5Dget_type (hid_t dset_id)
*-------------------------------------------------------------------------
*/
hid_t
-H5Dget_create_plist (hid_t dset_id)
+H5Dget_create_plist(hid_t dset_id)
{
H5D_t *dset = NULL;
H5D_create_t *copied_parms = NULL;
@@ -540,7 +571,7 @@ H5Dget_create_plist (hid_t dset_id)
*-------------------------------------------------------------------------
*/
herr_t
-H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
+H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf/*out*/)
{
H5D_t *dset = NULL;
@@ -641,7 +672,7 @@ H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
*-------------------------------------------------------------------------
*/
herr_t
-H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
+H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf)
{
H5D_t *dset = NULL;
@@ -723,7 +754,7 @@ H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
*-------------------------------------------------------------------------
*/
herr_t
-H5Dextend (hid_t dset_id, const hsize_t *size)
+H5Dextend(hid_t dset_id, const hsize_t *size)
{
H5D_t *dset = NULL;