When using the '-ansi' flag with gcc, netcdf would fail to build because of the use of '//' for one-line comments. I've addressed this by replacing instances of // with enclosing comment blocks.

This commit is contained in:
Ward Fisher 2014-08-26 11:19:32 -06:00
parent 88d01e4c08
commit b43813d821
16 changed files with 29 additions and 29 deletions

View File

@ -62,7 +62,7 @@ mapconstraints(DCEconstraint* constraint,
for(i=0;i<nclistlength(dceprojections);i++) {
CDFnode* cdfmatch = NULL;
DCEprojection* proj = (DCEprojection*)nclistget(dceprojections,i);
if(proj->discrim != CES_VAR) continue; // ignore functions
if(proj->discrim != CES_VAR) continue; /* ignore functions */
ncstat = matchpartialname(nodes,proj->var->segments,&cdfmatch);
if(ncstat) goto done;
/* Cross links */

View File

@ -191,7 +191,6 @@ fprintf(stderr,"\n");
for(i=0;i<ncrank;i++) {
CDFnode* dim = (CDFnode*)nclistget(ncdimsall,i);
/* countp and startp are unsigned, so will never be < 0 */
//if(startp[i] < 0 || countp[i] < 0 || stridep[i] < 1) {
if(stridep[i] < 1) {
ncstat = NC_EINVALCOORDS;
goto fail;
@ -423,7 +422,6 @@ fail:
if(fetchconstraint != NULL) dcefree((DCEnode*)fetchconstraint);
if(varainfo != NULL) freegetvara(varainfo);
if(ocstat != OC_NOERR) ncstat = ocerrtoncerr(ocstat);
//if(varainfo) freegetvara(varainfo);
return THROW(ncstat);
}

View File

@ -220,11 +220,9 @@ NCDEFAULT_get_vars(int ncid, int varid, const size_t * start,
/* illegal value checks */
dimlen = (i == 0 && isrecvar ? numrecs : varshape[i]);
/* mystart is unsigned, never < 0 */
//if(mystart[i] < 0 || mystart[i] >= dimlen)
if(mystart[i] >= dimlen)
return NC_EINVALCOORDS;
/* myedges is unsigned, never < 0 */
//if(myedges[i] < 0 || (mystart[i] + myedges[i] > dimlen))
if(mystart[i] + myedges[i] > dimlen)
return NC_EEDGE;
}

View File

@ -210,11 +210,9 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start,
if(i == 0 && isrecvar) {/*do nothing*/}
else {
/* mystart is unsigned, will never be < 0 */
//if(mystart[i] < 0 || mystart[i] > dimlen)
if(mystart[i] > dimlen)
return NC_EINVALCOORDS;
/* myediges is unsigned, will never be < 0 */
//if(myedges[i] < 0 || (mystart[i] + myedges[i] > dimlen))
if(mystart[i] + myedges[i] > dimlen)
return NC_EEDGE;
}

View File

@ -2814,8 +2814,7 @@ NC4_set_fill(int ncid, int fillmode, int *old_modep)
int
NC4_redef(int ncid)
{
//NC *nc;
NC_HDF5_FILE_INFO_T* nc4_info;
NC_HDF5_FILE_INFO_T* nc4_info;
LOG((1, "%s: ncid 0x%x", __func__, ncid));

View File

@ -130,7 +130,7 @@ printf("*** testing diskless file with scalar vars...");
/* Close the file. */
if (nc_close(ncid))
abort(); //ERR;
abort(); /* ERR; */
}
SUMMARIZE_ERR;
@ -247,7 +247,7 @@ printf("*** testing diskless file with scalar vars...");
/* Close the file, losing all information. Hey! What kind of
* storage format is this, anyway? */
if (nc_close(ncid))
abort(); //ERR;
abort(); /* ERR; */
}
SUMMARIZE_ERR;
printf("*** testing diskless file with scalar vars and type conversion...");
@ -305,12 +305,12 @@ printf("*** testing diskless file with scalar vars...");
/* Close the file. */
if (nc_close(ncid))
abort(); //ERR;
abort(); /* ERR; */
}
SUMMARIZE_ERR;
FINAL_RESULTS;
/* Unnecessary exit(0), FINAL_RESULTS returns. */
//exit(0);
/* exit(0); */
}

View File

@ -142,7 +142,7 @@ main()
#endif
check(err = nc_get_varm_float (ncid, varid, start, count, stride, imap,(float*) dat),__FILE__,__LINE__);
// check(err = nc_get_vara_float (ncid, varid, start, count, (float*) dat),__FILE__,__LINE__);
/* check(err = nc_get_vara_float (ncid, varid, start, count, (float*) dat),__FILE__,__LINE__); */
#ifdef STANDALONE
printf("varm: %s =",VAR);

View File

@ -46,11 +46,11 @@ main(int argc, char **argv)
double dvals[NVALS], dvals_in[NVALS];
float fnan = NC_FNAN;//(NC_INFINITE-NC_INFINITE);//0.f/0.f;
double dnan = NC_DNAN;//(NC_INFINITE-NC_INFINITE);//0.0/0.0;
float fpinf = NC_FPINF;//NC_INFINITE;//1.0f/0.0f;
float fnan = NC_FNAN;/*(NC_INFINITE-NC_INFINITE);//0.f/0.f; */
double dnan = NC_DNAN;/*(NC_INFINITE-NC_INFINITE);//0.0/0.0; */
float fpinf = NC_FPINF;/*NC_INFINITE;//1.0f/0.0f; */
float fninf = -fpinf;
double dpinf = NC_DPINF;//NC_INFINITE;//1.0/0.0;
double dpinf = NC_DPINF;/*NC_INFINITE;//1.0/0.0; */
double dninf = -dpinf;
nc_type att_type;
size_t att_len;

View File

@ -18,7 +18,7 @@ extern int lvsnprintf(char*, size_t, const char*, va_list);
NCConstant nullconstant;
NCConstant fillconstant;
Datalist nildatalist; // to support NIL keyword
Datalist nildatalist; /* to support NIL keyword */
Bytebuffer* codebuffer;
Bytebuffer* codetmp;

View File

@ -172,7 +172,7 @@ main(
int c;
FILE *fp;
struct Languages* langs;
char* lang_name;//
char* lang_name;
#ifdef __hpux
setlocale(LC_CTYPE,"");
#endif

View File

@ -3254,7 +3254,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
}
attr = makeattribute(install("_FillValue"),vsym,tsym,list,ATTRVAR);
} else switch (tag) {
// These will be output as attributes later
/* These will be output as attributes later */
case _STORAGE_FLAG:
if(strcmp(sdata,"contiguous") == 0)
special->_Storage = NC_CONTIGUOUS;

View File

@ -29,7 +29,7 @@
int
main(int argc, char **argv)
{
//EXTERNL int ncopts; /* netCDF error options */
/*EXTERNL int ncopts; */ /* netCDF error options */
char *testfiles[] = {"nonesuch", "nctest_classic.nc",
"nctest_64bit_offset.nc", "nctest_netcdf4.nc"};
char *testfile;

View File

@ -569,7 +569,7 @@ oc_dds_fieldbyname(OCobject link, OCobject ddsnode, const char* name, OCobject*
err = oc_dds_ithfield(link,ddsnode,i,&field);
if(err != OC_NOERR) return err;
// Get the field's name
/* Get the field's name */
err = oc_dds_name(link,field,&fieldname);
if(err != OC_NOERR) return err;
if(fieldname != NULL) {
@ -985,7 +985,7 @@ oc_data_fieldbyname(OCobject link, OCobject datanode, const char* name, OCobject
char* fieldname = NULL;
err = oc_dds_ithfield(link,ddsnode,i,&field);
if(err != OC_NOERR) return err;
// Get the field's name
/* Get the field's name */
err = oc_dds_name(link,field,&fieldname);
if(err != OC_NOERR) return err;
if(!fieldname)

View File

@ -14,6 +14,10 @@ Version: 2.0
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
/*!\file oc.h
*/

View File

@ -598,7 +598,7 @@ occopycat(char* dst, size_t size, size_t n, ...)
va_list args;
size_t avail = size - 1;
int i;
int status = 1; // assume ok
int status = 1; /* assume ok */
char* p = dst;
if(n == 0) {
@ -642,8 +642,8 @@ int
occoncat(char* dst, size_t size, size_t n, ...)
{
va_list args;
int status = 1; // assume ok
size_t avail;
int status = 1; /* assume ok */
size_t avail = 0;
int i;
char* p;
size_t dstused;

View File

@ -54,6 +54,10 @@
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef _WIN32
#include <wchar.h>
#include <sys/types.h>
@ -222,8 +226,7 @@ xxdr_skip(XXDR* xdrs, off_t len)
off_t pos;
pos = xxdr_getpos(xdrs);
pos = (pos + len);
// Removed the following; pos is unsigned. jhrg 9/30/13
// if(pos < 0) pos = 0;
/* Removed the following; pos is unsigned. jhrg 9/30/13 */
return xxdr_setpos(xdrs,pos);
}