summaryrefslogtreecommitdiffstats
path: root/tools/test/h5jam
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /tools/test/h5jam
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'tools/test/h5jam')
-rw-r--r--tools/test/h5jam/getub.c73
-rw-r--r--tools/test/h5jam/h5jamgentest.c395
-rw-r--r--tools/test/h5jam/tellub.c62
3 files changed, 258 insertions, 272 deletions
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c
index f496a7a..9e9cd4d 100644
--- a/tools/test/h5jam/getub.c
+++ b/tools/test/h5jam/getub.c
@@ -21,11 +21,9 @@ void parse_command_line(int argc, const char *argv[]);
#define PROGRAM_NAME "getub"
char *nbytes = NULL;
-static const char *s_opts = "c:"; /* add more later ? */
-static struct long_options l_opts[] = {
- {"c", require_arg, 'c'}, /* input file */
- {NULL, 0, '\0'}
-};
+static const char * s_opts = "c:"; /* add more later ? */
+static struct long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -36,7 +34,7 @@ static struct long_options l_opts[] = {
*-------------------------------------------------------------------------
*/
static void
-usage (const char *prog)
+usage(const char *prog)
{
HDfflush(stdout);
HDfprintf(stdout, "usage: %s -c nb file] \n", prog);
@@ -59,33 +57,33 @@ parse_command_line(int argc, const char *argv[])
int opt;
/* parse command line options */
- while((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) {
- switch((char) opt) {
- case 'c':
- nbytes = HDstrdup(opt_arg);
- break;
- case '?':
- default:
- usage(h5tools_getprogname());
- HDexit(EXIT_FAILURE);
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
+ case 'c':
+ nbytes = HDstrdup(opt_arg);
+ break;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
} /* end switch */
- } /* end while */
+ } /* end while */
- if(argc <= opt_ind) {
- error_msg("missing file name\n");
- usage(h5tools_getprogname());
- HDexit(EXIT_FAILURE);
+ if (argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
} /* end if */
} /* end parse_command_line() */
int
main(int argc, const char *argv[])
{
- int fd = H5I_INVALID_HID;
+ int fd = H5I_INVALID_HID;
unsigned size;
- char *filename = NULL;
- long res;
- char *buf = NULL;
+ char * filename = NULL;
+ long res;
+ char * buf = NULL;
h5tools_setprogname(PROGRAM_NAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -95,14 +93,14 @@ main(int argc, const char *argv[])
parse_command_line(argc, argv);
- if(NULL == nbytes) {
+ if (NULL == nbytes) {
/* missing arg */
error_msg("missing size\n");
usage(h5tools_getprogname());
goto error;
} /* end if */
- if(argc <= (opt_ind)) {
+ if (argc <= (opt_ind)) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
goto error;
@@ -111,30 +109,30 @@ main(int argc, const char *argv[])
filename = HDstrdup(argv[opt_ind]);
size = 0;
- if(EOF == (res = sscanf(nbytes, "%u", &size))) {
- /* fail */
- error_msg("missing file name\n");
- usage(h5tools_getprogname());
- goto error;
+ if (EOF == (res = sscanf(nbytes, "%u", &size))) {
+ /* fail */
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ goto error;
} /* end if */
- if((fd = HDopen(filename, O_RDONLY, 0)) < 0) {
+ if ((fd = HDopen(filename, O_RDONLY, 0)) < 0) {
error_msg("can't open file %s\n", filename);
goto error;
} /* end if */
- if(NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) {
+ if (NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) {
error_msg("can't allocate buffer \n");
goto error;
} /* end if */
res = HDread(fd, buf, (unsigned)size);
- if(res < (long)size) {
+ if (res < (long)size) {
error_msg("Bad read \n");
goto error;
} /* end if */
- if(HDwrite(1, buf, (unsigned)size) < 0) {
+ if (HDwrite(1, buf, (unsigned)size) < 0) {
error_msg("Bad write \n");
goto error;
} /* end if */
@@ -146,10 +144,9 @@ main(int argc, const char *argv[])
return EXIT_SUCCESS;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- if(fd >= 0)
+ if (fd >= 0)
HDclose(fd);
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c
index 56b4ead..aac226e 100644
--- a/tools/test/h5jam/h5jamgentest.c
+++ b/tools/test/h5jam/h5jamgentest.c
@@ -1,4 +1,4 @@
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
@@ -64,31 +64,24 @@ char pattern[11] = "abcdefghij";
*-------------------------------------------------------------------------
*/
-
#define BUF_SIZE 1024
/* Element selection information */
-typedef enum{
- RED,
- GREEN,
- BLUE,
- WHITE,
- BLACK
-} enumtype;
+typedef enum { RED, GREEN, BLUE, WHITE, BLACK } enumtype;
/* Compound datatype */
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
-
/* A UD link traversal function. Shouldn't actually be called. */
-static hid_t UD_traverse(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED cur_group,
- const void H5_ATTR_UNUSED * udata, size_t H5_ATTR_UNUSED udata_size, hid_t H5_ATTR_UNUSED lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id)
+static hid_t
+UD_traverse(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED cur_group,
+ const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t H5_ATTR_UNUSED lapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id)
{
return -1;
}
@@ -106,8 +99,6 @@ const H5L_class_t UD_link_class[1] = {{
NULL /* Query callback */
}};
-
-
/* gent_ub
with no ub, identical to gent_all from h5dumpgentest.c
@@ -126,184 +117,188 @@ g2 : dset2.1 dset2.2 udlink
*/
static void
-gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
+gent_ub(const char *filename, size_t ub_size, size_t ub_fill)
{
- hid_t fid, group, attr, dataset, space;
- hid_t create_plist;
+ hid_t fid, group, attr, dataset, space;
+ hid_t create_plist;
hsize_t dims[2];
- int data[2][2], dset1[10][10], dset2[20];
- char buf[BUF_SIZE];
- int i, j;
- size_t u;
- float dset2_1[10], dset2_2[3][5];
- int fd;
- char *bp;
-
- if(ub_size > 0)
- {
- create_plist = H5Pcreate(H5P_FILE_CREATE);
- H5Pset_userblock(create_plist, (hsize_t)ub_size);
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
- }
- else
- {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- }
-
- /* create groups */
- group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- /* root attributes */
- group = H5Gopen2(fid, "/", H5P_DEFAULT);
-
- dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(buf, "abcdefghi");
- H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
- H5Sclose(space);
- H5Aclose(attr);
-
- dims[0] = 2; dims[1] = 2;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
- H5Awrite(attr, H5T_NATIVE_INT, data);
- H5Sclose(space);
- H5Aclose(attr);
-
- H5Gclose(group);
-
- group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT);
-
- /* dset1.1.1 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- dset1[i][j] = j*i;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
- H5Sclose(space);
-
- /* attributes of dset1.1.1 */
- dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(buf, "1st attribute of dset1.1.1");
- H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
- H5Sclose(space);
- H5Aclose(attr);
-
- dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(buf, "2nd attribute of dset1.1.1");
- H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
- H5Sclose(space);
- H5Aclose(attr);
-
- H5Dclose(dataset);
-
- /* dset1.1.2 */
- dims[0] = 20;
- space = H5Screate_simple(1, dims, NULL);
- dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for (i = 0; i < 20; i++)
- dset2[i] = i;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
- H5Sclose(space);
- H5Dclose(dataset);
-
- H5Gclose(group);
-
- /* external link */
- H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT);
-
- /* soft link */
- group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT);
- H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gopen2(fid, "/g2", H5P_DEFAULT);
-
- /* dset2.1 */
- dims[0] = 10;
- 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)((float)i * 0.1F + 1.0F);
- H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
- H5Sclose(space);
- H5Dclose(dataset);
-
- /* dset2.2 */
- dims[0] = 3; dims[1] = 5;
- space = H5Screate_simple(2, dims, NULL);
- 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++)
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[BUF_SIZE];
+ int i, j;
+ size_t u;
+ float dset2_1[10], dset2_2[3][5];
+ int fd;
+ char * bp;
+
+ if (ub_size > 0) {
+ create_plist = H5Pcreate(H5P_FILE_CREATE);
+ H5Pset_userblock(create_plist, (hsize_t)ub_size);
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
+ }
+ else {
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ }
+
+ /* create groups */
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* root attributes */
+ group = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ dims[0] = 10;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ HDsprintf(buf, "abcdefghi");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ dims[0] = 2;
+ dims[1] = 2;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0;
+ data[0][1] = 1;
+ data[1][0] = 2;
+ data[1][1] = 3;
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT);
+
+ /* dset1.1.1 */
+ dims[0] = 10;
+ dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ dset1[i][j] = j * i;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Sclose(space);
+
+ /* attributes of dset1.1.1 */
+ dims[0] = 27;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ HDsprintf(buf, "1st attribute of dset1.1.1");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ dims[0] = 27;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ HDsprintf(buf, "2nd attribute of dset1.1.1");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Dclose(dataset);
+
+ /* dset1.1.2 */
+ dims[0] = 20;
+ space = H5Screate_simple(1, dims, NULL);
+ dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 20; i++)
+ dset2[i] = i;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ H5Gclose(group);
+
+ /* external link */
+ H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT);
+
+ /* soft link */
+ group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT);
+ H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g2", H5P_DEFAULT);
+
+ /* dset2.1 */
+ dims[0] = 10;
+ 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)((float)i * 0.1F + 1.0F);
+ H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* dset2.2 */
+ dims[0] = 3;
+ dims[1] = 5;
+ space = H5Screate_simple(2, dims, NULL);
+ 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)(((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);
+ H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
+ H5Sclose(space);
+ H5Dclose(dataset);
- H5Gclose(group);
+ H5Gclose(group);
- /* user-defined link */
- H5Lregister(UD_link_class);
- H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ /* user-defined link */
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
- H5Fclose(fid);
+ H5Fclose(fid);
- /* If a user block is being used, write to it here */
- if(ub_size > 0) {
- HDassert(ub_size <= BUF_SIZE);
+ /* If a user block is being used, write to it here */
+ if (ub_size > 0) {
+ HDassert(ub_size <= BUF_SIZE);
- fd = HDopen(filename, O_RDWR);
- HDassert(fd >= 0);
+ fd = HDopen(filename, O_RDWR);
+ HDassert(fd >= 0);
- /* fill buf with pattern */
- HDmemset(buf, '\0', ub_size);
- bp = buf;
- for (u = 0; u < ub_fill; u++)
- *bp++ = pattern[u % 10];
+ /* fill buf with pattern */
+ HDmemset(buf, '\0', ub_size);
+ bp = buf;
+ for (u = 0; u < ub_fill; u++)
+ *bp++ = pattern[u % 10];
- HDwrite(fd, buf, ub_size);
+ HDwrite(fd, buf, ub_size);
- HDclose(fd);
- }
+ HDclose(fd);
+ }
}
static void
create_textfile(const char *name, size_t size)
{
- char *buf;
- int fd;
+ char * buf;
+ int fd;
size_t i;
- char *bp;
+ char * bp;
- fd = HDcreat(name,0777);
+ fd = HDcreat(name, 0777);
HDassert(fd >= 0);
buf = (char *)HDcalloc(size, (size_t)1);
HDassert(buf);
/* fill buf with pattern */
bp = buf;
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
*bp++ = pattern[i % 10];
HDwrite(fd, buf, size);
@@ -319,22 +314,22 @@ void
create_binfile(char *name, off_t size)
{
char *buf;
- int fd;
- int i;
+ int fd;
+ int i;
char *bp;
- fd = creat(name,0777);
+ fd = creat(name, 0777);
HDassert(fd >= 0);
- buf = HDcalloc(size,1);
+ buf = HDcalloc(size, 1);
HDassert(buf);
/* fill buf with pattern */
bp = buf;
for (i = 0; i < size; i++)
- *bp++ = (char) i & 0xff;
+ *bp++ = (char)i & 0xff;
- HDwrite(fd,buf,size);
+ HDwrite(fd, buf, size);
HDclose(fd);
}
@@ -346,32 +341,32 @@ create_binfile(char *name, off_t size)
*-------------------------------------------------------------------------
*/
-
-int main(void)
+int
+main(void)
{
-/*
-create_textfile(UBTXT1, (size_t)0);
-*/
-create_textfile(UBTXT2, (size_t)10);
-create_textfile(UBTXT3, (size_t)511);
-create_textfile(UBTXT4, (size_t)512);
-create_textfile(UBTXT5, (size_t)513);
-/*
-create_textfile(UBTXT6, (size_t)1023);
-create_textfile(UBTXT7, (size_t)1024);
-create_textfile(UBTXT8, (size_t)1025);
-create_textfile(UBTXT9, (size_t)2047);
-create_textfile(UBTXT10, (size_t)2048);
-create_textfile(UBTXT11, (size_t)2049);
-
-create_binfile(UBBIN1, (off_t)0);
-create_binfile(UBBIN2, (off_t)10);
-create_binfile(UBBIN3, (off_t)511);
-create_binfile(UBBIN4, (off_t)512);
-create_binfile(UBBIN5, (off_t)513);
-
-*/
+ /*
+ create_textfile(UBTXT1, (size_t)0);
+ */
+ create_textfile(UBTXT2, (size_t)10);
+ create_textfile(UBTXT3, (size_t)511);
+ create_textfile(UBTXT4, (size_t)512);
+ create_textfile(UBTXT5, (size_t)513);
+ /*
+ create_textfile(UBTXT6, (size_t)1023);
+ create_textfile(UBTXT7, (size_t)1024);
+ create_textfile(UBTXT8, (size_t)1025);
+ create_textfile(UBTXT9, (size_t)2047);
+ create_textfile(UBTXT10, (size_t)2048);
+ create_textfile(UBTXT11, (size_t)2049);
+
+ create_binfile(UBBIN1, (off_t)0);
+ create_binfile(UBBIN2, (off_t)10);
+ create_binfile(UBBIN3, (off_t)511);
+ create_binfile(UBBIN4, (off_t)512);
+ create_binfile(UBBIN5, (off_t)513);
+
+ */
gent_ub(FILE7, (size_t)0, (size_t)0);
gent_ub(FILE8, (size_t)512, HDstrlen(pattern));
gent_ub(FILE9, (size_t)1024, (size_t)513);
diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c
index 453444d..afb7e95 100644
--- a/tools/test/h5jam/tellub.c
+++ b/tools/test/h5jam/tellub.c
@@ -24,12 +24,8 @@
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "h";
-static struct long_options l_opts[] = {
- {"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {NULL, 0, '\0'}
-};
+static const char * s_opts = "h";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -40,12 +36,11 @@ static struct long_options l_opts[] = {
*-------------------------------------------------------------------------
*/
static void
-usage (const char *prog)
+usage(const char *prog)
{
HDfflush(stdout);
HDfprintf(stdout, "usage: %s h5_file\n", prog);
- HDfprintf(stdout,
- " Check that h5_fil is HDF5 file and print size of user block \n");
+ HDfprintf(stdout, " Check that h5_fil is HDF5 file and print size of user block \n");
HDfprintf(stdout, " %s -h\n", prog);
HDfprintf(stdout, " Print a usage message and exit\n");
} /* end usage() */
@@ -61,20 +56,20 @@ usage (const char *prog)
*/
static void
-parse_command_line (int argc, const char *argv[])
+parse_command_line(int argc, const char *argv[])
{
int opt;
/* parse command line options */
- while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) {
- switch ((char) opt) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'h':
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
break;
case '?':
default:
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
}
}
@@ -82,7 +77,7 @@ parse_command_line (int argc, const char *argv[])
/* check for file name to be processed */
if (argc <= opt_ind) {
error_msg("missing file name\n");
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
}
} /* end parse_command_line() */
@@ -90,8 +85,8 @@ parse_command_line (int argc, const char *argv[])
static void
leave(int ret)
{
- h5tools_close();
- HDexit(ret);
+ h5tools_close();
+ HDexit(ret);
}
/*-------------------------------------------------------------------------
@@ -103,14 +98,14 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- char *ifname;
- hid_t ifile = H5I_INVALID_HID;
+ char * ifname;
+ hid_t ifile = H5I_INVALID_HID;
hsize_t usize;
- htri_t testval;
- herr_t status;
- hid_t plist = H5I_INVALID_HID;
+ htri_t testval;
+ herr_t status;
+ hid_t plist = H5I_INVALID_HID;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -123,9 +118,9 @@ main (int argc, const char *argv[])
/* enable error reporting if command line option */
h5tools_error_report();
- if(argc <= (opt_ind)) {
+ if (argc <= (opt_ind)) {
error_msg("missing file name\n");
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -134,7 +129,7 @@ main (int argc, const char *argv[])
testval = H5Fis_accessible(ifname, H5P_DEFAULT);
- if(testval <= 0) {
+ if (testval <= 0) {
error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -142,33 +137,32 @@ main (int argc, const char *argv[])
ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(ifile < 0) {
+ if (ifile < 0) {
error_msg("Can't open input HDF5 file \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
plist = H5Fget_create_plist(ifile);
- if(plist < 0) {
+ if (plist < 0) {
error_msg("Can't get file creation plist for file \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
status = H5Pget_userblock(plist, &usize);
- if(status < 0) {
+ if (status < 0) {
error_msg("Can't get user block for file \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- HDprintf("%ld\n", (long) usize);
+ HDprintf("%ld\n", (long)usize);
done:
- H5Pclose (plist);
- if(ifile >= 0)
- H5Fclose (ifile);
+ H5Pclose(plist);
+ if (ifile >= 0)
+ H5Fclose(ifile);
leave(h5tools_getstatus());
} /* end main() */
-