Commit 291f8440 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Fix g++ warnings.

parent ea75dbeb
......@@ -200,8 +200,8 @@ case "${HOSTNAME}" in
--enable-maintainer-mode \
$CDOLIBS LDFLAGS="-Wl,-rpath,$HOME/local/eccodes-2.3.0/lib" \
F77=gfortran FFLAGS="-g -O2" \
CXX=g++ CXXFLAGS="-g -pipe -Wall -W -Wfloat-equal -pedantic -O3 -march=native -Wa,-q" \
CC=gcc CFLAGS="-g -pipe -Wall -W -Wfloat-equal -pedantic -O3 -march=native -Wa,-q"
CXX=g++ CXXFLAGS="-g -pipe -Wall -Wextra -Wshadow -Wfloat-equal -pedantic -O3 -march=native -Wa,-q" \
CC=gcc CFLAGS="-g -pipe -Wall -Wextra -Wshadow -Wfloat-equal -pedantic -O3 -march=native -Wa,-q"
fi
;;
# win7 based cygwin virtual machine
......
......@@ -209,17 +209,17 @@ static int
submitCdoCommand(const char *argument)
{
const char *cdoPath = getCdoPath();
char *cdoCommand = (char *) Malloc(strlen(cdoPath) + strlen(argument) + 8);
char *cdo_command = (char *) Malloc(strlen(cdoPath) + strlen(argument) + 8);
int status;
cdoCommand[0] = '\0';
strcat(cdoCommand, cdoPath);
strcat(cdoCommand, " -b 64 ");
strcat(cdoCommand, argument);
cdo_command[0] = '\0';
strcat(cdo_command, cdoPath);
strcat(cdo_command, " -b 64 ");
strcat(cdo_command, argument);
status = system(cdoCommand);
Free(cdoCommand);
status = system(cdo_command);
Free(cdo_command);
return status;
}
......
......@@ -407,8 +407,6 @@ HistogramSet::addSubVarLevelValues(int varID, int levelID, const Field &field, i
void
HistogramSet::Reset(int varID, int levelID, int ptype)
{
const auto nvars = this->nvars;
assert(nvars > 0);
if (varID < 0 || varID >= nvars) cdoAbort("Illegal argument: varID %d is undefined (%s)", varID, __func__);
......
......@@ -37,8 +37,8 @@ pipe_t::close()
pthread_mutex_unlock(m_mutex);
pthread_cond_signal(tsDef);
pthread_cond_signal(tsInq);
pthread_cond_signal(recInq); //
pthread_cond_signal(isclosed); //
pthread_cond_signal(recInq);
pthread_cond_signal(isclosed);
}
void
......@@ -167,12 +167,10 @@ pipe_t::pipeDefTimestep(int p_vlistID, int p_tsID)
{
auto vlistID = p_vlistID;
numrecs = 0;
for (int varID = 0; varID < vlistNvars(vlistID); varID++)
for (int i = 0; i < vlistNvars(vlistID); i++)
{
if (vlistInqVarTimetype(vlistID, varID) != TIME_CONSTANT)
{
numrecs += zaxisInqSize(vlistInqVarZaxis(vlistID, varID));
}
if (vlistInqVarTimetype(vlistID, i) != TIME_CONSTANT)
numrecs += zaxisInqSize(vlistInqVarZaxis(vlistID, i));
}
Debug(PIPE, " %s numrecs= %d nvars= %d ", name.c_str(), numrecs, vlistNvars(vlistID));
}
......@@ -352,9 +350,9 @@ pipe_t::pipeReadPipeRecord(float *p_data, int vlistID, size_t *p_nmiss)
}
size_t
pipe_t::pipeReadRecord(int p_vlistID, double *p_data, size_t *nmiss)
pipe_t::pipeReadRecord(int p_vlistID, double *p_data, size_t *p_nmiss)
{
*nmiss = 0;
*p_nmiss = 0;
size_t nvals = 0;
// LOCK
......@@ -367,7 +365,7 @@ pipe_t::pipeReadRecord(int p_vlistID, double *p_data, size_t *nmiss)
if (hasdata)
{
nvals = pipeReadPipeRecord(p_data, p_vlistID, nmiss);
nvals = pipeReadPipeRecord(p_data, p_vlistID, p_nmiss);
}
else
{
......@@ -386,9 +384,9 @@ pipe_t::pipeReadRecord(int p_vlistID, double *p_data, size_t *nmiss)
}
size_t
pipe_t::pipeReadRecord(int p_vlistID, float *p_data, size_t *nmiss)
pipe_t::pipeReadRecord(int p_vlistID, float *p_data, size_t *p_nmiss)
{
*nmiss = 0;
*p_nmiss = 0;
size_t nvals = 0;
// LOCK
......@@ -401,7 +399,7 @@ pipe_t::pipeReadRecord(int p_vlistID, float *p_data, size_t *nmiss)
if (hasdata)
{
nvals = pipeReadPipeRecord(p_data, p_vlistID, nmiss);
nvals = pipeReadPipeRecord(p_data, p_vlistID, p_nmiss);
}
else
{
......
......@@ -249,8 +249,8 @@ parseNamelist(PMList &pmlist, NamelistParser &parser, char *buf, bool cdocmor)
if (it + 1 < ntok && tokens[it + 1].type == NamelistType::WORD)
{
it++;
const auto &t = tokens[it];
snprintf(name, sizeof(name), "%.*s", t.end - t.start, buf + t.start);
const auto &t2 = tokens[it];
snprintf(name, sizeof(name), "%.*s", t2.end - t2.start, buf + t2.start);
name[sizeof(name) - 1] = 0;
}
......
......@@ -303,15 +303,15 @@ pointInQuad(bool isCyclic, size_t nx, size_t ny, size_t i, size_t j, size_t adds
idx[2] = jp1 * nx + ip1; // north-east
idx[3] = jp1 * nx + i; // north
for (unsigned j = 0; j < 4; ++j) lons[j] = centerLon[idx[j]];
for (unsigned j = 0; j < 4; ++j) lats[j] = centerLat[idx[j]];
for (unsigned k = 0; k < 4; ++k) lons[k] = centerLon[idx[k]];
for (unsigned k = 0; k < 4; ++k) lats[k] = centerLat[idx[k]];
unsigned n = quadCrossProducts(plon, plat, lons, lats);
// If cross products all same sign, we found the location
if (n >= 4)
{
for (unsigned j = 0; j < 4; ++j) adds[j] = idx[j];
for (unsigned k = 0; k < 4; ++k) adds[k] = idx[k];
search_result = true;
}
......
......@@ -141,7 +141,7 @@ boundboxFromCenter(bool lonIsCyclic, size_t size, size_t nx, size_t ny, const do
size_t n4 = n << 2;
/* Find N,S and NE points to this grid point */
// Find N,S and NE points to this grid point
size_t j = n / nx;
size_t i = n - j * nx;
......@@ -154,10 +154,10 @@ boundboxFromCenter(bool lonIsCyclic, size_t size, size_t nx, size_t ny, const do
idx[2] = jp1 * nx + ip1; // north-east
idx[3] = jp1 * nx + i; // north
/* Find N,S and NE lat/lon coords and check bounding box */
// Find N,S and NE lat/lon coords and check bounding box
for (unsigned j = 0; j < 4; ++j) tmp_lons[j] = center_lon[idx[j]];
for (unsigned j = 0; j < 4; ++j) tmp_lats[j] = center_lat[idx[j]];
for (unsigned k = 0; k < 4; ++k) tmp_lons[k] = center_lon[idx[k]];
for (unsigned k = 0; k < 4; ++k) tmp_lats[k] = center_lat[idx[k]];
bound_box[n4 + 0] = tmp_lats[0];
bound_box[n4 + 1] = tmp_lats[0];
......
......@@ -47,7 +47,7 @@ sellist_init(SelectList &sellist, KVList &kvlist)
++i;
}
for (int i = 0; i < (int) sellist.size(); ++i)
for (i = 0; i < (int) sellist.size(); ++i)
{
auto &e = sellist[i];
e.flag = nullptr;
......
......@@ -119,7 +119,7 @@ zaxisPrintKernel(int zaxisID, FILE *fp)
if (type == ZAXIS_REFERENCE)
{
unsigned char uuid[CDI_UUID_SIZE];
int length = CDI_UUID_SIZE;
length = CDI_UUID_SIZE;
memset(uuid, 0, length);
cdiInqKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, &length);
if (!cdiUUIDIsNull(uuid))
......
Supports Markdown
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