summaryrefslogtreecommitdiffstats
path: root/tools/h5jam/h5jam.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2017-07-06 19:16:57 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2017-07-06 19:16:57 (GMT)
commit23a702e7bad93fc4f14eab07678c75d276e2d0ad (patch)
treeafb57ddaeca17021342fa09b8999c15569630e71 /tools/h5jam/h5jam.c
parent03dbcb75918b2cbf39800d9edf5665d3471a1fee (diff)
parentc15238a38fdb3692466bc1218de4c5aeb420fdcc (diff)
downloadhdf5-23a702e7bad93fc4f14eab07678c75d276e2d0ad.zip
hdf5-23a702e7bad93fc4f14eab07678c75d276e2d0ad.tar.gz
hdf5-23a702e7bad93fc4f14eab07678c75d276e2d0ad.tar.bz2
Merge pull request #593 in HDFFV/hdf5 from hdf5_1_8_19 to 1.8/masterhdf5-1_8_19
* commit 'c15238a38fdb3692466bc1218de4c5aeb420fdcc': (153 commits) Commit changes to release version strings in README.txt and RELEASE.txt from release. Put back link targets for dynamically loaded libraries in Makefile.ams that avoid linking with libhdf5 dependencies. Some configurations failed unnecessarily to find and link with lz and lsz when these targets were removed. Update URL for obtaining source inINSTALL file. Disable building of libdynlib* dynamically loaded plugin test libraries on CYGWIN. Added known problem entry to RELEASE.txt. Set version for 1.8.19 release. Barbara updated contents of README.txt file. Moved libdynlib* plugin test libraries to noist_LT_LIBRARIES with added flag '-rpath /nowhere' to stop them being installed while keeping them from linking with libhdf5, etc. Incremented version to 1.8.19-pre1 and ran bin/release to create tar and zip files for testing. HDF5 1.8.19-pre1 released. Add RELEASE.txt entry for H5Dget_chunk_size. Remove test entries Ran bin/reconfigure after so number change. Update hl lib .so numbers: new function was added. Update RELEASE.txt: move H5DOread_chunks entry to new features, clarify entry for HDFFV-10051. Updated notes for test fixes and added bug fix for h5diff help text. Update h5vers and release scripts for 1.8.19 branch, set version to 1.8.19-pre1. Make script name consistent across product versions Update version to 1.8.19-pre1. Propagate .so number changes to Makefile.ins with bin/reconfigure. Add toolset option Update so version numbers according to the interface compatibility report. Update supported Platforms section. Remove empty sub-sections of New Features and Bugs Fixed sections. Add entries for HDFFV-10051 and HDFFV-9934 to RELEASE.txt. Correct spelling ...
Diffstat (limited to 'tools/h5jam/h5jam.c')
-rw-r--r--tools/h5jam/h5jam.c202
1 files changed, 86 insertions, 116 deletions
diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c
index ab38f65..b15a18f 100644
--- a/tools/h5jam/h5jam.c
+++ b/tools/h5jam/h5jam.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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "hdf5.h"
@@ -421,109 +419,88 @@ main (int argc, const char *argv[])
* Return: Success: last byte written in the output.
* Failure: Exits program with EXIT_FAILURE value.
*
- * Programmer:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
-copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
+copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
ssize_t limit)
{
- char buf[1024];
- h5_stat_t sbuf;
- int res;
- ssize_t tot = 0;
- ssize_t howmuch = 0;
- ssize_t nchars = -1;
-/* used in assertion check
- ssize_t ncw = -1;
-*/
- ssize_t to;
- ssize_t from;
- ssize_t toend;
- ssize_t fromend;
-
- if(startin > startout) {
- /* this case is prohibited */
- error_msg("copy_some_to_file: panic: startin > startout?\n");
- exit (EXIT_FAILURE);
- }
-
- if(limit < 0) {
- res = HDfstat(infid, &sbuf);
- if(res < 0) {
- error_msg("Can't stat file \n");
- exit (EXIT_FAILURE);
- }
-
- howmuch = (ssize_t)sbuf.st_size;
- }
- else
- howmuch = limit;
-
- if(howmuch == 0)
- return 0;
-
- /* assert (howmuch > 0) */
-
- toend = (ssize_t) startout + howmuch;
- fromend = (ssize_t) startin + howmuch;
-
- if (howmuch > 512)
- {
- to = toend - 512;
- from = fromend - 512;
- }
- else
- {
- to = toend - howmuch;
- from = fromend - howmuch;
- }
-
- while (howmuch > 0)
- {
- HDlseek (outfid, (off_t) to, SEEK_SET);
- HDlseek (infid, (off_t) from, SEEK_SET);
-
- if (howmuch > 512)
- {
- nchars = HDread (infid, buf, (unsigned) 512);
- }
- else
- {
- nchars = HDread (infid, buf, (unsigned)howmuch);
- }
-
- if (nchars <= 0)
- {
- printf ("huh? \n");
- exit (EXIT_FAILURE);
- }
- /*ncw = */ HDwrite (outfid, buf, (unsigned) nchars);
-
- /* assert (ncw == nchars) */
-
- tot += nchars;
- howmuch -= nchars;
- if (howmuch > 512)
- {
- to -= nchars;
- from -= nchars;
- }
- else
- {
- to -= howmuch;
- from -= howmuch;
- }
- }
+ char buf[1024];
+ h5_stat_t sbuf;
+ int res;
+ ssize_t tot = 0;
+ ssize_t howmuch = 0;
+ ssize_t nchars = -1;
+ ssize_t to;
+ ssize_t from;
+ ssize_t toend;
+ ssize_t fromend;
+
+ if(startin > startout) {
+ /* this case is prohibited */
+ error_msg("copy_some_to_file: panic: startin > startout?\n");
+ exit (EXIT_FAILURE);
+ } /* end if */
+
+ if(limit < 0) {
+ res = HDfstat(infid, &sbuf);
+ if(res < 0) {
+ error_msg("Can't stat file \n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ howmuch = (ssize_t)sbuf.st_size;
+ } else {
+ howmuch = limit;
+ } /* end if */
+
+ if(0 == howmuch)
+ return 0;
+
+ toend = (ssize_t) startout + howmuch;
+ fromend = (ssize_t) startin + howmuch;
+
+ if (howmuch > 512) {
+ to = toend - 512;
+ from = fromend - 512;
+ } else {
+ to = toend - howmuch;
+ from = fromend - howmuch;
+ } /* end if */
+
+ while (howmuch > 0) {
+ HDlseek(outfid, (off_t) to, SEEK_SET);
+ HDlseek(infid, (off_t) from, SEEK_SET);
+
+ if (howmuch > 512) {
+ nchars = HDread(infid, buf, (unsigned) 512);
+ } else {
+ nchars = HDread(infid, buf, (unsigned)howmuch);
+ } /* end if */
+
+ if (nchars <= 0) {
+ error_msg("Read error \n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ if(HDwrite (outfid, buf, (unsigned) nchars) < 0) {
+ error_msg("Write error \n");
+ HDexit(EXIT_FAILURE);
+ }
- /* assert howmuch == 0 */
- /* assert tot == limit */
+ tot += nchars;
+ howmuch -= nchars;
+ if(howmuch > 512) {
+ to -= nchars;
+ from -= nchars;
+ } else {
+ to -= howmuch;
+ from -= howmuch;
+ } /* end if */
+ } /* end while */
- return ((hsize_t) tot + (hsize_t) startout);
-}
+ return (hsize_t)tot + (hsize_t)startout;
+} /* end copy_some_to_file() */
/*-------------------------------------------------------------------------
@@ -539,28 +516,21 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
*
* Return: Success: last byte written in the output.
* Failure: Exits program with EXIT_FAILURE value.
- *
- * Programmer:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
compute_user_block_size (hsize_t ublock_size)
{
- hsize_t where = 512;
+ hsize_t where = 512;
- if (ublock_size == 0)
- return 0;
+ if(0 == ublock_size)
+ return 0;
- while (where < ublock_size)
- {
- where *= 2;
- }
+ while(where < ublock_size)
+ where *= 2;
- return (where);
-}
+ return where;
+} /* end compute_user_block_size() */
/*
* Write zeroes to fill the file from 'where' to 512, 1024, etc. bytes.