summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Odtype.c25
-rw-r--r--src/H5T.c86
-rw-r--r--src/H5Tcompound.c57
-rw-r--r--src/H5Tconv.c43
-rw-r--r--src/H5Tenum.c16
-rw-r--r--src/H5Tfields.c120
-rw-r--r--src/H5Tnative.c29
-rw-r--r--src/H5Tpkg.h16
-rw-r--r--src/H5Tpublic.h14
-rw-r--r--src/H5Tvlen.c7
10 files changed, 233 insertions, 180 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 5ab3fb4..e399870 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -93,7 +93,7 @@ static herr_t
H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
{
unsigned flags, version;
- int i, j;
+ unsigned i, j;
size_t z;
herr_t ret_value=SUCCEED; /* Return value */
@@ -195,7 +195,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
if (NULL==dt->u.compnd.memb)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
for (i = 0; i < dt->u.compnd.nmembs; i++) {
- int ndims=0; /* Number of dimensions of the array field */
+ unsigned ndims=0; /* Number of dimensions of the array field */
hsize_t dim[H5O_LAYOUT_NDIMS]; /* Dimensions of the array */
int perm[H5O_LAYOUT_NDIMS]; /* Dimension permutations */
unsigned perm_word=0; /* Dimension permutation information */
@@ -253,7 +253,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
perm[j]=(perm_word>>(j*8))&0xff;
/* Create the array datatype for the field */
- if ((array_dt=H5T_array_create(temp_type,ndims,dim,perm))==NULL) {
+ if ((array_dt=H5T_array_create(temp_type,(int)ndims,dim,perm))==NULL) {
for (j=0; j<=i; j++)
H5MM_xfree(dt->u.compnd.memb[j].name);
H5MM_xfree(dt->u.compnd.memb);
@@ -311,7 +311,6 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
* Enumeration data types...
*/
dt->u.enumer.nmembs = dt->u.enumer.nalloc = flags & 0xffff;
- assert(dt->u.enumer.nmembs>=0);
if (NULL==(dt->parent=H5FL_CALLOC(H5T_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
dt->parent->ent.header = HADDR_UNDEF;
@@ -405,13 +404,13 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
*pp += 3;
/* Decode array dimension sizes & compute number of elements */
- for (j=0, dt->u.array.nelem=1; j<dt->u.array.ndims; j++) {
+ for (j=0, dt->u.array.nelem=1; j<(unsigned)dt->u.array.ndims; j++) {
UINT32DECODE(*pp, dt->u.array.dim[j]);
dt->u.array.nelem *= dt->u.array.dim[j];
} /* end for */
/* Decode array dimension permutations (even though they are unused currently) */
- for (j=0; j<dt->u.array.ndims; j++)
+ for (j=0; j<(unsigned)dt->u.array.ndims; j++)
UINT32DECODE(*pp, dt->u.array.perm[j]);
/* Decode base type of array */
@@ -459,7 +458,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
htri_t has_array=FALSE; /* Whether a compound datatype has an array inside it */
unsigned flags = 0;
char *hdr = (char *)*pp;
- int i, j;
+ unsigned i, j;
size_t n, z, aligned;
herr_t ret_value=SUCCEED; /* Return value */
@@ -776,11 +775,11 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
*(*pp)++ = '\0';
/* Encode array dimensions */
- for (j=0; j<dt->u.array.ndims; j++)
+ for (j=0; j<(unsigned)dt->u.array.ndims; j++)
UINT32ENCODE(*pp, dt->u.array.dim[j]);
/* Encode array dimension permutations */
- for (j=0; j<dt->u.array.ndims; j++)
+ for (j=0; j<(unsigned)dt->u.array.ndims; j++)
UINT32ENCODE(*pp, dt->u.array.perm[j]);
/* Encode base type of array's information */
@@ -963,7 +962,7 @@ done:
static size_t
H5O_dtype_size(H5F_t *f, const void *mesg)
{
- int i;
+ unsigned i;
size_t ret_value = 8;
const H5T_t *dt = (const H5T_t *) mesg;
@@ -1205,7 +1204,7 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
const H5T_t *dt = (const H5T_t*)mesg;
const char *s;
char buf[256];
- int i;
+ unsigned i;
size_t k;
herr_t ret_value=SUCCEED; /* Return value */
@@ -1341,12 +1340,12 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream,
"Rank:",
dt->u.array.ndims);
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
- for (i=0; i<dt->u.array.ndims; i++) {
+ for (i=0; i<(unsigned)dt->u.array.ndims; i++) {
fprintf (stream, "%s%u", i?", ":"", (unsigned)dt->u.array.dim[i]);
}
fprintf (stream, "}\n");
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Permutation:");
- for (i=0; i<dt->u.array.ndims; i++) {
+ for (i=0; i<(unsigned)dt->u.array.ndims; i++) {
fprintf (stream, "%s%d", i?", ":"", dt->u.array.perm[i]);
}
fprintf (stream, "}\n");
diff --git a/src/H5T.c b/src/H5T.c
index cea739e..8f09cbc 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2470,7 +2470,7 @@ done:
htri_t
H5T_detect_class (const H5T_t *dt, H5T_class_t cls)
{
- int i;
+ unsigned i;
htri_t ret_value=FALSE; /* Return value */
FUNC_ENTER_NOAPI(H5T_detect_class, FAIL);
@@ -3530,7 +3530,7 @@ H5T_t *
H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
{
H5T_t *new_dt=NULL, *tmp=NULL;
- int i;
+ unsigned i;
char *s;
H5T_t *ret_value;
@@ -3605,7 +3605,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
new_dt->u.compnd.nmembs * sizeof(H5T_cmemb_t));
for (i=0; i<new_dt->u.compnd.nmembs; i++) {
- int j;
+ unsigned j;
int old_match;
s = new_dt->u.compnd.memb[i].name;
@@ -3773,7 +3773,7 @@ done:
herr_t
H5T_free(H5T_t *dt)
{
- int i;
+ unsigned i;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_free, FAIL);
@@ -4099,9 +4099,11 @@ H5T_get_size(const H5T_t *dt)
int
H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
{
- int *idx1 = NULL, *idx2 = NULL;
+ unsigned *idx1 = NULL, *idx2 = NULL;
int ret_value = 0;
- int i, j, tmp;
+ int i, j;
+ unsigned u;
+ int tmp;
hbool_t swapped;
size_t base_size;
@@ -4138,11 +4140,11 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
HGOTO_DONE(1);
/* Build an index for each type so the names are sorted */
- if (NULL==(idx1 = H5MM_malloc(dt1->u.compnd.nmembs * sizeof(int))) ||
- NULL==(idx2 = H5MM_malloc(dt1->u.compnd.nmembs * sizeof(int))))
+ if (NULL==(idx1 = H5MM_malloc(dt1->u.compnd.nmembs * sizeof(unsigned))) ||
+ NULL==(idx2 = H5MM_malloc(dt1->u.compnd.nmembs * sizeof(unsigned))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
- for (i=0; i<dt1->u.compnd.nmembs; i++)
- idx1[i] = idx2[i] = i;
+ for (u=0; u<dt1->u.compnd.nmembs; u++)
+ idx1[u] = idx2[u] = u;
for (i=dt1->u.compnd.nmembs-1, swapped=TRUE; swapped && i>=0; --i) {
for (j=0, swapped=FALSE; j<i; j++) {
if (HDstrcmp(dt1->u.compnd.memb[idx1[j]].name,
@@ -4168,35 +4170,31 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
#ifdef H5T_DEBUG
/* I don't quite trust the code above yet :-) --RPM */
- for (i=0; i<dt1->u.compnd.nmembs-1; i++) {
- assert(HDstrcmp(dt1->u.compnd.memb[idx1[i]].name,
- dt1->u.compnd.memb[idx1[i + 1]].name));
- assert(HDstrcmp(dt2->u.compnd.memb[idx2[i]].name,
- dt2->u.compnd.memb[idx2[i + 1]].name));
+ for (u=0; u<dt1->u.compnd.nmembs-1; u++) {
+ assert(HDstrcmp(dt1->u.compnd.memb[idx1[u]].name,
+ dt1->u.compnd.memb[idx1[u + 1]].name));
+ assert(HDstrcmp(dt2->u.compnd.memb[idx2[u]].name,
+ dt2->u.compnd.memb[idx2[u + 1]].name));
}
#endif
/* Compare the members */
- for (i=0; i<dt1->u.compnd.nmembs; i++) {
- tmp = HDstrcmp(dt1->u.compnd.memb[idx1[i]].name,
- dt2->u.compnd.memb[idx2[i]].name);
+ for (u=0; u<dt1->u.compnd.nmembs; u++) {
+ tmp = HDstrcmp(dt1->u.compnd.memb[idx1[u]].name,
+ dt2->u.compnd.memb[idx2[u]].name);
if (tmp < 0)
HGOTO_DONE(-1);
if (tmp > 0)
HGOTO_DONE(1);
- if (dt1->u.compnd.memb[idx1[i]].offset <
- dt2->u.compnd.memb[idx2[i]].offset) HGOTO_DONE(-1);
- if (dt1->u.compnd.memb[idx1[i]].offset >
- dt2->u.compnd.memb[idx2[i]].offset) HGOTO_DONE(1);
+ if (dt1->u.compnd.memb[idx1[u]].offset < dt2->u.compnd.memb[idx2[u]].offset) HGOTO_DONE(-1);
+ if (dt1->u.compnd.memb[idx1[u]].offset > dt2->u.compnd.memb[idx2[u]].offset) HGOTO_DONE(1);
- if (dt1->u.compnd.memb[idx1[i]].size <
- dt2->u.compnd.memb[idx2[i]].size) HGOTO_DONE(-1);
- if (dt1->u.compnd.memb[idx1[i]].size >
- dt2->u.compnd.memb[idx2[i]].size) HGOTO_DONE(1);
+ if (dt1->u.compnd.memb[idx1[u]].size < dt2->u.compnd.memb[idx2[u]].size) HGOTO_DONE(-1);
+ if (dt1->u.compnd.memb[idx1[u]].size > dt2->u.compnd.memb[idx2[u]].size) HGOTO_DONE(1);
- tmp = H5T_cmp(dt1->u.compnd.memb[idx1[i]].type,
- dt2->u.compnd.memb[idx2[i]].type);
+ tmp = H5T_cmp(dt1->u.compnd.memb[idx1[u]].type,
+ dt2->u.compnd.memb[idx2[u]].type);
if (tmp < 0) HGOTO_DONE(-1);
if (tmp > 0) HGOTO_DONE(1);
}
@@ -4212,11 +4210,11 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
HGOTO_DONE(1);
/* Build an index for each type so the names are sorted */
- if (NULL==(idx1 = H5MM_malloc(dt1->u.enumer.nmembs * sizeof(int))) ||
- NULL==(idx2 = H5MM_malloc(dt1->u.enumer.nmembs * sizeof(int))))
+ if (NULL==(idx1 = H5MM_malloc(dt1->u.enumer.nmembs * sizeof(unsigned))) ||
+ NULL==(idx2 = H5MM_malloc(dt1->u.enumer.nmembs * sizeof(unsigned))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
- for (i=0; i<dt1->u.enumer.nmembs; i++)
- idx1[i] = idx2[i] = i;
+ for (u=0; u<dt1->u.enumer.nmembs; u++)
+ idx1[u] = idx2[u] = u;
for (i=dt1->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) {
for (j=0, swapped=FALSE; j<i; j++) {
if (HDstrcmp(dt1->u.enumer.name[idx1[j]],
@@ -4242,24 +4240,24 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2)
#ifdef H5T_DEBUG
/* I don't quite trust the code above yet :-) --RPM */
- for (i=0; i<dt1->u.enumer.nmembs-1; i++) {
- assert(HDstrcmp(dt1->u.enumer.name[idx1[i]],
- dt1->u.enumer.name[idx1[i+1]]));
- assert(HDstrcmp(dt2->u.enumer.name[idx2[i]],
- dt2->u.enumer.name[idx2[i+1]]));
+ for (u=0; u<dt1->u.enumer.nmembs-1; u++) {
+ assert(HDstrcmp(dt1->u.enumer.name[idx1[u]],
+ dt1->u.enumer.name[idx1[u+1]]));
+ assert(HDstrcmp(dt2->u.enumer.name[idx2[u]],
+ dt2->u.enumer.name[idx2[u+1]]));
}
#endif
/* Compare the members */
base_size = dt1->parent->size;
- for (i=0; i<dt1->u.enumer.nmembs; i++) {
- tmp = HDstrcmp(dt1->u.enumer.name[idx1[i]],
- dt2->u.enumer.name[idx2[i]]);
+ for (u=0; u<dt1->u.enumer.nmembs; u++) {
+ tmp = HDstrcmp(dt1->u.enumer.name[idx1[u]],
+ dt2->u.enumer.name[idx2[u]]);
if (tmp<0) HGOTO_DONE(-1);
if (tmp>0) HGOTO_DONE(1);
- tmp = HDmemcmp(dt1->u.enumer.value+idx1[i]*base_size,
- dt2->u.enumer.value+idx2[i]*base_size,
+ tmp = HDmemcmp(dt1->u.enumer.value+idx1[u]*base_size,
+ dt2->u.enumer.value+idx2[u]*base_size,
base_size);
if (tmp<0) HGOTO_DONE(-1);
if (tmp>0) HGOTO_DONE(1);
@@ -5073,7 +5071,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
{
htri_t changed; /* Whether H5T_set_loc changed the type (even if the size didn't change) */
htri_t ret_value = 0; /* Indicate that success, but no location change */
- int i; /* Local index variable */
+ unsigned i; /* Local index variable */
int accum_change; /* Amount of change in the offset of the fields */
size_t old_size; /* Previous size of a field */
@@ -5271,7 +5269,7 @@ herr_t
H5T_debug(const H5T_t *dt, FILE *stream)
{
const char *s1="", *s2="";
- int i;
+ unsigned i;
size_t k, base_size;
uint64_t tmp;
herr_t ret_value=SUCCEED; /* Return value */
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c
index e21f865..e919c02 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, int membno);
+static size_t H5T_get_member_offset(H5T_t *dt, unsigned membno);
static herr_t H5T_pack(H5T_t *dt);
@@ -84,9 +84,17 @@ H5T_init_compound_interface(void)
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_6_COMPAT
size_t
-H5Tget_member_offset(hid_t type_id, int membno)
+H5Tget_member_offset(hid_t type_id, int _membno)
+#else /* H5_WANT_H5_V1_6_COMPAT */
+size_t
+H5Tget_member_offset(hid_t type_id, unsigned membno)
+#endif /* H5_WANT_H5_V1_6_COMPAT */
{
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ unsigned membno = (unsigned)_membno;
+#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL;
size_t ret_value;
@@ -96,7 +104,7 @@ H5Tget_member_offset(hid_t type_id, int 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");
- if (membno < 0 || membno >= dt->u.compnd.nmembs)
+ if (membno >= dt->u.compnd.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number");
/* Value */
@@ -111,7 +119,7 @@ done:
* Function: H5T_get_member_offset
*
* Purpose: Private function for H5Tget_member_offset. Returns the byte
- * offset of the beginning of a member with respect to the i
+ * offset of the beginning of a member with respect to the
* beginning of the compound datatype datum.
*
* Return: Success: Byte offset.
@@ -129,14 +137,14 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5T_get_member_offset(H5T_t *dt, int membno)
+H5T_get_member_offset(H5T_t *dt, unsigned membno)
{
size_t ret_value;
FUNC_ENTER_NOAPI(H5T_get_member_offset, 0);
assert(dt);
- assert(membno >= 0 && membno < dt->u.compnd.nmembs);
+ assert(membno < dt->u.compnd.nmembs);
/* Value */
ret_value = dt->u.compnd.memb[membno].offset;
@@ -162,9 +170,17 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_6_COMPAT
+H5T_class_t
+H5Tget_member_class(hid_t type_id, int _membno)
+#else /* H5_WANT_H5_V1_6_COMPAT */
H5T_class_t
-H5Tget_member_class(hid_t type_id, int membno)
+H5Tget_member_class(hid_t type_id, unsigned membno)
+#endif /* H5_WANT_H5_V1_6_COMPAT */
{
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ unsigned membno = (unsigned)_membno;
+#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL;
H5T_class_t ret_value;
@@ -174,7 +190,7 @@ H5Tget_member_class(hid_t type_id, int 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");
- if (membno < 0 || membno >= dt->u.compnd.nmembs)
+ if (membno >= dt->u.compnd.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number");
/* Value */
@@ -209,9 +225,17 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_6_COMPAT
hid_t
-H5Tget_member_type(hid_t type_id, int membno)
+H5Tget_member_type(hid_t type_id, int _membno)
+#else /* H5_WANT_H5_V1_6_COMPAT */
+hid_t
+H5Tget_member_type(hid_t type_id, unsigned membno)
+#endif /* H5_WANT_H5_V1_6_COMPAT */
{
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ unsigned membno = (unsigned)_membno;
+#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL, *memb_dt = NULL;
hid_t ret_value;
@@ -221,7 +245,7 @@ H5Tget_member_type(hid_t type_id, int 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");
- if (membno < 0 || membno >= dt->u.compnd.nmembs)
+ if (membno >= dt->u.compnd.nmembs)
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");
@@ -229,7 +253,8 @@ H5Tget_member_type(hid_t type_id, int membno)
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);
} /* end if */
@@ -258,14 +283,14 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_get_member_type(H5T_t *dt, int membno)
+H5T_get_member_type(H5T_t *dt, unsigned membno)
{
H5T_t *ret_value = NULL;
FUNC_ENTER_NOAPI(H5T_get_member_type, NULL);
assert(dt);
- assert(membno >=0 && membno < dt->u.compnd.nmembs);
+ 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)))
@@ -389,8 +414,8 @@ done:
herr_t
H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member)
{
- int idx, i;
- size_t total_size;
+ unsigned idx, i;
+ size_t total_size;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_insert, FAIL);
@@ -496,7 +521,7 @@ done:
static herr_t
H5T_pack(H5T_t *dt)
{
- int i;
+ unsigned i;
size_t offset;
herr_t ret_value=SUCCEED; /* Return value */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 5695b08..47f96ba 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -1217,7 +1217,8 @@ static herr_t
H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
{
H5T_conv_struct_t *priv = (H5T_conv_struct_t*)(cdata->priv);
- int i, j, *src2dst = NULL;
+ int *src2dst = NULL;
+ unsigned i, j;
H5T_t *type = NULL;
hid_t tid;
herr_t ret_value=SUCCEED; /* Return value */
@@ -1368,6 +1369,7 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
size_t offset; /*byte offset wrt struct */
size_t src_delta; /*source stride */
hsize_t elmtno;
+ unsigned u; /*counters */
int i; /*counters */
H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv);
herr_t ret_value=SUCCEED; /* Return value */
@@ -1450,14 +1452,14 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
* data point as small as possible with all the free space on the
* right side.
*/
- for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
- if (src2dst[i]<0) continue; /*subsetting*/
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
+ for (u=0, offset=0; u<src->u.compnd.nmembs; u++) {
+ if (src2dst[u]<0) continue; /*subsetting*/
+ src_memb = src->u.compnd.memb + u;
+ dst_memb = dst->u.compnd.memb + src2dst[u];
if (dst_memb->size <= src_memb->size) {
- if (H5T_convert(priv->memb_path[i], priv->src_memb_id[i],
- priv->dst_memb_id[src2dst[i]],
+ if (H5T_convert(priv->memb_path[u], priv->src_memb_id[u],
+ priv->dst_memb_id[src2dst[u]],
(hsize_t)1, 0, 0, /*no striding (packed array)*/
xbuf+src_memb->offset, xbkg+dst_memb->offset,
dxpl_id)<0)
@@ -1600,6 +1602,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */
size_t offset; /*byte offset wrt struct */
hsize_t elmtno; /*element counter */
+ unsigned u; /*counters */
int i; /*counters */
H5T_conv_struct_t *priv = NULL; /*private data */
herr_t ret_value=SUCCEED; /* Return value */
@@ -1637,11 +1640,11 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* is room for each conversion instead of actually doing anything.
*/
if (dst->size > src->size) {
- for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
- if (src2dst[i]<0)
+ for (u=0, offset=0; u<src->u.compnd.nmembs; u++) {
+ if (src2dst[u]<0)
continue;
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
+ src_memb = src->u.compnd.memb + u;
+ dst_memb = dst->u.compnd.memb + src2dst[u];
if (dst_memb->size > src_memb->size)
offset += src_memb->size;
}
@@ -1718,17 +1721,17 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* destination in the bkg buffer. Otherwise move the element as far
* left as possible in the buffer.
*/
- for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
- if (src2dst[i]<0) continue; /*subsetting*/
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
+ for (u=0, offset=0; u<src->u.compnd.nmembs; u++) {
+ if (src2dst[u]<0) continue; /*subsetting*/
+ src_memb = src->u.compnd.memb + u;
+ dst_memb = dst->u.compnd.memb + src2dst[u];
if (dst_memb->size <= src_memb->size) {
xbuf = buf + src_memb->offset;
xbkg = bkg + dst_memb->offset;
- if (H5T_convert(priv->memb_path[i],
- priv->src_memb_id[i],
- priv->dst_memb_id[src2dst[i]], nelmts,
+ if (H5T_convert(priv->memb_path[u],
+ priv->src_memb_id[u],
+ priv->dst_memb_id[src2dst[u]], nelmts,
buf_stride ? buf_stride : src->size,
bkg_stride, xbuf, xbkg,
dxpl_id)<0)
@@ -1820,8 +1823,8 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
int n; /*src value cast as native int */
int domain[2]; /*min and max source values */
int *map=NULL; /*map from src value to dst idx */
- int length; /*nelmts in map array */
- int i, j; /*counters */
+ unsigned length; /*nelmts in map array */
+ unsigned i, j; /*counters */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOINIT(H5T_conv_enum_init);
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index 95c514f..56ac80d 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -220,7 +220,7 @@ done:
herr_t
H5T_enum_insert(H5T_t *dt, const char *name, void *value)
{
- int i;
+ unsigned i;
char **names=NULL;
uint8_t *values=NULL;
herr_t ret_value=SUCCEED; /* Return value */
@@ -280,9 +280,17 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_6_COMPAT
herr_t
-H5Tget_member_value(hid_t type, int membno, void *value/*out*/)
+H5Tget_member_value(hid_t type, int _membno, void *value/*out*/)
+#else /* H5_WANT_H5_V1_6_COMPAT */
+herr_t
+H5Tget_member_value(hid_t type, unsigned membno, void *value/*out*/)
+#endif /* H5_WANT_H5_V1_6_COMPAT */
{
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ unsigned membno = (unsigned)_membno;
+#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt=NULL;
herr_t ret_value=SUCCEED; /* Return value */
@@ -293,7 +301,7 @@ H5Tget_member_value(hid_t type, int membno, void *value/*out*/)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
if (H5T_ENUM!=dt->type)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
- if (membno<0 || membno>=dt->u.enumer.nmembs)
+ if (membno>=dt->u.enumer.nmembs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number");
if (!value)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null value buffer");
@@ -324,7 +332,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5T_get_member_value(H5T_t *dt, int membno, void *value/*out*/)
+H5T_get_member_value(H5T_t *dt, unsigned membno, void *value/*out*/)
{
herr_t ret_value=SUCCEED; /* Return value */
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index b14a53d..b3baa8e 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -19,14 +19,16 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5Tfields_mask
+
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
#include "H5Iprivate.h" /*ID functions */
#include "H5MMprivate.h" /*memory management */
#include "H5Tpkg.h" /*data-type functions */
-#define PABLO_MASK H5Tfields_mask
-
/* Interface initialization */
static int interface_initialize_g = 0;
#define INTERFACE_INIT H5T_init_fields_interface
@@ -49,9 +51,9 @@ DESCRIPTION
static herr_t
H5T_init_fields_interface(void)
{
- FUNC_ENTER_NOINIT(H5T_init_fields_interface);
+ FUNC_ENTER_NOINIT(H5T_init_fields_interface)
- FUNC_LEAVE_NOAPI(H5T_init());
+ FUNC_LEAVE_NOAPI(H5T_init())
} /* H5T_init_fields_interface() */
@@ -59,9 +61,9 @@ H5T_init_fields_interface(void)
* Function: H5Tget_nmembers
*
* Purpose: Determines how many members TYPE_ID has. The type must be
- * either a compound data type or an enumeration data type.
+ * either a compound datatype or an enumeration datatype.
*
- * Return: Success: Number of members defined in the data type.
+ * Return: Success: Number of members defined in the datatype.
*
* Failure: Negative
*
@@ -72,7 +74,7 @@ H5T_init_fields_interface(void)
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with enumeration data types.
+ * Also works with enumeration datatypes.
*-------------------------------------------------------------------------
*/
int
@@ -81,18 +83,18 @@ H5Tget_nmembers(hid_t type_id)
H5T_t *dt = NULL;
int ret_value;
- FUNC_ENTER_API(H5Tget_num_members, FAIL);
+ FUNC_ENTER_API(H5Tget_num_members, FAIL)
H5TRACE1("Is","i",type_id);
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
if((ret_value = H5T_get_nmembers(dt))<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot return member number");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot return member number")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -101,9 +103,9 @@ done:
*
* Purpose: Private function for H5Tget_nmembers. Determines how many
* members DTYPE has. The type must be either a compound data
- * type or an enumeration data type.
+ * type or an enumeration datatype.
*
- * Return: Success: Number of members defined in the data type.
+ * Return: Success: Number of members defined in the datatype.
*
* Failure: Negative
*
@@ -121,19 +123,19 @@ H5T_get_nmembers(const H5T_t *dt)
{
int ret_value;
- FUNC_ENTER_NOAPI(H5T_get_nmembers, FAIL);
+ FUNC_ENTER_NOAPI(H5T_get_nmembers, FAIL)
assert(dt);
if (H5T_COMPOUND==dt->type)
- ret_value = dt->u.compnd.nmembs;
+ ret_value = (int)dt->u.compnd.nmembs;
else if (H5T_ENUM==dt->type)
- ret_value = dt->u.enumer.nmembs;
+ ret_value = (int)dt->u.enumer.nmembs;
else
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for type class");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for type class")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -141,7 +143,7 @@ done:
* Function: H5Tget_member_name
*
* Purpose: Returns the name of a member of a compound or enumeration
- * data type. Members are stored in no particular order with
+ * datatype. Members are stored in no particular order with
* numbers 0 through N-1 where N is the value returned by
* H5Tget_nmembers().
*
@@ -155,26 +157,34 @@ done:
*
* Modifications:
* Robb Matzke, 22 Dec 1998
- * Also works with enumeration data types.
+ * Also works with enumeration datatypes.
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_6_COMPAT
+char *
+H5Tget_member_name(hid_t type_id, int _membno)
+#else /* H5_WANT_H5_V1_6_COMPAT */
char *
-H5Tget_member_name(hid_t type_id, int membno)
+H5Tget_member_name(hid_t type_id, unsigned membno)
+#endif /* H5_WANT_H5_V1_6_COMPAT */
{
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ unsigned membno = (unsigned)_membno;
+#endif /* H5_WANT_H5_V1_6_COMPAT */
H5T_t *dt = NULL;
char *ret_value;
- FUNC_ENTER_API(H5Tget_member_name, NULL);
+ FUNC_ENTER_API(H5Tget_member_name, NULL)
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
if((ret_value = H5T_get_member_name(dt, membno))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get member name");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get member name")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -182,7 +192,7 @@ done:
* Function: H5T_get_member_name
*
* Purpose: Private function for H5Tget_member_name. Returns the name
- * of a member of a compound or enumeration data type. Members
+ * of a member of a compound or enumeration datatype. Members
* are stored in no particular order with numbers 0 through
* N-1 where N is the value returned by H5Tget_nmembers().
*
@@ -198,33 +208,33 @@ done:
*-------------------------------------------------------------------------
*/
char *
-H5T_get_member_name(H5T_t *dt, int membno)
+H5T_get_member_name(H5T_t const *dt, unsigned membno)
{
char *ret_value;
- FUNC_ENTER_NOAPI(H5T_get_member_name, NULL);
+ FUNC_ENTER_NOAPI(H5T_get_member_name, NULL)
assert(dt);
switch (dt->type) {
case H5T_COMPOUND:
- if (membno<0 || membno>=dt->u.compnd.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number");
+ if (membno>=dt->u.compnd.nmembs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number")
ret_value = H5MM_xstrdup(dt->u.compnd.memb[membno].name);
break;
case H5T_ENUM:
- if (membno<0 || membno>=dt->u.enumer.nmembs)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number");
+ if (membno>=dt->u.enumer.nmembs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number")
ret_value = H5MM_xstrdup(dt->u.enumer.name[membno]);
break;
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class")
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -232,7 +242,7 @@ done:
* Function: H5Tget_member_index
*
* Purpose: Returns the index of a member in a compound or enumeration
- * data type by given name.Members are stored in no particular
+ * datatype by given name.Members are stored in no particular
* order with numbers 0 through N-1 where N is the value
* returned by H5Tget_nmembers().
*
@@ -251,47 +261,45 @@ H5Tget_member_index(hid_t type_id, const char *name)
{
H5T_t *dt = NULL;
int ret_value=FAIL;
- int nmembs, i;
+ unsigned i;
- FUNC_ENTER_API(H5Tget_member_index, FAIL);
+ FUNC_ENTER_API(H5Tget_member_index, FAIL)
H5TRACE2("Is","is",type_id,name);
/* Check arguments */
assert(name);
if(NULL==(dt=H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Locate member by name */
switch (dt->type) {
case H5T_COMPOUND:
- nmembs = dt->u.compnd.nmembs;
- for(i=0; i<nmembs; i++) {
+ for(i=0; i< dt->u.compnd.nmembs; i++) {
if(!HDstrcmp(dt->u.compnd.memb[i].name, name))
- HGOTO_DONE(i);
+ HGOTO_DONE((int)i)
}
break;
case H5T_ENUM:
- nmembs = dt->u.enumer.nmembs;
- for(i=0; i<nmembs; i++) {
+ for(i=0; i< dt->u.enumer.nmembs; i++) {
if(!HDstrcmp(dt->u.enumer.name[i], name))
- HGOTO_DONE(i);
+ HGOTO_DONE((int)i)
}
break;
default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type")
}
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5T_sort_value
*
- * Purpose: Sorts the members of a compound data type by their offsets;
+ * Purpose: Sorts the members of a compound datatype by their offsets;
* sorts the members of an enum type by their values. This even
- * works for locked data types since it doesn't change the value
+ * works for locked datatypes since it doesn't change the value
* of the type. MAP is an optional parallel integer array which
* is also swapped along with members of DT.
*
@@ -307,13 +315,13 @@ done:
herr_t
H5T_sort_value(H5T_t *dt, int *map)
{
- int i, j, nmembs;
+ unsigned i, j, nmembs;
size_t size;
hbool_t swapped;
uint8_t tbuf[32];
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5T_sort_value, FAIL);
+ FUNC_ENTER_NOAPI(H5T_sort_value, FAIL)
/* Check args */
assert(dt);
@@ -393,15 +401,15 @@ H5T_sort_value(H5T_t *dt, int *map)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
/*-------------------------------------------------------------------------
* Function: H5T_sort_name
*
- * Purpose: Sorts members of a compound or enumeration data type by their
- * names. This even works for locked data types since it doesn't
+ * Purpose: Sorts members of a compound or enumeration datatype by their
+ * names. This even works for locked datatypes since it doesn't
* change the value of the types.
*
* Return: Success: Non-negative
@@ -418,13 +426,13 @@ done:
herr_t
H5T_sort_name(H5T_t *dt, int *map)
{
- int i, j, nmembs;
+ unsigned i, j, nmembs;
size_t size;
hbool_t swapped;
uint8_t tbuf[32];
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5T_sort_name, FAIL);
+ FUNC_ENTER_NOAPI(H5T_sort_name, FAIL)
/* Check args */
assert(dt);
@@ -500,6 +508,6 @@ H5T_sort_name(H5T_t *dt, int *map)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index cf6a953..f013271 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -159,11 +159,12 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
H5T_t *dt; /* Datatype to make native */
H5T_class_t h5_class; /* Class of datatype to make native */
size_t size; /* Size of datatype to make native */
- int nmemb; /* Number of members in compound & enum types */
+ int snmemb; /* Number of members in compound & enum types */
+ unsigned nmemb; /* Number of members in compound & enum types */
H5T_t *super_type; /* Super type of VL, array and enum datatypes */
H5T_t *nat_super_type; /* Native form of VL, array & enum super datatype */
H5T_t *new_type=NULL; /* New native datatype */
- int i; /* Local index variable */
+ unsigned i; /* Local index variable */
H5T_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5T_get_native_type, NULL)
@@ -257,15 +258,15 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
size_t children_st_align=0; /* The max alignment among compound members. This'll be the compound alignment */
char **comp_mname; /* List of member names in compound type */
- if((nmemb = H5T_get_nmembers(dtype))<=0)
+ if((snmemb = H5T_get_nmembers(dtype))<=0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "compound data type doesn't have any member")
+ H5_ASSIGN_OVERFLOW(nmemb,snmemb,int,unsigned);
- H5_CHECK_OVERFLOW(nmemb,int,size_t);
- if((memb_list = (H5T_t**)H5MM_malloc((size_t)nmemb*sizeof(H5T_t*)))==NULL)
+ if((memb_list = (H5T_t**)H5MM_malloc(nmemb*sizeof(H5T_t*)))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
- if((memb_offset = (size_t*)H5MM_calloc((size_t)nmemb*sizeof(size_t)))==NULL)
+ if((memb_offset = (size_t*)H5MM_calloc(nmemb*sizeof(size_t)))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
- if((comp_mname = (char**)H5MM_malloc((size_t)nmemb*sizeof(char*)))==NULL)
+ if((comp_mname = (char**)H5MM_malloc(nmemb*sizeof(char*)))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
/* Construct child compound type and retrieve a list of their IDs, offsets, total size, and alignment for compound type. */
@@ -352,8 +353,9 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type")
/* Retrieve member info and insert members into new enum type */
- if((nmemb = H5T_get_nmembers(dtype))<=0)
+ if((snmemb = H5T_get_nmembers(dtype))<=0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumarate data type doesn't have any member")
+ H5_ASSIGN_OVERFLOW(nmemb,snmemb,int,unsigned);
for(i=0; i<nmemb; i++) {
if((memb_name=H5T_get_member_name(dtype, i))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name")
@@ -384,7 +386,8 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
case H5T_ARRAY:
{
- int array_rank; /* Array's rank */
+ int sarray_rank; /* Array's rank */
+ unsigned array_rank; /* Array's rank */
hsize_t *dims = NULL; /* Dimension sizes for array */
hsize_t nelems = 1;
size_t super_offset=0;
@@ -392,10 +395,10 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
size_t super_align=0;
/* Retrieve dimension information for array data type */
- if((array_rank=H5T_get_array_ndims(dtype))<=0)
+ if((sarray_rank=H5T_get_array_ndims(dtype))<=0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension rank")
- H5_CHECK_OVERFLOW(array_rank,int,size_t);
- if((dims = (hsize_t*)H5MM_malloc((size_t)array_rank*sizeof(hsize_t)))==NULL)
+ H5_ASSIGN_OVERFLOW(array_rank,sarray_rank,int,unsigned);
+ if((dims = (hsize_t*)H5MM_malloc(array_rank*sizeof(hsize_t)))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory")
if(H5T_get_array_dims(dtype, dims, NULL)<0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension size")
@@ -412,7 +415,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype")
/* Create a new array type based on native type */
- if((new_type=H5T_array_create(nat_super_type, array_rank, dims, NULL))==NULL)
+ if((new_type=H5T_array_create(nat_super_type, sarray_rank, dims, NULL))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create array type")
/* Close base type */
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 2058e6a..dba89bc 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -125,8 +125,8 @@ typedef enum H5T_sort_t {
/* A compound datatype */
typedef struct H5T_compnd_t {
- int nalloc; /*num entries allocated in MEMB array*/
- int nmembs; /*number of members defined in struct*/
+ unsigned nalloc; /*num entries allocated in MEMB array*/
+ unsigned nmembs; /*number of members defined in struct*/
H5T_sort_t sorted; /*how are members sorted? */
hbool_t packed; /*are members packed together? */
struct H5T_cmemb_t *memb; /*array of struct members */
@@ -134,8 +134,8 @@ typedef struct H5T_compnd_t {
/* An enumeration datatype */
typedef struct H5T_enum_t {
- int nalloc; /*num entries allocated */
- int nmembs; /*number of members defined in enum */
+ unsigned nalloc; /*num entries allocated */
+ unsigned nmembs; /*number of members defined in enum */
H5T_sort_t sorted; /*how are members sorted? */
uint8_t *value; /*array of values */
char **name; /*array of symbol names */
@@ -305,11 +305,11 @@ H5_DLLVAR size_t H5T_NATIVE_UINT_FAST64_ALIGN_g;
H5_DLL herr_t H5T_init_interface(void);
H5_DLL H5T_t *H5T_create(H5T_class_t type, size_t size);
H5_DLL herr_t H5T_free(H5T_t *dt);
-H5_DLL H5T_sign_t H5T_get_sign(H5T_t *dt);
+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 *dt, int membno);
-H5_DLL herr_t H5T_get_member_value(H5T_t *dt, int membno, void *value);
-H5_DLL H5T_t *H5T_get_member_type(H5T_t *dt, int membno);
+H5_DLL char *H5T_get_member_name(H5T_t const *dt, unsigned membno);
+H5_DLL herr_t H5T_get_member_value(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);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 1c0084e..13c8a33 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -523,13 +523,23 @@ H5_DLL H5T_norm_t H5Tget_norm(hid_t type_id);
H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id);
H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id);
H5_DLL int H5Tget_nmembers(hid_t type_id);
+#ifdef H5_WANT_H5_V1_6_COMPAT
H5_DLL char *H5Tget_member_name(hid_t type_id, int membno);
+#else /* H5_WANT_H5_V1_6_COMPAT */
+H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno);
+#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL int H5Tget_member_index(hid_t type_id, const char *name);
+#ifdef H5_WANT_H5_V1_6_COMPAT
H5_DLL size_t H5Tget_member_offset(hid_t type_id, int membno);
H5_DLL H5T_class_t H5Tget_member_class(hid_t type_id, int membno);
H5_DLL hid_t H5Tget_member_type(hid_t type_id, int membno);
-H5_DLL herr_t H5Tget_member_value(hid_t type_id, int membno,
- void *value/*out*/);
+H5_DLL herr_t H5Tget_member_value(hid_t type_id, int membno, void *value/*out*/);
+#else /* H5_WANT_H5_V1_6_COMPAT */
+H5_DLL size_t H5Tget_member_offset(hid_t type_id, unsigned membno);
+H5_DLL H5T_class_t H5Tget_member_class(hid_t type_id, unsigned membno);
+H5_DLL hid_t H5Tget_member_type(hid_t type_id, unsigned membno);
+H5_DLL herr_t H5Tget_member_value(hid_t type_id, unsigned membno, void *value/*out*/);
+#endif /* H5_WANT_H5_V1_6_COMPAT */
H5_DLL H5T_cset_t H5Tget_cset(hid_t type_id);
H5_DLL htri_t H5Tis_variable_str(hid_t type_id);
H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction);
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 1946136..1b113a7 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -717,8 +717,7 @@ done:
static herr_t
H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, void *free_info)
{
- int i; /* local index variable */
- size_t j; /* local index variable */
+ unsigned i; /* local index variable */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOINIT(H5T_vlen_reclaim_recurse)
@@ -734,8 +733,8 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
void *off; /* offset of field */
/* Calculate the offset member and recurse on it */
- for(j=0; j<dt->u.array.nelem; j++) {
- off=((uint8_t *)elem)+j*(dt->parent->size);
+ for(i=0; i<dt->u.array.nelem; i++) {
+ off=((uint8_t *)elem)+i*(dt->parent->size);
if(H5T_vlen_reclaim_recurse(off,dt->parent,free_func,free_info)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free array element")
} /* end for */