diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1999-08-25 22:01:41 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1999-08-25 22:01:41 (GMT) |
commit | 9b934aa767e8c177a0ac84cc808dec9ac49135ae (patch) | |
tree | 0e8840d231ceab518613dace000a3b9e19c81da8 | |
parent | a92c1a7f2cd831a866dd81fe69e0034bfa9338f8 (diff) | |
download | hdf5-9b934aa767e8c177a0ac84cc808dec9ac49135ae.zip hdf5-9b934aa767e8c177a0ac84cc808dec9ac49135ae.tar.gz hdf5-9b934aa767e8c177a0ac84cc808dec9ac49135ae.tar.bz2 |
[svn-r1599] Changed return type of H5Tenum_nameof and H5Tenum_valueof from hid_t to herr_t
-rw-r--r-- | src/H5T.c | 9 | ||||
-rw-r--r-- | src/H5Tpublic.h | 7 |
2 files changed, 11 insertions, 5 deletions
@@ -1940,9 +1940,12 @@ H5Tset_size(hid_t type_id, size_t size) if (H5T_STATE_TRANSIENT!=dt->state) { HRETURN_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); } - if (size <= 0) { + if (size <= 0 && size!=H5T_VARIABLE) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive"); } + if (size == H5T_VARIABLE && dt->type!=H5T_STRING) { + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "only strings may be variable length"); + } if (H5T_ENUM==dt->type && dt->u.enumer.nmembs>0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); @@ -3801,7 +3804,7 @@ H5Tget_member_value(hid_t type, int membno, void *value/*out*/) * *------------------------------------------------------------------------- */ -hid_t +herr_t H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, size_t size) { H5T_t *dt = NULL; @@ -3851,7 +3854,7 @@ H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, size_t size) * *------------------------------------------------------------------------- */ -hid_t +herr_t H5Tenum_valueof(hid_t type, const char *name, void *value/*out*/) { H5T_t *dt = NULL; diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index e595da6..d9284f1 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -156,6 +156,9 @@ typedef struct { void *p; /* Pointer to VL data */ } hvl_t; +/* Variable Length String information */ +#define H5T_VARIABLE ((size_t)(-1)) /* Indicate that a string is variable length (null-terminated in C, instead of fixed length) */ + /* All data type conversion functions are... */ typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t stride, void *buf, @@ -460,9 +463,9 @@ __DLL__ herr_t H5Tpack(hid_t type_id); /* Operations defined on enumeration data types */ __DLL__ hid_t H5Tenum_create(hid_t base_id); __DLL__ herr_t H5Tenum_insert(hid_t type, const char *name, void *value); -__DLL__ hid_t H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, +__DLL__ herr_t H5Tenum_nameof(hid_t type, void *value, char *name/*out*/, size_t size); -__DLL__ hid_t H5Tenum_valueof(hid_t type, const char *name, +__DLL__ herr_t H5Tenum_valueof(hid_t type, const char *name, void *value/*out*/); /* Operations defined on variable-length data types */ |