diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/big.c | 8 | ||||
-rw-r--r-- | test/dt_arith.c | 30 | ||||
-rw-r--r-- | test/file_image.c | 6 | ||||
-rw-r--r-- | test/tgenprop.c | 6 | ||||
-rw-r--r-- | test/th5s.c | 20 | ||||
-rw-r--r-- | test/tselect.c | 30 |
6 files changed, 51 insertions, 49 deletions
@@ -129,8 +129,8 @@ randll(hsize_t limit, int current_index) /* does not overlap with any previous writes */ while(overlap != 0 && tries < MAX_TRIES) { - acc = HDrandom(); - acc *= HDrandom(); + acc = (hsize_t)HDrandom(); + acc *= (hsize_t)HDrandom(); acc = acc % limit; overlap = 0; @@ -508,7 +508,7 @@ reader(char *filename, hid_t fapl) if('#' != ln[0]) break; i = (int)HDstrtol(ln + 1, &s, 10); - hs_offset[0] = HDstrtoll(s, NULL, 0); + hs_offset[0] = HDstrtoull(s, NULL, 0); HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); HDfflush(stdout); @@ -801,7 +801,7 @@ main (int ac, char **av) /* seed = (unsigned long)1155438845; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); #endif /* QAK */ - HDsrandom(seed); + HDsrandom((unsigned)seed); /* run VFD-specific test */ if(H5FD_SEC2 == driver) { diff --git a/test/dt_arith.c b/test/dt_arith.c index 639ad52..e258b77 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -3094,8 +3094,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if (FLT_FLOAT==dst_type) { hw_f = (float)(*((double*)aligned)); hw = (unsigned char*)&hw_f; - underflow = HDfabs(*((double*)aligned)) < FLT_MIN; - overflow = HDfabs(*((double*)aligned)) > FLT_MAX; + underflow = HDfabs(*((double*)aligned)) < (double)FLT_MIN; + overflow = HDfabs(*((double*)aligned)) > (double)FLT_MAX; } else if (FLT_DOUBLE==dst_type) { hw_d = *((double*)aligned); hw = (unsigned char*)&hw_d; @@ -3109,12 +3109,12 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) } else { HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double)); if (FLT_FLOAT==dst_type) { - hw_f = *((long double*)aligned); + hw_f = (float)*((long double*)aligned); hw = (unsigned char*)&hw_f; underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN; overflow = HDfabsl(*((long double*)aligned)) > FLT_MAX; } else if (FLT_DOUBLE==dst_type) { - hw_d = *((long double*)aligned); + hw_d = (double)*((long double*)aligned); hw = (unsigned char*)&hw_d; underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN; overflow = HDfabsl(*((long double*)aligned)) > DBL_MAX; @@ -3227,15 +3227,15 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) long double x; HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); /* dst is largest float, no need to check underflow. */ - check_mant[0] = HDfrexpl(x, check_expo+0); - check_mant[1] = HDfrexpl(hw_ld, check_expo+1); + check_mant[0] = (double)HDfrexpl(x, check_expo+0); + check_mant[1] = (double)HDfrexpl(hw_ld, check_expo+1); #endif } /* Special check for denormalized values */ if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) { - int expo_diff=check_expo[0]-check_expo[1]; - int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; - double epsilon=1.0F; + int expo_diff = check_expo[0] - check_expo[1]; + int valid_bits = (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1; + double epsilon = 1.0F; /* Re-scale the mantissas based on any exponent difference */ if(expo_diff!=0) @@ -3249,8 +3249,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) continue; } /* end if */ else { - if (check_expo[0]==check_expo[1] && - HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON) + if(check_expo[0] == check_expo[1] && + HDfabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON) continue; } /* end else */ } @@ -4217,10 +4217,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) */ #if H5_SIZEOF_LONG_DOUBLE !=0 if(dendian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) { - unsigned int q; - for(q=dst_nbits/8; q<dst_size; q++) { - buf[j*dst_size+q] = 0x00; - } + size_t q; + + for(q = dst_nbits / 8; q < dst_size; q++) + buf[j * dst_size + q] = 0x00; } #endif diff --git a/test/file_image.c b/test/file_image.c index ef7adb8..e901fa4 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -867,9 +867,11 @@ test_get_file_image(const char * test_banner, VERIFY(fd >= 0, "HDopen() failed."); if(user) { + HDoff_t off; + /* Position at userblock */ - ret = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET); - VERIFY(ret >= 0, "HDlseek() failed."); + off = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET); + VERIFY(off >= 0, "HDlseek() failed."); } /* read the test file from disk into the buffer */ diff --git a/test/tgenprop.c b/test/tgenprop.c index b670c0d..e6f9692 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -784,7 +784,7 @@ test_genprop_basic_list_prop(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) + if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -821,7 +821,7 @@ test_genprop_basic_list_prop(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -1241,7 +1241,7 @@ test_genprop_list_callback(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) + if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); diff --git a/test/th5s.c b/test/th5s.c index a478803..664c23a 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -551,18 +551,18 @@ test_h5s_zero_dim(void) MESSAGE(5, ("Testing Dataspace with zero dimension size\n")); /* Initialize the data */ - for(i=0; i<SPACE1_DIM2; i++) - for(j=0; j<SPACE1_DIM3; j++) { - wdata[i][j] = i + j; + for(i = 0; i < SPACE1_DIM2; i++) + for(j = 0; j < SPACE1_DIM3; j++) { + wdata[i][j] = (int)(i + j); rdata[i][j] = 7; - wdata_short[i][j] = i + j; + wdata_short[i][j] = (short)(i + j); rdata_short[i][j] = 7; } - for(i=0; i<SPACE1_DIM1; i++) - for(j=0; j<SPACE1_DIM2; j++) - for(k=0; k<SPACE1_DIM3; k++) - wdata_real[i][j][k] = i + j + k; + for(i = 0; i < SPACE1_DIM1; i++) + for(j = 0; j < SPACE1_DIM2; j++) + for(k = 0; k < SPACE1_DIM3; k++) + wdata_real[i][j][k] = (int)(i + j + k); /* Test with different space allocation times */ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { @@ -1647,7 +1647,7 @@ test_h5s_chunk(void) /* Initialize float array */ for(i = 0; i < 50000; i++) for(j = 0; j < 3; j++) - chunk_data_flt[i][j] = (float)((i + 1) * 2.5F - j * 100.3F); + chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F; status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); CHECK(status, FAIL, "H5Dwrite"); @@ -1683,7 +1683,7 @@ test_h5s_chunk(void) for(i=0; i<50000; i++) { for(j=0; j<3; j++) { /* Check if the two values are within 0.001% range. */ - if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001F)) + if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F)) TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]); } /* end for */ } /* end for */ diff --git a/test/tselect.c b/test/tselect.c index 73b8015..9230d8b 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -720,7 +720,7 @@ test_select_all(hid_t xfer_plist) for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++) for(j=0; j<SPACE4_DIM2; j++) for(k=0; k<SPACE4_DIM3; k++) - *tbuf++ = (uint8_t)(((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k; + *tbuf++ = (uint8_t)((((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k); /* Create file */ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -7188,8 +7188,8 @@ test_select_fill_point(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_points; u++) { - points[u][0] = (hsize_t)(points[u][0] + real_offset[0]); - points[u][1] = (hsize_t)(points[u][1] + real_offset[1]); + points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]); + points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7269,8 +7269,8 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Verify memory buffer the hard way... */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { - if((u >= (unsigned)(start[0] + real_offset[0]) && u < (unsigned)(start[0] + count[0] + real_offset[0])) - && (v >= (unsigned)(start[1] + real_offset[1]) && v < (unsigned)(start[1] + count[1] + real_offset[1]))) { + if((u >= (unsigned)((hssize_t)start[0] + real_offset[0]) && u < (unsigned)((hssize_t)(start[0] + count[0]) + real_offset[0])) + && (v >= (unsigned)((hssize_t)start[1] + real_offset[1]) && v < (unsigned)((hssize_t)(start[1] + count[1]) + real_offset[1]))) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); } /* end if */ @@ -7288,8 +7288,8 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Set the coordinates of the selection (with the offset) */ for(u = 0, num_points = 0; u < (unsigned)count[0]; u++) for(v = 0; v < (unsigned)count[1]; v++, num_points++) { - points[num_points][0] = (hsize_t)(u + start[0] + real_offset[0]); - points[num_points][1] = (hsize_t)(v + start[1] + real_offset[1]); + points[num_points][0] = (hsize_t)((hssize_t)(u + start[0]) + real_offset[0]); + points[num_points][1] = (hsize_t)((hssize_t)(v + start[1]) + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7379,7 +7379,7 @@ test_select_fill_hyper_regular(hssize_t *offset) for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { for(w = 0; w < (unsigned)num_points; w++) { - if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) { + if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); break; @@ -7396,8 +7396,8 @@ test_select_fill_hyper_regular(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_points; u++) { - points[u][0] = (hsize_t)(points[u][0] + real_offset[0]); - points[u][1] = (hsize_t)(points[u][1] + real_offset[1]); + points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]); + points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7502,7 +7502,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { for(w = 0; w < (unsigned)num_points; w++) { - if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) { + if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); break; @@ -7519,8 +7519,8 @@ test_select_fill_hyper_irregular(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_iter_points; u++) { - iter_points[u][0] = (hsize_t)(iter_points[u][0] + real_offset[0]); - iter_points[u][1] = (hsize_t)(iter_points[u][1] + real_offset[1]); + iter_points[u][0] = (hsize_t)((hssize_t)iter_points[u][0] + real_offset[0]); + iter_points[u][1] = (hsize_t)((hssize_t)iter_points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -13652,9 +13652,9 @@ test_hyper_unlim(void) VERIFY(start2[0], start[0], "H5Sget_select_bounds"); VERIFY(start2[1], start[1], "H5Sget_select_bounds"); VERIFY(start2[2], start[2], "H5Sget_select_bounds"); - VERIFY(count2[0], start[0] + (stride[0] * (count[0] - (hsize_t)1)) + block[0] - (hsize_t)1, "H5Sget_select_bounds"); + VERIFY(count2[0], (long)(start[0] + (stride[0] * (count[0] - 1)) + block[0] - 1), "H5Sget_select_bounds"); VERIFY(count2[1], H5S_UNLIMITED, "H5Sget_select_bounds"); - VERIFY(count2[2], start[2] + (stride[2] * (count[2] - (hsize_t)1)) + block[2] - (hsize_t)1, "H5Sget_select_bounds"); + VERIFY(count2[2], (long)(start[2] + (stride[2] * (count[2] - 1)) + block[2] - 1), "H5Sget_select_bounds"); /* Close the dataspace */ ret = H5Sclose(sid); |