summaryrefslogtreecommitdiffstats
path: root/src/H5Rdeprec.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
commit4a17aff4085ad6ee265b95730aca3f493056dec8 (patch)
tree8bfb665c6d95a2e3520fa1bb0ff54d95aff3923f /src/H5Rdeprec.c
parent853ae26333592faf69cd8c454ef92ffea8549df5 (diff)
downloadhdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.zip
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.gz
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.bz2
Add API context interface and use it throughout the library.
Diffstat (limited to 'src/H5Rdeprec.c')
-rw-r--r--src/H5Rdeprec.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 699f8df..ccb4798 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -37,11 +37,12 @@
#include "H5Ppublic.h" /* Property lists */
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
#include "H5Rpkg.h" /* References */
@@ -103,6 +104,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
{
H5G_loc_t loc; /* Object location */
H5O_type_t obj_type; /* Object type */
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
@@ -116,14 +118,21 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
if (ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer")
+/* Set API context */
+if(H5CX_push() < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5G_UNKNOWN, "can't set API context")
+api_ctx_pushed = TRUE;
+
/* Get the object information */
- if (H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, &obj_type) < 0)
+ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type")
/* Set return value */
ret_value = H5G_map_obj_type(obj_type);
done:
+if(api_ctx_pushed && H5CX_pop() < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, H5G_UNKNOWN, "can't reset API context")
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_obj_type1() */
@@ -149,27 +158,35 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
{
H5G_loc_t loc; /* Group location */
H5F_t *file = NULL; /* File object */
- hid_t ret_value;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref);
/* Check args */
if (H5G_loc(obj_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location")
if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type")
if (_ref == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
+
+/* Set API context */
+if(H5CX_push() < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context")
+api_ctx_pushed = TRUE;
/* Get the file pointer from the entry */
file = loc.oloc->file;
/* Create reference */
- if ((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id, ref_type, _ref, TRUE)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object")
+ if((ret_value = H5R__dereference(file, H5P_DATASET_ACCESS_DEFAULT, ref_type, _ref)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable dereference object")
done:
+if(api_ctx_pushed && H5CX_pop() < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context")
FUNC_LEAVE_API(ret_value)
} /* end H5Rdereference1() */