Merge branch 'master' into travis-update

This commit is contained in:
Ward Fisher 2016-04-14 10:33:49 -06:00
commit 89dab75455
6 changed files with 36 additions and 18 deletions

View File

@ -48,6 +48,18 @@ AC_CANONICAL_TARGET
AC_CONFIG_HEADERS([config.h])
##
# Some files need to exist in build directories
# that do not correspond to their source directory, or
# the test program makes an assumption about where files
# live. AC_CONFIG_LINKS provides a mechanism to link/copy files
# if an out-of-source build is happening.
##
AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat1.nc:nc_test4/ref_hdf5_compat1.nc])
AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5_compat2.nc])
AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc])
# This call is required by automake.
AM_INIT_AUTOMAKE([foreign dist-zip subdir-objects])

View File

@ -650,20 +650,24 @@ ncuridecodeparams(NCURI* ncuri)
int
ncurilookup(NCURI* uri, const char* key, const char** resultp)
{
int i;
char* value = NULL;
if(uri == NULL || key == NULL || uri->params == NULL) return 0;
if(uri->paramlist == NULL) {
int i;
char* value = NULL;
if(uri == NULL || key == NULL || uri->params == NULL) return 0;
if(uri->paramlist == NULL) {
i = ncuridecodeparams(uri);
if(!i) return 0;
}
/* Coverity[FORWARD_NULL] */
i = ncfind(uri->paramlist,key);
if(i < 0)
}
/* Coverity[FORWARD_NULL] */
i = ncfind(uri->paramlist,key);
if(i < 0)
return 0;
if(uri->paramlist) {
value = uri->paramlist[(2*i)+1];
if(resultp) *resultp = value;
return 1;
}
return 1;
}
int

View File

@ -47,7 +47,7 @@ EXTRA_DIST = attr.m4 ncx.m4 putget.m4 $(man_MANS) CMakeLists.txt XGetopt.c
# This tells make how to turn .m4 files into .c files.
.m4.c:
m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >$@
m4 $(AM_M4FLAGS) $(M4FLAGS) -s $< >${srcdir}/$@
# The C API man page.
man_MANS = netcdf.3

View File

@ -11,6 +11,8 @@
#define ACTIVE 1
#define MAX(a,b) ((a) > (b) ? (a) : (b))
extern uint32_t hash_fast(const void *key, size_t length);
/* NOTE: 'data' is the dimid or varid which is non-negative.
@ -153,7 +155,7 @@ void NC_hashmapAddDim(const NC_dimarray* ncap, long data, const char *name)
{
unsigned long i;
unsigned long index = key % hash->size;
unsigned long step = (key % (hash->size-2)) + 1;
unsigned long step = (key % MAX(1,(hash->size-2))) + 1;
for (i = 0; i < hash->size; i++)
{
@ -200,7 +202,7 @@ void NC_hashmapAddVar(const NC_vararray* ncap, long data, const char *name)
{
unsigned long i;
unsigned long index = key % hash->size;
unsigned long step = (key % (hash->size-2)) + 1;
unsigned long step = (key % MAX(1,(hash->size-2))) + 1;
for (i = 0; i < hash->size; i++)
{

View File

@ -93,14 +93,14 @@ EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh \
run_diskless.sh run_diskless2.sh run_mmap.sh run_pnetcdf_test.sh
# ref_tst_diskless2.cdl is for diff comparison and to produce tst_diskless2.c
EXTRA_DIST += ref_tst_diskless2.cdl CMakeLists.txt tst_types.c
EXTRA_DIST += ref_tst_diskless2.cdl CMakeLists.txt
# Only clean these on mainatiner-clean, because they require m4 to
# regenerate.
#MAINTAINERCLEANFILES = test_get.c test_put.c
all:
cp $(top_builddir)/libsrc/ncx.c .
cp $(top_srcdir)/libsrc/ncx.c .
CLEANFILES += ncx.c

View File

@ -80,7 +80,7 @@ int main() {
}
printf("\t* Puting data in secondary variable:\tnc_put_vara().\n");
if (nc_put_vara(ncid,varid2,&startp2,&countp2,data2)) ERR;
if (nc_put_vara(ncid,varid2,startp2,countp2,data2)) ERR;
/***********/
/* Actually unnecessary to recreate the issue. */
@ -172,7 +172,7 @@ int main() {
}
printf("\t* Puting data in secondary variable:\tnc_put_vara().\n");
if (nc_put_vara(ncid,varid2,&startp2,&countp2,data2)) ERR;
if (nc_put_vara(ncid,varid2,startp2,countp2,data2)) ERR;
/***********/
/* Actually unnecessary to recreate the issue. */