Commit Graph

796 Commits

Author SHA1 Message Date
Ed Hartnett
8885c75ade removing unneeded lookups 2018-08-22 06:08:19 -06:00
Ed Hartnett
d8c1a6209a removed unneeded lookup function 2018-08-21 11:54:06 -06:00
Ed Hartnett
990a75d5d7 clean up of find_grp functions 2018-08-21 11:23:12 -06:00
Ed Hartnett
ece953458d cleanup of group find functions 2018-08-21 10:50:32 -06:00
Ed Hartnett
42b9dc778f removing unneeded function nc4_rec_find_grp 2018-08-21 10:28:44 -06:00
Ed Hartnett
0feeba691e removed enum test file from configure because it is not being used 2018-08-21 07:24:43 -06:00
Ed Hartnett
3bbc590045 merged master 2018-08-20 17:08:20 -06:00
Ed Hartnett
b3842197e0 merged master 2018-08-16 05:49:41 -06:00
Ed Hartnett
d59446ccd5
Merge branch 'master' into ejh_func_cleanup3 2018-08-15 18:08:34 -06:00
Ed Hartnett
b5999278cc added nc4_find_grp_h5_var 2018-08-09 06:47:45 -06:00
Ed Hartnett
a65078040d whitespace cleanup 2018-08-07 15:17:40 -06:00
Ed Hartnett
9dc99c8a04 cleaned up some functions in preparation for lazy vars 2018-08-06 10:16:49 -06:00
Ed Hartnett
c1acba1f07 redid branch for PR 2018-07-29 04:57:25 -06:00
Ed Hartnett
5a52f28bb7 further condensing code 2018-07-21 10:43:36 -06:00
Ed Hartnett
7aed50a902 performance test for fast global att reads 2018-07-21 07:29:12 -06:00
Ed Hartnett
0d8dd16231 removed use of hdfid from libsrc4 directory 2018-07-19 13:13:23 -06:00
Ed Hartnett
d1198a3667 whitespace cleanup 2018-07-19 07:33:48 -06:00
Ed Hartnett
9b0192fe94 moved memfile code to libhdf5 2018-07-19 07:26:27 -06:00
Ed Hartnett
3c0abc3d28 moved hdf5 var code to hdf5var.c 2018-07-19 07:23:03 -06:00
Ed Hartnett
bdca4313c4 split nc4var.c 2018-07-19 07:05:55 -06:00
Ed Hartnett
396124c0ca merged ejh_hdf5internal 2018-07-17 07:56:09 -06:00
Ed Hartnett
786c5a8f2e moved hdf5 specific header stuff to hdf5internal.h 2018-07-12 07:05:21 -06:00
Dennis Heimbigner
40013b72f6 The pr does some cleanup on the internal documentation
in the docs directory.
1. Add a new internal document -- testserver.dox -- to describe
   how to set up and maintain the dap test server.
2. It moves the internal documentation (internal.dox, indexing.dox,
   and testserver.dox) to later in the documentation table of contents.
3. Cleanup the formatting of the internal documents.
4. Cleanup some minor doxygen issues in other files.
2018-06-29 15:06:27 -06:00
Ed Hartnett
697f033823 renamed NC_HDF5_FILE_INFO to NC_FILE_INFO 2018-06-22 07:08:09 -06:00
Ed Hartnett
eafe151f13 added test 2018-06-19 14:59:07 -06:00
Ed Hartnett
77936f2884 more progress towards lazy read of atts for vars 2018-06-19 08:25:19 -06:00
Ed Hartnett
b524cd04bc adding calls to get var atts when needed 2018-06-19 07:56:54 -06:00
Ed Hartnett
81add527f2 lazy read of global atts now working 2018-06-19 07:39:42 -06:00
Ed Hartnett
6b90169278 switching to att_not_read 2018-06-19 05:05:44 -06:00
Ed Hartnett
dad70cf880 more lazy atts 2018-06-19 04:54:03 -06:00
Ed Hartnett
93278a8561 merged in outstanding PRs 2018-06-19 03:59:00 -06:00
Ed Hartnett
9230cb8aa9 now using put_vars too 2018-06-16 10:37:49 -06:00
Ed Hartnett
77ab979c5f using get_vars but not put_vars 2018-06-16 09:58:48 -06:00
Ed Hartnett
12cf3254dc using get_vars but not put_vars 2018-06-16 09:10:31 -06:00
Ed Hartnett
4f83e929c0 switch to vars 2018-06-16 08:38:52 -06:00
Ed Hartnett
416da4cb4f took out is_long for vars functions 2018-06-16 05:55:50 -06:00
Ed Hartnett
3f9315d58f took out defaultvars 2018-06-16 05:52:07 -06:00
Ed Hartnett
19ae8b47d1 took out src_long and dest_long again. Getting good at it! ;-) 2018-06-16 05:33:04 -06:00
Ed Hartnett
2ca8526278 merged master 2018-06-14 16:57:38 -06:00
Ward Fisher
5fe7d0ffad
Merge branch 'master' into ejh_udf 2018-06-08 16:52:20 -06:00
Ward Fisher
1d789d9d39 Additional reconciliation 2018-06-08 15:50:39 -06:00
Ward Fisher
df4942d280 Merge branch 'master' into vars.dmh 2018-06-08 15:50:28 -06:00
Ed Hartnett
29ce3b7d8c
Merge branch 'master' into ejh_udf 2018-06-08 14:49:15 -06:00
Ed Hartnett
03d1a7c7cc
Merge branch 'master' into ejh_logging 2018-06-08 03:17:01 -06:00
Ed Hartnett
367d7c2a57 merged master 2018-06-07 18:36:25 -06:00
Ward Fisher
32b8ffbee9 Merge branch 'master' into misc-changes.wif 2018-06-07 16:17:54 -06:00
Ed Hartnett
9a2782b56c got long working with master 2018-06-05 14:40:49 -06:00
Ed Hartnett
8996b36c66 fixed make clean in docs 2018-06-05 11:30:59 -06:00
Ed Hartnett
d556dcb2c9 udf1 stuff 2018-06-03 06:28:55 -06:00
Ed Hartnett
01d1364331 user defined formats working 2018-06-03 06:14:23 -06:00
Ed Hartnett
2e831e9bbe initialization of user-defined formats 2018-06-02 08:43:34 -06:00
Ward Fisher
3a0d55f137 Removed a null assignment. 2018-05-31 16:40:11 -06:00
Ward Fisher
acc0b29140 Potential dereference of a null pointer fixed. 2018-05-31 15:28:13 -06:00
Ward Fisher
165d59e6af Fixed a potential memory leak identified by static analysis. 2018-05-31 15:25:40 -06:00
Dennis Heimbigner
4b936ee26a Fix use of 'int' to represent 'hid_t' that caused HDF5 1.10 to fail.
re: github issue https://github.com/Unidata/netcdf-fortran/issues/82

This was originally discovered in the Fortran tests, but is
a problem in the C library.

The problem only occurred when using HDF5-1.10.x.  The reason it
failed is that starting with 1.10, the hid_t type was changed
from 32 bits to 64 bits.
The function libsrc4/nc4memcb.c#NC4_image_init was using type int (doh!)
to return the hdf fileid instead of hid_t type.  This, of course,
caused the id to be truncated and in turn later use of the id
caused hdf5 to fail.

Fix is trivial: replace int with hid_t. This also requires a related
change in nc4mem.c.

Also added the test case derived from the original Fortran code.

You would think I would learn...
2018-05-30 14:47:37 -06:00
Dennis Heimbigner
2f1daaa61e Merge branch 'master' into vars.dmh 2018-05-30 10:45:00 -06:00
Ward Fisher
84fd054a29 Merge branch 'ejh_hdf5_3' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into misc-changes.wif 2018-05-29 15:39:09 -06:00
Ed Hartnett
e0f92efaa2 fixed logging 2018-05-24 14:55:34 -06:00
Ed Hartnett
f2cb4678ee moving HDF5 functions to libhdf5 2018-05-24 14:27:16 -06:00
Ward Fisher
4283b791b5 Misc changes to appveyor testing. 2018-05-24 13:16:56 -06:00
Dennis Heimbigner
ee509ff4f3 Re-Implement the nc_get/put_vars operations for netcdf-4 using the
corresponding HDF5 operations.

re: github issue https://github.com/Unidata/netcdf-c/issues/908
also in reference to https://github.com/pydata/xarray/issues/2004

The netcdf-c library has implemented the nc_get_vars and nc_put_vars
operations as element at a time. This has resulted in very slow
operation.

This pr attempts to improve the situation for netcdf-4/hdf5 files
by using the slab operations provided by the hdf5 library. The new
implementation passes the get/put vars stride information down to
the hdf5 slab operations.

The result appears to improve performance significantly. Some simple
tests on large 2-D arrays shows speedups in excess of 150.

Misc. other changes:
1. fix bug in ncgen/semantics.c; using a list's allocated length
   instead of actual length.
2. Added a temporary hook in the netcdf library plus a performance
   test case (tst_varsperf.c) to estimate the speedup. After users
   have had some experience with this, I will remove it, probably
   after the 4.7 release.
2018-05-22 16:50:52 -06:00
Ed Hartnett
3e320a5bfb moved more HDF5 functions to libhdf5 2018-05-15 06:47:52 -06:00
Ed Hartnett
c06ec6aa48
Merge branch 'master' into ejh_logging 2018-05-14 17:17:36 -06:00
Ed Hartnett
82c80c8c6c fixed issue building without nc_set_log_level 2018-05-12 11:46:04 -06:00
Ed Hartnett
27a74dee54 now always define nc_set_log_level unless user disables 2018-05-12 11:27:11 -06:00
Ward Fisher
2bb209f9c5 Corrected typo. 2018-05-08 15:06:27 -06:00
Ward Fisher
eca1477a3e Corrected an issue with parallel builds. 2018-05-08 14:58:00 -06:00
Ed Hartnett
c402b79ed8 merged changes from master 2018-05-08 12:13:03 -06:00
Ed Hartnett
5526ca65d1 created libhdf5, moved some files 2018-05-08 11:58:01 -06:00
Ward Fisher
90122c317f Merge branch 'patch-21' of https://github.com/gsjaardema/netcdf-c into pr-consolidate.wif 2018-05-08 11:11:44 -06:00
Greg Sjaardema
700262c5ab
Fix unused variable compiler warning
Fix unused variable warning for `printid`.   Looks like it was not substituted in all places where it should have been and was only used inside an ifdef so was unused if `LOGGING` was false.  Add use in `fprintf` line following the ifdef block.

Minor change, but compilation output is so clean that a little wart sticks out...
2018-05-07 08:56:19 -06:00
Dennis Heimbigner
5bc174920f re: esupport MQO-415619
There is an error in handling the nc_create_memio function
as noted in the above esupport thread.
This attempts to fix it.

Also do a master merge
2018-05-03 21:02:32 -06:00
Dennis Heimbigner
9aa1e9a14e master merge 2018-05-03 21:02:12 -06:00
luz.paz
b4d0fe651a Follow-up trivial typos 2018-04-26 23:04:01 -04:00
Dennis Heimbigner
0a44d9ae3a Merge branch 'master' into inmemory.dmh 2018-04-23 11:30:14 -06:00
Greg Sjaardema
e9088e5dfa
Use hdf5-1.8 compatible output format if possible
In hdf5-1.10.2, THG added a new enumeration for use in the `H5Pset_libver_bounds` function which makes it easier to maintain compatibility with hdf5-1.8.X clients.   

An explanation is provided at https://www.hdfgroup.org/2018/04/why-should-i-care-about-the-hdf5-1-10-2-release/ 

In particular, the section "What does this change mean to an HDF5 application?" discusses its use with NetCDF
2018-04-19 13:26:56 -06:00
Ward Fisher
14903ac981 Removed a reference to a non-existant file. 2018-04-13 14:37:40 -06:00
Dennis Heimbigner
4739cd3225 Master merge and conflict resolution 2018-04-12 21:51:17 -06:00
Dennis Heimbigner
42e8028726 Re: github issues
https://github.com/Unidata/netcdf-c/issues/917
https://github.com/Unidata/netcdf-c/issues/915

Fix following memory errors:
1. global_buffer_overflow
2. nc4_att_list_add
2018-03-29 14:57:40 -06:00
Dennis Heimbigner
eace0e922e Fixed case when --enable-parallel is true 2018-03-28 13:41:26 -06:00
Dennis Heimbigner
1246dd189b merge master 2018-03-20 21:50:58 -06:00
Dennis Heimbigner
25f062528b This completes (for now) the refactoring of libsrc4.
The file docs/indexing.dox tries to provide design
information for the refactoring.

The primary change is to replace all walking of linked
lists with the use of the NCindex data structure.
Ncindex is a combination of a hash table (for name-based
lookup) and a vector (for walking the elements in the index).
Additionally, global vectors are added to NC_HDF5_FILE_INFO_T
to support direct mapping of an e.g. dimid to the NC_DIM_INFO_T
object. These global vectors exist for dimensions, types, and groups
because they have globally unique id numbers.

WARNING:
1. since libsrc4 and libsrchdf4 share code, there are also
   changes in libsrchdf4.
2. Any outstanding pull requests that change libsrc4 or libhdf4
   are likely to cause conflicts with this code.
3. The original reason for doing this was for performance improvements,
   but as noted elsewhere, this may not be significant because
   the meta-data read performance apparently is being dominated
   by the hdf5 library because we do bulk meta-data reading rather
   than lazy reading.
2018-03-16 11:46:18 -06:00
Dennis Heimbigner
ccc70d640b re: esupport MQO-415619
and https://github.com/Unidata/netcdf-c/issues/708

Expand the NC_INMEMORY capabilities to support writing and accessing
the final modified memory.

Three new functions have been added:
nc_open_memio, nc_create_mem, and nc_close_memio.

The following new capabilities were added.
1. nc_open_memio() allows the NC_WRITE mode flag
   so a chunk of memory can be passed in and be modified
2. nc_create_mem() allows the NC_INMEMORY flag to be set
   to cause the created file to be kept in memory.
3. nc_close_mem() allows the final in-memory contents to be
   retrieved at the time the file is closed.
4. A special flag, NC_MEMIO_LOCK, is provided to ensure that
   the provided memory will not be freed or reallocated.

Note the following.
1. If nc_open_memio() is called with NC_WRITE, and NC_MEMIO_LOCK is not set,
   then the netcdf-c library will take control of the incoming memory.
   This means that the original memory block should not be freed
   but the block returned by nc_close_mem() must be freed.
2. If nc_open_memio() is called with NC_WRITE, and NC_MEMIO_LOCK is set,
   then modifications to the original memory may fail if the space available
   is insufficient.

Documentation is provided in the file docs/inmemory.md.
A test case is provided: nc_test/tst_inmemory.c driven by
nc_test/run_inmemory.sh

WARNING: changes were made to the dispatch table for
the close entry. From int (*close)(int) to int (*close)(int,void*).
2018-02-25 21:45:31 -07:00
Dennis Heimbigner
8cb1fc4cfe This is the second step in refactoring the libsrc4 code.
The first was branch newhash0.dmh.

As with newhash0.dmh, these changes should be transparent.
2018-02-24 20:36:24 -07:00
Ed Hartnett
9de58cad99
Merge branch 'master' into ejh_extra_tests 2018-02-19 18:52:50 -07:00
Ward Fisher
40805e5dfa
Merge branch 'master' into ejh_hdf4_dispatch_unidata2 2018-02-16 13:02:05 -07:00
Ben Boeckel
bdae9b4c44 nc4hdf: use PRId64 for hid_t format strings 2018-02-14 17:24:49 -05:00
Ben Boeckel
7505bed6f5 nc4dispatch: don't initialize fields which may not exist
These fields are only here if `USE_NETCDF4` is defined.
2018-02-14 17:24:49 -05:00
Ed Hartnett
e5cbf259ba fixed string memory leak 2018-02-13 14:17:15 -07:00
Ed Hartnett
2358d4a910 moved HDF4 to its own dispatch layer 2018-02-08 06:20:58 -07:00
Ward Fisher
a640c034f2 Merge branch 'ejh_atts_unidata' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into ejh_batch 2018-02-05 11:47:48 -07:00
Ward Fisher
e0577cb251 Merge branch 'ejh_fill_value_string_unidata' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into ejh_batch 2018-02-05 11:47:34 -07:00
Ward Fisher
b268f268bd Merge branch 'ejh_dims_unidata' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into ejh_batch 2018-02-05 11:43:41 -07:00
Ed Hartnett
0d96ead703
Merge branch 'master' into ejh_dims_unidata 2018-02-05 06:34:04 -07:00
Ward Fisher
c12fca453e Merge branch 'ejh_rename2_unidata' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into ejh_batch 2018-02-02 17:57:32 -07:00
Ward Fisher
27693ba4a3
Merge branch 'master' into nc3-per-var-fill-v2 2018-02-01 11:45:40 -07:00
Ed Hartnett
69c899a529 removed results of other merges from nc4var.c 2018-02-01 05:28:24 -07:00
Ed Hartnett
2afe401f17 another rename fix 2018-02-01 05:10:57 -07:00
Greg Sjaardema
e887772e8f
Eliminate unused variables
Eliminate variables no longer used after recent refactorings.
2018-01-31 09:03:19 -07:00
Ed Hartnett
7c936a7bb6 brought in changes from ejh_att 2018-01-31 08:44:33 -07:00
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