diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d0b930a81d..b19fb10b6a 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. See [GitHub #365](https://github.com/Unidata/netcdf-c/issues/365) 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 522b34a2b8..0000000000 --- a/cf.cmake +++ /dev/null @@ -1,44 +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" -FLAGS="$FLAGS -DCMAKE_INSTALL_PREFIX=d:/ignore" - -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" -FLAGS="$FLAGS -DENABLE_EXAMPLES=false" -#FLAGS="$FLAGS -DENABLE_DAP4=true" - -rm -fr build -mkdir build -cd build - -cmake $FLAGS ${ZLIB} ${HDF5} ${CURL} .. -# We must use Release config here because Debug will invoke a runtime dialog box. -# If missing, appears to default to Debug -#CFG="--config RelWithDebInfo" -#cmake --build . ${CFG} -#cmake --build . ${CFG} --target RUN_TESTS diff --git a/libdap2/dapcvt.c b/libdap2/dapcvt.c index db0345756d..baae82fe33 100644 --- a/libdap2/dapcvt.c +++ b/libdap2/dapcvt.c @@ -215,6 +215,7 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src) 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); @@ -246,6 +247,7 @@ dapcvtattrval(nc_type etype, void* dst, NClist* src) 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); 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):