summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-24 03:47:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-24 03:47:06 (GMT)
commit77706cc276af29d0aee26d8051854da2f824ab9d (patch)
treed1c046cd0bccfd108e2617e8909062683cf3c165
parentb57f3b955f297d4f99ead2efa4ee6a41a5501e97 (diff)
downloadhdf5-77706cc276af29d0aee26d8051854da2f824ab9d.zip
hdf5-77706cc276af29d0aee26d8051854da2f824ab9d.tar.gz
hdf5-77706cc276af29d0aee26d8051854da2f824ab9d.tar.bz2
[svn-r8416] Purpose:
Code cleanup Description: Reduce warnings w/PC-Lint in various ways Platforms tested: PC-Lint too minor to require h5committest Misc. update:
-rw-r--r--src/H5Tcompound.c113
-rw-r--r--src/H5Tpkg.h4
-rwxr-xr-xsrc/hdf5.lnt2
3 files changed, 61 insertions, 58 deletions
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index 5d3306c..3a1c64f 100644
--- a/src/H5Tcompound.c
+++ b/src/H5Tcompound.c
@@ -38,7 +38,7 @@ static herr_t H5T_init_compound_interface(void);
#define H5T_COMPND_INC 64 /*typical max numb of members per struct */
/* Static local functions */
-static size_t H5T_get_member_offset(H5T_t *dt, unsigned membno);
+static size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
static herr_t H5T_pack(H5T_t *dt);
@@ -58,9 +58,9 @@ DESCRIPTION
static herr_t
H5T_init_compound_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_compound_interface);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_compound_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_compound_interface() */
@@ -98,20 +98,20 @@ H5Tget_member_offset(hid_t type_id, unsigned membno)
H5T_t *dt = NULL;
size_t ret_value;
- FUNC_ENTER_API(H5Tget_member_offset, 0);
+ FUNC_ENTER_API(H5Tget_member_offset, 0)
H5TRACE2("z","iIu",type_id,membno);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a compound datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a compound datatype")
if (membno >= dt->u.compnd.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number")
/* Value */
ret_value = H5T_get_member_offset(dt, membno);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -137,11 +137,11 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5T_get_member_offset(H5T_t *dt, unsigned membno)
+H5T_get_member_offset(const H5T_t *dt, unsigned membno)
{
size_t ret_value;
- FUNC_ENTER_NOAPI(H5T_get_member_offset, 0);
+ FUNC_ENTER_NOAPI(H5T_get_member_offset, 0)
assert(dt);
assert(membno < dt->u.compnd.nmembs);
@@ -150,7 +150,7 @@ H5T_get_member_offset(H5T_t *dt, unsigned membno)
ret_value = dt->u.compnd.memb[membno].offset;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -184,20 +184,20 @@ H5Tget_member_class(hid_t type_id, unsigned membno)
H5T_t *dt = NULL;
H5T_class_t ret_value;
- FUNC_ENTER_API(H5Tget_member_class, H5T_NO_CLASS);
+ FUNC_ENTER_API(H5Tget_member_class, H5T_NO_CLASS)
H5TRACE2("Tt","iIu",type_id,membno);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a compound datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a compound datatype")
if (membno >= dt->u.compnd.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number")
/* Value */
ret_value = dt->u.compnd.memb[membno].type->type;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Tget_member_class() */
@@ -239,27 +239,27 @@ H5Tget_member_type(hid_t type_id, unsigned membno)
H5T_t *dt = NULL, *memb_dt = NULL;
hid_t ret_value;
- FUNC_ENTER_API(H5Tget_member_type, FAIL);
+ FUNC_ENTER_API(H5Tget_member_type, FAIL)
H5TRACE2("i","iIs",type_id,membno);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype")
if (membno >= dt->u.compnd.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number")
if ((memb_dt=H5T_get_member_type(dt, membno))==NULL)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to retrieve member type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to retrieve member type")
if ((ret_value = H5I_register(H5I_DATATYPE, memb_dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable register datatype atom");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable register datatype atom")
done:
- if(ret_value<0)
-{
+ if(ret_value<0) {
if(memb_dt!=NULL)
- H5T_close(memb_dt);
+ if(H5T_close(memb_dt)<0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype")
} /* end if */
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -283,21 +283,21 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_get_member_type(H5T_t *dt, unsigned membno)
+H5T_get_member_type(const H5T_t *dt, unsigned membno)
{
H5T_t *ret_value = NULL;
- FUNC_ENTER_NOAPI(H5T_get_member_type, NULL);
+ FUNC_ENTER_NOAPI(H5T_get_member_type, NULL)
assert(dt);
assert(membno < dt->u.compnd.nmembs);
/* Copy datatype into an atom */
if (NULL == (ret_value = H5T_copy(dt->u.compnd.memb[membno].type, H5T_COPY_REOPEN)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy member datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy member datatype")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -332,27 +332,27 @@ H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id)
H5T_t *member = NULL; /*the atomic member type */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tinsert, FAIL);
+ FUNC_ENTER_API(H5Tinsert, FAIL)
H5TRACE4("e","iszi",parent_id,name,offset,member_id);
/* Check args */
if (parent_id==member_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't insert compound datatype within itself");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't insert compound datatype within itself")
if (NULL == (parent = H5I_object_verify(parent_id,H5I_DATATYPE)) || H5T_COMPOUND != parent->type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype")
if (H5T_STATE_TRANSIENT!=parent->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parent type read-only");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parent type read-only")
if (!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no member name");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no member name")
if (NULL == (member = H5I_object_verify(member_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Insert */
if (H5T_insert(parent, name, offset, member) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -377,19 +377,19 @@ H5Tpack(hid_t type_id)
H5T_t *dt = NULL;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Tpack, FAIL);
+ FUNC_ENTER_API(H5Tpack, FAIL)
H5TRACE1("e","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_detect_class(dt,H5T_COMPOUND)<=0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype")
/* Pack */
if (H5T_pack(dt) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -418,7 +418,7 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
size_t total_size;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5T_insert, FAIL);
+ FUNC_ENTER_NOAPI(H5T_insert, FAIL)
/* check args */
assert(parent && H5T_COMPOUND == parent->type);
@@ -429,7 +429,7 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
/* Does NAME already exist in PARENT? */
for (i=0; i<parent->u.compnd.nmembs; i++) {
if (!HDstrcmp(parent->u.compnd.memb[i].name, name))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member name is not unique");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member name is not unique")
}
/* Does the new member overlap any existing member ? */
@@ -440,12 +440,12 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
(parent->u.compnd.memb[i].offset <= offset &&
parent->u.compnd.memb[i].offset +
parent->u.compnd.memb[i].size > offset))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member")
}
/* Does the new member overlap the end of the compound type? */
if(offset+total_size>parent->size)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member extends past end of compound type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member extends past end of compound type")
/* Increase member array if necessary */
if (parent->u.compnd.nmembs >= parent->u.compnd.nalloc) {
@@ -454,8 +454,8 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
na * sizeof(H5T_cmemb_t));
if (!x)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- parent->u.compnd.nalloc = (int)na;
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ parent->u.compnd.nalloc = na;
parent->u.compnd.memb = x;
}
@@ -499,7 +499,7 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
parent->force_conv=TRUE;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -525,7 +525,7 @@ H5T_pack(H5T_t *dt)
size_t offset;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5T_pack);
+ FUNC_ENTER_NOAPI_NOINIT(H5T_pack)
assert(dt);
@@ -536,11 +536,11 @@ H5T_pack(H5T_t *dt)
/* Check for packing unmodifiable datatype */
if (H5T_STATE_TRANSIENT!=dt->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only")
if(dt->parent) {
if (H5T_pack(dt->parent) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype")
/* Adjust size of datatype appropriately */
if(dt->type==H5T_ARRAY)
@@ -552,10 +552,11 @@ H5T_pack(H5T_t *dt)
/* Recursively pack the members */
for (i=0; i<dt->u.compnd.nmembs; i++)
if (H5T_pack(dt->u.compnd.memb[i].type) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack part of a compound datatype");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack part of a compound datatype")
/* Remove padding between members */
- H5T_sort_value(dt, NULL);
+ if(H5T_sort_value(dt, NULL)<0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed")
for (i=0, offset=0; i<dt->u.compnd.nmembs; i++) {
dt->u.compnd.memb[i].offset = offset;
offset += dt->u.compnd.memb[i].size;
@@ -570,7 +571,7 @@ H5T_pack(H5T_t *dt)
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -590,11 +591,11 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5T_is_packed(H5T_t *dt)
+H5T_is_packed(const H5T_t *dt)
{
htri_t ret_value=TRUE; /* Return value */
- FUNC_ENTER_NOAPI(H5T_is_packed,FAIL);
+ FUNC_ENTER_NOAPI(H5T_is_packed,FAIL)
assert(dt);
@@ -604,9 +605,9 @@ H5T_is_packed(H5T_t *dt)
/* If this is a compound datatype, check if it is packed */
if(dt->type==H5T_COMPOUND)
- ret_value=dt->u.compnd.packed;
+ ret_value=(htri_t)dt->u.compnd.packed;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_is_packed() */
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 1ecf0f3..11a00c9 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -323,7 +323,6 @@ H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt);
H5_DLL H5T_t *H5T_get_super(H5T_t *dt);
H5_DLL char *H5T_get_member_name(H5T_t const *dt, unsigned membno);
H5_DLL herr_t H5T_get_member_value(const H5T_t *dt, unsigned membno, void *value);
-H5_DLL H5T_t *H5T_get_member_type(H5T_t *dt, unsigned membno);
H5_DLL int H5T_get_nmembers(const H5T_t *dt);
H5_DLL herr_t H5T_insert(H5T_t *parent, const char *name, size_t offset,
const H5T_t *member);
@@ -1091,6 +1090,7 @@ H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims,
const hsize_t dim[/* ndims */], const int perm[/* ndims */]);
/* Compound functions */
-H5_DLL htri_t H5T_is_packed(H5T_t *dt);
+H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno);
+H5_DLL htri_t H5T_is_packed(const H5T_t *dt);
#endif
diff --git a/src/hdf5.lnt b/src/hdf5.lnt
index 0c39404..c66de8a 100755
--- a/src/hdf5.lnt
+++ b/src/hdf5.lnt
@@ -94,6 +94,8 @@
H5FL.c
H5FO.c
+ H5Tcompound.c
+
H5Tcset.c
H5Tenum.c
H5Tfields.c