mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-06 18:00:24 +08:00
A netcdfgroup email
(Re: [netcdfgroup] nccopy fails with corrupted double link list) shows that ncdump/nccopy was returning EPERM instead of NC_EDAPCONSTRAINT as an error when we have a malformed constraint. Also clean up a potential bug that might occur if the user invokes nc_set_default_format before calling nc_open on a dap url.
This commit is contained in:
parent
1118628a09
commit
1bf34d8557
@ -61,5 +61,5 @@ EXTRA_DIST += dce.y
|
||||
makece::
|
||||
bison -v -d -t -p dce dce.y
|
||||
rm -f dcetab.c dcetab.h
|
||||
mv dce.tab.c dcetab.c
|
||||
mv dce.tab.h dcetab.h
|
||||
sed -e 's/dce[.]tab[.]c/dcetab.c/g' -e 's/dce[.]tab[.]h/dcetab.h/g' <dce.tab.c >dcetab.c
|
||||
sed -e 's/dce[.]tab[.]c/dcetab.c/g' -e 's/dce[.]tab[.]h/dcetab.h/g' <dce.tab.h >dcetab.h
|
||||
|
@ -4,8 +4,9 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include "ncdap.h"
|
||||
#include "dapdump.h"
|
||||
#include "dceparselex.h"
|
||||
#include "dceconstraints.h"
|
||||
#include "dapdump.h"
|
||||
|
||||
static void completesegments(NClist* fullpath, NClist* segments);
|
||||
static NCerror qualifyprojectionnames(DCEprojection* proj);
|
||||
|
@ -321,7 +321,7 @@ int
|
||||
dceerror(DCEparsestate* state, char* msg)
|
||||
{
|
||||
strncpy(state->errorbuf,msg,1023);
|
||||
state->errorcode=1;
|
||||
state->errorcode=NC_EDAPCONSTRAINT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,11 @@
|
||||
#define DCEPARSELEX_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* Forward */
|
||||
struct DCEparsestate;
|
||||
typedef struct DCEparsestate DCEparsestate;
|
||||
|
||||
#include "dcetab.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
1631
libdap2/dcetab.c
1631
libdap2/dcetab.c
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,19 @@
|
||||
/* A Bison parser, made by GNU Bison 2.4.3. */
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||
2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
@ -27,32 +26,40 @@
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
SCAN_WORD = 258,
|
||||
SCAN_STRINGCONST = 259,
|
||||
SCAN_NUMBERCONST = 260
|
||||
};
|
||||
#ifndef YY_DCE_DCE_TAB_H_INCLUDED
|
||||
# define YY_DCE_DCE_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int dcedebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
SCAN_WORD = 258,
|
||||
SCAN_STRINGCONST = 259,
|
||||
SCAN_NUMBERCONST = 260
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef int YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int dceparse (DCEparsestate* parsestate);
|
||||
|
||||
#endif /* !YY_DCE_DCE_TAB_H_INCLUDED */
|
||||
|
@ -376,8 +376,17 @@ NCD2_open(const char * path, int mode,
|
||||
*/
|
||||
snprintf(tmpname,sizeof(tmpname),"%d",drno->int_ncid);
|
||||
|
||||
/* Now, use the file to create the netcdf file; force classic. */
|
||||
ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&nc3id);
|
||||
/* Now, use the file to create the hidden, in-memory netcdf file.
|
||||
We want this hidden file to always be NC_CLASSIC, so we need to
|
||||
force default format temporarily in case user changed it.
|
||||
*/
|
||||
{
|
||||
int new = NC_CLASSIC_MODEL;
|
||||
int old = 0;
|
||||
nc_set_default_format(new,&old); /* save and change */
|
||||
ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&nc3id);
|
||||
nc_set_default_format(old,&new); /* restore */
|
||||
}
|
||||
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
|
||||
dapcomm->nc3id = nc3id;
|
||||
/* Avoid fill */
|
||||
@ -2244,7 +2253,7 @@ int
|
||||
NCD2_inq_format(int ncid, int* formatp)
|
||||
{
|
||||
NC* drno;
|
||||
int ret;
|
||||
int ret = NC_NOERR;
|
||||
if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
|
||||
ret = nc_inq_format(getnc3id(drno), formatp);
|
||||
return THROW(ret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user