summaryrefslogtreecommitdiffstats
path: root/tools/h5jam/h5jamgentest.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-05-17 20:53:42 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-05-17 20:53:42 (GMT)
commita466f168515cc377b9bba00abdc0a2a76bd3b507 (patch)
tree3f62b7d46be02c0137aa26bf6836dc7ced74f164 /tools/h5jam/h5jamgentest.c
parentf5ee10c94f9c178393cca8c560ec73991159aa9f (diff)
downloadhdf5-a466f168515cc377b9bba00abdc0a2a76bd3b507.zip
hdf5-a466f168515cc377b9bba00abdc0a2a76bd3b507.tar.gz
hdf5-a466f168515cc377b9bba00abdc0a2a76bd3b507.tar.bz2
Tools merge from develop-1.10
Diffstat (limited to 'tools/h5jam/h5jamgentest.c')
-rw-r--r--tools/h5jam/h5jamgentest.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index 5f24566..fa8bd4e 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -5,12 +5,10 @@
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
@@ -254,7 +252,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);
@@ -265,7 +263,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);
@@ -281,20 +279,23 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
/* If a user block is being used, write to it here */
if(ub_size > 0)
{
- HDassert(ub_size <= BUF_SIZE);
+ ssize_t nbytes;
- fd = HDopen(filename, O_RDWR, 0);
- HDassert(fd >= 0);
+ HDassert(ub_size <= BUF_SIZE);
- /* fill buf with pattern */
- HDmemset(buf, '\0', ub_size);
- bp = buf;
- for (u = 0; u < ub_fill; u++)
- *bp++ = pattern[u % 10];
+ fd = HDopen(filename, O_RDWR, 0);
+ HDassert(fd >= 0);
- HDwrite(fd, buf, ub_size);
+ /* fill buf with pattern */
+ HDmemset(buf, '\0', ub_size);
+ bp = buf;
+ for (u = 0; u < ub_fill; u++)
+ *bp++ = pattern[u % 10];
- HDclose(fd);
+ nbytes = HDwrite(fd, buf, ub_size);
+ HDassert(nbytes >= 0);
+
+ HDclose(fd);
}
}
@@ -305,10 +306,11 @@ create_textfile(const char *name, size_t size)
int fd;
size_t i;
char *bp;
+ ssize_t nbytes;
fd = HDcreat(name,0777);
HDassert(fd >= 0);
- buf = HDcalloc(size, (size_t)1);
+ buf = (char *)HDcalloc(size, (size_t)1);
HDassert(buf);
/* fill buf with pattern */
@@ -316,7 +318,8 @@ create_textfile(const char *name, size_t size)
for(i = 0; i < size; i++)
*bp++ = pattern[i % 10];
- HDwrite(fd, buf, size);
+ nbytes = HDwrite(fd, buf, size);
+ HDassert(nbytes >= 0);
HDfree(buf);