Fix Klocwork scan issues.

This commit is contained in:
Chang, Harry 2020-12-27 12:04:55 +00:00 committed by Konstantinos Margaritis
parent 18f6aee5c2
commit 52f658ac55
4 changed files with 6 additions and 5 deletions

View File

@ -69,14 +69,14 @@ struct LitGraphVertexProps {
LitGraphVertexProps() = default; LitGraphVertexProps() = default;
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(move(c_in)) {} explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(move(c_in)) {}
ue2_literal::elem c; // string element (char + bool) ue2_literal::elem c; // string element (char + bool)
size_t index; // managed by ue2_graph size_t index = 0; // managed by ue2_graph
}; };
struct LitGraphEdgeProps { struct LitGraphEdgeProps {
LitGraphEdgeProps() = default; LitGraphEdgeProps() = default;
explicit LitGraphEdgeProps(u64a score_in) : score(score_in) {} explicit LitGraphEdgeProps(u64a score_in) : score(score_in) {}
u64a score = NO_LITERAL_AT_EDGE_SCORE; u64a score = NO_LITERAL_AT_EDGE_SCORE;
size_t index; // managed by ue2_graph size_t index = 0; // managed by ue2_graph
}; };
struct LitGraph struct LitGraph

View File

@ -65,8 +65,8 @@ public:
class EngineHSStream : public EngineStream { class EngineHSStream : public EngineStream {
public: public:
~EngineHSStream(); ~EngineHSStream();
hs_stream_t *id; hs_stream_t *id = nullptr;
EngineHSContext *ctx; EngineHSContext *ctx = nullptr;
}; };
/** Hyperscan Engine for scanning data. */ /** Hyperscan Engine for scanning data. */

View File

@ -62,7 +62,7 @@ public:
struct PcreDB { struct PcreDB {
bool highlander = false; bool highlander = false;
bool utf8 = false; bool utf8 = false;
u32 id; u32 id = 0;
pcre *db = nullptr; pcre *db = nullptr;
pcre_extra *extra = nullptr; pcre_extra *extra = nullptr;
}; };

View File

@ -877,6 +877,7 @@ void displayCsvResults(const vector<unique_ptr<ThreadContext>> &threads,
printf(",\"%0.3f\"", totalSecs); printf(",\"%0.3f\"", totalSecs);
printf(",\"%0.2Lf\"", calc_mbps(totalSecs, totalBytes)); printf(",\"%0.2Lf\"", calc_mbps(totalSecs, totalBytes));
assert(bytesPerRun);
double matchRate = ((double)matchesPerRun * 1024) / bytesPerRun; double matchRate = ((double)matchesPerRun * 1024) / bytesPerRun;
printf(",\"%llu\"", matchesPerRun); printf(",\"%llu\"", matchesPerRun);
printf(",\"%0.3f\"", matchRate); printf(",\"%0.3f\"", matchRate);