summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Iprivate.h2
-rw-r--r--src/H5Ipublic.h1
-rw-r--r--src/H5MPprivate.h2
-rw-r--r--src/H5O.c97
-rw-r--r--src/H5Odtype.c2
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5T.c148
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5Tpublic.h2
-rw-r--r--test/dtypes.c183
11 files changed, 424 insertions, 21 deletions
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 3f6b65c..2f0bdb8 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -26,6 +26,7 @@
/* Private headers needed by this file */
#include "H5private.h"
+#include "H5Oprivate.h"
/* Macro to determine if a H5I_type_t is a "library type" */
#define H5I_IS_LIB_TYPE( type ) (type > 0 && type < H5I_NTYPES)
@@ -65,4 +66,5 @@ H5_DLL int H5I_dec_ref(hid_t id);
H5_DLL int H5I_inc_type_ref(H5I_type_t type);
H5_DLL herr_t H5I_dec_type_ref(H5I_type_t type);
H5_DLL int H5I_get_type_ref(H5I_type_t type);
+
#endif
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index c3015e1..9d76d63 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -96,7 +96,6 @@ H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members);
H5_DLL htri_t H5Itype_exists(H5I_type_t type);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h
index 2062f61..771c836 100644
--- a/src/H5MPprivate.h
+++ b/src/H5MPprivate.h
@@ -183,6 +183,8 @@
#define color_H5Tcommitted "red"
#define color_H5Tinsert "red"
#define color_H5Tpack "red"
+#define color_H5Tencode "red"
+#define color_H5Tdecode "red"
#define color_H5Tenum_create "red"
#define color_H5Tenum_insert "red"
#define color_H5Tenum_nameof "red"
diff --git a/src/H5O.c b/src/H5O.c
index 0ee7706..609b7c6 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -3427,6 +3427,103 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_encode
+ *
+ * Purpose: Encode an object(data type and simple data space only)
+ * description into a buffer.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 13, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_encode(unsigned char *buf, void *obj, size_t *nalloc, hid_t type_id)
+{
+ const H5O_class_t *type; /* Actual H5O class type for the ID */
+ size_t size; /* size of the message*/
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_encode,FAIL);
+
+ /* check args */
+ if(type_id<0 || type_id>=(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object type");
+
+ /* map the type ID to the actual type object */
+ if((type=message_type_g[type_id])==NULL)
+ HGOTO_ERROR (H5E_OHDR, H5E_BADTYPE, FAIL, "unable to find object type");
+
+ /* check buffer size */
+ if ((size=(type->raw_size)(NULL, obj))<0)
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
+
+ /* Don't encode if buffer size isn't big enough */
+ if(!buf || *nalloc<size) {
+ *nalloc = size;
+ HGOTO_DONE(ret_value);
+ }
+
+ /* Encode */
+ if ((type->encode)(NULL, buf, obj)<0)
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_decode
+ *
+ * Purpose: Decode a binary object(data type and data space only)
+ * description and return a new object handle.
+ *
+ * Return: Success: Object ID(non-negative)
+ *
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 14, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void*
+H5O_decode(unsigned char *buf, hid_t type_id)
+{
+ const H5O_class_t *type; /* Actual H5O class type for the ID */
+ size_t size; /* size of the message*/
+ void *ret_value=NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_decode,NULL);
+
+ /* check args */
+ if(type_id<0 || type_id>=(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, NULL, "invalid object type");
+
+ /* map the type ID to the actual type object */
+ if((type=message_type_g[type_id])==NULL)
+ HGOTO_ERROR (H5E_OHDR, H5E_BADTYPE, NULL, "unable to find object type");
+
+ /* decode */
+ ret_value = (type->decode)(NULL, 0, buf, NULL);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_debug_id
*
* Purpose: Act as a proxy for calling the 'debug' method for a
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index c5a9fe8..3c44b26 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -875,7 +875,7 @@ H5O_dtype_encode(H5F_t UNUSED *f, uint8_t *p, const void *mesg)
FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_encode);
/* check args */
- assert(f);
+ /*assert(f);*/
assert(p);
assert(dt);
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 8de6392..ab52171 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -249,6 +249,8 @@ H5_DLL herr_t H5O_remove(H5G_entry_t *ent, hid_t type_id, int sequence,
hid_t dxpl_id);
H5_DLL herr_t H5O_reset(hid_t type_id, void *native);
H5_DLL void *H5O_free(hid_t type_id, void *mesg);
+H5_DLL herr_t H5O_encode(unsigned char *buf, void *obj, size_t *nalloc, hid_t type_id);
+H5_DLL void* H5O_decode(unsigned char *buf, hid_t type_id);
H5_DLL void *H5O_copy(hid_t type_id, const void *mesg, void *dst);
H5_DLL size_t H5O_raw_size(hid_t type_id, H5F_t *f, const void *mesg);
H5_DLL herr_t H5O_get_share(hid_t type_id, H5F_t *f, const void *mesg, H5O_shared_t *share);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index e130977..7c4bb80 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -210,7 +210,7 @@ done:
--------------------------------------------------------------------------*/
static herr_t
-H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg)
+H5O_sdspace_encode(H5F_t UNUSED *f, uint8_t *p, const void *mesg)
{
const H5S_extent_t *sdim = (const H5S_extent_t *) mesg;
unsigned u; /* Local counting variable */
@@ -219,7 +219,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_encode);
/* check args */
- assert(f);
+ /*assert(f);*/
assert(p);
assert(sdim);
diff --git a/src/H5T.c b/src/H5T.c
index fae6e03..26cc8c3 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2550,6 +2550,84 @@ done:
FUNC_LEAVE_API(ret_value);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Tencode
+ *
+ * Purpose: Given an datatype ID, converts the object description into
+ * binary in a buffer.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 14, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Tencode(hid_t obj_id, unsigned char* buf, size_t* nalloc)
+{
+ H5T_t *dtype;
+ herr_t ret_value;
+
+ FUNC_ENTER_API (H5Tencode, FAIL);
+
+ /* Check argument and retrieve object */
+ if (NULL==(dtype=H5I_object_verify(obj_id, H5I_DATATYPE)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ ret_value = H5T_encode(dtype, buf, nalloc);
+
+done:
+ FUNC_LEAVE_API(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Tdecode
+ *
+ * Purpose: Decode a binary object description and return a new object
+ * handle.
+ *
+ * Return: Success: datatype ID(non-negative)
+ *
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 14, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Tdecode(unsigned char* buf)
+{
+ H5T_t *dt;
+ hid_t ret_value;
+
+ FUNC_ENTER_API (H5Tdecode, FAIL);
+
+ if (buf==NULL)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "empty buffer")
+
+ if((dt = H5T_decode(buf))==NULL)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object");
+
+ /* Register the type and return the ID */
+ if ((ret_value=H5I_register (H5I_DATATYPE, dt))<0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type");
+
+done:
+ FUNC_LEAVE_API(ret_value);
+}
+
/*-------------------------------------------------------------------------
* API functions are above; library-private functions are below...
*-------------------------------------------------------------------------
@@ -2557,6 +2635,76 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T_encode
+ *
+ * Purpose: Private function for H5Tencode. Converts an object
+ * description into binary in a buffer.
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 14, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5T_encode, FAIL);
+
+ if(H5O_encode(buf, obj, nalloc, H5O_DTYPE_ID)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode object");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_decode
+ *
+ * Purpose: Private function for H5Tdecode. Reconstructs a binary
+ * description of datatype and returns a new object handle.
+ *
+ * Return: Success: datatype ID(non-negative)
+ *
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * slu@ncsa.uiuc.edu
+ * July 14, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5T_t*
+H5T_decode(unsigned char *buf)
+{
+ H5T_t *dt;
+ H5T_t *ret_value;
+
+ FUNC_ENTER_NOAPI(H5T_decode, NULL);
+
+ if((dt = H5O_decode(buf, H5O_DTYPE_ID))==NULL)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object");
+
+ /* Set return value */
+ ret_value=dt;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5T_create
*
* Purpose: Creates a new data type and initializes it to reasonable
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 965ca93..a8840e7 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -93,6 +93,8 @@ H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
H5_DLL htri_t H5T_committed(H5T_t *type);
H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id);
+H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
+H5_DLL H5T_t *H5T_decode(unsigned char *buf);
/* Reference specific functions */
H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 3fec470..7e5f8eb 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -485,6 +485,8 @@ H5_DLL htri_t H5Tequal(hid_t type1_id, hid_t type2_id);
H5_DLL herr_t H5Tlock(hid_t type_id);
H5_DLL herr_t H5Tcommit(hid_t loc_id, const char *name, hid_t type_id);
H5_DLL htri_t H5Tcommitted(hid_t type_id);
+H5_DLL herr_t H5Tencode(hid_t obj_id, unsigned char* buf, size_t* nalloc);
+H5_DLL hid_t H5Tdecode(unsigned char* buf);
/* Operations defined on compound datatypes */
H5_DLL herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset,
diff --git a/test/dtypes.c b/test/dtypes.c
index fc85ad3..dcc14bd 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -65,6 +65,7 @@ const char *FILENAME[] = {
"dtypes3",
"dtypes4",
"dtypes5",
+ "dtypes6",
NULL
};
@@ -1859,23 +1860,23 @@ test_compound_10(void)
/*-------------------------------------------------------------------------
- * Function: test_query
+ * Function: test_encode
*
- * Purpose: Tests query functions of compound and enumeration types.
+ * Purpose: Tests functions of encoding and decoding data type.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Raymond Lu
- * Thursday, April 4, 2002
+ * July 14, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
-test_query(void)
+test_encode(void)
{
struct s1 {
int a;
@@ -1884,17 +1885,25 @@ test_query(void)
double d;
};
hid_t file=-1, tid1=-1, tid2=-1;
+ hid_t decoded_tid1, decoded_tid2;
char filename[1024];
char compnd_type[]="Compound_type", enum_type[]="Enum_type";
short enum_val;
+ size_t cmpd_buf_size = 0;
+ size_t enum_buf_size = 0;
+ unsigned char *cmpd_buf, *enum_buf;
- TESTING("query functions of compound and enumeration types");
+ TESTING("functions of encoding and decoding data types");
/* Create File */
- h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename);
+ h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
goto error;
+ /*-----------------------------------------------------------------------
+ * Create compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
/* Create a compound datatype */
if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) {
H5_FAILED();
@@ -1953,31 +1962,86 @@ test_query(void)
printf("Can't insert field into enumeration type\n");
goto error;
} /* end if */
+
+ /*-----------------------------------------------------------------------
+ * Test encoding and decoding compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
+ /* Encode compound type in a buffer */
+ if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ if(cmpd_buf_size>0)
+ cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+
+ if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the compound buffer and return an object handle */
+ if((decoded_tid1=H5Tdecode(cmpd_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode compound type\n");
+ goto error;
+ } /* end if */
/* Query member number and member index by name, for compound type. */
- if(H5Tget_nmembers(tid1)!=4) {
+ if(H5Tget_nmembers(decoded_tid1)!=4) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid1, "c")!=2) {
+ if(H5Tget_member_index(decoded_tid1, "c")!=2) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
+
+ /* Encode enumerate type in a buffer */
+ if(H5Tencode(tid2, NULL, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ if(enum_buf_size>0)
+ enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+
+ if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the enumerate buffer and return an object handle */
+ if((decoded_tid2=H5Tdecode(enum_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode enumerate type\n");
+ goto error;
+ } /* end if */
+
/* Query member number and member index by name, for enumeration type. */
- if(H5Tget_nmembers(tid2)!=5) {
+ if(H5Tget_nmembers(decoded_tid2)!=5) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid2, "ORANGE")!=3) {
+ if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
+ /*-----------------------------------------------------------------------
+ * Commit and reopen the compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
/* Commit compound datatype and close it */
if(H5Tcommit(file, compnd_type, tid1)<0) {
H5_FAILED();
@@ -1989,6 +2053,13 @@ test_query(void)
printf("Can't close datatype\n");
goto error;
} /* end if */
+ if(H5Tclose(decoded_tid1)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ free(cmpd_buf);
+ cmpd_buf_size = 0;
/* Commit enumeration datatype and close it */
if(H5Tcommit(file, enum_type, tid2)<0) {
@@ -2001,6 +2072,13 @@ test_query(void)
printf("Can't close datatype\n");
goto error;
} /* end if */
+ if(H5Tclose(decoded_tid2)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ free(enum_buf);
+ enum_buf_size = 0;
/* Open the dataytpe for query */
if((tid1=H5Topen(file, compnd_type))<0) {
@@ -2014,30 +2092,85 @@ test_query(void)
goto error;
} /* end if */
- /* Query member number and member index by name, for compound type */
- if(H5Tget_nmembers(tid1)!=4) {
+
+ /* Encode compound type in a buffer */
+ if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ if(cmpd_buf_size>0)
+ cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+
+ if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode compound type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the compound buffer and return an object handle */
+ if((decoded_tid1=H5Tdecode(cmpd_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode compound type\n");
+ goto error;
+ } /* end if */
+
+ /* Query member number and member index by name, for compound type. */
+ if(H5Tget_nmembers(decoded_tid1)!=4) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid1, "c")!=2) {
+ if(H5Tget_member_index(decoded_tid1, "c")!=2) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
- /* Query member number and member index by name, for enumeration type */
- if(H5Tget_nmembers(tid2)!=5) {
+ /*-----------------------------------------------------------------------
+ * Test encoding and decoding compound and enumerate data types
+ *-----------------------------------------------------------------------
+ */
+ /* Encode enumerate type in a buffer */
+ if(H5Tencode(tid2, NULL, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ if(enum_buf_size>0)
+ enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+
+ if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) {
+ H5_FAILED();
+ printf("Can't encode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ /* Decode from the enumerate buffer and return an object handle */
+ if((decoded_tid2=H5Tdecode(enum_buf))<0) {
+ H5_FAILED();
+ printf("Can't decode enumerate type\n");
+ goto error;
+ } /* end if */
+
+ /* Query member number and member index by name, for enumeration type. */
+ if(H5Tget_nmembers(decoded_tid2)!=5) {
H5_FAILED();
printf("Can't get member number\n");
goto error;
} /* end if */
- if(H5Tget_member_index(tid2, "ORANGE")!=3) {
+ if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
H5_FAILED();
printf("Can't get correct index number\n");
goto error;
} /* end if */
+ /*-----------------------------------------------------------------------
+ * Close and release
+ *-----------------------------------------------------------------------
+ */
/* Close data type and file */
if(H5Tclose(tid1)<0) {
H5_FAILED();
@@ -2050,12 +2183,26 @@ test_query(void)
goto error;
} /* end if */
+ if(H5Tclose(decoded_tid1)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+ if(H5Tclose(decoded_tid2)<0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ } /* end if */
+
if(H5Fclose(file)<0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
} /* end if */
+ free(cmpd_buf);
+ free(enum_buf);
+
PASSED();
return 0;
@@ -2063,6 +2210,8 @@ test_query(void)
H5E_BEGIN_TRY {
H5Tclose (tid1);
H5Tclose (tid2);
+ H5Tclose (decoded_tid1);
+ H5Tclose (decoded_tid2);
H5Fclose (file);
} H5E_END_TRY;
return 1;
@@ -6182,9 +6331,9 @@ main(void)
nerrors += test_copy();
nerrors += test_detect();
nerrors += test_compound_1();
- nerrors += test_query();
nerrors += test_transient (fapl);
nerrors += test_named (fapl);
+ nerrors += test_encode();
h5_cleanup(FILENAME, fapl); /*must happen before first reset*/
reset_hdf5();