summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5G.c44
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Gprivate.h8
-rw-r--r--src/H5Gpublic.h20
-rw-r--r--src/H5R.c18
5 files changed, 71 insertions, 21 deletions
diff --git a/src/H5G.c b/src/H5G.c
index fb11f8d..0b71257 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -156,7 +156,7 @@ static herr_t H5G_move(H5G_entry_t *src_loc, const char *src_name,
static herr_t H5G_unlink(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
static herr_t H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs, hid_t dxpl_id);
static ssize_t H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size, hid_t dxpl_id);
-static H5G_obj_t H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id);
+static int H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id);
static herr_t H5G_replace_ent(void *obj_ptr, hid_t obj_id, const void *key);
static herr_t H5G_traverse_slink(H5G_entry_t *grp_ent/*in,out*/,
H5G_entry_t *obj_ent/*in,out*/, int *nlinks/*in,out*/, hid_t dxpl_id);
@@ -511,6 +511,35 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
+int
+H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx)
+{
+ H5G_t *group = NULL;
+ hsize_t num_objs;
+ int ret_value = H5G_UNKNOWN;
+
+ FUNC_ENTER_API(H5Gget_objtype_by_idx, FAIL);
+ H5TRACE2("Is","ih",group_id,idx);
+
+ /* Check args */
+ if (NULL==(group = H5I_object_verify(group_id,H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
+
+ if (H5G_get_num_objs(group, &num_objs, H5AC_ind_dxpl_id)<0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to retrieve number of members");
+ if(idx >= num_objs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound");
+
+ /*call private function*/
+ ret_value = H5G_get_objtype_by_idx(group, idx, H5AC_ind_dxpl_id);
+
+done:
+ FUNC_LEAVE_API(ret_value);
+
+}
+
+#else /*H5_WANT_H5_V1_4_COMPAT*/
H5G_obj_t
H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx)
{
@@ -531,12 +560,13 @@ H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound");
/*call private function*/
- ret_value = H5G_get_objtype_by_idx(group, idx, H5AC_ind_dxpl_id);
+ ret_value = (H5G_obj_t)H5G_get_objtype_by_idx(group, idx, H5AC_ind_dxpl_id);
done:
FUNC_LEAVE_API(ret_value);
}
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
/*-------------------------------------------------------------------------
@@ -1003,7 +1033,7 @@ H5G_term_interface(void)
*-------------------------------------------------------------------------
*/
herr_t
-H5G_register_type(H5G_obj_t type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc)
+H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc)
{
char *desc = NULL;
size_t i;
@@ -2298,7 +2328,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5G_obj_t
+int
H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id)
{
htri_t isa;
@@ -2521,10 +2551,10 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5G_obj_t
+static int
H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id)
{
- H5G_obj_t ret_value = H5G_UNKNOWN;
+ int ret_value = H5G_UNKNOWN;
H5G_bt_ud3_t udata;
FUNC_ENTER_NOAPI(H5G_get_objtype_by_idx, FAIL);
@@ -3057,7 +3087,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
+H5G_replace_name(int type, H5G_entry_t *loc,
H5RS_str_t *src_name, H5G_entry_t *src_loc,
H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op )
{
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 53e8a31..5f9adfb 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -126,7 +126,7 @@ typedef struct H5G_bt_ud3_t {
hsize_t idx; /*index of group member to be querried */
char *name; /*member name to be returned */
hsize_t num_objs; /*the number of objects having been traversed*/
- H5G_obj_t type; /*member type to be returned */
+ int type; /*member type to be returned */
} H5G_bt_ud3_t;
/*
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 66fd86e..64b7689 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -120,7 +120,7 @@ typedef struct H5G_t H5G_t;
* is allocated dynamically.
*/
typedef struct H5G_typeinfo_t {
- H5G_obj_t type; /*one of the public H5G_* types */
+ int type; /*one of the public H5G_* types */
htri_t (*isa)(H5G_entry_t*, hid_t); /*function to determine type */
char *desc; /*description of object type */
} H5G_typeinfo_t;
@@ -148,7 +148,7 @@ struct H5O_stab_t;
* Library prototypes... These are the ones that other packages routinely
* call.
*/
-H5_DLL herr_t H5G_register_type(H5G_obj_t type, htri_t(*isa)(H5G_entry_t*, hid_t),
+H5_DLL herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t),
const char *desc);
H5_DLL H5G_entry_t *H5G_loc(hid_t loc_id);
H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_entry);
@@ -158,7 +158,7 @@ H5_DLL H5G_t *H5G_open(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
H5_DLL H5G_t *H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL herr_t H5G_close(H5G_t *grp);
H5_DLL H5G_t *H5G_rootof(H5F_t *f);
-H5_DLL H5G_obj_t H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id);
+H5_DLL int H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL herr_t H5G_get_objinfo(H5G_entry_t *loc, const char *name,
hbool_t follow_link,
H5G_stat_t *statbuf/*out*/, hid_t dxpl_id);
@@ -167,7 +167,7 @@ H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name,
H5_DLL herr_t H5G_find(H5G_entry_t *loc, const char *name,
H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/, hid_t dxpl_id);
H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
-H5_DLL herr_t H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
+H5_DLL herr_t H5G_replace_name(int type, H5G_entry_t *loc,
H5RS_str_t *src_name, H5G_entry_t *src_loc,
H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op);
H5_DLL herr_t H5G_free_grp_name(H5G_t *grp);
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 88b6c45..5a48e30 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -52,6 +52,17 @@ typedef enum H5G_link_t {
* application is running. An object may satisfy the `isa' function for more
* than one type.
*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
+#define H5G_UNKNOWN -1 /* Unknown object type */
+#define H5G_LINK 0 /* Object is a symbolic link */
+#define H5G_GROUP 1 /* Object is a group */
+#define H5G_DATASET 2 /* Object is a dataset */
+#define H5G_TYPE 3 /* Object is a named data type */
+#define H5G_RESERVED_4 4 /* Reserved for future use */
+#define H5G_RESERVED_5 5 /* Reserved for future use */
+#define H5G_RESERVED_6 6 /* Reserved for future use */
+#define H5G_RESERVED_7 7 /* Reserved for future use */
+#else /*H5_WANT_H5_V1_4_COMPAT*/
typedef enum H5G_obj_t {
H5G_UNKNOWN = -1, /* Unknown object type */
H5G_LINK, /* Object is a symbolic link */
@@ -63,6 +74,7 @@ typedef enum H5G_obj_t {
H5G_RESERVED_6, /* Reserved for future use */
H5G_RESERVED_7 /* Reserved for future use */
} H5G_obj_t;
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
#define H5G_NTYPES 256 /* Max possible number of types */
#define H5G_NLIBTYPES 8 /* Number of internal types */
@@ -74,7 +86,11 @@ typedef struct H5G_stat_t {
unsigned long fileno[2]; /*file number */
unsigned long objno[2]; /*object number */
unsigned nlink; /*number of hard links to object*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ int type; /*basic object type */
+#else /*H5_WANT_H5_V1_4_COMPAT*/
H5G_obj_t type; /*basic object type */
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
time_t mtime; /*modification time */
size_t linklen; /*symbolic link value length */
} H5G_stat_t;
@@ -95,7 +111,11 @@ H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx,
H5G_iterate_t op, void *op_data);
H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
H5_DLL ssize_t H5Gget_objname_by_idx(hid_t group_id, hsize_t idx, char* name, size_t size);
+#ifdef H5_WANT_H5_V1_4_COMPAT
+H5_DLL int H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx);
+#else /*H5_WANT_H5_V1_4_COMPAT*/
H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx);
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
H5_DLL herr_t H5Gmove2(hid_t src_loc, const char *src, hid_t dst_loc,
const char *dst);
H5_DLL herr_t H5Glink2(hid_t src_loc, const char *cur_name, H5G_link_t type,
diff --git a/src/H5R.c b/src/H5R.c
index ee1c7e4..a085995 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -40,7 +40,7 @@ static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
-static H5G_obj_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
+static int H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
/*--------------------------------------------------------------------------
@@ -337,7 +337,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
H5T_t *datatype; /* Pointer to datatype to open */
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
- H5G_obj_t oid_type; /* type of object being dereferenced */
+ int oid_type; /* type of object being dereferenced */
hid_t ret_value;
FUNC_ENTER_NOINIT(H5R_dereference);
@@ -647,13 +647,13 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5G_obj_t
-H5R_get_object_type(H5F_t *file, void *_ref)
+static int
+H5R_get_object_type(H5F_t *file, hid_t dxpl_id, void *_ref)
{
H5G_entry_t ent; /* Symbol table entry */
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */
uint8_t *p; /* Pointer to OID to store */
- H5G_obj_t ret_value;
+ int ret_value;
FUNC_ENTER_NOINIT(H5R_get_object_type);
@@ -670,7 +670,7 @@ H5R_get_object_type(H5F_t *file, void *_ref)
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
/* Get the OID type */
- ret_value=H5G_get_type(&ent);
+ ret_value=H5G_get_type(&ent, dxpl_id);
#ifdef LATER
done:
@@ -721,7 +721,7 @@ H5Rget_object_type(hid_t id, void *_ref)
file=loc->file;
/* Get the object information */
- if ((ret_value=H5R_get_object_type(file,_ref))<0)
+ if ((ret_value=H5R_get_object_type(file,H5AC_ind_dxpl_id,_ref))<0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type");
done:
@@ -752,12 +752,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5G_obj_t
+static int
H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
{
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
- H5G_obj_t ret_value;
+ int ret_value;
FUNC_ENTER_NOINIT(H5R_get_obj_type);