Commit Graph

796 Commits

Author SHA1 Message Date
Ed Hartnett
94c23712b7 extra tests, plus fill value fixes for string type 2018-01-30 14:39:47 -07:00
Ed Hartnett
333b802861 fix dim bad paramter issues 2018-01-30 09:35:56 -07:00
Ward Fisher
d0339c8902 Merge branch 'pr-catchup' into v4.6.0-release-branch 2018-01-24 15:51:24 -06:00
Ward Fisher
d1296e5d9a
Merge branch 'master' into nc3-per-var-fill-v2 2018-01-23 17:36:14 -07:00
Ed Hartnett
c329298dc5 merged 760 2018-01-20 07:31:42 -07:00
Ed Hartnett
ef65bdf9af merged 786 2018-01-20 06:06:25 -07:00
Ed Hartnett
da928c1b83 merged 780 2018-01-20 06:05:34 -07:00
Ed Hartnett
cc4eb3cd96 more test development 2018-01-19 05:41:05 -07:00
Ed Hartnett
ea3874c567 more test development 2018-01-19 05:40:48 -07:00
Ed Hartnett
196a0b574a more test development 2018-01-19 05:11:07 -07:00
Ed Hartnett
4be1fd82e6 further test development 2018-01-19 04:16:59 -07:00
Ed Hartnett
bc1f103c3d cleaned up h5 checks in nc4grp.c 2018-01-19 03:37:49 -07:00
Ed Hartnett
3f83998b26
Merge branch 'master' into ejh_rename2 2018-01-18 16:05:04 -07:00
Ward Fisher
0f5fc7222b
Merge branch 'master' into plugins.dmh 2018-01-18 15:46:50 -07:00
Ed Hartnett
d350f82889 removed unneeded h5 checks 2018-01-18 07:46:31 -07:00
Ed Hartnett
126d34da1d more tests, error handling 2018-01-18 07:36:52 -07:00
Ed Hartnett
38c7cddf8f further test development, added documentation for uncommitted user-defined types, fixed check of return value 2018-01-18 06:47:50 -07:00
Ed Hartnett
9949a11155 removed some unneeded HDF4 checks, added some needed parameter checks 2018-01-17 09:09:58 -07:00
Ed Hartnett
09ee32b205 fixed some header files, checked some return values 2018-01-17 08:25:15 -07:00
Dennis Heimbigner
99fccab359 1. Keep up to date by merging master
2. Fixed plugin building (nc_test4/hdf5plugins)
   to be done properly by cmake and automake.
4. Duplicated part of the nc_test4 filter test code
   in examples/C

An incomplete and untested set of hooks exist
for OS-X in nc_test4/findplugins.in. They need testing.
2018-01-16 11:00:09 -07:00
Ed Hartnett
3fa3d3f9f9 ported rename fix changes from branch ejh_fill_values for easy merging 2018-01-05 06:01:22 -07:00
Levi Naden
f6fc9c183b Allow multiple vars with different chunks on the same unlimited dim
Fix #299
The conditions to make this error are the following:
* Two variables with different chunk sizes
* Both variables write on the same unlimited dimension
* The first variable has already written data when the second variable is created
2018-01-02 11:37:01 -05:00
Ward Fisher
a1fc9fff41
Merge branch 'master' into nc3-per-var-fill-v2 2017-12-22 16:22:12 -07:00
Wei-keng Liao
0f4a85b9f2 a clean commit for #383 2017-12-20 20:53:30 -06:00
Ray Donnelly
879d071b0c Fix buffer overrun in tabs[MAX_NESTS] by adding space for \0 terminator
.. also speed it up by not using strcat when direct array access works just fine.
2017-12-20 21:38:34 +00:00
Ed Hartnett
4de61e21f2 more docs, more cleaning 2017-12-04 12:21:14 -07:00
Ed Hartnett
fec74e18ef more internal documentation 2017-12-04 07:07:45 -07:00
Ed Hartnett
11e3e81489 more internal docs 2017-12-03 15:37:56 -07:00
Ed Hartnett
097a09fc79 more internal docs 2017-12-03 07:57:21 -07:00
Ed Hartnett
3514ae9d08 more internal docs 2017-12-03 07:11:51 -07:00
Ed Hartnett
bf6dab14e0 fixed error value from nc4_find_g_var_nc() when ncid is bad 2017-12-03 04:06:56 -07:00
Ed Hartnett
9e4c564656 more tests 2017-12-02 18:00:22 -07:00
Ed Hartnett
8055c1cede more tests 2017-12-02 17:43:46 -07:00
Ed Hartnett
1cf8177f45 more test 2017-12-02 15:43:40 -07:00
Ed Hartnett
ea63ff526f more tests 2017-12-02 08:05:17 -07:00
Ed Hartnett
bfeb8d4e0b more testing 2017-12-02 07:38:01 -07:00
Ed Hartnett
7cd344f7b0 removed redundant check in NC4_def_var() 2017-12-02 07:23:23 -07:00
Ed Hartnett
6c3aa79684 more testing of nc_set_var_chunk_cache_ints 2017-12-02 07:15:19 -07:00
Ed Hartnett
acbd3e259e more tests 2017-12-01 13:58:13 -07:00
Ed Hartnett
a8e9c196e2 more tests, fixed documentation warnings 2017-12-01 13:02:59 -07:00
Ed Hartnett
42c482d33c more tests 2017-12-01 11:20:09 -07:00
Ed Hartnett
3e45557157 more docs, more tests, eliminated two unneeded functions 2017-12-01 10:02:40 -07:00
Ed Hartnett
2023ed6b7c fixed problems with bad inputs to nc_def_Var 2017-12-01 09:08:12 -07:00
Ed Hartnett
5d11415b83 adding internal documentation 2017-12-01 08:18:49 -07:00
Ed Hartnett
8e47b9bbc2 merged ejh_more_warnings 2017-11-24 10:14:57 -07:00
Ed Hartnett
845355e91b added hdf4 test for inq_format calls 2017-11-22 08:21:24 -07:00
Ed Hartnett
d4495e8e86 more testing 2017-11-22 07:46:03 -07:00
Ed Hartnett
7e662c6b87 fixed easy warnings 2017-11-20 05:55:04 -07:00
Ed Hartnett
3b82328902
Merge branch 'master' into ejh_more_warnings 2017-11-15 03:41:12 -07:00
Ed Hartnett
013151edc6 fixed leak relating to var->params 2017-11-14 09:15:13 -07:00
Ward Fisher
16d6f94f30 Merge branch 'master' into filters.dmh 2017-11-13 11:15:02 -07:00
Ed Hartnett
6d31b47543
Merge branch 'master' into ejh_more_warnings 2017-11-10 02:52:46 -07:00
Ward Fisher
a9dde277d7 Merge branch 'ejh_enum_mem_fix' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into more_ejh_pulls 2017-11-09 16:11:17 -07:00
Ed Hartnett
0e0482bc05 fixed warnings 2017-11-09 06:24:18 -07:00
Ed Hartnett
b9911d6e6f took out most uses of EXTRA_TESTS, returned it to disabled by default 2017-11-08 13:25:23 -07:00
Ed Hartnett
a72d5b4d16
Merge branch 'master' into ejh_enum_mem_fix 2017-11-07 18:34:55 -07:00
Ed Hartnett
ef05ba642f
Merge branch 'master' into ejh_remove_counts 2017-11-05 10:08:36 -07:00
Ed Hartnett
7872785cf0
Merge branch 'master' into ejh_enum_mem_fix 2017-11-03 19:44:40 -06:00
Ward Fisher
f98635be1b Merge remote-tracking branch 'origin/h5offset.dmh' into dmh_multi_merge 2017-11-03 12:40:52 -06:00
Ed Hartnett
0ac8ec40a1 removed archaic code to check memory use 2017-11-02 11:40:13 -06:00
Ed Hartnett
406e979fb4 fixed tst_enums memory issue 2017-11-01 04:31:12 -06:00
Ward Fisher
d7f0919c12
Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-31 14:06:41 -06:00
Dennis Heimbigner
2d77e6451b Master merge 2017-10-28 14:06:39 -06:00
Dennis Heimbigner
261ed4c99d Merge branch 'master' into h5offset.dmh 2017-10-27 12:33:17 -06:00
Ed Hartnett
c36554ffb8 fixed memory error in handling of (ignored) reference atts in HDF5 file 2017-10-27 06:08:22 -06:00
Ward Fisher
bacdef88fe Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-26 14:31:22 -06:00
Ward Fisher
b066a2ac76 Merge branch 'ejh_fix_nc4info_warnings' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into merge_small_pulls 2017-10-25 11:03:35 -06:00
Ed Hartnett
785e0c3a9a fixed warning in nc4var.c 2017-10-25 04:55:56 -06:00
Ed Hartnett
19e248c63e fixed compile warnings in nc4info.c 2017-10-25 04:48:03 -06:00
Ed Hartnett
26f443b7ac fixed warnings in libsrc4/nc4hdf.c 2017-10-25 04:28:24 -06:00
Dennis Heimbigner
9983b9d911 re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446

Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
   It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.

Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.

Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf

Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.

This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
   NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
   to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
   an offset are properly recognized. It does so by prefixing
   a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-24 16:25:09 -06:00
Dennis Heimbigner
5ff3909704 Fix bug in nc4file.c where it improperly handled filters with more than 4 parameters. 2017-10-09 21:24:56 -06:00
Wei-keng Liao
2cc30c16be check against NC_MAX_VAR_DIMS (but using NC_EMAXDIMS, maybe a new error code NC_EMAXVARDIMS is needed) 2017-09-21 12:37:33 -05:00
Dennis Heimbigner
ed44fd7306 Add szip support via libaec 2017-08-27 13:35:20 -06:00
Dennis Heimbigner
7e8bd784cc Merge branch 'master' into filters.dmh 2017-08-17 14:29:34 -06:00
Dennis Heimbigner
86fc8745dc merge master and resolve conflicts 2017-08-12 15:50:31 -06:00
Ward Fisher
24ca95645c Applied fix for a stack buffer overflow into 4.5.0 release branch. 2017-08-08 13:18:53 -06:00
Ward Fisher
f6ac978f25 Merge branch 'master' into fix_nc4_check_name_buffer_overflow 2017-08-08 11:22:06 -06:00
Ward Fisher
05d3d7e9f5 Merge remote-tracking branch 'origin/d4tempfile.dmh' into v4.5.0-release-branch 2017-08-07 10:12:36 -06:00
Dennis Heimbigner
4d8fbbf501 If DAP (2 or 4) is enabled, but diskless is disabled, then the
dap code will create a real temporary file in which to store the
converted metadata for the DAP .dds or .dmr.

It was assumed that the nc_close code would reclaim the
temporary file. For DAP2, reclamation occurs in the ncio
code. For DAP4, it was assumed that the libsrc4 code would do
the reclamation, but for whatever reason, this is not happening.
Thus, in this situation, a temporary file is left in the file
system. Aside from being irritating to users, this screws up
'make distcheck'.

So the DAP4 code is fixed to ensure that the temporary file is
properly reclaimed independent of the libsrc4 code.
2017-08-05 22:41:31 -06:00
Even Rouault
1989ddc252 Fix stack buffer overflow in nc4_check_name()
nc4_check_name() checks that the provided string doesn't exceed NC_MAX_NAME,
but fails to do so after calling nc_utf8_normalize(). This extra check is
needed since a caller of nc4_check_name(), like NC4_def_dim, allocates
norm_name as char norm_name[NC_MAX_NAME + 1]

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2840
Credit to OSS-Fuzz
2017-08-02 21:57:36 +02:00
Dennis Heimbigner
715a6fe5eb The files libdispatch/dwinpath.c and include/ncwinpath.h
were added to provide a path name converter from e.g. cygwin
paths to e.g. windows paths. This is necessary because
the shell scripts may produce cygwin paths, but the code
may have been compiled with Visual Studio. Similar issues
arise with Mingw.

At appropriate places, and if using Visual Studio or Mingw,
I added calls to the path conversion code.
Apparently I forgot to find all the places where this
conversion was needed. So this pr does the following:
1. Push the calls to the converter to the various libXXX
   directories and out of libdispatch/dfile.c.
2. Add conversion calls to other parts of the code like oc2.

I also turns out that conversion code in dapcvt.c
had a bug when handling DAP Byte type under visual studio.

Notes:
1. there may still be places I missed that need to do path conversion.
2. need to make sure that calls to e.g. H5open also use converted path.
2017-07-13 10:40:07 -06:00
Ward Fisher
8a4f5aea95 Corrected a double-free reported by static analysis. 2017-06-15 12:09:54 -06:00
Even Rouault
d02e3c952b Fix memory leak in NC4_put_propattr()
Current code only frees char* text in error cases. It should
also free it in success case.

Otherwise Valgrind reports a leak:

==28536== 64 bytes in 1 blocks are definitely lost in loss record 4 of 13
==28536==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28536==    by 0xE673496: NC4_buildpropinfo (nc4info.c:239)
==28536==    by 0xE67313B: NC4_put_propattr (nc4info.c:162)
==28536==    by 0xE65BF35: nc4_create_file (nc4file.c:468)
==28536==    by 0xE65C0AC: NC4_create (nc4file.c:564)
==28536==    by 0xE608A08: NC_create (dfile.c:1773)
==28536==    by 0xE607E6A: nc__create (dfile.c:511)
==28536==    by 0xE607E23: nc_create (dfile.c:440)

Credit to OSS Fuzz
2017-06-07 10:48:38 +02:00
Dennis Heimbigner
c834d4af12 merge from master 2017-05-10 12:33:03 -06:00
Dennis Heimbigner
7c3164577e Finalize the compression support.
This relies on the HDF5 capability to
dynamically load compression filters.
Note that a compression filter is just
a subcase of filters.

The primary user-visible changes are as follows:
1. Add a standard header "netcdf_filter.h" that defines
   the necessary API extensions
2. Modify ncgen to support two new special attributes
   "_Filter_ID" and "_Filter_Parameters" so that compression
   can be turned on when creating a file using ncgen.
4. Add a detailed description of filtering support
   to the user's guide; see the file filters.md
5. Add a test case directory for this: nc_test4/filter_test.
   It is fragile and a ./configure flags (-enable-filter-test)
   is defined (default disabled) to shut this off this test
   to avoid spurious 'make check' failures.

Note that the HDF5 documentation is not up-to-date, so
much of what is encoded here comes from examining the
actual code in the file H5PL.c in the HDF5 source code.
2017-04-27 13:01:59 -06:00
Ward Fisher
8dddd222a3 Merged master, DAP4 support into branch. 2017-04-19 09:29:35 -06:00
Dennis Heimbigner
32fe709615 ckp 2017-04-14 11:05:30 -06:00
Ward Fisher
b5b99cbebb Merge branch 'master' into ghpull-375 2017-04-05 16:24:55 -06:00
Dennis Heimbigner
5f15c9e777 1) master merge 2)fix uname -o problem 2017-03-30 16:21:31 -06:00
Greg Sjaardema
97c27b1582 Merge branch 'master' into patch-1 2017-03-29 20:19:37 -06:00
Wei-keng Liao
1508bd5529 fix the previous commit that missed the case of re-open file 2017-03-29 12:16:25 -05:00
Dennis Heimbigner
80390b94e5 keep up-to-date with master 2017-03-27 12:16:24 -06:00
Wei-keng Liao
73ccb364a9 To solve NC_ELATEFILL error for NetCDF-4 files, mark all variables written at enddef. 2017-03-24 20:55:00 -05:00
Ward Fisher
eeb673bf8c Merge branch 'master' into ghpull-375 2017-03-22 11:24:56 -06:00
Greg Sjaardema
26c393cd13 Merge branch 'master' into patch-1 2017-03-15 08:50:12 -06:00
Stephan Hoyer
4dd8e380c1 Switch NC_CHAR on netCDF4 to use ASCII
Fixes GH298
2017-03-13 20:12:08 -07:00
Ward Fisher
d4a4dfdd15 Resolved a conflict. 2017-03-13 14:23:57 -06:00
Ward Fisher
8e3790f7ce Merged master. 2017-03-09 12:53:28 -07:00
Dennis Heimbigner
3db4f013bf Primary change: add dap4 support
Specific changes:
1. Add dap4 code: libdap4 and dap4_test.
   Note that until the d4ts server problem is solved, dap4 is turned off.
2. Modify various files to support dap4 flags:
	configure.ac, Makefile.am, CMakeLists.txt, etc.
3. Add nc_test/test_common.sh. This centralizes
   the handling of the locations of various
   things in the build tree: e.g. where is
   ncgen.exe located. See nc_test/test_common.sh
   for details.
4. Modify .sh files to use test_common.sh
5. Obsolete separate oc2 by moving it to be part of
   netcdf-c. This means replacing code with netcdf-c
   equivalents.
5. Add --with-testserver to configure.ac to allow
   override of the servers to be used for --enable-dap-remote-tests.
6. There were multiple versions of nctypealignment code. Try to
   centralize in libdispatch/doffset.c and include/ncoffsets.h
7. Add a unit test for the ncuri code because of its complexity.
8. Move the findserver code out of libdispatch and into
   a separate, self contained program in ncdap_test and dap4_test.
9. Move the dispatch header files (nc{3,4}dispatch.h) to
   .../include because they are now shared by modules.
10. Revamp the handling of TOPSRCDIR and TOPBUILDDIR for shell scripts.
11. Make use of MREMAP if available
12. Misc. minor changes e.g.
	- #include <config.h> -> #include "config.h"
	- Add some no-install headers to /include
	- extern -> EXTERNL and vice versa as needed
	- misc header cleanup
	- clean up checking for misc. unix vs microsoft functions
13. Change copyright decls in some files to point to LICENSE file.
14. Add notes to RELEASENOTES.md
2017-03-08 17:01:10 -07:00
Ward Fisher
2558fd6f9f Merge branch 'att_callbk' of https://github.com/brtnfld/netcdf-c into gh276 2017-03-06 12:56:33 -07:00
Greg Sjaardema
cbb9448ab0 Remove unused fields from struct
The nvars, ndims, and natts fields on the NC_HDF5_FILE_INFO struct are
never set.  The nvars field is read, but since it is never written,
the value is always zero.
2017-03-06 11:14:00 -07:00
Greg Sjaardema
473529d199 Remove unused ndims from grp struct 2017-03-06 11:14:00 -07:00
Dennis Heimbigner
47daf33074 Resolves Github issue https://github.com/Unidata/netcdf-c/issues/349.
Update utf8proc.[ch] to use the version now
maintained by the Julia Language project
(https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).
The license for the previous version was
unacceptable for the Debian and Ubuntu release
systems. The new version both updates the code
and addresses the license issue.

It turns out that the utf8proc software we are using
was turned over to the Julia Language developers
and the license terms changed to allow modification.
(https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).

So the fix here is as follows:
1. Wrap the library with a fixed interface: libdispatch/dutf8.c
   and include/ncutf8.h.
2. Replace the existing utf8proc code with the new version
   from https://github.com/JuliaLang/utf8proc.
3. Add a couple more test cases: nc_test/tst_utf8_validate.c
   and nc_test_utf8_phrases.c.  If/when I can find a usable
   normalization test, I will incorporate that later.
2017-02-16 14:27:54 -07:00
Ward Fisher
7edb08977a Added platform checks for ARM. 2017-02-03 11:19:39 -07:00
Ward Fisher
3e5124996e Merged https://github.com/Unidata/netcdf-c/pull/319 to resolve some recently arisen conflicts, in preparation for larger merge. 2017-02-01 13:27:29 -07:00
Ward Fisher
0d2727d9da Merging pull request from gsjaardema, see https://github.com/Unidata/netcdf-c/pull/335 for more information. 2017-01-30 12:45:50 -07:00
Greg Sjaardema
b334171548 Merge branch 'master' into patch-1 2017-01-11 21:18:03 -07:00
Ward Fisher
34161aab69 Added fixes for Visual Studio 10 2017-01-10 13:54:09 -07:00
Greg Sjaardema
a2fdfa04ab Eliminate an MPI_Allreduce in many cases 2016-12-09 09:52:15 -07:00
Greg Sjaardema
f8e818385e Modify previous no_fill setting
HDF5 does not permit a variable to have no_fill == TRUE if the variable type is variable length.  This includes types NC_STRING and NC_VLEN.  

The test above also excludes user-defined types which I'm not sure is needed or not.
2016-12-05 11:08:26 -07:00
Greg Sjaardema
8401e2087e Set variable no_fill to match database default (nc4)
In nc4 mode, the variables were ignoring the default "database" fill/no_fill mode set via a call to nc_set_fill().  This sets the no_fill mode on the variable to match the default database setting at the time the variable is defined.
2016-12-02 08:17:47 -07:00
Greg Sjaardema
72c1948980 Move metadata ops calls 2016-12-01 13:35:16 -07:00
Greg Sjaardema
e0269d6cac Add hdf5 collective metadata api detection to cmake build 2016-12-01 13:35:10 -07:00
Greg Sjaardema
39c90e7b76 Enable collective metadata operations for hdf5-1.10; not protected yet 2016-12-01 13:34:58 -07:00
Wei-keng Liao
fe9685deb4 implement an error code precedence 2016-12-01 12:31:20 -06:00
Wei-keng Liao
4cdbf7dba5 Merge branch 'master' into issue258 2016-12-01 01:09:45 -06:00
Ward Fisher
767a5b372c Corrected an issue reported as part of the pull request at https://github.com/Unidata/netcdfic/pull/328 2016-11-28 13:31:43 -07:00
Ward Fisher
05ceb8d471 Merge branch 'nc4-var-array' of https://github.com/gsjaardema/netcdf-c into gh328 2016-11-28 13:10:07 -07:00
Wei-keng Liao
ab73a57fca Merge branch 'master' into issue258 2016-11-25 10:49:03 -06:00
Ward Fisher
24a4a230e6 Updated debugging script, fixed a problem in logging type size. 2016-11-16 12:18:20 -07:00
Greg Sjaardema
b9c50aec89 Create var correctly for hdf4 files 2016-11-16 10:37:37 -07:00
Greg Sjaardema
a55d96eba1 Clean-up build after changes -- remove unused variables 2016-11-16 08:45:28 -07:00
Greg Sjaardema
207a2ee4f9 Fix stdc violation 2016-11-16 08:45:23 -07:00
Greg Sjaardema
d16f5a8842 Whitespace cleanup 2016-11-16 08:45:19 -07:00
Greg Sjaardema
8698e57424 Compile with c89 -- eliminate init in for-loop 2016-11-16 08:45:15 -07:00
Greg Sjaardema
c84b475ccf Remove var linked list 2016-11-16 08:45:10 -07:00
Greg Sjaardema
dee1baca8e Store vars in array instead of linked list (linked list still active) 2016-11-16 08:45:06 -07:00
Wei-keng Liao
e8cfdbb25a Merge branch 'master' into issue258 2016-11-13 00:00:54 -06:00
Wei-keng Liao
2081ae7099 add configure option --enable-relax-coord-bound for issue #243 2016-11-12 23:58:09 -06:00
Ward Fisher
f4ac2f827d Merge branch 'patch-4' of https://github.com/gsjaardema/netcdf-c into gh290 2016-11-09 12:27:48 -07:00
Wei-keng Liao
4725c1484b move varid check right after ncid 2016-10-12 13:33:17 -05:00
Wei-keng Liao
dbb9be59d2 temporally disable __arm__ for testing 2016-10-09 22:21:32 -05:00
Ward Fisher
49fb3241c6 Corrected coverity issue 1372965. 2016-09-15 11:07:11 -06:00
Greg Sjaardema
dab30468f9 Merge branch 'master' into patch-4 2016-09-15 11:04:30 -06:00
Ward Fisher
a08be0a312 Corrected issue 1372910 in coverity. 2016-09-14 16:26:08 -06:00
Ward Fisher
934bb4bd66 Corrected typo. 2016-09-14 16:20:43 -06:00
Ward Fisher
ad1220453a Corrected issue 1372911 in Coverity. 2016-09-14 16:16:06 -06:00
Ward Fisher
485faa0333 Addressed defect 1372912 in coverity. 2016-09-14 16:11:22 -06:00
Dennis Heimbigner
ddfb6d6279 Make sure that the _NcProperties attr is null terminated and stored as such 2016-08-08 21:54:23 -06:00
Dennis Heimbigner
0cf1e2c49f re: Github issue netcdf-c 300
Modified provenance code to allocate the minimal space
needed for _NCProperties attribute in file.  Basically
required using malloc in the provenance code and in ncdump.
Otherwise should cause no externally visible effects.
Also removed the ENABLE_FILEINFO from configure.ac since
the provenance code is no longer optional.
2016-08-08 09:24:19 -06:00
Greg Sjaardema
c7ccdfa543 More pedantically correct check
This modifies the previous change to be more pedantically correct.  It should always be an NC_EINVALCOORDS error if start exceeds fdims[2]; however, if start equals fdims[2], then it is only an error if count is non-zero.
2016-07-21 09:30:18 -06:00
Greg Sjaardema
9290b31c9d Fix variable bounds check for parallel output
The following code is in nc4hdf.c, function `nc4_put_vara`.

```
  /* Check dimension bounds. Remember that unlimited dimnsions can
   * put data beyond their current length. */
  for (d2 = 0; d2 < var->ndims; d2++)
    {
      dim = var->dim[d2];
      assert(dim && dim->dimid == var->dimids[d2]);
      if (!dim->unlimited)
        {
          if (start[d2] >= (hssize_t)fdims[d2])
            BAIL_QUIET(NC_EINVALCOORDS);
          if (start[d2] + count[d2] > fdims[d2])
            BAIL_QUIET(NC_EEDGE);
        }
    }
```

There is an issue when the process with the highest rank has zero items to output.  As an example, if I have 4 mpi processes which are each writing the following amount of data:
 * rank 0: 0 items
 * rank 1: 2548 items
 * rank 2: 4352 items
 * rank 3: 0 items.

I will define the variable to have a length of 6900 items (0 + 2548 + 4352 + 0).  When I am outputting data to the variable, each rank will call nc_put_vara_longlong with the following start and count values:
 * rank 0: start = 0, count = 0
 * rank 1: start = 0, count = 2548
 * rank 2: start = 2548, count = 4352
 * rank 3: start = 6900, count = 0.

In each case, the `start` for rank N is equal to `start` for rank N-1 + `count` for rank N-1.  This all works ok until the highest rank is writing 0 items.  In that case, the `start` value for that rank is equal to the total size of the variable and the check in the code fragment shown above fails since `start[] == fdims[]`.

This could be fixed in the application code by checking whether the `count` is zero and if so, then set `start` to 0 also, but I think that is a kluge that should not be required.

Note that this test appears three times in this file.  In one case, the check for non-zero count already exists, but not in the other two.  This pull request adds the check to the other two tests.
2016-07-21 09:30:18 -06:00
Ward Fisher
c1ec950d70 Merge branch 'extent-llu' of https://github.com/brtnfld/netcdf-c into consolidate-gh 2016-07-15 14:42:49 -06:00
Ward Fisher
d419b53925 Merge branch 'patch-1' of https://github.com/gsjaardema/netcdf-c into consolidate-gh 2016-07-15 14:40:32 -06:00
Greg Sjaardema
382ff98e6c Use an hdf5-api function that eliminates code
The H5Aexists hdf5 function does the same function as the manually coded loop with much less code and fewer function calls.

Also, the H5Aopen_idx and H5Aget_num_attrs functions are deprecated.
2016-07-13 09:30:54 -04:00
Greg Sjaardema
fcb1455b28 Update nc4hdf.c
If H5Aopen_idx on line 1964 fails, then attid will be < 0.  The BAIL will goto exit at line 1989 and then the test of "if (attid ...)" at line 1995 will pass (attd != 0) and then call H5Aclose(attid) with a negative attid.    Similar issue for spaceid.  

Result of function if probably the same since there is a failure somewhere, but more difficult to track down if looks like failure is happening in the wrong place.
2016-07-12 08:59:01 -04:00
Greg Sjaardema
c361938c8e Fix att_name size
There was a mismatch between the allocated size of att_name and the size that H5Aget_name was told the size was.
2016-07-12 08:12:23 -04:00
Scot Breitenfeld
55bf63d35c Merge branch 'master' into extent-llu 2016-06-21 13:07:20 -05:00
M. Scot Breitenfeld
2bf233c9d5 This patch changes the algorithm for determining the extended size of a dataset in parallel to pass a variable of type unsigned long long to MPI_Allreduce. Despite the comment in the code on this line (removed in this patch), the current usage is not correct. For example, consider if process 0 has an extend size of 2^32 (0x100000000) and process 2 has an extend size of 1 (0x1). The current algorithm will compute the max of each 4 byte segment then combine these into an 8 byte number, yielding a max of (2^32)+1 (0x100000001), when it should simply be 2^32.
N. Fortner
2016-06-21 13:04:15 -05:00
Ward Fisher
3e24dcd575 Removed some dead assignments reported by clang. 2016-06-20 15:28:46 -06:00
Scot Breitenfeld
b2dc48d7b3 Merge branch 'master' into att_callbk 2016-06-15 08:36:41 -05:00
Ward Fisher
46c63344f7 Added comments where needed. 2016-06-14 10:47:24 -06:00
Ward Fisher
a499bf1ed8 Extending when attributes are copied. 2016-06-14 10:29:14 -06:00
Ward Fisher
13b088f49f Moved fix out to a separate function so that we can hopefully address a few other NCO-reported issues. 2016-06-14 10:22:06 -06:00
M. Scot Breitenfeld
4f43988e84 Changed from discovering attributes and then looping through them to using H5Aiterate2 instead. 2016-06-14 09:33:52 -05:00
Ward Fisher
1ebb104f74 Tentatively fixed https://github.com/Unidata/netcdf-c/issues/239 but the test needs to be extended. 2016-06-10 17:03:08 -06:00
Ward Fisher
2edc4ce64a Added a fix as contributed by Kent at HDF group for a collective I/O, parallel issue. 2016-06-09 14:16:20 -06:00
dmh
5bfdf54263 The name hash for hdf4 variables was
not being computed. Fix in nc4file.c.
Not sure how this ever worked for any variable.
What is also weird is that the dim hash is
apparently being computed.
2016-06-01 15:20:36 -06:00
Dennis Heimbigner
835511eaeb HDF5 is generating unnecessary error messages when netcdf4 logging is enabled
re: github netcdf-c issue #271

This occurs for several reasons, including:
1. using H5Aopen_name instead of H5Aexists to test if attribute exists.
2. using H5Eset_auto instead of H5Eset_auto2.
There are probably others that will have to be extinguished as encountered.
p.s Hope I did not overdo this and kill too much.
2016-05-27 10:08:01 -06:00
Dennis Heimbigner
8c1f8f57ee re: https://github.com/Unidata/netcdf-c/issues/269
The hash field for phony dimensions was not being set
(in nc4hdf.c). Also added test case (nc_test4/?).
Note that I searched for other similar failures and
did not find any, but I may have missed them.
2016-05-24 19:37:21 -06:00
Greg Sjaardema
4d037a1f62 Check for valid MPI_Comm before freeing
If in parallel mode and the H5Fcreate fails, then the h5->comm field may/will point to MPI_COMM_NULL instead of to a valid communicator.  If that is passed to MPI_Comm_free, then the code will core dump down in the MPI_Comm_free function and not return a valid return status to the caller routine. If communicator is checked, then execution proceeds back up the call tree and caller can report a better error message about the failed file create.
2016-05-24 10:50:00 -06:00
Ward Fisher
fcca7ae57d Merge branch 'master' into provfix 2016-05-16 12:39:15 -06:00
Dennis Heimbigner
4fa1470241 re: github issue https://github.com/Unidata/netcdf-c/issues/265
Charlie Zender noted that we forgot to define what happens for
various netcdf API attribute operations, notably nc_inq_att()
and nc_get_att().
So, I added a list of legal and illegal api calls for the provenance
attributes in docs/attribute_conventions.md.
I also added more test cases to ncdump/tst_fileinfo.c to verify
and fixed resultant errors.
2016-05-15 18:03:04 -06:00
Dennis Heimbigner
7e0db68dce Finally get around to removing all that
obsolete pnetcdf related code in libsrc4.
2016-05-14 22:31:41 -06:00
Ward Fisher
e4d79dbb6c Removed an unused, unneeded struct, NCdata, that was causing problems on Visual Studio because it was empty. 2016-05-10 11:11:50 -06:00
Dennis Heimbigner
11a259ad86 Add provenance info for netcdf-4 files.
This consists of a persistent attribute named
_NCProperties plus two computed attributes
_IsNetcdf4 and _SuperblockVersion.
See the 'Provenance Attributes' section
of docs/attribute_conventions.md for details.
2016-05-07 14:32:07 -06:00
Ward Fisher
493a6e5d62 Found pre-existing call to H5Pset_libver_bounds, modified it so that the generated files would be created without the 1.10 specific things. 2016-04-08 21:36:08 +00:00
dmh
764a1c40a3 ckp 2016-04-06 19:51:40 -06:00
Ward Fisher
0bb9856880 Merge branch 'upstream' of https://github.com/gsjaardema/netcdf-c into gs-pulls 2016-03-04 14:58:10 -07:00
Greg Sjaardema
4ccebf25b5 Use dim field of var instead of finding dim from var->dimids.
The var struct has a 'dim' field which was not being used
Instead, the dimids field would always search for the dim
with the matching dimid.  For db with large numbers of dims,
this could be a significant time sync.

Modified code to always set var-dim[i] when var->dimids[i] was
set (if the dim existed at that point).  Then use the var->dim
field instead of var->dimids and search whenever requested.

All var->dim accesses are protected by asserts that verify
non-null and that the var->dim[]->dimid == var->dimids[].
2016-03-04 10:45:36 -07:00
Greg Sjaardema
1a84a6a99e Add hash field to dim and var to facilitate fast name compare
In non-classic netcdf-4 models, it is allowable to have
large numbers of dims and vars.  In many operations, the
entire list of dims or vars is searched for a dim/var matching
a specific name which results in *lots* of strncmp or strcmp
calls.

If we add a hash field to the var and dim structs similar to what
has already been done for the netcdf-3 formats, then we can hash the
name being searched for and numerically compare that value with
the var/dim hash value.  If they match, then do a more expensive
strncmp call to ensure that the names truly match.
2016-03-03 13:18:31 -07:00
Ward Fisher
332d71fd1a Merge branch 'master' into gh223 2016-02-19 15:32:50 -07:00
Ward Fisher
d8b65ccea1 Fix for https://github.com/Unidata/netcdf-c/issues/223 2016-02-19 15:05:39 -07:00
Ward Fisher
db84f39adc Tentative, robust fix for https://github.com/Unidata/netcdf-c/issues/221 that does not immediately introduce other issues into ncdump. Broader validation pending. 2016-02-18 15:42:03 -07:00
Ward Fisher
9791b1a397 Tentative fix for initial issue at http://github.com/Unidata/netcdf-c/issues/221 . investigating knock-on issues now. 2016-02-18 14:46:16 -07:00
Dennis Heimbigner
45572f5971 Fix github issue: https://github.com/Unidata/netcdf-c/issues/208
Return an error when specifying deflation (compression) or fletcher32 on
a file created for parallel IO in netcdf-4.
2016-02-01 16:15:58 -07:00
Dennis Heimbigner
b5ba424793 Clean up the handling of hdf5 initialization by
creating an nc4_hdf5_initialize(void) function
plus nc4_hdf5_initialized flag.
Also fix potential null exception in nc4internal.c
2016-01-28 16:19:38 -07:00
Ward Fisher
bb00562779 Addressed a static-analysis issue. 2015-12-31 11:47:39 -07:00
Ward Fisher
473259b772 Corrected issue where overwriting an attribute of type NC_CHAR with NC_STRING would result in dangling data. 2015-11-11 11:32:12 -07:00
Ward Fisher
c1210f4020 Merge branch 'master' into cdf5-sync-master 2015-11-09 13:45:11 -07:00
dmh
5ad26bb68f Fix github issues #140
1. Added check to libsrc4/nc4var.nc_def_var_extra to
   check that the no specified chunks size is greater than
   the dimension size.

2. Added test to nc_test4/tst_chunks.c
2015-11-07 20:29:16 -07:00
Ward Fisher
612b35a84c Merge branch 'master' into cdf-5, in preparation for merging the CDF-5 functionality into the master branch. This will be the key new feature for netcdf 4.4.0. 2015-11-05 13:40:35 -07:00
Ward Fisher
519a56019f Merge branch 'fix-typos' of https://github.com/tbeu/netcdf-c into tbeu-fix-typos 2015-10-16 14:16:09 -06:00
dmh
49597a64af merge-squash 2015-10-09 10:12:11 -06:00
Russ Rew
d3d442537d Fix 1D variables with an unlimited dimension taking DEFAULT_CHUNK_SIZE (4MiB), by default, in netCDF-4 files 2015-09-29 13:58:51 -06:00
dmh
5b89b22021 missing include file 2015-09-18 11:11:57 -06:00
dmh
0a7ff043a2 re: Jira NCF-320
Partially resolve by making
string variables and attributes use
UTF-8 encoding.
Normalization is not necessarily fixed,
however.
2015-08-20 15:53:48 -06:00
tbeu
e2820e4d8a Fix common typos
Detected by https://github.com/vlajos/misspell_fixer
2015-08-20 11:42:05 +02:00
Ward Fisher
bb42e4639e Addressed conflict between master, mem2. 2015-06-02 15:03:12 -06:00
Ward Fisher
cf6d87f1dc [NCF-332] Addressed the issue in get_netcdf_type_from_hdf4() by adding case statements explicitly for the little-endian hdf4 values as defined by http://www.hdfgroup.org/training/HDFtraining/UsersGuide/Fundmtls.fm3.html. 2015-05-28 17:27:57 -06:00
Ward Fisher
afa157f918 Started adding checks for little-endian HDF data types [NCF-332] 2015-05-28 16:41:48 -06:00
dmh
3dd807a155 The original mem branch somehow got
hosed, so I rebuilt it as a new mem2 branch.
2015-05-28 15:10:10 -06:00
Ward Fisher
167835ea32 Added a check to avoid passing 0 to malloc; in this case gcc will return a pointer but some other compilers will return NULL, which is then flagged as a malloc failure. Attempting to bypass this behavior. 2015-05-20 11:11:19 -06:00
Ward Fisher
9d98aab40a Refactored test. 2015-05-15 15:29:29 -06:00
Ward Fisher
99ef1624bc Regarding [NCF-331], the issues appears to have been in nc4file.c:get_type_info2(). The call to H5Tget_order() was only happening for H5T_Float. According to the documentation, this works for all datatypes as of hdf5 1.8.6. This tentatively fixes the bug reported, but additional testing (and cleanup from debugging) is needed. 2015-05-15 14:24:27 -06:00
Ward Fisher
999f4e5720 Additional debugging, modified the LOGGING functions somewhat. Also modified ncdump to print 'native' endianness. This may be removed before merging back into trunk. 2015-05-14 17:22:07 -06:00
Ward Fisher
4c07e22ae4 Progress working towards [NCF-329] 2015-04-21 13:52:43 -06:00
Russ Rew
ab18a2e17c Fix bug NCF-187 (thanks to Alexander Barth). Add test for bug fix. 2015-04-02 12:30:51 -06:00
Quincey Koziol
aede522766 Mark dataset attributes dirty when one is renamed. 2015-02-25 09:25:40 -06:00
Ward Fisher
dd2ae92a48 Corrected a potential dereference of a null pointer. 2015-02-11 13:13:39 -07:00
Ward Fisher
c1875ec8f0 Addressed a couple of memory leaks identified by clang. 2015-02-10 13:39:15 -07:00
Russ Rew
72c3e5809a Fix comment, small memory leak 2015-02-05 16:33:42 -07:00
Ward Fisher
e2a56efa9c Merge branch 'NCF-324' of https://github.com/qkoziol/netcdf-c into qkoziol-NCF-324 2015-02-04 09:54:17 -07:00
Ward Fisher
dd2318b725 Added fencepost for cross-dll memory freeing in Windows/Visual Studio 2015-02-02 14:46:51 -07:00
Quincey Koziol
4f8898719a NCF-324: Make similar change to get_vara code, and add in test to Makefile.am 2015-02-02 08:51:00 -06:00
Quincey Koziol
e9484cc7e6 NCF-324 - Don't reopen HDF5 dataset if it's already open (in particular when
the variable name is the same as a dimension name).
2015-02-02 08:32:17 -06:00
Ward Fisher
296928ffc7 Identified a potential null pointer dereference introduced in pull request, added check for null pointer. 2014-12-28 21:04:48 -08:00
Ubuntu
64f95828c3 Checkout current files 2014-12-28 01:10:33 +00:00
Quincey Koziol
2917a6a123 Interim checkpoint of working code. 2014-12-01 08:52:53 -06:00
Quincey Koziol
d2ed77f95f Merge remote-tracking branch 'upstream/master' into NCF-177 2014-11-30 23:49:24 -06:00
Quincey Koziol
7a9e209147 Merge branch 'master' into NCF-177
Conflicts:
	libsrc4/nc4hdf.c
2014-11-30 23:37:19 -06:00
Quincey Koziol
8769d58b1d Initial fix for further rename issue. 2014-11-24 09:36:58 -06:00
Ward Fisher
2ab47745cc Fixed a different set of potential memory leaks paired with the previous ones. 2014-11-11 15:24:38 -07:00
Ward Fisher
2f7ffacac4 Fixed a handful of potential memory leaks reported by clang static analysis. 2014-11-11 15:17:57 -07:00
dmh
1739c50622 Modified a number of tests
to make use of remotetest.unidata.ucar.edu
optional. Purpose is purely for testing
new dts and thredds servers.
2014-10-04 15:59:16 -06:00
Ward Fisher
03ce4c9761 Cast malloc return to appropriate type. 2014-10-01 17:04:56 -06:00
Ward Fisher
61a7dab58f Fixed an issue preventing compilation with hdf4 support with Visual Studio. 2014-08-28 18:14:14 -06:00
Ward Fisher
b43813d821 When using the '-ansi' flag with gcc, netcdf would fail to build because of the use of '//' for one-line comments. I've addressed this by replacing instances of // with enclosing comment blocks. 2014-08-26 11:19:32 -06:00
Ward Fisher
840d80f490 More doxygen tweaks. 2014-07-09 16:45:13 -06:00
Ward Fisher
7f812b367e Manual merge of pull request https://github.com/Unidata/netcdf-c/pull/64 contributed by nschloe. Assorted CMake improvements. 2014-06-11 15:51:31 -06:00
Ward Fisher
dd53809815 Cleaned up a comment in nc4hdf.c 2014-06-09 17:03:49 -06:00
dmh
ed068ef643 Fix misc. typos from previous commit 2014-06-02 14:02:34 -06:00
dmh
909940f9d3 #endfi -> #endif 2014-06-02 13:25:53 -06:00
dmh
83ec39f5db [NCF-272]
re: e support ZCL-340681 and CPW-270700

HDF4 supports compression (and chunking)
but the chunking was not being recorded
for HDF4 files. So, I modified the necessary
files to support HDF4 chunking.
2014-06-02 13:04:28 -06:00
dmh
b560fe1233 [NCF-272]
It turns out that HDF4 supports chunking
(and compression). However the existing
HDF4 code does not support it.
So add HDF4 support for chunking.
Also add a test case.
2014-05-30 22:12:05 -06:00
Ward Fisher
2dccd773e9 Corrected an 'dead assignment' issue reported by static analysis. 2014-05-19 16:26:49 -06:00
Quincey Koziol
435d8a03ed Account for the HDF5 library not having the MPI-POSIX VFD configured in. 2014-05-07 08:45:15 -05:00
Ward Fisher
5a693d7326 Merged pull requestion from nschloe, #48. 2014-04-21 16:11:48 -06:00
Ward Fisher
44fae42214 Cleaned up indentation, white space in multiple CMakeLists.txt files. 2014-04-21 11:15:33 -06:00
Dennis Heimbigner
4ae47ad45b jna? 2014-04-21 10:13:27 -06:00
Ward Fisher
ff47046e93 Fixed clang-reported issue: memory leak. 2014-04-19 17:57:25 -06:00
Dennis Heimbigner
b3a7ccb3d4 more jna fixes 2014-04-10 19:48:53 -06:00
Dennis Heimbigner
af9b5c4abf alternate JNA bug fix 2014-04-10 14:03:11 -06:00
dmh
211004898f jna fixes 2014-04-09 15:20:16 -06:00
Ward Fisher
76e5e0f1fa Addressed several minor issues revealed by static analysis (coverity, clang). Mostly to do with extreme corner cases in which a null pointer would be dereferenced, or dereferencing a non-null (but non-initialized) pointer would result in garbage. 2014-03-28 17:11:26 -06:00
Russ Rew
7d36a6c7f3 Fix a couple of warnings 2014-03-27 11:11:06 -06:00
Russ Rew
b95ab08f8f Fix bug in setting default chunksize for 1D record variables 2014-03-27 09:58:53 -06:00
Russ Rew
93878e8816 Fix possibility of divide by zero in rechunking. 2014-02-27 12:19:14 -07:00
Russ Rew
abe9a7d753 Merge branch 'master' of https://github.com/Unidata/netcdf-c 2014-02-26 14:01:51 -07:00
Russ Rew
9212968f54 Fix default chunksize for 1-dimensional record variables 2014-02-26 13:30:12 -07:00
Quincey Koziol
fe9e0b056d Update HDF4 support for recent datatype changes. 2014-02-25 21:05:19 -06:00
Russ Rew
976bc707f3 Fix compile errors in HDF4 support from change of att->xtype to att->nc_typeid and similar var change. Still a bug at runtime with ref count for type ids. 2014-02-23 11:32:35 -07:00
Quincey Koziol
d033f9f6ff Clean up Coverity warnings from last checkin. 2014-02-20 08:24:55 -06:00
Quincey Koziol
b98a475f37 Minor tweaks to comments and LOG messages. 2014-02-17 13:34:05 -06:00
Quincey Koziol
658e298cf8 Merge remote-tracking branch 'upstream/master' 2014-02-17 13:33:55 -06:00
Russ Rew
178e99467a Fix bug in MPI type reported by Chrostopher Bartz 2014-02-16 11:54:25 -07:00
Quincey Koziol
fd981824c1 Correct handling of variablen-length sequences for attributes, plus uncomment a
bunch of tests that stress this area of the library.

Also clean up some compiler warnings in the dispatch code.
2014-02-14 08:07:14 -06:00
Quincey Koziol
36c960c0ca Add a few cases for NC_CHAR type class that were missed earlier. 2014-02-12 08:48:13 -06:00
Quincey Koziol
4bfd9b27a0 Merge remote-tracking branch 'upstream/master'
Conflicts:
	libdap2/common34.c
	oc2/ocutil.c
2014-02-11 17:26:09 -06:00
Quincey Koziol
b2dfacbcfa Big clean up to type handling in libsrc4, which makes fill-values work
correctly for variables with string datatype, plus a few other minor changes.
2014-02-11 17:12:08 -06:00
Russ Rew
0627c82758 Fix for bit-for-bit reproducibility from Rimvydas Jasin, Quincey Koziol 2014-02-10 15:29:14 -07:00
Quincey Koziol
cd71eb525c Corrected "BAIL" macros to avoid infinite loop when logging is disabled and an
error occurs after an "exit:" label.

Corrected a dozen Coverity errors (mainly allocation issues, along with a few
    other things):
        711711, 711802, 711803, 711905, 970825, 996123, 996124, 1025787,
        1047274, 1130013, 1130014, 1139538

Refactored internal fill-value code to correctly handle string types, and
    especially to allow NULL pointers and null strings (ie. "") to be
    distinguished.  The code now avoids partially aliasing the two together
    (which only happened on the 'write' side of things and wasn't reflected on
    the 'read' side, adding to the previous confusion).

    Probably still weak on handling fill-values of variable-length and compound
    datatypes.

Refactored the recursive metadata reads a bit more, to process HDF5 named
    datatypes and datasets immediately, avoiding chewing up memory for those
    types of objects, etc.

Finished uncommenting and updating the nc_test4/tst_fills2.c code (as I'm
    proceeding alphabetically through the nc_test4 code files).
2013-12-29 01:12:43 -06:00
dmh
582410a407 [NCF-273]/HZY-708311
Add a new function called nc_inq_format_extended that
returns more detailed format information (vis-a-vis
nc_inq_format) about an open dataset.

Note that the netcdf API will present the file as if it had
the format specified by nc_inq_format.  The true file
format, however, may not even be a netcdf file; it might be
DAP, HDF4, or PNETCDF, for example. This function returns
that true file type.  It also returns the effective mode for
the file.

signature: nc_inq_format_extended(int ncid, int* formatp, int* modep)
where
* ncid is the NetCDF ID from a previous call to nc_open() or
  nc_create().
* formatp is a pointer to a location for returned true format.
* modep is a pointer to a location for returned mode flags.

Refer to the actual list in the file netcdf.h to see the
currently defined set.

Also added test cases (tst_formatx*).
2013-12-22 12:53:20 -07:00
Quincey Koziol
0d42ac7e87 Switch test for nc_inq_unlimdim and nc_inq_unlimdims to use the same ordering as
the rest of the dimension queries.  Correct error in library where types used
in sub-group variables but that were added to the file after the sub-group was
created weren't available for sub-group variables to use.  Start cleaning up
test suite and un-commenting tests that were commented out (got up to
nc_test4/tst_fills2.c, alphabetically) before running into an error in HDF5.
2013-12-15 19:55:41 -06:00
Quincey Koziol
b3044de434 Refactored read_scale(), memio_new(), var_create_dataset() and makespecial()
to clean up resources properly on failure.

Refactored doubly-linked list code for objects in the libsrc4 directory,
    cleaning up the add/del routines, breaking out the common next/prev
    pointers into a struct and extracting the add/del operations on them,
    changed the list of dims to add new dims in the same order as the other
    types, made all add routines able to optionally return a pointer to the
    newly created object.

Removed some dead code (pg_var(), nc4_pg_var1(), nc4_pg_varm(), misc. small
    routines, etc)

Fixed fill value handling for string types in nc4_get_vara().

Changed many malloc()+strcpy() pairs into calls to strdup().

Cleaned up misc. other minor Coverity issues.
2013-12-08 03:29:26 -06:00
Quincey Koziol
5ccb8a24b5 Merge branch 'master' into ncf-177 2013-11-30 23:40:26 -06:00
Quincey Koziol
e66e6e2b3a Merge remote-tracking branch 'upstream/master' 2013-11-30 23:24:44 -06:00
Quincey Koziol
e1fc13b215 Many changes to address NCF-177 (renaming dimensions and variables). Also
many cleanups to fix compiler warnings, streamline iteration over objects
in HDF5 file when opening the file, and generally straightening out the code
to be cleaner and simpler.

Tested on Mac OS/X with gcc 4.8 and OpenMPI (which uses clang).
2013-11-30 23:20:28 -06:00
dmh
2bc308432d sync with oc2.0 2013-11-14 15:13:20 -07:00
Russ Rew
751ac82ef7 For chunk computations that might overflow ints, use double instead of
float.
2013-10-17 14:25:39 -06:00
Ward Fisher
23cf133b39 Addressed Coverity issues 711911, 1102823 2013-10-07 16:25:30 -06:00
Quincey Koziol
d9069aaeaa More progress toward fixing NCF-177. 2013-09-28 12:40:21 -05:00
Russ Rew
68c8303743 Quincey's patch for NCF-269 parallel I/O bug. 2013-09-16 20:06:54 -06:00
Quincey Koziol
a5d23868b7 Merge branch 'master' into ncf-177 2013-09-14 13:22:12 -05:00
Quincey Koziol
7a4479be6b Minor cleanups to reduce warnings in headers, and switch from MPI_BYTE to MPI_INT
for MPI_Allreduce() call.
2013-09-14 13:19:58 -05:00
Ward Fisher
c238435853 Added stanza in nc4file.c, read_var, to avoid crashes when reading an h5 file with layout == "H5D_COMPACT". 2013-09-09 15:03:03 -06:00
Quincey Koziol
e808067582 Merge branch 'master' into ncf-177 2013-08-24 14:35:21 -05:00
Quincey Koziol
3cdce9e3af Correct error when a parallel application writes different amounts of data to
an unlimited-dimension variable, and different processes don't agree on the
whether to extend the underlying HDF5 dataset, or don't agree on the amount
to extend the dataset.
2013-08-18 20:45:17 -05:00
Quincey Koziol
a7ecaeb327 Work in progress on NCF-177. 2013-08-17 12:53:29 -05:00
Ward Fisher
f43bf8f1da Addressed a handful of issues identified by
Coverity static analysis.
2013-08-05 20:36:33 +00:00
Dennis Heimbigner
05369372f7 Debugged previously added
code to support group rename.
Also added a simple test case.
2013-07-21 01:08:39 +00:00
Dennis Heimbigner
b85d3568ec Added the necessary code to support
group renaming. The primary API
is 'nc_rename_grp(int grpid, const char* name)'.
No test cases provided yet.
This also required adding a rename_grp entry
to the dispatch tables.
2013-07-19 21:48:37 +00:00
Ward Fisher
1c23ec06b8 Merging latest from netcdf-cmake branch. Includes a handful
of fixes for coverity-identified errors.
2013-07-19 21:32:27 +00:00
Russ Rew
e4f9350c23 Quincey's fixes for NCF-56, "netcdf-4 can't read HDF5 scalar atts".
Also added ability capability for netCDF-4 to write and read NIL
values for string type attributes and variables, so these can be read
if used in HDF5 files.

Include are additions to CMakeLists files to reflect new tests.
2013-07-10 20:09:31 +00:00
Russ Rew
6cd8fca60d Quincey's fixes for NCF-250, netCDF-4 parallel independent access with
unlimited dimension hanging.  Extending the size of an unlimited
dimension in HDF5 must be a collective operation, so now an error is
returned if trying to extend in independent access mode.

Quincey's bug fixes for parallel build portability, particularly
OpenMPI on MacOS-X.
2013-07-08 21:31:13 +00:00
Russ Rew
58a63708cc Fix contributed by Nath Gopalaswamy to large file problem reading
netCDF classic or 64-bit offset files that have a UINT32_MAX flag for
large last record size of a variable that has values larger than 1
byte.  This problem had previously been fixed for *writing* such data,
but was only tested with an ncbyte variable.  Fixed test to
demonstrate problem and the fix.

More updates to chunking documentation, cosmetic fixes for some
"--option=" documentation that doxygen turns into mdash.
2013-06-25 17:04:10 +00:00
Ward Fisher
33d3d06971 Added initial 'make dist', 'make distcheck' support to
CMake-based builds.
2013-06-03 16:42:04 +00:00
Russ Rew
3152893da0 Updated documentation on default chunk size for unlimited dimensions.
Removed old heuristic for dims several orders of magnitude smaller
than the max dimension.
2013-05-28 15:34:55 +00:00
Dennis Heimbigner
de34ed2d5b merge from netcdf/trunk prior to merge back to trunk 2013-05-11 19:37:38 +00:00
Dennis Heimbigner
c583f91992 merge with trunk and fix conflicts 2013-05-10 17:04:28 +00:00
Dennis Heimbigner
4070bcf946 Fix (again) jira NCF-248.
So, it turns out that just freeing
the nc4_info is not enough;
The root group must also be reclaimed.
So, it appears the best approach
is to invoke an abort on the
failed file.
2013-04-24 22:11:44 +00:00
Ward Fisher
67f96188ff Merged latest from netCDF-cmake branch in preparation for 4.3.0 release. 2013-04-23 21:50:07 +00:00
Dennis Heimbigner
e960416761 Fix JIRA NCF-248 2013-04-23 18:02:35 +00:00
Russ Rew
3a87936711 New RELEASE_NOTES entry and a couple of Coverity fixes. 2013-04-23 16:27:28 +00:00
Russ Rew
6ebc98d254 Fix NCF-247 bug, and add test for bug fix. 2013-04-22 22:34:21 +00:00
Ward Fisher
b113f6f8b6 Merged a handful of changes from netcdf-cmake branch.
Addressed the following coverity issues:

711762
711763
711766
711788
711933
711934
711935
2013-04-16 23:02:54 +00:00
Ward Fisher
b70e1d74af Merged latest from cmake development branch. 2013-04-16 17:23:14 +00:00
Russ Rew
8b3a9505ae Revert nc4file.c to r3113, because r3123 version broke --enable-extra-tests build 2013-04-08 19:33:30 +00:00
Ward Fisher
4a274b9870 Merged latest changes from cmake development branch.
Addressed a number of memory-related problems
reported by Coverity.
2013-04-02 22:09:31 +00:00
Ward Fisher
9f187a1484 Merged the fix for NCF-29 from Quincy into the trunk. 2013-03-26 18:57:26 +00:00
Dennis Heimbigner
c659633d2e merge from trunk 2013-03-26 16:45:02 +00:00
Dennis Heimbigner
4b7817e69e Return EACCES instead of NC_EMETADATA when failing to create an HDF5 file 2013-03-26 16:31:56 +00:00
Russ Rew
b36dc5b5fb Fix NCF-244 bug for case where using different order for defining
coordinate variables and their associated dimensions occurs in any
subgroup, rather than just the root group.  If this occurs, the
variable attribute "_Netcdf4Dimid" is created for every dimension
scale.

Also add a test for this bug fix in tst_dims3.nc, based on Pedro
Vicente's demo.
2013-03-26 15:14:19 +00:00
Russ Rew
2071ca9bf3 Fixed NCF-244, a netCDF-4 bug resulting in two dimensions with the same dimension ID 2013-03-25 18:06:19 +00:00
Dennis Heimbigner
4e41843740 1) fix some minor bugs when pnetcdf is enabled 2)Comment out some apparently unused procedures 2013-03-25 17:12:50 +00:00
Dennis Heimbigner
8d993d58d8 undo a conversion to static 2013-03-25 16:29:19 +00:00
Dennis Heimbigner
9b4db7a039 Make some things static that do not need to be externally visible 2013-03-24 17:33:17 +00:00
Dennis Heimbigner
dea3c726c8 merge trunk into this branch 2013-03-15 20:31:07 +00:00
Ward Fisher
6096f6b43b Merged changes from CMake branch.
Addressed a handful of memory leaks
reported by Coverity.
2013-03-14 22:49:21 +00:00
Dennis Heimbigner
9eaac2a595 Apply Wei-Keng's fix
for JIRA issue NCF-241.
This is only temporary
until I can make pnetcdf
operate as a separate dispatch table.

Also, fix nc_test4/tst_pnetcdf
to open with nc_open_par;
this is necessary because a pnetcdf
created file cannot be opened
as a netcdf classic file.
2013-03-13 17:34:47 +00:00
Koziol
0f29dd60c0 Description:
Fix Jira issue NCF-29 (https://bugtracking.unidata.ucar.edu/browse/NCF-29):
making the netCDF-4 library ignore HDF5 datasets and attributes which have
datatypes (such as references) that it doesn't understand.

Tested on:
    Mac OSX/64 10.8.2 (amazon) w/--enable-netcdf-4 --enable-extra-tests --enable-extra-example-tests
        --disable-shared --enable-logging
2013-03-01 08:10:28 +00:00
Ward Fisher
57084316de Merging changes from netCDF branch. 2013-02-28 21:50:55 +00:00
Ward Fisher
ddf3c31bb0 Corrected a handful of syntax issues in CMake config files,
probably introduced more.  

Added CMake-related files to Makefile.am files for inclusion
when creating a distribution package.
2013-02-20 23:28:28 +00:00
Ward Fisher
5703c0979e Corrected an issue I introduced which broke a particular parallel test. 2013-02-12 21:27:52 +00:00
Russ Rew
7a3f42974c Fix bug NCF-222, scalar non-coordinate variables with same name as dimensions. (Previous commit was just test, this is really the fix. 2013-02-04 15:49:52 +00:00
Russ Rew
fab1c8675c Fix NCF-217, a bug depending on order of calls to netCDF-4 functions 2013-02-01 17:38:26 +00:00
Ward Fisher
71a30406f7 Corrected 2 windows-specific errors when using Visual Studio:
1. In nc4hdf.c, had a variable declaration located such
that Visual Studio complained and threw an error. Moved
to head of function.

2. Visual Studio was complaining about variable declarations
being made after OCVERIFY/OCDEREF macros.
2013-01-29 23:33:59 +00:00
Ward Fisher
c20baac22b Removed dependency on NC_MAX_DIMS from libsrc4 files.
Improved HDF4 suport in CMakeLists.txt
Remaining files were not changed, but svn picks up
'property changes' on them.
2013-01-28 19:58:06 +00:00
Ward Fisher
19dcece866 Merged latest trunk, addressed NC_MAX_DIMS dependence in libsrc4 2013-01-28 18:31:02 +00:00
Ward Fisher
fae7d90194 Removing reliance on NC_MAX_VAR_DIMS 2013-01-22 20:59:39 +00:00
Ward Fisher
23647a6910 2013-01-22 20:37:23 +00:00
Ward Fisher
1a77185d5e 2013-01-22 19:47:46 +00:00
Dennis Heimbigner
0d8c0b9276 more pnetcdf fixes 2013-01-18 02:25:12 +00:00
Ward Fisher
426c1508a3 2013-01-16 21:14:29 +00:00
Ward Fisher
91188cea7a Merging CMake branch into trunk. Changes include:
CMake related changes in CMakeLists.txt files,
cmake_config.h.in. Other changes relate to 
Windows-specific issues, and changes made
when regenerating generated source files.
2013-01-15 22:43:09 +00:00
Ward Fisher
4a6b93f3ab A test from netcdf-cmake branch made its way into the trunk;
corrected.
2013-01-15 19:48:12 +00:00
Russ Rew
22b411a17c Merged in pnetcdf fixes from Greg Sjardema, to make set_fill_mode work
with parallel-netcdf, to fully implement parallel-netcdf support for
other functions, and to prevent a hang in hdf5 from an eary return in
an nc4_put_vara() call.  Also fixed an nccopy bug when
nc_inq_var_deflate() returns defalate_level of 0, but says the variable
is deflated.
2013-01-15 03:46:46 +00:00
Ward Fisher
21523c8582 Merged changes from cmake branch. oc2 changes are just
'file property' changes, not sure what exactly.
2012-12-20 21:50:45 +00:00
Dennis Heimbigner
adbe2ba5f1 extend r2822 to work when logging is enabled 2012-12-18 19:44:39 +00:00
Ward Fisher
7b91248723 Merged changes from netcdf-branch.
o Changed variable names 'typeid' to 'typeid1' to avoid a namespace conflict
in visual studio.
o Cleaned up a handful of warnings in Visual Studio.
o Addressed a few Coverity-discovered issuesl
o Made changes to CMake-based builds.
2012-12-13 22:09:41 +00:00
Dennis Heimbigner
635a03f2f7 It turns out that when I converted the code
to keep the NC structure pure and independent
of any file format, I neglected to check with
--enable-hdf4. These changes appear to fix that
problem.
2012-12-13 18:22:11 +00:00
Dennis Heimbigner
5f2eb8afbf Fix a number of potential problems by changing calls to nc_XXX to NC3/4_XXX 2012-12-12 20:05:06 +00:00
Ward Fisher
cf0d0b54f2 Merged latest changes from cmake branch. Fixed a test file, and changed a deallocation call to avoid throwing an error on Windows related to cross-dll memory-management. 2012-12-07 23:21:27 +00:00
Ward Fisher
85382f21bc Fixed a handful of issues identified by Coverity. 2012-12-06 00:06:32 +00:00
Ward Fisher
ff631c8156 Merged latest changes from cmake branch.
o Improved CMake support.
o Cmake module compatibility (netcdf-config*.cmake.in).
2012-11-19 21:43:12 +00:00
Russ Rew
8e98e3727d Fixed bug NCF-144 (ncdump of variables with multiple unlimited
dimensions).  Added comprehensive tests that include variables with
lots of combinations of 0 through 4 fixed and unlimited dimensions.
2012-11-16 21:37:43 +00:00
Ward Fisher
afa67452f6 Took some time to address a handful of errors identified by Coverity.
Primarily focused on memory errors falling into a couple different types:

1) Static overrun errors.
2) Dereference uninitialized memory errors.

make distcheck works after applying these fixes, and coverity no longer sees an issue, so hopefully they are properly resolved.
2012-11-14 18:24:45 +00:00
Ward Fisher
45f77090a1 Addressed a handful of minor 'fixed-length buffer overrun'
errors identified by Coverity.  The fixes involved replacing calls
to strcpy, strcat with strncpy, strncat.
2012-10-31 21:31:47 +00:00
Ward Fisher
7a226dd3f1 Merging the win_netcdf branch into the trunk. 2012-09-27 22:50:41 +00:00
Ward Fisher
f2d2ddf435 2012-09-26 20:30:19 +00:00
Ward Fisher
98675a8047 Merged with latest trunk. 2012-09-26 17:08:23 +00:00
Russ Rew
a92c7c98a0 Fixed DOS line endings in source file.
Fixed minor memory leak found by Coverity.
Fixed misleading error message in configure.
2012-09-25 21:48:14 +00:00
Ward Fisher
e55d002dbc Merged Dennis' changes from trunk. 2012-09-06 21:15:37 +00:00
Dennis Heimbigner
5ca78309cc The effect of this change is to make the struct NC structure
contain as little file-type specific info as possible.  It
modifies especially libsrc so that all of the netcdf-3 data
that used to be in struct NC is now kept in a separate chunk
of data pointed to by the struct NC. This makes all of
current protocols consistent: netcdf-3, netcdf-4, and dap.
2012-09-06 19:44:03 +00:00
Ward Fisher
7ef113df5f 2012-08-24 18:24:58 +00:00
Russ Rew
eda91aa9cf Enhanced netcdf-4 to be able to deal with optional user area data
block at the front of some HDF5 files (NCF-28).  Also fixed some minor
typos in doxygen blocks in netcdf.h.
2012-08-22 21:53:06 +00:00
Ward Fisher
235fc6bb13 Merged latest trunk into branch 2012-08-22 19:52:24 +00:00
Russ Rew
24a1cd0718 Fix test of H5Tget_size() return so it can actually detect an error.
Remove some dead code.  Fix declaration of X_INT_MIN in tests.h.
2012-08-22 14:57:30 +00:00
Ward Fisher
e8453be1e5 Merged from trunk into branch 2012-08-20 18:30:04 +00:00
Russ Rew
8d53da4826 Fixed bug "adding a bad _FillValue" bug (NCF-190). Fixed minor bugs
reported by static analysis, including memory leak in ncdump, missing
size_t cast for chunk cache.  Fixed various doc problems, including
byte vs. char issues, missing NC_UBYTE in type list, needed link to
"Building with Windows" page.
2012-08-16 18:31:48 +00:00
Ward Fisher
14619ec4c4 2012-08-09 18:40:41 +00:00
Ward Fisher
0607b62375 Added coverage test flags to CMakeLists.txt files. 2012-08-09 17:07:41 +00:00
Ward Fisher
05cde40552 2012-08-08 22:31:28 +00:00
Ward Fisher
0ee2fba307 Expanded ctest functionality. 2012-08-07 20:21:44 +00:00
Ward Fisher
0d90326575 Integrated latest changes to trunk, added preliminary CPack support. 2012-08-02 22:56:57 +00:00
Ward Fisher
7163dc49d8 Changed a few dangling checks for H5F_LIBVER_18 to H5F_LIBVER_LATEST. These were causing compile failures on some versions of Ubuntu (10.10, 11.??) 2012-08-01 20:57:23 +00:00
Ward Fisher
1af2b768b0 Merged changes from trunk (mainly Dennis' oc2 inclusion). 2012-07-31 22:04:25 +00:00
Dennis Heimbigner
42999f4c7c move from oc1.0 to oc2.0; create new dir oc2 2012-07-31 20:34:13 +00:00
Ward Fisher
71075cee2e Additional changes in support of CMake. 2012-07-18 21:12:58 +00:00