summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-06-14 21:18:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-06-14 21:18:32 (GMT)
commit7e7dd03a329f692507203f6cda87fe6f67b86ac7 (patch)
treec928635641c06760ceb52d9dbdfd3acd62d00130 /test
parent162b19cd6c1f6c6b14254c60b83bd14b1c11184c (diff)
downloadhdf5-7e7dd03a329f692507203f6cda87fe6f67b86ac7.zip
hdf5-7e7dd03a329f692507203f6cda87fe6f67b86ac7.tar.gz
hdf5-7e7dd03a329f692507203f6cda87fe6f67b86ac7.tar.bz2
[svn-r10920] Purpose:
Bug fix Description: Add check for opaque tags that are too long for file format to handle currently. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5commmitest
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index ba18b91..8872727 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -95,6 +95,7 @@ static herr_t convert_opaque(hid_t UNUSED st, hid_t UNUSED dt,
size_t UNUSED nelmts, size_t UNUSED buf_stride,
size_t UNUSED bkg_stride, void UNUSED *_buf,
void UNUSED *bkg, hid_t UNUSED dset_xfer_plid);
+static int opaque_long(void);
/*-------------------------------------------------------------------------
@@ -3266,6 +3267,8 @@ test_opaque(void)
num_errors += opaque_check(0);
/* Test opaque types without tag */
num_errors += opaque_check(1);
+ /* Test named opaque types with very long tag */
+ num_errors += opaque_long();
if(num_errors)
goto error;
@@ -3358,6 +3361,59 @@ opaque_check(int tag_it)
/*-------------------------------------------------------------------------
+ * Function: opaque_long
+ *
+ * Purpose: Test named (committed) opaque datatypes w/very long tags
+ *
+ * Return: Success: 0
+ *
+ * Failure: number of errors
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, June 14, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+opaque_long(void)
+{
+ char *long_tag = NULL;
+ hid_t dt = -1;
+ herr_t ret;
+
+ /* Build opaque type */
+ if ((dt=H5Tcreate(H5T_OPAQUE, 4))<0) TEST_ERROR
+
+ /* Create long tag */
+ long_tag = HDmalloc(16384+1);
+ HDmemset(long_tag, 'a', 16384);
+ long_tag[16384] = '\0';
+
+ /* Set opaque type's tag */
+ H5E_BEGIN_TRY {
+ ret = H5Tset_tag(dt, long_tag);
+ } H5E_END_TRY;
+ if(ret!=FAIL) TEST_ERROR
+
+ /* Close datatype */
+ if(H5Tclose(dt) < 0) TEST_ERROR
+
+ /* Release memory for tag */
+ HDfree(long_tag);
+
+ return 0;
+
+ error:
+ if (dt>0) H5Tclose(dt);
+ if (long_tag != NULL) HDfree(long_tag);
+ H5_FAILED();
+ return 1;
+}
+
+
+/*-------------------------------------------------------------------------
* Function: test_encode
*
* Purpose: Tests functions of encoding and decoding data type.