summaryrefslogtreecommitdiffstats
path: root/src/H5Rint.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-12-19 20:55:49 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-12-19 20:55:49 (GMT)
commitd11b347aa77cbcfa2bf782c8856bf559444ad880 (patch)
treedf43489411575f566e0475ad4bb040dc69f623e6 /src/H5Rint.c
parent4281d101c41f80a75143c0d40232383a81afc7f0 (diff)
parent817235bb60e1f79c4b22b4a6116a1594aa75b81d (diff)
downloadhdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.zip
hdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.tar.gz
hdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '817235bb60e1f79c4b22b4a6116a1594aa75b81d': (145 commits) Remove const Fix compile error - declaration after executable statement Adjust cache.c only variables. Fix include to correct memory calls - big-endian issue. Update h5debug to retrieve file pointer through VOL framework Minor whitespace Remove duplicate instance Revert and move declaration Correct struct access Fix duplicate and varname Fix compile and test issues from DT Modify H5VL initialization routines to initialize all VOL-managed object types. Modify H5VLwrap_register() to reject non-VOL-managed object types. Also fix overisights in h5trace.c from previous changes. Add release note for sanitizer support HDFFV-10979 cleanup globals TRILABS-135 Add clang analyzers HDFFV-10979 fix global name clash Fix issues found with ONLY_SHARED_LIBS option Fix 2010 compile issues Change from using H5Dcreate to H5Dcreate2 Latest date first in RELEASE.txt ...
Diffstat (limited to 'src/H5Rint.c')
-rw-r--r--src/H5Rint.c103
1 files changed, 52 insertions, 51 deletions
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 504ae06..2a21179 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -135,7 +135,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5R_top_package_initialize_s = FALSE;
-
+
/*--------------------------------------------------------------------------
NAME
H5R__init_package -- Initialize interface-specific information
@@ -162,7 +162,7 @@ H5R__init_package(void)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5R__init_package() */
-
+
/*--------------------------------------------------------------------------
NAME
H5R_top_term_package
@@ -184,7 +184,7 @@ H5R__init_package(void)
int
H5R_top_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -196,7 +196,7 @@ H5R_top_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5R_top_term_package() */
-
+
/*--------------------------------------------------------------------------
NAME
H5R_term_package
@@ -220,7 +220,7 @@ H5R_top_term_package(void)
int
H5R_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -236,7 +236,7 @@ H5R_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5R_term_package() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__create_object
*
@@ -258,7 +258,7 @@ H5R__create_object(const H5VL_token_t *obj_token, size_t token_size,
HDassert(ref);
/* Create new reference */
- H5MM_memcpy(ref->ref.obj.token, obj_token, token_size);
+ H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size);
ref->ref.obj.filename = NULL;
ref->loc_id = H5I_INVALID_HID;
ref->type = (uint8_t)H5R_OBJECT2;
@@ -277,7 +277,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__create_object() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__create_region
*
@@ -300,7 +300,7 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size,
HDassert(ref);
/* Create new reference */
- H5MM_memcpy(ref->ref.obj.token, obj_token, token_size);
+ H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size);
ref->ref.obj.filename = NULL;
if(NULL == (ref->ref.reg.space = H5S_copy(space, FALSE, TRUE)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace")
@@ -328,7 +328,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5R__create_region */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__create_attr
*
@@ -355,7 +355,7 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size,
HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN)
/* Create new reference */
- H5MM_memcpy(ref->ref.obj.token, obj_token, token_size);
+ H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size);
ref->ref.obj.filename = NULL;
if(NULL == (ref->ref.attr.name = HDstrdup(attr_name)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name")
@@ -379,7 +379,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5R__create_attr */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__destroy
*
@@ -413,6 +413,7 @@ H5R__destroy(H5R_ref_priv_t *ref)
break;
case H5R_OBJECT1:
case H5R_DATASET_REGION1:
+ break;
case H5R_BADTYPE:
case H5R_MAXTYPE:
HDassert("invalid reference type" && 0);
@@ -423,14 +424,14 @@ H5R__destroy(H5R_ref_priv_t *ref)
} /* end switch */
/* Decrement refcount of attached loc_id */
- if((ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0))
+ if(ref->type && (ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__destroy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__set_loc_id
*
@@ -463,7 +464,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__set_loc_id() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__get_loc_id
*
@@ -487,7 +488,7 @@ H5R__get_loc_id(const H5R_ref_priv_t *ref)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_loc_id() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__reopen_file
*
@@ -551,7 +552,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__reopen_file() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__get_type
*
@@ -574,7 +575,7 @@ H5R__get_type(const H5R_ref_priv_t *ref)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__equal
*
@@ -601,7 +602,7 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2)
/* Compare object addresses */
if(ref1->token_size != ref2->token_size)
HGOTO_DONE(FALSE);
- if(0 != HDmemcmp(ref1->ref.obj.token, ref2->ref.obj.token, ref1->token_size))
+ if(0 != HDmemcmp(&ref1->ref.obj.token, &ref2->ref.obj.token, ref1->token_size))
HGOTO_DONE(FALSE);
/* Compare filenames */
@@ -639,7 +640,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__equal() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__copy
*
@@ -658,7 +659,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref)
HDassert((src_ref != NULL) && (dst_ref != NULL));
- H5MM_memcpy(dst_ref->ref.obj.token, src_ref->ref.obj.token, src_ref->token_size);
+ H5MM_memcpy(&dst_ref->ref.obj.token, &src_ref->ref.obj.token, src_ref->token_size);
dst_ref->encode_size = src_ref->encode_size;
dst_ref->type = src_ref->type;
dst_ref->token_size = src_ref->token_size;
@@ -704,7 +705,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__get_obj_token
*
@@ -728,7 +729,7 @@ H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token,
if(obj_token) {
if(0 == ref->token_size)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size")
- H5MM_memcpy(obj_token, ref->ref.obj.token, ref->token_size);
+ H5MM_memcpy(obj_token, &ref->ref.obj.token, ref->token_size);
}
if(token_size)
*token_size = ref->token_size;
@@ -737,7 +738,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_obj_token() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__set_obj_token
*
@@ -760,13 +761,13 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token,
HDassert(token_size);
HDassert(token_size <= H5VL_MAX_TOKEN_SIZE);
- H5MM_memcpy(ref->ref.obj.token, obj_token, ref->token_size);
+ H5MM_memcpy(&ref->ref.obj.token, obj_token, ref->token_size);
ref->token_size = token_size;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__set_obj_token() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__get_region
*
@@ -797,7 +798,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_region() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__get_file_name
*
@@ -839,7 +840,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_file_name() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__get_attr_name
*
@@ -877,7 +878,7 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_attr_name() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__encode
*
@@ -972,7 +973,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode
*
@@ -1064,7 +1065,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__encode_obj_token
*
@@ -1099,7 +1100,7 @@ H5R__encode_obj_token(const H5VL_token_t *obj_token, size_t token_size,
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode_obj_token() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode_obj_token
*
@@ -1141,7 +1142,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_obj_token() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__encode_region
*
@@ -1169,8 +1170,8 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
/* Don't encode if buffer size isn't big enough or buffer is empty */
if(buf && *nalloc >= ((size_t)buf_size + 2 * H5_SIZEOF_UINT32_T)) {
- p = (uint8_t *)buf;
int rank;
+ p = (uint8_t *)buf;
/* Encode the size for safety check */
UINT32ENCODE(p, (uint32_t)buf_size);
@@ -1190,7 +1191,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode_region() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode_region
*
@@ -1246,7 +1247,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_region() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__encode_string
*
@@ -1288,7 +1289,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode_string() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode_string
*
@@ -1335,7 +1336,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_string() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__encode_heap
*
@@ -1376,7 +1377,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode_heap() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode_heap
*
@@ -1423,7 +1424,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_heap() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__free_heap
*
@@ -1468,7 +1469,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__free_heap() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode_token_compat
*
@@ -1479,18 +1480,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5R__decode_token_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type,
+H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type,
const unsigned char *buf, H5VL_token_t *obj_token)
{
hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
- void *vol_obj_file = NULL;
+ H5VL_object_t *vol_obj_file = NULL;
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
/* Get the file for the object */
- if((file_id = H5F_get_file_id(id, type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Retrieve VOL object */
@@ -1526,7 +1527,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__decode_token_compat() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__encode_token_obj_compat
*
@@ -1557,7 +1558,7 @@ H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size,
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode_token_obj_compat() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode_token_obj_compat
*
@@ -1592,7 +1593,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5R__decode_token_obj_compat() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__encode_token_region_compat
*
@@ -1667,7 +1668,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5R__encode_token_region_compat() */
-
+
/*-------------------------------------------------------------------------
* Function: H5R__decode_token_region_compat
*
@@ -1701,13 +1702,13 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
/* Get object address */
p = (const uint8_t *)data;
- H5MM_memcpy(token, p, token_size);
+ H5MM_memcpy(&token, p, token_size);
p += token_size;
if(space_ptr) {
H5O_loc_t oloc; /* Object location */
H5S_t *space = NULL;
- const uint8_t *q = token;
+ const uint8_t *q = (const uint8_t *)&token;
/* Initialize the object location */
H5O_loc_reset(&oloc);
@@ -1725,7 +1726,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf,
*space_ptr = space;
}
if(obj_token)
- H5MM_memcpy(obj_token, token, token_size);
+ H5MM_memcpy(obj_token, &token, token_size);
done:
H5MM_free(data);