Commit 86fe2edb authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Fix cppcheck error: Uninitialized variable.

parent 3542db88
...@@ -90,11 +90,8 @@ enum ...@@ -90,11 +90,8 @@ enum
YEAR_LEN = 10 YEAR_LEN = 10
}; };
class ReadArguments struct ReadArguments
{ {
public:
ReadArguments(FieldVector2D &input_vars) : vars(input_vars){};
~ReadArguments(){};
int tsIDnext; int tsIDnext;
#ifdef USE_CDI_STREAM #ifdef USE_CDI_STREAM
int streamID; int streamID;
...@@ -104,6 +101,8 @@ public: ...@@ -104,6 +101,8 @@ public:
int nrecs; int nrecs;
RecordInfo *recList; RecordInfo *recList;
FieldVector2D &vars; FieldVector2D &vars;
ReadArguments(FieldVector2D &input_vars) : vars(input_vars), tsIDnext(0), nrecs(0), recList(nullptr) {};
}; };
static int num_recs = 0; static int num_recs = 0;
......
...@@ -31,12 +31,14 @@ CdoStream::~CdoStream() {} ...@@ -31,12 +31,14 @@ CdoStream::~CdoStream() {}
CdoStream::CdoStream() : m_cdoStreamID(nextCdoStreamID++) CdoStream::CdoStream() : m_cdoStreamID(nextCdoStreamID++)
{ {
isopen = false; isopen = false;
ispipe = false;
m_vlistID = -1; m_vlistID = -1;
m_tsID = -1; m_tsID = -1;
m_filetype = CDI_UNDEFID; m_filetype = CDI_UNDEFID;
m_name = ""; m_name = "";
m_varID = -1; m_varID = -1;
m_nvals = 0; m_nvals = 0;
m_fileID = 0;
} }
int int
......
...@@ -132,7 +132,7 @@ scan(std::vector<std::string> p_argv) ...@@ -132,7 +132,7 @@ scan(std::vector<std::string> p_argv)
} }
std::vector<std::string> std::vector<std::string>
expandApply(std::vector<std::string> &p_argv) expandApply(const std::vector<std::string> &p_argv)
{ {
auto result = scan(p_argv); auto result = scan(p_argv);
if (errState == -1) exit(EXIT_FAILURE); if (errState == -1) exit(EXIT_FAILURE);
......
...@@ -24,6 +24,6 @@ ...@@ -24,6 +24,6 @@
* operators with arguments: written as -apply,OPERNAME,arguments * operators with arguments: written as -apply,OPERNAME,arguments
*/ */
std::vector<std::string> expandApply(std::vector<std::string> &p_argv); std::vector<std::string> expandApply(const std::vector<std::string> &p_argv);
#endif #endif
...@@ -401,8 +401,6 @@ getTimeIncrement(double jdelta, int64_t vdate0, int64_t vdate1) ...@@ -401,8 +401,6 @@ getTimeIncrement(double jdelta, int64_t vdate0, int64_t vdate1)
void void
checkTimeIncrement(int tsID, int calendar, int64_t vdate, int vtime, CheckTimeInc &checkTimeInc) checkTimeIncrement(int tsID, int calendar, int64_t vdate, int vtime, CheckTimeInc &checkTimeInc)
{ {
const char *tunits[] = { "second", "minute", "hour", "day", "month", "year" };
const auto juldate = julianDateEncode(calendar, vdate, vtime); const auto juldate = julianDateEncode(calendar, vdate, vtime);
if (tsID) if (tsID)
...@@ -415,6 +413,7 @@ checkTimeIncrement(int tsID, int calendar, int64_t vdate, int vtime, CheckTimeIn ...@@ -415,6 +413,7 @@ checkTimeIncrement(int tsID, int calendar, int64_t vdate, int vtime, CheckTimeIn
if (checkTimeInc.lwarn && (timeIncr.period != checkTimeInc.timeIncr.period || timeIncr.unit != checkTimeInc.timeIncr.unit)) if (checkTimeInc.lwarn && (timeIncr.period != checkTimeInc.timeIncr.period || timeIncr.unit != checkTimeInc.timeIncr.unit))
{ {
checkTimeInc.lwarn = false; checkTimeInc.lwarn = false;
const char *tunits[] = { "second", "minute", "hour", "day", "month", "year" };
cdoWarning("Time increment in step %d (%lld%s) differs from step 1 (%lld%s)!" cdoWarning("Time increment in step %d (%lld%s) differs from step 1 (%lld%s)!"
" Set parameter equal=false for unequal time increments!", " Set parameter equal=false for unequal time increments!",
tsID + 1, timeIncr.period, tunits[(int) timeIncr.unit], checkTimeInc.timeIncr.period, tsID + 1, timeIncr.period, tunits[(int) timeIncr.unit], checkTimeInc.timeIncr.period,
......
...@@ -109,7 +109,7 @@ private: ...@@ -109,7 +109,7 @@ private:
int has_bounds = -1; int has_bounds = -1;
int calendar = -1; int calendar = -1;
TimeStat stat = TimeStat::LAST; TimeStat stat = TimeStat::LAST;
DateTimeInfo timestat; DateTimeInfo timestat = {};
std::vector<DateTimeInfo> dtinfo; std::vector<DateTimeInfo> dtinfo;
void mean(int nsteps); void mean(int nsteps);
......
...@@ -73,7 +73,7 @@ class GridPointSearch ...@@ -73,7 +73,7 @@ class GridPointSearch
double (*coordinates_xyz)[3]; double (*coordinates_xyz)[3];
GridPointSearch() : in_use(false), extrapolate(false), is_cyclic(false), is_reg2d(false), is_curve(false), GridPointSearch() : in_use(false), extrapolate(false), is_cyclic(false), is_reg2d(false), is_curve(false),
n(0), search_container(nullptr), plons(nullptr), plats(nullptr), pointcloud(nullptr) {} method(PointSearchMethod::full), n(0), search_container(nullptr), plons(nullptr), plats(nullptr), pointcloud(nullptr) {}
}; };
void gridSearchPoint(GridPointSearch &gps, double plon, double plat, knnWeightsType &knnWeights); void gridSearchPoint(GridPointSearch &gps, double plon, double plat, knnWeightsType &knnWeights);
......
...@@ -51,6 +51,10 @@ pipe_t::pipe_init() ...@@ -51,6 +51,10 @@ pipe_t::pipe_init()
tsIDr = -1; tsIDr = -1;
tsIDw = -1; tsIDw = -1;
varID = -1;
levelID = -1;
nrecs = 0;
nmiss = 0; nmiss = 0;
data_d = nullptr; data_d = nullptr;
data_f = nullptr; data_f = nullptr;
...@@ -130,7 +134,7 @@ constexpr std::chrono::milliseconds TIMEOUT = std::chrono::milliseconds(1000); ...@@ -130,7 +134,7 @@ constexpr std::chrono::milliseconds TIMEOUT = std::chrono::milliseconds(1000);
int processNumsActive(void); int processNumsActive(void);
int int
pipe_t::pipeInqVlist(int &p_vlistID) pipe_t::pipeInqVlist(int p_vlistID)
{ {
Debug(PIPE, "Inquiring vlist for vlistID: %d", p_vlistID); Debug(PIPE, "Inquiring vlist for vlistID: %d", p_vlistID);
std::chrono::milliseconds time_to_wait(0); std::chrono::milliseconds time_to_wait(0);
......
...@@ -39,7 +39,7 @@ struct pipe_t ...@@ -39,7 +39,7 @@ struct pipe_t
{ {
public: public:
pipe_t(); pipe_t();
int pipeInqVlist(int &vlistID); int pipeInqVlist(int vlistID);
void pipe_init(); void pipe_init();
void pipeDefRecord(int p_varId, int p_levelID); void pipeDefRecord(int p_varId, int p_levelID);
void pipeDefTimestep(int p_vlistID, int tsID); void pipeDefTimestep(int p_vlistID, int tsID);
......
...@@ -34,7 +34,7 @@ public: ...@@ -34,7 +34,7 @@ public:
long nlat = 0; long nlat = 0;
long ntr = 0; long ntr = 0;
long nlev = 0; long nlev = 0;
long ifax[10]; long ifax[10] = {};
std::vector<double> vtrig; std::vector<double> vtrig;
FC_Transformation() FC_Transformation()
......
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