summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJacob Smith <jake.smith@hdfgroup.org>2019-07-22 22:34:01 (GMT)
committerJacob Smith <jake.smith@hdfgroup.org>2019-07-22 22:34:01 (GMT)
commitded30348ae923a15f287b9a2f49a97ce5ac10da0 (patch)
treee01920853398a2ec1faecab658fa991fde28cd2b /tools
parentc7f8cb011da46e0e764c5da7c2e38b6294756a89 (diff)
downloadhdf5-ded30348ae923a15f287b9a2f49a97ce5ac10da0.zip
hdf5-ded30348ae923a15f287b9a2f49a97ce5ac10da0.tar.gz
hdf5-ded30348ae923a15f287b9a2f49a97ce5ac10da0.tar.bz2
Add copyright/disclaimer to repack gentest.
Minor formatting tweaks.
Diffstat (limited to 'tools')
-rw-r--r--tools/src/h5repack/h5repack_main.c7
-rw-r--r--tools/test/h5repack/h5repackgentest.c74
2 files changed, 45 insertions, 36 deletions
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index b4e5470..a146499 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -416,14 +416,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
int ret_value = 0;
/* parse command line options */
-#if 0
while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) {
-#else
- for (opt = get_option(argc, argv, s_opts, l_opts);
- opt != EOF;
- opt = get_option(argc, argv, s_opts, l_opts))
- {
-#endif
switch ((char) opt) {
/* -i for backward compatibility */
diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c
index 27f6009..c236d71 100644
--- a/tools/test/h5repack/h5repackgentest.c
+++ b/tools/test/h5repack/h5repackgentest.c
@@ -1,5 +1,15 @@
-#include "hdf5.h"
-#include "H5private.h"
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* For generating files for verifying h5repack with external storage. . .
*
@@ -16,11 +26,11 @@
*
* There is no restriction on the name, number, or structure of datasets and
* groups in HDF5 file.
- *
- * The generated files will need to be moved "by hand" into the testfiles
- * directory. (TODO)
*/
+#include "hdf5.h"
+#include "H5private.h"
+
#define MAX_NAME_SIZE 256
#define FILE_INT32LE "h5repack_int32le"
#define FILE_UINT8BE "h5repack_uint8be"
@@ -34,24 +44,27 @@ static void
generate_int32le(hbool_t external)
{
char filename[MAX_NAME_SIZE];
- hid_t file;
- hid_t dset;
+ hid_t file = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5P_DEFAULT;
- hid_t dspace;
+ hid_t dspace = H5I_INVALID_HID;
hsize_t dims[] = {8, 8, 8};
- int32_t wdata[512]; /* 8^3 */
- int32_t n;
- int i;
- int j;
- int k;
- herr_t ret; /* error-checking */
+ int32_t wdata[512]; /* 8^3, from dims */
+ int32_t n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ herr_t ret = FAIL; /* error-checking */
/* generate values, alternating positive and negative
*/
- for (i=0, n=0; i < 8; i++)
- for (j=0; j < 8; j++)
- for (k=0; k < 8; k++, n++)
+ for (i=0, n=0; i < 8; i++) {
+ for (j=0; j < 8; j++) {
+ for (k=0; k < 8; k++, n++) {
wdata[n] = (k + j*512 + i*4096) * ((n&1) ? (-1) : (1));
+ }
+ }
+ }
snprintf(filename,
MAX_NAME_SIZE,
@@ -111,25 +124,28 @@ static void
generate_uint8be(hbool_t external)
{
char filename[MAX_NAME_SIZE];
- hid_t file;
- hid_t dset;
+ hid_t file = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
hid_t dcpl = H5P_DEFAULT;
- hid_t dspace;
+ hid_t dspace = H5I_INVALID_HID;
hsize_t dims[] = {8, 8, 8};
- uint8_t wdata[512]; /* 8^3 */
- uint8_t n;
- int i;
- int j;
- int k;
+ uint8_t wdata[512]; /* 8^3, from dims */
+ uint8_t n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
herr_t ret; /* error-checking */
/* Generate values, alternating positive and negative
* The latter half of the dataset is "overflow garbage" (TODO?)
*/
- for (i=0, n=0; i < 8; i++)
- for (j=0; j < 8; j++)
- for (k=0; k < 8; k++, n++)
+ for (i=0, n=0; i < 8; i++) {
+ for (j=0; j < 8; j++) {
+ for (k=0; k < 8; k++, n++) {
wdata[n] = n * ((n&1) ? (-1) : (1));
+ }
+ }
+ }
snprintf(filename,
MAX_NAME_SIZE,
@@ -192,7 +208,7 @@ generate_uint8be(hbool_t external)
int
main(void)
{
- int i;
+ int i = 0;
for (i=0; i < 2; i++) {
hbool_t external = (i&1) ? TRUE : FALSE;