summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-10-18 20:03:47 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-10-18 20:03:47 (GMT)
commit9729a518b49a2217307c3c7ce9b33b064fc83147 (patch)
tree28b22bf7d1972b4a537bcec377778147c976420c /test
parent1bc858b1b889ae2d0eeca463646592d195db8c94 (diff)
downloadhdf5-9729a518b49a2217307c3c7ce9b33b064fc83147.zip
hdf5-9729a518b49a2217307c3c7ce9b33b064fc83147.tar.gz
hdf5-9729a518b49a2217307c3c7ce9b33b064fc83147.tar.bz2
[svn-r24332] Bring revision #24330 from revise_chunks. h5committested.
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c10
-rw-r--r--test/dtypes.c62
2 files changed, 37 insertions, 35 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 3d8ae2c..b1813a5 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -1111,10 +1111,10 @@ test_conv_buffer(hid_t fid)
cf->a[j][k][l] = 10*(j+1) + l + k;
for(j = 0; j < DIM2; j++)
- cf->b[j] = (float)(100.*(j+1) + 0.01*j);
+ cf->b[j] = (float)(100.0f*(j+1) + 0.01f*j);
for(j = 0; j < DIM3; j++)
- cf->c[j] = 100.*(j+1) + 0.02*j;
+ cf->c[j] = 100.0f*(j+1) + 0.02f*j;
/* Create data space */
@@ -2858,7 +2858,7 @@ test_nbit_int(hid_t file)
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);
+ (long long)HDpow(2.0f, (double)(precision - 1))) << offset);
/* even-numbered values are negtive */
if((i*size[1]+j+1)%2 == 0)
@@ -2960,8 +2960,8 @@ test_nbit_float(hid_t file)
/* orig_data[] are initialized to be within the range that can be represented by
* dataset datatype (no precision loss during datatype conversion)
*/
- float orig_data[2][5] = {{(float)188384.00, (float)19.103516, (float)-1.0831790e9, (float)-84.242188,
- (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}};
+ float orig_data[2][5] = {{(float)188384.00f, (float)19.103516f, (float)-1.0831790e9f, (float)-84.242188f,
+ (float)5.2045898f}, {(float)-49140.000f, (float)2350.2500f, (float)-3.2110596e-1f, (float)6.4998865e-5f, (float)-0.0000000f}};
float new_data[2][5];
size_t precision, offset;
size_t i, j;
diff --git a/test/dtypes.c b/test/dtypes.c
index 117a21a..de64713 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1859,7 +1859,7 @@ test_compound_10(void)
hsize_t dim1[1];
void *t1, *t2;
char filename[1024];
- int len;
+ size_t len;
int i;
TESTING("array datatype of compound type with VL string");
@@ -1867,12 +1867,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] += i;
+ wdata[i].str[9] += (char)i;
wdata[i].i2 = i*1000+i*10;
wdata[i].text.p = (void*)HDstrdup("variable-length text A\0");
- len = wdata[i].text.len = strlen((char*)wdata[i].text.p)+1;
- ((char*)(wdata[i].text.p))[len-2] += i;
+ 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-1] = '\0';
}
@@ -2088,11 +2088,11 @@ test_compound_11(void)
/* Initialize buffer */
for(u = 0; u < NTESTELEM; u++) {
- ((big_t *)buf)[u].d1 = (double)u * (double)1.5;
- ((big_t *)buf)[u].d2 = (double)u * (double)2.5;
- ((big_t *)buf)[u].d3 = (double)u * (double)3.5;
- ((big_t *)buf)[u].i1 = u * 3;
- ((big_t *)buf)[u].i2 = u * 5;
+ ((big_t *)buf)[u].d1 = (double)u * (double)1.5f;
+ ((big_t *)buf)[u].d2 = (double)u * (double)2.5f;
+ ((big_t *)buf)[u].d3 = (double)u * (double)3.5f;
+ ((big_t *)buf)[u].i1 = (int)(u * 3);
+ ((big_t *)buf)[u].i2 = (int)(u * 5);
((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32);
sprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u);
} /* end for */
@@ -2351,8 +2351,8 @@ test_compound_13(void)
/* Create some phony data. */
HDmemset(&data_out, 0, sizeof(data_out));
for(u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
- data_out.x[u] = u;
- data_out.y = 99.99;
+ data_out.x[u] = (unsigned char)u;
+ data_out.y = 99.99f;
/* Set latest_format in access propertly list to enable the latest
* compound datatype format.
@@ -2966,7 +2966,7 @@ test_compound_16(void)
} cmpd_struct;
cmpd_struct wdata1 = {1254, 5471};
- int obj_count;
+ ssize_t obj_count;
hid_t file;
hid_t cmpd_m_tid, cmpd_f_tid, int_id;
hid_t space_id;
@@ -3003,7 +3003,7 @@ test_compound_16(void)
/* Check behavior of H5Fget_obj_count */
if((obj_count = H5Fget_obj_count(file, H5F_OBJ_DATATYPE)) != 1) {
H5_FAILED(); AT();
- printf(" H5Fget_obj_count returned: %d; expected: 1\n", obj_count);
+ printf(" H5Fget_obj_count returned: %zd; expected: 1\n", obj_count);
goto error;
}
@@ -3737,7 +3737,7 @@ test_named (hid_t fapl)
H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
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);
+ attr_data[i][j] = (unsigned)(i * ds_size[1] + j);
if(H5Awrite(attr1, H5T_NATIVE_UINT, attr_data) < 0) goto error;
if(H5Aclose(attr1) < 0) goto error;
@@ -4282,9 +4282,9 @@ test_conv_str_2(void)
if((f_type = mkstr((size_t)8, H5T_STR_SPACEPAD)) < 0) goto error;
if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8))) goto error;
for(i = 0; i < nelmts; i++) {
- nchars = HDrand() % 8;
+ nchars = (size_t)(HDrand() % 8);
for(j = 0; j < nchars; j++)
- buf[i * 8 + j] = 'a' + HDrand() % 26;
+ buf[i * 8 + j] = (char)('a' + HDrand() % 26);
while(j < nchars)
buf[i * 8 + j++] = '\0';
} /* end for */
@@ -4338,7 +4338,7 @@ test_conv_str_3(void)
const size_t nelmts = NTESTELEM;
size_t i, j, nchars;
int ret_value = 1;
- int size;
+ size_t size;
H5T_pad_t inpad;
H5T_sign_t sign;
char *tag = NULL;
@@ -4353,9 +4353,9 @@ test_conv_str_3(void)
if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8)))
FAIL_PUTS_ERROR("Allocation failed.");
for(i = 0; i < nelmts; i++) {
- nchars = HDrand() % 8;
+ nchars = (size_t)(HDrand() % 8);
for(j = 0; j < nchars; j++)
- buf[i * 8 + j] = 'a' + HDrand() % 26;
+ buf[i * 8 + j] = (char)('a' + HDrand() % 26);
while(j < nchars)
buf[i * 8 + j++] = '\0';
} /* end for */
@@ -4461,7 +4461,7 @@ test_conv_enum_1(void)
if((t2 = H5Tenum_create(H5T_NATIVE_INT)) < 0) goto error;
s[1] = '\0';
for(i = 0; i < 26; i++) {
- s[0] = 'A' + i;
+ s[0] = (char)('A' + i);
H5Tenum_insert(t1, s, &i);
H5Tenum_insert(t2, s, (val = i * 1000 + i, &val));
} /* end for */
@@ -4535,7 +4535,7 @@ test_conv_enum_2(void)
srctype = H5Tenum_create(oddsize);
for (i=7; i>=0; --i) {
char pattern[3];
- pattern[2] = i;
+ pattern[2] = (char)i;
pattern[0] = pattern[1] = 0;
H5Tenum_insert(srctype, mname[i], pattern);
}
@@ -4549,7 +4549,7 @@ test_conv_enum_2(void)
/* Source data */
data = (int*)malloc(NTESTELEM*sizeof(int));
for (i=0; i<NTESTELEM; i++) {
- ((char*)data)[i*3+2] = i % 8;
+ ((char*)data)[i*3+2] = (char)(i % 8);
((char*)data)[i*3+0] = 0;
((char*)data)[i*3+1] = 0;
}
@@ -4695,7 +4695,7 @@ static int
test_bitfield_funcs(void)
{
hid_t type=-1, ntype=-1, super=-1;
- int size;
+ size_t size;
char* tag=0;
H5T_pad_t inpad;
H5T_cset_t cset;
@@ -5016,7 +5016,7 @@ static int
opaque_funcs(void)
{
hid_t type = -1, super=-1;
- int size;
+ size_t size;
H5T_pad_t inpad;
H5T_cset_t cset;
H5T_str_t strpad;
@@ -5920,13 +5920,13 @@ static int
test_int_float_except(void)
{
#if H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4
- float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0, (float)INT_MAX - 32.0,
- (float)INT_MAX - 68.0, (float)4.5};
+ float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f,
+ (float)INT_MAX - 68.0f, (float)4.5f};
int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4};
- float buf_float[CONVERT_SIZE] = {INT_MIN, INT_MAX + 1.0, INT_MAX - 127.0, 4};
+ float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
int *intp; /* Pointer to buffer, as integers */
int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
- float buf2_float[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127.0, (float)0.0};
+ float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
float *floatp; /* Pointer to buffer #2, as floats */
hid_t dxpl; /* Dataset transfer property list */
@@ -7048,7 +7048,8 @@ error:
* 10 November 2011
*-------------------------------------------------------------------------
*/
-int test_utf_ascii_conv(void)
+static int
+test_utf_ascii_conv(void)
{
hid_t fid = -1;
hid_t did = -1;
@@ -7265,7 +7266,7 @@ error:
int
main(void)
{
- unsigned long nerrors = 0;
+ long nerrors = 0;
hid_t fapl = -1;
/* Set the random # seed */
@@ -7338,3 +7339,4 @@ main(void)
return 0;
}
+