mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
Fix occurlflags bug
This commit is contained in:
parent
3aa6c969e2
commit
3a559d3f1d
@ -31,6 +31,11 @@ ENDIF()
|
||||
SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c)
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|
||||
|
||||
# These rules are used if someone wants to rebuild ncgenyy.c or ncgentab.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.*
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ncgentab.h
|
||||
COMMAND flex -Pncg -B ncgen.l
|
||||
@ -45,7 +50,6 @@ ADD_CUSTOM_COMMAND(
|
||||
COMMAND mv ncgenyy.c ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(makeparser DEPENDS ncgentab.h)
|
||||
|
||||
## Specify files to be distributed by 'make dist'
|
||||
|
@ -36,7 +36,7 @@ endif # USE_NETCDF4
|
||||
CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \
|
||||
ncf199.nc
|
||||
|
||||
# These rule are used if someone wants to rebuild ncgenyy.c or ncgentab.c
|
||||
# These rules are used if someone wants to rebuild ncgenyy.c or ncgentab.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.*
|
||||
|
@ -43,6 +43,7 @@ static struct OCCURLFLAG oc_curlflags[] = {
|
||||
{NULL,0}
|
||||
};
|
||||
|
||||
#if 0
|
||||
static struct OCCURLFLAG oc_allcurlflags[] = {
|
||||
{"CURLOPT_ADDRESS_SCOPE",CURLOPT_ADDRESS_SCOPE,171,CF_UNKNOWN},
|
||||
{"CURLOPT_APPEND",CURLOPT_APPEND,50,CF_UNKNOWN},
|
||||
@ -51,9 +52,7 @@ static struct OCCURLFLAG oc_allcurlflags[] = {
|
||||
{"CURLOPT_CAINFO",CURLOPT_CAINFO,10065,CF_UNKNOWN},
|
||||
{"CURLOPT_CAPATH",CURLOPT_CAPATH,10097,CF_UNKNOWN},
|
||||
{"CURLOPT_CERTINFO",CURLOPT_CERTINFO,172,CF_UNKNOWN},
|
||||
#ifdef HAVE_CURLOPT_CHUNK_BGN_FUNCTION
|
||||
{"CURLOPT_CHUNK_BGN_FUNCTION",CURLOPT_CHUNK_BGN_FUNCTION,20198,CF_UNKNOWN},
|
||||
#endif
|
||||
{"CURLOPT_CHUNK_DATA",CURLOPT_CHUNK_DATA,10201,CF_UNKNOWN},
|
||||
{"CURLOPT_CHUNK_END_FUNCTION",CURLOPT_CHUNK_END_FUNCTION,20199,CF_UNKNOWN},
|
||||
{"CURLOPT_CLOSEPOLICY",CURLOPT_CLOSEPOLICY,72,CF_UNKNOWN},
|
||||
@ -234,6 +233,15 @@ static struct OCCURLFLAG oc_allcurlflags[] = {
|
||||
{NULL,0}
|
||||
};
|
||||
|
||||
struct OCCURLFLAG*
|
||||
occurlflagsall(void)
|
||||
{
|
||||
if(nflags == 0) initialize();
|
||||
return oc_allcurlflags;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int touppercase(int c)
|
||||
{
|
||||
if(c >= 'a' && c <= 'z')
|
||||
@ -270,14 +278,6 @@ occurlflags(void)
|
||||
return oc_curlflags;
|
||||
}
|
||||
|
||||
struct OCCURLFLAG*
|
||||
occurlflagsall(void)
|
||||
{
|
||||
if(nflags == 0) initialize();
|
||||
return oc_allcurlflags;
|
||||
}
|
||||
|
||||
|
||||
struct OCCURLFLAG*
|
||||
occurlflagbyname(const char* name)
|
||||
{
|
||||
@ -287,7 +287,7 @@ occurlflagbyname(const char* name)
|
||||
const char* p;
|
||||
char* q;
|
||||
|
||||
if(nflags == 0) initialize();
|
||||
if(nflags == 0) initialize();
|
||||
/* Force upper case */
|
||||
for(p=name,q=flagname;*p;p++) {
|
||||
int cc = touppercase(*p);
|
||||
@ -309,7 +309,7 @@ occurlflagbyname(const char* name)
|
||||
struct OCCURLFLAG*
|
||||
occurlflagbyflag(int flag)
|
||||
{
|
||||
if(nflags == 0) initialize();
|
||||
if(nflags == 0) initialize();
|
||||
if(flag >= 0 || flag <= maxflag)
|
||||
return flagindices[flag];
|
||||
return NULL;
|
||||
|
@ -594,6 +594,12 @@ ocset_curlproperties(OCstate* state)
|
||||
/* Some servers (e.g. thredds and columbia) appear to require a place
|
||||
to put cookies in order for some security functions to work
|
||||
*/
|
||||
if(state->curlflags.cookiejar != NULL
|
||||
&& strlen(state->curlflags.cookiejar) == 0) {
|
||||
free(state->curlflags.cookiejar);
|
||||
state->curlflags.cookiejar = NULL;
|
||||
}
|
||||
|
||||
if(state->curlflags.cookiejar == NULL) {
|
||||
/* If no cookie file was defined, define a default */
|
||||
char tmp[OCPATHMAX+1];
|
||||
@ -607,9 +613,14 @@ ocset_curlproperties(OCstate* state)
|
||||
errno = 0;
|
||||
/* Create the unique cookie file name */
|
||||
stat = ocmktmp(tmp,&state->curlflags.cookiejar);
|
||||
state->curlflags.createdflags |= COOKIECREATED;
|
||||
state->curlflags.createdflags |= COOKIECREATED;
|
||||
if(stat != OC_NOERR && errno != EEXIST) {
|
||||
fprintf(stderr,"Cannot create cookie file\n");
|
||||
goto fail;
|
||||
}
|
||||
errno = 0;
|
||||
}
|
||||
OCASSERT(state->curlflags.cookiejar != NULL && *state->curlflags.cookiejar != '\0');
|
||||
OCASSERT(state->curlflags.cookiejar != NULL);
|
||||
|
||||
/* Make sure the cookie jar exists and can be read and written */
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user