summaryrefslogtreecommitdiffstats
path: root/test/use_disable_mdc_flushes.c
diff options
context:
space:
mode:
authorKimmy Mu <kmu@hdfgroup.org>2020-01-23 22:21:06 (GMT)
committerkmu <kmu@hdfgroup.org>2020-01-28 02:47:06 (GMT)
commitfe75e8f66f79c16d083d80ccdca303f267e96745 (patch)
tree345d20f70d273b8512aa6cf309a72d7c7b441ab4 /test/use_disable_mdc_flushes.c
parentb87a4362a12428613c2b8bd3ba2aa33828b4d5af (diff)
downloadhdf5-fe75e8f66f79c16d083d80ccdca303f267e96745.zip
hdf5-fe75e8f66f79c16d083d80ccdca303f267e96745.tar.gz
hdf5-fe75e8f66f79c16d083d80ccdca303f267e96745.tar.bz2
Merge pull request #2300 in HDFFV/hdf5 from ~KMU/hdf5:squashed_cast to develop
* commit 'af5c33afabdae2e39bb45eb1b3e9c8366da01145': remove unnecessary stuff squash cast warning fix
Diffstat (limited to 'test/use_disable_mdc_flushes.c')
-rw-r--r--test/use_disable_mdc_flushes.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c
index 9cd202c..32a8244 100644
--- a/test/use_disable_mdc_flushes.c
+++ b/test/use_disable_mdc_flushes.c
@@ -108,7 +108,7 @@ parse_option(int argc, char * const argv[])
filename_g = optarg;
break;
case 'n': /* number of planes to write/read */
- if ((nplanes_g = HDatoi(optarg)) <= 0){
+ if ((nplanes_g = (hsize_t)HDatoi(optarg)) <= 0){
HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
@@ -193,17 +193,17 @@ setup_parameters(int argc, char * const argv[])
return(-1);
}
/* set chunk dims */
- chunkdims_g[0] = chunkplanes_g;
- chunkdims_g[1]= chunkdims_g[2] = chunksize_g;
+ chunkdims_g[0] = (hsize_t)chunkplanes_g;
+ chunkdims_g[1]= chunkdims_g[2] = (hsize_t)chunksize_g;
/* set dataset initial and max dims */
dims_g[0] = 0;
max_dims_g[0] = H5S_UNLIMITED;
- dims_g[1] = dims_g[2] = max_dims_g[1] = max_dims_g[2] = chunksize_g;
+ dims_g[1] = dims_g[2] = max_dims_g[1] = max_dims_g[2] = (hsize_t)chunksize_g;
/* set nplanes */
if (nplanes_g == 0)
- nplanes_g = chunksize_g;
+ nplanes_g = (hsize_t)chunksize_g;
/* show parameters and return */
show_parameters();
@@ -299,7 +299,7 @@ write_file(void)
hid_t dcpl; /* Dataset creation property list */
char *name;
UC_CTYPE *buffer, *bufptr; /* data buffer */
- hsize_t cz=chunksize_g; /* Chunk size */
+ hsize_t cz=(hsize_t)chunksize_g; /* Chunk size */
hid_t f_sid; /* dataset file space id */
hid_t m_sid; /* memory space id */
int rank; /* rank */
@@ -413,8 +413,13 @@ write_file(void)
/* fill buffer with value i+1 */
bufptr = buffer;
for (j=0; j<dims[1]; j++)
- for (k=0; k<dims[2]; k++)
- *bufptr++ = i;
+ for (k=0; k<dims[2]; k++) {
+ if(i > SHRT_MAX) {
+ HDfprintf(stderr, "rank(%d) of dataset overflow\n", rank);
+ return -1;
+ }
+ *bufptr++ = (short)i;
+ }
/* extend the dataset by one for new plane */
dims[0]=i+1;