diff --git a/CMakeLists.txt b/CMakeLists.txt index 08c3b2d614..5be854a2df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -649,8 +649,8 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) # Find out if HDF5 was built with parallel support. # Do that by checking for the targets H5Pget_fapl_mpiposx and # H5Pget_fapl_mpio in ${HDF5_LIB}. - CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX) - CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO) IF(HDF5_IS_PARALLEL_MPIPOSIX OR HDF5_IS_PARALLEL_MPIO) SET(HDF5_PARALLEL ON) ELSE() @@ -667,7 +667,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) ENDIF() #Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0) - CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS) OPTION(ENABLE_DYNAMIC_LOADING "Enable Dynamic Loading" ON) IF(ENABLE_DYNAMIC_LOADING) @@ -676,10 +676,10 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) ENDIF(NOT MSVC) # Make sure the user has built the library with zlib support. - CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_deflate "" HAVE_H5PSET_DEFLATE) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pset_deflate "" HAVE_H5PSET_DEFLATE) #Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip. - CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5P_SZIP "" USE_SZIP) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5P_SZIP "" USE_SZIP) IF(USE_SZIP) FIND_LIBRARY(SZIP NAMES szip sz) IF(SZIP) @@ -690,11 +690,11 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) ENDIF() ENDIF() - CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HDF5_HAS_H5FREE) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5free_memory "" HDF5_HAS_H5FREE) IF(HDF5_HAS_H5FREE) SET(HAVE_H5FREE_MEMORY TRUE) ENDIF(HDF5_HAS_H5FREE) - CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_libver_bounds "" HDF5_HAS_LIBVER_BOUNDS) + CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pset_libver_bounds "" HDF5_HAS_LIBVER_BOUNDS) IF(HDF5_HAS_LIBVER_BOUNDS) SET(HAVE_H5PSET_LIBVER_BOUNDS TRUE) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d0b930a81d..f25c6e02a5 100755 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -11,6 +11,7 @@ This file contains a high-level description of this package's evolution. Release ## 4.4.2 - TBD +* [Bug] Addressed conversion problem with Windows sscanf. This primarily affected some OPeNDAP URLs on Windows. See [GitHub #365](https://github.com/Unidata/netcdf-c/issues/365) and [GitHub #366](https://github.com/Unidata/netcdf-c/issues/366) for more information. * [Enhancement] Added support for HDF5 collective metadata operations when available. Patch submitted by Greg Sjaardema, see [Pull request #335](https://github.com/Unidata/netcdf-c/pull/335) for more information. * [Bug] Addressed a potential type punning issue. See [GitHub #351](https://github.com/Unidata/netcdf-c/issues/351) for more information. * [Bug] Addressed an issue where netCDF wouldn't build on Windows systems using MSVC 2012. See [GitHub #304](https://github.com/Unidata/netcdf-c/issues/304) for more information. diff --git a/cf.cmake b/cf.cmake deleted file mode 100644 index c0f4b3e5b4..0000000000 --- a/cf.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# Is netcdf-4 and/or DAP enabled? -NC4=1 -DAP=1 - -# Is visual studio being used? -VS=yes -#CYGWIN=yes - - -if test "x$VS" = x ; then -#CC=mpicc -CC=gcc -else -VSSTRING="Visual Studio 12 2013 Win64" -G="-G\"$VSSTRING\"" -fi - -export CC - -FLAGS="-DCMAKE_PREFIX_PATH=c:/tools/nccmake" - -if test "x$DAP" = x ; then -FLAGS="$FLAGS -DENABLE_DAP=false" -fi -if test "x$NC4" = x ; then -FLAGS="$FLAGS -DENABLE_NETCDF_4=false" -fi -FLAGS="$FLAGS -DENABLE_CONVERSION_WARNINGS=false" -FLAGS="$FLAGS -DENABLE_DAP_REMOTE_TESTS=true" -FLAGS="$FLAGS -DENABLE_TESTS=true" - -rm -fr build -mkdir build -cd build - -cmake -GVisual\ Studio\ 14\ 2015 $FLAGS ${ZLIB} ${HDF5} ${CURL} .. -#cmake --build . -CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test diff --git a/libdap2/dapcvt.c b/libdap2/dapcvt.c index b67ff846f9..baae82fe33 100644 --- a/libdap2/dapcvt.c +++ b/libdap2/dapcvt.c @@ -210,14 +210,15 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src) ok = 0; switch (etype) { case NC_BYTE: { - char tmp[128]; - - unsigned char* p = (unsigned char*)dstmem; + char* p = (unsigned char*)dstmem; #ifdef _MSC_VER - ok = sscanf(s,"%hC%n",p,&nread); - _ASSERTE(_CrtCheckMemory()); + int ival; + ok = sscanf(s,"%d%n",&ival,&nread); + _ASSERTE(_CrtCheckMemory()); + if(ival < NC_MIN_BYTE || ival > NC_MAX_BYTE) ok = 0; + *p = (char)ival; #else - ok = sscanf(s,"%hhu%n",p,&nread); + ok = sscanf(s,"%hhu%n",p,&nread); #endif } break; case NC_CHAR: { @@ -243,12 +244,15 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src) case NC_UBYTE: { unsigned char* p = (unsigned char*)dstmem; #ifdef _MSC_VER - ok = sscanf(s, "%hc%n", p,&nread); - _ASSERTE(_CrtCheckMemory()); + unsigned int uval; + ok = sscanf(s,"%u%n",&uval,&nread); + _ASSERTE(_CrtCheckMemory()); + if(uval > NC_MAX_UBYTE) ok = 0; + *p = (unsigned char)uval; #else ok = sscanf(s,"%hhu%n",p,&nread); #endif - } break; + } break; case NC_USHORT: { unsigned short* p = (unsigned short*)dstmem; ok = sscanf(s,"%hu%n",p,&nread); diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c index b679c4d36b..e269345107 100644 --- a/libdap2/ncd2dispatch.c +++ b/libdap2/ncd2dispatch.c @@ -336,7 +336,8 @@ NCD2_open(const char * path, int mode, dapcomm->oc.rawurltext = strdup(path); #endif - ncuriparse(dapcomm->oc.rawurltext,&dapcomm->oc.url); + ncstat = ncuriparse(dapcomm->oc.rawurltext,&dapcomm->oc.url); + if (!ncstat) goto done; /* parse the client parameters */ ncuridecodeparams(dapcomm->oc.url); diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am index c13f94e01a..2145752190 100644 --- a/ncgen/Makefile.am +++ b/ncgen/Makefile.am @@ -44,6 +44,8 @@ CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \ # Otherwise never invoked, but records how to do it. # BTW: note that renaming is essential because otherwise # autoconf will forcibly delete files of the name *.tab.* +# Note also that this should be built under linux or cygwin +# using bison version 3 or later. makeparser:: flex -Pncg -8 ncgen.l diff --git a/ncgen/cvt.c b/ncgen/cvt.c index e7d1646002..81113e4a21 100644 --- a/ncgen/cvt.c +++ b/ncgen/cvt.c @@ -18,7 +18,9 @@ convert1(NCConstant* src, NCConstant* dst) Constvalue tmp; unsigned char* bytes = NULL; size_t bytelen; - +#ifdef _MSC_VER + int byteval; +#endif dst->lineno = src->lineno; /* Need to translate all possible sources to all possible sinks.*/ @@ -405,10 +407,17 @@ case CASE(NC_DOUBLE,NC_DOUBLE): break; /* Conversion of a string to e.g. an integer should be what?*/ +#ifdef _MSC_VER +case CASE(NC_STRING,NC_BYTE): + sscanf(src->value.stringv.stringv,"%d",&byteval); tmp.int8v = (char)byteval; break; +case CASE(NC_STRING,NC_UBYTE): + sscanf(src->value.stringv.stringv,"%d",&byteval); tmp.uint8v = (unsigned char)byteval; break; +#else case CASE(NC_STRING,NC_BYTE): sscanf(src->value.stringv.stringv,"%hhd",&tmp.int8v); break; case CASE(NC_STRING,NC_UBYTE): sscanf(src->value.stringv.stringv,"%hhu",&tmp.uint8v); break; +#endif case CASE(NC_STRING,NC_USHORT): sscanf(src->value.stringv.stringv,"%hu",&tmp.uint16v); break; case CASE(NC_STRING,NC_UINT):