summaryrefslogtreecommitdiffstats
path: root/tools/src/h5jam
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-08-23 21:12:40 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-08-23 21:12:40 (GMT)
commitb82ba32275f7ed998aafa68a1cecaab3e80323da (patch)
tree2e27f8701a0f4223a6a43c85087a963bf372b2d5 /tools/src/h5jam
parent1b647b18fee735086616bf99e1879e47bab0c72e (diff)
downloadhdf5-b82ba32275f7ed998aafa68a1cecaab3e80323da.zip
hdf5-b82ba32275f7ed998aafa68a1cecaab3e80323da.tar.gz
hdf5-b82ba32275f7ed998aafa68a1cecaab3e80323da.tar.bz2
HDFFV-10282 refactor out assert calls in tools
Diffstat (limited to 'tools/src/h5jam')
-rw-r--r--tools/src/h5jam/h5jam.c13
-rw-r--r--tools/src/h5jam/h5unjam.c54
2 files changed, 33 insertions, 34 deletions
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index a403cf1..8c15686 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -73,13 +73,13 @@ usage (const char *prog)
HDfprintf (stdout,
"Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
HDfprintf (stdout, "\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
"OPTIONS\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
" -i in_file.h5 Specifies the input HDF5 file.\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
" -u in_user_file Specifies the file to be inserted into the user block.\n");
- HDfprintf (stdout,
+ HDfprintf (stdout,
" Can be any file format except an HDF5 format.\n");
HDfprintf (stdout,
" -o out_file.h5 Specifies the output HDF5 file.\n");
@@ -392,7 +392,7 @@ main (int argc, const char *argv[])
HDfree (input_file);
if(output_file)
HDfree (output_file);
-
+
if(ufid >= 0)
HDclose (ufid);
if(h5fid >= 0)
@@ -548,7 +548,8 @@ write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
char buf[1];
hsize_t psize;
- HDassert(new_where);
+ if(new_where == NULL)
+ return FAIL;
buf[0] = '\0';
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index 1cc8cb3..4e9798e 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -133,28 +133,28 @@ static int
parse_command_line(int argc, const char *argv[])
{
int opt = FALSE;
-
+
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch((char)opt) {
case 'o':
output_file = HDstrdup(opt_arg);
- if (output_file)
- h5tools_set_data_output_file(output_file, 1);
- break;
+ if (output_file)
+ h5tools_set_data_output_file(output_file, 1);
+ break;
case 'i':
input_file = HDstrdup(opt_arg);
- if (input_file)
- h5tools_set_input_file(input_file, 1);
- break;;
+ if (input_file)
+ h5tools_set_input_file(input_file, 1);
+ break;;
case 'u':
ub_file = HDstrdup(opt_arg);
- if (ub_file)
- h5tools_set_output_file(ub_file, 1);
- else
- rawoutstream = stdout;
+ if (ub_file)
+ h5tools_set_output_file(ub_file, 1);
+ else
+ rawoutstream = stdout;
break;
case 'd':
@@ -180,7 +180,7 @@ parse_command_line(int argc, const char *argv[])
}
return EXIT_SUCCESS;
-
+
done:
if(input_file)
HDfree(input_file);
@@ -240,7 +240,7 @@ main(int argc, const char *argv[])
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
-
+
testval = H5Fis_hdf5(input_file);
if (testval <= 0) {
@@ -272,10 +272,8 @@ main(int argc, const char *argv[])
goto done;
}
- status = H5Pclose(plist);
- HDassert(status >= 0);
- status = H5Fclose(ifile);
- HDassert(status >= 0);
+ H5Pclose(plist);
+ H5Fclose(ifile);
if (usize == 0) {
/* no user block to remove: message? */
@@ -303,7 +301,7 @@ main(int argc, const char *argv[])
error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
/* copy from 0 to 'usize - 1' into ufid */
if (!do_delete) {
@@ -321,18 +319,18 @@ main(int argc, const char *argv[])
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
-
+
done:
if(input_file)
HDfree(input_file);
-
+
if(output_file)
HDfree(output_file);
-
+
if(ub_file) {
HDfree(ub_file);
}
-
+
h5tools_close();
return h5tools_getstatus();
@@ -374,7 +372,7 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
else
bytes_in = how_much;
- /* Seek to correct position in input file */
+ /* Seek to correct position in input file */
HDfseek(infid, from, SEEK_SET);
/* Read data to buffer */
@@ -396,11 +394,11 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
to += (off_t)bytes_read;
/* Write nchars bytes to output file */
- bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
- if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
- ret_value = -1;
- goto done;
- } /* end if */
+ bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
+ if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
+ ret_value = -1;
+ goto done;
+ } /* end if */
} /* end while */
done: