Commit 4f850936 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Set constant variables to const.

parent 6881eb4e
Pipeline #9206 failed with stage
in 0 seconds
......@@ -93,8 +93,8 @@ size_t binReadF77Block(int fileID, int byteswap)
void binWriteF77Block(int fileID, int byteswap, size_t blocksize)
{
static unsigned int s[4] = {0, 8, 16, 24};
unsigned long ublocksize = (unsigned long) blocksize;
static const unsigned int s[4] = {0, 8, 16, 24};
const unsigned long ublocksize = (unsigned long) blocksize;
unsigned char f77block[4];
switch (HOST_ENDIANNESS)
......
......@@ -27,25 +27,12 @@ int days_per_month(int calendar, int year, int month)
{
int daysperyear = calendar_dpy(calendar);
const int *dpm;
if ( daysperyear == 360 ) dpm = month_360;
else if ( daysperyear == 365 ) dpm = month_365;
else dpm = month_366;
int dayspermonth = 0;
if ( month >= 1 && month <= 12 )
dayspermonth = dpm[month-1];
/*
else
fprintf(stderr, "days_per_month: month %d out of range\n", month);
*/
if ( daysperyear == 0 && month == 2 )
{
if ( (year%4 == 0 && year%100 != 0) || year%400 == 0 )
dayspermonth = 29;
else
dayspermonth = 28;
}
const int *dpm = (daysperyear == 360) ? month_360 : ((daysperyear == 365) ? month_365 : month_366);
int dayspermonth = ( month >= 1 && month <= 12 ) ? dpm[month-1] : 0;
if (daysperyear == 0 && month == 2)
dayspermonth = ((year%4 == 0 && year%100 != 0) || year%400 == 0) ? 29 : 28;
return dayspermonth;
}
......@@ -55,11 +42,11 @@ int days_per_year(int calendar, int year)
{
int daysperyear = calendar_dpy(calendar);
if ( daysperyear == 0 )
if (daysperyear == 0)
{
if ( year == 1582 && (calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN) )
if (year == 1582 && (calendar == CALENDAR_STANDARD || calendar == CALENDAR_GREGORIAN))
daysperyear = 355;
else if ( (year%4 == 0 && year%100 != 0) || year%400 == 0 )
else if ((year%4 == 0 && year%100 != 0) || year%400 == 0)
daysperyear = 366;
else
daysperyear = 365;
......@@ -71,8 +58,6 @@ int days_per_year(int calendar, int year)
static void decode_day(int dpy, int days, int *year, int *month, int *day)
{
int i = 0;
*year = (days-1) / dpy;
days -= (*year*dpy);
......@@ -81,6 +66,7 @@ static void decode_day(int dpy, int days, int *year, int *month, int *day)
else if ( dpy == 365 ) dpm = month_365;
else if ( dpy == 366 ) dpm = month_366;
int i = 0;
if ( dpm )
for ( i = 0; i < 12; i++ )
{
......@@ -112,7 +98,7 @@ static int64_t encode_day(int dpy, int year, int month, int day)
void encode_caldaysec(int calendar, int year, int month, int day, int hour, int minute, int second,
int64_t *julday, int *secofday)
{
int dpy = calendar_dpy(calendar);
const int dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 )
*julday = encode_day(dpy, year, month, day);
......@@ -126,7 +112,7 @@ void encode_caldaysec(int calendar, int year, int month, int day, int hour, int
void decode_caldaysec(int calendar, int64_t julday, int secofday,
int *year, int *month, int *day, int *hour, int *minute, int *second)
{
int dpy = calendar_dpy(calendar);
const int dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 )
decode_day(dpy, julday, year, month, day);
......@@ -142,7 +128,7 @@ void decode_caldaysec(int calendar, int64_t julday, int secofday,
#ifdef TEST
static int date_to_calday(int calendar, int date)
{
int dpy = calendar_dpy(calendar);
const int dpy = calendar_dpy(calendar);
int year, month, day;
cdiDecodeDate(date, &year, &month, &day);
......@@ -160,14 +146,14 @@ static int date_to_calday(int calendar, int date)
static int calday_to_date(int calendar, int calday)
{
int year, month, day;
int dpy = calendar_dpy(calendar);
const int dpy = calendar_dpy(calendar);
if ( dpy == 360 || dpy == 365 || dpy == 366 )
decode_day(dpy, calday, &year, &month, &day);
else
decode_julday(calendar, calday, &year, &month, &day);
int date = cdiEncodeDate(year, month, day);
const int date = cdiEncodeDate(year, month, day);
return date;
}
......
......@@ -103,7 +103,7 @@ static int cdfOpenFile(const char *filename, const char *mode, int *filetype)
{
case 'r':
{
int status = cdf_open(filename, readmode, &ncid);
const int status = cdf_open(filename, readmode, &ncid);
if ( status > 0 && ncid < 0 ) ncid = CDI_ESYSTEM;
#ifdef HAVE_NETCDF4
else
......
......@@ -85,21 +85,21 @@ int cdf_open(const char *path, int omode, int *ncidp)
void cdf_close(int ncid)
{
int status = nc_close(ncid);
const int status = nc_close(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
void cdf_redef(int ncid)
{
int status = nc_redef(ncid);
const int status = nc_redef(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
void cdf_enddef(int ncid)
{
int status = nc_enddef(ncid);
const int status = nc_enddef(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -111,21 +111,21 @@ void cdf__enddef(const int ncid, const size_t hdr_pad)
const size_t r_align = 4UL; // [B] Alignment of beginning of data section for record variables
// nc_enddef(ncid) is equivalent to nc__enddef(ncid, 0, 4, 0, 4)
int status = nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align);
const int status = nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
void cdf_sync(int ncid)
{
int status = nc_sync(ncid);
const int status = nc_sync(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp)
{
int status = nc_inq(ncid, ndimsp, nvarsp, ngattsp, unlimdimidp);
const int status = nc_inq(ncid, ndimsp, nvarsp, ngattsp, unlimdimidp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d ndims=%d nvars=%d ngatts=%d unlimid=%d",
......@@ -137,7 +137,7 @@ void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp)
void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp)
{
int status = nc_def_dim(ncid, name, len, dimidp);
const int status = nc_def_dim(ncid, name, len, dimidp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d name=%s len=%d", ncid, name, len);
......@@ -148,7 +148,7 @@ void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp)
void cdf_inq_dimid(int ncid, const char *name, int *dimidp)
{
int status = nc_inq_dimid(ncid, name, dimidp);
const int status = nc_inq_dimid(ncid, name, dimidp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d name=%s dimid=%d", ncid, name, *dimidp);
......@@ -159,7 +159,7 @@ void cdf_inq_dimid(int ncid, const char *name, int *dimidp)
void cdf_inq_dim(int ncid, int dimid, char *name, size_t * lengthp)
{
int status = nc_inq_dim(ncid, dimid, name, lengthp);
const int status = nc_inq_dim(ncid, dimid, name, lengthp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d dimid=%d length=%d name=%s", ncid, dimid, *lengthp, name);
......@@ -170,7 +170,7 @@ void cdf_inq_dim(int ncid, int dimid, char *name, size_t * lengthp)
void cdf_inq_dimname(int ncid, int dimid, char *name)
{
int status = nc_inq_dimname(ncid, dimid, name);
const int status = nc_inq_dimname(ncid, dimid, name);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d dimid=%d name=%s", ncid, dimid, name);
......@@ -181,7 +181,7 @@ void cdf_inq_dimname(int ncid, int dimid, char *name)
void cdf_inq_dimlen(int ncid, int dimid, size_t * lengthp)
{
int status = nc_inq_dimlen(ncid, dimid, lengthp);
const int status = nc_inq_dimlen(ncid, dimid, lengthp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d dimid=%d length=%d", ncid, dimid, *lengthp);
......@@ -202,11 +202,10 @@ void
cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
const int dimids[], int *varidp)
{
int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp);
const int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d name=%s xtype=%d ndims=%d varid=%d",
ncid, name, xtype, ndims, *varidp);
Message("ncid=%d name=%s xtype=%d ndims=%d varid=%d", ncid, name, xtype, ndims, *varidp);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -215,7 +214,7 @@ cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
void cdf_inq_varid(int ncid, const char *name, int *varidp)
{
int status = nc_inq_varid(ncid, name, varidp);
const int status = nc_inq_varid(ncid, name, varidp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d name=%s varid=%d", ncid, name, *varidp);
......@@ -226,7 +225,7 @@ void cdf_inq_varid(int ncid, const char *name, int *varidp)
void cdf_inq_nvars(int ncid, int *nvarsp)
{
int status = nc_inq_nvars(ncid, nvarsp);
const int status = nc_inq_nvars(ncid, nvarsp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d nvars=%d", ncid, *nvarsp);
......@@ -238,7 +237,7 @@ void cdf_inq_nvars(int ncid, int *nvarsp)
void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
int dimids[], int *nattsp)
{
int status = nc_inq_var(ncid, varid, name, xtypep, ndimsp, dimids, nattsp);
const int status = nc_inq_var(ncid, varid, name, xtypep, ndimsp, dimids, nattsp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d ndims=%d xtype=%d natts=%d name=%s",
......@@ -250,7 +249,7 @@ void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
void cdf_inq_varname(int ncid, int varid, char *name)
{
int status = nc_inq_varname(ncid, varid, name);
const int status = nc_inq_varname(ncid, varid, name);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d name=%s", ncid, varid, name);
......@@ -261,7 +260,7 @@ void cdf_inq_varname(int ncid, int varid, char *name)
void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep)
{
int status = nc_inq_vartype(ncid, varid, xtypep);
const int status = nc_inq_vartype(ncid, varid, xtypep);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d xtype=%s", ncid, varid, *xtypep);
......@@ -272,7 +271,7 @@ void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep)
void cdf_inq_varndims(int ncid, int varid, int *ndimsp)
{
int status = nc_inq_varndims(ncid, varid, ndimsp);
const int status = nc_inq_varndims(ncid, varid, ndimsp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -283,7 +282,7 @@ void cdf_inq_varndims(int ncid, int varid, int *ndimsp)
void cdf_inq_vardimid(int ncid, int varid, int dimids[])
{
int status = nc_inq_vardimid(ncid, varid, dimids);
const int status = nc_inq_vardimid(ncid, varid, dimids);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -294,7 +293,7 @@ void cdf_inq_vardimid(int ncid, int varid, int dimids[])
void cdf_inq_varnatts(int ncid, int varid, int *nattsp)
{
int status = nc_inq_varnatts(ncid, varid, nattsp);
const int status = nc_inq_varnatts(ncid, varid, nattsp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d nattsp=%d", ncid, varid, *nattsp);
......@@ -305,7 +304,7 @@ void cdf_inq_varnatts(int ncid, int varid, int *nattsp)
void cdf_put_var_text(int ncid, int varid, const char *tp)
{
int status = nc_put_var_text(ncid, varid, tp);
const int status = nc_put_var_text(ncid, varid, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %s", ncid, varid, tp);
......@@ -316,7 +315,7 @@ void cdf_put_var_text(int ncid, int varid, const char *tp)
void cdf_put_var_short(int ncid, int varid, const short *sp)
{
int status = nc_put_var_short(ncid, varid, sp);
const int status = nc_put_var_short(ncid, varid, sp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %hd", ncid, varid, *sp);
......@@ -327,7 +326,7 @@ void cdf_put_var_short(int ncid, int varid, const short *sp)
void cdf_put_var_int(int ncid, int varid, const int *ip)
{
int status = nc_put_var_int(ncid, varid, ip);
const int status = nc_put_var_int(ncid, varid, ip);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %d", ncid, varid, *ip);
......@@ -338,7 +337,7 @@ void cdf_put_var_int(int ncid, int varid, const int *ip)
void cdf_put_var_long(int ncid, int varid, const long *lp)
{
int status = nc_put_var_long(ncid, varid, lp);
const int status = nc_put_var_long(ncid, varid, lp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %ld", ncid, varid, *lp);
......@@ -349,7 +348,7 @@ void cdf_put_var_long(int ncid, int varid, const long *lp)
void cdf_put_var_float(int ncid, int varid, const float *fp)
{
int status = nc_put_var_float(ncid, varid, fp);
const int status = nc_put_var_float(ncid, varid, fp);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %f", ncid, varid, *fp);
......@@ -407,7 +406,7 @@ void minmaxvalf(size_t nvals, const float *array, double *minval, double *maxval
void cdf_put_vara_double(int ncid, int varid, const size_t start[],
const size_t count[], const double *dp)
{
int status = nc_put_vara_double(ncid, varid, start, count, dp);
const int status = nc_put_vara_double(ncid, varid, start, count, dp);
if ( CDF_Debug || status != NC_NOERR )
{
......@@ -417,7 +416,7 @@ void cdf_put_vara_double(int ncid, int varid, const size_t start[],
nc_inq_vartype(ncid, varid, &xtype);
int ndims;
nc_inq_varndims(ncid, varid, &ndims);
double minval = 0, maxval = 0;
double minval = 0.0, maxval = 0.0;
size_t nvals = 1;
for ( int i = 0; i < ndims; ++i ) nvals *= count[i];
minmaxval(nvals, dp, &minval, &maxval);
......@@ -432,7 +431,7 @@ void cdf_put_vara_double(int ncid, int varid, const size_t start[],
void cdf_put_vara_float(int ncid, int varid, const size_t start[],
const size_t count[], const float *fp)
{
int status = nc_put_vara_float(ncid, varid, start, count, fp);
const int status = nc_put_vara_float(ncid, varid, start, count, fp);
if ( CDF_Debug || status != NC_NOERR )
{
......@@ -442,7 +441,7 @@ void cdf_put_vara_float(int ncid, int varid, const size_t start[],
nc_inq_vartype(ncid, varid, &xtype);
int ndims;
nc_inq_varndims(ncid, varid, &ndims);
double minval = 0, maxval = 0;
double minval = 0.0, maxval = 0.0;
size_t nvals = 1;
for ( int i = 0; i < ndims; ++i ) nvals *= count[i];
minmaxvalf(nvals, fp, &minval, &maxval);
......@@ -456,7 +455,7 @@ void cdf_put_vara_float(int ncid, int varid, const size_t start[],
void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[], const void *cp)
{
int status = nc_put_vara(ncid, varid, start, count, cp);
const int status = nc_put_vara(ncid, varid, start, count, cp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -467,7 +466,7 @@ void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[
void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[], void *cp)
{
int status = nc_get_vara(ncid, varid, start, count, cp);
const int status = nc_get_vara(ncid, varid, start, count, cp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -478,7 +477,7 @@ void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[
void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t count[], int *dp)
{
int status = nc_get_vara_int(ncid, varid, start, count, dp);
const int status = nc_get_vara_int(ncid, varid, start, count, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -489,7 +488,7 @@ void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t co
void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t count[], double *dp)
{
int status = nc_get_vara_double(ncid, varid, start, count, dp);
const int status = nc_get_vara_double(ncid, varid, start, count, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]);
......@@ -500,7 +499,7 @@ void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t
void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count[], float *fp)
{
int status = nc_get_vara_float(ncid, varid, start, count, fp);
const int status = nc_get_vara_float(ncid, varid, start, count, fp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]);
......@@ -511,7 +510,7 @@ void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t
void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[], char *tp)
{
int status = nc_get_vara_text(ncid, varid, start, count, tp);
const int status = nc_get_vara_text(ncid, varid, start, count, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -522,7 +521,7 @@ void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t c
void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp)
{
int status = nc_get_vara_uchar(ncid, varid, start, count, tp);
const int status = nc_get_vara_uchar(ncid, varid, start, count, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -533,7 +532,7 @@ void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t
void cdf_put_var_double(int ncid, int varid, const double *dp)
{
int status = nc_put_var_double(ncid, varid, dp);
const int status = nc_put_var_double(ncid, varid, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp);
......@@ -544,7 +543,7 @@ void cdf_put_var_double(int ncid, int varid, const double *dp)
void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp)
{
int status = nc_get_var1_text(ncid, varid, index, tp);
const int status = nc_get_var1_text(ncid, varid, index, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -555,7 +554,7 @@ void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp)
void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp)
{
int status = nc_get_var1_double(ncid, varid, index, dp);
const int status = nc_get_var1_double(ncid, varid, index, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -566,7 +565,7 @@ void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp)
void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp)
{
int status = nc_put_var1_double(ncid, varid, index, dp);
const int status = nc_put_var1_double(ncid, varid, index, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d val=%f", ncid, varid, *dp);
......@@ -577,7 +576,7 @@ void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double
void cdf_get_var_text(int ncid, int varid, char *tp)
{
int status = nc_get_var_text(ncid, varid, tp);
const int status = nc_get_var_text(ncid, varid, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -588,7 +587,7 @@ void cdf_get_var_text(int ncid, int varid, char *tp)
void cdf_get_var_short(int ncid, int varid, short *sp)
{
int status = nc_get_var_short(ncid, varid, sp);
const int status = nc_get_var_short(ncid, varid, sp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -599,7 +598,7 @@ void cdf_get_var_short(int ncid, int varid, short *sp)
void cdf_get_var_int(int ncid, int varid, int *ip)
{
int status = nc_get_var_int(ncid, varid, ip);
const int status = nc_get_var_int(ncid, varid, ip);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -610,7 +609,7 @@ void cdf_get_var_int(int ncid, int varid, int *ip)
void cdf_get_var_long(int ncid, int varid, long *lp)
{
int status = nc_get_var_long(ncid, varid, lp);
const int status = nc_get_var_long(ncid, varid, lp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -621,7 +620,7 @@ void cdf_get_var_long(int ncid, int varid, long *lp)
void cdf_get_var_float(int ncid, int varid, float *fp)
{
int status = nc_get_var_float(ncid, varid, fp);
const int status = nc_get_var_float(ncid, varid, fp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d", ncid, varid);
......@@ -632,7 +631,7 @@ void cdf_get_var_float(int ncid, int varid, float *fp)
void cdf_get_var_double(int ncid, int varid, double *dp)
{
int status = nc_get_var_double(ncid, varid, dp);
const int status = nc_get_var_double(ncid, varid, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d val[0]=%f", ncid, varid, *dp);
......@@ -643,7 +642,7 @@ void cdf_get_var_double(int ncid, int varid, double *dp)
void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out)
{
int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out);
const int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out);
if ( CDF_Debug || status != NC_NOERR )
Message("%d %d %s %d %d", ncid_in, varid_out, name, ncid_out, varid_out);
......@@ -654,7 +653,7 @@ void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int
void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const char *tp)
{
int status = nc_put_att_text(ncid, varid, name, len, tp);
const int status = nc_put_att_text(ncid, varid, name, len, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d att=%s text=%.*s", ncid, varid, name, (int)len, tp);
......@@ -665,7 +664,7 @@ void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const c
void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len, const int *ip)
{
int status = nc_put_att_int(ncid, varid, name, xtype, len, ip);
const int status = nc_put_att_int(ncid, varid, name, xtype, len, ip);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d att=%s val=%d", ncid, varid, name, *ip);
......@@ -676,7 +675,7 @@ void cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_
void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *dp)
{
int status = nc_put_att_float(ncid, varid, name, xtype, len, dp);
const int status = nc_put_att_float(ncid, varid, name, xtype, len, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp);
......@@ -687,7 +686,7 @@ void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, siz
void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *dp)
{
int status = nc_put_att_double(ncid, varid, name, xtype, len, dp);
const int status = nc_put_att_double(ncid, varid, name, xtype, len, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp);
......@@ -698,7 +697,7 @@ void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, si
void cdf_get_att_text(int ncid, int varid, const char *name, char *tp)
{
int status = nc_get_att_text(ncid, varid, name, tp);
const int status = nc_get_att_text(ncid, varid, name, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d name=%s", ncid, varid, name);
......@@ -710,7 +709,7 @@ void cdf_get_att_text(int ncid, int varid, const char *name, char *tp)
void cdf_get_att_string(int ncid, int varid, const char *name, char **tp)
{
#ifdef HAVE_NETCDF4
int status = nc_get_att_string(ncid, varid, name, tp);
const int status = nc_get_att_string(ncid, varid, name, tp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d name=%s", ncid, varid, name);
......@@ -722,7 +721,7 @@ void cdf_get_att_string(int ncid, int varid, const char *name, char **tp)
void cdf_get_att_int(int ncid, int varid, const char *name, int *ip)
{
int status = nc_get_att_int(ncid, varid, name, ip);
const int status = nc_get_att_int(ncid, varid, name, ip);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d att=%s val=%d", ncid, varid, name, *ip);
......@@ -734,7 +733,7 @@ void cdf_get_att_int(int ncid, int varid, const char *name, int *ip)
void cdf_get_att_long(int ncid, int varid, const char *name, long *ip)
{
#ifdef HAVE_NETCDF4
int status = nc_get_att_long(ncid, varid, name, ip);
const int status = nc_get_att_long(ncid, varid, name, ip);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d att=%s val=%ld", ncid, varid, name, *ip);
......@@ -746,9 +745,7 @@ void cdf_get_att_long(int ncid, int varid, const char *name, long *ip)
void cdf_get_att_double(int ncid, int varid, const char *name, double *dp)
{
int status;
status = nc_get_att_double(ncid, varid, name, dp);
const int status = nc_get_att_double(ncid, varid, name, dp);
if ( CDF_Debug || status != NC_NOERR )
Message("ncid=%d varid=%d att=%s val=%.9g", ncid, varid, name, *dp);
......@@ -759,7 +756,7 @@ void cdf_get_att_double(int ncid, int varid, const char *name, double *dp)
void cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp)
{
int status = nc_inq_att(ncid, varid, name, xtypep, lenp);
const int status = nc_inq_att(ncid, varid, name, xtypep, lenp);