Commit Graph

439 Commits

Author SHA1 Message Date
Dennis Heimbigner
8072d1f6bb Modify DAP2 and DAP4 to optionally allow Fillvalue/Variable mismatch
re: issue https://github.com/Unidata/netcdf-c/issues/1151

Modify DAP2 and DAP4 code to handle case when _FillValue type is not
same as the parent variable type.

Specifically:
1. Define a parameter [fillmismatch] to allow this mismatch;
   default is to disallow.
2. If allowed, forcibly change the type of the _FillValue to match
   the parent variable.
3. If allowed Convert the values to match new type
4. Generate a log message
5. if not allowed, then fail

Implementing this required some changes to ncdap_test/dapcvt.c
Also added test cases.

Minor Unrelated Changes:
1. There were a number of warnings about e.g.
   assigning a const char* to a char*. Fix these
2. In nccopy.1, replace .NP with .IP "n"
   (re PR https://github.com/Unidata/netcdf-c/pull/1144)
3. fix minor error in ncdump/ocprint
2018-10-01 15:51:43 -06:00
Dennis Heimbigner
d62a9e623c Fix the NC_INMEMORY code to work in all cases with HDF5 1.10.
re: github issue https://github.com/Unidata/netcdf-c/issues/1111

One of the less common use cases for the in-memory feature is
apparently failing with HDF5-1.10.x.  The fix is complicated and
requires significant changes to libhdf5/nc4memcb.c. The current
setup is detailed in the file docs/inmeminternal.dox.

Additionally, it was discovered that the program
nc_test/tst_inmemory.c, which is invoked by
nc_test/run_inmemory.sh, actually was failing because of the
above problem. But the failure is not detected since the script
does not return non-zero value.

Other Changes:
1. Fix nc_test_tst_inmemory to return errors correctly.
2. Make ncdap_tests/findtestserver.c and dap4_tests/findtestserver4.c
   be generated from ncdap_test/findtestserver.c.in.
3. Make LOG() print output to stderr instead of stdout to
   avoid contaminating e.g. ncdump output.
4. Modify the handling of NC_INMEMORY and NC_DISKLESS flags
   to properly handle that NC_DISKLESS => NC_INMEMORY. This
   affects a number of code pieces, especially memio.c.
2018-09-04 11:27:47 -06:00
Wei-keng Liao
0ee68a3263 This commit fixes the logical problem of using the default file formats.
The fix includes the following changes.
1. Checking and using the default file format at file create time is now
   done only when the create mode (argument cmode) does not include any
   format related flags, i.e. NC_64BIT_OFFSET, NC_64BIT_DATA,
   NC_CLASSIC_MODEL, and NC_NETCDF4.
2. Adjustment of cmode based on the default format is now done in
   NC_create() only. The idea is to adjust cmode before entering the
   dispatcher's file create subroutine.
3. Any adjustment of cmode is removed from all I/O dispatchers, i.e.
   NC4_create(), NC3_create(), and NCP_create().
4. Checking for illegal cmode has been done in check_create_mode() called
   in NC_create(). This commit removes the redundant checking from
   NCP_create().
5. Remove PnetCDF tests in nc_test/tst_names.c, so it can focus on testing
   all classic formats and netCDF4 formats.

Two new test programs are added. They can be used to test netCDF with and
without this commit.
1. nc_test/tst_default_format.c
2. nc_test/tst_default_format_pnetcdf.c (use when PnetCDF is enabled).
2018-07-28 11:18:28 -05:00
Ward Fisher
2f791cc749 Merge branch 'enable-cdf5' of https://github.com/wkliao/netcdf-c into pr-aggregation.wif 2018-07-17 11:26:21 -06:00
Wei-keng Liao
f95d3e3325 replace USE_CDF5 with ENABLE_CDF5 2018-06-29 21:17:07 -05:00
Wei-keng Liao
1b6f579aa4 another typecast missed 2018-06-17 13:16:09 -05:00
Wei-keng Liao
547b7405e7 miss another typecast 2018-06-15 17:30:30 -05:00
Wei-keng Liao
ab2dbc0d84 Promote NC_var member len from size_t to long long to fix some problems of large-variable tests on 320bit platforms. 2018-06-15 15:08:05 -05:00
Wei-keng Liao
a2e0ef4ea6 Checking large-sized variables has been moved to NC_enddef() as explained in below comments at lines 491-495. This is most likely caused by git merge failed to delete residue codes. 2018-06-15 14:23:09 -05:00
Ward Fisher
db8d23b986 Removed a potential double-free identified by static analysis. 2018-05-31 15:09:11 -06:00
Ward Fisher
3f83cc4926 Merge branch 'master' into inmem2.dmh 2018-05-16 14:24:19 -06:00
Ward Fisher
27ca221bdb Merge branch 'master' into appveyor.wif 2018-05-14 13:19:17 -06:00
Dennis Heimbigner
3c7ffcc6d1 Fix https://github.com/Unidata/netcdf-c/issues/963
Fix https://github.com/Unidata/netcdf-c/issues/962

1. remove the --disable-diskless option since it is no
   longer needed. Similarly for CMakeLists.txt.
2. Fixed nc4files.c where BAIL and return were mixed
   leading to situation where cleanup code was not
   being invoked. This probably occurs elsewhere,
   but I did not find any specifically.
2018-05-11 15:30:19 -06:00
Ward Fisher
94cbded134 Merge branch 'ejh_fix_n3' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into pr-consolidate.wif 2018-05-08 11:43:19 -06:00
Ed Hartnett
c175a302da fixed some issues 2018-05-08 11:39:37 -06:00
Ward Fisher
544c0994c9 Merge branch 'msvc-vs2013-support' of https://github.com/mathstuf/netcdf-c into pr-consolidate.wif 2018-05-08 11:12:19 -06:00
Dennis Heimbigner
9aa1e9a14e master merge 2018-05-03 21:02:12 -06:00
Ward Fisher
fa81457d18
Merge branch 'master' into msvc-vs2013-support 2018-05-02 16:27:59 -06:00
luz.paz
b4d0fe651a Follow-up trivial typos 2018-04-26 23:04:01 -04:00
Ward Fisher
28ce3e4a8c Added fenceposts around bash scripts, excluding the bash.exe included with Windows 10 (for now) when searching to see if bash is available. 2018-04-26 14:38:56 -06:00
Ward Fisher
eb34e3ab85
Merge branch 'master' into msvc-vs2013-support 2018-04-23 13:38:00 -06:00
Dennis Heimbigner
0a44d9ae3a Merge branch 'master' into inmemory.dmh 2018-04-23 11:30:14 -06:00
Ward Fisher
46e39c3647 Merge branch 'err_endef_close' of https://github.com/wkliao/netcdf-c into gh479-conflict-resolution 2018-04-18 10:22:53 -06:00
Dennis Heimbigner
4739cd3225 Master merge and conflict resolution 2018-04-12 21:51:17 -06:00
Ward Fisher
5ff3bb34ca
Merge branch 'master' into msvc-vs2013-support 2018-04-12 15:57:30 -05:00
Ward Fisher
28082c283b
Merge branch 'master' into index.dmh 2018-03-26 23:47:43 -06:00
Ward Fisher
7b86b4d3d3
Merge branch 'master' into issue899.dmh 2018-03-26 22:31:29 -06:00
Dennis Heimbigner
efe2fa727e Fix bug: Index exceeds dimension bound
Fix github issue https://github.com/Unidata/netcdf-c/issues/899
which came from e-support UOY-859712.

The problem was that the vlen_max parameter
to libsrc/var.c#NC_check_vlen was of type size_t.
However, it is being called, sometimes, with values
of size X_INT64_MAX. The resulting truncation was
causing dimension failures as noted in the e-support
report.

Fix is to change the vlen_max argument (and some
local variables in NC_check_vlen) to be of declared
as unsigned long long.
2018-03-16 13:54:33 -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
f6a45b942e Merge branch 'master' into newhash1.dmh 2018-03-01 22:13:50 -07:00
Ward Fisher
c4551856d4 Simplified fix. 2018-02-28 12:20:53 -07:00
Ward Fisher
3ccce81190 Accomodating special characters in path name. 2018-02-28 12:18:20 -07:00
Dennis Heimbigner
9240f04dc7 1. make uptodate wrt master
2. fix lgtm alert
4. fix problem in examples/C/hdf5plugins
   where a file overwrite problem occurs.
2018-02-28 11:10:35 -07:00
Dennis Heimbigner
225453f12f Fix memory leaks re utf8_normalize 2018-02-27 15:46:19 -07:00
Ward Fisher
faf1470887 Commented out the code, rather than just adding a comment block. 2018-02-27 15:20:58 -07:00
Ward Fisher
6ce110e362 Updated libsrc/attr.m4 in support of https://github.com/Unidata/netcdf-c/issues/843 2018-02-27 15:15:43 -07:00
Dennis Heimbigner
25045b78ce fix lgtm alert 2018-02-26 12:18:01 -07: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
199221eef6 fix memory leak 2018-02-25 20:35:24 -07:00
Dennis Heimbigner
ab96eb36ad Fix lgtm alerts 2018-02-25 11:28:06 -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
Ward Fisher
f9f27c5ab7
Merge branch 'master' into newhash0.dmh 2018-02-21 14:19:43 -07:00
Ben Boeckel
e0f314123f ncx: use __inline with MSVC
Visual Studio 2013 and older do not support `inline` in C code.
2018-02-19 10:14:29 -05:00
Ben Boeckel
b432a527c4 c: remove __CHAR_UNSIGNED__
In C, `char`, `signed char`, and `unsigned char` are three separate,
distinct types, so just because `char` happens to be signed does not
mean it is interchangeable with `signed char`.
2018-02-14 17:24:49 -05:00
Dennis Heimbigner
727b613459 This is the initial step in moving to the new higher performance
(I hope) metadata mechanism. This mostly just adds new pieces of
code (e.g. nclistmap) and does some minor fixes.

It should be transparent to everything else.
The next set of changes will be the big step.
2018-02-08 19:53:40 -07:00
Ward Fisher
9e926410ee Added the fix suggested by @mathstuf in support of https://github.com/unidata/netcdf-c/issues/845 2018-02-07 11:23:54 -07:00
Ward Fisher
0d420fcfbb
Merge branch 'master' into cdf5_var_len 2018-02-02 10:31:46 -07:00
Ward Fisher
27693ba4a3
Merge branch 'master' into nc3-per-var-fill-v2 2018-02-01 11:45:40 -07:00
Ward Fisher
8487a0a954
Merge branch 'master' into cdf5_var_len 2018-01-25 16:30:58 -07:00
Ed Hartnett
2197d9849b merged 466 2018-01-20 06:04:08 -07:00