Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ncdump fails under visual studio for certain dap urls #366

Merged
merged 8 commits into from
Feb 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
38 changes: 0 additions & 38 deletions cf.cmake

This file was deleted.

22 changes: 13 additions & 9 deletions libdap2/dapcvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion libdap2/ncd2dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions ncgen/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion ncgen/cvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.*/
Expand Down Expand Up @@ -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):
Expand Down