diff options
-rw-r--r-- | hl/src/H5LT.c | 4 | ||||
-rw-r--r-- | hl/test/test_dset_append.c | 2 | ||||
-rw-r--r-- | src/H5FSpkg.h | 16 | ||||
-rw-r--r-- | src/H5PL.c | 2 | ||||
-rw-r--r-- | test/bittests.c | 64 | ||||
-rw-r--r-- | test/dtypes.c | 16 | ||||
-rw-r--r-- | test/error_test.c | 10 | ||||
-rw-r--r-- | test/fheap.c | 12 | ||||
-rw-r--r-- | test/fillval.c | 44 | ||||
-rw-r--r-- | test/flush1.c | 28 | ||||
-rw-r--r-- | test/flush2.c | 15 | ||||
-rw-r--r-- | test/gheap.c | 68 | ||||
-rw-r--r-- | test/hyperslab.c | 20 | ||||
-rw-r--r-- | test/tchecksum.c | 4 | ||||
-rw-r--r-- | test/tfile.c | 19 | ||||
-rw-r--r-- | test/th5o.c | 34 | ||||
-rw-r--r-- | test/titerate.c | 14 | ||||
-rw-r--r-- | test/trefer.c | 28 | ||||
-rw-r--r-- | test/ttst.c | 2 | ||||
-rw-r--r-- | test/tunicode.c | 38 | ||||
-rw-r--r-- | tools/h5diff/h5diff_common.c | 9 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 20 | ||||
-rw-r--r-- | tools/h5import/h5importtest.c | 16 | ||||
-rw-r--r-- | tools/h5jam/h5jamgentest.c | 4 | ||||
-rw-r--r-- | tools/lib/io_timer.c | 4 | ||||
-rw-r--r-- | tools/misc/h5repart.c | 18 | ||||
-rw-r--r-- | tools/misc/h5repart_gentest.c | 3 | ||||
-rw-r--r-- | tools/perform/chunk.c | 18 | ||||
-rw-r--r-- | tools/perform/iopipe.c | 18 | ||||
-rw-r--r-- | tools/perform/overhead.c | 19 | ||||
-rw-r--r-- | tools/perform/sio_engine.c | 112 |
31 files changed, 331 insertions, 350 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 107e238..b7e0b4a 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -894,8 +894,8 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) /* set allocation increment to a percentage of the supplied buffer size, or * a pre-defined minimum increment value, whichever is larger */ - if ((buf_prcnt * buf_size) > min_incr) - alloc_incr = (size_t)(buf_prcnt * buf_size); + if ((size_t)(buf_prcnt * (double)buf_size) > min_incr) + alloc_incr = (size_t)(buf_prcnt * (double)buf_size); else alloc_incr = min_incr; diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 62e86cb..a5c9abc 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -56,14 +56,12 @@ test_dataset_append_notset(hid_t fid) hid_t did = -1; /* Dataset ID */ hid_t sid = -1; /* Dataspace ID */ hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ hid_t ffapl = -1; /* The file's file access property list */ hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */ hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ int lbuf[10]; /* The data buffers */ - hsize_t file_size; /* File size */ int i, j; /* Local index variables */ h5_stat_t sb1, sb2; /* File info */ diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 54029cc..7e52b5f 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -65,18 +65,18 @@ \ /* Free space header specific fields */ \ + 1 /* Client ID */ \ - + H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \ - + H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \ - + H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \ - + H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Total free space tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Total # of sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* # of serializable sections tracked */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* # of ghost sections tracked */ \ + 2 /* Number of section classes */ \ + 2 /* Shrink percent */ \ + 2 /* Expand percent */ \ + 2 /* Size of address space for sections (log2 of value) */ \ - + H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \ - + H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \ - + H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \ - + H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Max. size of section to track */ \ + + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of serialized free space sections */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Size of serialized free space sections used */ \ + + (unsigned)H5F_SIZEOF_SIZE(f) /* Allocated size of serialized free space sections */ \ ) /* Size of the free space serialized sections on disk */ @@ -433,7 +433,7 @@ H5PL__init_path_table(void) dl_path = (char *)H5MM_xfree(dl_path); dl_path = H5MM_strdup(tempbuf); } -#endif H5_HAVE_WIN32_API +#endif /* H5_HAVE_WIN32_API */ /* Put paths in the path table. They are separated by ":" */ dir = HDstrtok(dl_path, H5PL_PATH_SEPARATOR); diff --git a/test/bittests.c b/test/bittests.c index c4dfe4c..38e419d 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -88,7 +88,7 @@ test_find (void) /* Try all combinations of one byte */ for(i = 0; i < 8 * (int)sizeof(v1); i++) { HDmemset(v1, 0, sizeof v1); - v1[i / 8] = 1 << (i % 8); + v1[i / 8] = (uint8_t)(1 << (i % 8)); n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE); if((ssize_t)i != n) { H5_FAILED(); @@ -120,8 +120,8 @@ test_find (void) /* Try all combinations of one byte */ for (i=0; i<8*(int)sizeof(v1); i++) { - memset (v1, 0xff, sizeof v1); - v1[i/8] &= ~(1<<(i%8)); + HDmemset(v1, 0xff, sizeof v1); + v1[i / 8] &= (uint8_t)~(1 << (i % 8)); n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE); if ((ssize_t)i!=n) { H5_FAILED(); @@ -175,12 +175,12 @@ test_copy (void) TESTING("bit copy operations"); for (i=0; i<NTESTS; i++) { - s_offset = HDrand() % (8*sizeof v1); - d_offset = HDrand() % (8*sizeof v2); + s_offset = (size_t)HDrand() % (8 * sizeof v1); + d_offset = (size_t)HDrand() % (8 * sizeof v2); size = (unsigned)HDrand() % MIN (8*sizeof(v1), 8*sizeof(v2)); size = MIN3 (size, 8*sizeof(v1)-s_offset, 8*sizeof(v2)-d_offset); - memset (v1, 0xff, sizeof v1); - memset (v2, 0x00, sizeof v2); + HDmemset(v1, 0xff, sizeof v1); + HDmemset(v2, 0x00, sizeof v2); /* Copy some bits to v2 and make sure something was copied */ H5T__bit_copy (v2, d_offset, v1, s_offset, size); @@ -297,21 +297,21 @@ test_shift (void) TESTING("bit shift operations"); for (i=0; i<NTESTS; i++) { - offset = HDrand() % (8*sizeof vector); - size = (unsigned)HDrand() % (8*sizeof(vector)-offset); + offset = (size_t)HDrand() % (8 * sizeof vector); + size = (size_t)HDrand() % (8 * sizeof(vector) - offset); /* Don't want size to be 0 */ if(size == 0) continue; - shift_dist = HDrand() % size; + shift_dist = (ssize_t)((size_t)HDrand() % size); /*-------- LEFT-shift some bits and make sure something was shifted --------*/ - memset (vector, 0x00, sizeof vector); + HDmemset(vector, 0x00, sizeof vector); H5T__bit_set (vector, offset, size, 1); H5T__bit_shift (vector, shift_dist, offset, size); /* Look for the ones */ n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); - if ((size_t)n!=offset+shift_dist) { + if(n != (ssize_t)offset + shift_dist) { H5_FAILED(); printf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); @@ -331,7 +331,7 @@ test_shift (void) } /*-------- RIGHT-shift some bits and make sure something was shifted --------*/ - memset (vector, 0x00, sizeof vector); + HDmemset(vector, 0x00, sizeof vector); H5T__bit_set (vector, offset, size, 1); H5T__bit_shift (vector, -shift_dist, offset, size); @@ -350,7 +350,7 @@ test_shift (void) * that reverse searches work as expected. */ n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); - if (n!=(ssize_t)(offset+size-shift_dist-1)) { + if(n != (ssize_t)(offset + size) - shift_dist - 1) { H5_FAILED(); printf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); @@ -362,11 +362,11 @@ test_shift (void) /* Randomly decide shift direction */ if(size % 2 == 0) - shift_dist = size; + shift_dist = (ssize_t)size; else shift_dist = -((ssize_t)size); - memset (vector, 0x00, sizeof vector); + HDmemset(vector, 0x00, sizeof vector); H5T__bit_set (vector, offset, size, 1); H5T__bit_shift (vector, shift_dist, offset, size); @@ -430,12 +430,12 @@ test_increment (void) TESTING("bit increment operations"); for (i=0; i<NTESTS; i++) { - offset = HDrand() % (8*sizeof vector); - size = (unsigned)HDrand() % (8*sizeof(vector)-offset); + offset = (size_t)HDrand() % (8 * sizeof vector); + size = (size_t)HDrand() % (8 * sizeof(vector) - offset); /* Don't want size to be 0 */ if(size == 0) continue; - memset (vector, 0x00, sizeof vector); + HDmemset(vector, 0x00, sizeof vector); if(size>1) /* if size=6, make a sequence like 011111 */ H5T__bit_set (vector, offset, size-1, 1); else /* if size=1, just set this one bit to 1 */ @@ -517,13 +517,13 @@ test_decrement (void) TESTING("bit decrement operations"); for (i=0; i<NTESTS; i++) { - offset = HDrand() % (8*sizeof vector); - size = (unsigned)HDrand() % (8*sizeof(vector)-offset); + offset = (size_t)HDrand() % (8 * sizeof vector); + size = (size_t)HDrand() % (8 * sizeof(vector) - offset); /* Don't want size to be 0 */ if(size == 0) continue; /* All-zero sequence will become 111111(size=6) after decrement */ - memset (vector, 0x00, sizeof vector); + HDmemset(vector, 0x00, sizeof vector); /* decrement the sequence by one */ H5T__bit_dec (vector, offset, size); @@ -589,13 +589,13 @@ test_negate (void) TESTING("bit negate operations"); for (i=0; i<NTESTS; i++) { - offset = HDrand() % (8*sizeof vector); - size = (unsigned)HDrand() % (8*sizeof(vector)-offset); + offset = (size_t)HDrand() % (8 * sizeof vector); + size = (size_t)HDrand() % (8 * sizeof(vector) - offset); /* Don't want size to be 0 */ if(size == 0) continue; /* All-zero sequence will become 111111(size=6) after negating */ - memset (vector, 0x00, sizeof vector); + HDmemset(vector, 0x00, sizeof vector); /* negate the sequence */ H5T__bit_neg (vector, offset, size); @@ -622,7 +622,7 @@ test_negate (void) } /* All-one sequence will become 000000(size=6) after negating */ - memset (vector, 0x00, sizeof vector); + HDmemset(vector, 0x00, sizeof vector); H5T__bit_set (vector, offset, size, 1); /* negate the sequence */ @@ -689,10 +689,10 @@ test_set (void) TESTING("bit set operations"); for (i=0; i<NTESTS; i++) { - d_offset = HDrand() % (8*sizeof v2); - size = (unsigned)HDrand() % (8*sizeof(v2)); + d_offset = (size_t)HDrand() % (8 * sizeof v2); + size = (size_t)HDrand() % (8 * sizeof(v2)); size = MIN (size, 8*sizeof(v2)-d_offset); - memset (v2, 0x00, sizeof v2); + HDmemset(v2, 0x00, sizeof v2); /* Set some bits in v2 */ H5T__bit_set (v2, d_offset, size, TRUE); @@ -806,10 +806,10 @@ test_clear (void) TESTING("bit clear operations"); for (i=0; i<NTESTS; i++) { - d_offset = HDrand() % (8*sizeof v2); - size = (unsigned)HDrand() % (8*sizeof(v2)); + d_offset = (size_t)HDrand() % (8 * sizeof v2); + size = (size_t)HDrand() % (8 * sizeof(v2)); size = MIN (size, 8*sizeof(v2)-d_offset); - memset (v2, 0xff, sizeof v2); + HDmemset(v2, 0xff, sizeof v2); /* Clear some bits in v2 */ H5T__bit_set (v2, d_offset, size, FALSE); diff --git a/test/dtypes.c b/test/dtypes.c index 255ef8e..f247bd9 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1925,12 +1925,12 @@ test_compound_10(void) for(i=0; i<ARRAY_DIM; i++) { wdata[i].i1 = i*10+i; wdata[i].str = HDstrdup("C string A"); - wdata[i].str[9] += (char)i; + wdata[i].str[9] = (char)(wdata[i].str[9] + i); wdata[i].i2 = i*1000+i*10; wdata[i].text.p = (void*)HDstrdup("variable-length text A\0"); len = wdata[i].text.len = HDstrlen((char*)wdata[i].text.p)+1; - ((char*)(wdata[i].text.p))[len-2] += (char)i; + ((char *)(wdata[i].text.p))[len - 2] = (char)(((char *)(wdata[i].text.p))[len - 2] + i); ((char*)(wdata[i].text.p))[len-1] = '\0'; } @@ -2183,7 +2183,7 @@ test_compound_11(void) /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { - if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) { + if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) { printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1); TEST_ERROR @@ -2227,7 +2227,7 @@ test_compound_11(void) /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { - if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) { + if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) { printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1); TEST_ERROR @@ -2265,7 +2265,7 @@ test_compound_11(void) /* Verify converted buffer is correct */ for(u=0; u<NTESTELEM; u++) { - if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) { + if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) { printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__, (unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1); TEST_ERROR @@ -2487,7 +2487,7 @@ test_compound_13(void) /* Check the data. */ for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++) if(data_out.x[u] != data_in.x[u]) TEST_ERROR - if(data_out.y != data_in.y) TEST_ERROR + if(!H5_FLT_ABS_EQUAL(data_out.y, data_in.y)) TEST_ERROR /* Release all resources. */ if(H5Aclose(attid) < 0) FAIL_STACK_ERROR @@ -6113,7 +6113,7 @@ test_int_float_except(void) /* Check the buffer after conversion, as floats */ for(u = 0; u < CONVERT_SIZE; u++) { floatp = (float *)&buf[u]; - if(*floatp != buf_float[u]) TEST_ERROR + if(!H5_FLT_ABS_EQUAL(*floatp, buf_float[u])) TEST_ERROR } /* end for */ /* Check for proper exceptions */ @@ -6134,7 +6134,7 @@ test_int_float_except(void) /* Check the buffer after conversion, as floats */ for(u = 0; u < CONVERT_SIZE; u++) { floatp = (float *)&buf2[u]; - if(*floatp != buf2_float[u]) TEST_ERROR + if(!H5_FLT_ABS_EQUAL(*floatp, buf2_float[u])) TEST_ERROR } /* end for */ /* Check for proper exceptions */ diff --git a/test/error_test.c b/test/error_test.c index ee181b1..5a7741f 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -270,7 +270,7 @@ error: static herr_t error_stack(void) { - int err_num; + ssize_t err_num; const char *FUNC_error_stack = "error_stack"; if((err_num = H5Eget_num(H5E_DEFAULT)) < 0) @@ -284,7 +284,7 @@ error_stack(void) /* Make it push error, force this function to fail */ if((err_num = H5Eget_num(ERR_STACK)) == 0) { H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM, - "Get number test failed, returned %d", err_num); + "Get number test failed, returned %zd", err_num); goto error; } /* end if */ @@ -354,7 +354,7 @@ test_long_desc(void) /* Create the long part of the error description */ for(u = 0; u < LONG_DESC_SIZE; u++) - long_desc[u] = 'A' + (u % 26); + long_desc[u] = (char)('A' + (u % 26)); long_desc[LONG_DESC_SIZE - 1] = '\0'; /* Clear the default error stack */ @@ -487,7 +487,7 @@ test_create(void) { const char *err_func = "test_create"; /* Function name for pushing error */ const char *err_msg = "Error message"; /* Error message for pushing error */ - int err_num; /* Number of errors on stack */ + ssize_t err_num; /* Number of errors on stack */ hid_t estack_id; /* Error stack ID */ /* Create an empty error stack */ @@ -538,7 +538,7 @@ test_copy(void) { const char *err_func = "test_copy"; /* Function name for pushing error */ const char *err_msg = "Error message"; /* Error message for pushing error */ - int err_num; /* Number of errors on stack */ + ssize_t err_num; /* Number of errors on stack */ hid_t estack_id; /* Error stack ID */ herr_t ret; /* Generic return value */ diff --git a/test/fheap.c b/test/fheap.c index a59c27f..8e364de 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -13758,7 +13758,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam unsigned char obj_type; /* Type of storage for object */ fheap_heap_state_t state; /* State of fractal heap */ unsigned deflate_level; /* Deflation level */ - unsigned old_actual_id_len = 0; /* Old actual ID length */ + size_t old_actual_id_len =0 ; /* Old actual ID length */ hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */ const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s"; /* Test description */ @@ -15741,7 +15741,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); /* Loop over adding objects to the heap, until the size limit is reached */ total_obj_added = 0; while(total_obj_added < size_limit) { - unsigned size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */ + size_t size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */ /* Determine the size of the range for this object */ /* (50% of the objects inserted will use the initial size range, @@ -16061,9 +16061,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size = (size_t)(obj_size * 1.3F); + obj_size = (size_t)((float)obj_size * 1.3F); else - obj_size = (size_t)(obj_size / 1.3F); + obj_size = (size_t)((float)obj_size / 1.3F); } /* end for */ /* Close the fractal heap */ @@ -16110,9 +16110,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size = (size_t)(obj_size * 1.3F); + obj_size = (size_t)((float)obj_size * 1.3F); else - obj_size = (size_t)(obj_size / 1.3F); + obj_size = (size_t)((float)obj_size / 1.3F); } /* end for */ /* Close the fractal heap */ diff --git a/test/fillval.c b/test/fillval.c index 1ea2ae6..3f713e9 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -623,7 +623,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0) goto error; if((dcpl = H5Dget_create_plist(dset9)) < 0) goto error; if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error; - if( rd_c.a!=0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z != '\0') { + if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", @@ -696,7 +696,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0) goto error; if((dcpl = H5Dget_create_plist(dset8)) < 0) goto error; if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error; - if(rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') { + if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", @@ -789,7 +789,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; for (i=0; i<1000; i++) { for (j=0; j<5; j++) - hs_offset[j] = rand() % cur_size[j]; + hs_offset[j] = (hsize_t)HDrand() % cur_size[j]; if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) goto error; @@ -811,9 +811,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; - if(fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a || - rd_c.x!=fill_c.x || rd_c.y!=fill_c.y || - rd_c.z!=fill_c.z)) { + if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || + rd_c.x != fill_c.x || !H5_DBL_ABS_EQUAL(rd_c.y, fill_c.y) || + rd_c.z != fill_c.z)) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c" @@ -879,8 +879,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* Verify values, except if no fill value written */ if(fill_time != H5D_FILL_TIME_NEVER) { for(u = 0; u < nelmts; u++) { - if(buf_c[u].a != fill_c.a || buf_c[u].x != fill_c.x || - buf_c[u].y != fill_c.y || buf_c[u].z != fill_c.z) { + if(!H5_FLT_ABS_EQUAL(buf_c[u].a, fill_c.a) || buf_c[u].x != fill_c.x || + !H5_DBL_ABS_EQUAL(buf_c[u].y, fill_c.y) || buf_c[u].z != fill_c.z) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout," Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %f, %d, %f, %c" @@ -938,7 +938,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; for(i = 0; i < 1000; i++) { for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % cur_size[j]; + hs_offset[j] = (hsize_t)HDrand() % cur_size[j]; odd += (int)(hs_offset[j]%2); } /* end for */ if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) @@ -993,8 +993,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, should_be_c.y=buf_c[0].y; should_be_c.z=buf_c[0].z; } - if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x || - rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) { + if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x || + !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " @@ -1012,8 +1012,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, should_be_c.x=buf_c[0].x; should_be_c.y=buf_c[0].y; should_be_c.z=buf_c[0].z; - if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x || - rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) { + if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x || + !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " @@ -1438,9 +1438,11 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *); int (*release_rtn)(void *); size_t val_size; /* Size of element */ - void *val_rd, *should_be, *init_val, *odd_val, *even_val; + void *val_rd, *odd_val; + const void *init_val, *should_be, *even_val; int val_rd_i, init_val_i = 9999; - comp_vl_datatype val_rd_c, init_val_c = {87, "baz", "mumble", 129}; + comp_vl_datatype init_val_c = {87, "baz", "mumble", 129}; + comp_vl_datatype val_rd_c; void *buf = NULL; unsigned odd; /* Whether an odd or even coord. was read */ unsigned i, j; /* Local index variables */ @@ -1495,7 +1497,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0; j < 5; j++) - hs_offset[j] = rand() % start_size[j]; + hs_offset[j] = (hsize_t)HDrand() % start_size[j]; /* Select the random element */ if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR @@ -1548,7 +1550,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % start_size[j]; + hs_offset[j] = (hsize_t)HDrand() % start_size[j]; odd += (unsigned)(hs_offset[j] % 2); } /* end for */ @@ -1586,7 +1588,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % extend_size[j]; + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; if(hs_offset[j] >= start_size[j]) odd = 1; else @@ -1625,7 +1627,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % max_size[j]; + hs_offset[j] = (hsize_t)HDrand() % max_size[j]; if(hs_offset[j] >= start_size[j]) odd = 1; else @@ -1666,7 +1668,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % extend_size[j]; + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; if(hs_offset[j] >= start_size[j]) odd = 1; else @@ -1759,7 +1761,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, for(i = 0; i < 1000; i++) { /* Set offset for random element */ for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = rand() % extend_size[j]; + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; if(hs_offset[j] >= start_size[j]) odd = 1; else diff --git a/test/flush1.c b/test/flush1.c index f15a05a..f1169ea 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -68,13 +68,8 @@ create_file(char* name, hid_t fapl) /* Write some data */ for(i = 0; i < ds_size[0]; i++) - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ for(j = 0; j < (size_t)ds_size[1]; j++) - the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1); + the_data[i][j] = (double)i / (double)(j + 1); if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) FAIL_STACK_ERROR /* Create some groups */ @@ -124,25 +119,15 @@ extend_file(hid_t file) goto error; /* Write some data */ - for (i=0; i<ds_size[0]; i++) { - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ - for (j=0; j<(size_t)ds_size[1]; j++) { - the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1); - } - } - if (H5Dwrite(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 < (size_t)ds_size[1]; j++) + the_data[i][j] = (double)i / (double)(j + 1); + if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) goto error; return file; error: - HD_exit(1); - + HD_exit(1); } /*------------------------------------------------------------------------- @@ -206,3 +191,4 @@ error: HD_exit(1); return 1; } + diff --git a/test/flush2.c b/test/flush2.c index e86d646..7dc45be 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -63,22 +63,15 @@ check_dset(hid_t file, const char* name) assert(100 == ds_size[0] && 100 == ds_size[1]); /* Read some data */ - if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, - the_data) < 0) goto error; + if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) goto error; 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. - * 1998-11-06 ptl - */ - error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1)); - if(error > 0.0001F) { + error = HDfabs(the_data[i][j] - (double)i / (double)(j + 1)); + if(error > (double)0.0001F) { H5_FAILED(); printf(" dset[%lu][%lu] = %g\n", (unsigned long)i, (unsigned long)j, the_data[i][j]); - printf(" should be %g\n", - (double)(hssize_t)i/(hssize_t)(j+1)); + printf(" should be %g\n", (double)i / (double)(j + 1)); goto error; } } diff --git a/test/gheap.c b/test/gheap.c index 3f66d35..317e306 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -81,7 +81,7 @@ test_1 (hid_t fapl) H5HG_t obj[1024]; uint8_t out[1024]; uint8_t in[1024]; - int i; + size_t u; size_t size; herr_t status; int nerrors = 0; @@ -104,16 +104,16 @@ test_1 (hid_t fapl) * a clean file, the addresses allocated for the collections should also * be monotonically increasing. */ - for(i = 0; i < 1024; i++) { - size = i + 1; - HDmemset(out, 'A' + i % 26, size); + for(u = 0; u < 1024; u++) { + size = u + 1; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + i); + status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + u); if(status < 0) { H5_FAILED(); puts(" Unable to insert object into global heap"); nerrors++; - } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) { + } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { H5_FAILED(); puts(" Collection addresses are not monotonically increasing"); nerrors++; @@ -123,11 +123,11 @@ test_1 (hid_t fapl) /* * Now try to read each object back. */ - for(i = 0; i < 1024; i++) { - size = i + 1; - HDmemset(out, 'A' + i % 26, size); + for(u = 0; u < 1024; u++) { + size = u + 1; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + i, in, NULL)) { + if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -177,7 +177,7 @@ test_2 (hid_t fapl) H5HG_t obj[1024]; uint8_t out[1024]; uint8_t in[1024]; - int i; + size_t u; size_t size; int nerrors = 0; char filename[1024]; @@ -197,11 +197,11 @@ test_2 (hid_t fapl) /* * Write the objects, monotonically decreasing in length. */ - for (i=0; i<1024; i++) { - size = 1024-i; - memset (out, 'A'+i%26, size); + for(u = 0; u < 1024; u++) { + size = 1024 - u; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i)<0) { + if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u) < 0) { H5_FAILED(); puts(" Unable to insert object into global heap"); nerrors++; @@ -211,11 +211,11 @@ test_2 (hid_t fapl) /* * Now try to read each object back. */ - for (i=0; i<1024; i++) { - size = 1024-i; - memset (out, 'A'+i%26, size); + for(u = 0; u < 1024; u++) { + size = 1024 - u; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj+i, in, NULL)) { + if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -263,7 +263,7 @@ test_3 (hid_t fapl) H5F_t *f = NULL; H5HG_t obj[1024]; uint8_t out[1024]; - int i; + size_t u; size_t size; herr_t status; int nerrors = 0; @@ -282,11 +282,11 @@ test_3 (hid_t fapl) } /* Create some stuff */ - for (i=0; i<1024; i++) { - size = i%30+100; - memset (out, 'A'+i%26, size); + for(u = 0; u < 1024; u++) { + size = u % 30 + 100; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i); + status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -295,8 +295,8 @@ test_3 (hid_t fapl) } /* Remove everything */ - for (i=0; i<1024; i++) { - status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i); + for(u = 0; u < 1024; u++) { + status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); @@ -342,7 +342,7 @@ test_4 (hid_t fapl) H5F_t *f = NULL; H5HG_t obj[1024]; uint8_t out[1024]; - int i; + size_t u; size_t size; herr_t status; int nerrors = 0; @@ -360,12 +360,12 @@ test_4 (hid_t fapl) goto error; } - for (i=0; i<1024; i++) { + for(u = 0; u < 1024; u++) { /* Insert */ - size = i%30+100; - memset (out, 'A'+i%26, size); + size = u % 30 + 100; + HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i); + status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -377,15 +377,15 @@ test_4 (hid_t fapl) * next one has already been inserted. That is, insert A, B, C; * remove B, insert D, E, F; remove E; etc. */ - if (1==i%3) { + if(1 == (u % 3)) { H5Eclear2(H5E_DEFAULT); - status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i-1); + status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u - 1); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); nerrors++; } - memset (obj+i-1, 0, sizeof *obj); + HDmemset(obj + u - 1, 0, sizeof *obj); } } diff --git a/test/hyperslab.c b/test/hyperslab.c index 2cf47b1..9ba5731 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -223,7 +223,7 @@ test_fill(size_t nx, size_t ny, size_t nz, for(v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++) for(w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++) ref_value -= dst[u * ny * nz + v * nz + w]; - ref_value += fill_value * dx * dy * dz; + ref_value += fill_value * (unsigned)dx * (unsigned)dy * (unsigned)dz; /* Fill the hyperslab with some value */ H5VM_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value); @@ -819,8 +819,8 @@ test_transpose(size_t nx, size_t ny) size[1] = ny; src_stride[0] = 0; src_stride[1] = sizeof(*src); - dst_stride[0] = (ssize_t)((1 - nx * ny) * sizeof(*src)); - dst_stride[1] = (ssize_t)(nx * sizeof(*src)); + dst_stride[0] = (hsize_t)((1 - nx * ny) * sizeof(*src)); + dst_stride[1] = (hsize_t)(nx * sizeof(*src)); /* Copy and transpose */ if(nx == ny) @@ -923,7 +923,7 @@ test_sub_super(size_t nx, size_t ny) /* Setup */ size[0] = nx; size[1] = ny; - src_stride[0] = (ssize_t)(2 * ny); + src_stride[0] = (hsize_t)(2 * ny); src_stride[1] = 2; dst_stride[0] = 0; dst_stride[1] = 1; @@ -972,9 +972,9 @@ test_sub_super(size_t nx, size_t ny) src_stride[1] = 1; src_stride[2] = 0; src_stride[3] = 0; - dst_stride[0] = (ssize_t)(2 * ny); - dst_stride[1] = (ssize_t)(2 * sizeof(uint8_t) - 4 * ny); - dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8_t)); + dst_stride[0] = (hsize_t)(2 * ny); + dst_stride[1] = (hsize_t)(2 * sizeof(uint8_t) - 4 * ny); + dst_stride[2] = (hsize_t)(2 * ny - 2 * sizeof(uint8_t)); dst_stride[3] = sizeof(uint8_t); /* Copy */ @@ -1144,9 +1144,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) /* Check offsets */ for(u = 0; u < n; u++) { /* Get random coordinate */ - coords[0] = (hssize_t)(HDrandom() % z); - coords[1] = (hssize_t)(HDrandom() % y); - coords[2] = (hssize_t)(HDrandom() % x); + coords[0] = (hsize_t)((size_t)HDrandom() % z); + coords[1] = (hsize_t)((size_t)HDrandom() % y); + coords[2] = (hsize_t)((size_t)HDrandom() % x); /* Get offset of coordinate */ off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords); diff --git a/test/tchecksum.c b/test/tchecksum.c index cb7c023..ca6c227 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -189,7 +189,7 @@ test_chksum_large(void) /* Initialize buffer w/known data */ for(u = 0; u < BUF_LEN; u++) - large_buf[u] = u * 3; + large_buf[u] = (uint8_t)(u * 3); /* Buffer w/real data */ chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf)); @@ -247,7 +247,7 @@ test_checksum(void) * *------------------------------------------------------------------------- */ -H5_ATTR_PURE void +H5_ATTR_PURE H5_ATTR_CONST void cleanup_checksum(void) { /* no file to clean */ diff --git a/test/tfile.c b/test/tfile.c index 74f3b86..833d2d9 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1858,7 +1858,7 @@ test_file_open_overlap(void) hid_t did1, did2; hid_t gid; hid_t sid; - int nobjs; /* # of open objects */ + ssize_t nobjs; /* # of open objects */ unsigned intent; herr_t ret; /* Generic return value */ @@ -2197,8 +2197,9 @@ test_file_double_file_dataset_open(hbool_t new_format) hsize_t max_dims1[1] = {H5S_UNLIMITED}; /* Maximum dimesion sizes for extensible array index */ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */ hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */ - char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */ - char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */ + hsize_t size; /* File size */ + const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */ + const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */ char* buffer[5]; /* Output buffer */ int wbuf[4] = {1, 2, 3, 4}; /* Input data */ herr_t ret; /* Generic return value */ @@ -2432,8 +2433,8 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(did1, FAIL, "H5Dopen2"); /* First file's get storage size */ - ret = H5Dget_storage_size(did1); - CHECK(ret, FAIL, "H5Dget_storage_size"); + size = H5Dget_storage_size(did1); + CHECK(size, 0, "H5Dget_storage_size"); /* Second file open */ fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -2452,8 +2453,8 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Fclose"); /* Second file's get storage size */ - ret = H5Dget_storage_size(did2); - CHECK(ret, FAIL, "H5Dget_storage_size"); + size = H5Dget_storage_size(did2); + CHECK(size, 0, "H5Dget_storage_size"); /* Second file's dataset close */ ret = H5Dclose(did2); @@ -2775,7 +2776,7 @@ test_rw_noupdate(void) diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); /* Check That Timestamps Are Equal */ - if(diff > 0.0F) { + if(diff > (double)0.0F) { /* Output message about test being performed */ MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time.\n")); } /* end if */ @@ -2808,7 +2809,7 @@ test_rw_noupdate(void) /* Ensure That Timestamps Are Equal */ diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); - ret = (diff > 0.0F); + ret = (diff > (double)0.0F); VERIFY(ret, 0, "Timestamp"); } /* end else */ } /* end test_rw_noupdate() */ diff --git a/test/th5o.c b/test/th5o.c index 3be5d12..125e11b 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -920,6 +920,7 @@ test_h5o_comment(void) const char *dtype_comment = "datatype comment"; char check_comment[64]; ssize_t comment_len = 0; + ssize_t len; herr_t ret; /* Value returned from API calls */ int ret_value; @@ -1008,8 +1009,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(fid, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(fid, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(fid, check_comment, (size_t)comment_len+1); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(file_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1022,8 +1023,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(grp, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(grp, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(grp, check_comment, (size_t)comment_len+1); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(grp_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1036,8 +1037,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(dtype, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(dtype_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1050,8 +1051,8 @@ test_h5o_comment(void) comment_len = H5Oget_comment(dset, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); - ret = H5Oget_comment(dset, check_comment, (size_t)comment_len+1); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment(dset, check_comment, (size_t)comment_len+1); + CHECK(ret, len, "H5Oget_comment"); ret_value = HDstrcmp(dset_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1092,6 +1093,7 @@ test_h5o_comment_by_name(void) const char *dtype_comment = "datatype comment by name"; char check_comment[64]; ssize_t comment_len = 0; + ssize_t len; herr_t ret; /* Value returned from API calls */ int ret_value; @@ -1179,8 +1181,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(fid, ".", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + len = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment_by_name"); ret_value = HDstrcmp(file_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); @@ -1193,8 +1195,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(fid, "group", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + len = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment_by_name"); ret_value = HDstrcmp(grp_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); @@ -1203,8 +1205,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(grp, "datatype", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment"); + len = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment"); ret_value = HDstrcmp(dtype_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); @@ -1213,8 +1215,8 @@ test_h5o_comment_by_name(void) comment_len = H5Oget_comment_by_name(fid, "dataset", NULL, (size_t)0, H5P_DEFAULT); CHECK(comment_len, FAIL, "H5Oget_comment_by_name"); - ret = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + len = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT); + CHECK(len, FAIL, "H5Oget_comment_by_name"); ret_value = HDstrcmp(dset_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); diff --git a/test/titerate.c b/test/titerate.c index f61842a..9f0b900 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -283,7 +283,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test all objects in group, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Literate"); @@ -308,7 +309,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test all objects in group, when callback changes return value */ /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Literate"); @@ -462,7 +464,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Test all attributes on dataset, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Aiterate2"); @@ -488,7 +491,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Test all attributes on dataset, when callback changes return value */ /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; - idx = i = 0; + i = 0; + idx = 0; while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Aiterate2"); @@ -672,7 +676,7 @@ test_iter_group_large(hid_t fapl) ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); CHECK(ret, FAIL, "H5Literate"); for(i = 1; i < 100; i++) { - hsize_t idx = i; + hsize_t idx = (hsize_t)i; curr_name = &names[i]; ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); diff --git a/test/trefer.c b/test/trefer.c index cb0f44e..433239a 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -84,8 +84,8 @@ test_reference_params(void) int i; /* counting variables */ const char *write_comment = "Foo!"; /* Comments for group */ hid_t ret_id; /* Generic hid_t return value */ + ssize_t name_size; /* Size of reference name */ herr_t ret; /* Generic return value */ - size_t name_size; /* Size of reference name */ /* Output message about test being performed */ MESSAGE(5, ("Testing Reference Parameters\n")); @@ -120,7 +120,7 @@ test_reference_params(void) CHECK(dataset, FAIL, "H5Dcreate2"); for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++=i*3; + *tu32++ = (unsigned)i * 3; /* Write selection to disk */ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -266,6 +266,7 @@ test_reference_obj(void) const char *write_comment="Foo!"; /* Comments for group */ char read_comment[10]; H5O_type_t obj_type; /* Object type */ + ssize_t size; /* Comment length */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -301,7 +302,7 @@ test_reference_obj(void) CHECK(dataset, FAIL, "H5Dcreate2"); for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++) - *tu32++=i*3; + *tu32++ = (unsigned)i * 3; /* Write selection to disk */ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -432,8 +433,8 @@ test_reference_obj(void) CHECK(group, FAIL, "H5Rdereference2"); /* Get group's comment */ - ret = H5Oget_comment(group, read_comment, (size_t)10); - CHECK(ret, FAIL, "H5Oget_comment"); + size = H5Oget_comment(group, read_comment, (size_t)10); + CHECK(size, FAIL, "H5Oget_comment"); /* Check for correct comment value */ if(HDstrcmp(write_comment, read_comment) != 0) @@ -557,7 +558,7 @@ test_reference_region(void) CHECK(dset2, FAIL, "H5Dcreate2"); for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++) - *tu8++ = i * 3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -762,7 +763,7 @@ test_reference_region(void) VERIFY(ret, 36, "H5Sget_select_npoints"); ret = (int)H5Sget_select_hyper_nblocks(sid2); VERIFY(ret, 1, "H5Sget_select_hyper_nblocks"); - coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist"); VERIFY(coords[0], 2, "Hyperslab Coordinates"); @@ -790,7 +791,7 @@ test_reference_region(void) VERIFY(ret, 10, "H5Sget_select_npoints"); ret = (int)H5Sget_select_elem_npoints(sid2); VERIFY(ret, 10, "H5Sget_select_elem_npoints"); - coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); VERIFY(coords[0], coord1[0][0], "Element Coordinates"); @@ -945,7 +946,7 @@ test_reference_region_1D(void) CHECK(dset3, FAIL, "H5Dcreate2"); for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) - *tu8++ = i * 3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf); @@ -1068,7 +1069,7 @@ test_reference_region_1D(void) VERIFY(ret, 30, "H5Sget_select_npoints"); ret = (int)H5Sget_select_hyper_nblocks(sid3); VERIFY(ret, 15, "H5Sget_select_hyper_nblocks"); - coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */ ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist"); VERIFY(coords[0], 2, "Hyperslab Coordinates"); @@ -1120,7 +1121,7 @@ test_reference_region_1D(void) VERIFY(ret, 10, "H5Sget_select_npoints"); ret = (int)H5Sget_select_elem_npoints(sid3); VERIFY(ret, 10, "H5Sget_select_elem_npoints"); - coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */ + coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); VERIFY(coords[0], coord1[0][0], "Element Coordinates"); @@ -1329,6 +1330,7 @@ test_reference_group(void) char objname[NAME_SIZE]; /* Buffer to store name */ H5O_info_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ + ssize_t size; /* Name length */ herr_t ret; /* Create file with a group and a dataset containing an object reference to the group */ @@ -1409,8 +1411,8 @@ test_reference_group(void) CHECK(ret, FAIL, "H5Gget_info"); VERIFY(ginfo.nlinks, 3, "H5Gget_info"); - ret = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_name_by_idx"); + size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT); + CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5P_DEFAULT); diff --git a/test/ttst.c b/test/ttst.c index 0c47dad..a7c43a2 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -123,7 +123,7 @@ test_tst_init(void) curr_time=HDtime(NULL); HDsrandom((unsigned)curr_time); for(u=0; u<num_uniq_words; u++) { - v=u+(HDrandom()%(num_uniq_words-u)); + v = u + ((size_t)HDrandom() % (num_uniq_words - u)); if(u!=v) { tmp_word=rand_uniq_words[u]; rand_uniq_words[u]=rand_uniq_words[v]; diff --git a/test/tunicode.c b/test/tunicode.c index 68e9073..2bba9ae 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -384,6 +384,7 @@ void test_objnames(hid_t fid, const char* string) char path_buf[MAX_PATH_LENGTH]; hsize_t dims=1; hobj_ref_t obj_ref; + ssize_t size; herr_t ret; /* Create a group with a UTF-8 name */ @@ -395,8 +396,8 @@ void test_objnames(hid_t fid, const char* string) */ ret = H5Oset_comment_by_name(fid, string, string, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oset_comment_by_name"); - ret = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_comment_by_name"); + size = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT); + CHECK(size, FAIL, "H5Oget_comment_by_name"); ret = H5Gclose(grp_id); CHECK(ret, FAIL, "H5Gclose"); @@ -510,6 +511,7 @@ void test_attrname(hid_t fid, const char * string) hid_t dtype_id, space_id; hsize_t dims=1; char read_buf[MAX_STRING_LENGTH]; + ssize_t size; herr_t ret; /* Create a new group and give it an attribute whose @@ -528,8 +530,8 @@ void test_attrname(hid_t fid, const char * string) /* Create the attribute and check that its name is correct */ attr_id = H5Acreate2(group_id, string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); - ret = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf); - CHECK(ret, FAIL, "H5Aget_name"); + size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf); + CHECK(size, FAIL, "H5Aget_name"); ret = strcmp(read_buf, string); VERIFY(ret, 0, "strcmp"); read_buf[0] = '\0'; @@ -740,25 +742,25 @@ static hid_t mkstr(size_t len, H5T_str_t strpad) unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos) { if (c < 0x80) { - test_string[cur_pos] = c; + test_string[cur_pos] = (char)c; cur_pos++; } else if (c < 0x800) { - test_string[cur_pos] = (0xC0 | c>>6); - test_string[cur_pos+1] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xC0 | c >> 6); + test_string[cur_pos + 1] = (char)(0x80 | (c & 0x3F)); cur_pos += 2; } else if (c < 0x10000) { - test_string[cur_pos] = (0xE0 | c>>12); - test_string[cur_pos+1] = (0x80 | (c>>6 & 0x3F)); - test_string[cur_pos+2] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xE0 | c >> 12); + test_string[cur_pos + 1] = (char)(0x80 | (c >> 6 & 0x3F)); + test_string[cur_pos + 2] = (char)(0x80 | (c & 0x3F)); cur_pos += 3; } else if (c < 0x200000) { - test_string[cur_pos] = (0xF0 | c>>18); - test_string[cur_pos+1] = (0x80 | (c>>12 & 0x3F)); - test_string[cur_pos+2] = (0x80 | (c>>6 & 0x3F)); - test_string[cur_pos+3] = (0x80 | (c & 0x3F)); + test_string[cur_pos] = (char)(0xF0 | c >> 18); + test_string[cur_pos + 1] = (char)(0x80 | (c >> 12 & 0x3F)); + test_string[cur_pos + 2] = (char)(0x80 | (c >> 6 & 0x3F)); + test_string[cur_pos + 3] = (char)(0x80 | (c & 0x3F)); cur_pos += 4; } @@ -771,13 +773,13 @@ unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos * could confuse printf (e.g., '\n'). */ void dump_string(const char * string) { - unsigned int length; - unsigned int x; + size_t length; + size_t x; printf("The string was:\n %s", string); printf("Or in hex:\n"); - length = strlen(string); + length = HDstrlen(string); for(x=0; x<length; x++) printf("%x ", string[x] & (0x000000FF)); @@ -810,7 +812,7 @@ void test_unicode(void) /* We need to avoid unprintable characters (codes 0-31) and the * . and / characters, since they aren't allowed in path names. */ - unicode_point = (HDrandom() % (MAX_CODE_POINT-32)) + 32; + unicode_point = (unsigned)(HDrandom() % (MAX_CODE_POINT-32)) + 32; if(unicode_point != 46 && unicode_point != 47) cur_pos = write_char(unicode_point, test_string, cur_pos); } diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 8a996d9..2453ffc 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -218,7 +218,7 @@ void parse_command_line(int argc, options->delta = atof( opt_arg ); /* -d 0 is the same as default */ - if (options->delta == 0) + if (H5_DBL_ABS_EQUAL(options->delta, (double)0.0F)) options->d=0; break; @@ -235,7 +235,7 @@ void parse_command_line(int argc, options->percent = atof( opt_arg ); /* -p 0 is the same as default */ - if (options->percent == 0) + if (H5_DBL_ABS_EQUAL(options->percent, (double)0.0F)) options->p = 0; break; @@ -249,16 +249,17 @@ void parse_command_line(int argc, usage(); h5diff_exit(EXIT_FAILURE); } - options->count = atol( opt_arg ); - + options->count = HDstrtoull(opt_arg, NULL, 0); break; case 'N': options->do_nans = 0; break; + case 'c': options->m_list_not_cmp = 1; break; + case 'e': options->use_system_epsilon = 1; break; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 4506da2..c95ada3 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -376,15 +376,12 @@ typedef struct s1_t { /* "File 82" macros */ /* Name of dataset to create in datafile */ #define F82_DATASETNAME "CompoundComplex1D" -#define F82_DATASETNAME2 "CompoundComplex2D" -#define F82_DATASETNAME3 "CompoundComplex3D" -#define F82_DATASETNAME4 "CompoundComplex4D" /* Dataset dimensions */ #define F82_DIM32 32 #define F82_RANK 1 -#define F82_RANK2 2 -#define F82_RANK3 3 -#define F82_RANK4 4 +//#define F82_RANK2 2 +//#define F82_RANK3 3 +//#define F82_RANK4 4 /* "File 83" macros */ /* Name of dataset to create in datafile */ @@ -9923,9 +9920,9 @@ static void gent_compound_complex2(void) compound buf[F82_DIM32]; /* compound */ - hid_t file, grp=-1, type=-1, space=-1, dset=-1; + hid_t file, type=-1, space=-1, dset=-1; hid_t dset_array_a, dset_array_b, dset_array_c; - hid_t cmpd_tid1, cmpd_tid2, cmpd_tid3; + hid_t cmpd_tid1 = -1, cmpd_tid2 = -1, cmpd_tid3 = -1; size_t i; size_t j, k; unsigned dset_array_ndims; @@ -9937,6 +9934,10 @@ static void gent_compound_complex2(void) if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) { /* CompoundComplex1D */ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) { + hid_t str_type, array; + hsize_t dims[1]; + hid_t nest1, nest2; + /* Insert top-level array members */ dset_array_ndims = 1; dset_array_a_dims[0] = 4; dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims); @@ -9954,8 +9955,6 @@ static void gent_compound_complex2(void) H5Tclose(dset_array_c); /* Insert first nested compound */ - hid_t str_type, array; - hsize_t dims[1]; cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(nested_compound)); H5Tinsert(cmpd_tid1, "nested_double", HOFFSET(nested_compound, nested_a), H5T_IEEE_F64LE); @@ -9977,7 +9976,6 @@ static void gent_compound_complex2(void) H5Tinsert(type, "nested_compound", HOFFSET(compound, d), cmpd_tid1); /* Insert second nested compound */ - hid_t nest1, nest2; cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(multiple_nested_compound)); H5Tinsert(cmpd_tid2, "nested_float", HOFFSET(multiple_nested_compound, a), H5T_IEEE_F32LE); diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index ac839fb..38fd75b 100644 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -119,8 +119,8 @@ main(void) #ifdef H5_SIZEOF_LONG_LONG row4i64[i] = row4i64[i - 1] + rowi4i64; #endif - row4i16[i] = row4i16[i - 1] + rowi4i16; - row4i8[i] = row4i8[i - 1] + rowi4i8; + row4i16[i] = (short)(row4i16[i - 1] + rowi4i16); + row4i8[i] = (char)(row4i8[i - 1] + rowi4i8); } for (j = 1; j < ncol; j++) @@ -131,8 +131,8 @@ main(void) #ifdef H5_SIZEOF_LONG_LONG col4i64[j] = col4i64[j - 1] + coli4i64; #endif - col4i16[j] = col4i16[j - 1] + coli4i16; - col4i8[j] = col4i8[j - 1] + coli4i8; + col4i16[j] = (short)(col4i16[j - 1] + coli4i16); + col4i8[j] = (char)(col4i8[j - 1] + coli4i8); } for (k = 1; k < npln; k++) { @@ -142,8 +142,8 @@ main(void) #ifdef H5_SIZEOF_LONG_LONG pln4i64[k] = pln4i64[k - 1] + plni4i64; #endif - pln4i16[k] = pln4i16[k - 1] + plni4i16; - pln4i8[k] = pln4i8[k - 1] + plni4i8; + pln4i16[k] = (short)(pln4i16[k - 1] + plni4i16); + pln4i8[k] = (char)(pln4i8[k - 1] + plni4i8); } /* @@ -157,8 +157,8 @@ main(void) for (k = 0; k < npln; k++) { b64r3[k][i][j] = row8[i] + col8[j] + pln8[k]; b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k]; - b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k]; - b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k]; + b16i3[k][i][j] = (short)(row4i16[i] + col4i16[j] + pln4i16[k]); + b8i3[k][i][j] = (char)(row4i8[i] + col4i8[j] + pln4i8[k]); } diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 7ae3169..a12b17a 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -248,7 +248,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) space = H5Screate_simple(1, dims, NULL); dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 10; i++) - dset2_1[i] = (float)(i*0.1F+1); + dset2_1[i] = (float)((float)i * 0.1F + 1.0F); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); @@ -259,7 +259,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 3; i++) for (j = 0; j < 5; j++) - dset2_2[i][j] = (float)((i+1)*j*0.1F); + dset2_2[i][j] = (float)(((float)i + 1.0F) * (float)j * 0.1F); H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2); H5Sclose(space); H5Dclose(dataset); diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index 4d79a9b..6053ce9 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -55,9 +55,9 @@ io_time_t *timer_g; /* timer: global for stub functions */ static double sub_time(struct timeval* a, struct timeval* b) { return (((double)a->tv_sec + - ((double)a->tv_usec) / MICROSECOND) - + ((double)a->tv_usec) / (double)MICROSECOND) - ((double)b->tv_sec + - ((double)b->tv_usec) / MICROSECOND)); + ((double)b->tv_usec) / (double)MICROSECOND)); } diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 8657cbc..e44c957 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -194,9 +194,7 @@ main (int argc, char *argv[]) int src, dst=-1; /*source & destination files */ int need_seek=FALSE; /*destination needs to seek? */ int need_write; /*data needs to be written? */ - /*struct stat sb; temporary file stat buffer */ - /*struct _stati64 sb;*/ - h5_stat_t sb; + h5_stat_t sb; /*temporary file stat buffer */ int verbose=FALSE; /*display file names? */ @@ -243,7 +241,7 @@ main (int argc, char *argv[]) family_to_sec2 = TRUE; argno++; } else if ('b'==argv[argno][1]) { - blk_size = get_size (prog_name, &argno, argc, argv); + blk_size = (size_t)get_size (prog_name, &argno, argc, argv); } else if ('m'==argv[argno][1]) { dst_size = get_size (prog_name, &argno, argc, argv); } else { @@ -308,7 +306,7 @@ main (int argc, char *argv[]) if (dst_is_family) n = (size_t)MIN((off_t)n, dst_size-dst_offset); if (left_overs) { n = (size_t)MIN ((off_t)n, left_overs); - left_overs -= n; + left_overs = left_overs - (off_t)n; need_write = FALSE; } else if (src_offset<src_act_size) { n = (size_t)MIN ((off_t)n, src_act_size-src_offset); @@ -359,16 +357,16 @@ main (int argc, char *argv[]) * loop. The destination offset must be updated so we can fix * trailing holes. */ - src_offset += n; + src_offset = src_offset + (off_t)n; if (src_offset==src_act_size) { HDclose (src); if (!src_is_family) { - dst_offset += n; + dst_offset = dst_offset + (off_t)n; break; } sprintf (src_name, src_gen_name, ++src_membno); if ((src=HDopen (src_name, O_RDONLY,0))<0 && ENOENT==errno) { - dst_offset += n; + dst_offset = dst_offset + (off_t)n; break; } else if (src<0) { perror (src_name); @@ -392,7 +390,7 @@ main (int argc, char *argv[]) * needed. The first member is extended to the logical member size * but other members might be smaller if they end with a hole. */ - dst_offset += n; + dst_offset = dst_offset + (off_t)n; if (dst_is_family && dst_offset==dst_size) { if (0==dst_membno) { if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { @@ -474,7 +472,7 @@ main (int argc, char *argv[]) } /* Set the property of the new member size as hsize_t */ - hdsize = dst_size; + hdsize = (hsize_t)dst_size; if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { perror ("H5Pset"); exit (EXIT_FAILURE); diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c index f7d9a73..8a34694 100644 --- a/tools/misc/h5repart_gentest.c +++ b/tools/misc/h5repart_gentest.c @@ -27,12 +27,13 @@ #define FAMILY_SIZE 1024 #define FILENAME "family_file%05d.h5" +static int buf[FAMILY_NUMBER][FAMILY_SIZE]; + int main(void) { hid_t file=(-1), fapl, space=(-1), dset=(-1); char dname[]="dataset"; int i, j; - int buf[FAMILY_NUMBER][FAMILY_SIZE]; hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; /* Set property list and file name for FAMILY driver */ diff --git a/tools/perform/chunk.c b/tools/perform/chunk.c index 0ea16e8..b1419ee 100644 --- a/tools/perform/chunk.c +++ b/tools/perform/chunk.c @@ -57,9 +57,9 @@ #define RM_CACHE_STRT 25 #define RM_CACHE_END 25 #define RM_CACHE_DELT 5 -#define RM_START 0.50F -#define RM_END 5.00F -#define RM_DELTA 0.50F +#define RM_START (double)0.50F +#define RM_END (double)5.00F +#define RM_DELTA (double)0.50F #define RM_W0 0.0F #define RM_NRDCC 521 @@ -67,9 +67,9 @@ #define DIAG_CACHE_STRT 25 #define DIAG_CACHE_END 25 #define DIAG_CACHE_DELT 5 -#define DIAG_START 0.50F -#define DIAG_END 5.00F -#define DIAG_DELTA 0.50F +#define DIAG_START (double)0.50F +#define DIAG_END (double)5.00F +#define DIAG_DELTA (double)0.50F /* #define DIAG_W0 0.65F */ /* #define DIAG_NRDCC 521 */ @@ -320,7 +320,7 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset) * Win32 version 5.0 compiler. * 1998-11-06 ptl */ - return (double)(hssize_t)nio/(hssize_t)nio_g; + return (double)nio/(double)nio_g; } @@ -479,9 +479,7 @@ main (void) for (cache_size=DIAG_CACHE_STRT; cache_size<=DIAG_CACHE_END; cache_size+=DIAG_CACHE_DELT) { - for (io_percent=DIAG_START; - io_percent<=DIAG_END; - io_percent+=DIAG_DELTA) { + for (io_percent=DIAG_START; io_percent<=DIAG_END; io_percent+=DIAG_DELTA) { io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); printf ("Diag-rd %8d %8.2f", (int)cache_size, io_percent); fflush (stdout); diff --git a/tools/perform/iopipe.c b/tools/perform/iopipe.c index 6ac7ccb..fd62d37 100644 --- a/tools/perform/iopipe.c +++ b/tools/perform/iopipe.c @@ -81,25 +81,25 @@ print_stats (const char *prefix, double u_time, s_time; u_time = ((double)(r_stop->ru_utime.tv_sec)+ - (double)(r_stop->ru_utime.tv_usec)/1000000.0F) - + (double)(r_stop->ru_utime.tv_usec)/(double)1000000.0F) - ((double)(r_start->ru_utime.tv_sec)+ - (double)(r_start->ru_utime.tv_usec)/1000000.0F); + (double)(r_start->ru_utime.tv_usec)/(double)1000000.0F); s_time = ((double)(r_stop->ru_stime.tv_sec)+ - (double)(r_stop->ru_stime.tv_usec)/1000000.0F) - + (double)(r_stop->ru_stime.tv_usec)/(double)1000000.0F) - ((double)(r_start->ru_stime.tv_sec)+ - (double)(r_start->ru_stime.tv_usec)/1000000.0F); + (double)(r_start->ru_stime.tv_usec)/(double)1000000.0F); #endif #ifndef H5_HAVE_SYS_TIMEB e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000000.0F) - + (double)(t_stop->tv_usec)/(double)1000000.0F) - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000000.0F); + (double)(t_start->tv_usec)/(double)1000000.0F); #else e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000.0F) - + (double)(t_stop->tv_usec)/(double)1000.0F) - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000.0F); + (double)(t_start->tv_usec)/(double)1000.0F); #endif bw = (double)nbytes / e_time; @@ -196,7 +196,7 @@ main (void) * 1998-11-06 ptl */ printf ("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0]*size[1])/1024.0F*1024); + (double)(hssize_t)(size[0]*size[1])/(double)1024.0F*(double)1024); /* Open the files */ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/perform/overhead.c b/tools/perform/overhead.c index 277f7a4..98093c7 100644 --- a/tools/perform/overhead.c +++ b/tools/perform/overhead.c @@ -199,7 +199,7 @@ test(fill_t fill_style, const double splits[], int *had = NULL; /*for random filling */ const char *sname=NULL; /*fill style nam */ int mdc_nelmts; /*num meta objs to cache*/ - hsize_t i; + hsize_t i, k; int j; h5_stat_t sb; @@ -236,13 +236,13 @@ test(fill_t fill_style, const double splits[], hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2; break; case FILL_OUTWARD: - j = (int)(cur_size[0]-i)+1; - hs_start[0] = j%2 ? j/2 : (hssize_t)cur_size[0]-j/2; + k = (cur_size[0] - i) + 1; + hs_start[0] = k % 2 ? (k / 2) : (hsize_t)((hssize_t)cur_size[0] - (hssize_t)(k / 2)); break; case FILL_RANDOM: for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0]) /*void*/; - hs_start[0] = j; + hs_start[0] = (hsize_t)j; had[j] = 1; break; case FILL_ALL: @@ -265,14 +265,9 @@ test(fill_t fill_style, const double splits[], if (verbose) { if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; if (HDfstat(fd, &sb) < 0) goto error; - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ printf("%4lu %8.3f ***\n", (unsigned long)i, - (double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i); + (double)(sb.st_size - (HDoff_t)(i * sizeof(int))) / (double)i); } } @@ -316,8 +311,8 @@ test(fill_t fill_style, const double splits[], if (HDfstat(fd, &sb) < 0) goto error; printf("%-7s %8.3f\n", sname, - (double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/ - (hssize_t)cur_size[0]); + (double)(sb.st_size - (HDoff_t)(cur_size[0] * sizeof(int))) / + (double)cur_size[0]); } HDclose(fd); diff --git a/tools/perform/sio_engine.c b/tools/perform/sio_engine.c index 11d8f65..abf1fa6 100644 --- a/tools/perform/sio_engine.c +++ b/tools/perform/sio_engine.c @@ -96,7 +96,7 @@ static herr_t do_fclose(iotype iot, file_descr *fd); static void do_cleanupfile(iotype iot, char *fname); /* global variables */ -static off_t offset[MAX_DIMS]; /* dataset size in bytes */ +static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */ static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */ static int order[MAX_DIMS]; /* dimension access order */ static size_t linear_buf_size; /* linear buffer size */ @@ -406,7 +406,8 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) { int ret_code = SUCCESS; char dname[64]; - long i; + int i; + size_t u; /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ @@ -416,20 +417,20 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) hsize_t h5start[MAX_DIMS]; /*selection start */ hsize_t h5maxdims[MAX_DIMS]; int rank; /*rank of dataset */ - /* Prepare buffer for verifying data */ + + /* Prepare buffer for verifying data */ /* if (parms->verify) memset(buffer,1,linear_buf_size); */ buf_p=(unsigned char *)buffer; - for (i=0; i < linear_buf_size; i++) - buf_p[i]=i%128; + for(u = 0; u < linear_buf_size; u++) + buf_p[u] = u % 128; rank = parms->rank; - for (i=0; i<rank; i++) { + for(i = 0; i < rank; i++) h5offset[i] = offset[i] = 0; - } /* I/O Access specific setup */ switch (parms->io_type) { @@ -616,20 +617,22 @@ done: * Programmer: Christian Chilan, April, 2008 * Modifications: */ - -static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) +static herr_t +dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) { int cur_dim = order[local_dim]-1; int ret_code = SUCCESS; int k; hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; - long i,j; + hsize_t i; + int j; herr_t hrc; /* iterates according to the dimensions in order array */ for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){ - h5offset[cur_dim] = offset[cur_dim] = i; + h5offset[cur_dim] = (hssize_t)i; + offset[cur_dim] = (HDoff_t)i; if (local_dim > 0){ @@ -641,17 +644,15 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void case POSIXIO: /* initialize POSIX offset in the buffer */ - for (j=0; j < parms->rank; j++) { - buf_offset[j]=0; - } + for(j = 0; j < parms->rank; j++) + buf_offset[j] = 0; buf_p = (unsigned char *)buffer; /* write POSIX buffer */ posix_buffer_write(0, fd, parms, buffer); break; case HDF5: - /* if dimensions are extendable, extend them as needed during - access */ + /* if dimensions are extendable, extend them as needed during access */ if (parms->h5_use_chunks && parms->h5_extendable) { hrc=H5Sget_simple_extent_dims(h5dset_space_id,dims,maxdims); @@ -659,7 +660,8 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void for (k=0; k < parms->rank; k++){ - if (dims[k] <= h5offset[k]) { + HDassert(h5offset[k] >= 0); + if (dims[k] <= (hsize_t)h5offset[k]) { dims[k] = dims[k]+h5count[k]; hrc=H5Sset_extent_simple(h5dset_space_id,parms->rank,dims,maxdims); VRFY((hrc >= 0), "H5Sset_extent_simple"); @@ -700,20 +702,17 @@ done: * Modifications: */ -static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) +static herr_t +posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) { - int dtype_size = 1; int ret_code = SUCCESS; - long i; - size_t d_offset; - size_t linear_dset_offset = 0; - int j, rc; /* if dimension is not contiguous, call recursively */ if (local_dim < parms->rank-1 && local_dim != cont_dim) { + size_t u; - for (i=0; i < parms->buf_size[local_dim]; i += dtype_size) { - buf_offset[local_dim] = i; + for(u = 0; u < parms->buf_size[local_dim]; u ++) { + buf_offset[local_dim] = u; posix_buffer_write(local_dim+1, fd, parms, buffer); /* if next dimension is cont_dim, it will fill out the buffer @@ -724,17 +723,20 @@ static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parm } /* otherwise, perform contiguous POSIX access */ } else { + HDoff_t d_offset; + HDoff_t linear_dset_offset = 0; + int i, j, rc; buf_offset[local_dim] = 0; /* determine offset in the buffer */ - for (i=0; i < parms->rank; i++){ - d_offset=1; + for(i = 0; i < parms->rank; i++) { + d_offset = 1; - for (j=i+1; j < parms->rank; j++) - d_offset *= parms->dset_size[j]; + for(j = i + 1; j < parms->rank; j++) + d_offset *= (HDoff_t)parms->dset_size[j]; - linear_dset_offset += (offset[i]+buf_offset[i])*d_offset; + linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; } /* only care if seek returns error */ @@ -749,6 +751,7 @@ static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parm buf_p += cont_size; } + done: return ret_code; } @@ -766,7 +769,8 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) char *buffer2 = NULL; /* Buffer for data verification */ int ret_code = SUCCESS; char dname[64]; - long i; + int i; + size_t u; /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */ @@ -782,8 +786,8 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end if */ /* Prepare buffer for verifying data */ - for(i = 0; i < linear_buf_size; i++) - buffer2[i] = i % 128; + for(u = 0; u < linear_buf_size; u++) + buffer2[u] = (char)(u % 128); rank = parms->rank; for(i = 0; i < rank; i++) @@ -937,18 +941,21 @@ done: * Modifications: */ -static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms, - void *buffer, const char *buffer2) +static herr_t +dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer, + const char *buffer2) { int cur_dim = order[local_dim]-1; - int ret_code = SUCCESS; - long i,j; + hsize_t i; + int j; herr_t hrc; + int ret_code = SUCCESS; /* iterate on the current dimension */ for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){ - h5offset[cur_dim] = offset[cur_dim] = i; + h5offset[cur_dim] = (hssize_t)i; + offset[cur_dim] = (HDoff_t)i; /* if traverse in order array is incomplete, recurse */ if (local_dim > 0){ @@ -975,13 +982,6 @@ static herr_t dset_read(int local_dim, file_descr *fd, parameters *parms, hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer); VRFY((hrc >= 0), "H5Dread"); -#if 0 - for (j=0; j<linear_buf_size; j++) { - buf_p = (unsigned char*)buffer; - if (buf_p[j]!=buffer2[j]) - printf("Inconsistent data in %d\n", j); - } -#endif break; default: @@ -1004,26 +1004,26 @@ done: * Modifications: */ -static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer) +static herr_t +posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer) { - int dtype_size = 1; int ret_code = SUCCESS; - long i; - size_t d_offset; - size_t linear_dset_offset = 0; - int j, rc; /* if local dimension is not contiguous, recurse */ if (local_dim < parms->rank-1 && local_dim != cont_dim) { + size_t u; - for (i=0; i < parms->buf_size[local_dim]; i += dtype_size) { - buf_offset[local_dim] = i; + for(u = 0; u < parms->buf_size[local_dim]; u++) { + buf_offset[local_dim] = u; ret_code = posix_buffer_read(local_dim+1, fd, parms, buffer); if (local_dim+1==cont_dim) break; } /* otherwise, perform contiguous POSIX access */ } else { + HDoff_t d_offset; + HDoff_t linear_dset_offset = 0; + int i, j, rc; buf_offset[local_dim] = 0; /* determine offset in buffer */ @@ -1031,9 +1031,9 @@ static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms d_offset=1; for (j=i+1; j<parms->rank; j++) - d_offset *= parms->dset_size[j]; + d_offset *= (HDoff_t)parms->dset_size[j]; - linear_dset_offset += (offset[i]+buf_offset[i])*d_offset; + linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset; } /* only care if seek returns error */ @@ -1165,7 +1165,7 @@ set_vfd(parameters *param) memb_fapl[mt] = H5P_DEFAULT; sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; - memb_addr[mt] = MAX(mt-1,0)*(HADDR_MAX/10); + memb_addr[mt] = (haddr_t)MAX(mt - 1,0) * (HADDR_MAX / 10); } if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name, |