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

Changed int to bool.

parent 0a0bebda
......@@ -2873,7 +2873,7 @@ void cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
}
}
ncvar->zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, (int)with_bounds, lbounds, ubounds,
ncvar->zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, with_bounds, lbounds, ubounds,
(int)vctsize, vct, pname, plongname, punits, zprec, 1, 0);
if ( CDI_cmor_mode && zsize == 1 && zaxisType != ZAXIS_HYBRID ) zaxisDefScalar(ncvar->zaxisID);
......
......@@ -861,17 +861,17 @@ void varDefZAxisReference(int nhlev, int nvgrid, unsigned char uuid[CDI_UUID_SIZ
}
int zaxisCompare(int zaxisID, int zaxistype, int nlevels, int lbounds, const double *levels, const char *longname, const char *units, int ltype1)
bool zaxisCompare(int zaxisID, int zaxistype, int nlevels, bool lbounds, const double *levels, const char *longname, const char *units, int ltype1)
{
int differ = 1;
int zlbounds = 0;
bool differ = true;
bool zlbounds = false;
bool ltype_is_equal = false;
if ( ltype1 == zaxisInqLtype(zaxisID) ) ltype_is_equal = true;
if ( ltype_is_equal && (zaxistype == zaxisInqType(zaxisID) || zaxistype == ZAXIS_GENERIC) )
{
if ( zaxisInqLbounds(zaxisID, NULL) > 0 ) zlbounds = 1;
if ( zaxisInqLbounds(zaxisID, NULL) > 0 ) zlbounds = true;
if ( nlevels == zaxisInqSize(zaxisID) && zlbounds == lbounds )
{
char zlongname[CDI_MAX_NAME];
......@@ -887,7 +887,7 @@ int zaxisCompare(int zaxisID, int zaxistype, int nlevels, int lbounds, const dou
break;
}
if ( levelID == nlevels ) differ = 0;
if ( levelID == nlevels ) differ = false;
}
if ( ! differ )
......@@ -896,11 +896,11 @@ int zaxisCompare(int zaxisID, int zaxistype, int nlevels, int lbounds, const dou
zaxisInqUnits(zaxisID, zunits);
if ( longname && zlongname[0] )
{
if ( strcmp(longname, zlongname) != 0 ) differ = 1;
if ( strcmp(longname, zlongname) != 0 ) differ = true;
}
if ( units && zunits[0] )
{
if ( strcmp(units, zunits) != 0 ) differ = 1;
if ( strcmp(units, zunits) != 0 ) differ = true;
}
}
}
......@@ -914,7 +914,7 @@ struct varDefZAxisSearchState
int resIDValue;
int zaxistype;
int nlevels;
int lbounds;
bool lbounds;
const double *levels;
const char *longname;
const char *units;
......@@ -926,9 +926,9 @@ varDefZAxisSearch(int id, void *res, void *data)
{
struct varDefZAxisSearchState *state = (struct varDefZAxisSearchState *)data;
(void)res;
if (zaxisCompare(id, state->zaxistype, state->nlevels, state->lbounds,
state->levels, state->longname, state->units, state->ltype)
== 0)
if ( zaxisCompare(id, state->zaxistype, state->nlevels, state->lbounds,
state->levels, state->longname, state->units, state->ltype)
== false)
{
state->resIDValue = id;
return CDI_APPLY_STOP;
......@@ -938,7 +938,7 @@ varDefZAxisSearch(int id, void *res, void *data)
}
int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, int lbounds,
int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, bool lbounds,
const double *levels1, const double *levels2, int vctsize, const double *vct, char *name,
const char *longname, const char *units, int prec, int mode, int ltype1)
{
......@@ -946,9 +946,9 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, i
mode: 0 search in vlist and zaxis table
1 search in zaxis table
*/
int zaxisdefined = 0;
int zaxisID = UNDEFID;
int zaxisglobdefined = 0;
bool zaxisdefined = false;
bool zaxisglobdefined = false;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
int nzaxis = vlistptr->nzaxis;
......@@ -957,9 +957,9 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, i
{
zaxisID = vlistptr->zaxisIDs[index];
if ( zaxisCompare(zaxisID, zaxistype, nlevels, lbounds, levels, longname, units, ltype1) == 0 )
if ( zaxisCompare(zaxisID, zaxistype, nlevels, lbounds, levels, longname, units, ltype1) == false )
{
zaxisdefined = 1;
zaxisdefined = true;
break;
}
}
......@@ -984,7 +984,7 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, i
for (int index = 0; index < nzaxis; index++ )
if ( vlistptr->zaxisIDs[index] == zaxisID )
{
zaxisglobdefined = FALSE;
zaxisglobdefined = false;
break;
}
}
......
......@@ -15,7 +15,7 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
void varDefVCT(size_t vctsize, double *vctptr);
void varDefZAxisReference(int nlev, int nvgrid, unsigned char uuid[CDI_UUID_SIZE]);
int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, int lbounds,
int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, bool lbounds,
const double *levels1, const double *levels2, int vctsize, const double *vct, char *name,
const char *longname, const char *units, int prec, int mode, int ltype);
......@@ -38,7 +38,7 @@ void varDefOptGribInt(int varID, int tile_index, long lval, const char *keyword)
void varDefOptGribDbl(int varID, int tile_index, double dval, const char *keyword);
int varOptGribNentries(int varID);
int zaxisCompare(int zaxisID, int zaxistype, int nlevels, int lbounds, const double *levels, const char *longname, const char *units, int ltype);
bool zaxisCompare(int zaxisID, int zaxistype, int nlevels, bool lbounds, const double *levels, const char *longname, const char *units, int ltype);
#endif
/*
......
......@@ -420,7 +420,7 @@ struct vgzSearchState
int resIDValue;
int zaxistype;
int nlevels;
int lbounds;
bool lbounds;
const double *levels;
};
......@@ -431,7 +431,7 @@ vgzZAxisSearch(int id, void *res, void *data)
(void)res;
if (zaxisCompare(id, state->zaxistype, state->nlevels, state->lbounds,
state->levels, NULL, NULL, 0)
== 0)
== false)
{
state->resIDValue = id;
return CDI_APPLY_STOP;
......@@ -440,27 +440,26 @@ vgzZAxisSearch(int id, void *res, void *data)
return CDI_APPLY_GO_ON;
}
static
int vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double *levels,
const double *lbounds, const double *ubounds, int vctsize, const double *vct)
{
int zaxisID = CDI_UNDEFID;
int zaxisglobdefined = 0;
int has_bounds = FALSE;
bool zaxisdefined = false;
bool zaxisglobdefined = false;
bool has_bounds = false;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
int zaxisdefined = 0;
int nzaxis = vlistptr->nzaxis;
if ( lbounds && ubounds ) has_bounds = TRUE;
if ( lbounds && ubounds ) has_bounds = true;
for ( int index = 0; index < nzaxis; ++index )
{
zaxisID = vlistptr->zaxisIDs[index];
if ( zaxisCompare(zaxisID, zaxistype, nlevels, has_bounds, levels, NULL, NULL, 0) == 0 )
if ( zaxisCompare(zaxisID, zaxistype, nlevels, has_bounds, levels, NULL, NULL, 0) == false )
{
zaxisdefined = 1;
zaxisdefined = true;
break;
}
}
......@@ -1540,7 +1539,7 @@ void vlist_check_contents(int vlistID)
/* Resizes and initializes opt_grib_kvpair data structure. */
void resize_opt_grib_entries(var_t *var, int nentries)
{
if (var->opt_grib_kvpair_size >= nentries)
if (var->opt_grib_kvpair_size >= nentries)
{
if ( CDI_Debug )
Message("data structure has size %d, no resize to %d needed.", var->opt_grib_kvpair_size, nentries);
......
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