Corrected MSVC-related issues with DAP. Renamed variables to avoid collision with reserved words, enclosed includes with appropriate ifdefs, other minor changes.

This commit is contained in:
Ward Fisher 2012-09-20 16:31:31 +00:00
parent 6e2d236b02
commit 650c6fe362
13 changed files with 29 additions and 7 deletions

View File

@ -13,7 +13,8 @@
#define fdopen _fdopen #define fdopen _fdopen
#define write _write #define write _write
#define snprintf _snprintf #define snprintf _snprintf
#define strcasecmp _stricmp
#define strtoll _strtoi64
#endif #endif
#ifndef CONFIG_H #ifndef CONFIG_H

View File

@ -426,7 +426,7 @@ makenewstruct3(CDFnode* node, CDFnode* templatenode)
CDFnode* newstruct = (CDFnode*)calloc(1,sizeof(CDFnode)); CDFnode* newstruct = (CDFnode*)calloc(1,sizeof(CDFnode));
if(newstruct == NULL) return NULL; if(newstruct == NULL) return NULL;
newstruct->nctype = NC_Structure; newstruct->nctype = NC_Structure;
newstruct->virtual = 1; newstruct->nc_virtual = 1;
newstruct->ocname = nulldup(templatenode->ocname); newstruct->ocname = nulldup(templatenode->ocname);
newstruct->ocnode = templatenode->ocnode; newstruct->ocnode = templatenode->ocnode;
newstruct->ncbasename = nulldup(templatenode->ncbasename); newstruct->ncbasename = nulldup(templatenode->ncbasename);

View File

@ -45,7 +45,7 @@ parsedapconstraints(NCDAPCOMMON* dapcomm, char* constraints,
in the declsizes. in the declsizes.
Two things to watch out for: Two things to watch out for:
1. suffix paths are legal (i.e. incomplete paths) 1. suffix paths are legal (i.e. incomplete paths)
2. virtual nodes (via restruct) 2. nc_virtual nodes (via restruct)
*/ */
NCerror NCerror

View File

@ -6,7 +6,9 @@
#include "config.h" #include "config.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif
#include "oc.h" #include "oc.h"
extern int oc_dumpnode(OClink, OCddsnode); extern int oc_dumpnode(OClink, OCddsnode);

View File

@ -617,13 +617,13 @@ movetofield(NCDAPCOMMON* nccomm,
xnext = (CDFnode*)nclistget(path,depth+1); xnext = (CDFnode*)nclistget(path,depth+1);
ASSERT((xnext != NULL)); ASSERT((xnext != NULL));
fieldindex = findfield(xnode,xnext); fieldindex = findfield(xnode,xnext);
/* If the next node is a virtual node, then /* If the next node is a nc_virtual node, then
we need to effectively we need to effectively
ignore it and use the appropriate subnode. ignore it and use the appropriate subnode.
If the next node is a re-struct'd node, then If the next node is a re-struct'd node, then
use it as is. use it as is.
*/ */
if(xnext->virtual) { if(xnext->nc_virtual) {
CDFnode* xgrid = xnext; CDFnode* xgrid = xnext;
xnext = (CDFnode*)nclistget(path,depth+2); /* real node */ xnext = (CDFnode*)nclistget(path,depth+2); /* real node */
gridindex = fieldindex; gridindex = fieldindex;

View File

@ -256,7 +256,7 @@ typedef struct CDFnode {
BOOL visible; /* 1 => node is present in derived tree; independent of elided flag */ BOOL visible; /* 1 => node is present in derived tree; independent of elided flag */
BOOL zerodim; /* 1 => node has a zero dimension */ BOOL zerodim; /* 1 => node has a zero dimension */
/* These two flags track the effects on grids of constraints */ /* These two flags track the effects on grids of constraints */
BOOL virtual; /* node added by regrid */ BOOL nc_virtual; /* node added by regrid */
#ifdef PROJECTED #ifdef PROJECTED
BOOL projected; /* node referenced by projection */ BOOL projected; /* node referenced by projection */
#endif #endif

View File

@ -8,7 +8,9 @@
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h> #include <string.h>

View File

@ -2,7 +2,9 @@
See the COPYRIGHT file for more information. */ See the COPYRIGHT file for more information. */
#include "config.h" #include "config.h"
#ifdef HAVE_STRINGS_H
#include <strings.h> #include <strings.h>
#endif
#include "dapparselex.h" #include "dapparselex.h"
#undef URLCVT /* NEVER turn this on */ #undef URLCVT /* NEVER turn this on */

View File

@ -425,11 +425,14 @@ extern void oc_logtext(int tag, const char* text);
/**************************************************/ /**************************************************/
/* Miscellaneous */ /* Miscellaneous */
/* For some reason, the MSVC compiler doesn't like this. */
#ifndef _MSC_VER
/* Return the size of the in-memory or on-disk /* Return the size of the in-memory or on-disk
data chunk returned by the server for a given tree. data chunk returned by the server for a given tree.
Zero implies it is not defined. Zero implies it is not defined.
*/ */
extern OCerror oc_raw_xdrsize(OClink,OCddsnode,off_t*); extern OCerror oc_raw_xdrsize(OClink,OCddsnode,off_t*);
#endif
/* Reclaim the strings within a string vector, but not the vector itself. /* Reclaim the strings within a string vector, but not the vector itself.
This is useful for reclaiming the result of oc_data_read This is useful for reclaiming the result of oc_data_read

View File

@ -2,7 +2,9 @@
See the COPYRIGHT file for more information. */ See the COPYRIGHT file for more information. */
#include "config.h" #include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <sys/types.h> #include <sys/types.h>
#include "ocinternal.h" #include "ocinternal.h"
#include "ocdebug.h" #include "ocdebug.h"

View File

@ -18,6 +18,11 @@
#include "ocrc.h" #include "ocrc.h"
#include "occurlfunctions.h" #include "occurlfunctions.h"
#ifdef _MSC_VER
#include <io.h>
#endif
/*Forward*/ /*Forward*/
static int readpacket(OCstate* state, OCURI*, OCbytes*, OCdxd, long*); static int readpacket(OCstate* state, OCURI*, OCbytes*, OCdxd, long*);
static int readfile(const char* path, const char* suffix, OCbytes* packet); static int readfile(const char* path, const char* suffix, OCbytes* packet);

View File

@ -52,6 +52,11 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef _MSC_VER
#include <wchar.h>
#include <sys/types.h>
#endif
#ifdef ENDIAN_VALIDATE #ifdef ENDIAN_VALIDATE
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif

View File

@ -114,7 +114,7 @@ extern void xxdrntohdouble(char*,double*);
typedef struct XXDR XXDR; /* forward */ typedef struct XXDR XXDR; /* forward */
/* Assume |off_t| == |void*| */ /* Assume |off_t| == |void*| */
struct XXDR { typedef struct XXDR {
char* data; char* data;
off_t pos; /* relative to data; off_t pos; /* relative to data;
may be a cache of underlying stream pos */ may be a cache of underlying stream pos */