Commit Graph

28 Commits

Author SHA1 Message Date
Allen Byrne
ba181d404d [svn-r23952] Update unjam file handling to eliminate infinite loops and use binary mode.
Tested: windows
2013-07-31 11:10:33 -05:00
Peter Cao
5b6ae0b603 [svn-r23945] fixed HDFFV-8306
using file stream for output data
2013-07-30 14:23:24 -05:00
Jonathan Kim
d7a07d62a4 [svn-r23228] Purpose:
Revert back one of the coverity updates from previous checkin. "r20457: Coverity issue 691" in previous svn log.  Only revert the change about using "STDOUT_FILENO".

Description:
    Using "STDOUT_FILENO" caused error on Windows. On unix it's defined in <unistd.h>, but not in Windows.  After a little discussion with Allen, he remembered how the similar case were handled for h5dump redirecting those streams. (in h5dump.c) However it would requires more attention to apply, so this issue is entered as a separate task in jira HDDFV-8306.

    
Tested: 
    jam (linux32-LE), koala (linux64-LE), ostrich (linuxppc64-BE), fred (mac64-LE)
2013-02-05 11:09:45 -05:00
Quincey Koziol
a3e98d0e36 [svn-r23219] Description:
Bring reviewed changes from Coverity branch back to trunk (QK & JK):

r20457:
Coverity issue 691: return of H5duo could be negative. Fixed by using
STDOUT_FILENO and redesign parse_command_line and main to cleanup file
allocations. The output_file var is null when using stdout. In cleanup do not
close output_file if NULL.

r20510:
Initialize ufid = -1 and predicate HDclose call on ufid != -1

r20511:
Purpose: Fix coverity issue 1715

Description: Free "file" and nested data on failure in H5FD_core_open.

r20512:
Initialize ifid = -1 and predicate HDclose call on ifid != -1

r20514:
Initialize h5fid = -1 and predicate HDclose call on h5fid != -1

r20516:
Added else branch to the if (ret_value < 0) check.

r20522:
Addressed coverity issues 930-933, 850, 836, 835, 1307.  All minor 
potential buffer overwrite bugs, or coverity errors.  Fixed by replacing
strcpy and sprintf with strncpy and snprintf.

r20523:
fixed coverity issues 68, 1120, 1116i

r20524:
Check  H5Z_SZIP->encoder_present < 1 assuming 0 represents absence.

r20601:
Purpose: Fix coverity issues 1703-1705

Description: Modified the cleanup code in test_free in accum.c to reset
allocated buffers to NULL after they are freed, and modified the error cleanup
code to check if these buffers are NULL before freeing them.  Also fixed some
unrelated warnings in accum.c.

r20602:
Use HDsnprintf and HDstrncat

r20603:
Purpose: Fix coverity issues 808-809

Description: Modified test_core in vfd.c to check the returns from malloc, and
keep track of whether points and check are allocated by setting them to NULL
when they are not.  Added code to free points and check on error if they are
not NULL.  Also fixed unrelated warnings in vfd.c.

r20604:
Use HDstrncpy.

r20605:
Use HDstrncpy and HDstrncat.

r20606:
Purpose: Fix coverity issue 807

Description: Modified long_compact in stab.c to keep track of whether objname is
allocated by setting it to NULL when it is not.  Added code to free objname on
error if it is not NULL.

r20607:
Changed string function calls to use versions that specify the string length
to fix coverity issues 832 and 839.


Tested on:
    Mac OSX/64 10.8.2 (amazon)
    (Too minor to require h5committest)
2013-02-01 20:53:32 -05:00
Jonathan Kim
41b9ce962a [svn-r22300] Purpose:
Fix for HDFFV-8001 - h5unjam: segfault when used -V (show version) option

Description:
  h5unjam has an option '-V' to display version information.
  "h5unjam -V" caused segfulat for 1.8.9 pre-release.

Tested:
  jam (linux32-LE), koala (linux64-LE), ostrich (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE),  Windows (32-LE cmake), Cmake (jam)
2012-04-19 16:38:07 -05:00
Allen Byrne
df6c92e506 [svn-r22004] Reduced warnings and fixed conflicts resulting from including h5tools.h
Tested: local linux
2012-02-28 13:26:34 -05:00
Allen Byrne
827cbbba31 [svn-r21982] Correct HD prefix in tools for exit
Checked for HD support.
2012-02-24 10:45:54 -05:00
Jonathan Kim
e703a6a2a4 [svn-r21236] Purpose:
Work for:
   HDFFV-7515 - GMQS: h5unjam - incorrect help page and should display when 
   no file is given.
   and
   HDFFV-5941 - h5jam: specifying a user block file with a proper HDF5 magic
   number will result in a corrupted HDF5 file.


Description:
   - Revised command help pages of h5jam and h5unjam. The descriptions
     were not up to date and some were missing. (HDFFV-7515)
   - Fixed h5jam not to allow specifying an HDF5 formatted file as input 
     file for -u (user block file) option, because the original HDF5 file 
     will not be accessible if allows. (HDFFV-5941)

Tested:
    jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Cmake (jam, Wondows)
2011-08-16 15:41:47 -05:00
Allen Byrne
f49dc38127 [svn-r20796] Refactor print_data_region_blocks/ponts to remove context passed in by value. The print functions needed an independent context with only the current indent level passed in by argument. Also synched the two routines logical flows and corrected a mem_space error.
h5dump (and h5stat, h5jam/h5unjam) help option not tested. Added h5dump parse_command_line technique for h5stat and h5jam/unjam and created testfiles.

Tested: local linux
2011-05-11 15:45:54 -05:00
Allen Byrne
b2120ac993 [svn-r20310] Change incorrect use of "struct stat" to use "h5_stat_t". On windows, this used the wrong structure and caused crashes. Also removed includes from top of file - they are included with proper config checks in h5private.h.
Tested: local linux, windows
2011-03-24 10:32:58 -05:00
Quincey Koziol
575469a6a7 [svn-r20065] Description:
Bring changes from Coverity branch to trunk:

r19975:
Fixed potential mem leak at H5O_attr_open_by_name

r19980:
Fix coverity issue 792.
Free tmp_env_prefix in H5Lexternal.c line 365 if it is not NULL but its contents are 0 when it goes out of scope.

r20039:
Eliminate warnings about nested extern and implicit declarations of parallel_print and address Coverity defects 712-781 by #including h5tools_utils.h in h5diff_array.c, h5diff_attr.c, h5diff_dset.c and h5diff_util.c.

r20046:
Purpose: Address TOCTOU warnings in h5jam and h5unjam

Description: Coverity is afraid that the state of the input file could change
between the call to stat() and the call to open().  This is called a time-of-
check time-of-use (TOCTOU) vulnerability.  Modified stat calls to fstat which
uses an open file pointer so it (hopefully) won't complain any more.

r20047:
Addressed coverity issues 135-137, 462-464.  Local pointers that needed to be freed in case of error were moved out of a switch statement in src/H5Tnative.c, set to NULL, and checked before freeing.

Tested on:
    Mac OS X/32 10.6.6 (amazon) w/debug & production
    (h5committested on Coverity branch)
2011-02-08 16:35:54 -05:00
Raymond Lu
1c61b6fe13 [svn-r19481] I'm backing out my fix for bug 1707 because there're some unresolved issues - r19441 and 19467.
Bug 1707 is that H5Eset_auto causes a seg fault when an application uses -DH5_USE_16_API with 
the 1.8 library to compile.  

I created a branch off the trunk called set_auto to continue working on the problem.

Tested on jam - backing out, simple.
2010-09-27 14:02:48 -05:00
Raymond Lu
d6c6a34a8f [svn-r19457] Bug fix for 1707 - H5Eset_auto causes a seg fault when an application uses -DH5_USE_16_API with the 1.8 library to compile. The cause is from the mismatch of H5Eprint1 and H5Eprint2 set
through H5Eset_auto.  I changed the union in the structure H5E_auto_t.  Another change is to 
make H5Eget_auto fail if H5Eset_auto is called to set the printing function.  I'll write a 
document for it.

Tested on heiwa, jam, and amani.

The property change in configure.in, config, and Makefile.am came from the merge of the 1.8 
library change.
2010-09-21 11:46:38 -05:00
Allen Byrne
68fa42f336 [svn-r18759] pull r18757 from 1.8 branch
Enable tools lib to be built as a dll on windows. Added two get/set functions for progname and d_status.
Also add windows import/export declarations to functions.
Updated error_mesg() and warn_mesg() to remove progname argument and use get functions

Tested:
   Windows, linux
2010-05-11 15:10:25 -05:00
Quincey Koziol
c462a2ec1f [svn-r18212] Description:
Bring revisions from Coverity fixing branch to trunk:

r18184:
Fixed Coverity issue 373.  Allocated memory freed in line 762 in case of error.

r18185:
Fixed Coverity issues 357 & 358.  Added check for NULL pointer before use.

r18186:
Fix coverity item 65.   Added code to h5unjam to correctly handle failures in
read() and write, and also to correctly handle writes that write less than
requested.

r18187:
Fix coverity items 115 and 116.   Added code to H5Tenum.c to correctly close
opened datatypes in case of failure.

r18188:
Fixed Coverity issue 46.  Check that dataset->shared is not null when freeing
memory after error.

r18190:
Fix coverity item 95.   Added code to H5T_create_vlen to correctly close
allocated datatype in case of failure.

r18191:
Fixed Coverity error 59.  Checked sfirst for -1 value before use in line 10533.

r18192:
Fix Coverity items 121 and 28

Added Asserts:
121: assert that all dimensions of count have values greater than zero.
28: assert curr_span pointer is not null before dereference.

Note: still need too add checks in hyperslab APIs that fail
     when count values are zero, and appropriate tests.

r18194:
Fixed Coverity issues 61 & 62. Checked variable snpoints for value < 0 in line
218.

Tested on:
    Mac OS X/32 10.6.2 (amazon) w/debug & production
    (already daily tested on coverity branch)
2010-02-04 21:56:25 -05:00
Scott Wegner
532e23b808 [svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead.  This way, we can map special versions of the call on particular systems.  Previously, it was all done in H5private.h.  However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h.  This way, we can use the non-Posix versions that Visual Studio sends warnings about.

Some macros are set specifically in the platform-specific header files.  Then, any macros left unset will be set by the "default" implementation in H5private.h.

This checkin also cleans up various source files to use the HD* macros when possible.

Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-05 13:52:19 -05:00
Pedro Vicente Nunes
c57f03ad75 [svn-r14236] new feature: add a -V option to h5unjam
tested: linux
2007-11-05 14:05:10 -05:00
Scott Wegner
eb16d8bc2b [svn-r14114] Purpose: Fix a subtle Windows bug in h5unjam
Description:
In h5unjam.c, there was a call to "open", rather than "HDopen".  This isn't a problem on most platforms, as the are equivalent.  However, on Windows, we use the HDopen macro to unconditionally set the O_BINARY flag.  This is needed to safely seek within a file.

Tested:
VS2005 on WinXP
h5committest (kagiso linew smirom)
2007-08-27 17:35:50 -05:00
Quincey Koziol
d6bb18abbc [svn-r13648] Description:
Rename new error handling API routines from H5E<foo>_stack() to
H5E<foo>2().

Tested on:
    Mac OS X/32 10.4.9 (amazon)
    FreeBSD/32 6.2 (duty)
    FreeBSD/64 6.2 (liberty)
2007-04-11 20:59:45 -05:00
Albert Cheng
ed7d456e51 [svn-r13253] Updated all C and C++ style source code files with the THG copyright notice.
Tested platform:
Kagiso only since it is only a comment block change.  If it works in one
machine, it should work in all, I hope.  Still need to check the parallel
build on copper.
2007-02-07 09:56:24 -05:00
Quincey Koziol
6b45f5172c [svn-r11245] Purpose:
Code cleanup

Description:
    Trim trailing whitespace, which is making 'diff'ing the two branches
difficult.

Solution:
    Ran this script in each directory:

foreach f (*.[ch] *.cpp)
    sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f
end


Platforms tested:
    FreeBSD 4.11 (sleipnir)
    Too minor to require h5committest
2005-08-13 15:53:35 -05:00
Elena Pourmal
c5e8dc74c5 [svn-r10220] Purpose: Minor bug fix
Description: h5jam and h5unjam used old names jam and unjam while
             printing help message

Solution: fixed

Platforms tested: heping

Misc. update:
2005-03-15 15:14:24 -05:00
Quincey Koziol
427ff7da28 [svn-r9727] Purpose:
Bug Fix/Code Cleanup/Doc Cleanup/Optimization/Branch Sync :-)

Description:
    Generally speaking, this is the "signed->unsigned" change to selections.
However, in the process of merging code back, things got stickier and stickier
until I ended up doing a big "sync the two branches up" operation.  So... I
brought back all the "infrastructure" fixes from the development branch to the
release branch (which I think were actually making some improvement in
performance) as well as fixed several bugs which had been fixed in one branch,
but not the other.

    I've also tagged the repository before making this checkin with the label
"before_signed_unsigned_changes".

Platforms tested:
    FreeBSD 4.10 (sleipnir) w/parallel & fphdf5
    FreeBSD 4.10 (sleipnir) w/threadsafe
    FreeBSD 4.10 (sleipnir) w/backward compatibility
    Solaris 2.7 (arabica) w/"purify options"
    Solaris 2.8 (sol) w/FORTRAN & C++
    AIX 5.x (copper) w/parallel & FORTRAN
    IRIX64 6.5 (modi4) w/FORTRAN
    Linux 2.4 (heping) w/FORTRAN & C++


Misc. update:
2004-12-29 09:26:20 -05:00
Quincey Koziol
eb3e9ccd8a [svn-r9234] Purpose:
Code cleanup

Description:
    Tweak recent "forward compatibility" changes to the H5E* API (which allowed
for the old H5E API functions to remain unchanged) by allowing for the error
stack callback function (H5E_auto_t) to also remain unchanged from the 1.6
branch.  This required changing the H5E{get|set}_auto routines to have the
old style H5E_auto_t type (which didn't have a stack ID parameter) and the new
H5E{get|set}_auto_stack routines to have a newer "H5E_auto_stack_t" type (which
has a stack ID parameter).  This should make the H5E API changes as forwardly
compatible as possible.
    One side-affect of this change was that it was impossible to determine if
the current auto error callback was the old style (H5E_auto_t) or the new style
(H5E_auto_stack_t) of callback, so a new API function (H5Eauto_is_stack) was
adde to query this.

Platforms tested:
    FreeBSD 4.10 (sleipnir)
    IRIX64 6.5 (modi4)
    h5committest
2004-09-08 21:37:02 -05:00
Raymond Lu
cb7f03a26f [svn-r9183] Purpose: New feature
Description:  Restore 6 old error API functions back to the library to be backward
compatible with v1.6.  They are H5Epush, H5Eprint, H5Ewalk, H5Eclear, H5Eset_auto,
H5Eget_auto.  These functions do not have error stack  as parameter.

Solution:  Internally, these functions use default error stack.

Platforms tested:  h5committest and fuss.

Misc. update: RELEASE.txt
2004-09-01 12:43:30 -05:00
Xuan Bai
74f96681ce [svn-r9111] Purpose:
Update.

Description:
Make some minor change so that h5jam.c is compatible with Windows.

Solution:
1. unistd.h is not available in windows system.  Add a macro for this header file as:
   #ifdef H5_HAVE_UNISTD_H
   #include <unistd.h>
   #endif
2. Change open, read, write, lseek functions to HDopen, HDread, HDwrite, and HDlseek,
   as these HD functions are more comtatible with Windows system.
3. add #include H5private.h
4. remove #include <stdlib.h>

Platforms tested:
Windows 2000
Windows XP
eirene
(Note:  I talked with Bob and Kent about these changes before check-in)

Misc. update:
2004-08-18 17:04:26 -05:00
Quincey Koziol
e599638365 [svn-r9036] Purpose:
Bug fix

Description:
    Correct compilation errors w/--enable-hdf5_v1_6 and using the C++ compiler
as a C compiler

Platforms tested:
    FreeBSD 4.10 (sleipnir) w/above flags
    Not tested with h5committest
2004-08-06 12:52:06 -05:00
Robert E. McGrath
f53299c0b3 [svn-r9019] Purpose:
Adding new 'jam' utility

Description:
New utility, plus changes to makefiles

Solution:
See http://hdf.ncsa.uiuc.edu/RFC/Jam

Platforms tested:
verbena (fortran,C++), arabica, hirdls (SGI Irix64)

Misc. update:
Manifest will be done in next checkin.
2004-08-05 10:10:39 -05:00