Fix a bunch of missing class member initializations

This commit is contained in:
Tim Wojtulewicz 2023-01-14 16:27:46 -07:00
parent 7374688d0d
commit 3b0e8ee6f1
16 changed files with 40 additions and 41 deletions

View file

@ -137,7 +137,7 @@ public:
protected: protected:
Location loc; Location loc;
Stmt* stmt; Stmt* stmt = nullptr;
}; };
extern bool g_policy_debug; // enable debugging facility extern bool g_policy_debug; // enable debugging facility

View file

@ -108,17 +108,17 @@ protected:
// Raises a file_opened event. // Raises a file_opened event.
void RaiseOpenEvent(); void RaiseOpenEvent();
FILE* f; FILE* f = nullptr;
TypePtr t; TypePtr t;
char* name; char* name = nullptr;
char* access; char* access = nullptr;
detail::Attributes* attrs; detail::Attributes* attrs = nullptr;
double open_time; double open_time = 0.0;
bool is_open; // whether the file is open in a general sense bool is_open = false; // whether the file is open in a general sense
bool buffered; bool buffered = false;
bool raw_output; bool raw_output = false;
static const int MIN_BUFFER_SIZE = 1024; static constexpr int MIN_BUFFER_SIZE = 1024;
private: private:
static std::list<std::pair<std::string, File*>> open_files; static std::list<std::pair<std::string, File*>> open_files;

View file

@ -232,7 +232,7 @@ constexpr int NUM_HASH_KEYS = HASH_KEY_STRING + 1;
class HashKey class HashKey
{ {
public: public:
explicit HashKey() { } explicit HashKey() { key_u.u32 = 0; }
explicit HashKey(bool b); explicit HashKey(bool b);
explicit HashKey(int i); explicit HashKey(int i);
explicit HashKey(zeek_int_t bi); explicit HashKey(zeek_int_t bi);

View file

@ -32,7 +32,7 @@ private:
int64_t totalc; /* Total bytes counted */ int64_t totalc; /* Total bytes counted */
int mp; int mp;
int sccfirst; int sccfirst;
unsigned int monte[RT_MONTEN]; unsigned int monte[RT_MONTEN] = {0};
int64_t inmont, mcount; int64_t inmont, mcount;
double cexp, montex, montey, montepi, sccu0, scclast, scct1, scct2, scct3; double cexp, montex, montey, montepi, sccu0, scclast, scct1, scct2, scct3;
}; };

View file

@ -1001,7 +1001,7 @@ public:
R_INIT_RECORD, // field requires a new record R_INIT_RECORD, // field requires a new record
R_INIT_TABLE, // field requires a new table/set R_INIT_TABLE, // field requires a new table/set
R_INIT_VECTOR, // field requires a new vector R_INIT_VECTOR, // field requires a new vector
} init_type; } init_type = R_INIT_NONE;
bool def_coerce = false; // whether coercion's required bool def_coerce = false; // whether coercion's required

View file

@ -725,12 +725,12 @@ protected:
std::vector<bool> managed_fields; std::vector<bool> managed_fields;
// Number of fields in the type. // Number of fields in the type.
int num_fields; int num_fields = 0;
// Number of fields in the type when originally declared. // Number of fields in the type when originally declared.
int num_orig_fields; int num_orig_fields = 0;
type_decl_list* types; type_decl_list* types = nullptr;
std::set<std::string> field_ids; std::set<std::string> field_ids;
}; };

View file

@ -23,13 +23,13 @@ protected:
struct Endpoint struct Endpoint
{ {
u_char buffer[MAX_BUFFER_SIZE]; u_char buffer[MAX_BUFFER_SIZE] = {0};
int buffer_len; int buffer_len = 0;
bool in_hdr; bool in_hdr = false;
int tpflags; int tpflags = 0;
int pkt_length; int pkt_length = 0;
int pkt_cnt; int pkt_cnt = 0;
bool encountered_first_chunk; bool encountered_first_chunk = false;
}; };
bool ProcessData(int len, const u_char* data, bool orig); bool ProcessData(int len, const u_char* data, bool orig);

View file

@ -14,7 +14,6 @@ namespace zeek::analyzer::file
File_Analyzer::File_Analyzer(const char* name, Connection* conn) File_Analyzer::File_Analyzer(const char* name, Connection* conn)
: TCP_ApplicationAnalyzer(name, conn) : TCP_ApplicationAnalyzer(name, conn)
{ {
buffer_len = 0;
} }
void File_Analyzer::DeliverStream(int len, const u_char* data, bool orig) void File_Analyzer::DeliverStream(int len, const u_char* data, bool orig)

View file

@ -27,8 +27,8 @@ protected:
void Identify(); void Identify();
static const int BUFFER_SIZE = 1024; static const int BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE]; char buffer[BUFFER_SIZE] = {0};
int buffer_len; int buffer_len = 0;
std::string file_id_orig; std::string file_id_orig;
std::string file_id_resp; std::string file_id_resp;
}; };

View file

@ -99,15 +99,15 @@ protected:
uint32_t cred_flavor, stamp; uint32_t cred_flavor, stamp;
uint32_t uid, gid; uint32_t uid, gid;
std::vector<int> auxgids; std::vector<int> auxgids;
uint32_t verf_flavor; uint32_t verf_flavor = 0;
u_char* call_buf; // copy of original call buffer u_char* call_buf; // copy of original call buffer
std::string machinename; std::string machinename;
double start_time; double start_time;
double last_time; double last_time;
int rpc_len; // size of the full RPC call, incl. xid and msg_type int rpc_len = 0; // size of the full RPC call, incl. xid and msg_type
int call_n; // size of call buf int call_n = 0; // size of call buf
int header_len; // size of data before the arguments int header_len = 0; // size of data before the arguments
bool valid_call; // whether call was well-formed bool valid_call = true; // whether call was well-formed
ValPtr v; // single (perhaps compound) value corresponding to call ValPtr v; // single (perhaps compound) value corresponding to call
}; };

View file

@ -78,7 +78,7 @@ private:
int64_t offset; int64_t offset;
int pipes[6]; int pipes[6] = {-1};
pid_t childpid; pid_t childpid;
enum IoChannels enum IoChannels

View file

@ -99,7 +99,7 @@ protected:
struct Properties struct Properties
{ {
std::string path; std::string path;
double open_time; double open_time = 0.0;
}; };
/** /**

View file

@ -90,7 +90,7 @@ struct Manager::Stream
WriterMap writers; // Writers indexed by id/path pair. WriterMap writers; // Writers indexed by id/path pair.
bool enable_remote; bool enable_remote = false;
~Stream(); ~Stream();
}; };

View file

@ -168,7 +168,7 @@ private:
* error is 1.04/sqrt(m), so the actual cardinality will be the * error is 1.04/sqrt(m), so the actual cardinality will be the
* estimate +/- 1.04/sqrt(m) with approximately 68% probability. * estimate +/- 1.04/sqrt(m) with approximately 68% probability.
*/ */
uint64_t m; uint64_t m = 0;
/** /**
* These are the actual buckets that are storing an estimate of the * These are the actual buckets that are storing an estimate of the
@ -184,9 +184,9 @@ private:
* buckets that are 0 and this is used in the small error correction. * buckets that are 0 and this is used in the small error correction.
* alpha_m is a multiplicative constant used in the algorithm. * alpha_m is a multiplicative constant used in the algorithm.
*/ */
uint64_t V; uint64_t V = 0;
double alpha_m; double alpha_m = 0.0;
int p; // the log2 of m int p = 0; // the log2 of m
}; };
} // namespace zeek::probabilistic::detail } // namespace zeek::probabilistic::detail

View file

@ -130,8 +130,8 @@ protected:
virtual HasherType Type() const = 0; virtual HasherType Type() const = 0;
private: private:
size_t k; size_t k = 0;
seed_t seed; seed_t seed = {0};
}; };
/** /**

View file

@ -73,7 +73,7 @@ private:
const char* func_name = nullptr; const char* func_name = nullptr;
const ZInst* insts = nullptr; const ZInst* insts = nullptr;
unsigned int ninst; unsigned int ninst = 0;
FrameReMap frame_denizens; FrameReMap frame_denizens;
int frame_size; int frame_size;