From ef9c40754bdf5b5be1bb92e632da5e17a8d6913c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 18 Apr 2002 09:05:38 -0500 Subject: [svn-r5200] Purpose: Code Cleanup Description: Clean up compiler warnings from the last bunch of checkins Platforms tested: FreeBSD 4.5 (sleipnir) --- src/H5D.c | 2 +- src/H5Distore.c | 37 +++++++++++++++++-------------------- src/H5Fistore.c | 37 +++++++++++++++++-------------------- src/H5Gnode.c | 1 + src/H5Tconv.c | 6 +++--- test/big.c | 2 +- test/dtypes.c | 10 +++++----- test/set_extent.c | 26 ++++++++++++++++++-------- test/tconfig.c | 1 - test/tvlstr.c | 3 +-- tools/h5dump/h5dump.c | 6 +++--- tools/h5ls/h5ls.c | 2 +- tools/lib/h5tools_utils.c | 4 ++-- tools/lib/h5tools_utils.h | 2 +- 14 files changed, 71 insertions(+), 68 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index a19bc6c..bf46af4 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -4113,7 +4113,7 @@ herr_t H5D_set_extent( H5D_t *dset, const hsize_t *size ) H5P_genplist_t *plist; H5O_fill_t fill; H5O_pline_t pline; - unsigned u; + int u; int shrink = 0; FUNC_ENTER( H5D_set_extent, FAIL ); diff --git a/src/H5Distore.c b/src/H5Distore.c index 1ed6679..328f791 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -170,25 +170,22 @@ typedef struct H5F_istore_ud1_t { /* inherits B-tree like properties from H5B */ H5B_class_t H5B_ISTORE[1] = {{ - H5B_ISTORE_ID, /*id */ - sizeof(H5F_istore_key_t), /*sizeof_nkey */ - H5F_istore_sizeof_rkey, /*get_sizeof_rkey */ - H5F_istore_new_node, /*new */ - H5F_istore_cmp2, /*cmp2 */ - H5F_istore_cmp3, /*cmp3 */ - H5F_istore_found, /*found */ - H5F_istore_insert, /*insert */ - FALSE, /*follow min branch? */ - FALSE, /*follow max branch? */ - /*pvn*/ - /*NULL,*/ /*remove */ - H5F_istore_remove, /*remove */ - H5F_istore_iterate, /*iterator */ - H5F_istore_decode_key, /*decode */ - H5F_istore_encode_key, /*encode */ - H5F_istore_debug_key, /*debug */ - /*pvn*/ - H5F_istore_prune_extent, /*remove chunks, upon H5Dset_extend call */ + H5B_ISTORE_ID, /*id */ + sizeof(H5F_istore_key_t), /*sizeof_nkey */ + H5F_istore_sizeof_rkey, /*get_sizeof_rkey */ + H5F_istore_new_node, /*new */ + H5F_istore_cmp2, /*cmp2 */ + H5F_istore_cmp3, /*cmp3 */ + H5F_istore_found, /*found */ + H5F_istore_insert, /*insert */ + FALSE, /*follow min branch? */ + FALSE, /*follow max branch? */ + H5F_istore_remove, /*remove */ + H5F_istore_iterate, /*iterator */ + H5F_istore_decode_key, /*decode */ + H5F_istore_encode_key, /*encode */ + H5F_istore_debug_key, /*debug */ + H5F_istore_prune_extent, /*remove chunks, upon H5Dset_extend call */ }}; #define H5F_HASH_DIVISOR 8 /* Attempt to spread out the hashing */ @@ -2790,7 +2787,7 @@ static H5B_ins_t H5F_istore_remove( H5F_t *f, hbool_t *rt_key_changed /*out*/) { H5F_istore_key_t *lt_key = (H5F_istore_key_t*)_lt_key; - H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, lt_key->nbytes); + H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes); *lt_key_changed = FALSE; *rt_key_changed = FALSE; return H5B_INS_REMOVE; diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 1ed6679..328f791 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -170,25 +170,22 @@ typedef struct H5F_istore_ud1_t { /* inherits B-tree like properties from H5B */ H5B_class_t H5B_ISTORE[1] = {{ - H5B_ISTORE_ID, /*id */ - sizeof(H5F_istore_key_t), /*sizeof_nkey */ - H5F_istore_sizeof_rkey, /*get_sizeof_rkey */ - H5F_istore_new_node, /*new */ - H5F_istore_cmp2, /*cmp2 */ - H5F_istore_cmp3, /*cmp3 */ - H5F_istore_found, /*found */ - H5F_istore_insert, /*insert */ - FALSE, /*follow min branch? */ - FALSE, /*follow max branch? */ - /*pvn*/ - /*NULL,*/ /*remove */ - H5F_istore_remove, /*remove */ - H5F_istore_iterate, /*iterator */ - H5F_istore_decode_key, /*decode */ - H5F_istore_encode_key, /*encode */ - H5F_istore_debug_key, /*debug */ - /*pvn*/ - H5F_istore_prune_extent, /*remove chunks, upon H5Dset_extend call */ + H5B_ISTORE_ID, /*id */ + sizeof(H5F_istore_key_t), /*sizeof_nkey */ + H5F_istore_sizeof_rkey, /*get_sizeof_rkey */ + H5F_istore_new_node, /*new */ + H5F_istore_cmp2, /*cmp2 */ + H5F_istore_cmp3, /*cmp3 */ + H5F_istore_found, /*found */ + H5F_istore_insert, /*insert */ + FALSE, /*follow min branch? */ + FALSE, /*follow max branch? */ + H5F_istore_remove, /*remove */ + H5F_istore_iterate, /*iterator */ + H5F_istore_decode_key, /*decode */ + H5F_istore_encode_key, /*encode */ + H5F_istore_debug_key, /*debug */ + H5F_istore_prune_extent, /*remove chunks, upon H5Dset_extend call */ }}; #define H5F_HASH_DIVISOR 8 /* Attempt to spread out the hashing */ @@ -2790,7 +2787,7 @@ static H5B_ins_t H5F_istore_remove( H5F_t *f, hbool_t *rt_key_changed /*out*/) { H5F_istore_key_t *lt_key = (H5F_istore_key_t*)_lt_key; - H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, lt_key->nbytes); + H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes); *lt_key_changed = FALSE; *rt_key_changed = FALSE; return H5B_INS_REMOVE; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 99f0211..2662165 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -94,6 +94,7 @@ H5B_class_t H5B_SNODE[1] = {{ H5G_node_decode_key, /*decode */ H5G_node_encode_key, /*encode */ NULL, /*debug key */ + NULL, /*remove chunks, upon H5Dset_extend call */ }}; /* Interface initialization */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index bb2edd6..a32efa4 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2175,9 +2175,9 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t src_base_size, dst_base_size;/*source & destination base size*/ size_t src_size, dst_size; /*source & destination total size in bytes*/ void *conv_buf=NULL; /*temporary conversion buffer */ - hsize_t conv_buf_size=0; /*size of conversion buffer in bytes */ + size_t conv_buf_size=0; /*size of conversion buffer in bytes */ void *bkg_buf=NULL; /*temporary background buffer */ - hsize_t bkg_buf_size=0; /*size of background buffer in bytes */ + size_t bkg_buf_size=0; /*size of background buffer in bytes */ uint8_t dbuf[64],*dbuf_ptr=dbuf;/*temp destination buffer */ int direction; /*direction of traversal */ hsize_t elmtno; /*element number counter */ @@ -2409,7 +2409,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, hsize_t elmtno; /*element number counter */ int i; /* local index variable */ void *bkg_buf=NULL; /*temporary background buffer */ - hsize_t bkg_buf_size=0; /*size of background buffer in bytes */ + size_t bkg_buf_size=0; /*size of background buffer in bytes */ FUNC_ENTER (H5T_conv_array, FAIL); diff --git a/test/big.c b/test/big.c index 2e2ec31..406e5c0 100644 --- a/test/big.c +++ b/test/big.c @@ -355,7 +355,7 @@ reader (hid_t fapl) * *------------------------------------------------------------------------- */ -void +static void usage(void) { HDfprintf(stdout, diff --git a/test/dtypes.c b/test/dtypes.c index 083c581..bcc90c9 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1112,7 +1112,7 @@ test_query(void) hid_t file=-1, tid1=-1, tid2=-1; char filename[1024]; char compnd_type[]="Compound_type", enum_type[]="Enum_type"; - int nmembs, index; + int nmembs, indx; short enum_val; TESTING("query functions of compound and enumeration types"); @@ -1187,7 +1187,7 @@ test_query(void) printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid1, "c"))!=2) { + if((indx=H5Tget_member_index(tid1, "c"))!=2) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; @@ -1199,7 +1199,7 @@ test_query(void) printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid2, "ORANGE"))!=3) { + if((indx=H5Tget_member_index(tid2, "ORANGE"))!=3) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; @@ -1247,7 +1247,7 @@ test_query(void) printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid1, "c"))!=2) { + if((indx=H5Tget_member_index(tid1, "c"))!=2) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; @@ -1259,7 +1259,7 @@ test_query(void) printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid2, "ORANGE"))!=3) { + if((indx=H5Tget_member_index(tid2, "ORANGE"))!=3) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; diff --git a/test/set_extent.c b/test/set_extent.c index 6178472..bae973f 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2002 NCSA + * All rights reserved. + * + * Programmer: Pedro Vicente + * April 12, 2002 + * + * Purpose: Tests the H5Dset_extent call + */ + #include "hdf5.h" #include "h5test.h" @@ -100,9 +110,9 @@ int main( void ) /* Compare the read array with the original array */ - for( i = 0; i < dims_out[0]; i++ ) + for( i = 0; i < (int)dims_out[0]; i++ ) { - for( j = 0; j < dims_out[1]; j++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) { if ( buf1[i][j] != data[i][j] ) { goto out; @@ -138,9 +148,9 @@ int main( void ) if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; /* Compare the read array with the original array */ - for( i = 0; i < dims_out[0]; i++ ) + for( i = 0; i < (int)dims_out[0]; i++ ) { - for( j = 0; j < dims_out[1]; j++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) { if ( i >= 70 || j >= 70 ) { @@ -229,9 +239,9 @@ int main( void ) if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; /* Compare the read array with the original array */ - for( i = 0; i < dims_out[0]; i++ ) + for( i = 0; i < (int)dims_out[0]; i++ ) { - for( j = 0; j < dims_out[1]; j++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) { if ( buf1[i][j] != data[i][j] ) { goto out; @@ -260,9 +270,9 @@ int main( void ) if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; /* Compare the read array with the original array */ - for( i = 0; i < dims_out[0]; i++ ) + for( i = 0; i < (int)dims_out[0]; i++ ) { - for( j = 0; j < dims_out[1]; j++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) { if ( i >= 70 || j >= 70 ) { diff --git a/test/tconfig.c b/test/tconfig.c index 01fc2df..8ed2a31 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -202,7 +202,6 @@ void test_config_malloc(void) { char *pt; - size_t n; /* verify H5_MALLOC_WORKS (malloc zero byte) macros */ pt = malloc(0); diff --git a/test/tvlstr.c b/test/tvlstr.c index 3c09746..7ce7e18 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -235,10 +235,9 @@ test_vlstrings_basic(void) static void test_vlstring_type(void) { hid_t fid; /* HDF5 File IDs */ - hid_t tid_vlstr, str; + hid_t tid_vlstr; H5T_cset_t cset; H5T_str_t pad; - size_t size; herr_t ret; /* Output message about test being performed */ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ceb86d4..4667e72 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -17,7 +17,7 @@ static const char *progname = "h5dump"; static int d_status = EXIT_SUCCESS; static int unamedtype = 0; /* shared data type with no name */ -static int prefix_len = 1024; +static size_t prefix_len = 1024; static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; static char *prefix; static const char *driver = NULL; /* The driver to open the file with. */ @@ -1377,7 +1377,7 @@ dump_all(hid_t group, const char *name, void * op_data) d_status = EXIT_FAILURE; ret = FAIL; } else { - int new_len = strlen(prefix) + strlen(name) + 2; + size_t new_len = strlen(prefix) + strlen(name) + 2; if (prefix_len <= new_len) { prefix_len = new_len + 1; @@ -2247,7 +2247,7 @@ handle_groups(hid_t fid, char *group, void * UNUSED data) dump_header_format->groupblockend); d_status = EXIT_FAILURE; } else { - int new_len = strlen(group) + 1; + size_t new_len = strlen(group) + 1; if (prefix_len <= new_len) { prefix_len = new_len; diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 5fd7df6..35f5f75 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -709,7 +709,7 @@ display_cmpd_type(hid_t type, int ind) char *name=NULL; /*member name */ size_t size; /*total size of type in bytes */ hid_t subtype; /*member data type */ - int i, j, n; /*miscellaneous counters */ + int i, n; /*miscellaneous counters */ if (H5T_COMPOUND!=H5Tget_class(type)) return FALSE; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index f7306a7..e96ad99 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -337,10 +337,10 @@ init_table(table_t **tbl) *------------------------------------------------------------------------- */ void -init_prefix(char **prefix, int prefix_len) +init_prefix(char **prefix, size_t prefix_len) { assert(prefix_len > 0); - *prefix = HDcalloc((size_t)prefix_len, 1); + *prefix = HDcalloc(prefix_len, 1); } diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index bb47c94..1ace7ad 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -109,6 +109,6 @@ extern char *get_objectname(table_t*, int); extern herr_t find_objs(hid_t group, const char *name, void *op_data); extern int search_obj(table_t *temp, unsigned long *); extern void init_table(table_t **tbl); -extern void init_prefix(char **temp, int); +extern void init_prefix(char **temp, size_t); #endif /* H5TOOLS_UTILS_H__ */ -- cgit v0.12