diff options
-rw-r--r-- | hl/examples/ex_image1.c | 8 | ||||
-rw-r--r-- | hl/examples/ex_lite2.c | 6 | ||||
-rw-r--r-- | hl/test/test_image.c | 12 | ||||
-rw-r--r-- | hl/test/test_table.c | 140 | ||||
-rw-r--r-- | src/H5Vprivate.h | 3 | ||||
-rw-r--r-- | test/dsets.c | 174 | ||||
-rw-r--r-- | test/dtypes.c | 6 | ||||
-rw-r--r-- | test/enum.c | 15 | ||||
-rw-r--r-- | test/external.c | 2 | ||||
-rw-r--r-- | test/flush1.c | 8 | ||||
-rw-r--r-- | test/flush2.c | 6 | ||||
-rw-r--r-- | test/istore.c | 2 | ||||
-rw-r--r-- | test/tsohm.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 20 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 6 |
15 files changed, 211 insertions, 203 deletions
diff --git a/hl/examples/ex_image1.c b/hl/examples/ex_image1.c index 9b3c426..96bc7c7 100644 --- a/hl/examples/ex_image1.c +++ b/hl/examples/ex_image1.c @@ -16,8 +16,8 @@ #include "hdf5.h" #include "hdf5_hl.h" -#define WIDTH (hsize_t)400 -#define HEIGHT (hsize_t)200 +#define WIDTH 400 +#define HEIGHT 200 #define PAL_ENTRIES 9 unsigned char buf [ WIDTH*HEIGHT ]; @@ -26,7 +26,7 @@ int main( void ) hid_t file_id; herr_t status; hsize_t pal_dims[] = {PAL_ENTRIES,3}; - hsize_t i, j; + size_t i, j; int n, space; unsigned char pal[PAL_ENTRIES*3] = { /* create a palette with 9 colors */ 0,0,168, /* dark blue */ @@ -56,7 +56,7 @@ int main( void ) file_id = H5Fcreate( "ex_image1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); /* make the image */ - status = H5IMmake_image_8bit( file_id, "image1", WIDTH, HEIGHT, buf ); + status = H5IMmake_image_8bit( file_id, "image1", (hsize_t)WIDTH, (hsize_t)HEIGHT, buf ); /* make a palette */ status = H5IMmake_palette( file_id, "pallete", pal_dims, pal ); diff --git a/hl/examples/ex_lite2.c b/hl/examples/ex_lite2.c index 5919ef9..98f92c8 100644 --- a/hl/examples/ex_lite2.c +++ b/hl/examples/ex_lite2.c @@ -22,7 +22,7 @@ int main( void ) int data[6]; hsize_t dims[2]; herr_t status; - hsize_t i, j, nrow, n_values; + size_t i, j, nrow, n_values; /* open file from ex_lite1.c */ file_id = H5Fopen ("ex_lite1.h5", H5F_ACC_RDONLY, H5P_DEFAULT); @@ -34,8 +34,8 @@ int main( void ) status = H5LTget_dataset_info(file_id,"/dset",dims,NULL,NULL); /* print it by rows */ - n_values = dims[0] * dims[1]; - nrow = dims[1]; + n_values = (size_t)(dims[0] * dims[1]); + nrow = (size_t)dims[1]; for (i=0; i<n_values/nrow; i++ ) { for (j=0; j<nrow; j++) diff --git a/hl/test/test_image.c b/hl/test/test_image.c index c4182bb..c988160 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -96,7 +96,7 @@ static int test_simple(void) hsize_t pal_dims_out[2]; char interlace[20]; hssize_t npals; - hsize_t i, j; + size_t i, j; herr_t is_image; herr_t is_pal; unsigned char image_in1 [ WIDTH*HEIGHT ]; @@ -120,10 +120,10 @@ static int test_simple(void) /* create an image of 9 values divided evenly by the array */ space = WIDTH*HEIGHT / PAL_ENTRIES; - for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ ) + for (i=0, j=0, n=0; i < (size_t)(WIDTH*HEIGHT); i++, j++ ) { image_in1[i] = n; - if ( j > space ) + if ( j > (size_t)space ) { n++; j=0; @@ -131,7 +131,7 @@ static int test_simple(void) if (n>PAL_ENTRIES-1) n=0; } /* create an image 3 byte RGB image */ - for (i=0, j=0, n=0; i < WIDTH*HEIGHT*3; i++, j++) + for (i=0, j=0, n=0; i < (size_t)(WIDTH*HEIGHT*3); i++, j++) { image_in2[i] = n; if (j==3) @@ -185,7 +185,7 @@ static int test_simple(void) goto out; /* check */ - for (i = 0; i < height*width*planes; i++) + for (i = 0; i < (size_t)(height*width*planes); i++) { if ( image_in1[i] != image_out1[i] ) { @@ -223,7 +223,7 @@ static int test_simple(void) goto out; /* check */ - for (i = 0; i < height*width*planes; i++) + for (i = 0; i < (size_t)(height*width*planes); i++) { if ( image_in2[i] != image_out2[i] ) { diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 0848b43..fcc8a7b 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -157,6 +157,7 @@ test_table(hid_t fid, int do_write) hsize_t nfields; hsize_t rfields; hsize_t i, j; + size_t u; hsize_t start1; /* record to start reading from 1st table */ hsize_t start2; /* record to start writing in 2nd table */ @@ -580,8 +581,8 @@ test_table(hid_t fid, int do_write) * data= 0 1 2 3 4 5 6 7 *------------------------------------------------------------------------- */ - for( i=0; i<NRECORDS; i++) - wbufd[i] = wbuf[i]; + for( u=0; u<(size_t)NRECORDS; u++) + wbufd[u] = wbuf[u]; if (H5TBmake_table(TITLE,fid,"table3",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, @@ -617,8 +618,8 @@ test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ nrecords=rrecords; - for( i=0; i<nrecords; i++) - wbufd[i] = rbuf[i]; + for( u=0; u<(size_t)nrecords; u++) + wbufd[u] = rbuf[u]; /*------------------------------------------------------------------------- * Delete records, start at 0, delete 2 @@ -648,8 +649,8 @@ test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ nrecords=rrecords; - for( i=0; i<nrecords; i++) - wbufd[i] = rbuf[i]; + for( u=0; u<(size_t)nrecords; u++) + wbufd[u] = rbuf[u]; /*------------------------------------------------------------------------- * Delete records, start at 1, delete 1 @@ -679,8 +680,8 @@ test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ nrecords=rrecords; - for( i=0; i<nrecords; i++) - wbufd[i] = rbuf[i]; + for( u=0; u<(size_t)nrecords; u++) + wbufd[u] = rbuf[u]; /*------------------------------------------------------------------------- * Delete records, start at 0, delete 1 @@ -710,8 +711,8 @@ test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ nrecords=rrecords; - for( i=0; i<nrecords; i++) - wbufd[i] = rbuf[i]; + for( u=0; u<(size_t)nrecords; u++) + wbufd[u] = rbuf[u]; /* Read complete table */ if (H5TBread_table(fid,"table3",type_size_mem,field_offset,field_size,rbuf)<0) @@ -923,18 +924,18 @@ test_table(hid_t fid, int do_write) goto out; /* compare the read values with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - if ( i >= 2 && i <= 4 ) + if ( u >= 2 && u <= 4 ) { - if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati || - rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || - rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] ) + if ( rbuf[u].lati != position_in[u-(size_t)NRECORDS_ADD+1].lati || + rbuf[u].longi != position_in[u-(size_t)NRECORDS_ADD+1].longi || + rbuf[u].pressure != pressure_in[u-(size_t)NRECORDS_ADD+1] ) { fprintf(stderr,"%ld %f %d\n", - rbuf[i].longi,rbuf[i].pressure,rbuf[i].lati); + rbuf[u].longi,rbuf[u].pressure,rbuf[u].lati); fprintf(stderr,"%ld %f %d\n", - position_in[i].longi,pressure_in[i],position_in[i].lati); + position_in[u].longi,pressure_in[u],position_in[u].lati); goto out; } } @@ -980,9 +981,9 @@ test_table(hid_t fid, int do_write) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS_ADD; i++ ) + for( u = 0; u < (size_t)NRECORDS_ADD; u++ ) { - if ( pressure_out[i] != pressure_in[i] ) { + if ( pressure_out[u] != pressure_in[u] ) { goto out; } } @@ -1009,10 +1010,10 @@ test_table(hid_t fid, int do_write) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS_ADD; i++ ) + for( u = 0; u < (size_t)NRECORDS_ADD; u++ ) { - if ( position_out[i].lati != position_in[i].lati || - position_out[i].longi != position_in[i].longi ) + if ( position_out[u].lati != position_in[u].lati || + position_out[u].longi != position_in[u].longi ) goto out; } @@ -1040,18 +1041,18 @@ test_table(hid_t fid, int do_write) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || - namepre_out[i].pressure != namepre_in[i].pressure ) { + if ( ( strcmp( namepre_out[u].name, namepre_in[u].name ) != 0 ) || + namepre_out[u].pressure != namepre_in[u].pressure ) { goto out; } } /* reset buffer */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - strcpy( namepre_out[i].name, "\0" ); - namepre_out[i].pressure = -1; + strcpy( namepre_out[u].name, "\0" ); + namepre_out[u].pressure = -1; } /*------------------------------------------------------------------------- @@ -1066,10 +1067,10 @@ test_table(hid_t fid, int do_write) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < 3; i++ ) + for( u = 0; u < 3; u++ ) { - if ( ( strcmp( namepre_out[i].name, namepre_in[start+i].name ) != 0 ) || - namepre_out[i].pressure != namepre_in[start+i].pressure ) { + if ( ( strcmp( namepre_out[u].name, namepre_in[(size_t)start+u].name ) != 0 ) || + namepre_out[u].pressure != namepre_in[(size_t)start+u].pressure ) { goto out; } } @@ -1119,13 +1120,13 @@ test_table(hid_t fid, int do_write) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - if ( i >= 2 && i <= 4 ) + if ( u >= 2 && u <= 4 ) { - if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati || - rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || - rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] ) + if ( rbuf[u].lati != position_in[u-(size_t)NRECORDS_ADD+1].lati || + rbuf[u].longi != position_in[u-(size_t)NRECORDS_ADD+1].longi || + rbuf[u].pressure != pressure_in[u-(size_t)NRECORDS_ADD+1] ) goto out; } } @@ -1176,9 +1177,9 @@ test_table(hid_t fid, int do_write) goto out; /* compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - if ( pressure_out[i] != pressure_in[i] ) { + if ( pressure_out[u] != pressure_in[u] ) { goto out; } } @@ -1207,10 +1208,10 @@ test_table(hid_t fid, int do_write) goto out; /* compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS_ADD; i++ ) + for( u = 0; u < (size_t)NRECORDS_ADD; u++ ) { - if ( position_out[i].lati != position_in[i].lati || - position_out[i].longi != position_in[i].longi ) { + if ( position_out[u].lati != position_in[u].lati || + position_out[u].longi != position_in[u].longi ) { goto out; } } @@ -1241,19 +1242,19 @@ test_table(hid_t fid, int do_write) goto out; /* compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || - namepre_out[i].pressure != namepre_in[i].pressure ) { + if ( ( strcmp( namepre_out[u].name, namepre_in[u].name ) != 0 ) || + namepre_out[u].pressure != namepre_in[u].pressure ) { goto out; } } /* reset buffer */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - strcpy( namepre_out[i].name, "\0" ); - namepre_out[i].pressure = -1; + strcpy( namepre_out[u].name, "\0" ); + namepre_out[u].pressure = -1; } /*------------------------------------------------------------------------- @@ -1271,10 +1272,10 @@ test_table(hid_t fid, int do_write) goto out; /* compare the extracted table with the initial values */ - for( i = 0; i < 3; i++ ) + for( u = 0; u < 3; u++ ) { - if ( ( strcmp( namepre_out[i].name, wbuf[start+i].name ) != 0 ) || - namepre_out[i].pressure != wbuf[start+i].pressure ) { + if ( ( strcmp( namepre_out[u].name, wbuf[(size_t)start+u].name ) != 0 ) || + namepre_out[u].pressure != wbuf[(size_t)start+u].pressure ) { goto out; } } @@ -1312,14 +1313,14 @@ test_table(hid_t fid, int do_write) goto out; /* compare the extracted table with the original array */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - if ( ( strcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || - rbuf2[i].lati != wbuf[i].lati || - rbuf2[i].longi != wbuf[i].longi || - rbuf2[i].pressure != wbuf[i].pressure || - rbuf2[i].temperature != wbuf[i].temperature || - rbuf2[i].new_field != buf_new[i] ) { + if ( ( strcmp( rbuf2[u].name, wbuf[u].name ) != 0 ) || + rbuf2[u].lati != wbuf[u].lati || + rbuf2[u].longi != wbuf[u].longi || + rbuf2[u].pressure != wbuf[u].pressure || + rbuf2[u].temperature != wbuf[u].temperature || + rbuf2[u].new_field != buf_new[u] ) { goto out; } } @@ -1355,12 +1356,12 @@ test_table(hid_t fid, int do_write) goto out; /* compare the extracted table with the original array */ - for( i = 0; i < NRECORDS; i++ ) + for( u = 0; u < (size_t)NRECORDS; u++ ) { - if ( ( strcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || - rbuf3[i].lati != wbuf[i].lati || - rbuf3[i].longi != wbuf[i].longi || - rbuf3[i].temperature != wbuf[i].temperature ) { + if ( ( strcmp( rbuf3[u].name, wbuf[u].name ) != 0 ) || + rbuf3[u].lati != wbuf[u].lati || + rbuf3[u].longi != wbuf[u].longi || + rbuf3[u].temperature != wbuf[u].temperature ) { goto out; } } @@ -1403,26 +1404,26 @@ test_table(hid_t fid, int do_write) /* alocate */ names_out = malloc( sizeof(char*) * (size_t)NFIELDS ); - for ( i = 0; i < NFIELDS; i++) + for ( u = 0; u < (size_t)NFIELDS; u++) { - names_out[i] = malloc( sizeof(char) * 255 ); + names_out[u] = malloc( sizeof(char) * 255 ); } /* Get field info */ if ( H5TBget_field_info(fid, "table1", names_out, sizes_out, offset_out, &size_out ) < 0 ) goto out; - for ( i = 0; i < NFIELDS; i++) + for ( u = 0; u < (size_t)NFIELDS; u++) { - if ( (strcmp( field_names[i], names_out[i] ) != 0)) { + if ( (strcmp( field_names[u], names_out[u] ) != 0)) { goto out; } } /* release */ - for ( i = 0; i < NFIELDS; i++) + for ( u = 0; u < (size_t)NFIELDS; u++) { - free ( names_out[i] ); + free ( names_out[u] ); } free ( names_out ); @@ -1549,8 +1550,9 @@ static hid_t h5file_open(const char *fname, unsigned flags) * function that compares one particle *------------------------------------------------------------------------- */ -static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ) +static int cmp_par(hsize_t _i, hsize_t _j, particle_t *rbuf, particle_t *wbuf ) { + size_t i = (size_t)_i, j = (size_t)_j; if ( ( strcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 98317b2..94b3699 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -365,7 +365,8 @@ H5V_log2_gen(uint64_t n) if((tt = (unsigned)(n >> 16))) r = (t = (unsigned)(n >> 24)) ? 24 + LogTable256[t] : 16 + LogTable256[tt & 0xFF]; else - r = (t = (unsigned)(n >> 8)) ? 8 + LogTable256[t] : LogTable256[n]; + /* Added 'uint8_t' cast to pacify PGCC compiler */ + r = (t = (unsigned)(n >> 8)) ? 8 + LogTable256[t] : LogTable256[(uint8_t)n]; #ifdef H5_BAD_LOG2_CODE_GENERATED } /* end else */ #endif /* H5_BAD_LOG2_CODE_GENERATED */ diff --git a/test/dsets.c b/test/dsets.c index 794f9c2..1d055d2 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1312,7 +1312,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ void *tconv_buf = NULL; /* Temporary conversion buffer */ - hsize_t i, j, n; /* Local index variables */ + size_t i, j, n; /* Local index variables */ herr_t status; /* Error status */ /* Create the data space */ @@ -1357,8 +1357,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if (H5Dread (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) goto error; - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if (0!=check[i][j]) { H5_FAILED(); printf(" Read a non-zero value.\n"); @@ -1557,9 +1557,9 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, */ TESTING(" filters (partial I/O)"); - for (i=0; i<hs_size[0]; i++) { - for (j=0; j<hs_size[1]; j++) { - points[hs_offset[0]+i][hs_offset[1]+j] = (int)HDrandom(); + for (i=0; i<(size_t)hs_size[0]; i++) { + for (j=0; j<(size_t)hs_size[1]; j++) { + points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom(); } } if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, @@ -1593,19 +1593,19 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i=0; i<hs_size[0]; i++) { - for (j=0; j<hs_size[1]; j++) { - if (points[hs_offset[0]+i][hs_offset[1]+j] != - check[hs_offset[0]+i][hs_offset[1]+j]) { + for (i=0; i<(size_t)hs_size[0]; i++) { + for (j=0; j<(size_t)hs_size[1]; j++) { + if (points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] != + check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) { H5_FAILED(); fprintf(stderr," Read different values than written.\n"); fprintf(stderr," At index %lu,%lu\n", - (unsigned long)(hs_offset[0]+i), - (unsigned long)(hs_offset[1]+j)); + (unsigned long)((size_t)hs_offset[0]+i), + (unsigned long)((size_t)hs_offset[1]+j)); fprintf(stderr," At original: %d\n", - (int)points[hs_offset[0]+i][hs_offset[1]+j]); + (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]); fprintf(stderr," At returned: %d\n", - (int)check[hs_offset[0]+i][hs_offset[1]+j]); + (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]); goto error; } } @@ -2166,7 +2166,7 @@ test_missing_filter(hid_t file) const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */ hsize_t dset_size; /* Dataset size */ - hsize_t i,j; /* Local index variables */ + size_t i,j; /* Local index variables */ herr_t ret; /* Generic return value */ char testfile[512]=""; /* Buffer to hold name of existing test file */ char *srcdir = HDgetenv("srcdir"); /* The source directory, if we are using the --srcdir configure option */ @@ -2278,8 +2278,8 @@ test_missing_filter(hid_t file) /* Compare data */ /* Check that the values read are the same as the values written */ - for (i=0; i<dims[0]; i++) { - for (j=0; j<dims[1]; j++) { + for (i=0; i<(size_t)dims[0]; i++) { + for (j=0; j<(size_t)dims[1]; j++) { if (points[i][j] != check[i][j]) { H5_FAILED(); printf(" Line %d: Read different values than written.\n",__LINE__); @@ -2418,7 +2418,7 @@ test_onebyte_shuffle(hid_t file) const hsize_t chunk_size[2] = {10, 20}; unsigned char orig_data[10][20]; unsigned char new_data[10][20]; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_SHUFFLE */ const char *not_supported= " Data shuffling is not enabled."; #endif /* H5_HAVE_FILTER_SHUFFLE */ @@ -2479,8 +2479,8 @@ test_onebyte_shuffle(hid_t file) goto error; /* Check that the values read are the same as the values written */ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if (new_data[i][j] != orig_data[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -2538,7 +2538,7 @@ test_nbit_int(hid_t file) int new_data[2][5]; unsigned int mask; size_t precision, offset; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ @@ -2572,8 +2572,8 @@ test_nbit_int(hid_t file) space,dc))<0) goto error; /* Initialize data, assuming size of long_long >= size of int */ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { + for (i= 0;i< (size_t)size[0]; i++) + for (j = 0; j < (size_t)size[1]; j++) { orig_data[i][j] = (int)(((long_long)HDrandom() % (long_long)HDpow(2.0, (double)(precision - 1))) << offset); @@ -2621,8 +2621,8 @@ test_nbit_int(hid_t file) * Use mask for checking the significant bits, ignoring the padding bits */ mask = ~(~0 << (precision + offset)) & (~0 << offset); - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if ((new_data[i][j] & mask) != (orig_data[i][j] & mask)) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -2683,7 +2683,7 @@ test_nbit_float(hid_t file) (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}}; float new_data[2][5]; size_t precision, offset; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ @@ -2750,8 +2750,8 @@ test_nbit_float(hid_t file) /* Check that the values read are the same as the values written * Assume size of int = size of float */ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if (!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */ if (new_data[i][j] != orig_data[i][j]) { H5_FAILED(); @@ -2816,7 +2816,7 @@ test_nbit_double(hid_t file) 6.6562295504670740e-3, -1.5747263393432150, 1.0711093225222612, -9.8971679387636870e-1}}; double new_data[2][5]; size_t precision, offset; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ @@ -2883,8 +2883,8 @@ test_nbit_double(hid_t file) /* Check that the values read are the same as the values written * Assume size of long_long = size of double */ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if (!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */ if (new_data[i][j] != orig_data[i][j]) { H5_FAILED(); @@ -2945,7 +2945,7 @@ test_nbit_array(hid_t file) unsigned int orig_data[2][5][3][2]; unsigned int new_data[2][5][3][2]; size_t precision, offset; - hsize_t i, j, m, n; + size_t i, j, m, n; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ @@ -2984,10 +2984,10 @@ test_nbit_array(hid_t file) space,dc))<0) goto error; /* Initialize data, assuming size of long_long >= size of unsigned int */ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) - for (m = 0; m < adims[0]; m++) - for (n = 0; n < adims[1]; n++) + for (i= 0;i< (size_t)size[0]; i++) + for (j = 0; j < (size_t)size[1]; j++) + for (m = 0; m < (size_t)adims[0]; m++) + for (n = 0; n < (size_t)adims[1]; n++) orig_data[i][j][m][n] = (unsigned int)(((long_long)HDrandom() % (long_long)HDpow(2.0, (double)precision)) << offset); PASSED(); @@ -3028,10 +3028,10 @@ test_nbit_array(hid_t file) /* Check that the values read are the same as the values written */ - for (i=0; i<size[0]; i++) - for (j=0; j<size[1]; j++) - for (m = 0; m < adims[0]; m++) - for (n = 0; n < adims[1]; n++) { + for (i=0; i<(size_t)size[0]; i++) + for (j=0; j<(size_t)size[1]; j++) + for (m = 0; m < (size_t)adims[0]; m++) + for (n = 0; n < (size_t)adims[1]; n++) { if (new_data[i][j][m][n]!= orig_data[i][j][m][n]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -3104,7 +3104,7 @@ test_nbit_compound(hid_t file) atomic orig_data[2][5]; atomic new_data[2][5]; unsigned int i_mask, s_mask, c_mask; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; @@ -3166,8 +3166,8 @@ test_nbit_compound(hid_t file) space,dc))<0) goto error; /* Initialize data, assuming size of long_long >= size of member datatypes */ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { + for (i= 0;i< (size_t)size[0]; i++) + for (j = 0; j < (size_t)size[1]; j++) { orig_data[i][j].i = (int)(((long_long)HDrandom() % (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].c = (char)(((long_long)HDrandom() % @@ -3319,7 +3319,7 @@ test_nbit_compound_2(hid_t file) complex orig_data[2][5]; complex new_data[2][5]; unsigned int i_mask, s_mask, c_mask, b_mask; - hsize_t i, j, m, n, b_failed, d_failed; + size_t i, j, m, n, b_failed, d_failed; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; @@ -3413,8 +3413,8 @@ test_nbit_compound_2(hid_t file) space,dc))<0) goto error; /* Initialize data, assuming size of long_long >= size of member datatypes */ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { + for (i= 0;i< (size_t)size[0]; i++) + for (j = 0; j < (size_t)size[1]; j++) { orig_data[i][j].a.i = (int)(((long_long)HDrandom() % (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].a.c = (char)(((long_long)HDrandom() % @@ -3426,13 +3426,13 @@ test_nbit_compound_2(hid_t file) orig_data[i][j].v = (unsigned int)(((long_long)HDrandom() % (long_long)HDpow(2.0, (double)precision[3])) << offset[3]); - for(m = 0; m < array_dims[0]; m++) - for(n = 0; n < array_dims[1]; n++) + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) orig_data[i][j].b[m][n] = (char)(((long_long)HDrandom() % (long_long)HDpow(2.0, (double)(precision[4]-1))) << offset[4]); - for(m = 0; m < array_dims[0]; m++) - for(n = 0; n < array_dims[1]; n++) { + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) { orig_data[i][j].d[m][n].i = (int)(-((long_long)HDrandom() % (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].d[m][n].c = (char)(((long_long)HDrandom() % @@ -3485,20 +3485,20 @@ test_nbit_compound_2(hid_t file) c_mask = ~(~0 << (precision[1] + offset[1])) & (~0 << offset[1]); s_mask = ~(~0 << (precision[2] + offset[2])) & (~0 << offset[2]); b_mask = ~(~0 << (precision[4] + offset[4])) & (~0 << offset[4]); - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { b_failed = 0; d_failed = 0; - for(m = 0; m < array_dims[0]; m++) - for(n = 0; n < array_dims[1]; n++) + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) if((new_data[i][j].b[m][n]&b_mask)!=(orig_data[i][j].b[m][n]&b_mask)) { b_failed = 1; goto out; } - for(m = 0; m < array_dims[0]; m++) - for(n = 0; n < array_dims[1]; n++) + for(m = 0; m < (size_t)array_dims[0]; m++) + for(n = 0; n < (size_t)array_dims[1]; n++) if((new_data[i][j].d[m][n].i & i_mask)!=(orig_data[i][j].d[m][n].i & i_mask)|| (new_data[i][j].d[m][n].c & c_mask)!=(orig_data[i][j].d[m][n].c & c_mask)|| (new_data[i][j].d[m][n].s & s_mask)!=(orig_data[i][j].d[m][n].s & s_mask)|| @@ -3591,7 +3591,7 @@ test_nbit_compound_3(hid_t file) const hsize_t chunk_size[1] = {5}; atomic orig_data[5]; atomic new_data[5]; - hsize_t i, k, j; + size_t i, k, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; @@ -3641,7 +3641,7 @@ test_nbit_compound_3(hid_t file) space, H5P_DEFAULT))<0) goto error; /* Initialize data */ - for(i = 0; i < size[0]; i++) { + for(i = 0; i < (size_t)size[0]; i++) { orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0); HDstrcpy(orig_data[i].str, "fixed-length C string"); orig_data[i].vl_str = HDstrdup("variable-length C string"); @@ -3692,7 +3692,7 @@ test_nbit_compound_3(hid_t file) goto error; /* Check that the values read are the same as the values written */ - for (i = 0; i < size[0]; i++) { + for (i = 0; i < (size_t)size[0]; i++) { if(new_data[i].i != orig_data[i].i || strcmp(new_data[i].str, orig_data[i].str) !=0 || strcmp(new_data[i].vl_str, orig_data[i].vl_str) !=0 || @@ -3779,7 +3779,7 @@ test_scaleoffset_int(hid_t file) const hsize_t chunk_size[2] = {2,5}; int orig_data[2][5]; int new_data[2][5]; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_SCALEOFFSET */ const char *not_supported= " Scaleoffset is not enabled."; #endif /* H5_HAVE_FILTER_SCALEOFFSET */ @@ -3810,8 +3810,8 @@ test_scaleoffset_int(hid_t file) space,dc))<0) goto error; /* Initialize data */ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { + for (i= 0;i< (size_t)size[0]; i++) + for (j = 0; j < (size_t)size[1]; j++) { orig_data[i][j] = HDrandom() % 10000; /* even-numbered values are negtive */ @@ -3853,8 +3853,8 @@ test_scaleoffset_int(hid_t file) new_data)<0) goto error; /* Check that the values read are the same as the values written */ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if (new_data[i][j] != orig_data[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -3915,7 +3915,7 @@ test_scaleoffset_int_2(hid_t file) hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ int fillval; - hsize_t j; + size_t j; #else /* H5_HAVE_FILTER_SCALEOFFSET */ const char *not_supported= " Scaleoffset is not enabled."; #endif /* H5_HAVE_FILTER_SCALEOFFSET */ @@ -3959,7 +3959,7 @@ test_scaleoffset_int_2(hid_t file) stride, count, block)<0) goto error; /* Initialize data of hyperslab */ - for (j = 0; j < size[1]; j++) { + for (j = 0; j < (size_t)size[1]; j++) { orig_data[0][j] = (int)HDrandom() % 10000; /* even-numbered values are negtive */ @@ -4002,7 +4002,7 @@ test_scaleoffset_int_2(hid_t file) new_data)<0) goto error; /* Check that the values read are the same as the values written */ - for (j=0; j<size[1]; j++) { + for (j=0; j<(size_t)size[1]; j++) { if (new_data[0][j] != orig_data[0][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -4057,7 +4057,7 @@ test_scaleoffset_float(hid_t file) const hsize_t chunk_size[2] = {2,5}; float orig_data[2][5]; float new_data[2][5]; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_SCALEOFFSET */ const char *not_supported= " Scaleoffset is not enabled."; #endif /* H5_HAVE_FILTER_SCALEOFFSET */ @@ -4089,8 +4089,8 @@ test_scaleoffset_float(hid_t file) space,dc))<0) goto error; /* Initialize data */ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { + for (i= 0;i< (size_t)size[0]; i++) + for (j = 0; j < (size_t)size[1]; j++) { orig_data[i][j] = (float)((HDrandom() % 100000) / (float)1000.0); /* even-numbered values are negtive */ @@ -4132,8 +4132,8 @@ test_scaleoffset_float(hid_t file) new_data)<0) goto error; /* Check that the values read are the same as the values written */ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -4194,7 +4194,7 @@ test_scaleoffset_float_2(hid_t file) hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - hsize_t j; + size_t j; #else /* H5_HAVE_FILTER_SCALEOFFSET */ const char *not_supported= " Scaleoffset is not enabled."; #endif /* H5_HAVE_FILTER_SCALEOFFSET */ @@ -4240,7 +4240,7 @@ test_scaleoffset_float_2(hid_t file) stride, count, block)<0) goto error; /* Initialize data of hyperslab */ - for (j = 0; j < size[1]; j++) { + for (j = 0; j < (size_t)size[1]; j++) { orig_data[0][j] = (float)((HDrandom() % 100000) / (float)1000.0); /* even-numbered values are negtive */ @@ -4283,7 +4283,7 @@ test_scaleoffset_float_2(hid_t file) new_data)<0) goto error; /* Check that the values read are the same as the values written */ - for (j=0; j<size[1]; j++) { + for (j=0; j<(size_t)size[1]; j++) { if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -3.0)) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -4337,7 +4337,7 @@ test_scaleoffset_double(hid_t file) const hsize_t chunk_size[2] = {2,5}; double orig_data[2][5]; double new_data[2][5]; - hsize_t i, j; + size_t i, j; #else /* H5_HAVE_FILTER_SCALEOFFSET */ const char *not_supported= " Scaleoffset is not enabled."; #endif /* H5_HAVE_FILTER_SCALEOFFSET */ @@ -4369,8 +4369,8 @@ test_scaleoffset_double(hid_t file) space,dc))<0) goto error; /* Initialize data */ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { + for (i= 0;i< (size_t)size[0]; i++) + for (j = 0; j < (size_t)size[1]; j++) { orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0; /* even-numbered values are negtive */ @@ -4412,8 +4412,8 @@ test_scaleoffset_double(hid_t file) new_data)<0) goto error; /* Check that the values read are the same as the values written */ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { + for (i=0; i<(size_t)size[0]; i++) { + for (j=0; j<(size_t)size[1]; j++) { if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -4474,7 +4474,7 @@ test_scaleoffset_double_2(hid_t file) hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - hsize_t j; + size_t j; #else /* H5_HAVE_FILTER_SCALEOFFSET */ const char *not_supported= " Scaleoffset is not enabled."; #endif /* H5_HAVE_FILTER_SCALEOFFSET */ @@ -4520,7 +4520,7 @@ test_scaleoffset_double_2(hid_t file) stride, count, block)<0) goto error; /* Initialize data of hyperslab */ - for (j = 0; j < size[1]; j++) { + for (j = 0; j < (size_t)size[1]; j++) { orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0; /* even-numbered values are negtive */ @@ -4563,7 +4563,7 @@ test_scaleoffset_double_2(hid_t file) new_data)<0) goto error; /* Check that the values read are the same as the values written */ - for (j=0; j<size[1]; j++) { + for (j=0; j<(size_t)size[1]; j++) { if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -7.0)) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -4794,7 +4794,7 @@ test_can_apply(hid_t file) const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */ hsize_t dset_size; /* Dataset size */ - hsize_t i,j; /* Local index variables */ + size_t i,j; /* Local index variables */ TESTING("dataset filter 'can apply' callback"); @@ -4883,8 +4883,8 @@ test_can_apply(hid_t file) /* Compare data */ /* Check that the values read are the same as the values written */ - for (i=0; i<dims[0]; i++) { - for (j=0; j<dims[1]; j++) { + for (i=0; i<(size_t)dims[0]; i++) { + for (j=0; j<(size_t)dims[1]; j++) { if (points[i][j] != check[i][j]) { H5_FAILED(); printf(" Line %d: Read different values than written.\n",__LINE__); @@ -5156,7 +5156,7 @@ test_set_local(hid_t fapl) const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */ hsize_t dset_size; /* Dataset size */ unsigned cd_values[2]={BOGUS2_PARAM_1, BOGUS2_PARAM_2}; /* Parameters for Bogus2 filter */ - hsize_t i,j; /* Local index variables */ + size_t i,j; /* Local index variables */ double n; /* Local index variables */ TESTING("dataset filter 'set local' callback"); diff --git a/test/dtypes.c b/test/dtypes.c index e32a0a9..75dde75 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2589,7 +2589,7 @@ test_named (hid_t fapl) hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, t3=-1, attr1=-1; herr_t status; static hsize_t ds_size[2] = {10, 20}; - hsize_t i,j; + size_t i,j; unsigned attr_data[10][20]; char filename[1024]; @@ -2645,8 +2645,8 @@ test_named (hid_t fapl) /* It should be possible to define an attribute for the named type */ if ((attr1=H5Acreate (type, "attr1", H5T_NATIVE_UCHAR, space, H5P_DEFAULT))<0) goto error; - for (i=0; i<ds_size[0]; i++) - for (j=0; j<ds_size[1]; j++) + for (i=0; i<(size_t)ds_size[0]; i++) + for (j=0; j<(size_t)ds_size[1]; j++) attr_data[i][j] = (int)(i*ds_size[1]+j); if (H5Awrite(attr1, H5T_NATIVE_UINT, attr_data)<0) goto error; if (H5Aclose (attr1)<0) goto error; diff --git a/test/enum.c b/test/enum.c index b565cb0..ae746c4 100644 --- a/test/enum.c +++ b/test/enum.c @@ -133,7 +133,8 @@ test_noconv(hid_t file) E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE, E1_RED, E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE}; c_e1 data2[NELMTS(data1)]; - hsize_t i, ds_size[1]={NELMTS(data1)}; + hsize_t ds_size[1]={NELMTS(data1)}; + size_t i; TESTING("no-conversion datasets"); if ((cwg=H5Gcreate(file, "test_noconv", 0))<0) goto error; @@ -151,7 +152,7 @@ test_noconv(hid_t file) if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1)<0) goto error; if (H5Dread(dset, type, space, space, H5P_DEFAULT, data2)<0) goto error; - for (i=0; i<ds_size[0]; i++) { + for (i=0; i<(size_t)ds_size[0]; i++) { if (data1[i]!=data2[i]) { H5_FAILED(); printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", @@ -202,7 +203,8 @@ static int test_tr1(hid_t file) { hid_t cwg=-1, m_type=-1, f_type=-1, space=-1, dset=-1; - hsize_t i, ds_size[1]={10}; + hsize_t ds_size[1]={10}; + size_t i; c_e1 eval; int ival; static c_e1 data1[10]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, @@ -238,7 +240,7 @@ test_tr1(hid_t file) if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1)<0) goto error; if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2)<0) goto error; - for (i=0; i<ds_size[0]; i++) { + for (i=0; i<(size_t)ds_size[0]; i++) { if (data1[i]!=data2[i]) { H5_FAILED(); printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", @@ -293,7 +295,8 @@ static int test_tr2(hid_t file) { hid_t cwg=-1, m_type=-1, f_type=-1, space=-1, dset=-1; - hsize_t i, ds_size[1]={10}; + hsize_t ds_size[1]={10}; + size_t i; c_e1 val1; int val2; static c_e1 data1[10]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, @@ -328,7 +331,7 @@ test_tr2(hid_t file) if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1)<0) goto error; if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2)<0) goto error; - for (i=0; i<ds_size[0]; i++) { + for (i=0; i<(size_t)ds_size[0]; i++) { if (data1[i]!=data2[i]) { H5_FAILED(); printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", diff --git a/test/external.c b/test/external.c index e46f5e3..db57afb 100644 --- a/test/external.c +++ b/test/external.c @@ -588,7 +588,7 @@ test_2 (hid_t fapl) hid_t dset=-1; /*dataset */ hid_t grp=-1; /*group to emit diagnostics */ int fd; /*external file descriptors */ - hsize_t i, j; /*miscellaneous counters */ + size_t i, j; /*miscellaneous counters */ hssize_t n; /*bytes of I/O */ char filename[1024]; /*file names */ int part[25], whole[100]; /*raw data buffers */ diff --git a/test/flush1.c b/test/flush1.c index 2086e3f..5f8eefc 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -56,7 +56,7 @@ create_file(char* name, hid_t fapl) hid_t file, dcpl, space, dset, groups, grp; hsize_t ds_size[2] = {100, 100}; hsize_t ch_size[2] = {5, 5}; - hsize_t i, j; + size_t i, j; if ((file=H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) goto error; @@ -74,7 +74,7 @@ create_file(char* name, hid_t fapl) * for the Win32 version 5.0 compiler. * 1998-11-06 ptl */ - for (j=0; j<ds_size[1]; j++) { + for (j=0; j<(size_t)ds_size[1]; j++) { the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1); } } @@ -119,7 +119,7 @@ extend_file(hid_t file) hid_t dcpl, space, dset; hsize_t ds_size[2] = {100, 100}; hsize_t ch_size[2] = {5, 5}; - hsize_t i, j; + size_t i, j; /* Create a chunked dataset */ if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; @@ -135,7 +135,7 @@ extend_file(hid_t file) * for the Win32 version 5.0 compiler. * 1998-11-06 ptl */ - for (j=0; j<ds_size[1]; j++) { + for (j=0; j<(size_t)ds_size[1]; j++) { the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1); } } diff --git a/test/flush2.c b/test/flush2.c index f0b760e..2b8cf7a 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -54,7 +54,7 @@ check_dset(hid_t file, const char* name) hid_t space, dset; hsize_t ds_size[2] = {100, 100}; double error; - hsize_t i, j; + size_t i, j; /* Open the dataset */ if ((dset=H5Dopen(file, name))<0) goto error; @@ -65,8 +65,8 @@ check_dset(hid_t file, const char* name) /* Read some data */ if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data)<0) goto error; - for (i=0; i<ds_size[0]; i++) { - for (j=0; j<ds_size[1]; j++) { + for (i=0; i<(size_t)ds_size[0]; i++) { + for (j=0; j<(size_t)ds_size[1]; j++) { /* * The extra cast in the following statement is a bug workaround * for the Win32 version 5.0 compiler. diff --git a/test/istore.c b/test/istore.c index 3c066aa..8764643 100644 --- a/test/istore.c +++ b/test/istore.c @@ -225,7 +225,7 @@ test_extend(hid_t f, const char *prefix, hid_t dataset; /* Dataset ID */ hid_t fspace; /* Dataset's file dataspace */ hid_t mspace; /* Dataset's memory dataspace */ - hsize_t i, j, k, ctr; + size_t i, j, k, ctr; int ndims; uint8_t *buf = NULL, *check = NULL, *whole = NULL; char dims[64], s[256], name[256]; diff --git a/test/tsohm.c b/test/tsohm.c index d0c0629..010311f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -971,7 +971,7 @@ static void sohm_attr_helper(hid_t fcpl_id) int wdata[2] = {7, 42}; int rdata[2]; herr_t ret; - hsize_t x; + size_t x; /* Create a file using the fcpl */ file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); @@ -1005,7 +1005,7 @@ static void sohm_attr_helper(hid_t fcpl_id) memset(rdata, 0, sizeof(rdata)); ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata); CHECK_I(ret, "H5Aread"); - for(x=0; x<dims; ++x) { + for(x=0; x<(size_t)dims; ++x) { VERIFY(rdata[x], wdata[x], "H5Aread"); } @@ -1041,7 +1041,7 @@ static void sohm_attr_helper(hid_t fcpl_id) memset(rdata, 0, sizeof(rdata)); ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata); CHECK_I(ret, "H5Aread"); - for(x=0; x<dims; ++x) { + for(x=0; x<(size_t)dims; ++x) { VERIFY(rdata[x], wdata[x], "H5Aread"); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 322fb27..8f04e76 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -735,7 +735,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset { herr_t ret; /* the value to return */ hid_t f_space; /* file data space */ - hsize_t i, j, n; /* counters */ + size_t i; /* counters */ + size_t j; /* counters */ + hsize_t n; /* counters */ hsize_t zero = 0; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ @@ -780,7 +782,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset /* assume entire data space to be printed */ if (ctx.ndims > 0) - for (i = 0; i < ctx.ndims; i++) + for (i = 0; i < (size_t)ctx.ndims; i++) ctx.p_min_idx[i] = 0; H5Sget_simple_extent_dims(f_space, total_size, NULL); @@ -794,7 +796,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset /* get the offset count */ outer_count = 1; if (ctx.ndims > 2) - for (i = 0; i < ctx.ndims - 2; i++) + for (i = 0; i < (size_t)ctx.ndims - 2; i++) outer_count *= sset->count[ i ]; if(ctx.ndims>0) @@ -802,7 +804,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset /* initialize temporary start, count and maximum start */ - for (i = 0; i < ctx.ndims; i++) + for (i = 0; i < (size_t)ctx.ndims; i++) { temp_start[ i ] = sset->start[ i ]; temp_count[ i ] = sset->count[ i ]; @@ -811,7 +813,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset } if (ctx.ndims > 2) { - for (i = 0; i < ctx.ndims - 2; i++) + for (i = 0; i < (size_t)ctx.ndims - 2; i++) { max_start[ i ] = temp_start[ i ] + sset->count[ i ]; temp_count[ i ] = 1; @@ -896,10 +898,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset the element position at the start of hyperslab */ H5Sget_select_bounds(f_space,low,high); elmtno=0; - for (i = 0; i < ctx.ndims-1; i++) + for (i = 0; i < (size_t)ctx.ndims-1; i++) { hsize_t offset = 1; /* accumulation of the previous dimensions */ - for (j = i+1; j < ctx.ndims; j++) + for (j = i+1; j < (size_t)ctx.ndims; j++) offset *= total_size[j]; elmtno+= low[i] * offset; } @@ -989,7 +991,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, { hid_t f_space; /* file data space */ hsize_t elmtno; /* counter */ - hsize_t i; /* counter */ + size_t i; /* counter */ int carry; /* counter carry value */ hsize_t zero[8]; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ @@ -1037,7 +1039,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, /* Assume entire data space to be printed */ if (ctx.ndims > 0) - for (i = 0; i < ctx.ndims; i++) + for (i = 0; i < (size_t)ctx.ndims; i++) ctx.p_min_idx[i] = 0; H5Sget_simple_extent_dims(f_space, total_size, NULL); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index b4c5cc3..57758a1 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -312,7 +312,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t max_idx[], h5tools_context_t *ctx) { hsize_t p_prod[H5S_MAX_RANK]; - hsize_t i = 0; + size_t i = 0; hsize_t curr_pos=elmtno; h5tools_str_reset(str); @@ -325,7 +325,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, for (i = ndims - 1, p_prod[ndims - 1] = 1; i > 0; --i) p_prod[i - 1] = (max_idx[i] - min_idx[i]) * p_prod[i]; - for ( i = 0; i < (hsize_t)ndims; i++) + for ( i = 0; i < (size_t)ndims; i++) { ctx->pos[i] = curr_pos/ctx->acc[i]; curr_pos -= ctx->acc[i]*ctx->pos[i]; @@ -333,7 +333,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, assert( curr_pos == 0 ); /* Print the index values */ - for (i = 0; i < (hsize_t)ndims; i++) { + for (i = 0; i < (size_t)ndims; i++) { if (i) h5tools_str_append(str, "%s", OPT(info->idx_sep, ",")); |