From 2856ee751d5846374866207cc2b6554e56e60462 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Fri, 29 Apr 2022 12:36:33 -0600 Subject: [PATCH] restore --- dap4_test/test_remote.sh | 4 +-- include/nctestserver.h | 12 ++++----- libdispatch/dinfermodel.c | 53 ++++++++++++++++++++++----------------- libdispatch/dutil.c | 6 ++--- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/dap4_test/test_remote.sh b/dap4_test/test_remote.sh index 20ed2a3a1..79f0b307b 100755 --- a/dap4_test/test_remote.sh +++ b/dap4_test/test_remote.sh @@ -70,8 +70,8 @@ for f in $F ; do if test "x$BIG" = x1; then URL="[ucar.littleendian=0]${URL}" fi - if test "x$NOCSUM" != x1; then - URL="[dap4.checksum=crc32]${URL}" + if test "x$NOCSUM" = x1; then + URL="[ucar.checksummode=none]${URL}" fi if ! ${NCDUMP} ${DUMPFLAGS} "${URL}" > ${builddir}/results_test_remote/${f}.dmp; then failure "${URL}" diff --git a/include/nctestserver.h b/include/nctestserver.h index d645793ee..978210c85 100644 --- a/include/nctestserver.h +++ b/include/nctestserver.h @@ -19,7 +19,7 @@ See \ref copyright file for more info. #include #include "netcdf.h" -#define FINDTESTSERVER_DEBUG +#undef FINDTESTSERVER_DEBUG enum KIND {NOKIND, DAP2KIND, DAP4KIND, THREDDSKIND}; @@ -208,17 +208,15 @@ timedping(const char* url, long timeout) /* Don't trust curl to return an error when request gets 404 */ CERR((curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE, &http_code))); if(http_code >= 400) { - stat = CURLE_HTTP_RETURNED_ERROR; + cstat = CURLE_HTTP_RETURNED_ERROR; goto done; } - + done: if(cstat != CURLE_OK) { #ifdef FINDTESTSERVER_DEBUG - /* Get more detail */ - curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE, &http_code); - fprintf(stderr, "curl error: %s; url=%s http_code=%ld\n", - curl_easy_strerror(cstat),url,http_code); + fprintf(stderr, "curl error: %s; url=%s\n", + curl_easy_strerror(cstat),url); #endif stat = NC_ECURL; } diff --git a/libdispatch/dinfermodel.c b/libdispatch/dinfermodel.c index 74c5e908e..e6d725fa5 100644 --- a/libdispatch/dinfermodel.c +++ b/libdispatch/dinfermodel.c @@ -220,7 +220,6 @@ static const char* getmodekey(const NClist* envv); static int replacemode(NClist* envv, const char* newval); static int inferone(const char* mode, NClist* newmodes); static int negateone(const char* mode, NClist* modes); -static int lcontains(NClist* l, const char* key0); /* If the path looks like a URL, then parse it, reformat it. @@ -382,7 +381,7 @@ parseonchar(const char* s, int ch, NClist* segments) if((q = malloc(slen+1)) == NULL) {stat = NC_ENOMEM; goto done;} memcpy(q,p,slen); q[slen] = '\0'; - nclistpush(segments,q); q = NULL; + nclistpush(segments,q); if(*endp == '\0') break; p = endp+1; } @@ -459,7 +458,7 @@ processmodearg(const char* arg, NCmodel* model) static int processmacros(NClist** fraglenvp) { - int i,stat = NC_NOERR; + int stat = NC_NOERR; const struct MACRODEF* macros = NULL; NClist* fraglenv = NULL; NClist* expanded = NULL; @@ -467,12 +466,12 @@ processmacros(NClist** fraglenvp) if(fraglenvp == NULL || nclistlength(*fraglenvp) == 0) goto done; fraglenv = *fraglenvp; expanded = nclistnew(); - for(i=0;i 0) { int found = 0; char* key = NULL; char* value = NULL; - key = nclistget(fraglenv,i); - value = nclistget(fraglenv,i+1); + key = nclistremove(fraglenv,0); /* remove from changing front */ + value = nclistremove(fraglenv,0); /* remove from changing front */ if(strlen(value) == 0) { /* must be a singleton */ for(macros=macrodefs;macros->name;macros++) { if(strcmp(macros->name,key)==0) { @@ -489,6 +488,8 @@ processmacros(NClist** fraglenvp) nclistpush(expanded,strdup(key)); nclistpush(expanded,strdup(value)); } + nullfree(key); + nullfree(value); } *fraglenvp = expanded; expanded = NULL; @@ -586,7 +587,7 @@ inferone(const char* mode, NClist* newmodes) static int mergekey(NClist** valuesp) { - int i; + int i,j; int stat = NC_NOERR; NClist* values = *valuesp; NClist* allvalues = nclistnew(); @@ -599,21 +600,27 @@ mergekey(NClist** valuesp) if((stat=parseonchar(val1,',',allvalues))) goto done; } /* Remove duplicates and "" */ - for(i=0;i 0) { + value = nclistremove(allvalues,0); + if(strlen(value) == 0) { + nullfree(value); value = NULL; + } else { + for(j=0;j