mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/timw/nullptr'
* origin/topic/timw/nullptr: The remaining nulls plugin/probabilistic/zeekygen: Replace nulls with nullptr file_analysis: Replace nulls with nullptr analyzer: Replace nulls with nullptr iosource/threading/input/logging: Replace nulls with nullptr
This commit is contained in:
commit
a3a38f0849
187 changed files with 1119 additions and 1117 deletions
6
CHANGES
6
CHANGES
|
@ -1,4 +1,10 @@
|
|||
|
||||
3.2.0-dev.378 | 2020-04-09 08:47:44 -0700
|
||||
|
||||
* Replace most of the uses of 0 or NULL to indicate null pointers with nullptr.
|
||||
This change does not change any calls to syscalls, in the interest of passing
|
||||
what the API for those calls says to pass. (Tim Wojtulewicz, Corelight)
|
||||
|
||||
3.2.0-dev.372 | 2020-04-08 14:00:28 -0700
|
||||
|
||||
* Lazy-initalize some of the fields in Frame to reduce size (Tim Wojtulewicz, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
3.2.0-dev.372
|
||||
3.2.0-dev.378
|
||||
|
|
20
src/Anon.cc
20
src/Anon.cc
|
@ -12,7 +12,7 @@
|
|||
#include "Reporter.h"
|
||||
|
||||
|
||||
AnonymizeIPAddr* ip_anonymizer[NUM_ADDR_ANONYMIZATION_METHODS] = {0};
|
||||
AnonymizeIPAddr* ip_anonymizer[NUM_ADDR_ANONYMIZATION_METHODS] = {nullptr};
|
||||
|
||||
static uint32_t rand32()
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ AnonymizeIPAddr_A50::~AnonymizeIPAddr_A50()
|
|||
|
||||
void AnonymizeIPAddr_A50::init()
|
||||
{
|
||||
root = next_free_node = 0;
|
||||
root = next_free_node = nullptr;
|
||||
|
||||
// Prepare special nodes for 0.0.0.0 and 255.255.255.255.
|
||||
memset(&special_nodes[0], 0, sizeof(special_nodes));
|
||||
|
@ -222,7 +222,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::new_node_block()
|
|||
for ( int i = 1; i < block_size - 1; ++i )
|
||||
block[i].child[0] = &block[i+1];
|
||||
|
||||
block[block_size - 1].child[0] = 0;
|
||||
block[block_size - 1].child[0] = nullptr;
|
||||
next_free_node = &block[1];
|
||||
|
||||
return &block[0];
|
||||
|
@ -276,12 +276,12 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::make_peer(ipaddr32_t a, Node* n)
|
|||
Node* down[2];
|
||||
|
||||
if ( ! (down[0] = new_node()) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( ! (down[1] = new_node()) )
|
||||
{
|
||||
free_node(down[0]);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// swivel is first bit 'a' and 'old->input' differ.
|
||||
|
@ -292,7 +292,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::make_peer(ipaddr32_t a, Node* n)
|
|||
|
||||
down[bitvalue]->input = a;
|
||||
down[bitvalue]->output = make_output(n->output, swivel);
|
||||
down[bitvalue]->child[0] = down[bitvalue]->child[1] = 0;
|
||||
down[bitvalue]->child[0] = down[bitvalue]->child[1] = nullptr;
|
||||
|
||||
*down[1 - bitvalue] = *n; // copy orig node down one level
|
||||
|
||||
|
@ -316,7 +316,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::find_node(ipaddr32_t a)
|
|||
root = new_node();
|
||||
root->input = a;
|
||||
root->output = rand32();
|
||||
root->child[0] = root->child[1] = 0;
|
||||
root->child[0] = root->child[1] = nullptr;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
@ -351,12 +351,12 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::find_node(ipaddr32_t a)
|
|||
}
|
||||
|
||||
reporter->InternalError("out of memory!");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void init_ip_addr_anonymizers()
|
||||
{
|
||||
ip_anonymizer[KEEP_ORIG_ADDR] = 0;
|
||||
ip_anonymizer[KEEP_ORIG_ADDR] = nullptr;
|
||||
ip_anonymizer[SEQUENTIALLY_NUMBERED] = new AnonymizeIPAddr_Seq();
|
||||
ip_anonymizer[RANDOM_MD5] = new AnonymizeIPAddr_RandomMD5();
|
||||
ip_anonymizer[PREFIX_PRESERVING_A50] = new AnonymizeIPAddr_A50();
|
||||
|
@ -365,7 +365,7 @@ void init_ip_addr_anonymizers()
|
|||
|
||||
ipaddr32_t anonymize_ip(ipaddr32_t ip, enum ip_addr_anonymization_class_t cl)
|
||||
{
|
||||
TableVal* preserve_addr = 0;
|
||||
TableVal* preserve_addr = nullptr;
|
||||
AddrVal addr(ip);
|
||||
|
||||
int method = -1;
|
||||
|
|
|
@ -197,7 +197,7 @@ void Attributes::AddAttrs(Attributes* a)
|
|||
Attr* Attributes::FindAttr(attr_tag t) const
|
||||
{
|
||||
if ( ! attrs )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
for ( const auto& a : *attrs )
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ Attr* Attributes::FindAttr(attr_tag t) const
|
|||
return a;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Attributes::RemoveAttr(attr_tag t)
|
||||
|
|
|
@ -55,7 +55,7 @@ int* Base64Converter::InitBase64Table(const string& alphabet)
|
|||
if ( alphabet == default_alphabet && default_table_initialized )
|
||||
return default_base64_table;
|
||||
|
||||
int* base64_table = 0;
|
||||
int* base64_table = nullptr;
|
||||
|
||||
if ( alphabet == default_alphabet )
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ Base64Converter::Base64Converter(Connection* arg_conn, const string& arg_alphabe
|
|||
alphabet = default_alphabet;
|
||||
}
|
||||
|
||||
base64_table = 0;
|
||||
base64_table = nullptr;
|
||||
base64_group_next = 0;
|
||||
base64_padding = base64_after_padding = 0;
|
||||
errored = 0;
|
||||
|
@ -234,7 +234,7 @@ BroString* decode_base64(const BroString* s, const BroString* a, Connection* con
|
|||
{
|
||||
reporter->Error("base64 decoding alphabet is not 64 characters: %s",
|
||||
a->CheckString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int buf_len = int((s->Len() + 3) / 4) * 3 + 1;
|
||||
|
@ -259,7 +259,7 @@ BroString* decode_base64(const BroString* s, const BroString* a, Connection* con
|
|||
|
||||
err:
|
||||
delete [] rbuf;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BroString* encode_base64(const BroString* s, const BroString* a, Connection* conn)
|
||||
|
@ -268,10 +268,10 @@ BroString* encode_base64(const BroString* s, const BroString* a, Connection* con
|
|||
{
|
||||
reporter->Error("base64 alphabet is not 64 characters: %s",
|
||||
a->CheckString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char* outbuf = 0;
|
||||
char* outbuf = nullptr;
|
||||
int outlen = 0;
|
||||
Base64Converter enc(conn, a ? a->CheckString() : "");
|
||||
enc.Encode(s->Len(), (const unsigned char*) s->Bytes(), &outlen, &outbuf);
|
||||
|
|
|
@ -59,5 +59,5 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
BroString* decode_base64(const BroString* s, const BroString* a = 0, Connection* conn = 0);
|
||||
BroString* encode_base64(const BroString* s, const BroString* a = 0, Connection* conn = 0);
|
||||
BroString* decode_base64(const BroString* s, const BroString* a = nullptr, Connection* conn = nullptr);
|
||||
BroString* encode_base64(const BroString* s, const BroString* a = nullptr, Connection* conn = nullptr);
|
||||
|
|
|
@ -284,7 +284,7 @@ BroString* BroString::GetSubstring(int start, int len) const
|
|||
{
|
||||
// This code used to live in zeek.bif's sub_bytes() routine.
|
||||
if ( start < 0 || start > n )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( len < 0 || len > n - start )
|
||||
len = n - start;
|
||||
|
@ -302,7 +302,7 @@ BroString::Vec* BroString::Split(const BroString::IdxVec& indices) const
|
|||
unsigned int i;
|
||||
|
||||
if ( indices.empty() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// Copy input, ensuring space for "0":
|
||||
IdxVec idx(1 + indices.size());
|
||||
|
@ -343,7 +343,7 @@ VectorVal* BroString:: VecToPolicy(Vec* vec)
|
|||
VectorVal* result =
|
||||
new VectorVal(internal_type("string_vec")->AsVectorType());
|
||||
if ( ! result )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
for ( unsigned int i = 0; i < vec->size(); ++i )
|
||||
{
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
//
|
||||
// Note that you need to delete[] the resulting string.
|
||||
//
|
||||
char* Render(int format = EXPANDED_STRING, int* len = 0) const;
|
||||
char* Render(int format = EXPANDED_STRING, int* len = nullptr) const;
|
||||
|
||||
// Similar to the above, but useful for output streams.
|
||||
// Also more useful for debugging purposes since no deallocation
|
||||
|
|
|
@ -76,7 +76,7 @@ bool Brofiler::ReadStats()
|
|||
|
||||
pair<string, string> location_desc(std::move(location), std::move(desc));
|
||||
uint64_t count;
|
||||
atoi_n(cnt.size(), cnt.c_str(), 0, 10, count);
|
||||
atoi_n(cnt.size(), cnt.c_str(), nullptr, 10, count);
|
||||
usage_map.emplace(std::move(location_desc), count);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,19 +47,19 @@ CompositeHash::CompositeHash(IntrusivePtr<TypeList> composite_type)
|
|||
// via the singleton later.
|
||||
singleton_tag = (*type->Types())[0]->InternalType();
|
||||
size = 0;
|
||||
key = 0;
|
||||
key = nullptr;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
size = ComputeKeySize(0, true, true);
|
||||
size = ComputeKeySize(nullptr, true, true);
|
||||
|
||||
if ( size > 0 )
|
||||
// Fixed size. Make sure what we get is fully aligned.
|
||||
key = reinterpret_cast<char*>
|
||||
(new double[size/sizeof(double) + 1]);
|
||||
else
|
||||
key = 0;
|
||||
key = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ CompositeHash::~CompositeHash()
|
|||
char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||
BroType* bt, Val* v, bool optional) const
|
||||
{
|
||||
char* kp1 = 0;
|
||||
char* kp1 = nullptr;
|
||||
InternalTypeTag t = bt->InternalType();
|
||||
|
||||
if ( optional )
|
||||
|
@ -90,7 +90,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
{
|
||||
InternalTypeTag vt = v->Type()->InternalType();
|
||||
if ( vt != t )
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch ( t ) {
|
||||
|
@ -186,12 +186,12 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
bool optional = (a && a->FindAttr(ATTR_OPTIONAL));
|
||||
|
||||
if ( ! (rv_i || optional) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( ! (kp = SingleValHash(type_check, kp,
|
||||
rt->FieldType(i),
|
||||
rv_i, optional)) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
kp1 = kp;
|
||||
|
@ -242,7 +242,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
|
||||
if ( ! (kp1 = SingleValHash(type_check, kp1, key->Type(), key,
|
||||
false)) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( ! v->Type()->IsSet() )
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
|
||||
if ( ! (kp1 = SingleValHash(type_check, kp1, val->Type(),
|
||||
val.get(), false)) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
{
|
||||
if ( ! (kp1 = SingleValHash(type_check, kp1,
|
||||
vt->YieldType(), val, false)) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
Val* v = lv->Index(i);
|
||||
if ( ! (kp1 = SingleValHash(type_check, kp1, v->Type(), v,
|
||||
false)) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -303,7 +303,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
default:
|
||||
{
|
||||
reporter->InternalError("bad index type in CompositeHash::SingleValHash");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
|||
break;
|
||||
|
||||
case TYPE_INTERNAL_ERROR:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return kp1;
|
||||
|
@ -361,7 +361,7 @@ HashKey* CompositeHash::ComputeHash(const Val* v, bool type_check) const
|
|||
{
|
||||
int sz = ComputeKeySize(v, type_check, false);
|
||||
if ( sz == 0 )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
k = reinterpret_cast<char*>(new double[sz/sizeof(double) + 1]);
|
||||
type_check = false; // no need to type-check again.
|
||||
|
@ -370,18 +370,18 @@ HashKey* CompositeHash::ComputeHash(const Val* v, bool type_check) const
|
|||
const type_list* tl = type->Types();
|
||||
|
||||
if ( type_check && v->Type()->Tag() != TYPE_LIST )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
const val_list* vl = v->AsListVal()->Vals();
|
||||
if ( type_check && vl->length() != tl->length() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
char* kp = k;
|
||||
loop_over_list(*tl, i)
|
||||
{
|
||||
kp = SingleValHash(type_check, kp, (*tl)[i], (*vl)[i], false);
|
||||
if ( ! kp )
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new HashKey((k == key), (void*) k, kp - k);
|
||||
|
@ -393,13 +393,13 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, bool type_check) cons
|
|||
{
|
||||
const val_list* vl = v->AsListVal()->Vals();
|
||||
if ( type_check && vl->length() != 1 )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
v = (*vl)[0];
|
||||
}
|
||||
|
||||
if ( type_check && v->Type()->InternalType() != singleton_tag )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
switch ( singleton_tag ) {
|
||||
case TYPE_INTERNAL_INT:
|
||||
|
@ -434,17 +434,17 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, bool type_check) cons
|
|||
}
|
||||
|
||||
reporter->InternalError("bad index type in CompositeHash::ComputeSingletonHash");
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
case TYPE_INTERNAL_STRING:
|
||||
return new HashKey(v->AsString());
|
||||
|
||||
case TYPE_INTERNAL_ERROR:
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
default:
|
||||
reporter->InternalError("bad internal type in CompositeHash::ComputeSingletonHash");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
|||
|
||||
case TYPE_RECORD:
|
||||
{
|
||||
const RecordVal* rv = v ? v->AsRecordVal() : 0;
|
||||
const RecordVal* rv = v ? v->AsRecordVal() : nullptr;
|
||||
RecordType* rt = bt->AsRecordType();
|
||||
int num_fields = rt->NumFields();
|
||||
|
||||
|
@ -517,7 +517,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
|||
bool optional = (a && a->FindAttr(ATTR_OPTIONAL));
|
||||
|
||||
sz = SingleTypeKeySize(rt->FieldType(i),
|
||||
rv ? rv->Lookup(i) : 0,
|
||||
rv ? rv->Lookup(i) : nullptr,
|
||||
type_check, sz, optional,
|
||||
calc_static_size);
|
||||
if ( ! sz )
|
||||
|
@ -632,7 +632,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
|||
int CompositeHash::ComputeKeySize(const Val* v, bool type_check, bool calc_static_size) const
|
||||
{
|
||||
const type_list* tl = type->Types();
|
||||
const val_list* vl = 0;
|
||||
const val_list* vl = nullptr;
|
||||
if ( v )
|
||||
{
|
||||
if ( type_check && v->Type()->Tag() != TYPE_LIST )
|
||||
|
@ -646,7 +646,7 @@ int CompositeHash::ComputeKeySize(const Val* v, bool type_check, bool calc_stati
|
|||
int sz = 0;
|
||||
loop_over_list(*tl, i)
|
||||
{
|
||||
sz = SingleTypeKeySize((*tl)[i], v ? v->AsListVal()->Index(i) : 0,
|
||||
sz = SingleTypeKeySize((*tl)[i], v ? v->AsListVal()->Index(i) : nullptr,
|
||||
type_check, sz, false, calc_static_size);
|
||||
if ( ! sz )
|
||||
return 0;
|
||||
|
@ -745,7 +745,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
|
||||
TypeTag tag = t->Tag();
|
||||
InternalTypeTag it = t->InternalType();
|
||||
const char* kp1 = 0;
|
||||
const char* kp1 = nullptr;
|
||||
|
||||
if ( optional )
|
||||
{
|
||||
|
|
20
src/Conn.cc
20
src/Conn.cc
|
@ -120,7 +120,7 @@ Connection::Connection(NetSessions* s, const ConnIDKey& k, double t, const ConnI
|
|||
if ( arg_encap )
|
||||
encapsulation = new EncapsulationStack(*arg_encap);
|
||||
else
|
||||
encapsulation = 0;
|
||||
encapsulation = nullptr;
|
||||
}
|
||||
|
||||
Connection::~Connection()
|
||||
|
@ -132,7 +132,7 @@ Connection::~Connection()
|
|||
|
||||
if ( conn_val )
|
||||
{
|
||||
conn_val->SetOrigin(0);
|
||||
conn_val->SetOrigin(nullptr);
|
||||
Unref(conn_val);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ void Connection::CheckEncapsulation(const EncapsulationStack* arg_encap)
|
|||
{
|
||||
if ( *encapsulation != *arg_encap )
|
||||
{
|
||||
Event(tunnel_changed, 0, arg_encap->GetVectorVal());
|
||||
Event(tunnel_changed, nullptr, arg_encap->GetVectorVal());
|
||||
delete encapsulation;
|
||||
encapsulation = new EncapsulationStack(*arg_encap);
|
||||
}
|
||||
|
@ -157,14 +157,14 @@ void Connection::CheckEncapsulation(const EncapsulationStack* arg_encap)
|
|||
else if ( encapsulation )
|
||||
{
|
||||
EncapsulationStack empty;
|
||||
Event(tunnel_changed, 0, empty.GetVectorVal());
|
||||
Event(tunnel_changed, nullptr, empty.GetVectorVal());
|
||||
delete encapsulation;
|
||||
encapsulation = nullptr;
|
||||
}
|
||||
|
||||
else if ( arg_encap )
|
||||
{
|
||||
Event(tunnel_changed, 0, arg_encap->GetVectorVal());
|
||||
Event(tunnel_changed, nullptr, arg_encap->GetVectorVal());
|
||||
encapsulation = new EncapsulationStack(*arg_encap);
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ void Connection::HistoryThresholdEvent(EventHandlerPtr e, bool is_orig,
|
|||
void Connection::DeleteTimer(double /* t */)
|
||||
{
|
||||
if ( is_active )
|
||||
Event(connection_timeout, 0);
|
||||
Event(connection_timeout, nullptr);
|
||||
|
||||
sessions->Remove(this);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ void Connection::InactivityTimer(double t)
|
|||
{
|
||||
if ( last_time + inactivity_timeout <= t )
|
||||
{
|
||||
Event(connection_timeout, 0);
|
||||
Event(connection_timeout, nullptr);
|
||||
sessions->Remove(this);
|
||||
++killed_by_inactivity;
|
||||
}
|
||||
|
@ -402,12 +402,12 @@ RecordVal* Connection::BuildConnVal()
|
|||
|
||||
analyzer::Analyzer* Connection::FindAnalyzer(analyzer::ID id)
|
||||
{
|
||||
return root_analyzer ? root_analyzer->FindChild(id) : 0;
|
||||
return root_analyzer ? root_analyzer->FindChild(id) : nullptr;
|
||||
}
|
||||
|
||||
analyzer::Analyzer* Connection::FindAnalyzer(const analyzer::Tag& tag)
|
||||
{
|
||||
return root_analyzer ? root_analyzer->FindChild(tag) : 0;
|
||||
return root_analyzer ? root_analyzer->FindChild(tag) : nullptr;
|
||||
}
|
||||
|
||||
analyzer::Analyzer* Connection::FindAnalyzer(const char* name)
|
||||
|
@ -696,7 +696,7 @@ void Connection::CheckFlowLabel(bool is_orig, uint32_t flow_label)
|
|||
if ( connection_flow_label_changed &&
|
||||
(is_orig ? saw_first_orig_packet : saw_first_resp_packet) )
|
||||
{
|
||||
EnqueueEvent(connection_flow_label_changed, 0,
|
||||
EnqueueEvent(connection_flow_label_changed, nullptr,
|
||||
IntrusivePtr{AdoptRef{}, BuildConnVal()},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetBool(is_orig)},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(my_flow_label)},
|
||||
|
|
|
@ -180,13 +180,13 @@ public:
|
|||
// given that event's first argument will be it, and it's second will be
|
||||
// the connection value. If 'name' is null, then the event's first
|
||||
// argument is the connection value.
|
||||
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, const char* name = 0);
|
||||
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, const char* name = nullptr);
|
||||
|
||||
// If a handler exists for 'f', an event will be generated. In any case,
|
||||
// 'v1' and 'v2' reference counts get decremented. The event's first
|
||||
// argument is the connection value, second argument is 'v1', and if 'v2'
|
||||
// is given that will be it's third argument.
|
||||
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, Val* v1, Val* v2 = 0);
|
||||
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, Val* v1, Val* v2 = nullptr);
|
||||
|
||||
// If a handler exists for 'f', an event will be generated. In any case,
|
||||
// reference count for each element in the 'vl' list are decremented. The
|
||||
|
|
10
src/DFA.cc
10
src/DFA.cc
|
@ -17,7 +17,7 @@ DFA_State::DFA_State(int arg_state_num, const EquivClass* ec,
|
|||
num_sym = ec->NumClasses();
|
||||
nfa_states = arg_nfa_states;
|
||||
accept = arg_accept;
|
||||
mark = 0;
|
||||
mark = nullptr;
|
||||
|
||||
SymPartition(ec);
|
||||
|
||||
|
@ -96,7 +96,7 @@ DFA_State* DFA_State::ComputeXtion(int sym, DFA_Machine* machine)
|
|||
else
|
||||
{
|
||||
delete ns;
|
||||
next_d = 0; // Jam
|
||||
next_d = nullptr; // Jam
|
||||
}
|
||||
|
||||
AddXtion(equiv_sym, next_d);
|
||||
|
@ -182,7 +182,7 @@ void DFA_State::ClearMarks()
|
|||
{
|
||||
if ( mark )
|
||||
{
|
||||
SetMark(0);
|
||||
SetMark(nullptr);
|
||||
|
||||
for ( int i = 0; i < num_sym; ++i )
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ DFA_Machine::DFA_Machine(NFA_Machine* n, EquivClass* arg_ec)
|
|||
}
|
||||
else
|
||||
{
|
||||
start_state = 0; // Jam
|
||||
start_state = nullptr; // Jam
|
||||
delete ns;
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ bool DFA_Machine::StateSetToDFA_State(NFA_state_list* state_set,
|
|||
if ( accept->empty() )
|
||||
{
|
||||
delete accept;
|
||||
accept = 0;
|
||||
accept = nullptr;
|
||||
}
|
||||
|
||||
DFA_State* ds = new DFA_State(state_count++, ec, state_set, accept);
|
||||
|
|
|
@ -194,7 +194,7 @@ DNS_Mapping::DNS_Mapping(const IPAddr& addr, struct hostent* h, uint32_t ttl)
|
|||
{
|
||||
Init(h);
|
||||
req_addr = addr;
|
||||
req_host = 0;
|
||||
req_host = nullptr;
|
||||
req_ttl = ttl;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ DNS_Mapping::DNS_Mapping(FILE* f)
|
|||
Clear();
|
||||
init_failed = true;
|
||||
|
||||
req_host = 0;
|
||||
req_host = nullptr;
|
||||
req_ttl = 0;
|
||||
creation_time = 0;
|
||||
|
||||
|
@ -255,7 +255,7 @@ DNS_Mapping::DNS_Mapping(FILE* f)
|
|||
}
|
||||
}
|
||||
else
|
||||
addrs = 0;
|
||||
addrs = nullptr;
|
||||
|
||||
init_failed = false;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ IntrusivePtr<TableVal> DNS_Mapping::AddrsSet() {
|
|||
IntrusivePtr<StringVal> DNS_Mapping::Host()
|
||||
{
|
||||
if ( failed || num_names == 0 || ! names[0] )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( ! host_val )
|
||||
host_val = make_intrusive<StringVal>(names[0]);
|
||||
|
@ -315,8 +315,8 @@ void DNS_Mapping::Init(struct hostent* h)
|
|||
no_mapping = false;
|
||||
init_failed = false;
|
||||
creation_time = current_time();
|
||||
host_val = 0;
|
||||
addrs_val = 0;
|
||||
host_val = nullptr;
|
||||
addrs_val = nullptr;
|
||||
|
||||
if ( ! h )
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ void DNS_Mapping::Init(struct hostent* h)
|
|||
map_type = h->h_addrtype;
|
||||
num_names = 1; // for now, just use official name
|
||||
names = new char*[num_names];
|
||||
names[0] = h->h_name ? copy_string(h->h_name) : 0;
|
||||
names[0] = h->h_name ? copy_string(h->h_name) : nullptr;
|
||||
|
||||
for ( num_addrs = 0; h->h_addr_list[num_addrs]; ++num_addrs )
|
||||
;
|
||||
|
@ -344,7 +344,7 @@ void DNS_Mapping::Init(struct hostent* h)
|
|||
IPAddr::Network);
|
||||
}
|
||||
else
|
||||
addrs = 0;
|
||||
addrs = nullptr;
|
||||
|
||||
failed = false;
|
||||
}
|
||||
|
@ -352,10 +352,10 @@ void DNS_Mapping::Init(struct hostent* h)
|
|||
void DNS_Mapping::Clear()
|
||||
{
|
||||
num_names = num_addrs = 0;
|
||||
names = 0;
|
||||
addrs = 0;
|
||||
host_val = 0;
|
||||
addrs_val = 0;
|
||||
names = nullptr;
|
||||
addrs = nullptr;
|
||||
host_val = nullptr;
|
||||
addrs_val = nullptr;
|
||||
no_mapping = false;
|
||||
map_type = 0;
|
||||
failed = true;
|
||||
|
@ -363,7 +363,7 @@ void DNS_Mapping::Clear()
|
|||
|
||||
void DNS_Mapping::Save(FILE* f) const
|
||||
{
|
||||
fprintf(f, "%.0f %d %s %d %s %d %d %" PRIu32"\n", creation_time, req_host != 0,
|
||||
fprintf(f, "%.0f %d %s %d %s %d %d %" PRIu32"\n", creation_time, req_host != nullptr,
|
||||
req_host ? req_host : req_addr.AsString().c_str(),
|
||||
failed, (names && names[0]) ? names[0] : "*",
|
||||
map_type, num_addrs, req_ttl);
|
||||
|
@ -381,11 +381,11 @@ DNS_Mgr::DNS_Mgr(DNS_MgrMode arg_mode)
|
|||
|
||||
dns_mapping_valid = dns_mapping_unverified = dns_mapping_new_name =
|
||||
dns_mapping_lost_name = dns_mapping_name_changed =
|
||||
dns_mapping_altered = 0;
|
||||
dns_mapping_altered = nullptr;
|
||||
|
||||
dm_rec = 0;
|
||||
dm_rec = nullptr;
|
||||
|
||||
cache_name = dir = 0;
|
||||
cache_name = dir = nullptr;
|
||||
|
||||
asyncs_pending = 0;
|
||||
num_requests = 0;
|
||||
|
@ -540,7 +540,7 @@ IntrusivePtr<TableVal> DNS_Mgr::LookupHost(const char* name)
|
|||
|
||||
case DNS_FORCE:
|
||||
reporter->FatalError("can't find DNS entry for %s in cache", name);
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
case DNS_DEFAULT:
|
||||
requests.push_back(new DNS_Mgr_Request(name, AF_INET, false));
|
||||
|
@ -550,7 +550,7 @@ IntrusivePtr<TableVal> DNS_Mgr::LookupHost(const char* name)
|
|||
|
||||
default:
|
||||
reporter->InternalError("bad mode in DNS_Mgr::LookupHost");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ IntrusivePtr<Val> DNS_Mgr::LookupAddr(const IPAddr& addr)
|
|||
case DNS_FORCE:
|
||||
reporter->FatalError("can't find DNS entry for %s in cache",
|
||||
addr.AsString().c_str());
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
case DNS_DEFAULT:
|
||||
requests.push_back(new DNS_Mgr_Request(addr));
|
||||
|
@ -594,7 +594,7 @@ IntrusivePtr<Val> DNS_Mgr::LookupAddr(const IPAddr& addr)
|
|||
|
||||
default:
|
||||
reporter->InternalError("bad mode in DNS_Mgr::LookupAddr");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,7 @@ void DNS_Mgr::Resolve()
|
|||
DNS_Mgr_Request* dr = requests[i];
|
||||
if ( dr->RequestPending() )
|
||||
{
|
||||
AddResult(dr, 0);
|
||||
AddResult(dr, nullptr);
|
||||
dr->RequestDone();
|
||||
}
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ IntrusivePtr<Val> DNS_Mgr::BuildMappingVal(DNS_Mapping* dm)
|
|||
|
||||
void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
|
||||
{
|
||||
struct hostent* h = (r && r->host_errno == 0) ? r->hostent : 0;
|
||||
struct hostent* h = (r && r->host_errno == 0) ? r->hostent : nullptr;
|
||||
u_int32_t ttl = (r && r->host_errno == 0) ? r->ttl : 0;
|
||||
|
||||
DNS_Mapping* new_dm;
|
||||
|
@ -758,7 +758,7 @@ void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
|
|||
if ( dr->ReqHost() )
|
||||
{
|
||||
new_dm = new DNS_Mapping(dr->ReqHost(), h, ttl);
|
||||
prev_dm = 0;
|
||||
prev_dm = nullptr;
|
||||
|
||||
if ( dr->ReqIsTxt() )
|
||||
{
|
||||
|
@ -784,10 +784,10 @@ void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
|
|||
if ( it == host_mappings.end() )
|
||||
{
|
||||
host_mappings[dr->ReqHost()].first =
|
||||
new_dm->Type() == AF_INET ? new_dm : 0;
|
||||
new_dm->Type() == AF_INET ? new_dm : nullptr;
|
||||
|
||||
host_mappings[dr->ReqHost()].second =
|
||||
new_dm->Type() == AF_INET ? 0 : new_dm;
|
||||
new_dm->Type() == AF_INET ? nullptr : new_dm;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -980,7 +980,7 @@ const char* DNS_Mgr::LookupAddrInCache(const IPAddr& addr)
|
|||
AddrMap::iterator it = addr_mappings.find(addr);
|
||||
|
||||
if ( it == addr_mappings.end() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
DNS_Mapping* d = it->second;
|
||||
|
||||
|
@ -988,7 +988,7 @@ const char* DNS_Mgr::LookupAddrInCache(const IPAddr& addr)
|
|||
{
|
||||
addr_mappings.erase(it);
|
||||
delete d;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The escapes in the following strings are to avoid having it
|
||||
|
@ -1002,21 +1002,21 @@ IntrusivePtr<TableVal> DNS_Mgr::LookupNameInCache(const string& name)
|
|||
if ( it == host_mappings.end() )
|
||||
{
|
||||
it = host_mappings.begin();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DNS_Mapping* d4 = it->second.first;
|
||||
DNS_Mapping* d6 = it->second.second;
|
||||
|
||||
if ( ! d4 || ! d4->names || ! d6 || ! d6->names )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( d4->Expired() || d6->Expired() )
|
||||
{
|
||||
host_mappings.erase(it);
|
||||
delete d4;
|
||||
delete d6;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto tv4 = d4->AddrsSet();
|
||||
|
@ -1029,7 +1029,7 @@ const char* DNS_Mgr::LookupTextInCache(const string& name)
|
|||
{
|
||||
TextMap::iterator it = text_mappings.find(name);
|
||||
if ( it == text_mappings.end() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
DNS_Mapping* d = it->second;
|
||||
|
||||
|
@ -1037,7 +1037,7 @@ const char* DNS_Mgr::LookupTextInCache(const string& name)
|
|||
{
|
||||
text_mappings.erase(it);
|
||||
delete d;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The escapes in the following strings are to avoid having it
|
||||
|
@ -1077,7 +1077,7 @@ void DNS_Mgr::AsyncLookupAddr(const IPAddr& host, LookupCallback* callback)
|
|||
return;
|
||||
}
|
||||
|
||||
AsyncRequest* req = 0;
|
||||
AsyncRequest* req = nullptr;
|
||||
|
||||
// Have we already a request waiting for this host?
|
||||
AsyncRequestAddrMap::iterator i = asyncs_addrs.find(host);
|
||||
|
@ -1115,7 +1115,7 @@ void DNS_Mgr::AsyncLookupName(const string& name, LookupCallback* callback)
|
|||
return;
|
||||
}
|
||||
|
||||
AsyncRequest* req = 0;
|
||||
AsyncRequest* req = nullptr;
|
||||
|
||||
// Have we already a request waiting for this host?
|
||||
AsyncRequestNameMap::iterator i = asyncs_names.find(name);
|
||||
|
@ -1154,7 +1154,7 @@ void DNS_Mgr::AsyncLookupNameText(const string& name, LookupCallback* callback)
|
|||
return;
|
||||
}
|
||||
|
||||
AsyncRequest* req = 0;
|
||||
AsyncRequest* req = nullptr;
|
||||
|
||||
// Have we already a request waiting for this host?
|
||||
AsyncRequestTextMap::iterator i = asyncs_texts.find(name);
|
||||
|
|
|
@ -49,13 +49,13 @@ DbgBreakpoint::DbgBreakpoint()
|
|||
enabled = temporary = false;
|
||||
BPID = -1;
|
||||
|
||||
at_stmt = 0;
|
||||
at_stmt = nullptr;
|
||||
at_time = -1.0;
|
||||
|
||||
repeat_count = hit_count = 0;
|
||||
|
||||
description[0] = 0;
|
||||
source_filename = 0;
|
||||
source_filename = nullptr;
|
||||
source_line = 0;
|
||||
}
|
||||
|
||||
|
|
30
src/Debug.cc
30
src/Debug.cc
|
@ -55,7 +55,7 @@ DebuggerState::DebuggerState()
|
|||
BreakFromSignal(false);
|
||||
|
||||
// ### Don't choose this arbitrary size! Extend Frame.
|
||||
dbg_locals = new Frame(1024, /* func = */ 0, /* fn_args = */ 0);
|
||||
dbg_locals = new Frame(1024, /* func = */ nullptr, /* fn_args = */ nullptr);
|
||||
}
|
||||
|
||||
DebuggerState::~DebuggerState()
|
||||
|
@ -107,7 +107,7 @@ FILE* TraceState::SetTraceFile(const char* filename)
|
|||
else
|
||||
{
|
||||
fprintf(stderr, "Unable to open trace file %s\n", filename);
|
||||
trace_file = 0;
|
||||
trace_file = nullptr;
|
||||
}
|
||||
|
||||
return oldfile;
|
||||
|
@ -137,7 +137,7 @@ int TraceState::LogTrace(const char* fmt, ...)
|
|||
|
||||
const Stmt* stmt;
|
||||
Location loc;
|
||||
loc.filename = 0;
|
||||
loc.filename = nullptr;
|
||||
|
||||
if ( g_frame_stack.size() > 0 && g_frame_stack.back() )
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ void get_first_statement(Stmt* list, Stmt*& first, Location& loc)
|
|||
{
|
||||
if ( ! list )
|
||||
{
|
||||
first = 0;
|
||||
first = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ static void parse_function_name(vector<ParseLocationRec>& result,
|
|||
return;
|
||||
}
|
||||
|
||||
Stmt* body = 0; // the particular body we care about; 0 = all
|
||||
Stmt* body = nullptr; // the particular body we care about; 0 = all
|
||||
|
||||
if ( bodies.size() == 1 )
|
||||
body = bodies[0].stmts.get();
|
||||
|
@ -380,7 +380,7 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
|||
return result;
|
||||
}
|
||||
|
||||
StmtLocMapping* hit = 0;
|
||||
StmtLocMapping* hit = nullptr;
|
||||
for ( const auto entry : *(iter->second) )
|
||||
{
|
||||
plr.filename = entry->Loc().filename;
|
||||
|
@ -399,7 +399,7 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
|||
if ( hit )
|
||||
plr.stmt = hit->Statement();
|
||||
else
|
||||
plr.stmt = 0;
|
||||
plr.stmt = nullptr;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -730,7 +730,7 @@ static char* get_prompt(bool reset_counter = false)
|
|||
string get_context_description(const Stmt* stmt, const Frame* frame)
|
||||
{
|
||||
ODesc d;
|
||||
const BroFunc* func = frame ? frame->GetFunction() : 0;
|
||||
const BroFunc* func = frame ? frame->GetFunction() : nullptr;
|
||||
|
||||
if ( func )
|
||||
func->DescribeDebug(&d, frame->GetFuncArgs());
|
||||
|
@ -758,7 +758,7 @@ string get_context_description(const Stmt* stmt, const Frame* frame)
|
|||
|
||||
int dbg_handle_debug_input()
|
||||
{
|
||||
static char* input_line = 0;
|
||||
static char* input_line = nullptr;
|
||||
int status = 0;
|
||||
|
||||
if ( g_debugger_state.BreakFromSignal() )
|
||||
|
@ -820,7 +820,7 @@ int dbg_handle_debug_input()
|
|||
if ( input_line )
|
||||
{
|
||||
free(input_line); // this was malloc'ed
|
||||
input_line = 0;
|
||||
input_line = nullptr;
|
||||
}
|
||||
else
|
||||
exit(0);
|
||||
|
@ -934,8 +934,8 @@ bool post_execute_stmt(Stmt* stmt, Frame* f, Val* result, stmt_flow_type* flow)
|
|||
|
||||
// Evaluates the given expression in the context of the currently selected
|
||||
// frame. Returns the resulting value, or nil if none (or there was an error).
|
||||
Expr* g_curr_debug_expr = 0;
|
||||
const char* g_curr_debug_error = 0;
|
||||
Expr* g_curr_debug_expr = nullptr;
|
||||
const char* g_curr_debug_error = nullptr;
|
||||
bool in_debug = false;
|
||||
|
||||
// ### fix this hardwired access to external variables etc.
|
||||
|
@ -993,7 +993,7 @@ IntrusivePtr<Val> dbg_eval_expr(const char* expr)
|
|||
if ( g_curr_debug_expr )
|
||||
{
|
||||
delete g_curr_debug_expr;
|
||||
g_curr_debug_expr = 0;
|
||||
g_curr_debug_expr = nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1003,9 +1003,9 @@ IntrusivePtr<Val> dbg_eval_expr(const char* expr)
|
|||
pop_scope();
|
||||
|
||||
delete g_curr_debug_expr;
|
||||
g_curr_debug_expr = 0;
|
||||
g_curr_debug_expr = nullptr;
|
||||
delete [] g_curr_debug_error;
|
||||
g_curr_debug_error = 0;
|
||||
g_curr_debug_error = nullptr;
|
||||
in_debug = false;
|
||||
|
||||
return result;
|
||||
|
|
|
@ -149,7 +149,7 @@ bool post_execute_stmt(Stmt* stmt, Frame* f, Val* result, stmt_flow_type* flow);
|
|||
// Returns 1 if successful, 0 otherwise.
|
||||
// If cmdfile is non-nil, it contains the location of a file of commands
|
||||
// to be executed as debug commands.
|
||||
int dbg_init_debugger(const char* cmdfile = 0);
|
||||
int dbg_init_debugger(const char* cmdfile = nullptr);
|
||||
int dbg_shutdown_debugger();
|
||||
|
||||
// Returns 1 if successful, 0 otherwise.
|
||||
|
|
|
@ -125,7 +125,7 @@ void choose_global_symbols_regex(const string& regex, vector<ID*>& choices,
|
|||
PQueue<DebugCmdInfo> g_DebugCmdInfos;
|
||||
|
||||
DebugCmdInfo::DebugCmdInfo(const DebugCmdInfo& info)
|
||||
: cmd(info.cmd), helpstring(0)
|
||||
: cmd(info.cmd), helpstring(nullptr)
|
||||
{
|
||||
num_names = info.num_names;
|
||||
names = info.names;
|
||||
|
@ -153,7 +153,7 @@ const DebugCmdInfo* get_debug_cmd_info(DebugCmd cmd)
|
|||
if ( (int) cmd < g_DebugCmdInfos.length() )
|
||||
return g_DebugCmdInfos[(int) cmd];
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int find_all_matching_cmds(const string& prefix, const char* array_of_matches[])
|
||||
|
@ -165,7 +165,7 @@ int find_all_matching_cmds(const string& prefix, const char* array_of_matches[])
|
|||
|
||||
for ( int i = 0; i < num_debug_cmds(); ++i )
|
||||
{
|
||||
array_of_matches[g_DebugCmdInfos[i]->Cmd()] = 0;
|
||||
array_of_matches[g_DebugCmdInfos[i]->Cmd()] = nullptr;
|
||||
|
||||
for ( int j = 0; j < g_DebugCmdInfos[i]->NumNames(); ++j )
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ int find_all_matching_cmds(const string& prefix, const char* array_of_matches[])
|
|||
if ( ! prefix.compare(curr_name) )
|
||||
{
|
||||
for ( int k = 0; k < num_debug_cmds(); ++k )
|
||||
array_of_matches[k] = 0;
|
||||
array_of_matches[k] = nullptr;
|
||||
|
||||
array_of_matches[g_DebugCmdInfos[i]->Cmd()] = curr_name;
|
||||
return 1;
|
||||
|
@ -214,7 +214,7 @@ static int dbg_backtrace_internal(int start, int end)
|
|||
for ( int i = start; i >= end; --i )
|
||||
{
|
||||
const Frame* f = g_frame_stack[i];
|
||||
const Stmt* stmt = f ? f->GetNextStmt() : 0;
|
||||
const Stmt* stmt = f ? f->GetNextStmt() : nullptr;
|
||||
|
||||
string context = get_context_description(stmt, f);
|
||||
debug_msg("#%d %s\n",
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
bool resume_execution, const char* const helpstring,
|
||||
bool repeatable);
|
||||
|
||||
DebugCmdInfo() : helpstring(0) {}
|
||||
DebugCmdInfo() : helpstring(nullptr) {}
|
||||
|
||||
int Cmd() const { return cmd; }
|
||||
int NumNames() const { return num_names; }
|
||||
|
|
|
@ -26,7 +26,7 @@ DebugLogger::Stream DebugLogger::streams[NUM_DBGS] = {
|
|||
DebugLogger::DebugLogger()
|
||||
{
|
||||
verbose = false;
|
||||
file = 0;
|
||||
file = nullptr;
|
||||
}
|
||||
|
||||
DebugLogger::~DebugLogger()
|
||||
|
|
|
@ -21,7 +21,7 @@ ODesc::ODesc(desc_type t, BroFile* arg_f)
|
|||
style = STANDARD_STYLE;
|
||||
f = arg_f;
|
||||
|
||||
if ( f == 0 )
|
||||
if ( f == nullptr )
|
||||
{
|
||||
size = DEFAULT_SIZE;
|
||||
base = safe_malloc(size);
|
||||
|
@ -31,7 +31,7 @@ ODesc::ODesc(desc_type t, BroFile* arg_f)
|
|||
else
|
||||
{
|
||||
offset = size = 0;
|
||||
base = 0;
|
||||
base = nullptr;
|
||||
}
|
||||
|
||||
indent_level = 0;
|
||||
|
|
|
@ -29,7 +29,7 @@ class BroType;
|
|||
|
||||
class ODesc {
|
||||
public:
|
||||
explicit ODesc(desc_type t=DESC_READABLE, BroFile* f=0);
|
||||
explicit ODesc(desc_type t=DESC_READABLE, BroFile* f=nullptr);
|
||||
|
||||
~ODesc();
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
byte_vec TakeBytes()
|
||||
{
|
||||
const void* t = base;
|
||||
base = 0;
|
||||
base = nullptr;
|
||||
size = 0;
|
||||
|
||||
// Don't clear offset, as we want to still support
|
||||
|
|
30
src/Dict.cc
30
src/Dict.cc
|
@ -81,7 +81,7 @@ TEST_CASE("dict operation")
|
|||
dict.Remove(key2);
|
||||
CHECK(dict.Length() == 0);
|
||||
uint32_t* lookup2 = dict.Lookup(key2);
|
||||
CHECK(lookup2 == (uint32_t*)0);
|
||||
CHECK(lookup2 == (uint32_t*)nullptr);
|
||||
delete key2;
|
||||
|
||||
CHECK(dict.MaxLength() == 1);
|
||||
|
@ -132,7 +132,7 @@ TEST_CASE("dict nthentry")
|
|||
|
||||
// NthEntry returns null for unordered dicts
|
||||
uint32_t* lookup = unordered.NthEntry(0);
|
||||
CHECK(lookup == (uint32_t*)0);
|
||||
CHECK(lookup == (uint32_t*)nullptr);
|
||||
|
||||
// Ordered dicts are based on order of insertion, nothing about the
|
||||
// data itself
|
||||
|
@ -256,7 +256,7 @@ void Dictionary::DeInit()
|
|||
void* Dictionary::Lookup(const void* key, int key_size, hash_t hash) const
|
||||
{
|
||||
if ( ! tbl && ! tbl2 )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
hash_t h;
|
||||
PList<DictEntry>* chain;
|
||||
|
@ -280,7 +280,7 @@ void* Dictionary::Lookup(const void* key, int key_size, hash_t hash) const
|
|||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* Dictionary::Insert(void* key, int key_size, hash_t hash, void* val,
|
||||
|
@ -314,7 +314,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
|||
bool dont_delete)
|
||||
{
|
||||
if ( ! tbl && ! tbl2 )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
hash_t h;
|
||||
PList<DictEntry>* chain;
|
||||
|
@ -334,7 +334,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
|||
}
|
||||
|
||||
if ( ! chain )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
for ( int i = 0; i < chain->length(); ++i )
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
|||
void* entry_value = DoRemove(entry, h, chain, i);
|
||||
|
||||
if ( dont_delete )
|
||||
entry->key = 0;
|
||||
entry->key = nullptr;
|
||||
|
||||
delete entry;
|
||||
--*num_entries_ptr;
|
||||
|
@ -354,7 +354,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
|||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* Dictionary::DoRemove(DictEntry* entry, hash_t h,
|
||||
|
@ -395,7 +395,7 @@ void* Dictionary::DoRemove(DictEntry* entry, hash_t h,
|
|||
void* Dictionary::NthEntry(int n, const void*& key, int& key_len) const
|
||||
{
|
||||
if ( ! order || n < 0 || n >= Length() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
DictEntry* entry = (*order)[n];
|
||||
key = entry->key;
|
||||
|
@ -419,8 +419,8 @@ void* Dictionary::NextEntry(HashKey*& h, IterCookie*& cookie, int return_hash) c
|
|||
{
|
||||
const_cast<PList<IterCookie>*>(&cookies)->remove(cookie);
|
||||
delete cookie;
|
||||
cookie = 0;
|
||||
return 0;
|
||||
cookie = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If there are any inserted entries, return them first.
|
||||
|
@ -486,8 +486,8 @@ void* Dictionary::NextEntry(HashKey*& h, IterCookie*& cookie, int return_hash) c
|
|||
// a better way?
|
||||
const_cast<PList<IterCookie>*>(&cookies)->remove(cookie);
|
||||
delete cookie;
|
||||
cookie = 0;
|
||||
return 0;
|
||||
cookie = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
entry = (*ttbl[b])[0];
|
||||
|
@ -604,7 +604,7 @@ void* Dictionary::Insert(DictEntry* new_entry, bool copy_key)
|
|||
c->inserted.push_back(new_entry);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int Dictionary::NextPrime(int n) const
|
||||
|
@ -665,7 +665,7 @@ void Dictionary::MoveChains()
|
|||
if ( ! chain )
|
||||
continue;
|
||||
|
||||
tbl[tbl_next_ind - 1] = 0;
|
||||
tbl[tbl_next_ind - 1] = nullptr;
|
||||
|
||||
for ( int j = 0; j < chain->length(); ++j )
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
}
|
||||
|
||||
// True if the dictionary is ordered, false otherwise.
|
||||
bool IsOrdered() const { return order != 0; }
|
||||
bool IsOrdered() const { return order != nullptr; }
|
||||
|
||||
// If the dictionary is ordered then returns the n'th entry's value;
|
||||
// the second method also returns the key. The first entry inserted
|
||||
|
|
|
@ -12,7 +12,7 @@ EquivClass::EquivClass(int arg_size)
|
|||
bck = new int[size];
|
||||
equiv_class = new int[size];
|
||||
rep = new int[size];
|
||||
ccl_flags = 0;
|
||||
ccl_flags = nullptr;
|
||||
num_ecs = 0;
|
||||
|
||||
ec_nil = no_class = no_rep = size + 1;
|
||||
|
|
|
@ -74,10 +74,10 @@ void Event::Dispatch(bool no_remote)
|
|||
|
||||
EventMgr::EventMgr()
|
||||
{
|
||||
head = tail = 0;
|
||||
head = tail = nullptr;
|
||||
current_src = SOURCE_LOCAL;
|
||||
current_aid = 0;
|
||||
src_val = 0;
|
||||
src_val = nullptr;
|
||||
draining = false;
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,8 @@ void EventMgr::Drain()
|
|||
for ( int round = 0; head && round < 2; round++ )
|
||||
{
|
||||
Event* current = head;
|
||||
head = 0;
|
||||
tail = 0;
|
||||
head = nullptr;
|
||||
tail = nullptr;
|
||||
|
||||
while ( current )
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||
void QueueEventFast(const EventHandlerPtr &h, val_list vl,
|
||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
||||
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
||||
|
||||
// Queues an event if there's an event handler (or remote consumer). This
|
||||
// function always takes ownership of decrementing the reference count of
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||
void QueueEvent(const EventHandlerPtr &h, val_list vl,
|
||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
||||
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
||||
|
||||
// Same as QueueEvent, except taking the event's argument list via a
|
||||
// pointer instead of by value. This function takes ownership of the
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||
void QueueEvent(const EventHandlerPtr &h, val_list* vl,
|
||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
||||
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
||||
|
||||
/**
|
||||
* Adds an event to the queue. If no handler is found for the event
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
void Drain();
|
||||
bool IsDraining() const { return draining; }
|
||||
|
||||
bool HasEvents() const { return head != 0; }
|
||||
bool HasEvents() const { return head != nullptr; }
|
||||
|
||||
// Returns the source ID of last raised event.
|
||||
SourceID CurrentSource() const { return current_src; }
|
||||
|
|
|
@ -13,8 +13,8 @@ EventHandler::EventHandler(const char* arg_name)
|
|||
{
|
||||
name = copy_string(arg_name);
|
||||
used = false;
|
||||
local = 0;
|
||||
type = 0;
|
||||
local = nullptr;
|
||||
type = nullptr;
|
||||
error_handler = false;
|
||||
enabled = true;
|
||||
generate_always = false;
|
||||
|
@ -42,10 +42,10 @@ FuncType* EventHandler::FType(bool check_export)
|
|||
check_export);
|
||||
|
||||
if ( ! id )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( id->Type()->Tag() != TYPE_FUNC )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
type = id->Type()->AsFuncType();
|
||||
return type;
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
// Encapsulates a ptr to an event handler to overload the boolean operator.
|
||||
class EventHandlerPtr {
|
||||
public:
|
||||
EventHandlerPtr(EventHandler* p = 0) { handler = p; }
|
||||
EventHandlerPtr(EventHandler* p = nullptr) { handler = p; }
|
||||
EventHandlerPtr(const EventHandlerPtr& h) { handler = h.handler; }
|
||||
|
||||
const EventHandlerPtr& operator=(EventHandler* p)
|
||||
|
|
46
src/Expr.cc
46
src/Expr.cc
|
@ -54,7 +54,7 @@ const char* expr_name(BroExprTag t)
|
|||
return expr_names[int(t)];
|
||||
}
|
||||
|
||||
Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), type(0), paren(false)
|
||||
Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), type(nullptr), paren(false)
|
||||
{
|
||||
SetLocationInfo(&start_location, &end_location);
|
||||
}
|
||||
|
@ -1623,7 +1623,7 @@ IntrusivePtr<Val> BoolExpr::Eval(Frame* f) const
|
|||
result->Assign(i, val_mgr->GetBool(local_result));
|
||||
}
|
||||
else
|
||||
result->Assign(i, 0);
|
||||
result->Assign(i, nullptr);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1952,7 +1952,7 @@ IntrusivePtr<Val> CondExpr::Eval(Frame* f) const
|
|||
result->Assign(i, v ? v->Ref() : nullptr);
|
||||
}
|
||||
else
|
||||
result->Assign(i, 0);
|
||||
result->Assign(i, nullptr);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -2019,7 +2019,7 @@ AssignExpr::AssignExpr(IntrusivePtr<Expr> arg_op1, IntrusivePtr<Expr> arg_op2,
|
|||
std::move(arg_op1) : arg_op1->MakeLvalue(),
|
||||
std::move(arg_op2))
|
||||
{
|
||||
val = 0;
|
||||
val = nullptr;
|
||||
is_init = arg_is_init;
|
||||
|
||||
if ( IsError() )
|
||||
|
@ -2079,7 +2079,7 @@ bool AssignExpr::TypeCheck(attr_list* attrs)
|
|||
|
||||
if ( bt1 == TYPE_TABLE && op2->Tag() == EXPR_LIST )
|
||||
{
|
||||
attr_list* attr_copy = 0;
|
||||
attr_list* attr_copy = nullptr;
|
||||
|
||||
if ( attrs )
|
||||
{
|
||||
|
@ -2178,7 +2178,7 @@ bool AssignExpr::TypeCheck(attr_list* attrs)
|
|||
return false;
|
||||
}
|
||||
|
||||
attr_list* attr_copy = 0;
|
||||
attr_list* attr_copy = nullptr;
|
||||
|
||||
if ( sce->Attrs() )
|
||||
{
|
||||
|
@ -2293,7 +2293,7 @@ void AssignExpr::EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const
|
|||
if ( IsError() )
|
||||
return;
|
||||
|
||||
TypeDecl td(0, 0);
|
||||
TypeDecl td(nullptr, nullptr);
|
||||
|
||||
if ( IsRecordElement(&td) )
|
||||
{
|
||||
|
@ -2348,7 +2348,7 @@ IntrusivePtr<Val> AssignExpr::InitVal(const BroType* t, IntrusivePtr<Val> aggr)
|
|||
if ( IsError() )
|
||||
return nullptr;
|
||||
|
||||
TypeDecl td(0, 0);
|
||||
TypeDecl td(nullptr, nullptr);
|
||||
|
||||
if ( IsRecordElement(&td) )
|
||||
{
|
||||
|
@ -2690,7 +2690,7 @@ IntrusivePtr<Val> IndexExpr::Fold(Val* v1, Val* v2) const
|
|||
const ListVal* lv = v2->AsListVal();
|
||||
const BroString* s = v1->AsString();
|
||||
int len = s->Len();
|
||||
BroString* substring = 0;
|
||||
BroString* substring = nullptr;
|
||||
|
||||
if ( lv->Length() == 1 )
|
||||
{
|
||||
|
@ -2709,7 +2709,7 @@ IntrusivePtr<Val> IndexExpr::Fold(Val* v1, Val* v2) const
|
|||
bro_int_t substring_len = last - first;
|
||||
|
||||
if ( substring_len < 0 )
|
||||
substring = 0;
|
||||
substring = nullptr;
|
||||
else
|
||||
substring = s->GetSubstring(first, substring_len);
|
||||
}
|
||||
|
@ -2851,7 +2851,7 @@ TraversalCode IndexExpr::Traverse(TraversalCallback* cb) const
|
|||
|
||||
FieldExpr::FieldExpr(IntrusivePtr<Expr> arg_op, const char* arg_field_name)
|
||||
: UnaryExpr(EXPR_FIELD, std::move(arg_op)),
|
||||
field_name(copy_string(arg_field_name)), td(0), field(0)
|
||||
field_name(copy_string(arg_field_name)), td(nullptr), field(0)
|
||||
{
|
||||
if ( IsError() )
|
||||
return;
|
||||
|
@ -2905,7 +2905,7 @@ void FieldExpr::Assign(Frame* f, IntrusivePtr<Val> v)
|
|||
|
||||
void FieldExpr::Delete(Frame* f)
|
||||
{
|
||||
Assign(f, 0);
|
||||
Assign(f, nullptr);
|
||||
}
|
||||
|
||||
IntrusivePtr<Val> FieldExpr::Fold(Val* v) const
|
||||
|
@ -2914,7 +2914,7 @@ IntrusivePtr<Val> FieldExpr::Fold(Val* v) const
|
|||
return {NewRef{}, result};
|
||||
|
||||
// Check for &default.
|
||||
const Attr* def_attr = td ? td->FindAttr(ATTR_DEFAULT) : 0;
|
||||
const Attr* def_attr = td ? td->FindAttr(ATTR_DEFAULT) : nullptr;
|
||||
|
||||
if ( def_attr )
|
||||
return def_attr->AttrExpr()->Eval(nullptr);
|
||||
|
@ -3101,7 +3101,7 @@ TableConstructorExpr::TableConstructorExpr(IntrusivePtr<ListExpr> constructor_li
|
|||
}
|
||||
}
|
||||
|
||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : 0;
|
||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : nullptr;
|
||||
|
||||
type_list* indices = type->AsTableType()->Indices()->Types();
|
||||
const expr_list& cle = op->AsListExpr()->Exprs();
|
||||
|
@ -3173,7 +3173,7 @@ IntrusivePtr<Val> TableConstructorExpr::InitVal(const BroType* t, IntrusivePtr<V
|
|||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||
|
||||
for ( const auto& expr : exprs )
|
||||
expr->EvalIntoAggregate(t, tval.get(), 0);
|
||||
expr->EvalIntoAggregate(t, tval.get(), nullptr);
|
||||
|
||||
return tval;
|
||||
}
|
||||
|
@ -3219,7 +3219,7 @@ SetConstructorExpr::SetConstructorExpr(IntrusivePtr<ListExpr> constructor_list,
|
|||
else if ( type->Tag() != TYPE_TABLE || ! type->AsTableType()->IsSet() )
|
||||
SetError("values in set(...) constructor do not specify a set");
|
||||
|
||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : 0;
|
||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : nullptr;
|
||||
|
||||
type_list* indices = type->AsTableType()->Indices()->Types();
|
||||
expr_list& cle = op->AsListExpr()->Exprs();
|
||||
|
@ -3265,7 +3265,7 @@ IntrusivePtr<Val> SetConstructorExpr::Eval(Frame* f) const
|
|||
for ( const auto& expr : exprs )
|
||||
{
|
||||
auto element = expr->Eval(f);
|
||||
aggr->Assign(element.get(), 0);
|
||||
aggr->Assign(element.get(), nullptr);
|
||||
}
|
||||
|
||||
return aggr;
|
||||
|
@ -3287,7 +3287,7 @@ IntrusivePtr<Val> SetConstructorExpr::InitVal(const BroType* t, IntrusivePtr<Val
|
|||
{
|
||||
auto element = check_and_promote(e->Eval(nullptr), index_type, true);
|
||||
|
||||
if ( ! element || ! tval->Assign(element.get(), 0) )
|
||||
if ( ! element || ! tval->Assign(element.get(), nullptr) )
|
||||
{
|
||||
Error(fmt("initialization type mismatch in set"), e);
|
||||
return nullptr;
|
||||
|
@ -3521,7 +3521,7 @@ IntrusivePtr<Val> ArithCoerceExpr::Fold(Val* v) const
|
|||
if ( Val* elt = vv->Lookup(i) )
|
||||
result->Assign(i, FoldSingleVal(elt, t));
|
||||
else
|
||||
result->Assign(i, 0);
|
||||
result->Assign(i, nullptr);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -4191,7 +4191,7 @@ IntrusivePtr<Val> CallExpr::Eval(Frame* f) const
|
|||
if ( func_val && v )
|
||||
{
|
||||
const ::Func* funcv = func_val->AsFunc();
|
||||
const CallExpr* current_call = f ? f->GetCall() : 0;
|
||||
const CallExpr* current_call = f ? f->GetCall() : nullptr;
|
||||
|
||||
if ( f )
|
||||
f->SetCall(this);
|
||||
|
@ -4491,12 +4491,12 @@ IntrusivePtr<BroType> ListExpr::InitType() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if ( exprs[0]->IsRecordElement(0) )
|
||||
if ( exprs[0]->IsRecordElement(nullptr) )
|
||||
{
|
||||
type_decl_list* types = new type_decl_list(exprs.length());
|
||||
for ( const auto& expr : exprs )
|
||||
{
|
||||
TypeDecl* td = new TypeDecl(0, 0);
|
||||
TypeDecl* td = new TypeDecl(nullptr, nullptr);
|
||||
if ( ! expr->IsRecordElement(td) )
|
||||
{
|
||||
expr->Error("record element expected");
|
||||
|
@ -5063,7 +5063,7 @@ bool check_and_promote_args(ListExpr* const args, RecordType* types)
|
|||
for ( int i = ntypes - 1; i >= el.length(); --i )
|
||||
{
|
||||
TypeDecl* td = types->FieldDecl(i);
|
||||
Attr* def_attr = td->attrs ? td->attrs->FindAttr(ATTR_DEFAULT) : 0;
|
||||
Attr* def_attr = td->attrs ? td->attrs->FindAttr(ATTR_DEFAULT) : nullptr;
|
||||
|
||||
if ( ! def_attr )
|
||||
{
|
||||
|
|
|
@ -523,7 +523,7 @@ public:
|
|||
bool IsPure() const override;
|
||||
|
||||
protected:
|
||||
bool TypeCheck(attr_list* attrs = 0);
|
||||
bool TypeCheck(attr_list* attrs = nullptr);
|
||||
bool TypeCheckArithmetics(TypeTag bt1, TypeTag bt2);
|
||||
|
||||
bool is_init;
|
||||
|
|
22
src/File.cc
22
src/File.cc
|
@ -56,9 +56,9 @@ BroFile::BroFile(FILE* arg_f)
|
|||
{
|
||||
Init();
|
||||
f = arg_f;
|
||||
name = access = 0;
|
||||
name = access = nullptr;
|
||||
t = base_type(TYPE_STRING);
|
||||
is_open = (f != 0);
|
||||
is_open = (f != nullptr);
|
||||
}
|
||||
|
||||
BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
||||
|
@ -68,13 +68,13 @@ BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
|||
name = copy_string(arg_name);
|
||||
access = copy_string(arg_access);
|
||||
t = base_type(TYPE_STRING);
|
||||
is_open = (f != 0);
|
||||
is_open = (f != nullptr);
|
||||
}
|
||||
|
||||
BroFile::BroFile(const char* arg_name, const char* arg_access)
|
||||
{
|
||||
Init();
|
||||
f = 0;
|
||||
f = nullptr;
|
||||
name = copy_string(arg_name);
|
||||
access = copy_string(arg_access);
|
||||
t = base_type(TYPE_STRING);
|
||||
|
@ -110,7 +110,7 @@ const char* BroFile::Name() const
|
|||
if ( f == stderr )
|
||||
return "/dev/stderr";
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool BroFile::Open(FILE* file, const char* mode)
|
||||
|
@ -168,7 +168,7 @@ void BroFile::Init()
|
|||
{
|
||||
open_time = 0;
|
||||
is_open = false;
|
||||
attrs = 0;
|
||||
attrs = nullptr;
|
||||
buffered = true;
|
||||
raw_output = false;
|
||||
|
||||
|
@ -185,7 +185,7 @@ FILE* BroFile::File()
|
|||
FILE* BroFile::Seek(long new_position)
|
||||
{
|
||||
if ( ! File() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( fseek(f, new_position, SEEK_SET) < 0 )
|
||||
reporter->Error("seek failed");
|
||||
|
@ -271,11 +271,11 @@ void BroFile::SetAttrs(Attributes* arg_attrs)
|
|||
RecordVal* BroFile::Rotate()
|
||||
{
|
||||
if ( ! is_open )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// Do not rotate stdin/stdout/stderr.
|
||||
if ( f == stdin || f == stdout || f == stderr )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
RecordVal* info = new RecordVal(rotate_info);
|
||||
FILE* newf = rotate_file(name, info);
|
||||
|
@ -283,7 +283,7 @@ RecordVal* BroFile::Rotate()
|
|||
if ( ! newf )
|
||||
{
|
||||
Unref(info);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
info->Assign(2, make_intrusive<Val>(open_time, TYPE_TIME));
|
||||
|
@ -291,7 +291,7 @@ RecordVal* BroFile::Rotate()
|
|||
Unlink();
|
||||
|
||||
fclose(f);
|
||||
f = 0;
|
||||
f = nullptr;
|
||||
|
||||
Open(newf);
|
||||
return info;
|
||||
|
|
|
@ -80,7 +80,7 @@ protected:
|
|||
* If file is not given and mode is, the filename will be opened with that
|
||||
* access mode.
|
||||
*/
|
||||
bool Open(FILE* f = nullptr, const char* mode = 0);
|
||||
bool Open(FILE* f = nullptr, const char* mode = nullptr);
|
||||
|
||||
void Unlink();
|
||||
|
||||
|
|
10
src/Frag.cc
10
src/Frag.cc
|
@ -49,7 +49,7 @@ FragReassembler::FragReassembler(NetSessions* arg_s,
|
|||
memcpy(proto_hdr, ip->IP6_Hdr(), proto_hdr_len);
|
||||
}
|
||||
|
||||
reassembled_pkt = 0;
|
||||
reassembled_pkt = nullptr;
|
||||
frag_size = 0; // flag meaning "not known"
|
||||
next_proto = ip->NextProto();
|
||||
|
||||
|
@ -59,7 +59,7 @@ FragReassembler::FragReassembler(NetSessions* arg_s,
|
|||
timer_mgr->Add(expire_timer);
|
||||
}
|
||||
else
|
||||
expire_timer = 0;
|
||||
expire_timer = nullptr;
|
||||
|
||||
AddFragment(t, ip, pkt);
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void FragReassembler::BlockInserted(DataBlockMap::const_iterator /* it */)
|
|||
}
|
||||
|
||||
delete reassembled_pkt;
|
||||
reassembled_pkt = 0;
|
||||
reassembled_pkt = nullptr;
|
||||
|
||||
unsigned int version = ((const struct ip*)pkt_start)->ip_v;
|
||||
|
||||
|
@ -318,7 +318,7 @@ void FragReassembler::Expire(double t)
|
|||
{
|
||||
block_list.Clear();
|
||||
expire_timer->ClearReassembler();
|
||||
expire_timer = 0; // timer manager will delete it
|
||||
expire_timer = nullptr; // timer manager will delete it
|
||||
|
||||
sessions->Remove(this);
|
||||
}
|
||||
|
@ -329,6 +329,6 @@ void FragReassembler::DeleteTimer()
|
|||
{
|
||||
expire_timer->ClearReassembler();
|
||||
timer_mgr->Cancel(expire_timer);
|
||||
expire_timer = 0; // timer manager will delete it
|
||||
expire_timer = nullptr; // timer manager will delete it
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
void Expire(double t);
|
||||
void DeleteTimer();
|
||||
void ClearTimer() { expire_timer = 0; }
|
||||
void ClearTimer() { expire_timer = nullptr; }
|
||||
|
||||
const IP_Hdr* ReassembledPkt() { return reassembled_pkt; }
|
||||
const FragReassemblerKey& Key() const { return key; }
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
void Dispatch(double t, bool is_expire) override;
|
||||
|
||||
// Break the association between this timer and its creator.
|
||||
void ClearReassembler() { f = 0; }
|
||||
void ClearReassembler() { f = nullptr; }
|
||||
|
||||
protected:
|
||||
FragReassembler* f;
|
||||
|
|
|
@ -143,7 +143,7 @@ void Frame::Reset(int startIdx)
|
|||
for ( int i = startIdx; i < size; ++i )
|
||||
{
|
||||
UnrefElement(i);
|
||||
frame[i] = 0;
|
||||
frame[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ void Frame::Describe(ODesc* d) const
|
|||
|
||||
for ( int i = 0; i < size; ++i )
|
||||
{
|
||||
d->Add(frame[i] != 0);
|
||||
d->Add(frame[i] != nullptr);
|
||||
d->SP();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
trigger::Trigger* GetTrigger() const { return trigger.get(); }
|
||||
|
||||
void SetCall(const CallExpr* arg_call) { call = arg_call; }
|
||||
void ClearCall() { call = 0; }
|
||||
void ClearCall() { call = nullptr; }
|
||||
const CallExpr* GetCall() const { return call; }
|
||||
|
||||
void SetDelayed() { delayed = true; }
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
uint32_t GetUniqueFuncID() const { return unique_id; }
|
||||
static Func* GetFuncPtrByID(uint32_t id)
|
||||
{ return id >= unique_ids.size() ? 0 : unique_ids[id]; }
|
||||
{ return id >= unique_ids.size() ? nullptr : unique_ids[id]; }
|
||||
|
||||
protected:
|
||||
Func();
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
void Describe(ODesc* d) const override;
|
||||
|
||||
protected:
|
||||
BuiltinFunc() { func = 0; is_pure = 0; }
|
||||
BuiltinFunc() { func = nullptr; is_pure = 0; }
|
||||
|
||||
built_in_func func;
|
||||
bool is_pure;
|
||||
|
|
12
src/ID.cc
12
src/ID.cc
|
@ -25,7 +25,7 @@ ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
|
|||
scope = arg_scope;
|
||||
is_export = arg_is_export;
|
||||
is_option = false;
|
||||
val = 0;
|
||||
val = nullptr;
|
||||
is_const = false;
|
||||
is_enum_const = false;
|
||||
is_type = false;
|
||||
|
@ -60,7 +60,7 @@ void ID::ClearVal()
|
|||
if ( ! weak_ref )
|
||||
Unref(val);
|
||||
|
||||
val = 0;
|
||||
val = nullptr;
|
||||
}
|
||||
|
||||
void ID::SetVal(IntrusivePtr<Val> v, bool arg_weak_ref)
|
||||
|
@ -147,12 +147,12 @@ void ID::SetVal(IntrusivePtr<Expr> ev, init_class c)
|
|||
|
||||
bool ID::IsRedefinable() const
|
||||
{
|
||||
return FindAttr(ATTR_REDEF) != 0;
|
||||
return FindAttr(ATTR_REDEF) != nullptr;
|
||||
}
|
||||
|
||||
void ID::SetAttrs(IntrusivePtr<Attributes> a)
|
||||
{
|
||||
attrs = 0;
|
||||
attrs = nullptr;
|
||||
AddAttrs(std::move(a));
|
||||
}
|
||||
|
||||
|
@ -197,12 +197,12 @@ void ID::UpdateValAttrs()
|
|||
|
||||
Attr* ID::FindAttr(attr_tag t) const
|
||||
{
|
||||
return attrs ? attrs->FindAttr(t) : 0;
|
||||
return attrs ? attrs->FindAttr(t) : nullptr;
|
||||
}
|
||||
|
||||
bool ID::IsDeprecated() const
|
||||
{
|
||||
return FindAttr(ATTR_DEPRECATED) != 0;
|
||||
return FindAttr(ATTR_DEPRECATED) != nullptr;
|
||||
}
|
||||
|
||||
void ID::MakeDeprecated(IntrusivePtr<Expr> deprecation)
|
||||
|
|
8
src/ID.h
8
src/ID.h
|
@ -41,8 +41,8 @@ public:
|
|||
const BroType* Type() const { return type.get(); }
|
||||
|
||||
void MakeType() { is_type = true; }
|
||||
BroType* AsType() { return is_type ? Type() : 0; }
|
||||
const BroType* AsType() const { return is_type ? Type() : 0; }
|
||||
BroType* AsType() { return is_type ? Type() : nullptr; }
|
||||
const BroType* AsType() const { return is_type ? Type() : nullptr; }
|
||||
|
||||
// If weak_ref is false, the Val is assumed to be already ref'ed
|
||||
// and will be deref'ed when the ID is deleted.
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
void SetVal(IntrusivePtr<Val> v, init_class c);
|
||||
void SetVal(IntrusivePtr<Expr> ev, init_class c);
|
||||
|
||||
bool HasVal() const { return val != 0; }
|
||||
bool HasVal() const { return val != nullptr; }
|
||||
Val* ID_Val() { return val; }
|
||||
const Val* ID_Val() const { return val; }
|
||||
void ClearVal();
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
std::string GetDeprecationWarning() const;
|
||||
|
||||
void Error(const char* msg, const BroObj* o2 = 0);
|
||||
void Error(const char* msg, const BroObj* o2 = nullptr);
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
// Adds type and value to description.
|
||||
|
|
52
src/IP.cc
52
src/IP.cc
|
@ -13,26 +13,26 @@
|
|||
#include "BroString.h"
|
||||
#include "Reporter.h"
|
||||
|
||||
static RecordType* ip4_hdr_type = 0;
|
||||
static RecordType* ip6_hdr_type = 0;
|
||||
static RecordType* ip6_ext_hdr_type = 0;
|
||||
static RecordType* ip6_option_type = 0;
|
||||
static RecordType* ip6_hopopts_type = 0;
|
||||
static RecordType* ip6_dstopts_type = 0;
|
||||
static RecordType* ip6_routing_type = 0;
|
||||
static RecordType* ip6_fragment_type = 0;
|
||||
static RecordType* ip6_ah_type = 0;
|
||||
static RecordType* ip6_esp_type = 0;
|
||||
static RecordType* ip6_mob_type = 0;
|
||||
static RecordType* ip6_mob_msg_type = 0;
|
||||
static RecordType* ip6_mob_brr_type = 0;
|
||||
static RecordType* ip6_mob_hoti_type = 0;
|
||||
static RecordType* ip6_mob_coti_type = 0;
|
||||
static RecordType* ip6_mob_hot_type = 0;
|
||||
static RecordType* ip6_mob_cot_type = 0;
|
||||
static RecordType* ip6_mob_bu_type = 0;
|
||||
static RecordType* ip6_mob_back_type = 0;
|
||||
static RecordType* ip6_mob_be_type = 0;
|
||||
static RecordType* ip4_hdr_type = nullptr;
|
||||
static RecordType* ip6_hdr_type = nullptr;
|
||||
static RecordType* ip6_ext_hdr_type = nullptr;
|
||||
static RecordType* ip6_option_type = nullptr;
|
||||
static RecordType* ip6_hopopts_type = nullptr;
|
||||
static RecordType* ip6_dstopts_type = nullptr;
|
||||
static RecordType* ip6_routing_type = nullptr;
|
||||
static RecordType* ip6_fragment_type = nullptr;
|
||||
static RecordType* ip6_ah_type = nullptr;
|
||||
static RecordType* ip6_esp_type = nullptr;
|
||||
static RecordType* ip6_mob_type = nullptr;
|
||||
static RecordType* ip6_mob_msg_type = nullptr;
|
||||
static RecordType* ip6_mob_brr_type = nullptr;
|
||||
static RecordType* ip6_mob_hoti_type = nullptr;
|
||||
static RecordType* ip6_mob_coti_type = nullptr;
|
||||
static RecordType* ip6_mob_hot_type = nullptr;
|
||||
static RecordType* ip6_mob_cot_type = nullptr;
|
||||
static RecordType* ip6_mob_bu_type = nullptr;
|
||||
static RecordType* ip6_mob_back_type = nullptr;
|
||||
static RecordType* ip6_mob_be_type = nullptr;
|
||||
|
||||
static inline RecordType* hdrType(RecordType*& type, const char* name)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ static VectorVal* BuildOptionsVal(const u_char* data, int len)
|
|||
|
||||
RecordVal* IPv6_Hdr::BuildRecordVal(VectorVal* chain) const
|
||||
{
|
||||
RecordVal* rv = 0;
|
||||
RecordVal* rv = nullptr;
|
||||
|
||||
switch ( type ) {
|
||||
case IPPROTO_IPV6:
|
||||
|
@ -330,7 +330,7 @@ IPAddr IP_Hdr::DstAddr() const
|
|||
|
||||
RecordVal* IP_Hdr::BuildIPHdrVal() const
|
||||
{
|
||||
RecordVal* rval = 0;
|
||||
RecordVal* rval = nullptr;
|
||||
|
||||
if ( ip4 )
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ RecordVal* IP_Hdr::BuildIPHdrVal() const
|
|||
|
||||
RecordVal* IP_Hdr::BuildPktHdrVal() const
|
||||
{
|
||||
static RecordType* pkt_hdr_type = 0;
|
||||
static RecordType* pkt_hdr_type = nullptr;
|
||||
|
||||
if ( ! pkt_hdr_type )
|
||||
pkt_hdr_type = internal_type("pkt_hdr")->AsRecordType();
|
||||
|
@ -365,9 +365,9 @@ RecordVal* IP_Hdr::BuildPktHdrVal() const
|
|||
|
||||
RecordVal* IP_Hdr::BuildPktHdrVal(RecordVal* pkt_hdr, int sindex) const
|
||||
{
|
||||
static RecordType* tcp_hdr_type = 0;
|
||||
static RecordType* udp_hdr_type = 0;
|
||||
static RecordType* icmp_hdr_type = 0;
|
||||
static RecordType* tcp_hdr_type = nullptr;
|
||||
static RecordType* udp_hdr_type = nullptr;
|
||||
static RecordType* icmp_hdr_type = nullptr;
|
||||
|
||||
if ( ! tcp_hdr_type )
|
||||
{
|
||||
|
|
4
src/IP.h
4
src/IP.h
|
@ -136,7 +136,7 @@ public:
|
|||
/**
|
||||
* Returns the script-layer record representation of the header.
|
||||
*/
|
||||
RecordVal* BuildRecordVal(VectorVal* chain = 0) const;
|
||||
RecordVal* BuildRecordVal(VectorVal* chain = nullptr) const;
|
||||
|
||||
protected:
|
||||
uint8_t type;
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
*/
|
||||
const struct ip6_frag* GetFragHdr() const
|
||||
{ return IsFragment() ?
|
||||
(const struct ip6_frag*)chain[chain.size()-1]->Data(): 0; }
|
||||
(const struct ip6_frag*)chain[chain.size()-1]->Data(): nullptr; }
|
||||
|
||||
/**
|
||||
* If the header chain is a fragment, returns the offset in number of bytes
|
||||
|
|
18
src/NFA.cc
18
src/NFA.cc
|
@ -14,11 +14,11 @@ static int nfa_state_id = 0;
|
|||
NFA_State::NFA_State(int arg_sym, EquivClass* ec)
|
||||
{
|
||||
sym = arg_sym;
|
||||
ccl = 0;
|
||||
ccl = nullptr;
|
||||
accept = NO_ACCEPT;
|
||||
first_trans_is_back_ref = false;
|
||||
mark = 0;
|
||||
epsclosure = 0;
|
||||
mark = nullptr;
|
||||
epsclosure = nullptr;
|
||||
id = ++nfa_state_id;
|
||||
|
||||
// Fix up equivalence classes based on this transition. Note that any
|
||||
|
@ -39,9 +39,9 @@ NFA_State::NFA_State(CCL* arg_ccl)
|
|||
ccl = arg_ccl;
|
||||
accept = NO_ACCEPT;
|
||||
first_trans_is_back_ref = false;
|
||||
mark = 0;
|
||||
mark = nullptr;
|
||||
id = ++nfa_state_id;
|
||||
epsclosure = 0;
|
||||
epsclosure = nullptr;
|
||||
}
|
||||
|
||||
NFA_State::~NFA_State()
|
||||
|
@ -67,7 +67,7 @@ NFA_State* NFA_State::DeepCopy()
|
|||
return mark;
|
||||
}
|
||||
|
||||
NFA_State* copy = ccl ? new NFA_State(ccl) : new NFA_State(sym, 0);
|
||||
NFA_State* copy = ccl ? new NFA_State(ccl) : new NFA_State(sym, nullptr);
|
||||
SetMark(copy);
|
||||
|
||||
for ( int i = 0; i < xtions.length(); ++i )
|
||||
|
@ -80,7 +80,7 @@ void NFA_State::ClearMarks()
|
|||
{
|
||||
if ( mark )
|
||||
{
|
||||
SetMark(0);
|
||||
SetMark(nullptr);
|
||||
for ( int i = 0; i < xtions.length(); ++i )
|
||||
xtions[i]->ClearMarks();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ NFA_state_list* NFA_State::EpsilonClosure()
|
|||
|
||||
// Clear out markers.
|
||||
for ( i = 0; i < states.length(); ++i )
|
||||
states[i]->SetMark(0);
|
||||
states[i]->SetMark(nullptr);
|
||||
|
||||
// Make it fit.
|
||||
epsclosure->resize(0);
|
||||
|
@ -262,7 +262,7 @@ void NFA_Machine::MakePositiveClosure()
|
|||
|
||||
void NFA_Machine::MakeRepl(int lower, int upper)
|
||||
{
|
||||
NFA_Machine* dup = 0;
|
||||
NFA_Machine* dup = nullptr;
|
||||
if ( upper > lower || upper == NO_UPPER_BOUND )
|
||||
dup = DuplicateMachine();
|
||||
|
||||
|
|
|
@ -78,12 +78,12 @@ protected:
|
|||
|
||||
class EpsilonState : public NFA_State {
|
||||
public:
|
||||
EpsilonState() : NFA_State(SYM_EPSILON, 0) { }
|
||||
EpsilonState() : NFA_State(SYM_EPSILON, nullptr) { }
|
||||
};
|
||||
|
||||
class NFA_Machine : public BroObj {
|
||||
public:
|
||||
explicit NFA_Machine(NFA_State* first, NFA_State* final = 0);
|
||||
explicit NFA_Machine(NFA_State* first, NFA_State* final = nullptr);
|
||||
~NFA_Machine() override;
|
||||
|
||||
NFA_State* FirstState() const { return first_state; }
|
||||
|
|
|
@ -115,7 +115,7 @@ RETSIGTYPE watchdog(int /* signo */)
|
|||
if ( ! pkt_dumper || pkt_dumper->IsError() )
|
||||
{
|
||||
reporter->Error("watchdog: can't open watchdog-pkt.pcap for writing");
|
||||
pkt_dumper = 0;
|
||||
pkt_dumper = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ extern void net_delete(); // Reclaim all memory, etc.
|
|||
extern void net_update_time(double new_network_time);
|
||||
extern void net_packet_dispatch(double t, const Packet* pkt,
|
||||
iosource::PktSrc* src_ps);
|
||||
extern void expire_timers(iosource::PktSrc* src_ps = 0);
|
||||
extern void expire_timers(iosource::PktSrc* src_ps = nullptr);
|
||||
extern void zeek_terminate_loop(const char* reason);
|
||||
|
||||
// Functions to temporarily suspend processing of live input (network packets
|
||||
|
|
|
@ -165,7 +165,7 @@ void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2,
|
|||
d->Add(s1);
|
||||
PinPoint(d, obj2, pinpoint_only);
|
||||
|
||||
const Location* loc2 = 0;
|
||||
const Location* loc2 = nullptr;
|
||||
if ( obj2 && obj2->GetLocationInfo() != &no_location &&
|
||||
*obj2->GetLocationInfo() != *GetLocationInfo() )
|
||||
loc2 = obj2->GetLocationInfo();
|
||||
|
|
20
src/Obj.h
20
src/Obj.h
|
@ -66,7 +66,7 @@ public:
|
|||
// we check for whether start_location has a line number
|
||||
// of 0, which should only happen if it's been assigned
|
||||
// to no_location (or hasn't been initialized at all).
|
||||
location = 0;
|
||||
location = nullptr;
|
||||
if ( start_location.first_line != 0 )
|
||||
SetLocationInfo(&start_location, &end_location);
|
||||
}
|
||||
|
@ -80,14 +80,14 @@ public:
|
|||
// Report user warnings/errors. If obj2 is given, then it's
|
||||
// included in the message, though if pinpoint_only is non-zero,
|
||||
// then obj2 is only used to pinpoint the location.
|
||||
void Warn(const char* msg, const BroObj* obj2 = 0,
|
||||
bool pinpoint_only = false, const Location* expr_location = 0) const;
|
||||
void Error(const char* msg, const BroObj* obj2 = 0,
|
||||
bool pinpoint_only = false, const Location* expr_location = 0) const;
|
||||
void Warn(const char* msg, const BroObj* obj2 = nullptr,
|
||||
bool pinpoint_only = false, const Location* expr_location = nullptr) const;
|
||||
void Error(const char* msg, const BroObj* obj2 = nullptr,
|
||||
bool pinpoint_only = false, const Location* expr_location = nullptr) const;
|
||||
|
||||
// Report internal errors.
|
||||
void BadTag(const char* msg, const char* t1 = 0,
|
||||
const char* t2 = 0) const;
|
||||
void BadTag(const char* msg, const char* t1 = nullptr,
|
||||
const char* t2 = nullptr) const;
|
||||
#define CHECK_TAG(t1, t2, text, tag_to_text_func) \
|
||||
{ \
|
||||
if ( t1 != t2 ) \
|
||||
|
@ -134,9 +134,9 @@ protected:
|
|||
private:
|
||||
friend class SuppressErrors;
|
||||
|
||||
void DoMsg(ODesc* d, const char s1[], const BroObj* obj2 = 0,
|
||||
bool pinpoint_only = false, const Location* expr_location = 0) const;
|
||||
void PinPoint(ODesc* d, const BroObj* obj2 = 0,
|
||||
void DoMsg(ODesc* d, const char s1[], const BroObj* obj2 = nullptr,
|
||||
bool pinpoint_only = false, const Location* expr_location = nullptr) const;
|
||||
void PinPoint(ODesc* d, const BroObj* obj2 = nullptr,
|
||||
bool pinpoint_only = false) const;
|
||||
|
||||
friend inline void Ref(BroObj* o);
|
||||
|
|
|
@ -699,24 +699,24 @@ bool EntropyVal::DoUnserialize(const broker::data& data)
|
|||
BloomFilterVal::BloomFilterVal()
|
||||
: OpaqueVal(bloomfilter_type)
|
||||
{
|
||||
type = 0;
|
||||
hash = 0;
|
||||
bloom_filter = 0;
|
||||
type = nullptr;
|
||||
hash = nullptr;
|
||||
bloom_filter = nullptr;
|
||||
}
|
||||
|
||||
BloomFilterVal::BloomFilterVal(OpaqueType* t)
|
||||
: OpaqueVal(t)
|
||||
{
|
||||
type = 0;
|
||||
hash = 0;
|
||||
bloom_filter = 0;
|
||||
type = nullptr;
|
||||
hash = nullptr;
|
||||
bloom_filter = nullptr;
|
||||
}
|
||||
|
||||
BloomFilterVal::BloomFilterVal(probabilistic::BloomFilter* bf)
|
||||
: OpaqueVal(bloomfilter_type)
|
||||
{
|
||||
type = 0;
|
||||
hash = 0;
|
||||
type = nullptr;
|
||||
hash = nullptr;
|
||||
bloom_filter = bf;
|
||||
}
|
||||
|
||||
|
@ -790,13 +790,13 @@ IntrusivePtr<BloomFilterVal> BloomFilterVal::Merge(const BloomFilterVal* x,
|
|||
! same_type(x->Type(), y->Type()) )
|
||||
{
|
||||
reporter->Error("cannot merge Bloom filters with different types");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( typeid(*x->bloom_filter) != typeid(*y->bloom_filter) )
|
||||
{
|
||||
reporter->Error("cannot merge different Bloom filter types");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
probabilistic::BloomFilter* copy = x->bloom_filter->Clone();
|
||||
|
@ -805,7 +805,7 @@ IntrusivePtr<BloomFilterVal> BloomFilterVal::Merge(const BloomFilterVal* x,
|
|||
{
|
||||
delete copy;
|
||||
reporter->Error("failed to merge Bloom filter");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto merged = make_intrusive<BloomFilterVal>(copy);
|
||||
|
@ -813,7 +813,7 @@ IntrusivePtr<BloomFilterVal> BloomFilterVal::Merge(const BloomFilterVal* x,
|
|||
if ( x->Type() && ! merged->Typify(x->Type()) )
|
||||
{
|
||||
reporter->Error("failed to set type on merged Bloom filter");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return merged;
|
||||
|
@ -876,17 +876,17 @@ bool BloomFilterVal::DoUnserialize(const broker::data& data)
|
|||
|
||||
CardinalityVal::CardinalityVal() : OpaqueVal(cardinality_type)
|
||||
{
|
||||
c = 0;
|
||||
type = 0;
|
||||
hash = 0;
|
||||
c = nullptr;
|
||||
type = nullptr;
|
||||
hash = nullptr;
|
||||
}
|
||||
|
||||
CardinalityVal::CardinalityVal(probabilistic::CardinalityCounter* arg_c)
|
||||
: OpaqueVal(cardinality_type)
|
||||
{
|
||||
c = arg_c;
|
||||
type = 0;
|
||||
hash = 0;
|
||||
type = nullptr;
|
||||
hash = nullptr;
|
||||
}
|
||||
|
||||
CardinalityVal::~CardinalityVal()
|
||||
|
|
|
@ -186,49 +186,49 @@ zeek::Options zeek::parse_cmdline(int argc, char** argv)
|
|||
}
|
||||
|
||||
constexpr struct option long_opts[] = {
|
||||
{"parse-only", no_argument, 0, 'a'},
|
||||
{"bare-mode", no_argument, 0, 'b'},
|
||||
{"debug-script", no_argument, 0, 'd'},
|
||||
{"exec", required_argument, 0, 'e'},
|
||||
{"filter", required_argument, 0, 'f'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"iface", required_argument, 0, 'i'},
|
||||
{"zeekygen", required_argument, 0, 'X'},
|
||||
{"prefix", required_argument, 0, 'p'},
|
||||
{"readfile", required_argument, 0, 'r'},
|
||||
{"rulefile", required_argument, 0, 's'},
|
||||
{"tracefile", required_argument, 0, 't'},
|
||||
{"writefile", required_argument, 0, 'w'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"no-checksums", no_argument, 0, 'C'},
|
||||
{"force-dns", no_argument, 0, 'F'},
|
||||
{"load-seeds", required_argument, 0, 'G'},
|
||||
{"save-seeds", required_argument, 0, 'H'},
|
||||
{"print-plugins", no_argument, 0, 'N'},
|
||||
{"prime-dns", no_argument, 0, 'P'},
|
||||
{"time", no_argument, 0, 'Q'},
|
||||
{"debug-rules", no_argument, 0, 'S'},
|
||||
{"re-level", required_argument, 0, 'T'},
|
||||
{"watchdog", no_argument, 0, 'W'},
|
||||
{"print-id", required_argument, 0, 'I'},
|
||||
{"status-file", required_argument, 0, 'U'},
|
||||
{"parse-only", no_argument, nullptr, 'a'},
|
||||
{"bare-mode", no_argument, nullptr, 'b'},
|
||||
{"debug-script", no_argument, nullptr, 'd'},
|
||||
{"exec", required_argument, nullptr, 'e'},
|
||||
{"filter", required_argument, nullptr, 'f'},
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"iface", required_argument, nullptr, 'i'},
|
||||
{"zeekygen", required_argument, nullptr, 'X'},
|
||||
{"prefix", required_argument, nullptr, 'p'},
|
||||
{"readfile", required_argument, nullptr, 'r'},
|
||||
{"rulefile", required_argument, nullptr, 's'},
|
||||
{"tracefile", required_argument, nullptr, 't'},
|
||||
{"writefile", required_argument, nullptr, 'w'},
|
||||
{"version", no_argument, nullptr, 'v'},
|
||||
{"no-checksums", no_argument, nullptr, 'C'},
|
||||
{"force-dns", no_argument, nullptr, 'F'},
|
||||
{"load-seeds", required_argument, nullptr, 'G'},
|
||||
{"save-seeds", required_argument, nullptr, 'H'},
|
||||
{"print-plugins", no_argument, nullptr, 'N'},
|
||||
{"prime-dns", no_argument, nullptr, 'P'},
|
||||
{"time", no_argument, nullptr, 'Q'},
|
||||
{"debug-rules", no_argument, nullptr, 'S'},
|
||||
{"re-level", required_argument, nullptr, 'T'},
|
||||
{"watchdog", no_argument, nullptr, 'W'},
|
||||
{"print-id", required_argument, nullptr, 'I'},
|
||||
{"status-file", required_argument, nullptr, 'U'},
|
||||
|
||||
#ifdef DEBUG
|
||||
{"debug", required_argument, 0, 'B'},
|
||||
{"debug", required_argument, nullptr, 'B'},
|
||||
#endif
|
||||
#ifdef USE_IDMEF
|
||||
{"idmef-dtd", required_argument, 0, 'n'},
|
||||
{"idmef-dtd", required_argument, nullptr, 'n'},
|
||||
#endif
|
||||
#ifdef USE_PERFTOOLS_DEBUG
|
||||
{"mem-leaks", no_argument, 0, 'm'},
|
||||
{"mem-profile", no_argument, 0, 'M'},
|
||||
{"mem-leaks", no_argument, nullptr, 'm'},
|
||||
{"mem-profile", no_argument, nullptr, 'M'},
|
||||
#endif
|
||||
|
||||
{"pseudo-realtime", optional_argument, 0, 'E'},
|
||||
{"jobs", optional_argument, 0, 'j'},
|
||||
{"test", no_argument, 0, '#'},
|
||||
{"pseudo-realtime", optional_argument, nullptr, 'E'},
|
||||
{"jobs", optional_argument, nullptr, 'j'},
|
||||
{"test", no_argument, nullptr, '#'},
|
||||
|
||||
{0, 0, 0, 0},
|
||||
{nullptr, 0, nullptr, 0},
|
||||
};
|
||||
|
||||
char opts[256];
|
||||
|
|
|
@ -18,8 +18,8 @@ using namespace std;
|
|||
#include "Reporter.h"
|
||||
|
||||
struct PolicyFile {
|
||||
PolicyFile () { filedata = 0; lmtime = 0; }
|
||||
~PolicyFile () { delete [] filedata; filedata = 0; }
|
||||
PolicyFile () { filedata = nullptr; lmtime = 0; }
|
||||
~PolicyFile () { delete [] filedata; filedata = nullptr; }
|
||||
|
||||
time_t lmtime;
|
||||
char* filedata;
|
||||
|
|
|
@ -28,7 +28,7 @@ void* PrefixTable::Insert(const IPAddr& addr, int width, void* data)
|
|||
if ( ! node )
|
||||
{
|
||||
reporter->InternalWarning("Cannot create node in patricia tree");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* old = node->data;
|
||||
|
@ -59,7 +59,7 @@ void* PrefixTable::Insert(const Val* value, void* data)
|
|||
|
||||
default:
|
||||
reporter->InternalWarning("Wrong index type for PrefixTable");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ void* PrefixTable::Lookup(const IPAddr& addr, int width, bool exact) const
|
|||
patricia_node_t** list = nullptr;
|
||||
|
||||
Deref_Prefix(prefix);
|
||||
return node ? node->data : 0;
|
||||
return node ? node->data : nullptr;
|
||||
}
|
||||
|
||||
void* PrefixTable::Lookup(const Val* value, bool exact) const
|
||||
|
@ -120,7 +120,7 @@ void* PrefixTable::Lookup(const Val* value, bool exact) const
|
|||
default:
|
||||
reporter->InternalWarning("Wrong index type %d for PrefixTable",
|
||||
value->Type()->Tag());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ void* PrefixTable::Remove(const IPAddr& addr, int width)
|
|||
Deref_Prefix(prefix);
|
||||
|
||||
if ( ! node )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
void* old = node->data;
|
||||
patricia_remove(tree, node);
|
||||
|
@ -158,7 +158,7 @@ void* PrefixTable::Remove(const Val* value)
|
|||
|
||||
default:
|
||||
reporter->InternalWarning("Wrong index type for PrefixTable");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ PrefixTable::iterator PrefixTable::InitIterator()
|
|||
iterator i;
|
||||
i.Xsp = i.Xstack;
|
||||
i.Xrn = tree->head;
|
||||
i.Xnode = 0;
|
||||
i.Xnode = nullptr;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ void* PrefixTable::GetNext(iterator* i)
|
|||
{
|
||||
i->Xnode = i->Xrn;
|
||||
if ( ! i->Xnode )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( i->Xrn->l )
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ void* PrefixTable::GetNext(iterator* i)
|
|||
i->Xrn = *(--i->Xsp);
|
||||
|
||||
else
|
||||
i->Xrn = (patricia_node_t*) 0;
|
||||
i->Xrn = (patricia_node_t*) nullptr;
|
||||
|
||||
if ( i->Xnode->prefix )
|
||||
return (void*) i->Xnode->data;
|
||||
|
|
|
@ -30,10 +30,10 @@ public:
|
|||
// Addr in network byte order. If data is zero, acts like a set.
|
||||
// Returns ptr to old data if already existing.
|
||||
// For existing items without data, returns non-nil if found.
|
||||
void* Insert(const IPAddr& addr, int width, void* data = 0);
|
||||
void* Insert(const IPAddr& addr, int width, void* data = nullptr);
|
||||
|
||||
// Value may be addr or subnet.
|
||||
void* Insert(const Val* value, void* data = 0);
|
||||
void* Insert(const Val* value, void* data = nullptr);
|
||||
|
||||
// Returns nil if not found, pointer to data otherwise.
|
||||
// For items without data, returns non-nil if found.
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
PQ_Element* Top() const
|
||||
{
|
||||
if ( heap_size == 0 )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return heap[0];
|
||||
}
|
||||
|
|
24
src/RE.cc
24
src/RE.cc
|
@ -12,10 +12,10 @@
|
|||
#include "Reporter.h"
|
||||
#include "BroString.h"
|
||||
|
||||
CCL* curr_ccl = 0;
|
||||
CCL* curr_ccl = nullptr;
|
||||
|
||||
Specific_RE_Matcher* rem;
|
||||
NFA_Machine* nfa = 0;
|
||||
NFA_Machine* nfa = nullptr;
|
||||
int case_insensitive = 0;
|
||||
|
||||
extern int RE_parse(void);
|
||||
|
@ -27,10 +27,10 @@ Specific_RE_Matcher::Specific_RE_Matcher(match_type arg_mt, int arg_multiline)
|
|||
{
|
||||
mt = arg_mt;
|
||||
multiline = arg_multiline;
|
||||
any_ccl = 0;
|
||||
pattern_text = 0;
|
||||
dfa = 0;
|
||||
ecs = 0;
|
||||
any_ccl = nullptr;
|
||||
pattern_text = nullptr;
|
||||
dfa = nullptr;
|
||||
ecs = nullptr;
|
||||
accepted = new AcceptingSet();
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ bool Specific_RE_Matcher::Compile(bool lazy)
|
|||
{
|
||||
reporter->Error("error compiling pattern /%s/", pattern_text);
|
||||
Unref(nfa);
|
||||
nfa = 0;
|
||||
nfa = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ bool Specific_RE_Matcher::Compile(bool lazy)
|
|||
dfa = new DFA_Machine(nfa, EC());
|
||||
|
||||
Unref(nfa);
|
||||
nfa = 0;
|
||||
nfa = nullptr;
|
||||
|
||||
ecs = EC()->EquivClasses();
|
||||
|
||||
|
@ -155,7 +155,7 @@ bool Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx
|
|||
|
||||
rem = this;
|
||||
|
||||
NFA_Machine* set_nfa = 0;
|
||||
NFA_Machine* set_nfa = nullptr;
|
||||
|
||||
loop_over_list(set, i)
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ bool Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx
|
|||
else
|
||||
Unref(nfa);
|
||||
|
||||
nfa = 0;
|
||||
nfa = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ bool Specific_RE_Matcher::MatchAll(const u_char* bv, int n)
|
|||
if ( d )
|
||||
d = d->Xtion(ecs[SYM_EOL], dfa);
|
||||
|
||||
return d && d->Accept() != 0;
|
||||
return d && d->Accept() != nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -354,7 +354,7 @@ bool RE_Match_State::Match(const u_char* bv, int n,
|
|||
|
||||
if ( ! next_state )
|
||||
{
|
||||
current_state = 0;
|
||||
current_state = nullptr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
6
src/RE.h
6
src/RE.h
|
@ -140,10 +140,10 @@ class RE_Match_State {
|
|||
public:
|
||||
explicit RE_Match_State(Specific_RE_Matcher* matcher)
|
||||
{
|
||||
dfa = matcher->DFA() ? matcher->DFA() : 0;
|
||||
dfa = matcher->DFA() ? matcher->DFA() : nullptr;
|
||||
ecs = matcher->EC()->EquivClasses();
|
||||
current_pos = -1;
|
||||
current_state = 0;
|
||||
current_state = nullptr;
|
||||
}
|
||||
|
||||
const AcceptingMatchSet& AcceptedMatches() const
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
void Clear()
|
||||
{
|
||||
current_pos = -1;
|
||||
current_state = 0;
|
||||
current_state = nullptr;
|
||||
accepted_matches.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ int closelog();
|
|||
}
|
||||
#endif
|
||||
|
||||
Reporter* reporter = 0;
|
||||
Reporter* reporter = nullptr;
|
||||
|
||||
Reporter::Reporter()
|
||||
{
|
||||
|
@ -88,8 +88,8 @@ void Reporter::Info(const char* fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
FILE* out = EmitToStderr(info_to_stderr) ? stderr : 0;
|
||||
DoLog("", reporter_info, out, 0, 0, true, true, 0, fmt, ap);
|
||||
FILE* out = EmitToStderr(info_to_stderr) ? stderr : nullptr;
|
||||
DoLog("", reporter_info, out, nullptr, nullptr, true, true, nullptr, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -97,8 +97,8 @@ void Reporter::Warning(const char* fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : 0;
|
||||
DoLog("warning", reporter_warning, out, 0, 0, true, true, 0, fmt, ap);
|
||||
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : nullptr;
|
||||
DoLog("warning", reporter_warning, out, nullptr, nullptr, true, true, nullptr, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,8 @@ void Reporter::Error(const char* fmt, ...)
|
|||
++errors;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : 0;
|
||||
DoLog("error", reporter_error, out, 0, 0, true, true, 0, fmt, ap);
|
||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : nullptr;
|
||||
DoLog("error", reporter_error, out, nullptr, nullptr, true, true, nullptr, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ void Reporter::FatalError(const char* fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
|
||||
// Always log to stderr.
|
||||
DoLog("fatal error", 0, stderr, 0, 0, true, false, 0, fmt, ap);
|
||||
DoLog("fatal error", nullptr, stderr, nullptr, nullptr, true, false, nullptr, fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
|
@ -134,7 +134,7 @@ void Reporter::FatalErrorWithCore(const char* fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
|
||||
// Always log to stderr.
|
||||
DoLog("fatal error", 0, stderr, 0, 0, true, false, 0, fmt, ap);
|
||||
DoLog("fatal error", nullptr, stderr, nullptr, nullptr, true, false, nullptr, fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
|
@ -152,8 +152,8 @@ void Reporter::ExprRuntimeError(const Expr* expr, const char* fmt, ...)
|
|||
PushLocation(expr->GetLocationInfo());
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : 0;
|
||||
DoLog("expression error", reporter_error, out, 0, 0, true, true,
|
||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : nullptr;
|
||||
DoLog("expression error", reporter_error, out, nullptr, nullptr, true, true,
|
||||
d.Description(), fmt, ap);
|
||||
va_end(ap);
|
||||
PopLocation();
|
||||
|
@ -166,8 +166,8 @@ void Reporter::RuntimeError(const Location* location, const char* fmt, ...)
|
|||
PushLocation(location);
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : 0;
|
||||
DoLog("runtime error", reporter_error, out, 0, 0, true, true, "", fmt, ap);
|
||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : nullptr;
|
||||
DoLog("runtime error", reporter_error, out, nullptr, nullptr, true, true, "", fmt, ap);
|
||||
va_end(ap);
|
||||
PopLocation();
|
||||
throw InterpreterException();
|
||||
|
@ -179,7 +179,7 @@ void Reporter::InternalError(const char* fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
|
||||
// Always log to stderr.
|
||||
DoLog("internal error", 0, stderr, 0, 0, true, false, 0, fmt, ap);
|
||||
DoLog("internal error", nullptr, stderr, nullptr, nullptr, true, false, nullptr, fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
|
@ -197,7 +197,7 @@ void Reporter::AnalyzerError(analyzer::Analyzer* a, const char* fmt,
|
|||
va_start(ap, fmt);
|
||||
// Always log to stderr.
|
||||
// TODO: would be nice to also log a call stack.
|
||||
DoLog("analyzer error", reporter_error, stderr, 0, 0, true, true, 0, fmt,
|
||||
DoLog("analyzer error", reporter_error, stderr, nullptr, nullptr, true, true, nullptr, fmt,
|
||||
ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -206,9 +206,9 @@ void Reporter::InternalWarning(const char* fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : 0;
|
||||
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : nullptr;
|
||||
// TODO: would be nice to also log a call stack.
|
||||
DoLog("internal warning", reporter_warning, out, 0, 0, true, true, 0, fmt,
|
||||
DoLog("internal warning", reporter_warning, out, nullptr, nullptr, true, true, nullptr, fmt,
|
||||
ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ void Reporter::WeirdHelper(EventHandlerPtr event, val_list vl, const char* fmt_n
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt_name);
|
||||
DoLog("weird", event, 0, 0, &vl, false, false, 0, fmt_name, ap);
|
||||
DoLog("weird", event, nullptr, nullptr, &vl, false, false, nullptr, fmt_name, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
|
|||
|
||||
int size = sizeof(tmp);
|
||||
char* buffer = tmp;
|
||||
char* alloced = 0;
|
||||
char* alloced = nullptr;
|
||||
|
||||
string loc_str;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ void Rule::AddRequires(const char* id, bool opposite_direction, bool negate)
|
|||
{
|
||||
Precond* p = new Precond;
|
||||
p->id = copy_string(id);
|
||||
p->rule = 0;
|
||||
p->rule = nullptr;
|
||||
p->opposite_dir = opposite_direction;
|
||||
p->negate = negate;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
idx = rule_counter++;
|
||||
location = arg_location;
|
||||
active = true;
|
||||
next = 0;
|
||||
next = nullptr;
|
||||
}
|
||||
|
||||
~Rule();
|
||||
|
|
|
@ -48,10 +48,10 @@ RuleHdrTest::RuleHdrTest(Prot arg_prot, uint32_t arg_offset, uint32_t arg_size,
|
|||
size = arg_size;
|
||||
comp = arg_comp;
|
||||
vals = arg_vals;
|
||||
sibling = 0;
|
||||
child = 0;
|
||||
pattern_rules = 0;
|
||||
pure_rules = 0;
|
||||
sibling = nullptr;
|
||||
child = nullptr;
|
||||
pattern_rules = nullptr;
|
||||
pure_rules = nullptr;
|
||||
ruleset = new IntSet;
|
||||
id = ++idcounter;
|
||||
level = 0;
|
||||
|
@ -65,10 +65,10 @@ RuleHdrTest::RuleHdrTest(Prot arg_prot, Comp arg_comp, vector<IPPrefix> arg_v)
|
|||
comp = arg_comp;
|
||||
vals = new maskedvalue_list;
|
||||
prefix_vals = std::move(arg_v);
|
||||
sibling = 0;
|
||||
child = 0;
|
||||
pattern_rules = 0;
|
||||
pure_rules = 0;
|
||||
sibling = nullptr;
|
||||
child = nullptr;
|
||||
pattern_rules = nullptr;
|
||||
pure_rules = nullptr;
|
||||
ruleset = new IntSet;
|
||||
id = ++idcounter;
|
||||
level = 0;
|
||||
|
@ -103,7 +103,7 @@ RuleHdrTest::RuleHdrTest(RuleHdrTest& h)
|
|||
for ( PatternSet* orig_set : h.psets[j] )
|
||||
{
|
||||
PatternSet* copied_set = new PatternSet;
|
||||
copied_set->re = 0;
|
||||
copied_set->re = nullptr;
|
||||
copied_set->ids = orig_set->ids;
|
||||
for ( const auto& pattern : orig_set->patterns )
|
||||
copied_set->patterns.push_back(copy_string(pattern));
|
||||
|
@ -113,10 +113,10 @@ RuleHdrTest::RuleHdrTest(RuleHdrTest& h)
|
|||
}
|
||||
}
|
||||
|
||||
sibling = 0;
|
||||
child = 0;
|
||||
pattern_rules = 0;
|
||||
pure_rules = 0;
|
||||
sibling = nullptr;
|
||||
child = nullptr;
|
||||
pattern_rules = nullptr;
|
||||
pure_rules = nullptr;
|
||||
ruleset = new IntSet;
|
||||
id = ++idcounter;
|
||||
level = 0;
|
||||
|
@ -758,8 +758,8 @@ RuleEndpointState* RuleMatcher::InitEndpoint(analyzer::Analyzer* analyzer,
|
|||
// Evaluate all rules on this node which don't contain
|
||||
// any patterns.
|
||||
for ( Rule* r = hdr_test->pure_rules; r; r = r->next )
|
||||
if ( EvalRuleConditions(r, state, 0, 0, false) )
|
||||
ExecRuleActions(r, state, 0, 0, false);
|
||||
if ( EvalRuleConditions(r, state, nullptr, 0, false) )
|
||||
ExecRuleActions(r, state, nullptr, 0, false);
|
||||
|
||||
// If we're on or above the RE_level, we may have some
|
||||
// pattern matching to do.
|
||||
|
@ -989,7 +989,7 @@ void RuleMatcher::ExecPureRules(RuleEndpointState* state, bool eos)
|
|||
for ( const auto& hdr_test : state->hdr_tests )
|
||||
{
|
||||
for ( Rule* r = hdr_test->pure_rules; r; r = r->next )
|
||||
ExecRulePurely(r, 0, state, eos);
|
||||
ExecRulePurely(r, nullptr, state, eos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1001,14 +1001,14 @@ bool RuleMatcher::ExecRulePurely(Rule* r, BroString* s,
|
|||
|
||||
DBG_LOG(DBG_RULES, "Checking rule %s purely", r->ID());
|
||||
|
||||
if ( EvalRuleConditions(r, state, 0, 0, eos) )
|
||||
if ( EvalRuleConditions(r, state, nullptr, 0, eos) )
|
||||
{
|
||||
DBG_LOG(DBG_RULES, "MATCH!");
|
||||
|
||||
if ( s )
|
||||
ExecRuleActions(r, state, s->Bytes(), s->Len(), eos);
|
||||
else
|
||||
ExecRuleActions(r, state, 0, 0, eos);
|
||||
ExecRuleActions(r, state, nullptr, 0, eos);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1098,7 +1098,7 @@ void RuleMatcher::ExecRule(Rule* rule, RuleEndpointState* state, bool eos)
|
|||
for ( Rule* r = h->pure_rules; r; r = r->next )
|
||||
if ( r == rule )
|
||||
{ // found, so let's evaluate it
|
||||
ExecRulePurely(rule, 0, state, eos);
|
||||
ExecRulePurely(rule, nullptr, state, eos);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1273,7 +1273,7 @@ static Val* get_bro_val(const char* label)
|
|||
if ( ! id )
|
||||
{
|
||||
rules_error("unknown script-level identifier", label);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return id->ID_Val();
|
||||
|
@ -1464,7 +1464,7 @@ void RuleMatcherState::FinishEndpointMatcher()
|
|||
delete orig_match_state;
|
||||
delete resp_match_state;
|
||||
|
||||
orig_match_state = resp_match_state = 0;
|
||||
orig_match_state = resp_match_state = nullptr;
|
||||
}
|
||||
|
||||
void RuleMatcherState::Match(Rule::PatternType type, const u_char* data,
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef PList<BroString> bstr_list;
|
|||
|
||||
// Get values from Bro's script-level variables.
|
||||
extern void id_to_maskedvallist(const char* id, maskedvalue_list* append_to,
|
||||
vector<IPPrefix>* prefix_vector = 0);
|
||||
vector<IPPrefix>* prefix_vector = nullptr);
|
||||
extern char* id_to_str(const char* id);
|
||||
extern uint32_t id_to_uint(const char* id);
|
||||
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
* @return The results of the signature matching.
|
||||
*/
|
||||
MIME_Matches* Match(RuleFileMagicState* state, const u_char* data,
|
||||
uint64_t len, MIME_Matches* matches = 0) const;
|
||||
uint64_t len, MIME_Matches* matches = nullptr) const;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -312,7 +312,7 @@ public:
|
|||
Val* BuildRuleStateValue(const Rule* rule,
|
||||
const RuleEndpointState* state) const;
|
||||
|
||||
void GetStats(Stats* stats, RuleHdrTest* hdr_test = 0);
|
||||
void GetStats(Stats* stats, RuleHdrTest* hdr_test = nullptr);
|
||||
void DumpStats(BroFile* f);
|
||||
|
||||
private:
|
||||
|
@ -372,13 +372,13 @@ private:
|
|||
// Keeps bi-directional matching-state.
|
||||
class RuleMatcherState {
|
||||
public:
|
||||
RuleMatcherState() { orig_match_state = resp_match_state = 0; }
|
||||
RuleMatcherState() { orig_match_state = resp_match_state = nullptr; }
|
||||
~RuleMatcherState()
|
||||
{ delete orig_match_state; delete resp_match_state; }
|
||||
|
||||
// ip may be nil.
|
||||
void InitEndpointMatcher(analyzer::Analyzer* analyzer, const IP_Hdr* ip,
|
||||
int caplen, bool from_orig, analyzer::pia::PIA* pia = 0);
|
||||
int caplen, bool from_orig, analyzer::pia::PIA* pia = nullptr);
|
||||
|
||||
// bol/eol should be set to false for type Rule::PAYLOAD; they're
|
||||
// deduced automatically.
|
||||
|
|
10
src/Scope.cc
10
src/Scope.cc
|
@ -20,7 +20,7 @@ Scope::Scope(IntrusivePtr<ID> id, attr_list* al)
|
|||
: scope_id(std::move(id))
|
||||
{
|
||||
attrs = al;
|
||||
return_type = 0;
|
||||
return_type = nullptr;
|
||||
|
||||
inits = new id_list;
|
||||
|
||||
|
@ -65,7 +65,7 @@ ID* Scope::GenerateTemporary(const char* name)
|
|||
id_list* Scope::GetInits()
|
||||
{
|
||||
id_list* ids = inits;
|
||||
inits = 0;
|
||||
inits = nullptr;
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
@ -76,9 +76,9 @@ void Scope::Describe(ODesc* d) const
|
|||
|
||||
else
|
||||
{
|
||||
d->Add(scope_id != 0);
|
||||
d->Add(scope_id != nullptr);
|
||||
d->SP();
|
||||
d->Add(return_type != 0);
|
||||
d->Add(return_type != nullptr);
|
||||
d->SP();
|
||||
d->Add(static_cast<uint64_t>(local.size()));
|
||||
d->SP();
|
||||
|
@ -149,7 +149,7 @@ IntrusivePtr<ID> lookup_ID(const char* name, const char* curr_module,
|
|||
return {NewRef{}, id};
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
|
||||
|
|
|
@ -29,7 +29,7 @@ void SerializationFormat::StartRead(const char* data, uint32_t arg_len)
|
|||
|
||||
void SerializationFormat::EndRead()
|
||||
{
|
||||
input = 0;
|
||||
input = nullptr;
|
||||
}
|
||||
|
||||
void SerializationFormat::StartWrite()
|
||||
|
@ -37,7 +37,7 @@ void SerializationFormat::StartWrite()
|
|||
if ( output && output_size > INITIAL_SIZE )
|
||||
{
|
||||
free(output);
|
||||
output = 0;
|
||||
output = nullptr;
|
||||
}
|
||||
|
||||
if ( ! output )
|
||||
|
@ -54,7 +54,7 @@ uint32_t SerializationFormat::EndWrite(char** data)
|
|||
{
|
||||
uint32_t rval = output_pos;
|
||||
*data = output;
|
||||
output = 0;
|
||||
output = nullptr;
|
||||
output_size = 0;
|
||||
output_pos = 0;
|
||||
return rval;
|
||||
|
@ -193,7 +193,7 @@ bool BinarySerializationFormat::Read(char** str, int* len, const char* tag)
|
|||
if ( ! ReadData(s, l) )
|
||||
{
|
||||
delete [] s;
|
||||
*str = 0;
|
||||
*str = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,16 +68,16 @@ NetSessions::NetSessions()
|
|||
if ( stp_correlate_pair )
|
||||
stp_manager = new analyzer::stepping_stone::SteppingStoneManager();
|
||||
else
|
||||
stp_manager = 0;
|
||||
stp_manager = nullptr;
|
||||
|
||||
discarder = new Discarder();
|
||||
if ( ! discarder->IsActive() )
|
||||
{
|
||||
delete discarder;
|
||||
discarder = 0;
|
||||
discarder = nullptr;
|
||||
}
|
||||
|
||||
packet_filter = 0;
|
||||
packet_filter = nullptr;
|
||||
|
||||
dump_this_packet = false;
|
||||
num_packets_processed = 0;
|
||||
|
@ -86,12 +86,12 @@ NetSessions::NetSessions()
|
|||
pkt_profiler = new PacketProfiler(pkt_profile_mode,
|
||||
pkt_profile_freq, pkt_profile_file->AsFile());
|
||||
else
|
||||
pkt_profiler = 0;
|
||||
pkt_profiler = nullptr;
|
||||
|
||||
if ( arp_request || arp_reply || bad_arp )
|
||||
arp_analyzer = new analyzer::arp::ARP_Analyzer();
|
||||
else
|
||||
arp_analyzer = 0;
|
||||
arp_analyzer = nullptr;
|
||||
|
||||
memset(&stats, 0, sizeof(SessionStats));
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void NetSessions::NextPacket(double t, const Packet* pkt)
|
|||
|
||||
const struct ip* ip = (const struct ip*) (pkt->data + pkt->hdr_size);
|
||||
IP_Hdr ip_hdr(ip, false);
|
||||
DoNextPacket(t, pkt, &ip_hdr, 0);
|
||||
DoNextPacket(t, pkt, &ip_hdr, nullptr);
|
||||
}
|
||||
|
||||
else if ( pkt->l3_proto == L3_IPV6 )
|
||||
|
@ -165,7 +165,7 @@ void NetSessions::NextPacket(double t, const Packet* pkt)
|
|||
}
|
||||
|
||||
IP_Hdr ip_hdr((const struct ip6_hdr*) (pkt->data + pkt->hdr_size), false, caplen);
|
||||
DoNextPacket(t, pkt, &ip_hdr, 0);
|
||||
DoNextPacket(t, pkt, &ip_hdr, nullptr);
|
||||
}
|
||||
|
||||
else if ( pkt->l3_proto == L3_ARP )
|
||||
|
@ -261,7 +261,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
|||
if ( discarder && discarder->NextPacket(ip_hdr, len, caplen) )
|
||||
return;
|
||||
|
||||
FragReassembler* f = 0;
|
||||
FragReassembler* f = nullptr;
|
||||
|
||||
if ( ip_hdr->IsFragment() )
|
||||
{
|
||||
|
@ -574,7 +574,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
|||
return;
|
||||
}
|
||||
|
||||
IP_Hdr* inner = 0;
|
||||
IP_Hdr* inner = nullptr;
|
||||
|
||||
if ( gre_version != 0 )
|
||||
{
|
||||
|
@ -662,7 +662,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
|||
// We already know that connection.
|
||||
if ( conn->IsReuse(t, data) )
|
||||
{
|
||||
conn->Event(connection_reused, 0);
|
||||
conn->Event(connection_reused, nullptr);
|
||||
|
||||
Remove(conn);
|
||||
conn = NewConn(key, t, &id, data, proto, ip_hdr->FlowLabel(), pkt, encapsulation);
|
||||
|
@ -686,16 +686,16 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
|||
|
||||
conn->CheckFlowLabel(is_orig, ip_hdr->FlowLabel());
|
||||
|
||||
Val* pkt_hdr_val = 0;
|
||||
Val* pkt_hdr_val = nullptr;
|
||||
|
||||
if ( ipv6_ext_headers && ip_hdr->NumHeaders() > 1 )
|
||||
{
|
||||
pkt_hdr_val = ip_hdr->BuildPktHdrVal();
|
||||
conn->Event(ipv6_ext_headers, 0, pkt_hdr_val);
|
||||
conn->Event(ipv6_ext_headers, nullptr, pkt_hdr_val);
|
||||
}
|
||||
|
||||
if ( new_packet )
|
||||
conn->Event(new_packet, 0,
|
||||
conn->Event(new_packet, nullptr,
|
||||
pkt_hdr_val ? pkt_hdr_val->Ref() : ip_hdr->BuildPktHdrVal());
|
||||
|
||||
conn->NextPacket(t, is_orig, ip_hdr, len, caplen, data,
|
||||
|
@ -739,7 +739,7 @@ void NetSessions::DoNextInnerPacket(double t, const Packet* pkt,
|
|||
((network_time - (double)ts.tv_sec) * 1000000);
|
||||
}
|
||||
|
||||
const u_char* data = 0;
|
||||
const u_char* data = nullptr;
|
||||
|
||||
if ( inner->IP4_Hdr() )
|
||||
data = (const u_char*) inner->IP4_Hdr();
|
||||
|
@ -906,7 +906,7 @@ Connection* NetSessions::FindConnection(Val* v)
|
|||
{
|
||||
BroType* vt = v->Type();
|
||||
if ( ! IsRecord(vt->Tag()) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
RecordType* vr = vt->AsRecordType();
|
||||
const val_list* vl = v->AsRecord();
|
||||
|
@ -931,7 +931,7 @@ Connection* NetSessions::FindConnection(Val* v)
|
|||
resp_p = vr->FieldOffset("resp_p");
|
||||
|
||||
if ( orig_h < 0 || resp_h < 0 || orig_p < 0 || resp_p < 0 )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// ### we ought to check that the fields have the right
|
||||
// types, too.
|
||||
|
@ -967,7 +967,7 @@ Connection* NetSessions::FindConnection(Val* v)
|
|||
// This can happen due to pseudo-connections we
|
||||
// construct, for example for packet headers embedded
|
||||
// in ICMPs.
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Connection* conn = nullptr;
|
||||
|
@ -1151,7 +1151,7 @@ Connection* NetSessions::NewConn(const ConnIDKey& k, double t, const ConnID* id,
|
|||
break;
|
||||
default:
|
||||
reporter->InternalWarning("unknown transport protocol");
|
||||
return 0;
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
if ( tproto == TRANSPORT_TCP )
|
||||
|
@ -1163,7 +1163,7 @@ Connection* NetSessions::NewConn(const ConnIDKey& k, double t, const ConnID* id,
|
|||
bool flip = false;
|
||||
|
||||
if ( ! WantConnection(src_h, dst_h, tproto, flags, flip) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
Connection* conn = new Connection(this, k, t, id, flow_label, pkt, encapsulation);
|
||||
conn->SetTransport(tproto);
|
||||
|
@ -1175,11 +1175,11 @@ Connection* NetSessions::NewConn(const ConnIDKey& k, double t, const ConnID* id,
|
|||
{
|
||||
conn->Done();
|
||||
Unref(conn);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( new_connection )
|
||||
conn->Event(new_connection, 0);
|
||||
conn->Event(new_connection, nullptr);
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
|
|
@ -75,9 +75,9 @@ public:
|
|||
void GetStats(SessionStats& s) const;
|
||||
|
||||
void Weird(const char* name, const Packet* pkt,
|
||||
const EncapsulationStack* encap = 0, const char* addl = "");
|
||||
const EncapsulationStack* encap = nullptr, const char* addl = "");
|
||||
void Weird(const char* name, const IP_Hdr* ip,
|
||||
const EncapsulationStack* encap = 0, const char* addl = "");
|
||||
const EncapsulationStack* encap = nullptr, const char* addl = "");
|
||||
|
||||
PacketFilter* GetPacketFilter()
|
||||
{
|
||||
|
|
|
@ -61,22 +61,22 @@ VectorVal* BroSubstring::VecToPolicy(Vec* vec)
|
|||
RecordType* sw_substring_type =
|
||||
internal_type("sw_substring")->AsRecordType();
|
||||
if ( ! sw_substring_type )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
RecordType* sw_align_type =
|
||||
internal_type("sw_align")->AsRecordType();
|
||||
if ( ! sw_align_type )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
VectorType* sw_align_vec_type =
|
||||
internal_type("sw_align_vec")->AsVectorType();
|
||||
if ( ! sw_align_vec_type )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
VectorVal* result =
|
||||
new VectorVal(internal_type("sw_substring_vec")->AsVectorType());
|
||||
if ( ! result )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( vec )
|
||||
{
|
||||
|
@ -235,9 +235,9 @@ public:
|
|||
{
|
||||
// Make sure access is in allowed range.
|
||||
if ( row < 0 || row >= _rows )
|
||||
return 0;
|
||||
return nullptr;
|
||||
if ( col < 0 || col >= _cols )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return &(_nodes[row * _cols + col]);
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ static void sw_collect_multiple(BroSubstring::Vec* result,
|
|||
{
|
||||
BroSubstring::Vec* old_al = *it;
|
||||
|
||||
if ( old_al == 0 )
|
||||
if ( old_al == nullptr )
|
||||
continue;
|
||||
|
||||
for ( BroSubstring::VecIt it2 = old_al->begin();
|
||||
|
@ -372,7 +372,7 @@ static void sw_collect_multiple(BroSubstring::Vec* result,
|
|||
{
|
||||
delete_each(new_al);
|
||||
delete new_al;
|
||||
new_al = 0;
|
||||
new_al = nullptr;
|
||||
goto end_loop;
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ end_loop:
|
|||
{
|
||||
BroSubstring::Vec* al = *it;
|
||||
|
||||
if ( al == 0 )
|
||||
if ( al == nullptr )
|
||||
continue;
|
||||
|
||||
for ( BroSubstring::VecIt it2 = al->begin();
|
||||
|
@ -432,8 +432,8 @@ BroSubstring::Vec* smith_waterman(const BroString* s1, const BroString* s2,
|
|||
byte_vec string2 = s2->Bytes();
|
||||
|
||||
SWNodeMatrix matrix(s1, s2); // dynamic programming matrix.
|
||||
SWNode* node_max = 0; // pointer to the best score's node
|
||||
SWNode* node_br_max = 0; // pointer to lowest-right matching node
|
||||
SWNode* node_max = nullptr; // pointer to the best score's node
|
||||
SWNode* node_br_max = nullptr; // pointer to lowest-right matching node
|
||||
|
||||
// The highest score in the matrix, globally. We initialize to 1
|
||||
// because we are only interested in real scores (initializing to
|
||||
|
|
10
src/Stats.cc
10
src/Stats.cc
|
@ -339,7 +339,7 @@ void ProfileLogger::SegmentProfile(const char* name, const Location* loc,
|
|||
|
||||
SampleLogger::SampleLogger()
|
||||
{
|
||||
static TableType* load_sample_info = 0;
|
||||
static TableType* load_sample_info = nullptr;
|
||||
|
||||
if ( ! load_sample_info )
|
||||
load_sample_info = internal_type("load_sample_info")->AsTableType();
|
||||
|
@ -355,14 +355,14 @@ SampleLogger::~SampleLogger()
|
|||
void SampleLogger::FunctionSeen(const Func* func)
|
||||
{
|
||||
Val* idx = new StringVal(func->Name());
|
||||
load_samples->Assign(idx, 0);
|
||||
load_samples->Assign(idx, nullptr);
|
||||
Unref(idx);
|
||||
}
|
||||
|
||||
void SampleLogger::LocationSeen(const Location* loc)
|
||||
{
|
||||
Val* idx = new StringVal(loc->filename);
|
||||
load_samples->Assign(idx, 0);
|
||||
load_samples->Assign(idx, nullptr);
|
||||
Unref(idx);
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ void PacketProfiler::ProfilePkt(double t, unsigned int bytes)
|
|||
getrusage(RUSAGE_SELF, &res);
|
||||
gettimeofday(&ptimestamp, 0);
|
||||
|
||||
get_memory_usage(&last_mem, 0);
|
||||
get_memory_usage(&last_mem, nullptr);
|
||||
last_Utime = res.ru_utime.tv_sec + res.ru_utime.tv_usec / 1e6;
|
||||
last_Stime = res.ru_stime.tv_sec + res.ru_stime.tv_usec / 1e6;
|
||||
last_Rtime = ptimestamp.tv_sec + ptimestamp.tv_usec / 1e6;
|
||||
|
@ -462,7 +462,7 @@ void PacketProfiler::ProfilePkt(double t, unsigned int bytes)
|
|||
ptimestamp.tv_sec + ptimestamp.tv_usec / 1e6;
|
||||
|
||||
uint64_t curr_mem;
|
||||
get_memory_usage(&curr_mem, 0);
|
||||
get_memory_usage(&curr_mem, nullptr);
|
||||
|
||||
file->Write(fmt("%.06f %.03f %" PRIu64 " %" PRIu64 " %.03f %.03f %.03f %" PRIu64 "\n",
|
||||
t, time-last_timestamp, pkt_cnt, byte_cnt,
|
||||
|
|
26
src/Stmt.cc
26
src/Stmt.cc
|
@ -182,7 +182,7 @@ TraversalCode ExprListStmt::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
static BroFile* print_stdout = 0;
|
||||
static BroFile* print_stdout = nullptr;
|
||||
|
||||
static IntrusivePtr<EnumVal> lookup_enum_val(const char* module_name, const char* name)
|
||||
{
|
||||
|
@ -629,7 +629,7 @@ SwitchStmt::SwitchStmt(IntrusivePtr<Expr> index, case_list* arg_cases)
|
|||
NegExpr* ne = (NegExpr*)(expr);
|
||||
|
||||
if ( ne->Op()->IsConst() )
|
||||
Unref(exprs.replace(j, new ConstExpr(ne->Eval(0))));
|
||||
Unref(exprs.replace(j, new ConstExpr(ne->Eval(nullptr))));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -638,7 +638,7 @@ SwitchStmt::SwitchStmt(IntrusivePtr<Expr> index, case_list* arg_cases)
|
|||
PosExpr* pe = (PosExpr*)(expr);
|
||||
|
||||
if ( pe->Op()->IsConst() )
|
||||
Unref(exprs.replace(j, new ConstExpr(pe->Eval(0))));
|
||||
Unref(exprs.replace(j, new ConstExpr(pe->Eval(nullptr))));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -648,7 +648,7 @@ SwitchStmt::SwitchStmt(IntrusivePtr<Expr> index, case_list* arg_cases)
|
|||
|
||||
if ( ne->Id()->IsConst() )
|
||||
{
|
||||
auto v = ne->Eval(0);
|
||||
auto v = ne->Eval(nullptr);
|
||||
|
||||
if ( v )
|
||||
Unref(exprs.replace(j, new ConstExpr(std::move(v))));
|
||||
|
@ -757,7 +757,7 @@ bool SwitchStmt::AddCaseLabelTypeMapping(ID* t, int idx)
|
|||
std::pair<int, ID*> SwitchStmt::FindCaseLabelMatch(const Val* v) const
|
||||
{
|
||||
int label_idx = -1;
|
||||
ID* label_id = 0;
|
||||
ID* label_id = nullptr;
|
||||
|
||||
// Find matching expression cases.
|
||||
if ( case_label_value_map.Length() )
|
||||
|
@ -1065,7 +1065,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
|||
: ExprStmt(STMT_FOR, std::move(loop_expr))
|
||||
{
|
||||
loop_vars = arg_loop_vars;
|
||||
body = 0;
|
||||
body = nullptr;
|
||||
|
||||
if ( e->Type()->Tag() == TYPE_TABLE )
|
||||
{
|
||||
|
@ -1090,7 +1090,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
|||
{
|
||||
add_local({NewRef{}, (*loop_vars)[i]},
|
||||
{NewRef{}, ind_type}, INIT_NONE,
|
||||
0, 0, VAR_REGULAR);
|
||||
nullptr, nullptr, VAR_REGULAR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
|||
BroType* t = (*loop_vars)[0]->Type();
|
||||
if ( ! t )
|
||||
add_local({NewRef{}, (*loop_vars)[0]}, base_type(TYPE_COUNT),
|
||||
INIT_NONE, 0, 0, VAR_REGULAR);
|
||||
INIT_NONE, nullptr, nullptr, VAR_REGULAR);
|
||||
|
||||
else if ( ! IsIntegral(t->Tag()) )
|
||||
{
|
||||
|
@ -1127,7 +1127,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
|||
if ( ! t )
|
||||
add_local({NewRef{}, (*loop_vars)[0]},
|
||||
base_type(TYPE_STRING),
|
||||
INIT_NONE, 0, 0, VAR_REGULAR);
|
||||
INIT_NONE, nullptr, nullptr, VAR_REGULAR);
|
||||
|
||||
else if ( t->Tag() != TYPE_STRING )
|
||||
{
|
||||
|
@ -1158,7 +1158,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars,
|
|||
else
|
||||
{
|
||||
add_local(value_var, {NewRef{}, yield_type}, INIT_NONE,
|
||||
0, 0, VAR_REGULAR);
|
||||
nullptr, nullptr, VAR_REGULAR);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1471,7 +1471,7 @@ void ReturnStmt::Describe(ODesc* d) const
|
|||
{
|
||||
Stmt::Describe(d);
|
||||
if ( ! d->IsReadable() )
|
||||
d->Add(e != 0);
|
||||
d->Add(e != nullptr);
|
||||
|
||||
if ( e )
|
||||
{
|
||||
|
@ -1600,7 +1600,7 @@ IntrusivePtr<Val> EventBodyList::Exec(Frame* f, stmt_flow_type& flow) const
|
|||
|
||||
// Simulate a return so the hooks operate properly.
|
||||
stmt_flow_type ft = FLOW_RETURN;
|
||||
(void) post_execute_stmt(f->GetNextStmt(), f, 0, &ft);
|
||||
(void) post_execute_stmt(f->GetNextStmt(), f, nullptr, &ft);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1656,7 +1656,7 @@ IntrusivePtr<Val> InitStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
|||
{
|
||||
BroType* t = aggr->Type();
|
||||
|
||||
Val* v = 0;
|
||||
Val* v = nullptr;
|
||||
|
||||
switch ( t->Tag() ) {
|
||||
case TYPE_RECORD:
|
||||
|
|
|
@ -41,13 +41,13 @@ Tag::Tag()
|
|||
{
|
||||
type = 0;
|
||||
subtype = 0;
|
||||
val = 0;
|
||||
val = nullptr;
|
||||
}
|
||||
|
||||
Tag::~Tag()
|
||||
{
|
||||
Unref(val);
|
||||
val = 0;
|
||||
val = nullptr;
|
||||
}
|
||||
|
||||
Tag& Tag::operator=(const Tag& other)
|
||||
|
|
|
@ -12,7 +12,7 @@ class ID;
|
|||
|
||||
class TraversalCallback {
|
||||
public:
|
||||
TraversalCallback() { current_scope = 0; }
|
||||
TraversalCallback() { current_scope = nullptr; }
|
||||
virtual ~TraversalCallback() {}
|
||||
|
||||
virtual TraversalCode PreFunction(const Func*) { return TC_CONTINUE; }
|
||||
|
|
|
@ -130,10 +130,10 @@ Trigger::Trigger(Expr* arg_cond, Stmt* arg_body, Stmt* arg_timeout_stmts,
|
|||
timeout_stmts = arg_timeout_stmts;
|
||||
timeout = arg_timeout;
|
||||
frame = arg_frame->Clone();
|
||||
timer = 0;
|
||||
timer = nullptr;
|
||||
delayed = false;
|
||||
disabled = false;
|
||||
attached = 0;
|
||||
attached = nullptr;
|
||||
is_return = arg_is_return;
|
||||
location = arg_location;
|
||||
timeout_value = -1;
|
||||
|
|
|
@ -129,7 +129,7 @@ protected:
|
|||
*/
|
||||
class EncapsulationStack {
|
||||
public:
|
||||
EncapsulationStack() : conns(0)
|
||||
EncapsulationStack() : conns(nullptr)
|
||||
{}
|
||||
|
||||
EncapsulationStack(const EncapsulationStack& other)
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
if ( other.conns )
|
||||
conns = new vector<EncapsulatingConn>(*(other.conns));
|
||||
else
|
||||
conns = 0;
|
||||
conns = nullptr;
|
||||
}
|
||||
|
||||
EncapsulationStack& operator=(const EncapsulationStack& other)
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
if ( other.conns )
|
||||
conns = new vector<EncapsulatingConn>(*(other.conns));
|
||||
else
|
||||
conns = 0;
|
||||
conns = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
14
src/Type.cc
14
src/Type.cc
|
@ -541,7 +541,7 @@ void FuncType::Describe(ODesc* d) const
|
|||
{
|
||||
d->Add(int(Tag()));
|
||||
d->Add(flavor);
|
||||
d->Add(yield != 0);
|
||||
d->Add(yield != nullptr);
|
||||
args->DescribeFields(d);
|
||||
if ( yield )
|
||||
yield->Describe(d);
|
||||
|
@ -648,7 +648,7 @@ bool RecordType::HasField(const char* field) const
|
|||
BroType* RecordType::FieldType(const char* field) const
|
||||
{
|
||||
int offset = FieldOffset(field);
|
||||
return offset >= 0 ? FieldType(offset) : 0;
|
||||
return offset >= 0 ? FieldType(offset) : nullptr;
|
||||
}
|
||||
|
||||
BroType* RecordType::FieldType(int field) const
|
||||
|
@ -783,7 +783,7 @@ IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
|||
if ( fv )
|
||||
::Ref(fv);
|
||||
|
||||
bool logged = (fd->attrs && fd->FindAttr(ATTR_LOG) != 0);
|
||||
bool logged = (fd->attrs && fd->FindAttr(ATTR_LOG) != nullptr);
|
||||
|
||||
auto nr = make_intrusive<RecordVal>(internal_type("record_field")->AsRecordType());
|
||||
|
||||
|
@ -1575,10 +1575,10 @@ bool same_type(const BroType* t1, const BroType* t2, bool is_init, bool match_re
|
|||
bool same_attrs(const Attributes* a1, const Attributes* a2)
|
||||
{
|
||||
if ( ! a1 )
|
||||
return (a2 == 0);
|
||||
return (a2 == nullptr);
|
||||
|
||||
if ( ! a2 )
|
||||
return (a1 == 0);
|
||||
return (a1 == nullptr);
|
||||
|
||||
return (*a1 == *a2);
|
||||
}
|
||||
|
@ -2023,7 +2023,7 @@ IntrusivePtr<BroType> init_type(Expr* init)
|
|||
// Could be a record, a set, or a list of table elements.
|
||||
Expr* e0 = el[0];
|
||||
|
||||
if ( e0->IsRecordElement(0) )
|
||||
if ( e0->IsRecordElement(nullptr) )
|
||||
// ListExpr's know how to build a record from their
|
||||
// components.
|
||||
return init_list->InitType();
|
||||
|
@ -2039,7 +2039,7 @@ IntrusivePtr<BroType> init_type(Expr* init)
|
|||
for ( int i = 1; t && i < el.length(); ++i )
|
||||
{
|
||||
auto el_t = el[i]->InitType();
|
||||
BroType* ti = el_t ? reduce_type(el_t.get()) : 0;
|
||||
BroType* ti = el_t ? reduce_type(el_t.get()) : nullptr;
|
||||
|
||||
if ( ! ti )
|
||||
return nullptr;
|
||||
|
|
16
src/Type.h
16
src/Type.h
|
@ -304,12 +304,12 @@ public:
|
|||
|
||||
bool IsSet() const
|
||||
{
|
||||
return tag == TYPE_TABLE && (YieldType() == 0);
|
||||
return tag == TYPE_TABLE && (YieldType() == nullptr);
|
||||
}
|
||||
|
||||
bool IsTable() const
|
||||
{
|
||||
return tag == TYPE_TABLE && (YieldType() != 0);
|
||||
return tag == TYPE_TABLE && (YieldType() != nullptr);
|
||||
}
|
||||
|
||||
BroType* Ref() { ::Ref(this); return this; }
|
||||
|
@ -357,7 +357,7 @@ public:
|
|||
const type_list* Types() const { return &types; }
|
||||
type_list* Types() { return &types; }
|
||||
|
||||
bool IsPure() const { return pure_type != 0; }
|
||||
bool IsPure() const { return pure_type != nullptr; }
|
||||
|
||||
// Returns the underlying pure type, or nil if the list
|
||||
// is not pure or is empty.
|
||||
|
@ -485,12 +485,12 @@ protected:
|
|||
|
||||
class TypeDecl final {
|
||||
public:
|
||||
TypeDecl(IntrusivePtr<BroType> t, const char* i, attr_list* attrs = 0, bool in_record = false);
|
||||
TypeDecl(IntrusivePtr<BroType> t, const char* i, attr_list* attrs = nullptr, bool in_record = false);
|
||||
TypeDecl(const TypeDecl& other);
|
||||
~TypeDecl();
|
||||
|
||||
const Attr* FindAttr(attr_tag a) const
|
||||
{ return attrs ? attrs->FindAttr(a) : 0; }
|
||||
{ return attrs ? attrs->FindAttr(a) : nullptr; }
|
||||
|
||||
void DescribeReST(ODesc* d, bool roles_only = false) const;
|
||||
|
||||
|
@ -547,19 +547,19 @@ public:
|
|||
bool IsFieldDeprecated(int field) const
|
||||
{
|
||||
const TypeDecl* decl = FieldDecl(field);
|
||||
return decl && decl->FindAttr(ATTR_DEPRECATED) != 0;
|
||||
return decl && decl->FindAttr(ATTR_DEPRECATED) != nullptr;
|
||||
}
|
||||
|
||||
bool FieldHasAttr(int field, attr_tag at) const
|
||||
{
|
||||
const TypeDecl* decl = FieldDecl(field);
|
||||
return decl && decl->FindAttr(at) != 0;
|
||||
return decl && decl->FindAttr(at) != nullptr;
|
||||
}
|
||||
|
||||
std::string GetFieldDeprecationWarning(int field, bool has_check) const;
|
||||
|
||||
protected:
|
||||
RecordType() { types = 0; }
|
||||
RecordType() { types = nullptr; }
|
||||
|
||||
int num_fields;
|
||||
type_decl_list* types;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
* Construct a UID of a given bit-length, optionally from given values.
|
||||
* @see UID::Set
|
||||
*/
|
||||
explicit UID(bro_uint_t bits, const uint64_t* v = 0, size_t n = 0)
|
||||
explicit UID(bro_uint_t bits, const uint64_t* v = nullptr, size_t n = 0)
|
||||
{ Set(bits, v, n); }
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
* 64, then a value is truncated to bit in desired bit-length.
|
||||
* @param n number of 64-bit elements in array pointed to by \a v.
|
||||
*/
|
||||
void Set(bro_uint_t bits, const uint64_t* v = 0, size_t n = 0);
|
||||
void Set(bro_uint_t bits, const uint64_t* v = nullptr, size_t n = 0);
|
||||
|
||||
/**
|
||||
* Returns a base62 (characters 0-9, A-Z, a-z) representation of the UID.
|
||||
|
|
46
src/Val.cc
46
src/Val.cc
|
@ -48,7 +48,7 @@ Val::Val(Func* f)
|
|||
|
||||
static FileType* GetStringFileType() noexcept
|
||||
{
|
||||
static FileType* string_file_type = 0;
|
||||
static FileType* string_file_type = nullptr;
|
||||
if ( ! string_file_type )
|
||||
string_file_type = new FileType(base_type(TYPE_STRING));
|
||||
return string_file_type;
|
||||
|
@ -366,13 +366,13 @@ void Val::ValDescribeReST(ODesc* d) const
|
|||
#ifdef DEBUG
|
||||
ID* Val::GetID() const
|
||||
{
|
||||
return bound_id ? global_scope()->Lookup(bound_id) : 0;
|
||||
return bound_id ? global_scope()->Lookup(bound_id) : nullptr;
|
||||
}
|
||||
|
||||
void Val::SetID(ID* id)
|
||||
{
|
||||
delete [] bound_id;
|
||||
bound_id = id ? copy_string(id->Name()) : 0;
|
||||
bound_id = id ? copy_string(id->Name()) : nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1233,7 +1233,7 @@ TableVal* ListVal::ConvertToSet() const
|
|||
TableVal* t = new TableVal(std::move(s));
|
||||
|
||||
for ( const auto& val : vals )
|
||||
t->Assign(val, 0);
|
||||
t->Assign(val, nullptr);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
@ -1381,16 +1381,16 @@ TableVal::TableVal(IntrusivePtr<TableType> t, IntrusivePtr<Attributes> a) : Val(
|
|||
void TableVal::Init(IntrusivePtr<TableType> t)
|
||||
{
|
||||
table_type = std::move(t);
|
||||
expire_func = 0;
|
||||
expire_time = 0;
|
||||
expire_cookie = 0;
|
||||
timer = 0;
|
||||
def_val = 0;
|
||||
expire_func = nullptr;
|
||||
expire_time = nullptr;
|
||||
expire_cookie = nullptr;
|
||||
timer = nullptr;
|
||||
def_val = nullptr;
|
||||
|
||||
if ( table_type->IsSubNetIndex() )
|
||||
subnets = new PrefixTable;
|
||||
else
|
||||
subnets = 0;
|
||||
subnets = nullptr;
|
||||
|
||||
table_hash = new CompositeHash(IntrusivePtr<TypeList>(NewRef{},
|
||||
table_type->Indices()));
|
||||
|
@ -1603,12 +1603,12 @@ bool TableVal::AddTo(Val* val, bool is_first_init, bool propagate_ops) const
|
|||
|
||||
if ( type->IsSet() )
|
||||
{
|
||||
if ( ! t->Assign(v->Value(), k, 0) )
|
||||
if ( ! t->Assign(v->Value(), k, nullptr) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! t->Assign(0, k, {NewRef{}, v->Value()}) )
|
||||
if ( ! t->Assign(nullptr, k, {NewRef{}, v->Value()}) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1804,11 +1804,11 @@ IntrusivePtr<Val> TableVal::Default(Val* index)
|
|||
auto coerce = make_intrusive<RecordCoerceExpr>(
|
||||
IntrusivePtr{NewRef{}, def_attr->AttrExpr()},
|
||||
IntrusivePtr{NewRef{}, ytype->AsRecordType()});
|
||||
def_val = coerce->Eval(0);
|
||||
def_val = coerce->Eval(nullptr);
|
||||
}
|
||||
|
||||
else
|
||||
def_val = def_attr->AttrExpr()->Eval(0);
|
||||
def_val = def_attr->AttrExpr()->Eval(nullptr);
|
||||
}
|
||||
|
||||
if ( ! def_val )
|
||||
|
@ -1942,7 +1942,7 @@ IntrusivePtr<TableVal> TableVal::LookupSubnetValues(const SubNetVal* search)
|
|||
if ( entry && entry->Value() )
|
||||
nt->Assign(s, {NewRef{}, entry->Value()});
|
||||
else
|
||||
nt->Assign(s, 0); // set
|
||||
nt->Assign(s, nullptr); // set
|
||||
|
||||
if ( entry )
|
||||
{
|
||||
|
@ -2050,7 +2050,7 @@ void TableVal::CallChangeFunc(const Val* index, Val* old_value, OnChangeType tpe
|
|||
IntrusivePtr<Val> TableVal::Delete(const Val* index)
|
||||
{
|
||||
HashKey* k = ComputeHash(index);
|
||||
TableEntryVal* v = k ? AsNonConstTable()->RemoveEntry(k) : 0;
|
||||
TableEntryVal* v = k ? AsNonConstTable()->RemoveEntry(k) : nullptr;
|
||||
IntrusivePtr<Val> va{NewRef{}, v ? (v->Value() ? v->Value() : this) : nullptr};
|
||||
|
||||
if ( subnets && ! subnets->Remove(index) )
|
||||
|
@ -2128,7 +2128,7 @@ ListVal* TableVal::ConvertToPureList() const
|
|||
if ( tl->length() != 1 )
|
||||
{
|
||||
InternalWarning("bad index type in TableVal::ConvertToPureList");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ConvertToList((*tl)[0]->Tag());
|
||||
|
@ -2136,7 +2136,7 @@ ListVal* TableVal::ConvertToPureList() const
|
|||
|
||||
Attr* TableVal::FindAttr(attr_tag t) const
|
||||
{
|
||||
return attrs ? attrs->FindAttr(t) : 0;
|
||||
return attrs ? attrs->FindAttr(t) : nullptr;
|
||||
}
|
||||
|
||||
void TableVal::Describe(ODesc* d) const
|
||||
|
@ -2253,7 +2253,7 @@ bool TableVal::ExpandCompoundAndInit(val_list* vl, int k, IntrusivePtr<Val> new_
|
|||
|
||||
bool TableVal::CheckAndAssign(Val* index, IntrusivePtr<Val> new_val)
|
||||
{
|
||||
Val* v = 0;
|
||||
Val* v = nullptr;
|
||||
if ( subnets )
|
||||
// We need an exact match here.
|
||||
v = (Val*) subnets->Lookup(index, true);
|
||||
|
@ -2392,7 +2392,7 @@ void TableVal::DoExpire(double t)
|
|||
|
||||
if ( ! v )
|
||||
{
|
||||
expire_cookie = 0;
|
||||
expire_cookie = nullptr;
|
||||
InitTimer(table_expire_interval);
|
||||
}
|
||||
else
|
||||
|
@ -2419,7 +2419,7 @@ double TableVal::GetExpireTime()
|
|||
if ( interval >= 0 )
|
||||
return interval;
|
||||
|
||||
expire_time = 0;
|
||||
expire_time = nullptr;
|
||||
|
||||
if ( timer )
|
||||
timer_mgr->Cancel(timer);
|
||||
|
@ -2819,7 +2819,7 @@ IntrusivePtr<RecordVal> RecordVal::CoerceTo(RecordType* t, bool allow_orphaning)
|
|||
if ( same_type(Type(), t) )
|
||||
return {NewRef{}, this};
|
||||
|
||||
return CoerceTo(t, 0, allow_orphaning);
|
||||
return CoerceTo(t, nullptr, allow_orphaning);
|
||||
}
|
||||
|
||||
IntrusivePtr<TableVal> RecordVal::GetRecordFieldsVal() const
|
||||
|
@ -2975,7 +2975,7 @@ bool VectorVal::Assign(unsigned int index, IntrusivePtr<Val> element)
|
|||
! same_type(element->Type(), vector_type->YieldType(), false) )
|
||||
return false;
|
||||
|
||||
Val* val_at_index = 0;
|
||||
Val* val_at_index = nullptr;
|
||||
|
||||
if ( index < val.vector_val->size() )
|
||||
val_at_index = (*val.vector_val)[index];
|
||||
|
|
|
@ -310,7 +310,7 @@ public:
|
|||
|
||||
// To be overridden by mutable derived class to enable change
|
||||
// notification.
|
||||
virtual notifier::Modifiable* Modifiable() { return 0; }
|
||||
virtual notifier::Modifiable* Modifiable() { return nullptr; }
|
||||
|
||||
#ifdef DEBUG
|
||||
// For debugging, we keep a reference to the global ID to which a
|
||||
|
@ -804,7 +804,7 @@ public:
|
|||
void ClearTimer(Timer* t)
|
||||
{
|
||||
if ( timer == t )
|
||||
timer = 0;
|
||||
timer = nullptr;
|
||||
}
|
||||
|
||||
HashKey* ComputeHash(const Val* index) const;
|
||||
|
@ -843,7 +843,7 @@ protected:
|
|||
IntrusivePtr<Val> Default(Val* index);
|
||||
|
||||
// Returns true if item expiration is enabled.
|
||||
bool ExpirationEnabled() { return expire_time != 0; }
|
||||
bool ExpirationEnabled() { return expire_time != nullptr; }
|
||||
|
||||
// Returns the expiration time defined by %{create,read,write}_expire
|
||||
// attribute, or -1 for unset/invalid values. In the invalid case, an
|
||||
|
|
|
@ -216,7 +216,7 @@ static void make_var(ID* id, IntrusivePtr<BroType> t, init_class c,
|
|||
// For events, add a function value (without any body) here so that
|
||||
// we can later access the ID even if no implementations have been
|
||||
// defined.
|
||||
Func* f = new BroFunc(id, 0, 0, 0, 0);
|
||||
Func* f = new BroFunc(id, nullptr, nullptr, 0, 0);
|
||||
id->SetVal(make_intrusive<Val>(f));
|
||||
}
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ static void transfer_arg_defaults(RecordType* args, RecordType* recv)
|
|||
TypeDecl* args_i = args->FieldDecl(i);
|
||||
TypeDecl* recv_i = recv->FieldDecl(i);
|
||||
|
||||
Attr* def = args_i->attrs ? args_i->attrs->FindAttr(ATTR_DEFAULT) : 0;
|
||||
Attr* def = args_i->attrs ? args_i->attrs->FindAttr(ATTR_DEFAULT) : nullptr;
|
||||
|
||||
if ( ! def )
|
||||
continue;
|
||||
|
@ -379,7 +379,7 @@ void begin_func(ID* id, const char* module_name, function_flavor flavor,
|
|||
case FUNC_FLAVOR_HOOK:
|
||||
if ( is_redef )
|
||||
// Clear out value so it will be replaced.
|
||||
id->SetVal(0);
|
||||
id->SetVal(nullptr);
|
||||
break;
|
||||
|
||||
case FUNC_FLAVOR_FUNCTION:
|
||||
|
|
|
@ -124,11 +124,11 @@ void Analyzer::CtorInit(const Tag& arg_tag, Connection* arg_conn)
|
|||
skip = false;
|
||||
finished = false;
|
||||
removing = false;
|
||||
parent = 0;
|
||||
orig_supporters = 0;
|
||||
resp_supporters = 0;
|
||||
signature = 0;
|
||||
output_handler = 0;
|
||||
parent = nullptr;
|
||||
orig_supporters = nullptr;
|
||||
resp_supporters = nullptr;
|
||||
signature = nullptr;
|
||||
output_handler = nullptr;
|
||||
}
|
||||
|
||||
Analyzer::~Analyzer()
|
||||
|
@ -138,7 +138,7 @@ Analyzer::~Analyzer()
|
|||
LOOP_OVER_CHILDREN(i)
|
||||
delete *i;
|
||||
|
||||
SupportAnalyzer* next = 0;
|
||||
SupportAnalyzer* next = nullptr;
|
||||
|
||||
for ( SupportAnalyzer* a = orig_supporters; a; a = next )
|
||||
{
|
||||
|
@ -501,7 +501,7 @@ Analyzer* Analyzer::FindChild(ID arg_id)
|
|||
return child;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Analyzer* Analyzer::FindChild(Tag arg_tag)
|
||||
|
@ -523,13 +523,13 @@ Analyzer* Analyzer::FindChild(Tag arg_tag)
|
|||
return child;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Analyzer* Analyzer::FindChild(const char* name)
|
||||
{
|
||||
Tag tag = analyzer_mgr->GetComponentTag(name);
|
||||
return tag ? FindChild(tag) : 0;
|
||||
return tag ? FindChild(tag) : nullptr;
|
||||
}
|
||||
|
||||
void Analyzer::DeleteChild(analyzer_list::iterator i)
|
||||
|
@ -570,7 +570,7 @@ void Analyzer::AddSupportAnalyzer(SupportAnalyzer* analyzer)
|
|||
analyzer->IsOrig() ? &orig_supporters : &resp_supporters;
|
||||
|
||||
// Find end of the list.
|
||||
SupportAnalyzer* prev = 0;
|
||||
SupportAnalyzer* prev = nullptr;
|
||||
SupportAnalyzer* s;
|
||||
for ( s = *head; s; prev = s, s = s->sibling )
|
||||
;
|
||||
|
@ -621,7 +621,7 @@ SupportAnalyzer* Analyzer::FirstSupportAnalyzer(bool orig)
|
|||
SupportAnalyzer* sa = orig ? orig_supporters : resp_supporters;
|
||||
|
||||
if ( ! sa )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( ! sa->Removing() )
|
||||
return sa;
|
||||
|
@ -922,7 +922,7 @@ void TransportLayerAnalyzer::SetContentsFile(unsigned int /* direction */,
|
|||
BroFile* TransportLayerAnalyzer::GetContentsFile(unsigned int /* direction */) const
|
||||
{
|
||||
reporter->Error("analyzer type does not support writing to a contents file");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TransportLayerAnalyzer::PacketContents(const u_char* data, int len)
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
* @param caplen The packet's capture length, if available.
|
||||
*/
|
||||
void NextPacket(int len, const u_char* data, bool is_orig,
|
||||
uint64_t seq = -1, const IP_Hdr* ip = 0, int caplen = 0);
|
||||
uint64_t seq = -1, const IP_Hdr* ip = nullptr, int caplen = 0);
|
||||
|
||||
/**
|
||||
* Passes stream input to the analyzer for processing. The analyzer
|
||||
|
@ -528,7 +528,7 @@ public:
|
|||
* @param len If \a data is given, the length of it.
|
||||
*/
|
||||
virtual void ProtocolViolation(const char* reason,
|
||||
const char* data = 0, int len = 0);
|
||||
const char* data = nullptr, int len = 0);
|
||||
|
||||
/**
|
||||
* Returns true if ProtocolConfirmation() has been called at least
|
||||
|
@ -558,13 +558,13 @@ public:
|
|||
* Convenience function that forwards directly to the corresponding
|
||||
* Connection::Event().
|
||||
*/
|
||||
void Event(EventHandlerPtr f, const char* name = 0);
|
||||
void Event(EventHandlerPtr f, const char* name = nullptr);
|
||||
|
||||
/**
|
||||
* Convenience function that forwards directly to the corresponding
|
||||
* Connection::Event().
|
||||
*/
|
||||
void Event(EventHandlerPtr f, Val* v1, Val* v2 = 0);
|
||||
void Event(EventHandlerPtr f, Val* v1, Val* v2 = nullptr);
|
||||
|
||||
/**
|
||||
* Convenience function that forwards directly to
|
||||
|
@ -796,7 +796,7 @@ public:
|
|||
* connection originator side, and otherwise for the responder side.
|
||||
*/
|
||||
SupportAnalyzer(const char* name, Connection* conn, bool arg_orig)
|
||||
: Analyzer(name, conn) { orig = arg_orig; sibling = 0; }
|
||||
: Analyzer(name, conn) { orig = arg_orig; sibling = nullptr; }
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
@ -879,7 +879,7 @@ public:
|
|||
* @param conn The connection the analyzer is associated with.
|
||||
*/
|
||||
TransportLayerAnalyzer(const char* name, Connection* conn)
|
||||
: Analyzer(name, conn) { pia = 0; }
|
||||
: Analyzer(name, conn) { pia = nullptr; }
|
||||
|
||||
/**
|
||||
* Overridden from parent class.
|
||||
|
|
|
@ -292,17 +292,17 @@ Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, Connection* conn)
|
|||
if ( ! c )
|
||||
{
|
||||
reporter->InternalWarning("request to instantiate unknown analyzer");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( ! c->Enabled() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( ! c->Factory() )
|
||||
{
|
||||
reporter->InternalWarning("analyzer %s cannot be instantiated dynamically",
|
||||
GetComponentName(tag).c_str());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Analyzer* a = c->Factory()(conn);
|
||||
|
@ -310,7 +310,7 @@ Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, Connection* conn)
|
|||
if ( ! a )
|
||||
{
|
||||
reporter->InternalWarning("analyzer instantiation failed");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
a->SetAnalyzerTag(tag);
|
||||
|
@ -321,12 +321,12 @@ Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, Connection* conn)
|
|||
Analyzer* Manager::InstantiateAnalyzer(const char* name, Connection* conn)
|
||||
{
|
||||
Tag tag = GetComponentTag(name);
|
||||
return tag ? InstantiateAnalyzer(tag, conn) : 0;
|
||||
return tag ? InstantiateAnalyzer(tag, conn) : nullptr;
|
||||
}
|
||||
|
||||
Manager::tag_set* Manager::LookupPort(TransportProto proto, uint32_t port, bool add_if_not_found)
|
||||
{
|
||||
analyzer_map_by_port* m = 0;
|
||||
analyzer_map_by_port* m = nullptr;
|
||||
|
||||
switch ( proto ) {
|
||||
case TRANSPORT_TCP:
|
||||
|
@ -339,7 +339,7 @@ Manager::tag_set* Manager::LookupPort(TransportProto proto, uint32_t port, bool
|
|||
|
||||
default:
|
||||
reporter->InternalWarning("unsupported transport protocol in analyzer::Manager::LookupPort");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
analyzer_map_by_port::const_iterator i = m->find(port);
|
||||
|
@ -348,7 +348,7 @@ Manager::tag_set* Manager::LookupPort(TransportProto proto, uint32_t port, bool
|
|||
return i->second;
|
||||
|
||||
if ( ! add_if_not_found )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
tag_set* l = new tag_set;
|
||||
m->insert(std::make_pair(port, l));
|
||||
|
@ -362,11 +362,11 @@ Manager::tag_set* Manager::LookupPort(PortVal* val, bool add_if_not_found)
|
|||
|
||||
bool Manager::BuildInitialAnalyzerTree(Connection* conn)
|
||||
{
|
||||
tcp::TCP_Analyzer* tcp = 0;
|
||||
udp::UDP_Analyzer* udp = 0;
|
||||
icmp::ICMP_Analyzer* icmp = 0;
|
||||
TransportLayerAnalyzer* root = 0;
|
||||
pia::PIA* pia = 0;
|
||||
tcp::TCP_Analyzer* tcp = nullptr;
|
||||
udp::UDP_Analyzer* udp = nullptr;
|
||||
icmp::ICMP_Analyzer* icmp = nullptr;
|
||||
TransportLayerAnalyzer* root = nullptr;
|
||||
pia::PIA* pia = nullptr;
|
||||
bool check_port = false;
|
||||
|
||||
switch ( conn->ConnTransport() ) {
|
||||
|
@ -628,7 +628,7 @@ bool Manager::ApplyScheduledAnalyzers(Connection* conn, bool init, TransportLaye
|
|||
|
||||
EnumVal* tag = it->AsEnumVal();
|
||||
Ref(tag);
|
||||
conn->Event(scheduled_analyzer_applied, 0, tag);
|
||||
conn->Event(scheduled_analyzer_applied, nullptr, tag);
|
||||
|
||||
DBG_ANALYZER_ARGS(conn, "activated %s analyzer as scheduled",
|
||||
analyzer_mgr->GetComponentName(*it).c_str());
|
||||
|
|
|
@ -311,7 +311,7 @@ public:
|
|||
*
|
||||
* @return True if at least one scheduled analyzer was found.
|
||||
*/
|
||||
bool ApplyScheduledAnalyzers(Connection* conn, bool init_and_event = true, TransportLayerAnalyzer* parent = 0);
|
||||
bool ApplyScheduledAnalyzers(Connection* conn, bool init_and_event = true, TransportLayerAnalyzer* parent = nullptr);
|
||||
|
||||
/**
|
||||
* Schedules a particular analyzer for an upcoming connection. Once
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
using namespace analyzer::bittorrent;
|
||||
|
||||
static TableType* bt_tracker_headers = 0;
|
||||
static TableType* bt_tracker_headers = nullptr;
|
||||
static RecordType* bittorrent_peer;
|
||||
static TableType* bittorrent_peer_set;
|
||||
static RecordType* bittorrent_benc_value;
|
||||
|
@ -44,7 +44,7 @@ BitTorrentTracker_Analyzer::BitTorrentTracker_Analyzer(Connection* c)
|
|||
req_buf[sizeof(req_buf) - 1] = 0;
|
||||
req_buf_pos = req_buf;
|
||||
req_buf_len = 0;
|
||||
req_val_uri = 0;
|
||||
req_val_uri = nullptr;
|
||||
req_val_headers = new TableVal({NewRef{}, bt_tracker_headers});
|
||||
|
||||
res_state = BTT_RES_STATUS;
|
||||
|
@ -230,16 +230,16 @@ void BitTorrentTracker_Analyzer::InitBencParser(void)
|
|||
benc_count.clear();
|
||||
|
||||
benc_state = BENC_STATE_EMPTY;
|
||||
benc_raw = 0;
|
||||
benc_raw = nullptr;
|
||||
benc_raw_type = BENC_TYPE_NONE;
|
||||
benc_raw_len = 0;
|
||||
benc_key = 0;
|
||||
benc_key = nullptr;
|
||||
benc_key_len = 0;
|
||||
benc_strlen = 0;
|
||||
benc_str = 0;
|
||||
benc_strlen = nullptr;
|
||||
benc_str = nullptr;
|
||||
benc_str_len = 0;
|
||||
benc_str_have = 0;
|
||||
benc_int = 0;
|
||||
benc_int = nullptr;
|
||||
benc_int_val = 0;
|
||||
}
|
||||
|
||||
|
@ -353,8 +353,8 @@ void BitTorrentTracker_Analyzer::EmitRequest(void)
|
|||
IntrusivePtr{AdoptRef{}, req_val_headers}
|
||||
);
|
||||
|
||||
req_val_uri = 0;
|
||||
req_val_headers = 0;
|
||||
req_val_uri = nullptr;
|
||||
req_val_headers = nullptr;
|
||||
}
|
||||
|
||||
bool BitTorrentTracker_Analyzer::ParseResponse(char* line)
|
||||
|
@ -406,7 +406,7 @@ bool BitTorrentTracker_Analyzer::ParseResponse(char* line)
|
|||
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(res_status)},
|
||||
IntrusivePtr{AdoptRef{}, res_val_headers}
|
||||
);
|
||||
res_val_headers = 0;
|
||||
res_val_headers = nullptr;
|
||||
res_buf_pos = res_buf + res_buf_len;
|
||||
res_state = BTT_RES_DONE;
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ void BitTorrentTracker_Analyzer::ResponseBenc(int name_len, char* name,
|
|||
RecordVal* peer = new RecordVal(bittorrent_peer);
|
||||
peer->Assign(0, make_intrusive<AddrVal>(ad));
|
||||
peer->Assign(1, val_mgr->GetPort(pt, TRANSPORT_TCP));
|
||||
res_val_peers->Assign(peer, 0);
|
||||
res_val_peers->Assign(peer, nullptr);
|
||||
|
||||
Unref(peer);
|
||||
}
|
||||
|
@ -617,9 +617,9 @@ int BitTorrentTracker_Analyzer::ResponseParseBenc(void)
|
|||
ResponseBenc(benc_key_len, benc_key,
|
||||
benc_raw_type,
|
||||
benc_raw_len, benc_raw);
|
||||
benc_key = 0;
|
||||
benc_key = nullptr;
|
||||
benc_key_len = 0;
|
||||
benc_raw = 0;
|
||||
benc_raw = nullptr;
|
||||
benc_raw_len = 0;
|
||||
benc_raw_type = BENC_TYPE_NONE;
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ int BitTorrentTracker_Analyzer::ResponseParseBenc(void)
|
|||
ResponseBenc(benc_key_len,
|
||||
benc_key, BENC_TYPE_INT,
|
||||
benc_int_val);
|
||||
benc_key = 0;
|
||||
benc_key = nullptr;
|
||||
benc_key_len = 0;
|
||||
}
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ int BitTorrentTracker_Analyzer::ResponseParseBenc(void)
|
|||
BENC_TYPE_STR,
|
||||
benc_str_len, benc_str);
|
||||
benc_key_len = 0;
|
||||
benc_key = 0;
|
||||
benc_key = nullptr;
|
||||
}
|
||||
|
||||
if ( ! benc_str_len )
|
||||
|
@ -796,7 +796,7 @@ void BitTorrentTracker_Analyzer::EmitResponse(void)
|
|||
IntrusivePtr{AdoptRef{}, res_val_benc}
|
||||
);
|
||||
|
||||
res_val_headers = 0;
|
||||
res_val_peers = 0;
|
||||
res_val_benc = 0;
|
||||
res_val_headers = nullptr;
|
||||
res_val_peers = nullptr;
|
||||
res_val_benc = nullptr;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ static analyzer::Analyzer* GetConnsizeAnalyzer(Val* cid)
|
|||
{
|
||||
Connection* c = sessions->FindConnection(cid);
|
||||
if ( ! c )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
analyzer::Analyzer* a = c->FindAnalyzer("CONNSIZE");
|
||||
if ( ! a )
|
||||
|
|
|
@ -545,7 +545,7 @@ bool DNS_Interpreter::ParseRR_Name(DNS_MsgInfo* msg,
|
|||
|
||||
default:
|
||||
analyzer->Conn()->Internal("DNS_RR_bad_name");
|
||||
reply_event = 0;
|
||||
reply_event = nullptr;
|
||||
}
|
||||
|
||||
if ( reply_event && ! msg->skip_event )
|
||||
|
@ -757,7 +757,7 @@ bool DNS_Interpreter::ParseRR_TSIG(DNS_MsgInfo* msg,
|
|||
ExtractOctets(data, len, dns_TSIG_addl ? &request_MAC : nullptr);
|
||||
unsigned int orig_id = ExtractShort(data, len);
|
||||
unsigned int rr_error = ExtractShort(data, len);
|
||||
ExtractOctets(data, len, 0); // Other Data
|
||||
ExtractOctets(data, len, nullptr); // Other Data
|
||||
|
||||
if ( dns_TSIG_addl )
|
||||
{
|
||||
|
@ -1256,7 +1256,7 @@ static StringVal* extract_char_string(analyzer::Analyzer* analyzer,
|
|||
const u_char*& data, int& len, int& rdlen)
|
||||
{
|
||||
if ( rdlen <= 0 )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
uint8_t str_size = data[0];
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ static StringVal* extract_char_string(analyzer::Analyzer* analyzer,
|
|||
if ( str_size > rdlen )
|
||||
{
|
||||
analyzer->Weird("DNS_TXT_char_str_past_rdlen");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StringVal* rval = new StringVal(str_size,
|
||||
|
@ -1428,7 +1428,7 @@ DNS_MsgInfo::DNS_MsgInfo(DNS_RawMsgHdr* hdr, int arg_is_query)
|
|||
id = ntohs(hdr->id);
|
||||
is_query = arg_is_query;
|
||||
|
||||
query_name = 0;
|
||||
query_name = nullptr;
|
||||
atype = TYPE_ALL;
|
||||
aclass = 0;
|
||||
ttl = 0;
|
||||
|
@ -1612,7 +1612,7 @@ Contents_DNS::Contents_DNS(Connection* conn, bool orig,
|
|||
{
|
||||
interp = arg_interp;
|
||||
|
||||
msg_buf = 0;
|
||||
msg_buf = nullptr;
|
||||
buf_n = buf_len = msg_size = 0;
|
||||
state = DNS_LEN_HI;
|
||||
}
|
||||
|
@ -1685,7 +1685,7 @@ void Contents_DNS::DeliverStream(int len, const u_char* data, bool orig)
|
|||
// Haven't filled up the message buffer yet, no more to do.
|
||||
return;
|
||||
|
||||
ForwardPacket(msg_size, msg_buf, orig, -1, 0, 0);
|
||||
ForwardPacket(msg_size, msg_buf, orig, -1, nullptr, 0);
|
||||
|
||||
buf_n = 0;
|
||||
state = DNS_LEN_HI;
|
||||
|
@ -1699,7 +1699,7 @@ DNS_Analyzer::DNS_Analyzer(Connection* conn)
|
|||
: tcp::TCP_ApplicationAnalyzer("DNS", conn)
|
||||
{
|
||||
interp = new DNS_Interpreter(this);
|
||||
contents_dns_orig = contents_dns_resp = 0;
|
||||
contents_dns_orig = contents_dns_resp = nullptr;
|
||||
|
||||
if ( Conn()->ConnTransport() == TRANSPORT_TCP )
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new ::analyzer::Component("DNS", ::analyzer::dns::DNS_Analyzer::Instantiate));
|
||||
AddComponent(new ::analyzer::Component("Contents_DNS", 0));
|
||||
AddComponent(new ::analyzer::Component("Contents_DNS", nullptr));
|
||||
|
||||
plugin::Configuration config;
|
||||
config.name = "Zeek::DNS";
|
||||
|
|
|
@ -60,7 +60,7 @@ void Finger_Analyzer::DeliverStream(int length, const u_char* data, bool is_orig
|
|||
assert(line <= end_of_line);
|
||||
size_t n = end_of_line >= line ? end_of_line - line : 0; // just to be sure if assertions aren't on.
|
||||
const char* at = reinterpret_cast<const char*>(memchr(line, '@', n));
|
||||
const char* host = 0;
|
||||
const char* host = nullptr;
|
||||
if ( ! at )
|
||||
at = host = end_of_line;
|
||||
else
|
||||
|
|
|
@ -204,7 +204,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
|||
const char* line = (const char*) data;
|
||||
const char* end_of_line = line + len;
|
||||
|
||||
BroString* decoded_adat = 0;
|
||||
BroString* decoded_adat = nullptr;
|
||||
|
||||
if ( orig )
|
||||
{
|
||||
|
@ -217,7 +217,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
|||
{
|
||||
line = skip_whitespace(line + cmd_len, end_of_line);
|
||||
StringVal encoded(end_of_line - line, line);
|
||||
decoded_adat = decode_base64(encoded.AsString(), 0, Conn());
|
||||
decoded_adat = decode_base64(encoded.AsString(), nullptr, Conn());
|
||||
|
||||
if ( first_token )
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
|||
// Doesn't look like TLS/SSL, so done analyzing.
|
||||
done = true;
|
||||
delete decoded_adat;
|
||||
decoded_adat = 0;
|
||||
decoded_adat = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
|||
{
|
||||
line += 5;
|
||||
StringVal encoded(end_of_line - line, line);
|
||||
decoded_adat = decode_base64(encoded.AsString(), 0, Conn());
|
||||
decoded_adat = decode_base64(encoded.AsString(), nullptr, Conn());
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
plugin::Configuration Configure() override
|
||||
{
|
||||
AddComponent(new ::analyzer::Component("FTP", ::analyzer::ftp::FTP_Analyzer::Instantiate));
|
||||
AddComponent(new ::analyzer::Component("FTP_ADAT", 0));
|
||||
AddComponent(new ::analyzer::Component("FTP_ADAT", nullptr));
|
||||
|
||||
plugin::Configuration config;
|
||||
config.name = "Zeek::FTP";
|
||||
|
|
|
@ -40,7 +40,7 @@ Gnutella_Analyzer::Gnutella_Analyzer(Connection* conn)
|
|||
new_state = 0;
|
||||
sent_establish = 0;
|
||||
|
||||
ms = 0;
|
||||
ms = nullptr;
|
||||
|
||||
orig_msg_state = new GnutellaMsgState();
|
||||
resp_msg_state = new GnutellaMsgState();
|
||||
|
|
|
@ -48,7 +48,7 @@ HTTP_Entity::HTTP_Entity(HTTP_Message *arg_message, MIME_Entity* parent_entity,
|
|||
header_length = 0;
|
||||
deliver_body = true;
|
||||
encoding = IDENTITY;
|
||||
zip = 0;
|
||||
zip = nullptr;
|
||||
is_partial_content = false;
|
||||
offset = 0;
|
||||
instance_length = -1; // unspecified
|
||||
|
@ -67,7 +67,7 @@ void HTTP_Entity::EndOfData()
|
|||
{
|
||||
zip->Done();
|
||||
delete zip;
|
||||
zip = 0;
|
||||
zip = nullptr;
|
||||
encoding = IDENTITY;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void HTTP_Entity::Deliver(int len, const char* data, bool trailing_CRLF)
|
|||
switch ( chunked_transfer_state ) {
|
||||
case EXPECT_CHUNK_SIZE:
|
||||
ASSERT(trailing_CRLF);
|
||||
if ( ! atoi_n(len, data, 0, 16, expect_data_length) )
|
||||
if ( ! atoi_n(len, data, nullptr, 16, expect_data_length) )
|
||||
{
|
||||
http_message->Weird("HTTP_bad_chunk_size");
|
||||
expect_data_length = 0;
|
||||
|
@ -365,7 +365,7 @@ void HTTP_Entity::SubmitHeader(mime::MIME_Header* h)
|
|||
if ( ! mime::is_null_data_chunk(vt) )
|
||||
{
|
||||
int64_t n;
|
||||
if ( atoi_n(vt.length, vt.data, 0, 10, n) )
|
||||
if ( atoi_n(vt.length, vt.data, nullptr, 10, n) )
|
||||
{
|
||||
content_length = n;
|
||||
|
||||
|
@ -427,8 +427,8 @@ void HTTP_Entity::SubmitHeader(mime::MIME_Header* h)
|
|||
instance_length_str.c_str());
|
||||
|
||||
int64_t f, l;
|
||||
atoi_n(first_byte_pos.size(), first_byte_pos.c_str(), 0, 10, f);
|
||||
atoi_n(last_byte_pos.size(), last_byte_pos.c_str(), 0, 10, l);
|
||||
atoi_n(first_byte_pos.size(), first_byte_pos.c_str(), nullptr, 10, f);
|
||||
atoi_n(last_byte_pos.size(), last_byte_pos.c_str(), nullptr, 10, l);
|
||||
int64_t len = l - f + 1;
|
||||
|
||||
if ( DEBUG_http )
|
||||
|
@ -439,7 +439,7 @@ void HTTP_Entity::SubmitHeader(mime::MIME_Header* h)
|
|||
if ( instance_length_str != "*" )
|
||||
{
|
||||
if ( ! atoi_n(instance_length_str.size(),
|
||||
instance_length_str.c_str(), 0, 10,
|
||||
instance_length_str.c_str(), nullptr, 10,
|
||||
instance_length) )
|
||||
instance_length = 0;
|
||||
}
|
||||
|
@ -596,9 +596,9 @@ HTTP_Message::HTTP_Message(HTTP_Analyzer* arg_analyzer,
|
|||
content_line = arg_cl;
|
||||
is_orig = arg_is_orig;
|
||||
|
||||
current_entity = 0;
|
||||
top_level = new HTTP_Entity(this, 0, expect_body);
|
||||
entity_data_buffer = 0;
|
||||
current_entity = nullptr;
|
||||
top_level = new HTTP_Entity(this, nullptr, expect_body);
|
||||
entity_data_buffer = nullptr;
|
||||
BeginEntity(top_level);
|
||||
|
||||
start_time = network_time;
|
||||
|
@ -837,20 +837,20 @@ HTTP_Analyzer::HTTP_Analyzer(Connection* conn)
|
|||
keep_alive = 0;
|
||||
connection_close = 0;
|
||||
|
||||
request_message = reply_message = 0;
|
||||
request_message = reply_message = nullptr;
|
||||
request_state = EXPECT_REQUEST_LINE;
|
||||
reply_state = EXPECT_REPLY_LINE;
|
||||
|
||||
request_ongoing = 0;
|
||||
request_method = request_URI = 0;
|
||||
unescaped_URI = 0;
|
||||
request_method = request_URI = nullptr;
|
||||
unescaped_URI = nullptr;
|
||||
|
||||
reply_ongoing = 0;
|
||||
reply_code = 0;
|
||||
reply_reason_phrase = 0;
|
||||
reply_reason_phrase = nullptr;
|
||||
|
||||
connect_request = false;
|
||||
pia = 0;
|
||||
pia = nullptr;
|
||||
upgraded = false;
|
||||
upgrade_connection = false;
|
||||
upgrade_protocol.clear();
|
||||
|
@ -882,10 +882,10 @@ void HTTP_Analyzer::Done()
|
|||
ReplyMade(true, "message interrupted when connection done");
|
||||
|
||||
delete request_message;
|
||||
request_message = 0;
|
||||
request_message = nullptr;
|
||||
|
||||
delete reply_message;
|
||||
reply_message = 0;
|
||||
reply_message = nullptr;
|
||||
|
||||
GenStats();
|
||||
|
||||
|
@ -1061,8 +1061,8 @@ void HTTP_Analyzer::DeliverStream(int len, const u_char* data, bool is_orig)
|
|||
|
||||
if ( AddChildAnalyzer(pia) )
|
||||
{
|
||||
pia->FirstPacket(true, 0);
|
||||
pia->FirstPacket(false, 0);
|
||||
pia->FirstPacket(true, nullptr);
|
||||
pia->FirstPacket(false, nullptr);
|
||||
|
||||
// This connection has transitioned to no longer
|
||||
// being http and the content line support analyzers
|
||||
|
@ -1073,7 +1073,7 @@ void HTTP_Analyzer::DeliverStream(int len, const u_char* data, bool is_orig)
|
|||
|
||||
else
|
||||
// AddChildAnalyzer() will have deleted PIA.
|
||||
pia = 0;
|
||||
pia = nullptr;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1193,7 +1193,7 @@ const char* HTTP_Analyzer::PrefixMatch(const char* line,
|
|||
|
||||
if ( *prefix )
|
||||
// It didn't match.
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return line;
|
||||
}
|
||||
|
@ -1201,15 +1201,15 @@ const char* HTTP_Analyzer::PrefixMatch(const char* line,
|
|||
const char* HTTP_Analyzer::PrefixWordMatch(const char* line,
|
||||
const char* end_of_line, const char* prefix)
|
||||
{
|
||||
if ( (line = PrefixMatch(line, end_of_line, prefix)) == 0 )
|
||||
return 0;
|
||||
if ( (line = PrefixMatch(line, end_of_line, prefix)) == nullptr )
|
||||
return nullptr;
|
||||
|
||||
const char* orig_line = line;
|
||||
line = skip_whitespace(line, end_of_line);
|
||||
|
||||
if ( line == orig_line )
|
||||
// Word didn't end at prefix.
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return line;
|
||||
}
|
||||
|
@ -1235,7 +1235,7 @@ static const char* get_HTTP_token(const char* s, const char* e)
|
|||
|
||||
int HTTP_Analyzer::HTTP_RequestLine(const char* line, const char* end_of_line)
|
||||
{
|
||||
const char* rest = 0;
|
||||
const char* rest = nullptr;
|
||||
const char* end_of_method = get_HTTP_token(line, end_of_line);
|
||||
|
||||
if ( end_of_method == line )
|
||||
|
@ -1439,7 +1439,7 @@ void HTTP_Analyzer::HTTP_Reply()
|
|||
else
|
||||
{
|
||||
Unref(reply_reason_phrase);
|
||||
reply_reason_phrase = 0;
|
||||
reply_reason_phrase = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1459,7 +1459,7 @@ void HTTP_Analyzer::RequestMade(bool interrupted, const char* msg)
|
|||
Unref(unescaped_URI);
|
||||
Unref(request_URI);
|
||||
|
||||
request_method = request_URI = unescaped_URI = 0;
|
||||
request_method = request_URI = unescaped_URI = nullptr;
|
||||
|
||||
num_request_lines = 0;
|
||||
|
||||
|
@ -1492,7 +1492,7 @@ void HTTP_Analyzer::ReplyMade(bool interrupted, const char* msg)
|
|||
if ( reply_reason_phrase )
|
||||
{
|
||||
Unref(reply_reason_phrase);
|
||||
reply_reason_phrase = 0;
|
||||
reply_reason_phrase = nullptr;
|
||||
}
|
||||
|
||||
// unanswered requests = 1 because there is no pop after 101.
|
||||
|
@ -1531,7 +1531,7 @@ void HTTP_Analyzer::RequestClash(Val* /* clash_val */)
|
|||
|
||||
const BroString* HTTP_Analyzer::UnansweredRequestMethod()
|
||||
{
|
||||
return unanswered_requests.empty() ? 0 : unanswered_requests.front()->AsString();
|
||||
return unanswered_requests.empty() ? nullptr : unanswered_requests.front()->AsString();
|
||||
}
|
||||
|
||||
int HTTP_Analyzer::HTTP_ReplyLine(const char* line, const char* end_of_line)
|
||||
|
|
|
@ -81,7 +81,7 @@ void ICMP_Analyzer::DeliverPacket(int len, const u_char* data,
|
|||
if ( rule_matcher )
|
||||
{
|
||||
if ( ! matcher_state.MatcherInitialized(is_orig) )
|
||||
matcher_state.InitEndpointMatcher(this, ip, len, is_orig, 0);
|
||||
matcher_state.InitEndpointMatcher(this, ip, len, is_orig, nullptr);
|
||||
}
|
||||
|
||||
type = icmpp->icmp_type;
|
||||
|
@ -497,7 +497,7 @@ void ICMP_Analyzer::Echo(double t, const struct icmp* icmpp, int len,
|
|||
int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
||||
{
|
||||
// For handling all Echo related ICMP messages
|
||||
EventHandlerPtr f = 0;
|
||||
EventHandlerPtr f = nullptr;
|
||||
|
||||
if ( ip_hdr->NextProto() == IPPROTO_ICMPV6 )
|
||||
f = (icmpp->icmp_type == ICMP6_ECHO_REQUEST)
|
||||
|
@ -658,7 +658,7 @@ void ICMP_Analyzer::RouterSolicit(double t, const struct icmp* icmpp, int len,
|
|||
void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
||||
int len, int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
||||
{
|
||||
EventHandlerPtr f = 0;
|
||||
EventHandlerPtr f = nullptr;
|
||||
|
||||
switch ( icmpp->icmp_type )
|
||||
{
|
||||
|
@ -684,7 +684,7 @@ void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
|||
void ICMP_Analyzer::Context6(double t, const struct icmp* icmpp,
|
||||
int len, int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
||||
{
|
||||
EventHandlerPtr f = 0;
|
||||
EventHandlerPtr f = nullptr;
|
||||
|
||||
switch ( icmpp->icmp_type )
|
||||
{
|
||||
|
@ -720,8 +720,8 @@ void ICMP_Analyzer::Context6(double t, const struct icmp* icmpp,
|
|||
|
||||
VectorVal* ICMP_Analyzer::BuildNDOptionsVal(int caplen, const u_char* data)
|
||||
{
|
||||
static RecordType* icmp6_nd_option_type = 0;
|
||||
static RecordType* icmp6_nd_prefix_info_type = 0;
|
||||
static RecordType* icmp6_nd_option_type = nullptr;
|
||||
static RecordType* icmp6_nd_prefix_info_type = nullptr;
|
||||
|
||||
if ( ! icmp6_nd_option_type )
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ void Ident_Analyzer::DeliverStream(int length, const u_char* data, bool is_orig)
|
|||
const char* orig_line = line;
|
||||
const char* end_of_line = line + length;
|
||||
|
||||
tcp::TCP_Endpoint* s = 0;
|
||||
tcp::TCP_Endpoint* s = nullptr;
|
||||
|
||||
if ( TCP() )
|
||||
s = is_orig ? TCP()->Orig() : TCP()->Resp();
|
||||
|
@ -194,17 +194,17 @@ const char* Ident_Analyzer::ParsePair(const char* line, const char* end_of_line,
|
|||
line = ParsePort(line, end_of_line, p1);
|
||||
if ( ! line )
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( line >= end_of_line || line[0] != ',' )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
++line;
|
||||
|
||||
line = ParsePort(line, end_of_line, p2);
|
||||
if ( ! line )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return line;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ const char* Ident_Analyzer::ParsePort(const char* line, const char* end_of_line,
|
|||
|
||||
line = skip_whitespace(line, end_of_line);
|
||||
if ( ! isdigit(*line) )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
const char* l = line;
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
if ( parts[i][0] == '@' )
|
||||
parts[i] = parts[i].substr(1);
|
||||
auto idx = make_intrusive<StringVal>(parts[i].c_str());
|
||||
set->Assign(idx.get(), 0);
|
||||
set->Assign(idx.get(), nullptr);
|
||||
}
|
||||
|
||||
EnqueueConnEvent(irc_names_info,
|
||||
|
@ -468,7 +468,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
for ( unsigned int i = 0; i < parts.size(); ++i )
|
||||
{
|
||||
auto idx = make_intrusive<StringVal>(parts[i].c_str());
|
||||
set->Assign(idx.get(), 0);
|
||||
set->Assign(idx.get(), nullptr);
|
||||
}
|
||||
|
||||
EnqueueConnEvent(irc_whois_channel_line,
|
||||
|
@ -857,7 +857,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
info->Assign(2, make_intrusive<StringVal>(empty_string.c_str()));
|
||||
// User mode.
|
||||
info->Assign(3, make_intrusive<StringVal>(empty_string.c_str()));
|
||||
list->Assign(info, 0);
|
||||
list->Assign(info, nullptr);
|
||||
Unref(info);
|
||||
}
|
||||
|
||||
|
@ -918,7 +918,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
info->Assign(2, make_intrusive<StringVal>(empty_string.c_str()));
|
||||
// User mode:
|
||||
info->Assign(3, make_intrusive<StringVal>(mode.c_str()));
|
||||
list->Assign(info.get(), 0);
|
||||
list->Assign(info.get(), nullptr);
|
||||
}
|
||||
|
||||
EnqueueConnEvent(irc_join_message,
|
||||
|
@ -957,7 +957,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
for ( unsigned int i = 0; i < channelList.size(); ++i )
|
||||
{
|
||||
auto idx = make_intrusive<StringVal>(channelList[i].c_str());
|
||||
set->Assign(idx.get(), 0);
|
||||
set->Assign(idx.get(), nullptr);
|
||||
}
|
||||
|
||||
EnqueueConnEvent(irc_part_message,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
using namespace analyzer::login;
|
||||
|
||||
static RE_Matcher* re_skip_authentication = 0;
|
||||
static RE_Matcher* re_skip_authentication = nullptr;
|
||||
static RE_Matcher* re_direct_login_prompts;
|
||||
static RE_Matcher* re_login_prompts;
|
||||
static RE_Matcher* re_login_non_failure_msgs;
|
||||
|
@ -39,7 +39,7 @@ Login_Analyzer::Login_Analyzer(const char* name, Connection* conn)
|
|||
user_text_first = 0;
|
||||
user_text_last = MAX_USER_TEXT - 1;
|
||||
num_user_text = 0;
|
||||
client_name = username = 0;
|
||||
client_name = username = nullptr;
|
||||
saw_ploy = is_VMS = false;
|
||||
|
||||
if ( ! re_skip_authentication )
|
||||
|
@ -214,7 +214,7 @@ void Login_Analyzer::AuthenticationDialog(bool orig, char* line)
|
|||
// respect to it (see below).
|
||||
login_prompt_line != failure_line);
|
||||
|
||||
const char* next_prompt = 0;
|
||||
const char* next_prompt = nullptr;
|
||||
while ( (*prompt != '\0' &&
|
||||
(next_prompt = IsLoginPrompt(prompt + 1))) ||
|
||||
multi_line_prompt )
|
||||
|
@ -507,7 +507,7 @@ const char* Login_Analyzer::IsLoginPrompt(const char* line) const
|
|||
int prompt_match = re_login_prompts->MatchAnywhere(line);
|
||||
if ( ! prompt_match || IsFailureMsg(line) )
|
||||
// IRIX can report "login: ERROR: Login incorrect"
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return &line[prompt_match];
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ char* Login_Analyzer::PeekUserText()
|
|||
{
|
||||
reporter->AnalyzerError(this,
|
||||
"underflow in Login_Analyzer::PeekUserText()");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return user_text[user_text_first];
|
||||
|
@ -576,7 +576,7 @@ char* Login_Analyzer::PopUserText()
|
|||
char* s = PeekUserText();
|
||||
|
||||
if ( ! s )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if ( ++user_text_first == MAX_USER_TEXT )
|
||||
user_text_first = 0;
|
||||
|
|
|
@ -320,7 +320,7 @@ char* TelnetEnvironmentOption::ExtractEnv(u_char*& data, int& len, int& code)
|
|||
|
||||
if ( code != ENVIRON_VAR && code != ENVIRON_VAL &&
|
||||
code != ENVIRON_USERVAR )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// Move past code.
|
||||
--len;
|
||||
|
@ -338,7 +338,7 @@ char* TelnetEnvironmentOption::ExtractEnv(u_char*& data, int& len, int& code)
|
|||
{
|
||||
++d; // move past ESC
|
||||
if ( d >= data_end )
|
||||
return 0;
|
||||
return nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ TelnetOption* NVT_Analyzer::FindOption(unsigned int code)
|
|||
if ( options[i]->Code() == code )
|
||||
return options[i];
|
||||
|
||||
TelnetOption* opt = 0;
|
||||
TelnetOption* opt = nullptr;
|
||||
if ( i < NUM_TELNET_OPTIONS )
|
||||
{ // Maybe we haven't created this option yet.
|
||||
switch ( code ) {
|
||||
|
|
|
@ -17,10 +17,10 @@ public:
|
|||
AddComponent(new ::analyzer::Component("Telnet", ::analyzer::login::Telnet_Analyzer::Instantiate));
|
||||
AddComponent(new ::analyzer::Component("Rsh", ::analyzer::login::Rsh_Analyzer::Instantiate));
|
||||
AddComponent(new ::analyzer::Component("Rlogin", ::analyzer::login::Rlogin_Analyzer::Instantiate));
|
||||
AddComponent(new ::analyzer::Component("NVT", 0));
|
||||
AddComponent(new ::analyzer::Component("Login", 0));
|
||||
AddComponent(new ::analyzer::Component("Contents_Rsh", 0));
|
||||
AddComponent(new ::analyzer::Component("Contents_Rlogin", 0));
|
||||
AddComponent(new ::analyzer::Component("NVT", nullptr));
|
||||
AddComponent(new ::analyzer::Component("Login", nullptr));
|
||||
AddComponent(new ::analyzer::Component("Contents_Rsh", nullptr));
|
||||
AddComponent(new ::analyzer::Component("Contents_Rlogin", nullptr));
|
||||
|
||||
plugin::Configuration config;
|
||||
config.name = "Zeek::Login";
|
||||
|
|
|
@ -16,7 +16,7 @@ Contents_Rlogin_Analyzer::Contents_Rlogin_Analyzer(Connection* conn, bool orig,
|
|||
{
|
||||
num_bytes_to_scan = 0;
|
||||
analyzer = arg_analyzer;
|
||||
peer = 0;
|
||||
peer = nullptr;
|
||||
|
||||
if ( orig )
|
||||
state = save_state = RLOGIN_FIRST_NULL;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace analyzer { namespace mime {
|
||||
|
||||
static const data_chunk_t null_data_chunk = { 0, 0 };
|
||||
static const data_chunk_t null_data_chunk = { 0, nullptr };
|
||||
|
||||
int mime_header_only = 0;
|
||||
int mime_decode_data = 1;
|
||||
|
@ -65,14 +65,14 @@ enum MIME_BOUNDARY_DELIMITER {
|
|||
static const char* MIMEHeaderName[] = {
|
||||
"content-type",
|
||||
"content-transfer-encoding",
|
||||
0,
|
||||
nullptr,
|
||||
};
|
||||
|
||||
static const char* MIMEContentTypeName[] = {
|
||||
"MULTIPART",
|
||||
"MESSAGE",
|
||||
"TEXT",
|
||||
0,
|
||||
nullptr,
|
||||
};
|
||||
|
||||
static const char* MIMEContentSubtypeName[] = {
|
||||
|
@ -86,7 +86,7 @@ static const char* MIMEContentSubtypeName[] = {
|
|||
|
||||
"PLAIN", // for text
|
||||
|
||||
0, // other
|
||||
nullptr, // other
|
||||
};
|
||||
|
||||
static const char* MIMEContentEncodingName[] = {
|
||||
|
@ -95,12 +95,12 @@ static const char* MIMEContentEncodingName[] = {
|
|||
"BINARY",
|
||||
"QUOTED-PRINTABLE",
|
||||
"BASE64",
|
||||
0,
|
||||
nullptr,
|
||||
};
|
||||
|
||||
bool is_null_data_chunk(data_chunk_t b)
|
||||
{
|
||||
return b.data == 0;
|
||||
return b.data == nullptr;
|
||||
}
|
||||
|
||||
bool is_lws(char ch)
|
||||
|
@ -437,7 +437,7 @@ using namespace analyzer::mime;
|
|||
|
||||
MIME_Multiline::MIME_Multiline()
|
||||
{
|
||||
line = 0;
|
||||
line = nullptr;
|
||||
}
|
||||
|
||||
MIME_Multiline::~MIME_Multiline()
|
||||
|
@ -454,7 +454,7 @@ void MIME_Multiline::append(int len, const char* data)
|
|||
BroString* MIME_Multiline::get_concatenated_line()
|
||||
{
|
||||
if ( buffer.empty() )
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
delete line;
|
||||
line = concatenate(buffer);
|
||||
|
@ -546,7 +546,7 @@ void MIME_Entity::init()
|
|||
in_header = 1;
|
||||
end_of_data = 0;
|
||||
|
||||
current_header_line = 0;
|
||||
current_header_line = nullptr;
|
||||
current_field_type = MIME_FIELD_OTHER;
|
||||
|
||||
need_to_parse_parameters = 0;
|
||||
|
@ -554,22 +554,22 @@ void MIME_Entity::init()
|
|||
content_type_str = new StringVal("TEXT");
|
||||
content_subtype_str = new StringVal("PLAIN");
|
||||
|
||||
content_encoding_str = 0;
|
||||
multipart_boundary = 0;
|
||||
content_encoding_str = nullptr;
|
||||
multipart_boundary = nullptr;
|
||||
content_type = CONTENT_TYPE_TEXT;
|
||||
content_subtype = CONTENT_SUBTYPE_PLAIN;
|
||||
content_encoding = CONTENT_ENCODING_OTHER;
|
||||
|
||||
parent = 0;
|
||||
current_child_entity = 0;
|
||||
parent = nullptr;
|
||||
current_child_entity = nullptr;
|
||||
|
||||
base64_decoder = 0;
|
||||
base64_decoder = nullptr;
|
||||
|
||||
data_buf_length = 0;
|
||||
data_buf_data = 0;
|
||||
data_buf_data = nullptr;
|
||||
data_buf_offset = -1;
|
||||
|
||||
message = 0;
|
||||
message = nullptr;
|
||||
delay_adding_implicit_CRLF = false;
|
||||
want_all_headers = false;
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ void MIME_Entity::init()
|
|||
MIME_Entity::~MIME_Entity()
|
||||
{
|
||||
if ( ! end_of_data )
|
||||
reporter->AnalyzerError(message ? message->GetAnalyzer() : 0,
|
||||
reporter->AnalyzerError(message ? message->GetAnalyzer() : nullptr,
|
||||
"missing MIME_Entity::EndOfData() before ~MIME_Entity");
|
||||
|
||||
delete current_header_line;
|
||||
|
@ -653,7 +653,7 @@ void MIME_Entity::EndOfData()
|
|||
|
||||
else
|
||||
{
|
||||
if ( current_child_entity != 0 )
|
||||
if ( current_child_entity != nullptr )
|
||||
{
|
||||
if ( content_type == CONTENT_TYPE_MULTIPART )
|
||||
IllegalFormat("multipart closing boundary delimiter missing");
|
||||
|
@ -675,13 +675,13 @@ void MIME_Entity::NewDataLine(int len, const char* data, bool trailing_CRLF)
|
|||
{
|
||||
switch ( CheckBoundaryDelimiter(len, data) ) {
|
||||
case MULTIPART_BOUNDARY:
|
||||
if ( current_child_entity != 0 )
|
||||
if ( current_child_entity != nullptr )
|
||||
EndChildEntity();
|
||||
BeginChildEntity();
|
||||
return;
|
||||
|
||||
case MULTIPART_CLOSING_BOUNDARY:
|
||||
if ( current_child_entity != 0 )
|
||||
if ( current_child_entity != nullptr )
|
||||
EndChildEntity();
|
||||
EndOfData();
|
||||
return;
|
||||
|
@ -695,7 +695,7 @@ void MIME_Entity::NewDataLine(int len, const char* data, bool trailing_CRLF)
|
|||
// binary encoding, and thus do not need to decode
|
||||
// before passing the data to child.
|
||||
|
||||
if ( current_child_entity != 0 )
|
||||
if ( current_child_entity != nullptr )
|
||||
// Data before the first or after the last
|
||||
// boundary delimiter are ignored
|
||||
current_child_entity->Deliver(len, data, trailing_CRLF);
|
||||
|
@ -722,7 +722,7 @@ void MIME_Entity::NewHeader(int len, const char* data)
|
|||
|
||||
void MIME_Entity::ContHeader(int len, const char* data)
|
||||
{
|
||||
if ( current_header_line == 0 )
|
||||
if ( current_header_line == nullptr )
|
||||
{
|
||||
IllegalFormat("first header line starts with linear whitespace");
|
||||
|
||||
|
@ -737,11 +737,11 @@ void MIME_Entity::ContHeader(int len, const char* data)
|
|||
|
||||
void MIME_Entity::FinishHeader()
|
||||
{
|
||||
if ( current_header_line == 0 )
|
||||
if ( current_header_line == nullptr )
|
||||
return;
|
||||
|
||||
MIME_Header* h = new MIME_Header(current_header_line);
|
||||
current_header_line = 0;
|
||||
current_header_line = nullptr;
|
||||
|
||||
if ( ! is_null_data_chunk(h->get_name()) )
|
||||
{
|
||||
|
@ -762,7 +762,7 @@ int MIME_Entity::LookupMIMEHeaderName(data_chunk_t name)
|
|||
// A linear lookup should be fine for now.
|
||||
// header names are case-insensitive (RFC 822, 2822, 2045).
|
||||
|
||||
for ( int i = 0; MIMEHeaderName[i] != 0; ++i )
|
||||
for ( int i = 0; MIMEHeaderName[i] != nullptr; ++i )
|
||||
if ( istrequal(name, MIMEHeaderName[i]) )
|
||||
return i;
|
||||
return -1;
|
||||
|
@ -770,7 +770,7 @@ int MIME_Entity::LookupMIMEHeaderName(data_chunk_t name)
|
|||
|
||||
void MIME_Entity::ParseMIMEHeader(MIME_Header* h)
|
||||
{
|
||||
if ( h == 0 )
|
||||
if ( h == nullptr )
|
||||
return;
|
||||
|
||||
current_field_type = LookupMIMEHeaderName(h->get_name());
|
||||
|
@ -884,7 +884,7 @@ bool MIME_Entity::ParseFieldParameters(int len, const char* data)
|
|||
data += offset;
|
||||
len -= offset;
|
||||
|
||||
BroString* val = 0;
|
||||
BroString* val = nullptr;
|
||||
|
||||
if ( current_field_type == MIME_CONTENT_TYPE &&
|
||||
content_type == CONTENT_TYPE_MULTIPART &&
|
||||
|
@ -1172,13 +1172,13 @@ void MIME_Entity::FinishDecodeBase64()
|
|||
}
|
||||
|
||||
delete base64_decoder;
|
||||
base64_decoder = 0;
|
||||
base64_decoder = nullptr;
|
||||
}
|
||||
|
||||
bool MIME_Entity::GetDataBuffer()
|
||||
{
|
||||
int ret = message->RequestBuffer(&data_buf_length, &data_buf_data);
|
||||
if ( ! ret || data_buf_length == 0 || data_buf_data == 0 )
|
||||
if ( ! ret || data_buf_length == 0 || data_buf_data == nullptr )
|
||||
{
|
||||
// reporter->InternalError("cannot get data buffer from MIME_Message", "");
|
||||
return false;
|
||||
|
@ -1250,18 +1250,18 @@ void MIME_Entity::SubmitAllHeaders()
|
|||
|
||||
void MIME_Entity::BeginChildEntity()
|
||||
{
|
||||
ASSERT(current_child_entity == 0);
|
||||
ASSERT(current_child_entity == nullptr);
|
||||
current_child_entity = NewChildEntity();
|
||||
message->BeginEntity(current_child_entity);
|
||||
}
|
||||
|
||||
void MIME_Entity::EndChildEntity()
|
||||
{
|
||||
ASSERT(current_child_entity != 0);
|
||||
ASSERT(current_child_entity != nullptr);
|
||||
|
||||
current_child_entity->EndOfData();
|
||||
delete current_child_entity;
|
||||
current_child_entity = 0;
|
||||
current_child_entity = nullptr;
|
||||
}
|
||||
|
||||
void MIME_Entity::IllegalFormat(const char* explanation)
|
||||
|
@ -1349,7 +1349,7 @@ MIME_Mail::MIME_Mail(analyzer::Analyzer* mail_analyzer, bool orig, int buf_size)
|
|||
|
||||
content_hash_length = 0;
|
||||
|
||||
top_level = new MIME_Entity(this, 0); // to be changed to MIME_Mail
|
||||
top_level = new MIME_Entity(this, nullptr); // to be changed to MIME_Mail
|
||||
BeginEntity(top_level);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ public:
|
|||
// Cannot initialize top_level entity because we do
|
||||
// not know its type yet (MIME_Entity / MIME_Mail /
|
||||
// etc.).
|
||||
top_level = 0;
|
||||
top_level = nullptr;
|
||||
finished = false;
|
||||
analyzer = arg_analyzer;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue