Merge branch 'master' into ejh_ncdump_again

This commit is contained in:
Ed Hartnett 2017-11-15 03:39:21 -07:00 committed by GitHub
commit 3d4548a0e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

View File

@ -166,8 +166,10 @@ NC_parsefilterspec(const char* spec, unsigned int* idp, size_t* nparamsp, unsign
/* Now return results */
if(idp) *idp = id;
if(nparamsp) *nparamsp = nparams;
if(paramsp) *paramsp = ulist;
ulist = NULL; /* avoid duplicate free */
if(paramsp) {
*paramsp = ulist;
ulist = NULL; /* avoid duplicate free */
}
if(sdata) free(sdata);
if(ulist) free(ulist);
return 1;

View File

@ -1071,6 +1071,10 @@ nc4_var_del(NC_VAR_INFO_T *var)
if (var->dimscale_attached)
free(var->dimscale_attached);
/* Release parameter information. */
if (var->params)
free(var->params);
/* Delete the var. */
free(var);

View File

@ -59,7 +59,9 @@ static int nerrs = 0;
static int parsefilterspec(const char* spec, unsigned int* idp, size_t* nparamsp, unsigned int** paramsp);
#endif
#ifdef WORD_BIGENDIAN
static void byteswap8(unsigned char* mem);
#endif
static void
report(const char* which)
@ -72,7 +74,7 @@ report(const char* which)
static void
mismatch(size_t i, unsigned int baseline, unsigned int params)
{
fprintf(stderr,"mismatch: [%d] baseline=%ud spec=%ud\n",i,baseline,params);
fprintf(stderr,"mismatch: [%d] baseline=%ud spec=%ud\n",(int)i,baseline,params);
fflush(stderr);
nerrs++;
}
@ -86,6 +88,8 @@ main(int argc, char **argv)
size_t i,nparams = 0;
unsigned int* params = NULL;
printf("\nTesting filter parser.\n");
#ifdef USE_INTERNAL
stat = parsefilterspec(spec,&id,&nparams,&params);
#else
@ -125,9 +129,16 @@ main(int argc, char **argv)
if(ul.ull != 18446744073709551615ULL)
report("ul.ull");
if (params)
free(params);
if (!nerrs)
printf("SUCCESS!!\n");
return (nerrs > 0 ? 1 : 0);
}
#ifdef WORD_BIGENDIAN
/* Byte swap an 8-byte integer in place */
static void
byteswap8(unsigned char* mem)
@ -146,6 +157,7 @@ byteswap8(unsigned char* mem)
mem[3] = mem[4];
mem[4] = c;
}
#endif
#ifdef USE_INTERNAL
static int