summaryrefslogtreecommitdiffstats
path: root/src/H5Tcommit.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-05 21:25:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-05 21:25:40 (GMT)
commitdefe2fb64fd30bbb03391426c56077f9620ccc3c (patch)
tree6e3ec93e4ef521f7ddab475664e0569186f3ee58 /src/H5Tcommit.c
parentc9c54b60413e004032f52c058c97e5734f2574fe (diff)
downloadhdf5-defe2fb64fd30bbb03391426c56077f9620ccc3c.zip
hdf5-defe2fb64fd30bbb03391426c56077f9620ccc3c.tar.gz
hdf5-defe2fb64fd30bbb03391426c56077f9620ccc3c.tar.bz2
[svn-r7543] Purpose:
Bug fixes and code cleanup Description: Lots of changes here: - Fixed bug #691 - when shared datatypes are used in attributes they are incorrectly copied into the attribute instead of referring the the named datatype in the file. This required bumping the version of the attribute message. The new version of the attribute message is only written out when a shared datatype is used in the attribute. [Also, this format change made the size of the attribute smaller.] - Added information to attribute debugging routine so that shared datatypes are displayed correctly with the h5debug tool. - Refactored the H5O* routines to extract code that was common to several routines into subroutines to call. - Added 'link' method for H5O message sub-classes, which increments the link count on shared objects when a message is created which shares them. - Corrected [unreported] bug where the link count was not being decremented on the shared object when a object header message with a reference to that object was deleted from the file. - Reduced size of shared message from 49 bytes (which was incorrect anyway and should have been 48 bytes) to 10 bytes, which required bumping the version of "shared" messages. - Refactored some of the shared datatype routines to allow for easier queries of "committedness" internally to the library and also added routine to easily increment/decrement the reference count of a shared datatype. Platforms tested: FreeBSD 4.9 (sleipnir) h5committest
Diffstat (limited to 'src/H5Tcommit.c')
-rw-r--r--src/H5Tcommit.c66
1 files changed, 64 insertions, 2 deletions
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 3cbb156..fb250e8 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -123,7 +123,7 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
H5F_t *file = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5T_commit, FAIL);
+ FUNC_ENTER_NOINIT(H5T_commit);
assert (loc);
assert (name && *name);
@@ -203,9 +203,71 @@ H5Tcommitted(hid_t type_id)
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
/* Set return value */
- ret_value= (H5T_STATE_OPEN==type->state || H5T_STATE_NAMED==type->state);
+ ret_value= H5T_committed(type);
done:
FUNC_LEAVE_API(ret_value);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_committed
+ *
+ * Purpose: Determines if a data type is committed or not.
+ *
+ * Return: Success: TRUE if committed, FALSE otherwise.
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, September 24, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5T_committed(H5T_t *type)
+{
+ /* Use no-init for efficiency */
+ FUNC_ENTER_NOINIT(H5T_committed);
+
+ assert (type);
+
+ FUNC_LEAVE_NOAPI(H5T_STATE_OPEN==type->state || H5T_STATE_NAMED==type->state);
+} /* end H5T_committed() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_link
+ *
+ * Purpose: Adjust the link count for an object header by adding
+ * ADJUST to the link count.
+ *
+ * Return: Success: New link count
+ *
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, September 26, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id)
+{
+ int ret_value; /* Return value */
+
+ /* Use no-init for efficiency */
+ FUNC_ENTER_NOAPI(H5T_link,FAIL);
+
+ assert (type);
+
+ /* Adjust the link count on the named datatype */
+ if((ret_value=H5O_link(&(type->ent),adjust,dxpl_id))<0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_LINK, FAIL, "unable to adjust named datatype link count");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5T_link() */
+