Commit 0d7002ac authored by Aleksy Barcz's avatar Aleksy Barcz

fix "Conditional jump or move depends on uninitialised value"

+ as reported by valgrind at lines draw.cpp:317 and draw.cpp:781, caused by creation of an uninitialized struct at database.cpp:400
+ fixed==false and ok==false seem like good defaults for this uninitialized struct
parent 54429849
......@@ -752,7 +752,7 @@ void ValuesTable::AddData(DatabaseQuery::ptr q, bool &view_values_changed, bool
}
void ValuesTable::InsertValue(DatabaseQuery::ValueData::V *v, NewValuesInsertStatus &status) {
void ValuesTable::InsertValue(const DatabaseQuery::ValueData::V *v, NewValuesInsertStatus &status) {
DTime dt(m_draw->GetPeriod(), ToWxDateTime(v->time_second, v->time_nanosecond));
int view_index = m_draw->m_index.GetStartTime().GetDistance(dt);
......
......@@ -83,31 +83,31 @@ struct DatabaseQuery {
PeriodType period_type;
struct V {
/**Start time of data*/
time_t time_second;
time_t time_nanosecond;
time_t time_second{};
time_t time_nanosecond{};
/**Custom porobe length*/
int custom_length;
int custom_length{};
/**Response from a database*/
double response;
double response{};
/**First val*/
double first_val;
double first_val{};
/**Last val*/
double last_val;
double last_val{};
/**Sum of probes*/
double sum;
double sum{};
/**Number of valid probes*/
int data_count = 0;
/**Number of no no-data probes*/
int no_data_count;
int no_data_count{};
/** False if error ocurred during data retrieval*/
bool ok;
bool ok{false};
/** error no*/
int error;
int error{};
/** Error string*/
wchar_t *error_str;
wchar_t *error_str{nullptr};
/** Fixed value, i.e. it's not gonna change in the future,
no need to ask for it */
bool fixed;
bool fixed{false};
};
std::vector<V> *vv;
bool refresh;
......
......@@ -226,7 +226,7 @@ struct ValuesTable {
* @param view_updated output param, indiactes if value of any entry wihin @see m_view interval has changed*/
void UpdateProbesValues(int idx, bool &stats_updated, bool &view_updated);
void InsertValue(DatabaseQuery::ValueData::V *v, NewValuesInsertStatus &status);
void InsertValue(const DatabaseQuery::ValueData::V *v, NewValuesInsertStatus &status);
size_t size() const;
......
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