Commit b3aee032 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Set constant variables to const.

parent 07c298e2
......@@ -86,7 +86,6 @@ int cdf_open(const char *path, int omode, int *ncidp)
void cdf_close(int ncid)
{
int status = nc_close(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -94,7 +93,6 @@ void cdf_close(int ncid)
void cdf_redef(int ncid)
{
int status = nc_redef(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -102,7 +100,6 @@ void cdf_redef(int ncid)
void cdf_enddef(int ncid)
{
int status = nc_enddef(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -115,7 +112,6 @@ void cdf__enddef(const int ncid, const size_t hdr_pad)
// 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);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -123,7 +119,6 @@ void cdf__enddef(const int ncid, const size_t hdr_pad)
void cdf_sync(int ncid)
{
int status = nc_sync(ncid);
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......
......@@ -613,13 +613,10 @@ void cdfGridCompress(int fileID, int ncvarid, size_t gridsize, int filetype, int
static
void cdfDefGridReference(stream_t *streamptr, int gridID)
{
int fileID = streamptr->fileID;
int number = gridInqNumber(gridID);
const int fileID = streamptr->fileID;
if ( number > 0 )
{
cdf_put_att_int(fileID, NC_GLOBAL, "number_of_grid_used", NC_INT, 1, &number);
}
const int number = gridInqNumber(gridID);
if ( number > 0 ) cdf_put_att_int(fileID, NC_GLOBAL, "number_of_grid_used", NC_INT, 1, &number);
const char *gridfile = gridInqReferencePtr(gridID);
if ( gridfile && gridfile[0] != 0 )
......@@ -1980,13 +1977,12 @@ void cdfDefHistory(stream_t *streamptr, int size, const char *history)
void cdfDefVars(stream_t *streamptr)
{
int vlistID = streamptr->vlistID;
if ( vlistID == CDI_UNDEFID )
Error("Internal problem! vlist undefined for streamptr %p", streamptr);
const int vlistID = streamptr->vlistID;
if ( vlistID == CDI_UNDEFID ) Error("Internal problem! vlist undefined for streamptr %p", streamptr);
if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
int ngrids = vlistNgrids(vlistID);
const int ngrids = vlistNgrids(vlistID);
if ( 2*ngrids > MAX_GRIDS_PS ) Error("Internal problem! Too many grids per stream (max=%d)\n", MAX_GRIDS_PS);
for ( int index = 0; index < 2*ngrids; ++index )
{
......@@ -1997,7 +1993,7 @@ void cdfDefVars(stream_t *streamptr)
for ( int index = 0; index < ngrids; ++index )
{
int gridID = vlistGrid(vlistID, index);
const int gridID = vlistGrid(vlistID, index);
cdfDefGrid(streamptr, gridID, index);
}
{
......@@ -2009,10 +2005,10 @@ void cdfDefVars(stream_t *streamptr)
if ( projID != CDI_UNDEFID ) cdfDefGrid(streamptr, projID, ++index);
}
}
int nzaxis = vlistNzaxis(vlistID);
const int nzaxis = vlistNzaxis(vlistID);
for ( int index = 0; index < nzaxis; ++index )
{
int zaxisID = vlistZaxis(vlistID, index);
const int zaxisID = vlistZaxis(vlistID, index);
if ( streamptr->zaxisID[index] == CDI_UNDEFID ) cdfDefZaxis(streamptr, zaxisID);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment