1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-05-01 22:57:33 +02:00

feat: Apply modernize-use-nullptr

This commit is contained in:
Sirius Bakke 2018-09-12 20:21:26 +02:00
parent defc5c7b63
commit 7824066a96
197 changed files with 1659 additions and 1659 deletions

View File

@ -71,7 +71,7 @@ void ASTFactory::registerFactory( int type, const char* ast_name, factory_type f
// check validity of arguments...
if( type < Token::MIN_USER_TYPE )
throw ANTLRException("Internal parser error invalid type passed to RegisterFactory");
if( factory == 0 )
if( factory == nullptr )
throw ANTLRException("Internal parser error 0 factory passed to RegisterFactory");
// resize up to and including 'type' and initalize any gaps to default
@ -243,12 +243,12 @@ RefAST ASTFactory::make(ANTLR_USE_NAMESPACE(std)vector<RefAST>& nodes)
// link in children;
for( unsigned int i = 1; i < nodes.size(); i++ )
{
if ( nodes[i] == 0 ) // ignore null nodes
if ( nodes[i] == nullptr ) // ignore null nodes
continue;
if ( root == 0 ) // Set the root and set it up for a flat list
if ( root == nullptr ) // Set the root and set it up for a flat list
root = tail = nodes[i];
else if ( tail == 0 )
else if ( tail == nullptr )
{
root->setFirstChild(nodes[i]);
tail = root->getFirstChild();

View File

@ -32,7 +32,7 @@ ASTRef* ASTRef::getRef(const AST* p)
else
return new ASTRef(pp);
} else
return 0;
return nullptr;
}
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE

View File

@ -273,7 +273,7 @@ ANTLR_API RefAST nullAST;
#if defined(_MSC_VER) && !defined(__ICL) // Microsoft Visual C++
extern ANTLR_API AST* const nullASTptr = 0;
#else
ANTLR_API AST* const nullASTptr = 0;
ANTLR_API AST* const nullASTptr = nullptr;
#endif
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE

View File

@ -83,7 +83,7 @@ void LLkParser::traceOut(const char* rname)
RefToken LLkParser::LT(unsigned int i)
{
//assert(this!=NULL); //clang error: 'this' pointer cannot be null in well-defined C++ code;
assert(inputState!=NULL);
assert(inputState!=nullptr);
TokenBuffer &tb = inputState->getInput();
//assert(&tb!=NULL); //clang error: reference cannot be bound to dereferenced null pointer in well-defined C++ code;
return tb.LT(i);

View File

@ -14,9 +14,9 @@ namespace antlr {
MismatchedTokenException::MismatchedTokenException()
: RecognitionException("Mismatched Token: expecting any AST node","<AST>",-1,-1)
, token(0)
, token(nullptr)
, node(nullASTptr)
, tokenNames(0)
, tokenNames(nullptr)
, numTokens(0)
{
}
@ -30,7 +30,7 @@ MismatchedTokenException::MismatchedTokenException(
int upper_,
bool matchNot
) : RecognitionException("Mismatched Token","<AST>",-1,-1)
, token(0)
, token(nullptr)
, node(node_)
, tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("<empty tree>")) )
, mismatchType(matchNot ? NOT_RANGE : RANGE)
@ -49,7 +49,7 @@ MismatchedTokenException::MismatchedTokenException(
int expecting_,
bool matchNot
) : RecognitionException("Mismatched Token","<AST>",-1,-1)
, token(0)
, token(nullptr)
, node(node_)
, tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("<empty tree>")) )
, mismatchType(matchNot ? NOT_TOKEN : TOKEN)
@ -67,7 +67,7 @@ MismatchedTokenException::MismatchedTokenException(
BitSet set_,
bool matchNot
) : RecognitionException("Mismatched Token","<AST>",-1,-1)
, token(0)
, token(nullptr)
, node(node_)
, tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("<empty tree>")) )
, mismatchType(matchNot ? NOT_SET : SET)

View File

@ -16,7 +16,7 @@ ANTLR_USING_NAMESPACE(std)
NoViableAltException::NoViableAltException(RefAST t)
: RecognitionException("NoViableAlt","<AST>",-1,-1),
token(0), node(t)
token(nullptr), node(t)
{
}

View File

@ -32,7 +32,7 @@ TokenRef* TokenRef::getRef(const Token* p)
else
return new TokenRef(pp);
} else
return 0;
return nullptr;
}
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE

View File

@ -20,7 +20,7 @@ namespace antlr {
*/
TokenStreamSelector::TokenStreamSelector()
: input(0)
: input(nullptr)
{
}

View File

@ -54,7 +54,7 @@ using namespace std;
static unsigned long calculateDimension(FWObject* obj)
{
if (Group::cast(obj)!=NULL)
if (Group::cast(obj)!=nullptr)
{
unsigned long res=0;
for (FWObject::iterator i1=obj->begin(); i1!=obj->end(); ++i1)
@ -68,7 +68,7 @@ static unsigned long calculateDimension(FWObject* obj)
} else
{
Address *a=Address::cast(obj);
if (a!=NULL)
if (a!=nullptr)
{
if (a->isAny()) return LONG_MAX;
return a->dimension();
@ -79,12 +79,12 @@ static unsigned long calculateDimension(FWObject* obj)
void Helper::expand_group_recursive(FWObject *o,list<FWObject*> &ol)
{
if (Group::cast( o )!=NULL)
if (Group::cast( o )!=nullptr)
{
for (FWObject::iterator i2=o->begin(); i2!=o->end(); ++i2)
{
FWObject *o1= *i2;
if (FWReference::cast(o1)!=NULL) o1=FWReference::cast(o1)->getPointer();
if (FWReference::cast(o1)!=nullptr) o1=FWReference::cast(o1)->getPointer();
assert(o1);
expand_group_recursive(o1,ol);
@ -112,7 +112,7 @@ int Helper::findInterfaceByAddress(Address *obj)
int Helper::findInterfaceByAddress(const InetAddr *addr,
const InetAddr *nm)
{
if (addr==NULL) return -1;
if (addr==nullptr) return -1;
#if DEBUG_NETZONE_OPS
cerr << "Helper::findInterfaceByAddress";
@ -150,7 +150,7 @@ int Helper::findInterfaceByAddress(const InetAddr *addr,
cerr << endl;
#endif
if (nm != NULL)
if (nm != nullptr)
{
InetAddrMask interface_subnet(*(i_addr->getAddressPtr()),
*(i_addr->getNetmaskPtr()));
@ -254,7 +254,7 @@ int Helper::findInterfaceByNetzone(const InetAddr *addr, const InetAddr *nm)
{
Address *netzone_addr = Address::cast(*j);
if (netzone_addr == NULL) continue;
if (netzone_addr == nullptr) continue;
#if DEBUG_NETZONE_OPS
cerr << "Helper::findInterfaceByNetzone";
@ -265,7 +265,7 @@ int Helper::findInterfaceByNetzone(const InetAddr *addr, const InetAddr *nm)
// if addr==NULL, return id of the interfacce that has
// net_zone=="any"
if (addr==NULL)
if (addr==nullptr)
{
if (netzone_addr->getId()==FWObjectDatabase::ANY_ADDRESS_ID)
return iface->getId(); // id of the interface
@ -278,7 +278,7 @@ int Helper::findInterfaceByNetzone(const InetAddr *addr, const InetAddr *nm)
const InetAddr *nz_addr = netzone_addr->getAddressPtr();
const InetAddr *nz_netm = netzone_addr->getNetmaskPtr();
if (nm != NULL && nz_netm != NULL)
if (nm != nullptr && nz_netm != nullptr)
{
InetAddrMask nz_subnet(*nz_addr, *nz_netm);
InetAddrMask other_subnet(*addr, *nm);
@ -408,9 +408,9 @@ list<int> Helper::findInterfaceByNetzoneOrAll(RuleElement *re)
} else
{
FWObject *fo = re->front();
if (FWReference::cast(fo)!=NULL) fo=FWReference::cast(fo)->getPointer();
if (FWReference::cast(fo)!=nullptr) fo=FWReference::cast(fo)->getPointer();
Address *a = Address::cast(fo);
if (a==NULL)
if (a==nullptr)
{
Rule *rule = Rule::cast(re->getParent());
Q_UNUSED(rule);

View File

@ -206,7 +206,7 @@ const char* rw[] = {
"icmp-traceroute",
"icmp-conversion-error",
"icmp-mobile-redirect",
NULL
nullptr
};
QSet<QString> NamedObject::reserved_words;
@ -220,7 +220,7 @@ NamedObject::NamedObject(const FWObject *_obj, const QString &_platform)
if (reserved_words.empty())
{
const char** cptr = rw;
while (*cptr!=NULL)
while (*cptr!=nullptr)
{
reserved_words.insert(QString(*cptr));
cptr++;
@ -231,10 +231,10 @@ NamedObject::NamedObject(const FWObject *_obj, const QString &_platform)
QString NamedObject::getCommandWord()
{
if (Address::constcast(obj)!=NULL && Address::constcast(obj)->isAny())
if (Address::constcast(obj)!=nullptr && Address::constcast(obj)->isAny())
return "any";
if (Service::constcast(obj)!=NULL && Service::constcast(obj)->isAny())
if (Service::constcast(obj)!=nullptr && Service::constcast(obj)->isAny())
return "any";
if (Interface::constcast(obj))
@ -262,7 +262,7 @@ QString NamedObject::sanitizeObjectName(const QString &name)
QString NamedObject::createNetworkObjectCommand(const Address *addr_obj)
{
if (addr_obj == NULL) return "";
if (addr_obj == nullptr) return "";
if (addr_obj->isAny()) return "";
if (Interface::constcast(obj)) return "";
@ -323,7 +323,7 @@ QString NamedObject::printPorts(int rs, int re)
QString NamedObject::createServiceObjectCommand(const Service *serv_obj)
{
if (serv_obj == NULL) return "";
if (serv_obj == nullptr) return "";
if (serv_obj->isAny()) return "";
QStringList res;
@ -377,10 +377,10 @@ QString NamedObject::createServiceObjectCommand(const Service *serv_obj)
QString NamedObject::getCommand()
{
if (Address::constcast(obj)!=NULL)
if (Address::constcast(obj)!=nullptr)
return createNetworkObjectCommand(Address::constcast(obj));
if (Service::constcast(obj)!=NULL)
if (Service::constcast(obj)!=nullptr)
return createServiceObjectCommand(Service::constcast(obj));
return "";
@ -388,8 +388,8 @@ QString NamedObject::getCommand()
QString NamedObject::getCommandWhenObjectGroupMember()
{
if (Address::constcast(obj)!=NULL) return "network-object object " + name;
if (Service::constcast(obj)!=NULL) return "service-object object " + name;
if (Address::constcast(obj)!=nullptr) return "network-object object " + name;
if (Service::constcast(obj)!=nullptr) return "service-object object " + name;
return "";
}

View File

@ -51,10 +51,10 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
if (this->getObjectGroupType() == NETWORK)
{
Address *a = Address::cast(obj);
assert(a!=NULL);
assert(a!=nullptr);
const InetAddr *addr = a->getAddressPtr();
ostr << "network-object ";
if (Network::cast(obj)!=NULL)
if (Network::cast(obj)!=nullptr)
{
const InetAddr *mask = a->getNetmaskPtr();
ostr << addr->toString() << " ";
@ -72,7 +72,7 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
{
ostr << "protocol-object ";
Service *s=Service::cast(obj);
assert(s!=NULL);
assert(s!=nullptr);
ostr << s->getProtocolName();
return ostr.str().c_str();
}
@ -81,7 +81,7 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
{
ostr << "icmp-object ";
ICMPService *s=ICMPService::cast(obj);
assert(s!=NULL);
assert(s!=nullptr);
if ( s->getInt("type")== -1)
ostr << "any";
else
@ -93,7 +93,7 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
{
ostr << "port-object ";
Service *s=Service::cast(obj);
assert(s!=NULL);
assert(s!=nullptr);
int rs=TCPUDPService::cast(s)->getDstRangeStart();
int re=TCPUDPService::cast(s)->getDstRangeEnd();

View File

@ -57,7 +57,7 @@ void init(char * const*)
userDataDir = string(getenv("HOME"));
char *lname = getenv("LOGNAME");
if (lname!=NULL)
if (lname!=nullptr)
user_name = QString(lname);
else
{

View File

@ -92,7 +92,7 @@ void CompilerDriver::assembleFwScriptInternal(Cluster *cluster,
time_t tm;
struct tm *stm;
tm = time(NULL);
tm = time(nullptr);
stm = localtime(&tm);
timestr = strdup(ctime(&tm));
timestr[strlen(timestr)-1] = '\0';

View File

@ -103,9 +103,9 @@ using namespace libfwbuilder;
using namespace std;
FWWindow *mw = NULL;
FWBSettings *st = NULL;
FWBApplication *app = NULL;
FWWindow *mw = nullptr;
FWBSettings *st = nullptr;
FWBApplication *app = nullptr;
string cmd_str = "";
command cmd = NONE;
@ -117,7 +117,7 @@ int conflict_res = 1;
vector<string> platforms;
FWObjectDatabase *objdb = NULL;
FWObjectDatabase *objdb = nullptr;
int fwbdebug = 0;
@ -493,7 +493,7 @@ int main(int argc, char * const *argv)
case 'a':
int num=0;
Q_UNUSED(num);
if (optarg!=NULL)
if (optarg!=nullptr)
{
string str = optarg;
num = splitStr(',', str, &ops);
@ -544,7 +544,7 @@ int main(int argc, char * const *argv)
case 'a':
int num=0;
Q_UNUSED(num);
if (optarg!=NULL)
if (optarg!=nullptr)
{
string str = optarg;
num = splitStr(',', str, &ops);
@ -738,8 +738,8 @@ int main(int argc, char * const *argv)
.split("/", QString::SkipEmptyParts);
string fw_name = components.last().toUtf8().constData();
Library *library = NULL;
while (library == NULL)
Library *library = nullptr;
while (library == nullptr)
{
components.pop_back();
string library_path = components.join("/").toUtf8().constData();

View File

@ -59,7 +59,7 @@ void importConfig(const string &import_config,
std::istringstream instream(buffer);
QueueLogger *logger = new QueueLogger();
logger->copyToStderr();
Importer* imp = NULL;
Importer* imp = nullptr;
QStringList sl_buf = QString::fromUtf8(buffer.c_str()).split("\n");
PreImport pi(&sl_buf);

View File

@ -147,7 +147,7 @@ string getAttributeValue(FWObject *obj, const string &attr_name)
return DNSName::cast(obj)->getSourceName();
}
if (TCPUDPService::cast(obj)!=NULL)
if (TCPUDPService::cast(obj)!=nullptr)
{
ostringstream str;
if (attr_name=="src_range_start")
@ -161,7 +161,7 @@ string getAttributeValue(FWObject *obj, const string &attr_name)
if (str.tellp()>0) return str.str();
}
if (ICMPService::cast(obj)!=NULL)
if (ICMPService::cast(obj)!=nullptr)
{
if (attr_name=="icmp_type") return obj->getStr("type");
if (attr_name=="icmp_code") return obj->getStr("code");

View File

@ -248,7 +248,7 @@ bool testPlatform(const string &pl, const string &os)
FWObject* createObject(FWObjectDatabase *objdb,
const string &type, const string &parent)
{
FWObject* obj = NULL;
FWObject* obj = nullptr;
string path;
obj = objdb->create(type);

View File

@ -182,8 +182,8 @@ FWObject* IOSImporter::createTCPUDPNeqObject(const QString &proto,
if ( ! name.isEmpty()) sig.object_name = name;
QString group_name;
FWObject *srv1 = NULL;
FWObject *srv2 = NULL;
FWObject *srv1 = nullptr;
FWObject *srv2 = nullptr;
if (src_port_op == "neq")
{
@ -221,7 +221,7 @@ FWObject* IOSImporter::createTCPUDPNeqObject(const QString &proto,
srv2 = service_maker->createObject(sig);
}
assert(srv1 != NULL && srv2 != NULL);
assert(srv1 != nullptr && srv2 != nullptr);
ObjectMaker maker(Library::cast(library), error_tracker);
FWObject *grp =
@ -250,8 +250,8 @@ void IOSImporter::ignoreCurrentInterface()
void IOSImporter::pushRule()
{
assert(current_ruleset!=NULL);
assert(current_rule!=NULL);
assert(current_ruleset!=nullptr);
assert(current_rule!=nullptr);
// populate all elements of the rule
addMessageToLog(
@ -270,7 +270,7 @@ void IOSImporter::MergeRules::move(FWObject* r)
// classes PolicyRule and RuleSetOptions. If r does not cast to
// PolicyRule, then it must be RuleSetOptions and we should just
// skip it.
if (rule==NULL)
if (rule==nullptr)
{
r->getParent()->remove(r);
return;
@ -310,7 +310,7 @@ Firewall* IOSImporter::finalize()
fw->getManagementObject(); // creates management obj
FWObject *policy = getFirewallObject()->getFirstByType(Policy::TYPENAME);
assert( policy!=NULL );
assert( policy!=nullptr );
if (all_rulesets.size()!=0)
{
@ -401,7 +401,7 @@ Firewall* IOSImporter::finalize()
if (_dir=="out") direction = PolicyRule::Outbound;
// not all access lists are associated with interfaces
if (intf!=NULL)
if (intf!=nullptr)
{
if (fwbdebug)
qDebug() << " interface="
@ -434,6 +434,6 @@ Firewall* IOSImporter::finalize()
}
else
{
return NULL;
return nullptr;
}
}

View File

@ -75,9 +75,9 @@ IPTImporter::IPTImporter(FWObject *lib,
current_table = "";
current_chain = "";
current_state = "";
current_ruleset = NULL;
current_rule = NULL;
last_mark_rule = NULL;
current_ruleset = nullptr;
current_rule = nullptr;
last_mark_rule = nullptr;
clear();
@ -397,13 +397,13 @@ void IPTImporter::processModuleMatches()
{
PolicyRule *rule = PolicyRule::cast(current_rule);
RuleElementSrv* srv = rule->getSrv();
assert(srv!=NULL);
assert(srv!=nullptr);
FWOptions *fwopt = getFirewallObject()->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
FWOptions *ropt = current_rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
addAllModuleMatches(rule);
@ -459,7 +459,7 @@ void IPTImporter::addAllModuleMatches(PolicyRule *rule)
void IPTImporter::addMarkMatch(PolicyRule *rule)
{
RuleElementSrv* srv = rule->getSrv();
assert(srv!=NULL);
assert(srv!=nullptr);
if (rule->getSrv()->isAny() && !match_mark.empty())
{
ObjectSignature sig(error_tracker);
@ -474,7 +474,7 @@ void IPTImporter::addMarkMatch(PolicyRule *rule)
void IPTImporter::addLengthMatch(PolicyRule *rule)
{
RuleElementSrv* srv = rule->getSrv();
assert(srv!=NULL);
assert(srv!=nullptr);
if (rule->getSrv()->isAny() && !length_spec.empty())
{
// create custom service with module "length"
@ -491,7 +491,7 @@ void IPTImporter::addLengthMatch(PolicyRule *rule)
void IPTImporter::addPktTypeMatch(PolicyRule *rule)
{
RuleElementSrv* srv = rule->getSrv();
assert(srv!=NULL);
assert(srv!=nullptr);
if (rule->getSrv()->isAny() && !pkt_type_spec.empty())
{
// create custom service with module "pkttype"
@ -508,7 +508,7 @@ void IPTImporter::addPktTypeMatch(PolicyRule *rule)
void IPTImporter::addLimitMatch(PolicyRule *rule)
{
FWOptions *ropt = rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
if (target!="LOG" && !limit_val.empty())
{
// TODO: this is where we should add support for hashlimit
@ -523,7 +523,7 @@ void IPTImporter::addLimitMatch(PolicyRule *rule)
void IPTImporter::addRecentMatch(PolicyRule *rule)
{
RuleElementSrv* srv = rule->getSrv();
assert(srv!=NULL);
assert(srv!=nullptr);
if (rule->getSrv()->isAny() && !recent_match.empty())
{
// create custom service with module "recent"
@ -541,7 +541,7 @@ void IPTImporter::addRecentMatch(PolicyRule *rule)
void IPTImporter::addStateMatch(libfwbuilder::PolicyRule *rule, const string &state)
{
RuleElementSrv* srv = rule->getSrv();
assert(srv!=NULL);
assert(srv!=nullptr);
if (rule->getSrv()->isAny() && !state.empty())
{
// create custom service with module "state"
@ -569,7 +569,7 @@ PolicyRule* IPTImporter::createPolicyBranch(
bool clear_rule_elements, bool make_stateless)
{
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
if (rs==NULL)
if (rs==nullptr)
rs = getUnidirRuleSet(branch_ruleset_name, Policy::TYPENAME);
branch_rulesets[branch_ruleset_name] = rs;
rs->ruleset->setName(branch_ruleset_name);
@ -584,10 +584,10 @@ PolicyRule* IPTImporter::createPolicyBranch(
rule->setBranch(rs->ruleset);
FWOptions *ropt = rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
ropt->setBool("stateless", true);
if (rule->getParent() != NULL)
if (rule->getParent() != nullptr)
{
ostringstream str1;
str1 << "Called from ruleset " << rule->getParent()->getName()
@ -607,7 +607,7 @@ PolicyRule* IPTImporter::createPolicyBranch(
if (make_stateless)
{
FWOptions *ropt = new_rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
ropt->setBool("stateless", true);
}
@ -622,7 +622,7 @@ NATRule* IPTImporter::createNATBranch(
bool clear_rule_elements)
{
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
if (rs==NULL)
if (rs==nullptr)
rs = getUnidirRuleSet(branch_ruleset_name, NAT::TYPENAME);
branch_rulesets[branch_ruleset_name] = rs;
rs->ruleset->setName(branch_ruleset_name);
@ -636,7 +636,7 @@ NATRule* IPTImporter::createNATBranch(
rule->setRuleType(NATRule::NATBranch);
rule->setBranch(rs->ruleset);
if (rule->getParent() != NULL)
if (rule->getParent() != nullptr)
{
ostringstream str1;
str1 << "Called from ruleset " << rule->getParent()->getName()
@ -670,7 +670,7 @@ NATRule* IPTImporter::createNATBranch(
void IPTImporter::pushRule()
{
// assert(current_ruleset!=NULL);
if (current_rule==NULL) return;
if (current_rule==nullptr) return;
if (current_table=="nat") pushNATRule();
else pushPolicyRule();
@ -684,10 +684,10 @@ void IPTImporter::pushPolicyRule()
rule->setLogging(false);
FWOptions *fwopt = getFirewallObject()->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
FWOptions *ropt = current_rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
bool skip_rule = false;
@ -879,7 +879,7 @@ void IPTImporter::pushPolicyRule()
std::string branch_ruleset_name = target;
action = PolicyRule::Branch;
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
if (rs==NULL)
if (rs==nullptr)
rs = getUnidirRuleSet(branch_ruleset_name, Policy::TYPENAME);
branch_rulesets[branch_ruleset_name] = rs;
@ -917,12 +917,12 @@ void IPTImporter::pushPolicyRule()
{
RuleElementSrv *srv = rule->getSrv();
std::string protocol = "";
FWObject *estab = NULL;
FWObject *estab = nullptr;
FWObjectDatabase *dbroot = getFirewallObject()->getRoot();
FWObject *std_obj = dbroot->findInIndex(FWObjectDatabase::STANDARD_LIB_ID);
estab = std_obj->findObjectByName(CustomService::TYPENAME, "ESTABLISHED");
if (estab == NULL)
if (estab == nullptr)
{
ObjectSignature sig(error_tracker);
sig.type_name = CustomService::TYPENAME;
@ -1034,11 +1034,11 @@ void IPTImporter::pushPolicyRule()
if (target=="CONNMARK" &&
last_mark_rule != NULL &&
last_mark_rule != nullptr &&
!action_params["connmark_save_mark"].empty())
{
FWOptions *lmr_ropt = last_mark_rule->getOptionsObject();
assert(lmr_ropt!=NULL);
assert(lmr_ropt!=nullptr);
lmr_ropt->setBool("ipt_mark_connections", true);
skip_rule = true;
addMessageToLog(
@ -1097,7 +1097,7 @@ void IPTImporter::pushPolicyRule()
}
// add rule to the right ruleset
RuleSet *ruleset = NULL;
RuleSet *ruleset = nullptr;
std::string ruleset_name = "";
// if (isStandardChain(current_chain))
@ -1115,7 +1115,7 @@ void IPTImporter::pushPolicyRule()
UnidirectionalRuleSet *rs = getUnidirRuleSet(current_chain,
Policy::TYPENAME);
assert(rs!=NULL);
assert(rs!=nullptr);
ruleset = rs->ruleset;
ruleset->add(current_rule);
@ -1238,7 +1238,7 @@ void IPTImporter::pushPolicyRule()
markCurrentRuleBad();
}
current_rule = NULL;
current_rule = nullptr;
rule_comment = "";
clear();
@ -1251,10 +1251,10 @@ void IPTImporter::pushNATRule()
NATRule *rule = NATRule::cast(current_rule);
FWOptions *fwopt = getFirewallObject()->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
FWOptions *ropt = current_rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
addOSrc();
addODst();
@ -1276,7 +1276,7 @@ void IPTImporter::pushNATRule()
rule_type = NATRule::Masq;
RuleElementTSrc *re = rule->getTSrc();
assert(re!=NULL);
assert(re!=nullptr);
if ( !o_intf.empty() )
{
newInterface(o_intf);
@ -1292,7 +1292,7 @@ void IPTImporter::pushNATRule()
{
rule_type = NATRule::SNAT;
FWObject *tsrc = NULL;
FWObject *tsrc = nullptr;
if (nat_addr1!=nat_addr2)
{
ObjectSignature sig(error_tracker);
@ -1310,7 +1310,7 @@ void IPTImporter::pushNATRule()
}
RuleElementTSrc *re = rule->getTSrc();
assert(re!=NULL);
assert(re!=nullptr);
re->addRef(tsrc);
if (!nat_port_range_start.empty())
@ -1319,14 +1319,14 @@ void IPTImporter::pushNATRule()
str_tuple nat_port_range(nat_port_range_start, nat_port_range_end);
FWObject *s = createTCPUDPService(nat_port_range, empty_range, protocol);
RuleElementTSrv *re = rule->getTSrv();
assert(re!=NULL);
assert(re!=nullptr);
re->addRef(s);
}
if (!o_intf.empty())
{
RuleElement *itf_o_re = rule->getItfOutb();
assert(itf_o_re!=NULL);
assert(itf_o_re!=nullptr);
newInterface(o_intf);
Interface *intf = all_interfaces[o_intf];
itf_o_re->addRef(intf);
@ -1342,11 +1342,11 @@ void IPTImporter::pushNATRule()
if (current_chain == "OUTPUT")
{
RuleElementOSrc *re = rule->getOSrc();
assert(re!=NULL);
assert(re!=nullptr);
re->addRef(getFirewallObject());
}
FWObject *tdst = NULL;
FWObject *tdst = nullptr;
if (nat_addr1!=nat_addr2)
{
ObjectSignature sig(error_tracker);
@ -1364,7 +1364,7 @@ void IPTImporter::pushNATRule()
}
RuleElementTDst *re = rule->getTDst();
assert(re!=NULL);
assert(re!=nullptr);
re->addRef(tdst);
if (!nat_port_range_start.empty())
@ -1373,14 +1373,14 @@ void IPTImporter::pushNATRule()
str_tuple nat_port_range(nat_port_range_start, nat_port_range_end);
FWObject *s = createTCPUDPService(empty_range, nat_port_range, protocol);
RuleElementTSrv *re = rule->getTSrv();
assert(re!=NULL);
assert(re!=nullptr);
re->addRef(s);
}
if (!i_intf.empty())
{
RuleElement *itf_i_re = rule->getItfInb();
assert(itf_i_re!=NULL);
assert(itf_i_re!=nullptr);
newInterface(i_intf);
Interface *intf = all_interfaces[i_intf];
itf_i_re->addRef(intf);
@ -1392,7 +1392,7 @@ void IPTImporter::pushNATRule()
rule_type = NATRule::Redirect;
RuleElementTDst *re = rule->getTDst();
assert(re!=NULL);
assert(re!=nullptr);
re->addRef(getFirewallObject());
if (!nat_port_range_start.empty())
@ -1401,14 +1401,14 @@ void IPTImporter::pushNATRule()
str_tuple nat_port_range(nat_port_range_start, nat_port_range_end);
FWObject *s = createTCPUDPService(empty_range, nat_port_range, protocol);
RuleElementTSrv *re = rule->getTSrv();
assert(re!=NULL);
assert(re!=nullptr);
re->addRef(s);
}
if ( ! o_intf.empty())
{
RuleElement *itf_o_re = rule->getItfOutb();
assert(itf_o_re!=NULL);
assert(itf_o_re!=nullptr);
newInterface(o_intf);
Interface *intf = all_interfaces[o_intf];
itf_o_re->addRef(intf);
@ -1417,14 +1417,14 @@ void IPTImporter::pushNATRule()
if (target=="NETMAP")
{
FWObject *o = NULL;
FWObject *o = nullptr;
if (!src_a.empty())
{
rule_type = NATRule::SNetnat;
RuleElementTSrc *tsrc = rule->getTSrc();
assert(tsrc!=NULL);
assert(tsrc!=nullptr);
ObjectSignature sig(error_tracker);
sig.type_name = Address::TYPENAME;
@ -1439,7 +1439,7 @@ void IPTImporter::pushNATRule()
rule_type = NATRule::DNetnat;
RuleElementTDst *tdst = rule->getTDst();
assert(tdst!=NULL);
assert(tdst!=nullptr);
ObjectSignature sig(error_tracker);
sig.type_name = Address::TYPENAME;
@ -1463,7 +1463,7 @@ void IPTImporter::pushNATRule()
rule->setAction(NATRule::Branch);
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
if (rs==NULL)
if (rs==nullptr)
{
rs = getUnidirRuleSet(branch_ruleset_name, NAT::TYPENAME);
branch_rulesets[branch_ruleset_name] = rs;
@ -1477,18 +1477,18 @@ void IPTImporter::pushNATRule()
rule->setRuleType(rule_type);
// add rule to the right ruleset
RuleSet *ruleset = NULL;
RuleSet *ruleset = nullptr;
std::string ruleset_name = "";
if (isStandardChain(current_chain))
{
ruleset = RuleSet::cast(
getFirewallObject()->getFirstByType(NAT::TYPENAME));
assert(ruleset!=NULL);
assert(ruleset!=nullptr);
ruleset->add(current_rule);
} else
{
UnidirectionalRuleSet *rs = getUnidirRuleSet(current_chain, NAT::TYPENAME);
assert(rs!=NULL);
assert(rs!=nullptr);
rs->ruleset->add(current_rule);
ruleset = rs->ruleset;
}
@ -1505,7 +1505,7 @@ void IPTImporter::pushNATRule()
// assert( nat!=NULL );
// nat->add(current_rule);
current_rule = NULL;
current_rule = nullptr;
rule_comment = "";
clear();
@ -1540,7 +1540,7 @@ Firewall* IPTImporter::finalize()
fw->getManagementObject(); // creates management obj
FWOptions *fwopt = fw->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
fwopt->setBool("firewall_is_part_of_any_and_networks", false);
@ -1562,7 +1562,7 @@ Firewall* IPTImporter::finalize()
// check if all child objects were populated properly
FWOptions *ropt = rule->getOptionsObject();
assert(ropt != NULL);
assert(ropt != nullptr);
ropt->setBool("stateless", true);
rule->setAction(PolicyRule::Accept);
@ -1597,7 +1597,7 @@ Firewall* IPTImporter::finalize()
if (rs->name == "INPUT")
{
RuleElementDst* dst = rule->getDst();
assert(dst!=NULL);
assert(dst!=nullptr);
dst->addRef(fw);
rule->setDirection(PolicyRule::Inbound);
@ -1622,7 +1622,7 @@ Firewall* IPTImporter::finalize()
if (rs->name == "OUTPUT")
{
RuleElementSrc* src = rule->getSrc();
assert(src!=NULL);
assert(src!=nullptr);
src->addRef(fw);
rule->setDirection(PolicyRule::Outbound);
}
@ -1665,7 +1665,7 @@ Firewall* IPTImporter::finalize()
}
else
{
return NULL;
return nullptr;
}
}
@ -1681,9 +1681,9 @@ UnidirectionalRuleSet* IPTImporter::getUnidirRuleSet(
{
string all_rulesets_index = current_table + "/" + ruleset_name;
UnidirectionalRuleSet *rs = all_rulesets[all_rulesets_index];
if (rs == NULL)
if (rs == nullptr)
{
RuleSet *ruleset = NULL;
RuleSet *ruleset = nullptr;
FWObjectDatabase *dbroot = getFirewallObject()->getRoot();
if (isStandardChain(ruleset_name))
@ -1709,7 +1709,7 @@ UnidirectionalRuleSet* IPTImporter::getUnidirRuleSet(
break;
}
}
if (ruleset == NULL)
if (ruleset == nullptr)
{
ruleset = RuleSet::cast(dbroot->create(Policy::TYPENAME));
FWOptions *rulesetopt = ruleset->getOptionsObject();
@ -1733,7 +1733,7 @@ UnidirectionalRuleSet* IPTImporter::getUnidirRuleSet(
break;
}
}
if (ruleset == NULL)
if (ruleset == nullptr)
{
ruleset = RuleSet::cast(dbroot->create(Policy::TYPENAME));
FWOptions *rulesetopt = ruleset->getOptionsObject();

View File

@ -487,7 +487,7 @@ void PFImporter::convertTcpFlags(QList<int> &flags_list,
FWObject* PFImporter::makeAddressObj(AddressSpec &as)
{
if (as.at == AddressSpec::ANY) return NULL;
if (as.at == AddressSpec::ANY) return nullptr;
if (as.at == AddressSpec::INTERFACE_OR_HOST_NAME)
{
@ -497,7 +497,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
if (int_prop->looksLikeInterface(as.address.c_str()))
{
Interface *intf = getInterfaceByName(as.address);
if (intf == NULL)
if (intf == nullptr)
{
// this interface was never used in "on <intf>" clause before
newInterface(as.address);
@ -532,7 +532,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
if (as.at == AddressSpec::INTERFACE_NETWORK)
{
Interface *intf = getInterfaceByName(as.address);
if (intf == NULL)
if (intf == nullptr)
{
// this interface was never used in "on <intf>" clause before
newInterface(as.address);
@ -540,7 +540,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
}
FWObject *o = intf->getFirstByType(AttachedNetworks::TYPENAME);
if ( o != NULL )
if ( o != nullptr )
{
return o;
} else {
@ -560,7 +560,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
{
error_tracker->registerError(
QObject::tr("import of 'interface:broadcast' is not supported."));
return NULL;
return nullptr;
}
if (as.at == AddressSpec::HOST_ADDRESS)
@ -580,7 +580,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
error_tracker->registerError(
QObject::tr("Warning: matching '%1' is not supported")
.arg(as.address.c_str()));
return NULL;
return nullptr;
}
}
@ -594,7 +594,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
return at;
}
return NULL;
return nullptr;
}
void PFImporter::addLogging()
@ -667,7 +667,7 @@ void PFImporter::pushRule()
else
pushNATRule();
assert(current_rule!=NULL);
assert(current_rule!=nullptr);
if (error_tracker->hasWarnings())
{
@ -692,7 +692,7 @@ void PFImporter::pushRule()
markCurrentRuleBad();
}
current_rule = NULL;
current_rule = nullptr;
rule_comment = "";
clear();
@ -708,7 +708,7 @@ void PFImporter::pushPolicyRule()
// base class uses dictionary all_rulesets to do some checks (e.g.
// countRules()) so we'll create one dummy UnidirectionalRuleSet object
string ruleset_name = ruleset->getName();
if (checkUnidirRuleSet(ruleset_name) == NULL)
if (checkUnidirRuleSet(ruleset_name) == nullptr)
{
UnidirectionalRuleSet *rs = new UnidirectionalRuleSet();
rs->name = ruleset_name;
@ -716,7 +716,7 @@ void PFImporter::pushPolicyRule()
all_rulesets[ruleset_name] = rs;
}
assert(current_rule!=NULL);
assert(current_rule!=nullptr);
// populate all elements of the rule
// Note that standard function
@ -734,7 +734,7 @@ void PFImporter::pushPolicyRule()
PolicyRule *rule = PolicyRule::cast(current_rule);
FWOptions *ropt = current_rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
if (action=="pass")
{
@ -811,7 +811,7 @@ void PFImporter::pushPolicyRule()
for (it=iface_group.begin(); it!=iface_group.end(); ++it)
{
Interface *intf = getInterfaceByName(it->name);
assert(intf!=NULL);
assert(intf!=nullptr);
RuleElement *re =rule->getItf();
re->addRef(intf);
if (it->neg) re->setNeg(true);
@ -853,7 +853,7 @@ void PFImporter::pushPolicyRule()
sig.type_name = TagService::TYPENAME;
sig.tag = tag.c_str();
FWObject *tobj = commitObject(service_maker->createObject(sig));
rule->setTagging(tobj != NULL);
rule->setTagging(tobj != nullptr);
rule->setTagObject(tobj);
}
@ -911,7 +911,7 @@ void PFImporter::pushPolicyRule()
RouteSpec &rs = *it;
Interface *intf = getInterfaceByName(rs.iface);
if (intf == NULL)
if (intf == nullptr)
{
// this interface was never used in "on <intf>" clause before
intf = newInterface(rs.iface);
@ -990,7 +990,7 @@ void PFImporter::pushNATRule()
// base class uses dictionary all_rulesets to do some checks (e.g.
// countRules()) so we'll create one dummy UnidirectionalRuleSet object
string ruleset_name = ruleset->getName();
if (checkUnidirRuleSet(ruleset_name) == NULL)
if (checkUnidirRuleSet(ruleset_name) == nullptr)
{
UnidirectionalRuleSet *rs = new UnidirectionalRuleSet();
rs->name = ruleset_name;
@ -998,7 +998,7 @@ void PFImporter::pushNATRule()
all_rulesets[ruleset_name] = rs;
}
assert(current_rule!=NULL);
assert(current_rule!=nullptr);
QString message_str =
QString("nat rule: action %1; interfaces: %2");
@ -1006,7 +1006,7 @@ void PFImporter::pushNATRule()
NATRule *rule = NATRule::cast(current_rule);
FWOptions *ropt = current_rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
if (action=="nat") rule->setRuleType(NATRule::SNAT);
if (action=="rdr") rule->setRuleType(NATRule::DNAT);
@ -1021,7 +1021,7 @@ void PFImporter::pushNATRule()
for (it=iface_group.begin(); it!=iface_group.end(); ++it)
{
Interface *intf = getInterfaceByName(it->name);
assert(intf!=NULL);
assert(intf!=nullptr);
RuleElement *re =rule->getItfOutb();
re->addRef(intf);
if (it->neg) re->setNeg(true);
@ -1300,7 +1300,7 @@ Firewall* PFImporter::finalize()
if (int_prop->looksLikeInterface(skip_interface_name.c_str()))
{
Interface *intf = getInterfaceByName(skip_interface_name);
if (intf == NULL)
if (intf == nullptr)
{
// this interface was never used in "on
// <intf>" clause before
@ -1377,7 +1377,7 @@ Firewall* PFImporter::finalize()
}
else
{
return NULL;
return nullptr;
}
}
@ -1392,7 +1392,7 @@ Interface* PFImporter::getInterfaceByName(const string &name)
return intf;
}
}
return NULL;
return nullptr;
}
void PFImporter::newAddressTableObject(const string &name, const string &file)
@ -1437,7 +1437,7 @@ void PFImporter::newAddressTableObject(const string &name,
ObjectMaker maker(Library::cast(library), error_tracker);
FWObject *og =
commitObject(maker.createObject(ObjectGroup::TYPENAME, name.c_str()));
assert(og!=NULL);
assert(og!=nullptr);
address_table_registry[name.c_str()] = og;
if (has_negations)

View File

@ -91,11 +91,11 @@ void PIXImporter::clear()
{
Importer::clear();
current_named_object = NULL;
current_named_object = nullptr;
named_object_name = "";
named_object_comment = "";
current_object_group = NULL;
current_object_group = nullptr;
object_group_name = "";
object_group_comment = "";
object_group_service_protocol = "";
@ -142,7 +142,7 @@ Interface* PIXImporter::getInterfaceByLabel(const string &label)
return intf;
}
}
return NULL;
return nullptr;
}
@ -251,8 +251,8 @@ void PIXImporter::fixServiceObjectUsedForBothSrcAndDstPorts()
// named object/object group)
if (src_port_spec.empty() || dst_port_spec.empty()) return;
FWObject *src_port_obj = NULL;
FWObject *dst_port_obj = NULL;
FWObject *src_port_obj = nullptr;
FWObject *dst_port_obj = nullptr;
if (!src_port_spec.empty() &&
named_objects_registry.count(src_port_spec.c_str()) > 0)
@ -265,11 +265,11 @@ void PIXImporter::fixServiceObjectUsedForBothSrcAndDstPorts()
// if both src_port_obj and dst_port_obj are NULL, this means
// both port operations are in-line port matches that will be
// taken are of in the base class functions
if (src_port_obj == NULL && dst_port_obj == NULL) return;
if (src_port_obj == nullptr && dst_port_obj == nullptr) return;
// If only one of the two is NULL, use base class functions to
// fill it in from its port_op and port_spec variables
if (dst_port_obj == NULL)
if (dst_port_obj == nullptr)
{
src_port_spec = "";
src_port_op = "";
@ -278,7 +278,7 @@ void PIXImporter::fixServiceObjectUsedForBothSrcAndDstPorts()
else dst_port_obj = createUDPService();
}
if (src_port_obj == NULL)
if (src_port_obj == nullptr)
{
dst_port_spec = "";
dst_port_op = "";
@ -307,7 +307,7 @@ void PIXImporter::mixServiceObjects(FWObject *src_ports,
FWObject *dst_ports,
FWObject *service_group)
{
if (Group::cast(src_ports)!=NULL)
if (Group::cast(src_ports)!=nullptr)
{
for (FWObject::iterator i1=src_ports->begin(); i1!=src_ports->end(); ++i1)
{
@ -317,7 +317,7 @@ void PIXImporter::mixServiceObjects(FWObject *src_ports,
return;
}
if (Group::cast(dst_ports)!=NULL)
if (Group::cast(dst_ports)!=nullptr)
{
for (FWObject::iterator i1=dst_ports->begin(); i1!=dst_ports->end(); ++i1)
{
@ -354,10 +354,10 @@ void PIXImporter::mixServiceObjects(FWObject *src_ports,
FWObject* PIXImporter::mirrorServiceObjectRecursively(FWObject *obj)
{
FWObject *res = NULL;
FWObject *res = nullptr;
string new_name = obj->getName() + "-mirror";
if (Service::cast(obj) != NULL)
if (Service::cast(obj) != nullptr)
{
FWObject *new_obj = service_maker->getMirroredServiceObject(obj);
if (new_obj)
@ -477,7 +477,7 @@ void PIXImporter::pushRule()
else
pushNATRule();
assert(current_rule!=NULL);
assert(current_rule!=nullptr);
if (error_tracker->hasWarnings())
{
@ -502,7 +502,7 @@ void PIXImporter::pushRule()
markCurrentRuleBad();
}
current_rule = NULL;
current_rule = nullptr;
rule_comment = "";
clear();
@ -511,8 +511,8 @@ void PIXImporter::pushRule()
void PIXImporter::pushPolicyRule()
{
assert(current_ruleset!=NULL);
assert(current_rule!=NULL);
assert(current_ruleset!=nullptr);
assert(current_rule!=nullptr);
// populate all elements of the rule
addMessageToLog(
@ -523,7 +523,7 @@ void PIXImporter::pushPolicyRule()
PolicyRule *rule = PolicyRule::cast(current_rule);
FWOptions *ropt = current_rule->getOptionsObject();
assert(ropt!=NULL);
assert(ropt!=nullptr);
if (action=="permit")
{
@ -678,10 +678,10 @@ Firewall* PIXImporter::finalize()
rearrangeVlanInterfaces();
FWObject *policy = getFirewallObject()->getFirstByType(Policy::TYPENAME);
assert( policy!=NULL );
assert( policy!=nullptr );
FWObject *nat = getFirewallObject()->getFirstByType(NAT::TYPENAME);
assert( nat!=NULL );
assert( nat!=nullptr );
if (all_rulesets.size()!=0)
{
@ -816,7 +816,7 @@ Firewall* PIXImporter::finalize()
<< "dir: " << _dir.c_str();
// not all access lists are associated with interfaces
if (intf != NULL)
if (intf != nullptr)
{
if (fwbdebug)
qDebug() << " interface: "
@ -867,7 +867,7 @@ Firewall* PIXImporter::finalize()
}
else
{
return NULL;
return nullptr;
}
}
@ -1001,7 +1001,7 @@ void PIXImporter::setNamedObjectDescription(const std::string &txt)
{
named_object_comment = QString::fromUtf8(txt.c_str());
if (current_named_object != NULL && ! named_object_name.isEmpty())
if (current_named_object != nullptr && ! named_object_name.isEmpty())
{
current_named_object->setBool(".import-commited", false);
current_named_object->setComment("");
@ -1089,7 +1089,7 @@ void PIXImporter::newObjectGroupICMP(const string &name)
void PIXImporter::setObjectGroupDescription(const std::string &descr)
{
object_group_comment = QString::fromUtf8(descr.c_str());
if (current_object_group != NULL && ! object_group_name.isEmpty())
if (current_object_group != nullptr && ! object_group_name.isEmpty())
{
current_object_group->setBool(".import-commited", false);
current_object_group->setComment("");
@ -1132,7 +1132,7 @@ void PIXImporter::addIPServiceToObjectGroup()
void PIXImporter::addTCPUDPServiceToObjectGroup()
{
FWObject *new_obj = NULL;
FWObject *new_obj = nullptr;
if (protocol.empty() && ! object_group_service_protocol.isEmpty())
protocol = object_group_service_protocol.toStdString();

View File

@ -118,7 +118,7 @@ int GetProtoByName::getProtocolByName(const QString &name)
if (protocols.contains(name)) return protocols[name];
struct protoent *pe = getprotobyname(name.toLatin1().constData());
if (pe!=NULL)
if (pe!=nullptr)
return pe->p_proto;
return -1;

View File

@ -684,7 +684,7 @@ int GetServByName::getPortByName(const QString &name, const QString &proto)
struct servent *se = getservbyname(name.toLatin1().constData(),
proto.toLatin1().constData());
if (se!=NULL)
if (se!=nullptr)
{
int port = ntohs(se->s_port);
//free(se);

View File

@ -79,7 +79,7 @@ void ObjectMakerErrorTracker::registerWarning(const string &msg)
void ObjectMaker::clear()
{
last_created = NULL;
last_created = nullptr;
named_object_registry.clear();
anon_object_registry.clear();
}
@ -93,13 +93,13 @@ FWObject* ObjectMaker::findMatchingObject(const ObjectSignature &sig)
if (named_object_registry.count(sig_str) > 0)
return library->getRoot()->findInIndex(
named_object_registry[sig_str]);
return NULL;
return nullptr;
}
if (anon_object_registry.count(sig_str) > 0)
return library->getRoot()->findInIndex(anon_object_registry[sig_str]);
return NULL;
return nullptr;
}
void ObjectMaker::registerNamedObject(const ObjectSignature &sig,
@ -110,7 +110,7 @@ void ObjectMaker::registerNamedObject(const ObjectSignature &sig,
QString as = anon_sig.toString();
if (anon_object_registry.count(as) > 0) anon_object_registry.remove(as);
named_object_registry[sig.toString()] = (obj!=NULL) ? obj->getId() : -1;
named_object_registry[sig.toString()] = (obj!=nullptr) ? obj->getId() : -1;
}
void ObjectMaker::registerAnonymousObject(const ObjectSignature &sig,
@ -118,7 +118,7 @@ void ObjectMaker::registerAnonymousObject(const ObjectSignature &sig,
{
ObjectSignature anon_sig = sig;
anon_sig.object_name = "";
anon_object_registry[anon_sig.toString()] = (obj!=NULL) ? obj->getId() : -1;
anon_object_registry[anon_sig.toString()] = (obj!=nullptr) ? obj->getId() : -1;
}
/*
@ -140,14 +140,14 @@ FWObject* ObjectMaker::promoteToNamedObject(FWObject *obj,
new_obj->duplicate(obj);
new_obj->setName(objName);
ObjectSignature sig(error_tracker);
new_obj->dispatch(&sig, (void*)(NULL));
new_obj->dispatch(&sig, (void*)nullptr);
registerNamedObject(sig, new_obj);
return new_obj;
} else
{
obj->setName(objName);
ObjectSignature sig(error_tracker);
obj->dispatch(&sig, (void*)(NULL));
obj->dispatch(&sig, (void*)nullptr);
registerNamedObject(sig, obj);
return obj;
}
@ -158,7 +158,7 @@ FWObject* ObjectMaker::promoteToNamedObject(FWObject *obj,
FWObject* ObjectMaker::createObject(const std::string &objType,
const std::string &objName)
{
assert(library!=NULL);
assert(library!=nullptr);
FWBTree tree ;
FWObject *slot = tree.getStandardSlotForObject(library,objType.c_str());
return createObject(slot, objType, objName);
@ -168,9 +168,9 @@ FWObject* ObjectMaker::createObject(FWObject *parent,
const std::string &objType,
const std::string &objName)
{
assert(library!=NULL);
assert(library!=nullptr);
FWObject* o = library->getRoot()->create(objType);
if (parent != NULL)
if (parent != nullptr)
{
if (parent->isReadOnly())
{
@ -201,7 +201,7 @@ FWObject* ObjectMaker::createObject(FWObject *parent,
FWObject* ObjectMaker::createObject(ObjectSignature &)
{
return NULL;
return nullptr;
}
//****************************************************************
@ -230,7 +230,7 @@ void ObjectMaker::prepareForDeduplication(FWObject *root)
{
ObjectSignature sig(error_tracker);
root->dispatch(&sig, (void*)(NULL));
root->dispatch(&sig, (void*)nullptr);
registerNamedObject(sig, root);
registerAnonymousObject(sig, root); // this erases sig.object_name

View File

@ -65,7 +65,7 @@ using namespace libfwbuilder;
using namespace fwcompiler;
FWObjectDatabase *objdb = NULL;
FWObjectDatabase *objdb = nullptr;
class UpgradePredicate: public XMLTools::UpgradePredicate
{

View File

@ -117,7 +117,7 @@ void expand_interface_with_phys_address(Compiler *compiler,
std::list<FWObject*> lipaddr;
std::list<FWObject*> lother;
physAddress *pa = NULL;
physAddress *pa = nullptr;
for (std::list<FWObject*>::iterator j=ol1.begin(); j!=ol1.end(); j++)
{
@ -126,7 +126,7 @@ void expand_interface_with_phys_address(Compiler *compiler,
lipaddr.push_back(*j);
continue;
}
if (physAddress::cast(*j)!=NULL)
if (physAddress::cast(*j)!=nullptr)
{
pa = physAddress::cast(*j);
continue;
@ -137,7 +137,7 @@ void expand_interface_with_phys_address(Compiler *compiler,
/*
* if pa==NULL then this is trivial case: there is no physical address
*/
if (pa==NULL)
if (pa==nullptr)
{
list_result.insert(list_result.end(), ol1.begin(), ol1.end());
return;
@ -163,10 +163,10 @@ void expand_interface_with_phys_address(Compiler *compiler,
*/
FWObject *p = Host::getParentHost(iface);
//FWObject *p = iface->getParentHost();
assert(p!=NULL);
assert(p!=nullptr);
FWOptions *hopt = Host::cast(p)->getOptionsObject();
bool use_mac = (hopt!=NULL && hopt->getBool("use_mac_addr_filter") );
bool use_mac = (hopt!=nullptr && hopt->getBool("use_mac_addr_filter") );
if (lipaddr.empty()) list_result.push_back(pa);
else

View File

@ -78,14 +78,14 @@ bool Address::isAny() const
const Address* Address::getAddressObject() const
{
return NULL;
return nullptr;
}
const InetAddrMask* Address::getInetAddrMaskObjectPtr() const
{
const Address *addr_obj = getAddressObject();
if (addr_obj) return addr_obj->inet_addr_mask;
return NULL;
return nullptr;
}
bool Address::hasInetAddress() const
@ -102,28 +102,28 @@ const InetAddr* Address::getAddressPtr() const
{
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
if (inet_addr_mask) return inet_addr_mask->getAddressPtr();
return NULL;
return nullptr;
}
const InetAddr* Address::getNetmaskPtr() const
{
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
if (inet_addr_mask) return inet_addr_mask->getNetmaskPtr();
return NULL;
return nullptr;
}
const InetAddr* Address::getNetworkAddressPtr() const
{
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
if (inet_addr_mask) return inet_addr_mask->getNetworkAddressPtr();
return NULL;
return nullptr;
}
const InetAddr* Address::getBroadcastAddressPtr() const
{
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
if (inet_addr_mask) return inet_addr_mask->getBroadcastAddressPtr();
return NULL;
return nullptr;
}
void Address::setAddress(const InetAddr& a)
@ -147,20 +147,20 @@ void Address::setAddressNetmask(const std::string&)
unsigned int Address::dimension() const
{
const InetAddrMask *addr_obj = getInetAddrMaskObjectPtr();
if (addr_obj!=NULL) return addr_obj->dimension();
if (addr_obj!=nullptr) return addr_obj->dimension();
return 1;
}
bool Address::belongs(const InetAddr &other) const
{
const InetAddrMask *addr_obj = getInetAddrMaskObjectPtr();
if (addr_obj!=NULL) return addr_obj->belongs(other);
if (addr_obj!=nullptr) return addr_obj->belongs(other);
return false;
}
bool Address::cmp(const FWObject *obj, bool recursive)
{
if (Address::constcast(obj)==NULL) return false;
if (Address::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
if (hasInetAddress()!=Address::constcast(obj)->hasInetAddress()) return false;
if (!hasInetAddress()) return true;

View File

@ -75,7 +75,7 @@ void AddressRange::setNetmask(const InetAddr& ) {}
FWObject& AddressRange::shallowDuplicate(const FWObject *o, bool preserve_id)
{
const AddressRange *n = dynamic_cast<const AddressRange *>(o);
if (n==NULL) {
if (n==nullptr) {
std::ostringstream s;
s << "Attempt to copy incompatible object to AddressRange: objectID=";
@ -91,7 +91,7 @@ FWObject& AddressRange::shallowDuplicate(const FWObject *o, bool preserve_id)
bool AddressRange::cmp(const FWObject *obj, bool recursive)
{
if (AddressRange::constcast(obj)==NULL) return false;
if (AddressRange::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
InetAddr o1b;
@ -113,12 +113,12 @@ void AddressRange::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("start_address")));
assert(n!=NULL);
assert(n!=nullptr);
start_address = InetAddr(AF_UNSPEC, n);
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("end_address")));
assert(n!=NULL);
assert(n!=nullptr);
end_address = InetAddr(AF_UNSPEC, n);
FREEXMLBUFF(n);

View File

@ -68,12 +68,12 @@ void AddressTable::fromXML(xmlNodePtr root)
const char *n;
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("filename")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("filename", n);
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("run_time")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("run_time", n);
FREEXMLBUFF(n);
}
@ -156,7 +156,7 @@ void AddressTable::loadFromSource(bool ipv6, FWOptions *options,
}
if (!buf.empty())
{
new_addr = NULL;
new_addr = nullptr;
if (ipv6 && buf.find(":")!=string::npos)
{
try

View File

@ -46,7 +46,7 @@ using namespace libfwbuilder;
BackgroundOp::BackgroundOp():running(false),connected(true)
{
error = NULL;
error = nullptr;
stop_program = new SyncFlag(false);
iamdead = new SyncFlag(false);
pthread_attr_init(&tattr);
@ -167,7 +167,7 @@ void *background_thread(void *args)
delete logger;
delete isdead;
delete void_pair;
return(NULL);
return(nullptr);
}
*logger << "Exception: " << ex.toString().c_str() << '\n';
bop->error=new FWException(ex);
@ -183,7 +183,7 @@ void *background_thread(void *args)
delete logger;
delete isdead;
delete void_pair;
return(NULL);
return(nullptr);
}
/* operation completed - clear "running" flag */
@ -213,7 +213,7 @@ void *background_thread(void *args)
delete logger;
delete void_pair;
return(NULL);
return(nullptr);
}
}

View File

@ -60,7 +60,7 @@ void Cluster::init(FWObjectDatabase *root)
Firewall::init(root);
// create one conntrack member group
FWObject *state_sync_members = getFirstByType(StateSyncClusterGroup::TYPENAME);
if (state_sync_members == NULL)
if (state_sync_members == nullptr)
{
state_sync_members = root->create(StateSyncClusterGroup::TYPENAME);
state_sync_members->setName("State Sync Group");
@ -115,7 +115,7 @@ ClusterGroup* Cluster::getStateSyncGroupObject()
StateSyncClusterGroup *group = StateSyncClusterGroup::cast(
getFirstByType(StateSyncClusterGroup::TYPENAME));
if (group == NULL)
if (group == nullptr)
{
// create a new ClusterGroup object
group = StateSyncClusterGroup::cast(getRoot()->create(
@ -159,12 +159,12 @@ FWObject& Cluster::duplicate(const FWObject *obj,
void Cluster::updateLastInstalledTimestamp()
{
setInt("lastInstalled", time(NULL));
setInt("lastInstalled", time(nullptr));
}
void Cluster::updateLastModifiedTimestamp()
{
setInt("lastModified", time(NULL));
setInt("lastModified", time(nullptr));
}
bool Cluster::needsInstall()
@ -199,7 +199,7 @@ time_t Cluster::getLastCompiled()
void Cluster::updateLastCompiledTimestamp()
{
setInt("lastCompiled", time(NULL));
setInt("lastCompiled", time(nullptr));
}
bool Cluster::getInactive()
@ -250,7 +250,7 @@ void Cluster::getMembersList(list<libfwbuilder::Firewall*> &members)
{
FWObject *member = FWReference::getObject(*j);
if (ClusterGroupOptions::isA(member)) continue;
Firewall *fw = NULL;
Firewall *fw = nullptr;
// as of 05/04 members of StateSyncClusterGroup are interfaces. See
// tickets #10 and #11
if (Interface::cast(member))
@ -284,7 +284,7 @@ bool Cluster::hasMember(Firewall *fw)
{
FWObject *member = FWReference::getObject(*j);
if (ClusterGroupOptions::isA(member)) continue;
Firewall *member_fw = NULL;
Firewall *member_fw = nullptr;
// as of 05/04/2009 members of StateSyncClusterGroup are
// interfaces. See tickets #10 and #11
if (Interface::cast(member))

View File

@ -35,7 +35,7 @@ ClusterGroup::ClusterGroup() : ObjectGroup()
void ClusterGroup::init(FWObjectDatabase *root)
{
FWObject *gopt = getFirstByType(ClusterGroupOptions::TYPENAME);
if (gopt == NULL)
if (gopt == nullptr)
{
gopt = root->create(ClusterGroupOptions::TYPENAME);
add(gopt);
@ -76,13 +76,13 @@ void ClusterGroup::fromXML(xmlNodePtr parent)
const char *n;
n = FROMXMLCAST(xmlGetProp(parent, TOXMLCAST("type")));
if (n != NULL)
if (n != nullptr)
{
setStr("type", n);
FREEXMLBUFF(n);
}
n = FROMXMLCAST(xmlGetProp(parent, TOXMLCAST("master_iface")));
if (n != NULL)
if (n != nullptr)
{
setStr("master_iface", n);
FREEXMLBUFF(n);
@ -116,7 +116,7 @@ ClusterGroupOptions* ClusterGroup::getOptionsObject()
ClusterGroupOptions *gopt = ClusterGroupOptions::cast(
getFirstByType(ClusterGroupOptions::TYPENAME));
if (gopt == NULL)
if (gopt == nullptr)
{
gopt = ClusterGroupOptions::cast(
getRoot()->create(ClusterGroupOptions::TYPENAME));
@ -127,7 +127,7 @@ ClusterGroupOptions* ClusterGroup::getOptionsObject()
FWObject& ClusterGroup::duplicateForUndo(const FWObject *obj)
{
if (ClusterGroup::constcast(obj)==NULL) return *this;
if (ClusterGroup::constcast(obj)==nullptr) return *this;
setRO(false);
@ -152,7 +152,7 @@ FWObject& ClusterGroup::duplicateForUndo(const FWObject *obj)
}
}
if (their_opts && mine_opts) mine_opts->duplicate(their_opts);
if (their_opts && mine_opts==NULL) addCopyOf(their_opts);
if (their_opts && mine_opts==nullptr) addCopyOf(their_opts);
shallowDuplicate(obj);
return *this;
@ -182,6 +182,6 @@ Interface* ClusterGroup::getInterfaceForMemberFirewall(Firewall *fw)
if (other_iface->isChildOf(fw)) return other_iface;
}
return NULL;
return nullptr;
}

View File

@ -106,7 +106,7 @@ void CustomService::fromXML(xmlNodePtr root)
if (cur && !xmlIsBlankNode(cur))
{
n = FROMXMLCAST(xmlGetProp(cur,TOXMLCAST("platform")));
assert(n!=NULL);
assert(n!=nullptr);
cont = FROMXMLCAST( xmlNodeGetContent(cur) );
if (cont)
{
@ -138,8 +138,8 @@ xmlNodePtr CustomService::toXML(xmlNodePtr parent)
{
const string &platform = (*i).first;
const string &code = (*i).second;
xmlChar *codebuf = xmlEncodeSpecialChars(NULL, STRTOXMLCAST(code) );
opt=xmlNewChild(me,NULL,TOXMLCAST("CustomServiceCommand"), codebuf);
xmlChar *codebuf = xmlEncodeSpecialChars(nullptr, STRTOXMLCAST(code) );
opt=xmlNewChild(me,nullptr,TOXMLCAST("CustomServiceCommand"), codebuf);
FREEXMLBUFF(codebuf);
xmlNewProp(opt, TOXMLCAST("platform") , STRTOXMLCAST(platform));
@ -149,7 +149,7 @@ xmlNodePtr CustomService::toXML(xmlNodePtr parent)
bool CustomService::cmp(const FWObject *obj, bool recursive)
{
if (CustomService::constcast(obj)==NULL) return false;
if (CustomService::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
const CustomService *o2 = CustomService::constcast(obj);

View File

@ -76,12 +76,12 @@ void DNSName::fromXML(xmlNodePtr root)
const char *n;
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dnsrec")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("dnsrec", n);
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dnsrectype")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("dnsrectype", n);
FREEXMLBUFF(n);
@ -91,7 +91,7 @@ void DNSName::fromXML(xmlNodePtr root)
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("run_time")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("run_time", n);
FREEXMLBUFF(n);
}
@ -132,7 +132,7 @@ void DNSName::loadFromSource(bool ipv6, FWOptions *options,
//Address *a = Address::cast(
// getRoot()->create((ipv6)?IPv6::TYPENAME:IPv4::TYPENAME));
int af = AF_INET;
Address *a = NULL;
Address *a = nullptr;
if (ipv6) { a = getRoot()->createIPv6(); af = AF_INET6; }
else a = getRoot()->createIPv4();
getRoot()->add(a);
@ -161,7 +161,7 @@ void DNSName::loadFromSource(bool ipv6, FWOptions *options,
{
err << " Using dummy address in test mode";
int af = AF_INET;
Address *a = NULL;
Address *a = nullptr;
if (ipv6)
{
a = getRoot()->createIPv6();

View File

@ -45,7 +45,7 @@ DynamicGroup::~DynamicGroup() {}
bool DynamicGroup::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
return FWObject::validateChild(o);
}
@ -55,7 +55,7 @@ void DynamicGroup::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
for (xmlNodePtr child = root->xmlChildrenNode;
child != 0; child = child->next) {
child != nullptr; child = child->next) {
if (child->type != XML_ELEMENT_NODE) continue;
assert(strcmp(FROMXMLCAST(child->name), "SelectionCriteria") == 0);
@ -87,8 +87,8 @@ xmlNodePtr DynamicGroup::toXML(xmlNodePtr parent)
if (!splitFilter(*iter, type, keyword)) continue;
if (!makeFilter(filter, type, keyword)) continue;
xmlNodePtr item = xmlNewChild(me, NULL,
TOXMLCAST("SelectionCriteria"), NULL);
xmlNodePtr item = xmlNewChild(me, nullptr,
TOXMLCAST("SelectionCriteria"), nullptr);
xmlNewProp(item, TOXMLCAST("type"), STRTOXMLCAST(type));
xmlNewProp(item, TOXMLCAST("keyword"), STRTOXMLCAST(keyword));
}
@ -164,22 +164,22 @@ void DynamicGroup::loadFromSource(bool ipv6, FWOptions *options, bool test_mode)
static bool isInDeletedObjs(FWObject *obj)
{
FWObject *lib = obj->getLibrary();
return lib == 0 || lib->getId() == FWObjectDatabase::DELETED_OBJECTS_ID;
return lib == nullptr || lib->getId() == FWObjectDatabase::DELETED_OBJECTS_ID;
}
bool DynamicGroup::isMemberOfGroup(FWObject *obj)
{
if (obj == this) return false;
if (ObjectGroup::cast(obj) == 0 && Address::cast(obj) == 0) return false;
if (RuleElement::cast(obj) != 0) return false;
if (ObjectGroup::cast(obj) == nullptr && Address::cast(obj) == nullptr) return false;
if (RuleElement::cast(obj) != nullptr) return false;
if (isInDeletedObjs(obj)) return false;
/* There's no way to figure out what are the "standard" object
groups (like "address tables") from within the fwbuilder
library, so we rely on counting how deep we are in the tree
instead. */
if (ObjectGroup::cast(obj) != 0 &&
if (ObjectGroup::cast(obj) != nullptr &&
obj->getDistanceFromRoot() <= 3) return false;
const set<string> &keywords = obj->getKeywords();

View File

@ -67,7 +67,7 @@ string FWObject::dataDir;
void FWObject::fromXML(xmlNodePtr root)
{
assert(root!=NULL);
assert(root!=nullptr);
const char *n;
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("name")));
@ -92,20 +92,20 @@ void FWObject::fromXML(xmlNodePtr root)
}
n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("keywords")));
if (n != 0) {
if (n != nullptr) {
keywords = stringToSet(n);
dbroot->keywords.insert(keywords.begin(), keywords.end());
FREEXMLBUFF(n);
}
n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("subfolders")));
if (n != 0) {
if (n != nullptr) {
setStr("subfolders", n);
FREEXMLBUFF(n);
}
n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("folder")));
if (n != 0) {
if (n != nullptr) {
setStr("folder", n);
FREEXMLBUFF(n);
}
@ -125,7 +125,7 @@ void FWObject::fromXML(xmlNodePtr root)
if (cur && !xmlIsBlankNode(cur))
{
FWObject *o = dbr->createFromXML(cur);
if (o!=NULL)
if (o!=nullptr)
{
/* Add w/o validation. Trust XML to do that */
add(o, false);
@ -157,9 +157,9 @@ xmlNodePtr FWObject::toXML(xmlNodePtr parent, bool process_children)
xmlNodePtr me = xmlNewChild(
parent,
NULL,
nullptr,
xml_name.empty() ? STRTOXMLCAST(getTypeName()) : STRTOXMLCAST(xml_name),
NULL);
nullptr);
if (id!=-1)
{
@ -199,8 +199,8 @@ FWObject::FWObject()
{
busy = false;
ref_counter = 0;
parent = NULL;
dbroot = NULL;
parent = nullptr;
dbroot = nullptr;
name = "";
comment = "";
id = -1;
@ -217,8 +217,8 @@ FWObject::FWObject(bool new_id)
{
busy = false;
ref_counter = 0;
parent = NULL;
dbroot = NULL;
parent = nullptr;
dbroot = nullptr;
name = "";
comment = "";
id = -1;
@ -261,7 +261,7 @@ void* FWObject::getPrivateData(const string &key) const
{
map<string, void*>::const_iterator it = private_data.find(key);
if(it == private_data.end())
return NULL;
return nullptr;
else
return it->second;
}
@ -323,7 +323,7 @@ FWObject* FWObject::findObjectByName(const string &type,
if(o) return o;
}
return NULL; // not found
return nullptr; // not found
}
FWObject* FWObject::findObjectByAttribute(const std::string &attr,
@ -340,7 +340,7 @@ FWObject* FWObject::findObjectByAttribute(const std::string &attr,
if(o) return o;
}
return NULL; // not found
return nullptr; // not found
}
@ -425,10 +425,10 @@ FWObject& FWObject::duplicate(const FWObject *x, bool preserve_id)
FWObject* FWObject::addCopyOf(const FWObject *x, bool preserve_id)
{
if (x==NULL) return NULL;
if (x==nullptr) return nullptr;
FWObject *o1;
FWObjectDatabase *root = getRoot();
if (root==NULL) root = x->getRoot();
if (root==nullptr) root = x->getRoot();
// do not prepopulte children for objects that do that automatically
// in their constructor
o1 = root->create(x->getTypeName(), -1);
@ -485,8 +485,8 @@ FWObject& FWObject::shallowDuplicate(const FWObject *x, bool preserve_id)
setId(old_id);
}
if (dbroot==NULL) setRoot(x->getRoot());
if (dbroot!=NULL) dbroot->addToIndex(this);
if (dbroot==nullptr) setRoot(x->getRoot());
if (dbroot!=nullptr) dbroot->addToIndex(this);
setReadOnly(x->ro);
setDirty(true);
@ -499,7 +499,7 @@ class InheritsFWOptions: public std::unary_function<FWObject*, bool>
InheritsFWOptions() {}
bool operator()(const FWObject *o) const
{
return FWOptions::constcast(o)!=NULL;
return FWOptions::constcast(o)!=nullptr;
}
};
@ -540,7 +540,7 @@ const string& FWObject::getLibraryName() const
FWObject* FWObject::getLibrary() const
{
const FWObject *p=this;
while (p!=NULL && !Library::isA(p) ) p=p->getParent();
while (p!=nullptr && !Library::isA(p) ) p=p->getParent();
return (FWObject*)p;
}
@ -552,7 +552,7 @@ FWObjectDatabase* FWObject::getRoot() const
int FWObject::getDistanceFromRoot() const
{
int count = 0;
for (FWObject *obj = getParent(); obj != 0; obj = obj->getParent()) {
for (FWObject *obj = getParent(); obj != nullptr; obj = obj->getParent()) {
count++;
}
return count;
@ -572,9 +572,9 @@ string FWObject::getPath(bool relative, bool detailed) const
list<string> res;
const FWObject *p = this;
if (p == NULL) res.push_front("(0x0)");
if (p == nullptr) res.push_front("(0x0)");
while (p!=NULL)
while (p!=nullptr)
{
if (relative && Library::isA(p)) break;
ostringstream s;
@ -620,7 +620,7 @@ void FWObject::setId(int c)
{
id = c;
setDirty(true);
if (dbroot!=NULL) dbroot->addToIndex(this);
if (dbroot!=nullptr) dbroot->addToIndex(this);
}
}
@ -749,7 +749,7 @@ void FWObject::dump(std::ostream &f,bool recursive,bool brief,int offset) const
{
list<FWObject*>::const_iterator m;
for (m=begin(); m!=end(); ++m) {
if ( (o=(*m))!=NULL) o->dump(f,recursive,brief,offset+2);
if ( (o=(*m))!=nullptr) o->dump(f,recursive,brief,offset+2);
}
}
} else
@ -764,7 +764,7 @@ void FWObject::dump(std::ostream &f,bool recursive,bool brief,int offset) const
f << string(offset,' ') << "Type: " << getTypeName() << endl;
f << string(offset,' ') << "Library:" << getLibrary() << endl;
// f << string(offset,' ') << "Path: " << getPath() << endl;
n=(getParent()!=NULL)?getParent()->getName():"";
n=(getParent()!=nullptr)?getParent()->getName():"";
f << string(offset,' ') << "Parent: " << getParent()
<< " name=" << n << endl;
f << string(offset,' ') << "Root: " << getRoot() << endl;
@ -780,7 +780,7 @@ void FWObject::dump(std::ostream &f,bool recursive,bool brief,int offset) const
list<FWObject*>::const_iterator m;
for (m=begin(); m!=end(); ++m)
{
if ( (o=(*m))!=NULL) o->dump(f,recursive,brief,offset+2);
if ( (o=(*m))!=nullptr) o->dump(f,recursive,brief,offset+2);
}
}
}
@ -807,7 +807,7 @@ void FWObject::_adopt(FWObject *obj)
void FWObject::addAt(int where_id, FWObject *obj)
{
FWObject *p = getRoot()->findInIndex( where_id );
assert (p!=NULL);
assert (p!=nullptr);
p->add(obj);
}
@ -816,7 +816,7 @@ void FWObject::add(FWObject *obj, bool validate)
checkReadOnly();
FWObject *old_parent = obj->getParent();
if (old_parent != NULL)
if (old_parent != nullptr)
{
cerr << "WARNING: object " << obj << " "
<< "(name: " << obj->getName()
@ -829,7 +829,7 @@ void FWObject::add(FWObject *obj, bool validate)
<< " type: " << getTypeName() << ") "
<< endl;
assert(old_parent == NULL);
assert(old_parent == nullptr);
}
// do not allow to add the same object twice
@ -858,7 +858,7 @@ void FWObject::add(FWObject *obj, bool validate)
void FWObject::reparent(FWObject *obj, bool validate)
{
FWObject *old_parent = obj->getParent();
if (old_parent != NULL && old_parent != this)
if (old_parent != nullptr && old_parent != this)
{
old_parent->remove(obj, false);
add(obj, validate);
@ -896,8 +896,8 @@ void FWObject::insert_before(FWObject *o1, FWObject *obj)
{
checkReadOnly();
if (obj == NULL) return;
if (o1 == NULL)
if (obj == nullptr) return;
if (o1 == nullptr)
{
insert(begin(), obj);
_adopt(obj);
@ -918,7 +918,7 @@ void FWObject::insert_after(FWObject *o1, FWObject *obj)
{
checkReadOnly();
if (obj == NULL) return;
if (obj == nullptr) return;
list<FWObject*>::iterator m = find(begin(), end(), o1);
if (m != end())
@ -964,7 +964,7 @@ void FWObject::remove(FWObject *obj, bool delete_if_last)
delete obj;
}
obj->parent = NULL;
obj->parent = nullptr;
}
}
@ -1130,7 +1130,7 @@ bool FWObject::verifyTree()
FWObject *o_parent = o->getParent();
if (o_parent != this)
{
if (o_parent != NULL)
if (o_parent != nullptr)
{
cerr << "WARNING: Object " << o << " (name: '" << o->getName()
<< "' type: " << o->getTypeName() << ")"
@ -1264,7 +1264,7 @@ bool FWObject::isChildOf(FWObject *obj)
cerr << endl;
#endif
FWObject *p=this;
while (p!=NULL && p!=obj) p=p->getParent();
while (p!=nullptr && p!=obj) p=p->getParent();
return (p==obj);
}
@ -1289,9 +1289,9 @@ FWObject* FWObject::getById (int id, bool recursive)
int oid = o->getId();
if(id==oid) return o;
if(recursive && (o=o->getById(id, true))!=NULL ) return o;
if(recursive && (o=o->getById(id, true))!=nullptr ) return o;
}
return NULL; // not found
return nullptr; // not found
}
FWObject* FWObject::getFirstByType(const string &type_name) const
@ -1335,7 +1335,7 @@ FWObjectTypedChildIterator FWObject::findByType(const std::string &type_name) co
void FWObject::setDirty(bool f)
{
FWObjectDatabase *dbr = getRoot();
if (dbr==NULL) return;
if (dbr==nullptr) return;
if (dbr==this) dirty = f;
else dbr->dirty = f;
}
@ -1343,7 +1343,7 @@ void FWObject::setDirty(bool f)
bool FWObject::isDirty()
{
FWObjectDatabase *dbr = getRoot();
if (dbr==NULL) return false;
if (dbr==nullptr) return false;
return (dbr->dirty);
}
@ -1376,7 +1376,7 @@ void FWObject::setReadOnly(bool f)
bool FWObject::isReadOnly()
{
FWObjectDatabase *dbr = getRoot();
if (dbr==NULL || dbr->busy) return false;
if (dbr==nullptr || dbr->busy) return false;
FWObject *p=this;
while (p)
{
@ -1504,7 +1504,7 @@ FWObject::tree_iterator& FWObject::tree_iterator::operator++()
}
FWObject *p = node;
while (node->getParent()!=NULL)
while (node->getParent()!=nullptr)
{
p = node->getParent();
@ -1591,7 +1591,7 @@ void FWObject::replaceReferenceInternal(int old_id, int new_id, int &counter)
if (old_id == new_id) return;
FWReference *ref = FWReference::cast(this);
if (ref==NULL)
if (ref==nullptr)
{
for (FWObject::iterator j1=begin(); j1!=end(); ++j1)
(*j1)->replaceReferenceInternal(old_id, new_id, counter);
@ -1607,7 +1607,7 @@ void FWObject::replaceReferenceInternal(int old_id, int new_id, int &counter)
void FWObject::findDependencies(list<FWObject*> &deps)
{
int loop_id = time(NULL);
int loop_id = time(nullptr);
_findDependencies_internal(this, deps, loop_id);
}
@ -1615,9 +1615,9 @@ void FWObject::_findDependencies_internal(FWObject *obj,
list<FWObject*> &deps,
int anti_loop_id)
{
if (obj==NULL) return;
if (obj==nullptr) return;
if (FWOptions::cast(obj)) return;
if (FWReference::cast(obj)!=NULL)
if (FWReference::cast(obj)!=nullptr)
{
_findDependencies_internal(FWReference::cast(obj)->getPointer(),
deps, anti_loop_id);

View File

@ -55,7 +55,7 @@ void FWOptions::fromXML(xmlNodePtr root)
if (cur && !xmlIsBlankNode(cur))
{
n = FROMXMLCAST(xmlGetProp(cur,TOXMLCAST("name")));
assert(n!=NULL);
assert(n!=nullptr);
cont = FROMXMLCAST( xmlNodeGetContent(cur) );
if (cont)
{
@ -72,9 +72,9 @@ xmlNodePtr FWOptions::toXML(xmlNodePtr root)
xmlNodePtr opt;
xmlNodePtr me = xmlNewChild(
root, NULL,
root, nullptr,
xml_name.empty() ? STRTOXMLCAST(getTypeName()) : STRTOXMLCAST(xml_name),
NULL);
nullptr);
for(map<string, string>::const_iterator i=data.begin(); i!=data.end(); ++i)
{
@ -87,7 +87,7 @@ xmlNodePtr FWOptions::toXML(xmlNodePtr root)
STRTOXMLCAST(value) );
// xmlChar *valbuf = xmlEncodeEntitiesReentrant(root->doc,
// STRTOXMLCAST(value) );
opt = xmlNewChild(me, NULL, TOXMLCAST("Option"), valbuf);
opt = xmlNewChild(me, nullptr, TOXMLCAST("Option"), valbuf);
FREEXMLBUFF(valbuf);
xmlNewProp(opt, TOXMLCAST("name") , STRTOXMLCAST(name));

View File

@ -48,7 +48,7 @@ FWReference::FWReference(FWObject *p)
FWReference::FWReference()
{
setPointer(NULL);
setPointer(nullptr);
}
FWReference::~FWReference() {}
@ -56,11 +56,11 @@ FWReference::~FWReference() {}
void FWReference::fromXML(xmlNodePtr root)
{
assert(root!=NULL);
assert(root!=nullptr);
FWObject::fromXML(root);
const char *n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("ref")));
assert(n!=NULL);
assert(n!=nullptr);
str_ref = n;
//setInt("ref", n);
// if object with id str_ref has not been loaded yet,
@ -75,9 +75,9 @@ xmlNodePtr FWReference::toXML(xmlNodePtr parent)
{
xmlNodePtr me = xmlNewChild(
parent,
NULL,
nullptr,
xml_name.empty() ? STRTOXMLCAST(getTypeName()) : STRTOXMLCAST(xml_name),
NULL);
nullptr);
if (int_ref == -1 && !str_ref.empty())
int_ref = FWObjectDatabase::getIntId(str_ref);
@ -102,7 +102,7 @@ FWObject& FWReference::shallowDuplicate(const FWObject *_other,
bool FWReference::cmp(const FWObject *obj, bool /* UNUSED recursive */)
{
const FWReference *rx = FWReference::constcast(obj);
if (rx == NULL) return false;
if (rx == nullptr) return false;
if (int_ref != rx->int_ref || str_ref != rx->str_ref) return false;
return true;
}
@ -167,7 +167,7 @@ void FWReference::dump(std::ostream &f, bool recursive, bool brief, int offset)
FWObject* FWReference::getObject(FWObject* o)
{
if (o==NULL) return NULL;
if (FWReference::cast(o)!=NULL) return FWReference::cast(o)->getPointer();
if (o==nullptr) return nullptr;
if (FWReference::cast(o)!=nullptr) return FWReference::cast(o)->getPointer();
return o;
}

View File

@ -66,7 +66,7 @@ Firewall::Firewall()
void Firewall::init(FWObjectDatabase *root)
{
FWObject *opt = getFirstByType(FirewallOptions::TYPENAME);
if (opt == NULL)
if (opt == nullptr)
{
add( root->createFirewallOptions() );
RuleSet *p;
@ -87,45 +87,45 @@ Firewall::~Firewall() {}
void Firewall::fromXML(xmlNodePtr root)
{
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("platform")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("platform", n);
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("version")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("version", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("host_OS")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("host_OS", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lastModified")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("lastModified", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lastInstalled")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("lastInstalled", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lastCompiled")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("lastCompiled", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("inactive")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("inactive", n);
FREEXMLBUFF(n);
@ -344,12 +344,12 @@ FWObject& Firewall::duplicateForUndo(const FWObject *obj)
void Firewall::updateLastInstalledTimestamp()
{
setInt("lastInstalled",time(NULL));
setInt("lastInstalled",time(nullptr));
}
void Firewall::updateLastModifiedTimestamp()
{
setInt("lastModified",time(NULL));
setInt("lastModified",time(nullptr));
}
bool Firewall::needsInstall()
@ -382,7 +382,7 @@ time_t Firewall::getLastCompiled()
}
void Firewall::updateLastCompiledTimestamp()
{
setInt("lastCompiled",time(NULL));
setInt("lastCompiled",time(nullptr));
}
bool Firewall::getInactive()

View File

@ -96,8 +96,8 @@ bool Group::hasMember(FWObject *o)
FWObject& Group::duplicateForUndo(const FWObject *obj)
{
setRO(false);
if ((obj->size() && FWReference::cast(obj->front())!=NULL) ||
(this->size() && FWReference::cast(this->front())!=NULL))
if ((obj->size() && FWReference::cast(obj->front())!=nullptr) ||
(this->size() && FWReference::cast(this->front())!=nullptr))
{
destroyChildren();
for(list<FWObject*>::const_iterator m=obj->begin(); m!=obj->end(); ++m)

View File

@ -48,7 +48,7 @@ Host::Host()
void Host::init(FWObjectDatabase *root)
{
FWObject *opt = getFirstByType(HostOptions::TYPENAME);
if (opt == NULL)
if (opt == nullptr)
add( root->createHostOptions() );
}
@ -69,7 +69,7 @@ xmlNodePtr Host::toXML(xmlNodePtr parent)
FWObject *o;
for(FWObjectTypedChildIterator j=findByType(Interface::TYPENAME); j!=j.end(); ++j)
if((o=(*j))!=NULL )
if((o=(*j))!=nullptr )
o->toXML(me);
o=getFirstByType( Management::TYPENAME );
@ -146,13 +146,13 @@ const InetAddr* Host::getManagementAddress()
}
}
return NULL;
return nullptr;
}
const Address* Host::getAddressObject() const
{
FWObjectTypedChildIterator j = findByType(Interface::TYPENAME);
if (j == j.end()) return NULL;
if (j == j.end()) return nullptr;
return Interface::cast(*j)->getAddressObject();
}
@ -176,7 +176,7 @@ int Host::countInetAddresses(bool skip_loopback) const
FWObject* Host::getParentHost(FWObject *obj)
{
FWObject *parent_h = obj;
while (parent_h != NULL && Host::cast(parent_h) == NULL)
while (parent_h != nullptr && Host::cast(parent_h) == nullptr)
parent_h = parent_h->getParent();
return parent_h;
}

View File

@ -52,12 +52,12 @@ void ICMPService::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("type")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("type", n);
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("code")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("code", n);
FREEXMLBUFF(n);

View File

@ -94,82 +94,82 @@ void IPService::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("protocol_num")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("protocol_num", n);
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("fragm")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("fragm", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("short_fragm")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("short_fragm", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("any_opt")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("any_opt", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lsrr")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("lsrr", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("ssrr")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("ssrr", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("rr")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("rr", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("ts")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("ts", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("tos")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("tos", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dscp")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("dscp", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("rtralt")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("rtralt", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("rtralt_value")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("rtralt_value", n);
FREEXMLBUFF(n);

View File

@ -66,7 +66,7 @@ void IPv4::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char* n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
assert(n!=NULL);
assert(n!=nullptr);
// strip whitespace and other non-numeric characters at the beginng and end
string addr(n);
@ -83,7 +83,7 @@ void IPv4::fromXML(xmlNodePtr root)
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
assert(n!=NULL);
assert(n!=nullptr);
string netm(n);
first = netm.find_first_of("0123456789");

View File

@ -81,12 +81,12 @@ void IPv6::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char* n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
assert(n!=NULL);
assert(n!=nullptr);
setAddress(InetAddr(AF_INET6, n));
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
assert(n!=NULL);
assert(n!=nullptr);
if (strlen(n))
{
if (string(n).find(":")!=string::npos)

View File

@ -69,11 +69,11 @@ InetAddrMask::InetAddrMask(bool)
// variables. This constructor should only be used by classes that
// inherit InetAddrMask and create address, netmask themselves,
// such as Inet6AddrMask
address = NULL;
netmask = NULL;
broadcast_address = NULL;
network_address = NULL;
last_host = NULL;
address = nullptr;
netmask = nullptr;
broadcast_address = nullptr;
network_address = nullptr;
last_host = nullptr;
}
InetAddrMask::InetAddrMask()
@ -146,11 +146,11 @@ InetAddrMask::InetAddrMask(const string &s)
InetAddrMask::~InetAddrMask()
{
if (address!=NULL) delete address;
if (netmask!=NULL) delete netmask;
if (network_address!=NULL) delete network_address;
if (broadcast_address!=NULL) delete broadcast_address;
if (last_host!=NULL) delete last_host;
if (address!=nullptr) delete address;
if (netmask!=nullptr) delete netmask;
if (network_address!=nullptr) delete network_address;
if (broadcast_address!=nullptr) delete broadcast_address;
if (last_host!=nullptr) delete last_host;
}
bool InetAddrMask::isAny()

View File

@ -105,7 +105,7 @@ FWObject& Interface::duplicate(const FWObject *x, bool preserve_id)
FWObject::duplicate(x, preserve_id);
const Interface *rx = Interface::constcast(x);
if (rx!=NULL)
if (rx!=nullptr)
{
bcast_bits = rx->bcast_bits;
ostatus = rx->ostatus;
@ -130,7 +130,7 @@ void Interface::duplicateWithIdMapping(const FWObject *src,
{
FWObject *src_obj = *m;
FWObject *dst_obj_copy = addCopyOf(src_obj, preserve_id);
if (src_obj!=NULL && dst_obj_copy!=NULL)
if (src_obj!=nullptr && dst_obj_copy!=nullptr)
id_mapping[src_obj->getId()] = dst_obj_copy->getId();
}
@ -140,7 +140,7 @@ void Interface::duplicateWithIdMapping(const FWObject *src,
bool Interface::cmp(const FWObject *obj, bool recursive)
{
const Interface *rx = Interface::constcast(obj);
if (rx == NULL) return false;
if (rx == nullptr) return false;
if (bcast_bits != rx->bcast_bits ||
ostatus != rx->ostatus ||
snmp_type != rx->snmp_type) return false;
@ -154,56 +154,56 @@ void Interface::fromXML(xmlNodePtr root)
const char *n;
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("security_level")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("security_level",n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dyn")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("dyn",n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("unnum")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("unnum",n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("unprotected")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("unprotected",n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dedicated_failover")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("dedicated_failover",n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("mgmt")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("mgmt",n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("label")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("label",n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("network_zone")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("network_zone", n);
FREEXMLBUFF(n);
@ -230,19 +230,19 @@ xmlNodePtr Interface::toXML(xmlNodePtr parent)
for(FWObjectTypedChildIterator j1=findByType(IPv4::TYPENAME);
j1!=j1.end(); ++j1)
{
if ((o=(*j1))!=NULL )
if ((o=(*j1))!=nullptr )
o->toXML(me);
}
for(FWObjectTypedChildIterator j1=findByType(IPv6::TYPENAME);
j1!=j1.end(); ++j1)
{
if ((o=(*j1))!=NULL )
if ((o=(*j1))!=nullptr )
o->toXML(me);
}
for(FWObjectTypedChildIterator j2=findByType(physAddress::TYPENAME);
j2!=j2.end(); ++j2)
{
if ((o=(*j2))!=NULL )
if ((o=(*j2))!=nullptr )
o->toXML(me);
}
@ -256,7 +256,7 @@ xmlNodePtr Interface::toXML(xmlNodePtr parent)
for(FWObjectTypedChildIterator j1=findByType(Interface::TYPENAME);
j1!=j1.end(); ++j1)
{
if((o=(*j1))!=NULL)
if((o=(*j1))!=nullptr)
o->toXML(me);
}
@ -276,14 +276,14 @@ FWOptions* Interface::getOptionsObject()
{
FWOptions *iface_opt = FWOptions::cast(getFirstByType(InterfaceOptions::TYPENAME));
if (iface_opt == NULL)
if (iface_opt == nullptr)
{
iface_opt = FWOptions::cast(getRoot()->create(InterfaceOptions::TYPENAME));
add(iface_opt);
// set default interface options
const FWObject *parent_host = Host::getParentHost(this);
if (parent_host != NULL)
if (parent_host != nullptr)
{
const string host_OS = parent_host->getStr("host_OS");
try
@ -303,7 +303,7 @@ FWOptions* Interface::getOptionsObject()
FWOptions* Interface::getOptionsObjectConst() const
{
FWOptions *iface_opt = FWOptions::cast(getFirstByType(InterfaceOptions::TYPENAME));
if (iface_opt == NULL)
if (iface_opt == nullptr)
cerr << "Interface "
<< getName()
<< " ("
@ -437,7 +437,7 @@ physAddress* Interface::getPhysicalAddress () const
void Interface::setPhysicalAddress(const std::string &paddr)
{
physAddress *pa=getPhysicalAddress();
if (pa!=NULL)
if (pa!=nullptr)
{
pa->setPhysAddress(paddr);
} else
@ -461,7 +461,7 @@ void Interface::setLabel(const string& n)
const Address* Interface::getAddressObject() const
{
Address *res = Address::cast(getFirstByType(IPv4::TYPENAME));
if (res==NULL)
if (res==nullptr)
res = Address::cast(getFirstByType(IPv6::TYPENAME));
return res;
}
@ -493,7 +493,7 @@ int Interface::countInetAddresses(bool skip_loopback) const
bool Interface::isFailoverInterface() const
{
return getFirstByType(FailoverClusterGroup::TYPENAME) != NULL;
return getFirstByType(FailoverClusterGroup::TYPENAME) != nullptr;
}
void Interface::replaceReferenceInternal(int old_id, int new_id, int &counter)

View File

@ -63,7 +63,7 @@ InterfaceData::InterfaceData(const InterfaceData& other) : addr_mask()
InetAddrMask *am;
const InetAddr *ad = (*i)->getAddressPtr();
const InetAddr *nm = (*i)->getNetmaskPtr();
if (ad==NULL) continue;
if (ad==nullptr) continue;
if (ad->isV6())
{
am = new Inet6AddrMask();
@ -109,7 +109,7 @@ InterfaceData::InterfaceData(const Interface &iface) : addr_mask()
isUnnumbered = iface.isUnnumbered();
isBridgePort = iface.isBridgePort();
libfwbuilder::physAddress *pa = iface.getPhysicalAddress();
if (pa!=NULL)
if (pa!=nullptr)
mac_addr = pa->getPhysAddress();
label = iface.getLabel();
networkZone = iface.getStr("network_zone");

View File

@ -184,42 +184,42 @@ void Interval::fromXML(xmlNodePtr root)
const char *n;
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_minute")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("from_minute", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_hour")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("from_hour", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_day")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("from_day", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_month")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("from_month", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_year")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("from_year", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_weekday")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("from_weekday", n);
FREEXMLBUFF(n);
@ -227,49 +227,49 @@ void Interval::fromXML(xmlNodePtr root)
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_minute")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("to_minute", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_hour")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("to_hour", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_day")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("to_day", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_month")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("to_month", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_year")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("to_year", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_weekday")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("to_weekday", n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("days_of_week")));
if (n!=NULL)
if (n!=nullptr)
{
setStr("days_of_week", n);
FREEXMLBUFF(n);

View File

@ -43,7 +43,7 @@ IntervalGroup::~IntervalGroup() {}
bool IntervalGroup::validateChild(FWObject *o)
{
FWObject *oo = o;
if (FWObjectReference::cast(o)!=NULL)
if (FWObjectReference::cast(o)!=nullptr)
oo = FWObjectReference::cast(o)->getPointer();
string otype = oo->getTypeName();

View File

@ -49,7 +49,7 @@ bool Library::validateChild(FWObject*)
void Library::fromXML(xmlNodePtr root)
{
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("color")));
if(n!=NULL) // color is not a mandatory attribute
if(n!=nullptr) // color is not a mandatory attribute
{
setStr("color", n);
FREEXMLBUFF(n);

View File

@ -105,7 +105,7 @@ xmlNodePtr Management::toXML(xmlNodePtr parent)
bool Management::cmp(const FWObject *obj, bool recursive)
{
if (Management::constcast(obj)==NULL) return false;
if (Management::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
const Management *o2=Management::constcast(obj);
@ -242,7 +242,7 @@ xmlNodePtr PolicyInstallScript::toXML(xmlNodePtr parent)
bool PolicyInstallScript::cmp(const FWObject *obj, bool recursive)
{
if (PolicyInstallScript::constcast(obj)==NULL) return false;
if (PolicyInstallScript::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
const PolicyInstallScript *o2=PolicyInstallScript::constcast(obj);
@ -348,7 +348,7 @@ xmlNodePtr SNMPManagement::toXML(xmlNodePtr parent)
bool SNMPManagement::cmp(const FWObject *obj, bool recursive)
{
if (SNMPManagement::constcast(obj)==NULL) return false;
if (SNMPManagement::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
const SNMPManagement *o2=SNMPManagement::constcast(obj);
@ -424,12 +424,12 @@ void FWBDManagement::setEnabled(bool v)
void FWBDManagement::fromXML(xmlNodePtr parent)
{
const char *n=FROMXMLCAST(xmlGetProp(parent,TOXMLCAST("identity")));
assert(n!=NULL);
assert(n!=nullptr);
identity_id = n;
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(parent,TOXMLCAST("port")));
assert(n!=NULL);
assert(n!=nullptr);
port = atoi(n);
FREEXMLBUFF(n);
@ -456,7 +456,7 @@ xmlNodePtr FWBDManagement::toXML(xmlNodePtr parent)
bool FWBDManagement::cmp(const FWObject *obj, bool recursive)
{
if (FWBDManagement::constcast(obj)==NULL) return false;
if (FWBDManagement::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
const FWBDManagement *o2=FWBDManagement::constcast(obj);

View File

@ -47,7 +47,7 @@ NAT::~NAT() {}
Rule* NAT::createRule()
{
FWObjectDatabase* db=getRoot();
assert(db!=NULL);
assert(db!=nullptr);
return db->createNATRule();
}

View File

@ -64,12 +64,12 @@ void Network::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
assert(n!=NULL);
assert(n!=nullptr);
setAddress(InetAddr(n));
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
assert(n!=NULL);
assert(n!=nullptr);
setNetmask(InetAddr(n));
FREEXMLBUFF(n);
}
@ -120,12 +120,12 @@ const InetAddr* Network::getFirstHostPtr() const
{
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
if (inet_addr_mask) return inet_addr_mask->getFirstHostPtr();
return NULL;
return nullptr;
}
const InetAddr* Network::getLastHostPtr() const
{
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
if (inet_addr_mask) return inet_addr_mask->getLastHostPtr();
return NULL;
return nullptr;
}

View File

@ -78,12 +78,12 @@ void NetworkIPv6::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
assert(n!=NULL);
assert(n!=nullptr);
setAddress(InetAddr(AF_INET6, n));
FREEXMLBUFF(n);
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
assert(n!=NULL);
assert(n!=nullptr);
if (strlen(n))
{
if (string(n).find(":")!=string::npos)

View File

@ -58,14 +58,14 @@ ObjectGroup::~ObjectGroup() {}
bool ObjectGroup::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
return (FWObject::validateChild(o) &&
Service::cast(o)==NULL &&
ServiceGroup::cast(o)==NULL &&
Interval::cast(o)==NULL &&
FWServiceReference::cast(o)==NULL &&
RuleSet::cast(o)==NULL);
Service::cast(o)==nullptr &&
ServiceGroup::cast(o)==nullptr &&
Interval::cast(o)==nullptr &&
FWServiceReference::cast(o)==nullptr &&
RuleSet::cast(o)==nullptr);
}
xmlNodePtr ObjectGroup::toXML(xmlNodePtr parent)

View File

@ -94,7 +94,7 @@ bool ObjectMatcher::complexMatch(Address *obj1, Address *obj2)
}
void* res = obj1->dispatch(this, obj2);
return (res != NULL);
return (res != nullptr);
}
/**
@ -279,11 +279,11 @@ void* ObjectMatcher::dispatch(Interface* obj1, void* _obj2)
if (obj1->getParent()->getId() == obj2->getId()) return obj1;
if (!obj1->isRegular()) return NULL;
if ((obj1->getByType(IPv4::TYPENAME)).size()>1) return NULL;
if ((obj1->getByType(IPv6::TYPENAME)).size()>1) return NULL;
if (!obj1->isRegular()) return nullptr;
if ((obj1->getByType(IPv4::TYPENAME)).size()>1) return nullptr;
if ((obj1->getByType(IPv6::TYPENAME)).size()>1) return nullptr;
return (checkComplexMatchForSingleAddress(obj1, obj2)) ? obj1 : NULL;
return (checkComplexMatchForSingleAddress(obj1, obj2)) ? obj1 : nullptr;
}
void* ObjectMatcher::dispatch(Network *obj1, void *_obj2)
@ -306,10 +306,10 @@ void* ObjectMatcher::dispatch(Network *obj1, void *_obj2)
* ranges, and some often used ranges trigger that (like
* "255.255.255.255-255.255.255.255" or "0.0.0.0-0.0.0.0")
*/
if (!obj1->getNetmaskPtr()->isHostMask()) return NULL;
if (!obj1->getNetmaskPtr()->isHostMask()) return nullptr;
} else
return NULL;
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
return nullptr;
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
}
void* ObjectMatcher::dispatch(NetworkIPv6 *obj1, void *_obj2)
@ -320,23 +320,23 @@ void* ObjectMatcher::dispatch(NetworkIPv6 *obj1, void *_obj2)
{
if (recognize_multicasts && inet_addr->isMulticast() &&
Firewall::isA(obj2)) return obj1;
if (!obj1->getNetmaskPtr()->isHostMask()) return NULL;
if (!obj1->getNetmaskPtr()->isHostMask()) return nullptr;
} else
return NULL;
return nullptr;
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
}
void* ObjectMatcher::dispatch(IPv4 *obj1, void *_obj2)
{
FWObject *obj2 = (FWObject*)(_obj2);
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
}
void* ObjectMatcher::dispatch(IPv6 *obj1, void *_obj2)
{
FWObject *obj2 = (FWObject*)(_obj2);
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
}
void* ObjectMatcher::dispatch(physAddress *obj1, void *_obj2)
@ -348,7 +348,7 @@ void* ObjectMatcher::dispatch(physAddress *obj1, void *_obj2)
physAddress *iface_pa = physAddress::cast(*i);
if (obj1->getPhysAddress() == iface_pa->getPhysAddress()) return obj1;
}
return NULL;
return nullptr;
}
void* ObjectMatcher::dispatch(AddressRange *obj1, void *_obj2)
@ -425,14 +425,14 @@ void* ObjectMatcher::dispatch(AddressRange *obj1, void *_obj2)
if (f_b <= 0 && f_e >= 0) return obj1;
}
}
return NULL;
return nullptr;
bool f_b = checkComplexMatchForSingleAddress(&range_start, obj2);
bool f_e = checkComplexMatchForSingleAddress(&range_end, obj2);
if (address_range_match_mode == EXACT && f_b && f_e) return obj1;
if (address_range_match_mode == PARTIAL && (f_b || f_e)) return obj1;
return NULL;
return nullptr;
}
/*
@ -447,7 +447,7 @@ void* ObjectMatcher::dispatch(MultiAddressRunTime *obj1, void *_obj2)
obj1->getSourceName() == "self" && Firewall::isA(obj2))
return obj1;
return NULL; // never matches in this implementation
return nullptr; // never matches in this implementation
}
void* ObjectMatcher::dispatch(Host *obj1, void *_obj2)
@ -464,7 +464,7 @@ void* ObjectMatcher::dispatch(Host *obj1, void *_obj2)
{
res &= checkComplexMatchForSingleAddress(Interface::cast(*it), obj2);
}
return res ? obj1 : NULL;
return res ? obj1 : nullptr;
}
void* ObjectMatcher::dispatch(Firewall *obj1, void *_obj2)
@ -499,7 +499,7 @@ void* ObjectMatcher::dispatch(Cluster *obj1, void *_obj2)
list<Firewall*>::iterator it;
for (it=members.begin(); it!=members.end(); ++it)
{
if (dispatch(*it, obj2) != NULL) return obj1;
if (dispatch(*it, obj2) != nullptr) return obj1;
}
/*
* match only if all interfaces of obj1 match obj2

View File

@ -48,7 +48,7 @@ using namespace std;
Service* ObjectMirror::getMirroredService(Service *obj)
{
void* res = obj->dispatch(this, (void*)NULL);
void* res = obj->dispatch(this, (void*)nullptr);
return Service::cast((FWObject*)(res));
}

View File

@ -50,7 +50,7 @@ Policy::~Policy() {}
Rule* Policy::createRule()
{
FWObjectDatabase* db=getRoot();
assert(db!=NULL);
assert(db!=nullptr);
return db->createPolicyRule();
}

View File

@ -59,22 +59,22 @@ using namespace std;
const string Resources::PLATFORM_RES_DIR_NAME = "platform";
const string Resources::OS_RES_DIR_NAME = "os";
Resources* Resources::global_res = NULL;
Resources* Resources::global_res = nullptr;
map<string,Resources*> Resources::platform_res;
map<string,Resources*> Resources::os_res;
Resources::Resources()
{
doc=NULL;
doc=nullptr;
}
Resources::Resources(const string &_resF)
{
doc = NULL;
doc = nullptr;
resfile = _resF;
if (global_res==NULL)
if (global_res==nullptr)
{
global_res = this;
loadRes(_resF);
@ -109,7 +109,7 @@ string Resources::getXmlNodeContent(xmlNodePtr node)
{
string res;
char* cptr= (char*)( xmlNodeGetContent(node) );
if (cptr!=NULL)
if (cptr!=nullptr)
{
res=cptr;
FREEXMLBUFF(cptr);
@ -121,7 +121,7 @@ string Resources::getXmlNodeProp(xmlNodePtr node,string prop)
{
string res;
char* cptr=(char*)( xmlGetProp(node,TOXMLCAST(prop.c_str())));
if (cptr!=NULL)
if (cptr!=nullptr)
{
res=cptr;
FREEXMLBUFF(cptr);
@ -394,7 +394,7 @@ string Resources::getRuleElementResourceStr(const string &rel,
xmlNodePtr dptr=Resources::global_res->getXmlNode("FWBuilderResources/RuleElements");
assert (dptr!=NULL);
assert (dptr!=nullptr);
for(c=dptr->xmlChildrenNode; c; c=c->next)
{
@ -463,7 +463,7 @@ string Resources::getTreeIconFileName(const FWObject *o)
void Resources::setDefaultOption(FWObject *o,const string &xml_node)
{
xmlNodePtr pn = XMLTools::getXmlNodeByPath(root,xml_node.c_str());
if (pn==NULL) return;
if (pn==nullptr) return;
string optname=FROMXMLCAST(pn->name);
string optval =getXmlNodeContent(pn);
@ -473,7 +473,7 @@ void Resources::setDefaultOption(FWObject *o,const string &xml_node)
void Resources::setDefaultOptionsAll(FWObject *o,const string &xml_node)
{
xmlNodePtr pn = XMLTools::getXmlNodeByPath(root , xml_node.c_str() );
if (pn==NULL) return;
if (pn==nullptr) return;
xmlNodePtr opt;
@ -488,11 +488,11 @@ void Resources::setDefaultOptionsAll(FWObject *o,const string &xml_node)
void Resources::setDefaultTargetOptions(const string &target,Firewall *fw)
{
FWOptions *opt=fw->getOptionsObject();
Resources *r=NULL;
Resources *r=nullptr;
if (platform_res.count(target)!=0) r=platform_res[target];
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
if (r==NULL)
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
if (r==nullptr)
throw FWException("Support module for target '"+target+"' is not available");
r->setDefaultOptionsAll(opt,"/FWBuilderResources/Target/options/default");
@ -502,16 +502,16 @@ void Resources::setDefaultIfaceOptions(const string &target,Interface *iface)
{
FWOptions *opt=iface->getOptionsObject();
/* if InterfaceOptions object does not yet exist -> create one */
if (opt == NULL) {
if (opt == nullptr) {
iface->add(iface->getRoot()->create(InterfaceOptions::TYPENAME));
opt = iface->getOptionsObject();
}
Resources *r=NULL;
Resources *r=nullptr;
if (platform_res.count(target)!=0) r=platform_res[target];
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
if (r==NULL)
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
if (r==nullptr)
throw FWException("Support module for target '"+target+"' is not available");
r->setDefaultOptionsAll(opt,"/FWBuilderResources/Target/options/interface");
@ -534,11 +534,11 @@ void Resources::setDefaultProperties(FWObject *obj)
string Resources::getTargetCapabilityStr(const string &target,
const string &cap_name)
{
Resources *r=NULL;
Resources *r=nullptr;
if (platform_res.count(target)!=0) r=platform_res[target];
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
if (r==NULL)
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
if (r==nullptr)
throw FWException("Support module for target '"+target+"' is not available");
return r->getResourceStr("/FWBuilderResources/Target/capabilities/"+cap_name);
@ -574,11 +574,11 @@ string Resources::getActionEditor(const string &target, const string &action)
string Resources::getTargetOptionStr(const string &target,
const string &opt_name)
{
Resources *r=NULL;
Resources *r=nullptr;
if (platform_res.count(target)!=0) r=platform_res[target];
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
if (r==NULL)
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
if (r==nullptr)
throw FWException("Support module for target '"+target+"' is not available");
return r->getResourceStr("/FWBuilderResources/Target/options/"+opt_name);

View File

@ -50,7 +50,7 @@ Routing::~Routing() {}
Rule* Routing::createRule()
{
FWObjectDatabase* db=getRoot();
assert(db!=NULL);
assert(db!=nullptr);
return db->createRoutingRule();
}

View File

@ -63,8 +63,8 @@ void Rule::init(FWObjectDatabase*)
{
}
FWOptions* Rule::getOptionsObject() const { return NULL; }
RuleSet* Rule::getBranch() { return NULL; }
FWOptions* Rule::getOptionsObject() const { return nullptr; }
RuleSet* Rule::getBranch() { return nullptr; }
void Rule::setPosition(int n) { setInt("position", n); }
int Rule::getPosition() const { return getInt("position"); }
void Rule::disable() { setBool("disabled",true); }
@ -117,33 +117,33 @@ PolicyRule::PolicyRule()
// setStr("action","Deny");
setAction(PolicyRule::Deny);
src_re = NULL;
dst_re = NULL;
srv_re = NULL;
itf_re = NULL;
when_re = NULL;
src_re = nullptr;
dst_re = nullptr;
srv_re = nullptr;
itf_re = nullptr;
when_re = nullptr;
}
void PolicyRule::init(FWObjectDatabase *root)
{
FWObject *re = getFirstByType(RuleElementSrc::TYPENAME);
if (re == NULL)
if (re == nullptr)
{
// <!ELEMENT PolicyRule (Src,Dst,Srv?,Itf?,When?,PolicyRuleOptions?)>
re = root->createRuleElementSrc(); assert(re!=NULL);
re = root->createRuleElementSrc(); assert(re!=nullptr);
add(re); src_re = RuleElementSrc::cast(re);
re = root->createRuleElementDst(); assert(re!=NULL);
re = root->createRuleElementDst(); assert(re!=nullptr);
add(re); dst_re = RuleElementDst::cast(re);
re = root->createRuleElementSrv(); assert(re!=NULL);
re = root->createRuleElementSrv(); assert(re!=nullptr);
add(re); srv_re = RuleElementSrv::cast(re);
re = root->createRuleElementItf(); assert(re!=NULL);
re = root->createRuleElementItf(); assert(re!=nullptr);
add(re); itf_re = RuleElementItf::cast(re);
re = root->createRuleElementInterval(); assert(re!=NULL);
re = root->createRuleElementInterval(); assert(re!=nullptr);
add(re); when_re = RuleElementInterval::cast(re);
add( root->createPolicyRuleOptions() );
@ -158,11 +158,11 @@ FWObject& PolicyRule::shallowDuplicate(const FWObject *x,
setAction(rx->getAction());
setLogging(rx->getLogging());
src_re = NULL;
dst_re = NULL;
srv_re = NULL;
itf_re = NULL;
when_re = NULL;
src_re = nullptr;
dst_re = nullptr;
srv_re = nullptr;
itf_re = nullptr;
when_re = nullptr;
return Rule::shallowDuplicate(x, preserve_id);
}
@ -170,7 +170,7 @@ FWObject& PolicyRule::shallowDuplicate(const FWObject *x,
bool PolicyRule::cmp(const FWObject *x, bool recursive)
{
const PolicyRule *rx = PolicyRule::constcast(x);
if (rx == NULL) return false;
if (rx == nullptr) return false;
if (getDirection() != rx->getDirection() ||
getAction() != rx->getAction() ||
getLogging() != rx->getLogging()) return false;
@ -436,26 +436,26 @@ xmlNodePtr PolicyRule::toXML(xmlNodePtr parent)
*
<!ELEMENT PolicyRule (Src,Dst,Srv?,Itf?,When?,PolicyRuleOptions?)>
*/
if ( (o=getFirstByType( RuleElementSrc::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementSrc::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementDst::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementDst::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementSrv::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementSrv::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementItf::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementItf::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( PolicyRuleOptions::TYPENAME ))!=NULL )
if ( (o=getFirstByType( PolicyRuleOptions::TYPENAME ))!=nullptr )
o->toXML(me);
// there should be no children Policy objects in v3
if ( (o=getFirstByType( Policy::TYPENAME ))!=NULL )
if ( (o=getFirstByType( Policy::TYPENAME ))!=nullptr )
o->toXML(me);
return me;
@ -487,10 +487,10 @@ void PolicyRule::updateNonStandardObjectReferences()
RuleSet* PolicyRule::getBranch()
{
if (getAction() != PolicyRule::Branch) return NULL;
if (getAction() != PolicyRule::Branch) return nullptr;
FWObject *fw = this;
while (fw && Firewall::cast(fw) == NULL) fw = fw->getParent();
assert(fw!=NULL);
while (fw && Firewall::cast(fw) == nullptr) fw = fw->getParent();
assert(fw!=nullptr);
string branch_id = getOptionsObject()->getStr("branch_id");
if (!branch_id.empty())
{
@ -504,7 +504,7 @@ RuleSet* PolicyRule::getBranch()
return RuleSet::cast(
fw->findObjectByName(Policy::TYPENAME, branch_name));
} else
return NULL;
return nullptr;
}
}
@ -565,7 +565,7 @@ FWObject* PolicyRule::getTagObject()
FWObjectDatabase::getIntId(tagobj_id));
}
}
return NULL;
return nullptr;
}
string PolicyRule::getTagValue()
@ -654,44 +654,44 @@ NATRule::NATRule() : Rule()
rule_type = Unknown;
setAction(NATRule::Translate);
osrc_re = NULL;
odst_re = NULL;
osrv_re = NULL;
tsrc_re = NULL;
tdst_re = NULL;
tsrv_re = NULL;
itf_inb_re = NULL;
itf_outb_re = NULL;
when_re = NULL;
osrc_re = nullptr;
odst_re = nullptr;
osrv_re = nullptr;
tsrc_re = nullptr;
tdst_re = nullptr;
tsrv_re = nullptr;
itf_inb_re = nullptr;
itf_outb_re = nullptr;
when_re = nullptr;
}
void NATRule::init(FWObjectDatabase *root)
{
FWObject *re = getFirstByType(RuleElementOSrc::TYPENAME);
if (re == NULL)
if (re == nullptr)
{
re = root->createRuleElementOSrc(); assert(re!=NULL);
re = root->createRuleElementOSrc(); assert(re!=nullptr);
add(re); osrc_re = RuleElementOSrc::cast(re);
re = root->createRuleElementODst(); assert(re!=NULL);
re = root->createRuleElementODst(); assert(re!=nullptr);
add(re); odst_re = RuleElementODst::cast(re);
re = root->createRuleElementOSrv(); assert(re!=NULL);
re = root->createRuleElementOSrv(); assert(re!=nullptr);
add(re); osrv_re = RuleElementOSrv::cast(re);
re = root->createRuleElementTSrc(); assert(re!=NULL);
re = root->createRuleElementTSrc(); assert(re!=nullptr);
add(re); tsrc_re = RuleElementTSrc::cast(re);
re = root->createRuleElementTDst(); assert(re!=NULL);
re = root->createRuleElementTDst(); assert(re!=nullptr);
add(re); tdst_re = RuleElementTDst::cast(re);
re = root->createRuleElementTSrv(); assert(re!=NULL);
re = root->createRuleElementTSrv(); assert(re!=nullptr);
add(re); tsrv_re = RuleElementTSrv::cast(re);
re = root->createRuleElementItfInb(); assert(re!=NULL);
re = root->createRuleElementItfInb(); assert(re!=nullptr);
add(re); itf_inb_re = RuleElementItfInb::cast(re);
re = root->createRuleElementItfOutb(); assert(re!=NULL);
re = root->createRuleElementItfOutb(); assert(re!=nullptr);
add(re); itf_outb_re = RuleElementItfOutb::cast(re);
add( root->createNATRuleOptions() );
@ -876,37 +876,37 @@ xmlNodePtr NATRule::toXML(xmlNodePtr parent)
FWObject *o;
if ( (o=getFirstByType( RuleElementOSrc::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementOSrc::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementODst::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementODst::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementOSrv::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementOSrv::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementTSrc::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementTSrc::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementTDst::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementTDst::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementTSrv::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementTSrv::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementItfInb::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementItfInb::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementItfOutb::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementItfOutb::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( NATRuleOptions::TYPENAME ))!=NULL )
if ( (o=getFirstByType( NATRuleOptions::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( NAT::TYPENAME ))!=NULL )
if ( (o=getFirstByType( NAT::TYPENAME ))!=nullptr )
o->toXML(me);
return me;
@ -919,9 +919,9 @@ FWOptions* NATRule::getOptionsObject() const
RuleSet* NATRule::getBranch()
{
if (getAction() != NATRule::Branch) return NULL;
if (getAction() != NATRule::Branch) return nullptr;
FWObject *fw = getParent()->getParent();
assert(fw!=NULL);
assert(fw!=nullptr);
string branch_id = getOptionsObject()->getStr("branch_id");
if (!branch_id.empty())
{
@ -934,7 +934,7 @@ RuleSet* NATRule::getBranch()
return RuleSet::cast(fw->findObjectByName(NAT::TYPENAME,
branch_name));
else
return NULL;
return nullptr;
}
}
@ -979,18 +979,18 @@ FWObject& NATRule::shallowDuplicate(const FWObject *x,
bool preserve_id)
{
const NATRule *rx = NATRule::constcast(x);
if (rx!=NULL) rule_type = rx->rule_type;
if (rx!=nullptr) rule_type = rx->rule_type;
setAction(rx->getAction());
osrc_re = NULL;
odst_re = NULL;
osrv_re = NULL;
tsrc_re = NULL;
tdst_re = NULL;
tsrv_re = NULL;
itf_inb_re = NULL;
itf_outb_re = NULL;
when_re = NULL;
osrc_re = nullptr;
odst_re = nullptr;
osrv_re = nullptr;
tsrc_re = nullptr;
tdst_re = nullptr;
tsrv_re = nullptr;
itf_inb_re = nullptr;
itf_outb_re = nullptr;
when_re = nullptr;
return Rule::shallowDuplicate(x, preserve_id);
}
@ -998,7 +998,7 @@ FWObject& NATRule::shallowDuplicate(const FWObject *x,
bool NATRule::cmp(const FWObject *x, bool recursive)
{
const NATRule *rx = NATRule::constcast(x);
if (rx == NULL) return false;
if (rx == nullptr) return false;
if (getAction() != rx->getAction()) return false;
return Rule::cmp(x, recursive);
}
@ -1017,11 +1017,11 @@ RoutingRule::RoutingRule() : Rule()
void RoutingRule::init(FWObjectDatabase *root)
{
FWObject *re = getFirstByType(RuleElementRDst::TYPENAME);
if (re == NULL)
if (re == nullptr)
{
re = root->createRuleElementRDst(); assert(re!=NULL); add(re);
re = root->createRuleElementRGtw(); assert(re!=NULL); add(re);
re = root->createRuleElementRItf(); assert(re!=NULL); add(re);
re = root->createRuleElementRDst(); assert(re!=nullptr); add(re);
re = root->createRuleElementRGtw(); assert(re!=nullptr); add(re);
re = root->createRuleElementRItf(); assert(re!=nullptr); add(re);
add( root->createRoutingRuleOptions() );
}
}
@ -1117,19 +1117,19 @@ xmlNodePtr RoutingRule::toXML(xmlNodePtr parent)
FWObject *o;
if ( (o=getFirstByType( RuleElementRDst::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementRDst::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementRGtw::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementRGtw::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RuleElementRItf::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleElementRItf::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( RoutingRuleOptions::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RoutingRuleOptions::TYPENAME ))!=nullptr )
o->toXML(me);
if ( (o=getFirstByType( Routing::TYPENAME ))!=NULL )
if ( (o=getFirstByType( Routing::TYPENAME ))!=nullptr )
o->toXML(me);
return me;
@ -1143,7 +1143,7 @@ FWOptions* RoutingRule::getOptionsObject() const
RuleSet* RoutingRule::getBranch()
{
FWObject *fw = getParent()->getParent();
assert(fw!=NULL);
assert(fw!=nullptr);
string branch_id = getOptionsObject()->getStr("branch_id");
if (!branch_id.empty())
{
@ -1156,7 +1156,7 @@ RuleSet* RoutingRule::getBranch()
return RuleSet::cast(fw->findObjectByName(Routing::TYPENAME,
branch_name));
else
return NULL;
return nullptr;
}
}
@ -1185,7 +1185,7 @@ FWObject& RoutingRule::duplicate(const FWObject *x,
{
Rule::duplicate(x,preserve_id);
const RoutingRule *rx = RoutingRule::constcast(x);
if (rx!=NULL)
if (rx!=nullptr)
{
rule_type = rx->rule_type;
sorted_dst_ids = rx->sorted_dst_ids;

View File

@ -73,7 +73,7 @@ void RuleElement::init(FWObjectDatabase *root)
*/
int any_id = getAnyElementId();
FWObject *any_obj = getById(any_id);
if (any_obj == NULL)
if (any_obj == nullptr)
{
any_obj = root->checkIndex( any_id );
if (any_obj) FWObject::addRef( any_obj );
@ -117,14 +117,14 @@ FWObject& RuleElement::shallowDuplicate(const FWObject *other,
void RuleElement::addRef(FWObject *obj)
{
FWObject *o=NULL;
FWObject *o=nullptr;
if (isAny())
{
o=(*(begin()));
o=(FWReference::cast(o))->getPointer();
}
FWObject::addRef(obj);
if (o!=NULL) removeRef(o);
if (o!=nullptr) removeRef(o);
}
void RuleElement::removeRef(FWObject *obj)
@ -185,7 +185,7 @@ xmlNodePtr RuleElementSrc::toXML(xmlNodePtr parent)
bool RuleElementSrc::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ObjectGroup::validateChild(o);
}
@ -228,7 +228,7 @@ xmlNodePtr RuleElementDst::toXML(xmlNodePtr parent)
bool RuleElementDst::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ObjectGroup::validateChild(o);
}
@ -271,7 +271,7 @@ xmlNodePtr RuleElementSrv::toXML(xmlNodePtr parent)
bool RuleElementSrv::validateChild(FWObject *o)
{
if (FWServiceReference::cast(o)!=NULL) return true;
if (FWServiceReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ServiceGroup::validateChild(o);
}
@ -314,13 +314,13 @@ xmlNodePtr RuleElementItf::toXML(xmlNodePtr parent)
bool RuleElementItf::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if (o->getId() == getAnyElementId()) return true;
if (Interface::cast(o)!=NULL) return true;
if (Interface::cast(o)!=nullptr) return true;
if (ObjectGroup::cast(o)!=NULL && o->size() > 0)
if (ObjectGroup::cast(o)!=nullptr && o->size() > 0)
{
bool all_intf = true;
for (FWObject::iterator i=o->begin(); i!=o->end(); ++i)
@ -376,7 +376,7 @@ bool RuleElementItf::isDummy() const
*/
bool RuleElementItf::checkItfChildOfThisFw(FWObject *o)
{
if (Group::cast(o) != NULL)
if (Group::cast(o) != nullptr)
{
for (FWObject::iterator i=o->begin(); i!=o->end(); ++i)
{
@ -390,11 +390,11 @@ bool RuleElementItf::checkItfChildOfThisFw(FWObject *o)
FWObject* o_tmp2 = getRoot()->findInIndex(this->getId());
FWObject *fw1 = o_tmp;
while (fw1 && Firewall::cast(fw1) == NULL) fw1 = fw1->getParent();
while (fw1 && Firewall::cast(fw1) == nullptr) fw1 = fw1->getParent();
FWObject *fw2 = o_tmp2;
while (fw2 && Firewall::cast(fw2) == NULL) fw2 = fw2->getParent();
while (fw2 && Firewall::cast(fw2) == nullptr) fw2 = fw2->getParent();
return (fw1 != NULL && fw1 == fw2);
return (fw1 != nullptr && fw1 == fw2);
}
const char *RuleElementItfInb::TYPENAME={"ItfInb"};
@ -425,7 +425,7 @@ xmlNodePtr RuleElementOSrc::toXML(xmlNodePtr parent)
bool RuleElementOSrc::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ObjectGroup::validateChild(o);
}
@ -452,7 +452,7 @@ xmlNodePtr RuleElementODst::toXML(xmlNodePtr parent)
bool RuleElementODst::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ObjectGroup::validateChild(o);
}
@ -479,7 +479,7 @@ xmlNodePtr RuleElementOSrv::toXML(xmlNodePtr parent)
bool RuleElementOSrv::validateChild(FWObject *o)
{
if (FWServiceReference::cast(o)!=NULL) return true;
if (FWServiceReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ServiceGroup::validateChild(o);
}
@ -508,7 +508,7 @@ xmlNodePtr RuleElementTSrc::toXML(xmlNodePtr parent)
bool RuleElementTSrc::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ObjectGroup::validateChild(o);
}
@ -535,7 +535,7 @@ xmlNodePtr RuleElementTDst::toXML(xmlNodePtr parent)
bool RuleElementTDst::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ObjectGroup::validateChild(o);
}
@ -562,13 +562,13 @@ xmlNodePtr RuleElementTSrv::toXML(xmlNodePtr parent)
bool RuleElementTSrv::validateChild(FWObject *o)
{
if (FWServiceReference::cast(o)!=NULL) return true;
if (FWServiceReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
// TagService is not allowed in translated service
if (TagService::isA(o)) return false;
if (ServiceGroup::cast(o)!=NULL)
if (ServiceGroup::cast(o)!=nullptr)
{
for (FWObject::iterator i=o->begin(); i!=o->end(); ++i)
{
@ -603,9 +603,9 @@ xmlNodePtr RuleElementInterval::toXML(xmlNodePtr parent)
bool RuleElementInterval::validateChild(FWObject *o)
{
if (FWIntervalReference::cast(o)!=NULL) return true;
if (FWIntervalReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return (Interval::cast(o)!=NULL || IntervalGroup::cast(o)!=NULL);
return (Interval::cast(o)!=nullptr || IntervalGroup::cast(o)!=nullptr);
}
@ -630,7 +630,7 @@ xmlNodePtr RuleElementRDst::toXML(xmlNodePtr parent)
bool RuleElementRDst::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if ( o->getId() == getAnyElementId()) return true;
return ObjectGroup::validateChild(o);
}
@ -657,7 +657,7 @@ xmlNodePtr RuleElementRGtw::toXML(xmlNodePtr parent)
bool RuleElementRGtw::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if( getChildrenCount() > 0 && !isAny()) return false;
return checkSingleIPAdress(o);
}
@ -665,7 +665,7 @@ bool RuleElementRGtw::validateChild(FWObject *o)
// check if the gateway has only one interface with only one ipv4 adress
bool RuleElementRGtw::checkSingleIPAdress(FWObject *o)
{
if( Host::cast(o) != NULL)
if( Host::cast(o) != nullptr)
{
list<FWObject*> obj_list = o->getByType("Interface");
if( obj_list.size() == 1)
@ -676,7 +676,7 @@ bool RuleElementRGtw::checkSingleIPAdress(FWObject *o)
return true;
} else return false;
} else return false;
} else if( Interface::cast(o) != NULL)
} else if( Interface::cast(o) != nullptr)
{
list<FWObject*> obj_list = o->getByType("IPv4");
if( obj_list.size() == 1)
@ -686,7 +686,7 @@ bool RuleElementRGtw::checkSingleIPAdress(FWObject *o)
}
return ( o->getId() == getAnyElementId() ||
(FWObject::validateChild(o) &&
(IPv4::cast(o)!=NULL || FWObjectReference::cast(o)!=NULL)));
(IPv4::cast(o)!=nullptr || FWObjectReference::cast(o)!=nullptr)));
}
const char *RuleElementRItf::TYPENAME={"RItf"};
@ -694,12 +694,12 @@ RuleElementRItf::RuleElementRItf() {}
bool RuleElementRItf::validateChild(FWObject *o)
{
if (FWObjectReference::cast(o)!=NULL) return true;
if (FWObjectReference::cast(o)!=nullptr) return true;
if (getChildrenCount() > 0 && !isAny()) return false;
if ( o->getId() == getAnyElementId()) return true;
return (Interface::cast(o)!=NULL);
return (Interface::cast(o)!=nullptr);
}

View File

@ -50,7 +50,7 @@ RuleSet::RuleSet()
void RuleSet::init(FWObjectDatabase *root)
{
FWObject *opt = getFirstByType(RuleSetOptions::TYPENAME);
if (opt == NULL) add(root->createRuleSetOptions());
if (opt == nullptr) add(root->createRuleSetOptions());
}
RuleSet::~RuleSet() {}
@ -67,21 +67,21 @@ void RuleSet::fromXML(xmlNodePtr root)
// avoid having to increment DTD version number)
n=FROMXMLCAST(xmlGetProp(root, TOXMLCAST("ipv4_rule_set")));
if (n!=NULL)
if (n!=nullptr)
{
ipv4 = (string(n)=="True" || string(n)=="true");
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root, TOXMLCAST("ipv6_rule_set")));
if (n!=NULL)
if (n!=nullptr)
{
ipv6 = (string(n)=="True" || string(n)=="true");
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("top_rule_set")));
if (n!=NULL)
if (n!=nullptr)
{
top = (string(n)=="True" || string(n)=="true");
FREEXMLBUFF(n);
@ -106,11 +106,11 @@ xmlNodePtr RuleSet::toXML(xmlNodePtr parent)
// First all rules, skip options
for(list<FWObject*>::const_iterator j=begin(); j!=end(); ++j)
{
if (FWOptions::cast(*j) == NULL) (*j)->toXML(me);
if (FWOptions::cast(*j) == nullptr) (*j)->toXML(me);
}
FWObject *o;
if ( (o=getFirstByType( RuleSetOptions::TYPENAME ))!=NULL )
if ( (o=getFirstByType( RuleSetOptions::TYPENAME ))!=nullptr )
o->toXML(me);
return me;
@ -137,7 +137,7 @@ FWObject& RuleSet::shallowDuplicate(const FWObject *o, bool preserve_id)
bool RuleSet::cmp(const FWObject *obj, bool recursive)
{
const RuleSet *other = RuleSet::constcast(obj);
if (other == NULL) return false;
if (other == nullptr) return false;
if (ipv4 != other->ipv4 || ipv6 != other->ipv6 || top != other->top)
return false;
return FWObject::cmp(obj, recursive);
@ -171,7 +171,7 @@ Rule* RuleSet::insertRuleBefore(int rule_n)
{
Rule *old_rule = getRuleByNum(rule_n);
Rule *r = createRule();
if (old_rule==NULL) add(r);
if (old_rule==nullptr) add(r);
else insert_before(old_rule, r);
renumberRules();
return(r);
@ -183,7 +183,7 @@ Rule* RuleSet::appendRuleAtBottom(bool hidden_rule)
r->setHidden(hidden_rule);
int last_rule_position;
Rule *last_rule = Rule::cast(back());
if (last_rule != NULL)
if (last_rule != nullptr)
{
last_rule_position = last_rule->getPosition() + 1000;
} else
@ -198,7 +198,7 @@ Rule* RuleSet::appendRuleAfter(int rule_n)
{
Rule *old_rule = getRuleByNum(rule_n);
Rule *r = createRule();
if (old_rule==NULL) add(r);
if (old_rule==nullptr) add(r);
else insert_after(old_rule,r);
renumberRules();
return(r);
@ -211,7 +211,7 @@ bool RuleSet::deleteRule(int rule_n)
bool RuleSet::deleteRule(Rule *r)
{
if (r!=NULL)
if (r!=nullptr)
{
remove(r, true); // and delete the rule if ref counter == 0
renumberRules();
@ -284,12 +284,12 @@ bool RuleSet::moveRule(int src_rule_n, int dst_rule_n)
FWObject* src =getRuleByNum( src_rule_n );
FWObject* dst =getRuleByNum( dst_rule_n );
if (src!=NULL && dst!=NULL && src!=dst ) {
if (src!=nullptr && dst!=nullptr && src!=dst ) {
FWObject *o;
list<FWObject*>::iterator m, m1, m2;
for (m=begin(); m!=end(); ++m) {
if ( (o=(*m))!=NULL ) {
if ( (o=(*m))!=nullptr ) {
if ( o==src ) m1=m;
if ( o==dst ) m2=m;
}
@ -354,14 +354,14 @@ Rule* RuleSet::getRuleByNum(int n)
for(list<FWObject*>::iterator m=begin(); m!=end(); ++m)
{
FWObject *o;
if ( (o=(*m))!=NULL )
if ( (o=(*m))!=nullptr )
{
Rule *r = Rule::cast(o);
if (r && r->getPosition()==n)
return r;
}
}
return NULL;
return nullptr;
}
int RuleSet::getRuleSetSize()
@ -374,7 +374,7 @@ void RuleSet::assignUniqueRuleIds()
for (FWObject::iterator it=begin(); it!=end(); ++it)
{
Rule *r = Rule::cast(*it);
if (r != NULL && r->getUniqueId().empty())
if (r != nullptr && r->getUniqueId().empty())
r->setUniqueId(FWObjectDatabase::getStringId((*it)->getId()) );
}

View File

@ -59,14 +59,14 @@ ServiceGroup::~ServiceGroup() {}
bool ServiceGroup::validateChild(FWObject *o)
{
if (FWServiceReference::cast(o)!=NULL) return true;
if (FWServiceReference::cast(o)!=nullptr) return true;
return (FWObject::validateChild(o) &&
Address::cast(o)==NULL &&
ObjectGroup::cast(o)==NULL &&
Interval::cast(o)==NULL &&
FWObjectReference::cast(o)==NULL &&
RuleSet::cast(o)==NULL);
Address::cast(o)==nullptr &&
ObjectGroup::cast(o)==nullptr &&
Interval::cast(o)==nullptr &&
FWObjectReference::cast(o)==nullptr &&
RuleSet::cast(o)==nullptr);
}
FWReference* ServiceGroup::createRef()

View File

@ -81,7 +81,7 @@ void TCPService::fromXML(xmlNodePtr root)
const char *n;
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("established")));
if(n!=NULL)
if(n!=nullptr)
{
setStr("established", n);
FREEXMLBUFF(n);
@ -91,7 +91,7 @@ void TCPService::fromXML(xmlNodePtr root)
for (i=flags.begin(); i!=flags.end(); ++i)
{
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST( (i->second).c_str() )));
if(n!=NULL)
if(n!=nullptr)
{
setStr( i->second , n);
FREEXMLBUFF(n);
@ -101,7 +101,7 @@ void TCPService::fromXML(xmlNodePtr root)
for (i=flags_masks.begin(); i!=flags_masks.end(); ++i)
{
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST( (i->second).c_str() )));
if(n!=NULL)
if(n!=nullptr)
{
setStr( i->second , n);
FREEXMLBUFF(n);

View File

@ -56,28 +56,28 @@ void TCPUDPService::fromXML(xmlNodePtr root)
const char *n;
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("src_range_start")));
if(n!=NULL)
if(n!=nullptr)
{
src_range_start = atol(n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("src_range_end")));
if(n!=NULL)
if(n!=nullptr)
{
src_range_end = atol(n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dst_range_start")));
if(n!=NULL)
if(n!=nullptr)
{
dst_range_start = atol(n);
FREEXMLBUFF(n);
}
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dst_range_end")));
if(n!=NULL)
if(n!=nullptr)
{
dst_range_end = atol(n);
FREEXMLBUFF(n);
@ -121,7 +121,7 @@ FWObject& TCPUDPService::shallowDuplicate(const FWObject *obj,
bool TCPUDPService::cmp(const FWObject *obj, bool recursive)
{
const TCPUDPService *other = TCPUDPService::constcast(obj);
if (other == NULL) return false;
if (other == nullptr) return false;
if (src_range_start != other->src_range_start ||
src_range_end != other->src_range_end ||
dst_range_start != other->dst_range_start ||

View File

@ -62,7 +62,7 @@ void TagService::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("tagcode")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("tagcode", n);
FREEXMLBUFF(n);

View File

@ -68,7 +68,7 @@ void Mutex::unlock() const
Cond::Cond()
{
pthread_cond_init( &cond, NULL );
pthread_cond_init( &cond, nullptr );
}
Cond::~Cond()

View File

@ -68,7 +68,7 @@ char *cxx_strdup(const string &x)
char *cxx_strdup(const char *x)
{
if(!x)
return (char*)NULL;
return (char*)nullptr;
char *res=new char[strlen(x)+1];
strcpy(res,x);
@ -130,10 +130,10 @@ list<string> getDirList(const std::string &dir,
#ifndef _WIN32
DIR *d=opendir(dir.c_str());
if (d!=NULL)
if (d!=nullptr)
{
struct dirent *de;
while ( (de=readdir(d))!=NULL )
while ( (de=readdir(d))!=nullptr )
{
if (strcmp(de->d_name,".")==SAME || strcmp(de->d_name,"..")==SAME)
continue;

View File

@ -76,7 +76,7 @@ xmlNodePtr UserService::toXML(xmlNodePtr parent)
bool UserService::cmp(const FWObject *obj, bool recursive)
{
if (UserService::constcast(obj)==NULL) return false;
if (UserService::constcast(obj)==nullptr) return false;
if (!FWObject::cmp(obj, recursive)) return false;
const UserService *user_serv = UserService::constcast(obj);

View File

@ -98,7 +98,7 @@ static void xslt_error_handler(void *ctx, const char *msg, ...)
char buf[4096];
va_list args;
assert(ctx!=NULL);
assert(ctx!=nullptr);
va_start(args, msg);
#ifdef _WIN32
@ -125,7 +125,7 @@ xmlNodePtr XMLTools::getXmlChildNode(xmlNodePtr r,const char *child_name)
if (strcmp(child_name,FROMXMLCAST(cur->name))==SAME)
return cur;
}
return NULL;
return nullptr;
}
@ -140,7 +140,7 @@ xmlNodePtr XMLTools::getXmlNodeByPath(xmlNodePtr r, const char *path)
char *path_copy;
xmlNodePtr cur, res;
res=NULL;
res=nullptr;
path_copy= cxx_strdup( path );
@ -155,7 +155,7 @@ xmlNodePtr XMLTools::getXmlNodeByPath(xmlNodePtr r, const char *path)
}
cptr=strchr(s1,'/');
if (cptr!=NULL) {
if (cptr!=nullptr) {
*cptr='\0';
cptr++;
}
@ -177,14 +177,14 @@ xmlNodePtr XMLTools::getXmlNodeByPath(xmlNodePtr r, const char *path)
}
xmlExternalEntityLoader XMLTools::defaultLoader = NULL;
xmlExternalEntityLoader XMLTools::defaultLoader = nullptr;
/**
* This is global variable used in 'fwbExternalEntityLoader'
* parser callback. It is protected by 'xml_parser_mutex'.
*/
static char* current_template_dir=NULL;
static char* current_template_dir=nullptr;
xmlParserInputPtr fwbExternalEntityLoader(const char *URL,
const char *ID,
@ -213,7 +213,7 @@ xmlParserInputPtr fwbExternalEntityLoader(const char *URL,
else if(XMLTools::defaultLoader)
return XMLTools::defaultLoader(URL, ID, ctxt);
else
return NULL;
return nullptr;
}
void XMLTools::initXMLTools()
@ -249,7 +249,7 @@ string XMLTools::readFile(const std::string &rfile)
}
gzFile gzf = gzopen(rfile.c_str(), "rb9");
if (gzf == NULL) throw FWException("Could not read file "+rfile);
if (gzf == nullptr) throw FWException("Could not read file "+rfile);
int chunk_size = 65536;
char *chunk = (char*)malloc(chunk_size);
@ -284,7 +284,7 @@ xmlDocPtr XMLTools::parseFile(const string &file_name,
{
xml_parser_mutex.lock();
if (current_template_dir!=NULL) delete[] current_template_dir;
if (current_template_dir!=nullptr) delete[] current_template_dir;
current_template_dir = cxx_strdup(template_dir.c_str());
xmlDoValidityCheckingDefaultValue = use_dtd ? 1 : 0;
@ -296,7 +296,7 @@ xmlDocPtr XMLTools::parseFile(const string &file_name,
xmlDocPtr doc = xmlParseMemory(buffer.c_str(), buffer.length());
xmlSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc(nullptr, nullptr);
xml_parser_mutex.unlock();
if (!doc || errors.length())
@ -422,7 +422,7 @@ in the same directory with extension '.bak'. Are you sure you want to open it?";
throw;
}
}
assert(doc!=NULL);
assert(doc!=nullptr);
xmlFreeDoc(doc);
//xmlCleanupParser();
@ -443,7 +443,7 @@ void XMLTools::setDTD(xmlDocPtr doc,
xmlCreateIntSubset(doc, STRTOXMLCAST(type_name),
NULL,
nullptr,
STRTOXMLCAST(dtd_file)
);
@ -477,12 +477,12 @@ void XMLTools::setDTD(xmlDocPtr doc,
if(xmlValidateDocument(&vctxt, doc)!=1)
throw FWException(string("DTD validation stage 2 failed with following errors:\n")+errors);
*/
xmlSetGenericErrorFunc (NULL, NULL);
xmlSetGenericErrorFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
} catch(...)
{
xmlSetGenericErrorFunc (NULL, NULL);
xmlSetGenericErrorFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
throw;
}
@ -527,7 +527,7 @@ void XMLTools::transformFileToFile(const string &src_file,
const string &dst_file)
{
string xslt_errors;
xsltStylesheetPtr ss = NULL;
xsltStylesheetPtr ss = nullptr;
xmlDocPtr doc, res;
@ -547,12 +547,12 @@ void XMLTools::transformFileToFile(const string &src_file,
if(!ss)
{
xsltSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc (NULL, NULL);
xsltSetGenericErrorFunc(nullptr, nullptr);
xmlSetGenericErrorFunc (nullptr, nullptr);
// Following line is workaround for bug #73088 in Gnome
// bugzilla. To be removed than it will be fixed.
xsltSetGenericDebugFunc (NULL, NULL);
xsltSetGenericDebugFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
xslt_processor_mutex.unlock();
throw FWException("File conversion error: Error loading stylesheet: " +
@ -568,12 +568,12 @@ void XMLTools::transformFileToFile(const string &src_file,
res = xsltApplyStylesheet(ss, doc, params);
xsltSaveResultToFilename(dst_file.c_str(), res, ss, 0);
xsltSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc (NULL, NULL);
xsltSetGenericErrorFunc(nullptr, nullptr);
xmlSetGenericErrorFunc (nullptr, nullptr);
// Following line is workaround for bug #73088 in Gnome
// bugzilla. To be removed than it will be fixed.
xsltSetGenericDebugFunc (NULL, NULL);
xsltSetGenericDebugFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
xslt_processor_mutex.unlock();
@ -628,12 +628,12 @@ void XMLTools::transformDocumentToFile(xmlDocPtr doc,
if (!ss)
{
xsltSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc (NULL, NULL);
xsltSetGenericErrorFunc(nullptr, nullptr);
xmlSetGenericErrorFunc (nullptr, nullptr);
// Following line is workaround for bug #73088 in Gnome
// bugzilla. To be removed than it will be fixed.
xsltSetGenericDebugFunc (NULL, NULL);
xsltSetGenericDebugFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
xslt_processor_mutex.unlock();
throw FWException("File conversion error: Error loading stylesheet: " +
@ -645,12 +645,12 @@ void XMLTools::transformDocumentToFile(xmlDocPtr doc,
xmlDocPtr res = xsltApplyStylesheet(ss, doc, params);
xsltSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc (NULL, NULL);
xsltSetGenericErrorFunc(nullptr, nullptr);
xmlSetGenericErrorFunc (nullptr, nullptr);
// Following line is workaround for bug #73088 in Gnome
// bugzilla. To be removed than it will be fixed.
xsltSetGenericDebugFunc (NULL, NULL);
xsltSetGenericDebugFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
xslt_processor_mutex.unlock();
@ -700,11 +700,11 @@ xmlDocPtr XMLTools::transformDocument(xmlDocPtr doc,
if (!ss)
{
xsltSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc (NULL, NULL);
xsltSetGenericErrorFunc(nullptr, nullptr);
xmlSetGenericErrorFunc (nullptr, nullptr);
// Following line is workaround for bug #73088 in Gnome
// bugzilla. To be removed than it will be fixed.
xsltSetGenericDebugFunc (NULL, NULL);
xsltSetGenericDebugFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
xslt_processor_mutex.unlock();
@ -716,11 +716,11 @@ xmlDocPtr XMLTools::transformDocument(xmlDocPtr doc,
xmlDocPtr res = xsltApplyStylesheet(ss, doc, params);
xsltFreeStylesheet(ss);
xsltSetGenericErrorFunc(NULL, NULL);
xmlSetGenericErrorFunc (NULL, NULL);
xsltSetGenericErrorFunc(nullptr, nullptr);
xmlSetGenericErrorFunc (nullptr, nullptr);
// Following line is workaround for bug #73088 in Gnome
// bugzilla. To be removed than it will be fixed.
xsltSetGenericDebugFunc (NULL, NULL);
xsltSetGenericDebugFunc (nullptr, nullptr);
xml_parser_mutex.unlock();
xslt_processor_mutex.unlock();
@ -741,7 +741,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
const string &template_dir,
const string &current_version)
{
xmlDocPtr res = NULL;
xmlDocPtr res = nullptr;
xmlNodePtr root = xmlDocGetRootElement(doc);
if (!root || !root->name || type_name!=FROMXMLCAST(root->name))
@ -753,7 +753,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
string vers;
const char *v = FROMXMLCAST(xmlGetProp(root,TOXMLCAST("version")));
if (v==NULL)
if (v==nullptr)
{
// no version.
v="0.8.7"; // at this version attribute has been introduced
@ -817,7 +817,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
try
{
res = transformDocument(doc, fname, NULL);
res = transformDocument(doc, fname, nullptr);
} catch(FWException &ex)
{
ex.getProperties()["failed_transformation"]=fname;
@ -839,7 +839,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
}
v = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("version")));
if (v==NULL)
if (v==nullptr)
{
xmlFreeDoc(doc);
//xmlCleanupParser();

View File

@ -58,14 +58,14 @@ using namespace libfwbuilder;
#undef DEBUG_DNS
Mutex *DNS::gethostbyname_mutex = NULL;
Mutex *DNS::gethostbyaddr_mutex = NULL;
Mutex *DNS::gethostbyname_mutex = nullptr;
Mutex *DNS::gethostbyaddr_mutex = nullptr;
// use this function for delayed initialization
void DNS::init()
{
if (gethostbyname_mutex==NULL) gethostbyname_mutex = new Mutex();
if (gethostbyaddr_mutex==NULL) gethostbyaddr_mutex = new Mutex();
if (gethostbyname_mutex==nullptr) gethostbyname_mutex = new Mutex();
if (gethostbyaddr_mutex==nullptr) gethostbyaddr_mutex = new Mutex();
}
/*
@ -94,7 +94,7 @@ HostEnt DNS::getHostByAddr(const InetAddr &addr, int type)
type);
}
if(hp==NULL)
if(hp==nullptr)
{
gethostbyaddr_mutex->unlock();
free(tmphstbuf);
@ -118,14 +118,14 @@ list<InetAddr> DNS::getHostByName(const string &name, int type)
list<InetAddr> v;
struct addrinfo *aiList = NULL;
struct addrinfo *aiList = nullptr;
int retVal;
#ifdef DEBUG_DNS
cerr << "DNS::getHostByName " << name << " type=" << type << endl;
#endif
if ((retVal = getaddrinfo(name.c_str(), NULL, NULL, &aiList)) != 0)
if ((retVal = getaddrinfo(name.c_str(), nullptr, nullptr, &aiList)) != 0)
{
std::ostringstream strerr;
strerr << "Host or network '" + name + "' not found; last error: ";
@ -140,7 +140,7 @@ list<InetAddr> DNS::getHostByName(const string &name, int type)
struct addrinfo *ai;
try
{
for (ai=aiList; ai!=NULL; ai=ai->ai_next)
for (ai=aiList; ai!=nullptr; ai=ai->ai_next)
{
#ifdef DEBUG_DNS
cerr << "DNS::getHostByName " << name

View File

@ -50,7 +50,7 @@ void physAddress::fromXML(xmlNodePtr root)
FWObject::fromXML(root);
const char* n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
assert(n!=NULL);
assert(n!=nullptr);
setStr("address", n);
FREEXMLBUFF(n);
}

View File

@ -82,7 +82,7 @@ void Compiler::epilog()
void Compiler::abort(const string &errstr)
{
BaseCompiler::abort(fw, source_ruleset, NULL, errstr);
BaseCompiler::abort(fw, source_ruleset, nullptr, errstr);
}
void Compiler::abort(FWObject *rule, const string &errstr)
@ -92,7 +92,7 @@ void Compiler::abort(FWObject *rule, const string &errstr)
void Compiler::error(const string &errstr)
{
BaseCompiler::error(fw, source_ruleset, NULL, errstr);
BaseCompiler::error(fw, source_ruleset, nullptr, errstr);
}
void Compiler::error(FWObject *rule, const string &errstr)
@ -102,7 +102,7 @@ void Compiler::error(FWObject *rule, const string &errstr)
void Compiler::warning(const string &errstr)
{
BaseCompiler::warning(fw, source_ruleset, NULL, errstr);
BaseCompiler::warning(fw, source_ruleset, nullptr, errstr);
}
void Compiler::warning(FWObject *rule, const string &errstr)
@ -136,9 +136,9 @@ void Compiler::_init(FWObjectDatabase *_db, Firewall *_fw)
{
initialized = false;
_cntr_ = 1;
group_registry = NULL;
group_registry = nullptr;
temp_ruleset = NULL;
temp_ruleset = nullptr;
debug = 0;
debug_rule = -1;
@ -148,13 +148,13 @@ void Compiler::_init(FWObjectDatabase *_db, Firewall *_fw)
single_rule_ruleset_name = "";
single_rule_position = -1;
dbcopy = NULL;
persistent_objects = NULL;
fw = NULL;
fwopt = NULL;
dbcopy = nullptr;
persistent_objects = nullptr;
fw = nullptr;
fwopt = nullptr;
fw_id = -1;
if (_db != NULL && _fw != NULL)
if (_db != nullptr && _fw != nullptr)
{
assert(_fw->getRoot() == _db);
@ -174,40 +174,40 @@ void Compiler::_init(FWObjectDatabase *_db, Firewall *_fw)
Compiler::Compiler(FWObjectDatabase *_db, Firewall *fw, bool ipv6_policy)
{
source_ruleset = NULL;
source_ruleset = nullptr;
ruleSetName = "";
osconfigurator = NULL;
osconfigurator = nullptr;
countIPv6Rules = 0;
ipv6 = ipv6_policy;
persistent_objects = NULL;
persistent_objects = nullptr;
_init(_db, fw);
}
Compiler::Compiler(FWObjectDatabase *_db, Firewall *fw, bool ipv6_policy,
OSConfigurator *_oscnf)
{
source_ruleset = NULL;
source_ruleset = nullptr;
ruleSetName = "";
osconfigurator = _oscnf;
countIPv6Rules = 0;
ipv6 = ipv6_policy;
persistent_objects = NULL;
persistent_objects = nullptr;
_init(_db, fw);
}
// this constructor is used by class Preprocessor, it does not call _init
Compiler::Compiler(FWObjectDatabase*, bool ipv6_policy)
{
source_ruleset = NULL;
source_ruleset = nullptr;
ruleSetName = "";
osconfigurator = NULL;
osconfigurator = nullptr;
countIPv6Rules = 0;
ipv6 = ipv6_policy;
initialized = false;
_cntr_ = 1;
persistent_objects = NULL;
fw = NULL;
temp_ruleset = NULL;
persistent_objects = nullptr;
fw = nullptr;
temp_ruleset = nullptr;
debug = 0;
debug_rule = -1;
rule_debug_on = false;
@ -218,7 +218,7 @@ Compiler::Compiler(FWObjectDatabase*, bool ipv6_policy)
Compiler::~Compiler()
{
deleteRuleProcessors();
dbcopy = NULL;
dbcopy = nullptr;
}
void Compiler::setPersistentObjects(Library* po)
@ -291,8 +291,8 @@ void Compiler::_expand_group_recursive(FWObject *o, list<FWObject*> &ol)
*/
MultiAddress *adt = MultiAddress::cast(o);
if ((Group::cast(o)!=NULL && adt==NULL) ||
(adt!=NULL && adt->isCompileTime()))
if ((Group::cast(o)!=nullptr && adt==nullptr) ||
(adt!=nullptr && adt->isCompileTime()))
{
for (FWObject::iterator i2=o->begin(); i2!=o->end(); ++i2)
{
@ -406,7 +406,7 @@ void Compiler::_expand_addr_recursive(Rule *rule, FWObject *s,
}
if (o->getId() == FWObjectDatabase::ANY_ADDRESS_ID ||
MultiAddress::cast(o)!=NULL ||
MultiAddress::cast(o)!=nullptr ||
Interface::cast(o) ||
physAddress::cast(o))
{
@ -417,7 +417,7 @@ void Compiler::_expand_addr_recursive(Rule *rule, FWObject *s,
if (addrlist.empty())
{
if (RuleElement::cast(s)==NULL) ol.push_back(s);
if (RuleElement::cast(s)==nullptr) ol.push_back(s);
}
else
{
@ -480,15 +480,15 @@ void Compiler::_expand_interface(Rule *rule,
FWObject *p = Host::getParentHost(iface);
//FWObject *p = iface->getParentHost();
Host *hp = Host::cast(p);
if (hp==NULL) return; // something is very broken
if (hp==nullptr) return; // something is very broken
FWOptions *hopt = hp->getOptionsObject();
bool use_mac = (hopt!=NULL && hopt->getBool("use_mac_addr_filter"));
bool use_mac = (hopt!=nullptr && hopt->getBool("use_mac_addr_filter"));
for (FWObject::iterator i1=iface->begin(); i1!=iface->end(); ++i1)
{
FWObject *o= *i1;
if (physAddress::cast(o)!=NULL)
if (physAddress::cast(o)!=nullptr)
{
if (use_mac) ol.push_back(o);
continue;
@ -504,7 +504,7 @@ void Compiler::_expand_interface(Rule *rule,
}
if ( ! iface->isUnnumbered() &&
Address::cast(o)!=NULL &&
Address::cast(o)!=nullptr &&
MatchesAddressFamily(o)) ol.push_back(o);
}
@ -540,7 +540,7 @@ bool compare_addresses(FWObject *o1, FWObject *o2)
{
Address *a1 = Address::cast(o1);
Address *a2 = Address::cast(o2);
if (a1 == NULL || a2 == NULL)
if (a1 == nullptr || a2 == nullptr)
{
// one or both could be MultiAddress objects (e.g. DNSName)
return o1->getName() < o2->getName();
@ -548,8 +548,8 @@ bool compare_addresses(FWObject *o1, FWObject *o2)
const InetAddr *addr1 = a1->getAddressPtr();
const InetAddr *addr2 = a2->getAddressPtr();
if (addr1 == NULL) return true;
if (addr2 == NULL) return false;
if (addr1 == nullptr) return true;
if (addr2 == nullptr) return false;
return *addr1 < *addr2;
}
@ -594,7 +594,7 @@ void Compiler::_expandAddressRanges(Rule *rule, FWObject *re)
for (FWObject::iterator i1=re->begin(); i1!=re->end(); ++i1)
{
FWObject *o = FWReference::getObject(*i1);
assert(o!=NULL);
assert(o!=nullptr);
// if this is address range, check if it matches current address
// family. If it is not address range, put it back into the rule element
@ -628,7 +628,7 @@ void Compiler::_expandAddressRanges(Rule *rule, FWObject *re)
cl.push_back(h);
// see GroupRegistry::registerGroupObject()
if (group_registry != NULL)
if (group_registry != nullptr)
{
group_registry->setGroupRegistryKey(
h, group_registry->getGroupRegistryKey(aro));
@ -659,7 +659,7 @@ void Compiler::debugRule()
i!=source_ruleset->end(); i++)
{
Rule *rule = Rule::cast( *i );
if (rule == NULL) continue;
if (rule == nullptr) continue;
if (rule_debug_on && rule->getPosition()==debug_rule )
{
info(debugPrintRule(rule));
@ -687,7 +687,7 @@ string Compiler::debugPrintRule(libfwbuilder::Rule *rule)
void Compiler::add(BasicRuleProcessor* rp)
{
rule_processors.push_back(rp);
if (rule_debug_on && dynamic_cast<simplePrintProgress*>(rp)==NULL)
if (rule_debug_on && dynamic_cast<simplePrintProgress*>(rp)==nullptr)
rule_processors.push_back(new Debug());
}
@ -728,14 +728,14 @@ Compiler::Begin::Begin(const std::string &n) : BasicRuleProcessor(n)
bool Compiler::Begin::processNext()
{
assert(compiler!=NULL);
assert(compiler!=nullptr);
if (!init)
{
for (FWObject::iterator i=compiler->source_ruleset->begin();
i!=compiler->source_ruleset->end(); ++i)
{
Rule *rule = Rule::cast(*i);
if (rule == NULL) continue;
if (rule == nullptr) continue;
if (rule->isDisabled()) continue;
if (rule->isDummyRule()) {
compiler->warning(rule, "Rule contains dummy object and is not parsed.");
@ -759,8 +759,8 @@ bool Compiler::Begin::processNext()
bool Compiler::printTotalNumberOfRules::processNext()
{
assert(compiler!=NULL);
assert(prev_processor!=NULL);
assert(compiler!=nullptr);
assert(prev_processor!=nullptr);
slurp();
if (tmp_queue.size()==0) return false;
@ -775,8 +775,8 @@ bool Compiler::printTotalNumberOfRules::processNext()
bool Compiler::createNewCompilerPass::processNext()
{
assert(compiler!=NULL);
assert(prev_processor!=NULL);
assert(compiler!=nullptr);
assert(prev_processor!=nullptr);
slurp();
if (tmp_queue.size()==0) return false;
@ -786,8 +786,8 @@ bool Compiler::createNewCompilerPass::processNext()
bool Compiler::Debug::processNext()
{
assert(compiler!=NULL);
assert(prev_processor!=NULL);
assert(compiler!=nullptr);
assert(prev_processor!=nullptr);
slurp();
if (tmp_queue.size()==0) return false;
@ -813,10 +813,10 @@ bool Compiler::Debug::processNext()
bool Compiler::singleRuleFilter::processNext()
{
assert(compiler!=NULL);
assert(prev_processor!=NULL);
assert(compiler!=nullptr);
assert(prev_processor!=nullptr);
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
if (!compiler->single_rule_mode)
{
@ -833,7 +833,7 @@ bool Compiler::singleRuleFilter::processNext()
bool Compiler::simplePrintProgress::processNext()
{
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
std::string rl=rule->getLabel();
if (rl!=current_rule_label) {
@ -856,7 +856,7 @@ bool Compiler::simplePrintProgress::processNext()
*/
bool Compiler::splitIfRuleElementMatchesFW::processNext()
{
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
int nre = re->size();
@ -867,7 +867,7 @@ bool Compiler::splitIfRuleElementMatchesFW::processNext()
{
FWObject *obj = FWReference::getObject(*i1);
Address *a = Address::cast(obj);
assert(a!=NULL);
assert(a!=nullptr);
if (a->getId() == compiler->fw->getId() ||
a->getInt("parent_cluster_id") == compiler->fw->getId() ||
@ -911,7 +911,7 @@ bool Compiler::splitIfRuleElementMatchesFW::processNext()
bool Compiler::ReplaceFirewallObjectWithSelfInRE::processNext()
{
Rule *rule = prev_processor->getNextRule();
if (rule==NULL) return false;
if (rule==nullptr) return false;
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
for (list<FWObject*>::iterator i1=re->begin(); i1!=re->end(); ++i1)
@ -922,7 +922,7 @@ bool Compiler::ReplaceFirewallObjectWithSelfInRE::processNext()
DNSName *self = DNSName::cast(
compiler->persistent_objects->findObjectByName(
DNSName::TYPENAME, "self"));
if (self == NULL)
if (self == nullptr)
{
self = compiler->dbcopy->createDNSName();
self->setName("self");
@ -944,16 +944,16 @@ bool Compiler::ReplaceFirewallObjectWithSelfInRE::processNext()
bool Compiler::RegisterGroupsAndTablesInRE::processNext()
{
Rule *rule = prev_processor->getNextRule();
if (rule==NULL) return false;
if (rule==nullptr) return false;
if (compiler->group_registry != NULL)
if (compiler->group_registry != nullptr)
{
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
{
FWObject *obj = FWReference::getObject(*i);
if (ObjectGroup::cast(obj)!=NULL && obj->size() > 0)
if (ObjectGroup::cast(obj)!=nullptr && obj->size() > 0)
{
compiler->registerGroupObject(re, ObjectGroup::cast(obj));
}
@ -966,7 +966,7 @@ bool Compiler::RegisterGroupsAndTablesInRE::processNext()
void Compiler::registerGroupObject(RuleElement *re, ObjectGroup *grp)
{
assert(group_registry!=NULL);
assert(group_registry!=nullptr);
list<FWObject*> objects;
expandGroup(grp, objects);
group_registry->registerGroup(grp, objects);
@ -980,7 +980,7 @@ bool Compiler::equalObj::operator()(FWObject *o)
bool Compiler::singleObjectNegation::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *rel = RuleElement::cast(rule->getFirstByType(re_type));
assert(rel);
@ -996,7 +996,7 @@ bool Compiler::singleObjectNegation::processNext()
} else
{
FWObject *o = rel->front();
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
Address *reladdr = Address::cast(o);
if ( reladdr && reladdr->countInetAddresses(true)==1 &&
!compiler->complexMatch(reladdr, compiler->fw))
@ -1031,10 +1031,10 @@ bool Compiler::singleObjectNegation::processNext()
*/
bool Compiler::fullInterfaceNegationInRE::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *itfre = RuleElement::cast(rule->getFirstByType(re_type));
if (itfre==NULL)
if (itfre==nullptr)
compiler->abort(rule, "Missing interface rule element");
FWOptions *fwopt = compiler->getCachedFwOpt();
@ -1051,7 +1051,7 @@ bool Compiler::fullInterfaceNegationInRE::processNext()
for (FWObject::iterator i=all_interfaces.begin(); i!=all_interfaces.end(); ++i)
{
Interface *intf = Interface::cast(*i);
if (intf == NULL) continue;
if (intf == nullptr) continue;
if (intf->isUnprotected()) continue;
if (intf->isLoopback()) continue;
@ -1066,7 +1066,7 @@ bool Compiler::fullInterfaceNegationInRE::processNext()
{
// Only interface objects are allowed in the "Interface" rule element
Interface *rule_iface = Interface::cast(FWReference::getObject(*i));
if (rule_iface == NULL) continue;
if (rule_iface == nullptr) continue;
// If this interface belongs to a cluster (which can only happen
// if the rule set belongs to a cluster), then replace it with
// corresponding interface of the member
@ -1097,21 +1097,21 @@ bool Compiler::fullInterfaceNegationInRE::processNext()
*/
bool Compiler::replaceClusterInterfaceInItfRE::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *itfre = RuleElement::cast(rule->getFirstByType(re_type));
if (itfre==NULL)
if (itfre==nullptr)
compiler->abort(rule, "Missing interface rule element");
map<FWObject*, FWObject*> interface_replacement;
for (FWObject::iterator i=itfre->begin(); i!=itfre->end(); ++i)
{
Interface *member_iface = NULL;
Interface *member_iface = nullptr;
// Only interface objects are allowed in the "Interface" rule element
FWObject *o = FWReference::getObject(*i);
Interface *rule_iface = Interface::cast(o);
if (rule_iface == NULL) continue;
if (rule_iface == nullptr) continue;
// If this interface belongs to a cluster (which can only happen
// if the rule set belongs to a cluster), then replace it with
// corresponding interface of the member
@ -1143,9 +1143,9 @@ bool Compiler::replaceClusterInterfaceInItfRE::processNext()
bool Compiler::eliminateDuplicatesInRE::processNext()
{
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
if (comparator==NULL) comparator = new equalObj();
if (comparator==nullptr) comparator = new equalObj();
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
@ -1154,7 +1154,7 @@ bool Compiler::eliminateDuplicatesInRE::processNext()
for(list<FWObject*>::iterator i=re->begin(); i!=re->end(); ++i)
{
FWObject *obj = FWReference::getObject(*i);
if (obj == NULL) continue;
if (obj == nullptr) continue;
comparator->set(obj);
@ -1183,7 +1183,7 @@ void Compiler::recursiveGroupsInRE::isRecursiveGroup(int grid, FWObject *obj)
for (FWObject::iterator i=obj->begin(); i!=obj->end(); i++)
{
FWObject *o = FWReference::getObject(*i);
if (Group::cast(o)!=NULL)
if (Group::cast(o)!=nullptr)
{
if (o->getId()==grid || obj->getId()==o->getId())
{
@ -1199,10 +1199,10 @@ void Compiler::recursiveGroupsInRE::isRecursiveGroup(int grid, FWObject *obj)
bool Compiler::recursiveGroupsInRE::processNext()
{
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
if (re == NULL || re->isAny())
if (re == nullptr || re->isAny())
{
tmp_queue.push_back(rule);
return true;
@ -1212,7 +1212,7 @@ bool Compiler::recursiveGroupsInRE::processNext()
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
{
FWObject *o = FWReference::getObject(*i);
if (Group::cast(o)!=NULL) isRecursiveGroup(o->getId(),o);
if (Group::cast(o)!=nullptr) isRecursiveGroup(o->getId(),o);
}
tmp_queue.push_back(rule);
@ -1240,11 +1240,11 @@ int Compiler::emptyGroupsInRE::countChildren(FWObject *obj)
// have some addresses at run time. So we just count it as a
// regular object.
if (MultiAddress::cast(o)!=NULL && MultiAddress::cast(o)->isRunTime())
if (MultiAddress::cast(o)!=nullptr && MultiAddress::cast(o)->isRunTime())
n++;
else
{
if (Group::cast(o)!=NULL) n += countChildren(o);
if (Group::cast(o)!=nullptr) n += countChildren(o);
else n++; // but if it is not a group, then we count it.
}
}
@ -1253,10 +1253,10 @@ int Compiler::emptyGroupsInRE::countChildren(FWObject *obj)
bool Compiler::emptyGroupsInRE::processNext()
{
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
if (re == NULL || re->isAny())
if (re == nullptr || re->isAny())
{
tmp_queue.push_back(rule);
return true;
@ -1267,10 +1267,10 @@ bool Compiler::emptyGroupsInRE::processNext()
{
FWObject *o = FWReference::getObject(*i);
if ( MultiAddress::cast(o)!=NULL && MultiAddress::cast(o)->isRunTime())
if ( MultiAddress::cast(o)!=nullptr && MultiAddress::cast(o)->isRunTime())
continue;
if (Group::cast(o)!=NULL && countChildren(o)==0)
if (Group::cast(o)!=nullptr && countChildren(o)==0)
cl.push_back(o);
}
@ -1335,10 +1335,10 @@ bool Compiler::emptyGroupsInRE::processNext()
*/
bool Compiler::swapMultiAddressObjectsInRE::processNext()
{
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *re=RuleElement::cast( rule->getFirstByType(re_type) );
if (re == NULL || re->isAny())
if (re == nullptr || re->isAny())
{
tmp_queue.push_back(rule);
return true;
@ -1348,7 +1348,7 @@ bool Compiler::swapMultiAddressObjectsInRE::processNext()
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
{
FWObject *o = FWReference::getObject(*i);
if (MultiAddress::cast(o)!=NULL && MultiAddress::cast(o)->isRunTime())
if (MultiAddress::cast(o)!=nullptr && MultiAddress::cast(o)->isRunTime())
cl.push_back(MultiAddress::cast(o));
}
@ -1369,7 +1369,7 @@ bool Compiler::swapMultiAddressObjectsInRE::processNext()
int mart_id = FWObjectDatabase::registerStringId(mart_id_str);
MultiAddressRunTime *mart = MultiAddressRunTime::cast(
compiler->dbcopy->findInIndex(mart_id));
if (mart==NULL)
if (mart==nullptr)
{
mart = new MultiAddressRunTime(ma);
@ -1396,7 +1396,7 @@ bool Compiler::swapMultiAddressObjectsInRE::processNext()
bool Compiler::expandMultipleAddressesInRE::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *re = RuleElement::cast( rule->getFirstByType(re_type) );
if (re) compiler->_expand_addr(rule, re, true);
tmp_queue.push_back(rule);
@ -1406,12 +1406,12 @@ bool Compiler::expandMultipleAddressesInRE::processNext()
bool Compiler::checkForObjectsWithErrors::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
for (FWObject::iterator it1=rule->begin(); it1!=rule->end(); it1++)
{
RuleElement *re = RuleElement::cast(*it1);
if (re == NULL || re->isAny()) continue;
if (re == nullptr || re->isAny()) continue;
for (FWObject::iterator it2=re->begin(); it2!=re->end(); it2++)
{
FWObject *obj = FWReference::getObject(*it2);
@ -1435,10 +1435,10 @@ bool Compiler::checkForObjectsWithErrors::processNext()
bool Compiler::replaceFailoverInterfaceInRE::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
RuleElement *re = RuleElement::cast( rule->getFirstByType(re_type) );
if (re == NULL || re->isAny())
if (re == nullptr || re->isAny())
{
tmp_queue.push_back(rule);
return true;
@ -1449,7 +1449,7 @@ bool Compiler::replaceFailoverInterfaceInRE::processNext()
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
{
Interface *intf = Interface::cast(FWReference::getObject(*i));
if (intf==NULL) continue;
if (intf==nullptr) continue;
if (intf->isFailoverInterface()) cl.push_back(intf);
else
@ -1500,7 +1500,7 @@ bool Compiler::replaceFailoverInterfaceInRE::processNext()
bool Compiler::FindAddressFamilyInRE(FWObject *parent, bool ipv6)
{
Address *addr = Address::cast(parent);
if (addr!=NULL)
if (addr!=nullptr)
{
const InetAddr *inet_addr = addr->getAddressPtr();
if (ipv6)
@ -1559,7 +1559,7 @@ bool Compiler::dropRuleWithEmptyRE::isREEmpty(Rule *rule,
*/
bool Compiler::dropRuleWithEmptyRE::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
if (PolicyRule::cast(rule) &&
(isREEmpty(rule, RuleElementSrc::TYPENAME) ||
@ -1607,7 +1607,7 @@ void Compiler::DropByServiceTypeInRE(RuleElement *rel, bool drop_ipv6)
Service *svc = Service::cast(o);
if (svc == NULL)
if (svc == nullptr)
{
cerr << endl;
cerr << "Rule " << Rule::cast(rel->getParent())->getLabel()
@ -1641,7 +1641,7 @@ bool Compiler::catchUnnumberedIfaceInRE(RuleElement *re)
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
{
FWObject *o = FWReference::getObject(*i);
if (o==NULL)
if (o==nullptr)
{
//Rule *rule = Rule::cast(re->getParent());
FWReference *refo = FWReference::cast(*i);
@ -1651,7 +1651,7 @@ bool Compiler::catchUnnumberedIfaceInRE(RuleElement *re)
FWObjectDatabase::getStringId(refo->getPointerId());
abort(re->getParent(), errmsg);
}
err |= ((iface=Interface::cast(o))!=NULL &&
err |= ((iface=Interface::cast(o))!=nullptr &&
(iface->isUnnumbered() || iface->isBridgePort())
);
}
@ -1682,7 +1682,7 @@ Service* Compiler::getFirstSrv(PolicyRule *rule)
Interval* Compiler::getFirstWhen(PolicyRule *rule)
{
RuleElementInterval *when = rule->getWhen();
if (when==NULL) return NULL; // when is optional element
if (when==nullptr) return nullptr; // when is optional element
FWObject *o = FWReference::getObject(when->front());
return Interval::cast(o);
}
@ -1690,7 +1690,7 @@ Interval* Compiler::getFirstWhen(PolicyRule *rule)
Interface* Compiler::getFirstItf(PolicyRule *rule)
{
RuleElementItf *itf = rule->getItf();
if (itf==NULL || itf->size()==0) return NULL; // itf is optional element
if (itf==nullptr || itf->size()==0) return nullptr; // itf is optional element
FWObject *o = FWReference::getObject(itf->front());
return Interface::cast(o);
}
@ -1698,7 +1698,7 @@ Interface* Compiler::getFirstItf(PolicyRule *rule)
Address* Compiler::getFirstOSrc(NATRule *rule)
{
RuleElementOSrc *osrc = rule->getOSrc();
assert(osrc!=NULL);
assert(osrc!=nullptr);
FWObject *o = FWReference::getObject(osrc->front());
return Address::cast(o);
}
@ -1706,7 +1706,7 @@ Address* Compiler::getFirstOSrc(NATRule *rule)
Address* Compiler::getFirstODst(NATRule *rule)
{
RuleElementODst *odst = rule->getODst();
assert(odst!=NULL);
assert(odst!=nullptr);
FWObject *o = FWReference::getObject(odst->front());
return Address::cast(o);
}
@ -1714,7 +1714,7 @@ Address* Compiler::getFirstODst(NATRule *rule)
Service* Compiler::getFirstOSrv(NATRule *rule)
{
RuleElementOSrv *osrv = rule->getOSrv();
assert(osrv!=NULL);
assert(osrv!=nullptr);
FWObject *o = FWReference::getObject(osrv->front());
return Service::cast(o);
}
@ -1722,7 +1722,7 @@ Service* Compiler::getFirstOSrv(NATRule *rule)
Address* Compiler::getFirstTSrc(NATRule *rule)
{
RuleElementTSrc *tsrc = rule->getTSrc();
assert(tsrc!=NULL);
assert(tsrc!=nullptr);
FWObject *o = FWReference::getObject(tsrc->front());
return Address::cast(o);
}
@ -1730,7 +1730,7 @@ Address* Compiler::getFirstTSrc(NATRule *rule)
Address* Compiler::getFirstTDst(NATRule *rule)
{
RuleElementTDst *tdst = rule->getTDst();
assert(tdst!=NULL);
assert(tdst!=nullptr);
FWObject *o = FWReference::getObject(tdst->front());
return Address::cast(o);
}
@ -1738,7 +1738,7 @@ Address* Compiler::getFirstTDst(NATRule *rule)
Service* Compiler::getFirstTSrv(NATRule *rule)
{
RuleElementTSrv *tsrv = rule->getTSrv();
assert(tsrv!=NULL);
assert(tsrv!=nullptr);
FWObject *o = FWReference::getObject(tsrv->front());
return Service::cast(o);
}
@ -1842,21 +1842,21 @@ Address* Compiler::correctForCluster(Address *addr)
*/
bool Compiler::DropRulesByAddressFamilyAndServiceType::processNext()
{
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
for(FWObject::iterator it=rule->begin(); it!=rule->end(); ++it)
{
RuleElement *re = RuleElement::cast(*it);
if (re == NULL) continue; // probably RuleOptions object
if (re == nullptr) continue; // probably RuleOptions object
bool orig_any = re->isAny();
if (orig_any) continue;
FWObject *first_object = FWReference::getObject(re->front());
if (Address::cast(first_object) != NULL)
if (Address::cast(first_object) != nullptr)
compiler->DropAddressFamilyInRE(re, drop_ipv6);
if (Service::cast(first_object) != NULL)
if (Service::cast(first_object) != nullptr)
compiler->DropByServiceTypeInRE(re, drop_ipv6);
if (!orig_any && re->isAny())

View File

@ -56,7 +56,7 @@ AddressRangeDialog::AddressRangeDialog(QWidget *parent):
{
m_dialog = new Ui::AddressRangeDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -70,7 +70,7 @@ void AddressRangeDialog::loadFWObject(FWObject *o)
{
obj=o;
AddressRange *s = dynamic_cast<AddressRange*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;
@ -99,7 +99,7 @@ void AddressRangeDialog::validate(bool *res)
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
AddressRange *s = dynamic_cast<AddressRange*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
try
{
InetAddr range_start(AF_UNSPEC, m_dialog->rangeStart->text().toLatin1().constData());
@ -118,13 +118,13 @@ void AddressRangeDialog::validate(bool *res)
{
*res = false;
// show warning dialog only if app has focus
if (QApplication::focusWidget() != NULL)
if (QApplication::focusWidget() != nullptr)
{
blockSignals(true);
QMessageBox::critical(
this, "Firewall Builder",
QString::fromUtf8(ex.toString().c_str()),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
blockSignals(false);
}
@ -138,7 +138,7 @@ void AddressRangeDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
AddressRange *s = dynamic_cast<AddressRange*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname = obj->getName();
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );

View File

@ -66,7 +66,7 @@ AddressTableDialog::AddressTableDialog(QWidget *parent) : BaseObjectDialog(paren
{
m_dialog = new Ui::AddressTableDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -80,7 +80,7 @@ void AddressTableDialog::loadFWObject(FWObject *o)
{
obj=o;
AddressTable *s = dynamic_cast<AddressTable*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init = true;
@ -116,7 +116,7 @@ void AddressTableDialog::validate(bool *res)
{
*res=true;
AddressTable *s = dynamic_cast<AddressTable*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
}
@ -127,7 +127,7 @@ void AddressTableDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
AddressTable *s = dynamic_cast<AddressTable*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname = obj->getName();
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );

View File

@ -41,7 +41,7 @@ FWObject *AskLibForCopyDialog::askLibForCopyDialog( QWidget *parent,
AskLibForCopyDialog dlg(parent, db, curr);
if ( dlg.exec() == QDialog::Accepted )
return dlg.getChoosenLib();
return 0;
return nullptr;
}
AskLibForCopyDialog::~AskLibForCopyDialog()
@ -110,5 +110,5 @@ FWObject *AskLibForCopyDialog::getChoosenLib()
int ind = m_dialog->libs->currentIndex();
if (0 <= ind)
return idxToLibs[ind];
return 0;
return nullptr;
}

View File

@ -59,7 +59,7 @@ AttachedNetworksDialog::AttachedNetworksDialog(QWidget *parent) : BaseObjectDial
{
m_dialog = new Ui::AttachedNetworksDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -70,7 +70,7 @@ void AttachedNetworksDialog::loadFWObject(FWObject *o)
{
obj=o;
AttachedNetworks *s = dynamic_cast<AttachedNetworks*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;
@ -129,7 +129,7 @@ void AttachedNetworksDialog::validate(bool *result)
*result = true;
AttachedNetworks *s = dynamic_cast<AttachedNetworks*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
if (!validateName(this, obj, m_dialog->obj_name->text()))
{
@ -144,7 +144,7 @@ void AttachedNetworksDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
AttachedNetworks *s = dynamic_cast<AttachedNetworks*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname = obj->getName();
new_state->setName(string(m_dialog->obj_name->text().toUtf8().constData()));

View File

@ -58,7 +58,7 @@ ClusterGroupDialog::ClusterGroupDialog(QWidget *parent)
{
m_dialog = new Ui::ClusterGroupDialog_q;
m_dialog->setupUi(this);
obj = NULL;
obj = nullptr;
reload = false;
connectSignalsOfAllWidgetsToSlotChange();
@ -68,7 +68,7 @@ void ClusterGroupDialog::loadFWObject(FWObject *o)
{
obj = o;
ClusterGroup *g = dynamic_cast<ClusterGroup*>(obj);
assert(g != NULL);
assert(g != nullptr);
init = true;
@ -76,7 +76,7 @@ void ClusterGroupDialog::loadFWObject(FWObject *o)
// Parent is either 'Cluster' or 'Interface', call getParent() approprietly
FWObject *parent = obj;
while (parent && !Cluster::isA(parent)) parent = parent->getParent();
if (parent == NULL)
if (parent == nullptr)
{
throw FWException("ClusterGroupDialog: parent is NULL!");
}
@ -199,7 +199,7 @@ void ClusterGroupDialog::saveGroupType(FWObject *group)
void ClusterGroupDialog::addIcon(FWObject *o, bool master)
{
FWObject *iface = o;
assert(Interface::cast(iface)!=NULL);
assert(Interface::cast(iface)!=nullptr);
FWObject *fw = Host::getParentHost(iface);
// FWObject *fw = Interface::cast(iface)->getParentHost(); // because iface can be subinterface
bool valid = cluster->validateMember(Firewall::cast(fw));
@ -280,7 +280,7 @@ void ClusterGroupDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
ClusterGroup *g = dynamic_cast<ClusterGroup*>(new_state);
assert(g != NULL);
assert(g != nullptr);
QString oldname = obj->getName().c_str();
new_state->setName(string(m_dialog->obj_name->text().toUtf8().constData()));
@ -304,12 +304,12 @@ void ClusterGroupDialog::openClusterConfDialog()
try
{
QWidget *w = DialogFactory::createClusterConfDialog(this, obj);
if (w == NULL)
if (w == nullptr)
{
return; // some dialogs may not be implemented yet
}
QDialog *d = dynamic_cast<QDialog*>(w);
assert(d != NULL);
assert(d != nullptr);
// connect obj changed signal
//connect(d, SIGNAL(membersChanged()), this, SLOT(objectChanged()));
@ -343,10 +343,10 @@ void ClusterGroupDialog::openClusterConfDialog()
void ClusterGroupDialog::openObject(QTreeWidgetItem *item)
{
ObjectListViewItem *otvi = dynamic_cast<ObjectListViewItem*>(item);
assert(otvi != NULL);
assert(otvi != nullptr);
FWObject *o = otvi->getFWObject();
if (o != NULL)
if (o != nullptr)
{
QCoreApplication::postEvent(
mw, new showObjectInTreeEvent(o->getRoot()->getFileName().c_str(),

View File

@ -145,7 +145,7 @@ bool ClusterInterfaceWidget::setCurrentInterface(const QString& name)
foreach(QTreeWidgetItem *item, list.list->findItems(name, Qt::MatchCaseSensitive | Qt::MatchExactly | Qt::MatchRecursive))
{
Interface *iface = item->data(0, Qt::UserRole).value<Interface*>();
if (iface == NULL) continue;
if (iface == nullptr) continue;
if ( item == roots[list.list] ) continue; // skip firewall object
if ( interfaceSelectable(iface) ) // interface is good for use in cluster
{
@ -195,7 +195,7 @@ bool ClusterInterfaceWidget::interfaceSelectable(Interface* iface)
Resources* os_res = Resources::os_res[os.toStdString()];
string os_family = os.toStdString();
if (os_res!=NULL)
if (os_res!=nullptr)
os_family = os_res->getResourceStr("/FWBuilderResources/Target/family");
unique_ptr<interfaceProperties> int_prop(

View File

@ -55,7 +55,7 @@ CommentEditorPanel::CommentEditorPanel(QWidget *p) : BaseObjectDialog(p)
{
m_widget = new Ui::CommentEditorPanel_q;
m_widget->setupUi(this);
rule=NULL;
rule=nullptr;
}
QString CommentEditorPanel::text()

View File

@ -60,6 +60,6 @@ CompilerDriver* CompilerDriverFactory::createCompilerDriver(Firewall *fw)
return new CompilerDriver_pix(fw->getRoot());
if (platform == "procurve_acl")
return new CompilerDriver_procurve_acl(fw->getRoot());
return NULL;
return nullptr;
}

View File

@ -132,7 +132,7 @@ void CompilerOutputPanel::loadFWObject(FWObject *obj)
//m_widget->compiler_output_panel->clear();
if (dr == NULL)
if (dr == nullptr)
{
// we have no compiler for this platform or unknown platform
format = error_format;

View File

@ -107,7 +107,7 @@ void ConfirmDeleteObjectDialog::findForObject(FWObject *obj)
foreach(FWObject *o, simplified_holders)
{
QTreeWidgetItem *item = FindWhereUsedWidget::createQTWidgetItem(obj, o);
if (item==NULL) continue;
if (item==nullptr) continue;
m_dialog->objectsView->addTopLevelItem(item);
itemCounter++;
}

View File

@ -57,7 +57,7 @@ CustomServiceDialog::CustomServiceDialog(QWidget *parent) : BaseObjectDialog(par
{
m_dialog = new Ui::CustomServiceDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -71,7 +71,7 @@ void CustomServiceDialog::loadFWObject(FWObject *o)
{
obj=o;
CustomService *s = dynamic_cast<CustomService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;
@ -202,7 +202,7 @@ void CustomServiceDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
CustomService *s = dynamic_cast<CustomService*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname = obj->getName();
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );

View File

@ -349,7 +349,7 @@ void DynamicGroupDialog::gotItemDoubleClicked(QTreeWidgetItem *item, int)
{
int objId = item->data(0, Qt::UserRole).toInt();
FWObject *o = m_project->db()->findInIndex(objId);
if (o == 0) return;
if (o == nullptr) return;
QCoreApplication::postEvent(m_project, new showObjectInTreeEvent(o->getRoot()->getFileName().c_str(), objId));
QCoreApplication::postEvent(mw, new openObjectInEditorEvent(o->getRoot()->getFileName().c_str(), objId));

View File

@ -118,7 +118,7 @@ void FWCmdAddObject::prepareStatesForRedo()
// remove it but increment reference counter.
FWObject* grp = getObject();
FWObject *new_grp = getNewState();
if (member == NULL)
if (member == nullptr)
{
// Find new object among children of newState. member can be
// NULL if FWCmdAddObject object is created before the new
@ -272,7 +272,7 @@ FWCmdAddLibrary::FWCmdAddLibrary(ProjectPanel *project,
QUndoCommand* macro):
FWCmdAddObject(project, root, lib, text, macro)
{
assert(FWObjectDatabase::cast(root)!=NULL);
assert(FWObjectDatabase::cast(root)!=nullptr);
if (text.isEmpty())
{

View File

@ -75,7 +75,7 @@ FWCmdMoveObject::FWCmdMoveObject(
{
old_parent = old_p;
new_parent = new_p;
current_parent = NULL;
current_parent = nullptr;
obj = o;
if (text.isEmpty())
@ -258,7 +258,7 @@ void FWCmdMoveObject::notify()
QCoreApplication::postEvent(
mw, new dataModifiedEvent(filename, new_parent->getId()));
FWObject *new_obj = NULL;
FWObject *new_obj = nullptr;
if (current_parent->getId()==FWObjectDatabase::DELETED_OBJECTS_ID)
{
if (Library::isA(obj))
@ -277,13 +277,13 @@ void FWCmdMoveObject::notify()
{
// new_obj = old_parent; // this does not work!
new_obj = project->m_panel->om->getNextUserLib(obj);
if (new_obj == NULL)
if (new_obj == nullptr)
{
// no user libraries left, show "Standard"
new_obj = old_parent->getRoot()->findInIndex(
FWObjectDatabase::getIntId("syslib000"));
}
if (new_obj == NULL)
if (new_obj == nullptr)
new_obj = old_parent->getRoot()->front();
if (fwbdebug) qDebug() << "FWCmdMoveObject::notify() new_obj="
<< new_obj;

View File

@ -37,18 +37,18 @@
using namespace std;
using namespace libfwbuilder;
FWObjectClipboard* FWObjectClipboard::obj_clipboard=NULL;
FWObjectClipboard* FWObjectClipboard::obj_clipboard=nullptr;
FWObjectClipboard::FWObjectClipboard()
{
assert(obj_clipboard==NULL);
assert(obj_clipboard==nullptr);
obj_clipboard=this;
}
FWObjectClipboard::~FWObjectClipboard()
{
clear();
obj_clipboard=NULL;
obj_clipboard=nullptr;
}
void FWObjectClipboard::clear()
@ -115,7 +115,7 @@ FWObject* FWObjectClipboard::getObject()
pair<int,ProjectPanel*> p = ids.back();
return p.second->db()->findInIndex( p.first );
} else
return NULL;
return nullptr;
}
FWObject* FWObjectClipboard::getObjectByIdx (int idx)
@ -125,6 +125,6 @@ FWObject* FWObjectClipboard::getObjectByIdx (int idx)
pair<int,ProjectPanel*> p = ids[idx];
return p.second->db()->findInIndex( p.first );
} else
return NULL;
return nullptr;
}

View File

@ -69,7 +69,7 @@ FWObjectDropArea::FWObjectDropArea(QWidget*p, const char * n, Qt::WindowFlags f)
setWindowFlags( f );
m_objectDropArea = new Ui::FWObjectDropArea_q;
m_objectDropArea->setupUi(this);
object=NULL;
object=nullptr;
helperText = tr("Drop object here.");
}
@ -93,7 +93,7 @@ void FWObjectDropArea::paintEvent(QPaintEvent *)
tp.drawLine(0,h-1,0,0);
tp.fillRect(1, 1, w-2, h-2, Qt::white);
if (object!=NULL)
if (object!=nullptr)
{
QPixmap pm;
@ -147,7 +147,7 @@ void FWObjectDropArea::insertObject(libfwbuilder::FWObject *o)
void FWObjectDropArea::deleteObject()
{
object=NULL;
object=nullptr;
update();
emit objectDeleted();
}
@ -166,9 +166,9 @@ void FWObjectDropArea::contextMenuEvent (QContextMenuEvent * e)
popup->addSeparator();
QAction *dlAct = popup->addAction( tr("Delete") , this , SLOT( deleteObject( )) );
sitAct->setEnabled(object!=NULL);
editAct->setEnabled(object!=NULL);
dlAct->setEnabled(object!=NULL);
sitAct->setEnabled(object!=nullptr);
editAct->setEnabled(object!=nullptr);
dlAct->setEnabled(object!=nullptr);
psAct->setEnabled(FWObjectClipboard::obj_clipboard->size()>0);
popup->exec(e->globalPos ());
@ -239,7 +239,7 @@ void FWObjectDropArea::pasteObject()
void FWObjectDropArea::showInTreeObject()
{
ProjectPanel * pp = mw->activeProject();
if (pp!=NULL)
if (pp!=nullptr)
{
QCoreApplication::postEvent(
pp, new showObjectInTreeEvent(pp->getFileName(), object->getId()));
@ -249,9 +249,9 @@ void FWObjectDropArea::showInTreeObject()
void FWObjectDropArea::editObject()
{
ProjectPanel * pp = mw->activeProject();
if (pp!=NULL)
if (pp!=nullptr)
{
if (RuleSet::cast(object)!=NULL)
if (RuleSet::cast(object)!=nullptr)
QCoreApplication::postEvent(
pp, new openRulesetEvent(pp->getFileName(), object->getId()));
@ -264,5 +264,5 @@ void FWObjectDropArea::editObject()
void FWObjectDropArea::mouseDoubleClickEvent(QMouseEvent *)
{
if (object!=NULL) editObject();
if (object!=nullptr) editObject();
}

View File

@ -159,11 +159,11 @@ QString FWObjectPropertiesFactory::getObjectPropertiesBrief(FWObject *obj)
str << "/";
str << QString("%1").arg(n->getNetmaskPtr()->getLength());
} else if (ClusterGroup::cast(obj)!=NULL)
} else if (ClusterGroup::cast(obj)!=nullptr)
{
ClusterGroup *g = ClusterGroup::cast(obj);
str << QObject::tr("type: ") << g->getStr("type").c_str();
} else if (Group::cast(obj)!=NULL) // just any group
} else if (Group::cast(obj)!=nullptr) // just any group
{
Group *g=Group::cast(obj);
str << g->size() << " " << QObject::tr(" objects");
@ -255,7 +255,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesBrief(FWObject *obj)
{
const UserService* user_srv = UserService::constcast(obj);
str << "User id: \"" << user_srv->getUserId().c_str() << "\"" ;
} else if (RuleSet::cast(obj) != NULL)
} else if (RuleSet::cast(obj) != nullptr)
{
QStringList attrs;
RuleSet *rs = RuleSet::cast(obj);
@ -356,10 +356,10 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
str << "(no ip address)";
FWObject *co=obj->getFirstByType("Interface");
if (co!=NULL)
if (co!=nullptr)
{
physAddress *paddr=(Interface::cast(co))->getPhysicalAddress();
if (paddr!=NULL)
if (paddr!=nullptr)
str << " " << paddr->getPhysAddress().c_str();
}
@ -377,7 +377,7 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
.arg(n->getAddressPtr()->toString().c_str())
.arg(n->getNetmaskPtr()->getLength());
} else if (ClusterGroup::cast(obj)!=NULL)
} else if (ClusterGroup::cast(obj)!=nullptr)
{
ClusterGroup *g = ClusterGroup::cast(obj);
str << QObject::tr("Type: ") << g->getStr("type").c_str() << " ";
@ -399,10 +399,10 @@ QString FWObjectPropertiesFactory::getObjectProperties(FWObject *obj)
members.push_front(QObject::tr("Members:"));
str << members.join(" ");
}
} else if (DynamicGroup::cast(obj) != 0) {
} else if (DynamicGroup::cast(obj) != nullptr) {
DynamicGroup *objGroup = DynamicGroup::cast(obj);
str << QObject::tr("%1 filters").arg(objGroup->getFilter().size());
} else if (Group::cast(obj)!=NULL) // just any group
} else if (Group::cast(obj)!=nullptr) // just any group
{
Group *g=Group::cast(obj);
str << QObject::tr("%1 objects").arg(g->size());
@ -696,7 +696,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
str += n->getAddressPtr()->toString().c_str();
str += "/";
str += QString("%1").arg(n->getNetmaskPtr()->getLength());
} else if (ClusterGroup::cast(obj)!=NULL)
} else if (ClusterGroup::cast(obj)!=nullptr)
{
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
ClusterGroup *g = ClusterGroup::cast(obj);
@ -712,10 +712,10 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
arg(fw->getName().c_str()).arg(obj->getName().c_str());
}
}
} else if (DynamicGroup::cast(obj) != 0) {
} else if (DynamicGroup::cast(obj) != nullptr) {
DynamicGroup *objGroup = DynamicGroup::cast(obj);
str += QObject::tr("%1 filters<br>\n").arg(objGroup->getFilter().size());
} else if (Group::cast(obj)!=NULL) // just any group
} else if (Group::cast(obj)!=nullptr) // just any group
{
if (showPath && !tooltip) str += "<b>Path: </b>" + path + "<br>\n";
Group *g = Group::cast(obj);
@ -733,7 +733,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
} else
{
FWObject *o1=*i;
if (FWReference::cast(o1)!=NULL)
if (FWReference::cast(o1)!=nullptr)
o1=FWReference::cast(o1)->getPointer();
str += QString(o1->getTypeName().c_str())
+ " <b>" + QString::fromUtf8(o1->getName().c_str()) + "</b><br>\n";
@ -791,10 +791,10 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
do
{
parent_host = parent_host->getParent();
if (parent_host == NULL) break;
if (parent_host == nullptr) break;
short_path.push_front(QString::fromUtf8(parent_host->getName().c_str()));
}
while (Host::cast(parent_host) == NULL);
while (Host::cast(parent_host) == nullptr);
str += QString("<b>Parent: </b>%1<br>\n").arg(short_path.join("/"));
@ -824,7 +824,7 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
}
physAddress *paddr = intf->getPhysicalAddress();
if (paddr!=NULL)
if (paddr!=nullptr)
{
str += "MAC: ";
str += paddr->getPhysAddress().c_str() ;
@ -837,8 +837,8 @@ QString FWObjectPropertiesFactory::getObjectPropertiesDetailed(FWObject *obj,
if (intf->isBridgePort()) q=" bridge port";
FWObject *p=obj;
while (p!=NULL && !Firewall::cast(p)) p=p->getParent();
if (p!=NULL && (p->getStr("platform")=="pix" || p->getStr("platform")=="fwsm"))
while (p!=nullptr && !Firewall::cast(p)) p=p->getParent();
if (p!=nullptr && (p->getStr("platform")=="pix" || p->getStr("platform")=="fwsm"))
{
int sl = intf->getSecurityLevel();
q=q+QString("sec.level %1").arg(sl);
@ -932,13 +932,13 @@ QString FWObjectPropertiesFactory::getRuleActionProperties(Rule *rule)
{
QString par = "";
if (rule!=NULL)
if (rule!=nullptr)
{
QString act = getRuleAction(rule);
FWObject *o = rule;
while (o!=NULL && Firewall::cast(o)==NULL) o=o->getParent();
if (o==NULL) return "";
while (o!=nullptr && Firewall::cast(o)==nullptr) o=o->getParent();
if (o==nullptr) return "";
Firewall *f=Firewall::cast(o);
string platform=f->getStr("platform");
@ -1003,8 +1003,8 @@ QString FWObjectPropertiesFactory::getRuleActionProperties(Rule *rule)
QString FWObjectPropertiesFactory::getRuleActionPropertiesRich(Rule *rule)
{
FWObject *p=rule;
while (p!=NULL && !Firewall::cast(p)) p=p->getParent();
if (p==NULL)
while (p!=nullptr && !Firewall::cast(p)) p=p->getParent();
if (p==nullptr)
{
qDebug() << "FWObjectPropertiesFactory::getRuleActionPropertiesRich(): "
<< "Can not locate parent firewall for the rule:";
@ -1025,14 +1025,14 @@ QString FWObjectPropertiesFactory::getRuleActionPropertiesRich(Rule *rule)
QString FWObjectPropertiesFactory::getPolicyRuleOptions(Rule *rule)
{
if (rule == NULL) return "";
if (rule == nullptr) return "";
QList<QPair<QString,QString> > options;
PolicyRule *prule = PolicyRule::cast(rule);
FWObject *o = rule;
while (o!=NULL && Firewall::cast(o)==NULL) o = o->getParent();
assert(o!=NULL);
while (o!=nullptr && Firewall::cast(o)==nullptr) o = o->getParent();
assert(o!=nullptr);
Firewall *f = Firewall::cast(o);
string platform = f->getStr("platform");
FWOptions *ropt = rule->getOptionsObject();
@ -1317,12 +1317,12 @@ QString FWObjectPropertiesFactory::getNATRuleOptions(Rule *rule)
{
QString res;
if (rule!=NULL)
if (rule!=nullptr)
{
res="";
FWObject *o = rule;
while (o!=NULL && Firewall::cast(o)==NULL) o=o->getParent();
assert(o!=NULL);
while (o!=nullptr && Firewall::cast(o)==nullptr) o=o->getParent();
assert(o!=nullptr);
Firewall *f=Firewall::cast(o);
string platform=f->getStr("platform");
FWOptions *ropt = rule->getOptionsObject();
@ -1357,7 +1357,7 @@ QString FWObjectPropertiesFactory::getNATRuleOptions(Rule *rule)
QString FWObjectPropertiesFactory::getInterfaceNameExamplesForHostOS(const QString &host_os)
{
Resources *os_resources = Resources::os_res[host_os.toStdString()];
if (os_resources == NULL) return "";
if (os_resources == nullptr) return "";
string os_family = os_resources-> getResourceStr("/FWBuilderResources/Target/family");
if (os_family == "linux24" ||

View File

@ -30,8 +30,8 @@ using namespace libfwbuilder;
FWObjectSelectionModel::FWObjectSelectionModel()
{
selectedObject = 0;
selectedObjectOld = 0;
selectedObject = nullptr;
selectedObjectOld = nullptr;
}
void FWObjectSelectionModel::setSelected(FWObject * so, const QModelIndex &index)
@ -56,5 +56,5 @@ void FWObjectSelectionModel::restore()
void FWObjectSelectionModel::reset()
{
QModelIndex index;
setSelected(NULL, index);
setSelected(nullptr, index);
}

View File

@ -63,7 +63,7 @@ using namespace libfwbuilder;
*/
bool FWWindow::isEditorVisible()
{
return oe != NULL && m_mainWindow->editorDockWidget->isVisible() &&
return oe != nullptr && m_mainWindow->editorDockWidget->isVisible() &&
m_mainWindow->editorPanelTabWidget->currentIndex() == EDITOR_PANEL_EDITOR_TAB;
}
@ -109,7 +109,7 @@ void FWWindow::clearEditorAndSearchPanels()
{
findWhereUsedWidget->clear();
findObjectWidget->clear();
if (oe != NULL) oe->blank();
if (oe != nullptr) oe->blank();
}
void FWWindow::openEditorPanel()
@ -146,7 +146,7 @@ void FWWindow::openEditor(FWObject *obj)
current_focus_widget &&
m_mainWindow->editorDockWidget->isAncestorOf(current_focus_widget));
QLineEdit *line_edit = dynamic_cast<QLineEdit*>(current_focus_widget);
bool restore_line_edit_selection = line_edit != NULL && line_edit->hasSelectedText();
bool restore_line_edit_selection = line_edit != nullptr && line_edit->hasSelectedText();
if (fwbdebug)
{
@ -184,13 +184,13 @@ void FWWindow::openEditor(FWObject *obj)
qDebug() << "parent firewall:" << parent_fw
<< QString((parent_fw)? parent_fw->getName().c_str() : "");
if (parent_fw != NULL) // this includes Cluster
if (parent_fw != nullptr) // this includes Cluster
{
RuleSetView* rsv = activeProject()->getCurrentRuleSetView();
if (rsv)
{
RuleSet* current_ruleset = NULL;
RuleSetModel* md = NULL;
RuleSet* current_ruleset = nullptr;
RuleSetModel* md = nullptr;
if (rsv)
{
md = (RuleSetModel*)rsv->model();
@ -202,10 +202,10 @@ void FWWindow::openEditor(FWObject *obj)
activeProject()->m_panel->om->findRuleSetInHistoryByParentFw(
parent_fw);
if (old_rs == NULL)
if (old_rs == nullptr)
old_rs = parent_fw->getFirstByType(Policy::TYPENAME);
if (old_rs != NULL)
if (old_rs != nullptr)
QCoreApplication::postEvent(
activeProject(), new openRulesetImmediatelyEvent(
activeProject()->getFileName(), old_rs->getId()));
@ -273,8 +273,8 @@ void FWWindow::buildEditorTitleAndIcon(libfwbuilder::FWObject *obj,
QStringList editor_title;
FWObject *o = obj;
Rule *rule = NULL;
FWObject *ruleset = NULL;
Rule *rule = nullptr;
FWObject *ruleset = nullptr;
while (o)
{
if (Rule::cast(o))

View File

@ -417,7 +417,7 @@ QString FWWindow::getCurrentFileName()
RCS * FWWindow::getRCS()
{
if (activeProject()) return activeProject()->getRCS();
return 0;
return nullptr;
}
/*
@ -433,14 +433,14 @@ FWObject* FWWindow::getCurrentLib()
{
if (activeProject())
return activeProject()->getCurrentLib();
return 0;
return nullptr;
}
FWObject* FWWindow::createObject(const QString &objType,
const QString &objName,
FWObject *copyFrom)
{
FWObject *res = NULL;
FWObject *res = nullptr;
if (activeProject())
{
res = activeProject()->createObject(objType, objName, copyFrom);
@ -453,7 +453,7 @@ FWObject* FWWindow::createObject(FWObject *parent,
const QString &objName,
FWObject *copyFrom)
{
FWObject *res = NULL;
FWObject *res = nullptr;
if (activeProject())
{
res = activeProject()->createObject(parent, objType,
@ -481,7 +481,7 @@ void FWWindow::moveObject(const QString &targetLibName, FWObject *obj)
ObjectTreeView* FWWindow::getCurrentObjectTree()
{
if (activeProject()) return activeProject()->getCurrentObjectTree();
return 0;
return nullptr;
}
void FWWindow::findAllFirewalls (std::list<Firewall *> &fws)
@ -508,7 +508,7 @@ void FWWindow::unselect()
FWObjectDatabase* FWWindow::db()
{
if (activeProject()) return activeProject()->db();
return NULL;
return nullptr;
}
QString FWWindow::printHeader()

View File

@ -140,7 +140,7 @@ void FindObjectWidget::disableAll()
void FindObjectWidget::objectInserted()
{
FWObject *o = m_widget->findDropArea->getObject();
if (o == NULL) return;
if (o == nullptr) return;
// disableAll(); // see #1757
@ -160,7 +160,7 @@ void FindObjectWidget::objectInserted()
void FindObjectWidget::reset()
{
lastFound = NULL;
lastFound = nullptr;
lastAttrSearch = "";
found_objects.clear();
}
@ -169,7 +169,7 @@ void FindObjectWidget::clear()
{
m_widget->findDropArea->deleteObject();
m_widget->replaceDropArea->deleteObject();
lastFound = NULL;
lastFound = nullptr;
lastAttrSearch = "";
found_objects.clear();
}
@ -283,7 +283,7 @@ bool FindObjectWidget::matchAttr(FWObject *obj)
}
Address *a = Address::cast(obj);
if (a!=NULL)
if (a!=nullptr)
{
const InetAddr *inet_addr = a->getAddressPtr();
if (inet_addr)
@ -301,7 +301,7 @@ bool FindObjectWidget::matchAttr(FWObject *obj)
}
case 2: // port
if (TCPService::cast(obj)!=NULL || UDPService::cast(obj)!=NULL)
if (TCPService::cast(obj)!=nullptr || UDPService::cast(obj)!=nullptr)
{
if (m_widget->useRegexp->isChecked())
{
@ -332,7 +332,7 @@ bool FindObjectWidget::matchAttr(FWObject *obj)
break;
case 3: // protocol num.
if (IPService::cast(obj)!=NULL)
if (IPService::cast(obj)!=nullptr)
{
if (m_widget->useRegexp->isChecked())
{
@ -350,7 +350,7 @@ bool FindObjectWidget::matchAttr(FWObject *obj)
break;
case 4: // icmp type
if (ICMPService::cast(obj)!=NULL)
if (ICMPService::cast(obj)!=nullptr)
{
if (m_widget->useRegexp->isChecked())
{
@ -381,7 +381,7 @@ void FindObjectWidget::_findAll()
{
FWObject *o = *treeSeeker;
if( RuleElement::cast(o->getParent())!=NULL)
if( RuleElement::cast(o->getParent())!=nullptr)
{
if (m_widget->srScope->currentIndex()==3) // scope == selected firewalls
{
@ -398,7 +398,7 @@ void FindObjectWidget::_findAll()
}
FWObject *obj = o;
if (FWReference::cast(o)!=NULL)
if (FWReference::cast(o)!=nullptr)
{
FWReference *r = FWReference::cast(o);
obj = r->getPointer();
@ -435,7 +435,7 @@ void FindObjectWidget::findNext()
if (m_widget->findAttr->count()>MAX_SEARCH_ITEMS_COUNT)
m_widget->findAttr->removeItem(0);
FWObject *o = NULL;
FWObject *o = nullptr;
// if scope is "policies of opened firewall" then we need to get
// pointer to the currently opened firewall object
@ -443,7 +443,7 @@ void FindObjectWidget::findNext()
if (current_rule_set)
selectedFirewall = Firewall::cast(current_rule_set->getParent());
else
selectedFirewall = NULL;
selectedFirewall = nullptr;
if (fwbdebug) qDebug() << "selectedFirewall: " << selectedFirewall;
@ -485,7 +485,7 @@ loop:
o = *found_objects_iter;
++found_objects_iter;
assert(o!=NULL);
assert(o!=nullptr);
lastFound = o;
if (fwbdebug)
@ -526,19 +526,19 @@ bool FindObjectWidget::validateReplaceObject()
}
bool obj_1_address =
Address::cast(findObj)!=NULL ||
MultiAddress::cast(findObj)!=NULL ||
ObjectGroup::cast(findObj)!=NULL;
Address::cast(findObj)!=nullptr ||
MultiAddress::cast(findObj)!=nullptr ||
ObjectGroup::cast(findObj)!=nullptr;
bool obj_2_address =
Address::cast(replObj)!=NULL ||
MultiAddress::cast(replObj)!=NULL ||
ObjectGroup::cast(replObj)!=NULL;
Address::cast(replObj)!=nullptr ||
MultiAddress::cast(replObj)!=nullptr ||
ObjectGroup::cast(replObj)!=nullptr;
bool obj_1_service =
Service::cast(findObj)!=NULL || ServiceGroup::cast(findObj);
Service::cast(findObj)!=nullptr || ServiceGroup::cast(findObj);
bool obj_2_service =
Service::cast(replObj)!=NULL || ServiceGroup::cast(replObj);
Service::cast(replObj)!=nullptr || ServiceGroup::cast(replObj);
if ((obj_1_address && obj_2_address) || (obj_1_service && obj_2_service))
return true;
@ -554,7 +554,7 @@ void FindObjectWidget::replace()
{
if (!validateReplaceObject()) return;
if (lastFound==NULL)
if (lastFound==nullptr)
{
find();
return;
@ -587,9 +587,9 @@ void FindObjectWidget::replaceAll()
if (current_rule_set)
selectedFirewall = Firewall::cast(current_rule_set->getParent());
else
selectedFirewall = NULL;
selectedFirewall = nullptr;
if (selectedFirewall == NULL)
if (selectedFirewall == nullptr)
{
QMessageBox::critical(this,
"Firewall Builder",
@ -633,8 +633,8 @@ void FindObjectWidget::_replaceCurrent()
FWObject *o = lastFound;
FWObject *p = lastFound->getParent();
if (p==NULL || o==NULL) return;
if (FWReference::cast(o)==NULL) return;
if (p==nullptr || o==nullptr) return;
if (FWReference::cast(o)==nullptr) return;
if (p->isReadOnly())
{
@ -679,7 +679,7 @@ void FindObjectWidget::_replaceCurrent()
// check for duplicates --------
if (RuleElement::cast(new_state)==NULL ||
if (RuleElement::cast(new_state)==nullptr ||
!RuleElement::cast(new_state)->isAny())
{
// avoid duplicates
@ -692,7 +692,7 @@ void FindObjectWidget::_replaceCurrent()
{
oo = *j;
if (cp_id==oo->getId() ||
((ref=FWReference::cast(oo))!=NULL &&
((ref=FWReference::cast(oo))!=nullptr &&
cp_id==ref->getPointerId()))
{
// replacement object is already a member of this
@ -718,8 +718,8 @@ void FindObjectWidget::_replaceCurrent()
bool FindObjectWidget::inSelectedFirewall( RuleElement* r)
{
FWObject *f=r;
while (f!=NULL && Firewall::cast(f)==NULL) f=f->getParent();
if (f==NULL) return false;
while (f!=nullptr && Firewall::cast(f)==nullptr) f=f->getParent();
if (f==nullptr) return false;
return selectedFirewall==(Firewall::cast(f));
}
@ -750,7 +750,7 @@ void FindObjectWidget::showObject(FWObject* o)
o->getName().c_str(), o->getParent()->getName().c_str());
FWReference* ref = FWReference::cast(o);
if (ref!=NULL && RuleElement::cast(o->getParent())!=NULL)
if (ref!=nullptr && RuleElement::cast(o->getParent())!=nullptr)
{
// found object in rules
QCoreApplication::sendEvent(
@ -760,7 +760,7 @@ void FindObjectWidget::showObject(FWObject* o)
}
if (!FWBTree().isStandardFolder(o) &&
Group::cast(o->getParent())!=NULL &&
Group::cast(o->getParent())!=nullptr &&
!FWBTree().isStandardFolder(o->getParent()))
{
QCoreApplication::sendEvent(
@ -781,7 +781,7 @@ void FindObjectWidget::init()
void FindObjectWidget::firewallOpened(Firewall *f)
{
if (f==NULL) return;
if (f==nullptr) return;
selectedFirewall = f;
m_widget->srScope->setItemText(
3, tr("Policy of firewall '")+f->getName().c_str()+"'" );

View File

@ -123,7 +123,7 @@ void FindWhereUsedWidget::itemActivated(QTreeWidgetItem* item, int)
{
FWObject *container = (FWObject*)(item->data(1, Qt::UserRole).value<void*>());
if (flShowObject && container!=NULL)
if (flShowObject && container!=nullptr)
{
showObject(container);
}
@ -140,7 +140,7 @@ void FindWhereUsedWidget::itemActivated(QTreeWidgetItem* item, int)
void FindWhereUsedWidget::itemClicked(QTreeWidgetItem* item, int)
{
FWObject *container = (FWObject*)(item->data(1, Qt::UserRole).value<void*>());
if (flShowObject && container!=NULL)
if (flShowObject && container!=nullptr)
{
showObject(container);
}
@ -171,7 +171,7 @@ void FindWhereUsedWidget::_find(FWObject *obj)
<< " project_panel "
<< project_panel;
if (project_panel==NULL) return;
if (project_panel==nullptr) return;
FWObjectDatabase *db = obj->getRoot();
map<int, set<FWObject*> > reference_holders;
@ -190,7 +190,7 @@ void FindWhereUsedWidget::_find(FWObject *obj)
foreach(FWObject *container, it->second)
{
QTreeWidgetItem *item = createQTWidgetItem(c_obj, container);
if (item==NULL) continue;
if (item==nullptr) continue;
QStringList item_str;
item_str << item->text(0) << item->text(1) << item->text(2);
widget_items[item_str.join("/")] = item;
@ -214,7 +214,7 @@ void FindWhereUsedWidget::_find(FWObject *obj)
void FindWhereUsedWidget::init()
{
object = NULL;
object = nullptr;
m_widget->resListView->clear();
resset.clear();
}
@ -234,9 +234,9 @@ void FindWhereUsedWidget::showObject(FWObject* o)
if (fwbdebug) qDebug("FindWhereUsedWidget::showObject o=%s (%s)",
o->getName().c_str(), o->getTypeName().c_str());
if (object==NULL || o==NULL) return;
if (object==nullptr || o==nullptr) return;
if (RuleElement::cast(o)!=NULL || RuleElement::cast(o->getParent())!=NULL)
if (RuleElement::cast(o)!=nullptr || RuleElement::cast(o->getParent())!=nullptr)
{
QCoreApplication::postEvent(
project_panel,
@ -244,7 +244,7 @@ void FindWhereUsedWidget::showObject(FWObject* o)
return;
}
if (Rule::cast(o)!=NULL)
if (Rule::cast(o)!=nullptr)
{
QCoreApplication::postEvent(
project_panel,
@ -259,7 +259,7 @@ void FindWhereUsedWidget::showObject(FWObject* o)
project_panel->unselectRules();
if (Group::cast(o)!=NULL)
if (Group::cast(o)!=nullptr)
{
QCoreApplication::postEvent(
project_panel,
@ -283,26 +283,26 @@ QTreeWidgetItem* FindWhereUsedWidget::createQTWidgetItem(FWObject *o,
<< "(" << container->getTypeName().c_str() << ")";
QString c1, c2;
FWObject *fw = NULL;
Rule *r = NULL;
RuleSet *rs = NULL;
FWObject *fw = nullptr;
Rule *r = nullptr;
RuleSet *rs = nullptr;
QPixmap object_icon;
QPixmap parent_icon;
FWBTree tree_format;
if (tree_format.isSystem(container) || Library::cast(container)) return NULL;
if (tree_format.isSystem(container) || Library::cast(container)) return nullptr;
// container can be a Rule if user searched for an object used in action
if (RuleElement::cast(container)!=NULL || Rule::cast(container)!=NULL)
if (RuleElement::cast(container)!=nullptr || Rule::cast(container)!=nullptr)
{
fw = container;
while (fw!=NULL && Firewall::cast(fw)==NULL) // Firewall::cast matches also Cluster
while (fw!=nullptr && Firewall::cast(fw)==nullptr) // Firewall::cast matches also Cluster
{
if (Rule::cast(fw)) r = Rule::cast(fw);
if (RuleSet::cast(fw)) rs = RuleSet::cast(fw);
fw = fw->getParent();
}
if (fw==NULL || r==NULL || rs==NULL) return NULL;
if (fw==nullptr || r==nullptr || rs==nullptr) return nullptr;
c1 = QString::fromUtf8(fw->getName().c_str());
QString ruleset_kind;
@ -323,12 +323,12 @@ QTreeWidgetItem* FindWhereUsedWidget::createQTWidgetItem(FWObject *o,
QString rule_element_name;
if (RuleElement::cast(container)!=NULL)
if (RuleElement::cast(container)!=nullptr)
rule_element_name =
getReadableRuleElementName(
fw->getStr("platform"), container->getParent()->getTypeName());
if (Rule::cast(container)!=NULL)
if (Rule::cast(container)!=nullptr)
rule_element_name = "Action";
c2 += tr("%1 \"%2\" / Rule %3 / %4").

View File

@ -78,7 +78,7 @@ FirewallDialog::FirewallDialog(QWidget *parent) :
{
m_dialog = new Ui::FirewallDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -89,7 +89,7 @@ void FirewallDialog::loadFWObject(FWObject *o)
{
obj = o;
Firewall *s = dynamic_cast<Firewall*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init = true;
@ -106,7 +106,7 @@ void FirewallDialog::loadFWObject(FWObject *o)
updateTimeStamps();
Management *mgmt=s->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
// FWOptions *opt =s->getOptionsObject();
@ -239,7 +239,7 @@ void FirewallDialog::validate(bool *res)
if (m_dialog->obj_name->text().contains("/"))
{
*res = false;
if (QApplication::focusWidget() != NULL)
if (QApplication::focusWidget() != nullptr)
{
blockSignals(true);
QMessageBox::critical(
@ -309,7 +309,7 @@ void FirewallDialog::applyChanges()
Firewall *s = dynamic_cast<Firewall*>(new_state);
Management *mgmt = s->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
string old_name = obj->getName();
string new_name = string(m_dialog->obj_name->text().toUtf8().constData());
@ -363,7 +363,7 @@ void FirewallDialog::applyChanges()
QMessageBox::critical(
this, "Firewall Builder",
tr("Platform setting can not be empty"),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
return;
}
@ -373,7 +373,7 @@ void FirewallDialog::applyChanges()
QMessageBox::critical(
this, "Firewall Builder",
tr("Host OS setting can not be empty"),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
return;
}
@ -401,9 +401,9 @@ void FirewallDialog::openFWDialog()
try
{
QWidget *w = DialogFactory::createFWDialog(mw, obj);
if (w==NULL) return; // some dialogs may not be implemented yet
if (w==nullptr) return; // some dialogs may not be implemented yet
QDialog *d=dynamic_cast<QDialog*>(w);
assert(d!=NULL);
assert(d!=nullptr);
d->setWindowModality(Qt::WindowModal);
// d->open();
d->exec();
@ -426,9 +426,9 @@ void FirewallDialog::openOSDialog()
try
{
QWidget *w = DialogFactory::createOSDialog(mw, obj);
if (w==NULL) return; // some dialogs may not be implemented yet
if (w==nullptr) return; // some dialogs may not be implemented yet
QDialog *d=dynamic_cast<QDialog*>(w);
assert(d!=NULL);
assert(d!=nullptr);
d->exec();
delete d;
}

View File

@ -850,7 +850,7 @@ QString FirewallInstaller::getGeneratedFileName(Firewall *fw)
void FirewallInstaller::terminate()
{
if (session != NULL)
if (session != nullptr)
{
session->terminate();
}

View File

@ -71,7 +71,7 @@ bool FirewallInstallerCisco::packInstallJobsList(Firewall*)
job_list.clear();
Management *mgmt = cnf->fwobj->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
if (pis->getCommand()!="")
{
@ -163,7 +163,7 @@ void FirewallInstallerCisco::activatePolicy(const QString&, const QString&)
packSSHArgs(args);
if (cnf->verbose) inst_dlg->displayCommand(args);
SSHCisco *ssh_object = NULL;
SSHCisco *ssh_object = nullptr;
if (cnf->fwobj->getStr("platform")=="pix" ||
cnf->fwobj->getStr("platform")=="fwsm")
{

View File

@ -69,7 +69,7 @@ bool FirewallInstallerJuniper::packInstallJobsList(Firewall*)
job_list.clear();
Management *mgmt = cnf->fwobj->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
if (pis->getCommand()!="")
{

View File

@ -67,7 +67,7 @@ bool FirewallInstallerProcurve::packInstallJobsList(Firewall*)
job_list.clear();
Management *mgmt = cnf->fwobj->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
if (pis->getCommand()!="")
{
@ -146,7 +146,7 @@ void FirewallInstallerProcurve::activatePolicy(const QString&, const QString&)
packSSHArgs(args);
if (cnf->verbose) inst_dlg->displayCommand(args);
SSHProcurve *ssh_object = NULL;
SSHProcurve *ssh_object = nullptr;
ssh_object = new SSHProcurve(inst_dlg,
cnf->fwobj->getName().c_str(),
args,

View File

@ -76,7 +76,7 @@ bool FirewallInstallerUnx::packInstallJobsList(Firewall* fw)
inst_dlg->addToLog(QString("Installation plan:\n"));
Management *mgmt = cnf->fwobj->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
if (pis->getCommand()!="")
{

View File

@ -177,9 +177,9 @@ GroupObjectDialog::GroupObjectDialog(QWidget *parent) :
m_dialog = new Ui::GroupObjectDialog_q;
m_dialog->setupUi(this);
obj = NULL;
selectedObject = NULL;
new_object_menu = NULL;
obj = nullptr;
selectedObject = nullptr;
new_object_menu = nullptr;
listView = new ObjectListView( m_dialog->objectViewsStack, "listView" );
QStringList sl;
@ -307,9 +307,9 @@ void GroupObjectDialog::listViewSelectionChanged()
void GroupObjectDialog::iconViewCurrentChanged(QListWidgetItem *itm)
{
if (itm==NULL)
if (itm==nullptr)
{
selectedObject=NULL;
selectedObject=nullptr;
return;
}
int obj_id = itm->data(Qt::UserRole).toInt();
@ -320,9 +320,9 @@ void GroupObjectDialog::iconViewCurrentChanged(QListWidgetItem *itm)
void GroupObjectDialog::listViewCurrentChanged(QTreeWidgetItem *itm)
{
if (itm==NULL)
if (itm==nullptr)
{
selectedObject=NULL;
selectedObject=nullptr;
return;
}
int obj_id = itm->data(0, Qt::UserRole).toInt();
@ -335,9 +335,9 @@ void GroupObjectDialog::listViewCurrentChanged(QTreeWidgetItem *itm)
*/
void GroupObjectDialog::insertObject(FWObject *o)
{
assert(o!=NULL);
assert(o!=nullptr);
Group *g = dynamic_cast<Group*>(obj);
assert(g!=NULL);
assert(g!=nullptr);
if ( ! g->validateChild(o) || g->isReadOnly() ) return;
// see #1976 do not allow pasting object that has been deleted
@ -368,7 +368,7 @@ void GroupObjectDialog::addIcon(FWObject *fwo)
{
FWObject *o=fwo;
bool ref=false;
if (FWReference::cast(o)!=NULL)
if (FWReference::cast(o)!=nullptr)
{
o=FWReference::cast(o)->getPointer();
ref=true;
@ -412,7 +412,7 @@ void GroupObjectDialog::loadFWObject(FWObject *o)
{
obj = o;
Group *g = Group::cast(obj);
assert(g!=NULL);
assert(g!=nullptr);
init=true;
@ -472,7 +472,7 @@ void GroupObjectDialog::loadFWObject(FWObject *o)
if (new_object_menu)
{
new_object_menu->clear();
m_dialog->newButton->setMenu(NULL);
m_dialog->newButton->setMenu(nullptr);
delete new_object_menu;
}
@ -540,7 +540,7 @@ void GroupObjectDialog::applyChanges()
for (FWObject::iterator j=obj->begin(); j!=obj->end(); ++j)
{
FWObject *o = *j;
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
oldobj.insert(o->getId());
}
@ -622,7 +622,7 @@ void GroupObjectDialog::switchToListView()
// This method is attached to the context menu item "Edit"
void GroupObjectDialog::openObject()
{
if (selectedObject!=NULL)
if (selectedObject!=nullptr)
{
QCoreApplication::postEvent(
m_project, new showObjectInTreeEvent(selectedObject->getRoot()->getFileName().c_str(),
@ -657,7 +657,7 @@ void GroupObjectDialog::dropped(QDropEvent *ev)
void GroupObjectDialog::iconContextMenu(const QPoint & pos)
{
FWObject *o = NULL;
FWObject *o = nullptr;
QListWidgetItem *itm = iconView->itemAt(pos);
if (itm)
{
@ -671,7 +671,7 @@ void GroupObjectDialog::iconContextMenu(const QPoint & pos)
void GroupObjectDialog::listContextMenu(const QPoint & pos)
{
FWObject *o=NULL;
FWObject *o=nullptr;
QTreeWidgetItem *itm = listView->itemAt(pos);
if (itm)
{
@ -686,7 +686,7 @@ void GroupObjectDialog::setupPopupMenu(const QPoint &pos)
{
QMenu *popup = new QMenu(this);
if (selectedObject!=NULL)
if (selectedObject!=nullptr)
{
if (selectedObject->isReadOnly() )
popup->addAction(tr("Open"), this, SLOT(openObject()));
@ -699,9 +699,9 @@ void GroupObjectDialog::setupPopupMenu(const QPoint &pos)
QAction *pasteID = popup->addAction(tr("Paste"), this, SLOT(pasteObj()));
QAction *delID = popup->addAction(tr("Delete"),this, SLOT(deleteObj()));
copyID->setEnabled(selectedObject!=NULL &&
copyID->setEnabled(selectedObject!=nullptr &&
! FWBTree().isSystem(selectedObject) );
cutID->setEnabled(selectedObject!=NULL &&
cutID->setEnabled(selectedObject!=nullptr &&
! FWBTree().isSystem(obj) &&
! obj->isReadOnly() );
@ -714,7 +714,7 @@ void GroupObjectDialog::setupPopupMenu(const QPoint &pos)
pasteID->setEnabled(! FWBTree().isSystem(obj) &&
! obj->isReadOnly() && ! obj_deleted);
delID->setEnabled(selectedObject!=NULL &&
delID->setEnabled(selectedObject!=nullptr &&
! FWBTree().isSystem(obj) &&
! obj->isReadOnly() );
@ -729,7 +729,7 @@ void GroupObjectDialog::copyObj()
{
FWObject* selectedObject = m_project->db()->findInIndex(*it);
if (selectedObject!=NULL && ! FWBTree().isSystem(selectedObject) )
if (selectedObject!=nullptr && ! FWBTree().isSystem(selectedObject) )
{
FWObjectClipboard::obj_clipboard->add(selectedObject,
this->m_project );

View File

@ -57,7 +57,7 @@ ICMPServiceDialog::ICMPServiceDialog(QWidget *parent) :
{
m_dialog = new Ui::ICMPServiceDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -71,7 +71,7 @@ void ICMPServiceDialog::loadFWObject(FWObject *o)
{
obj=o;
ICMPService *s = dynamic_cast<ICMPService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
// if (ICMP6Service::isA(o))
// {

View File

@ -56,7 +56,7 @@ IPServiceDialog::IPServiceDialog(QWidget *parent) : BaseObjectDialog(parent)
{
m_dialog = new Ui::IPServiceDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -84,7 +84,7 @@ void IPServiceDialog::loadFWObject(FWObject *o)
{
obj=o;
IPService *s = dynamic_cast<IPService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init = true;

View File

@ -81,7 +81,7 @@ InterfaceDialog::InterfaceDialog(QWidget *parent) :
seclevel->hide(); seclevelLabel->hide();
netzone->hide(); netzoneLabel->hide();
*/
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -96,7 +96,7 @@ void InterfaceDialog::loadFWObject(FWObject *o)
{
obj=o;
Interface *s = dynamic_cast<Interface*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init = true;
@ -345,7 +345,7 @@ void InterfaceDialog::validate(bool *res)
Interface::cast(obj), obj_name, err))
{
*res = false;
if (QApplication::focusWidget() != NULL)
if (QApplication::focusWidget() != nullptr)
{
blockSignals(true);
QMessageBox::critical(
@ -379,7 +379,7 @@ void InterfaceDialog::validate(bool *res)
*/
*res = false;
// show warning dialog only if app has focus
if (QApplication::focusWidget() != NULL)
if (QApplication::focusWidget() != nullptr)
{
blockSignals(true);
QMessageBox::critical(
@ -435,7 +435,7 @@ void InterfaceDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
Interface *intf = Interface::cast(new_state);
assert(intf!=NULL);
assert(intf!=nullptr);
string oldname = obj->getName();
string oldlabel = intf->getLabel();
@ -526,9 +526,9 @@ void InterfaceDialog::openIfaceDialog()
try
{
QWidget *w = DialogFactory::createIfaceDialog(this, obj);
if (w==NULL) return; // some dialogs may not be implemented yet
if (w==nullptr) return; // some dialogs may not be implemented yet
QDialog *d=dynamic_cast<QDialog*>(w);
assert(d!=NULL);
assert(d!=nullptr);
d->exec();
delete w;
}

View File

@ -43,7 +43,7 @@ InterfaceEditorWidget::InterfaceEditorWidget(QWidget *parent) :
m_ui(new Ui::InterfaceEditorWidget)
{
tabw = dynamic_cast<QTabWidget*>(parent);
this->interfacep = NULL;
this->interfacep = nullptr;
m_ui->setupUi(this);
setClusterMode(false);
this->m_ui->name->setText(""); // blank interface name
@ -101,7 +101,7 @@ InterfaceEditorWidget::InterfaceEditorWidget(QWidget *parent,
clusterMode = true;
tabw = dynamic_cast<QTabWidget*>(parent);
m_ui->setupUi(this);
this->interfacep = NULL;
this->interfacep = nullptr;
this->m_ui->name->setText(data.name);
this->m_ui->label->setText(data.label);

View File

@ -72,11 +72,11 @@ QMap<Interface*, EditedInterfaceData> InterfacesTabWidget::getData()
{
InterfaceEditorWidget *w = dynamic_cast<InterfaceEditorWidget*>(
this->widget(i));
if (w == NULL || w->getInterface() == NULL)
if (w == nullptr || w->getInterface() == nullptr)
continue;
InterfaceEditorWidget *intEditor = dynamic_cast<InterfaceEditorWidget*>(
this->widget(i));
if (intEditor != NULL)
if (intEditor != nullptr)
res[intEditor->getInterface()] = intEditor->getInterfaceData();
}
return res;
@ -89,7 +89,7 @@ QList<EditedInterfaceData> InterfacesTabWidget::getNewData()
{
InterfaceEditorWidget *w = dynamic_cast<InterfaceEditorWidget*>(
this->widget(i));
if ( w != NULL && w->getInterface() == NULL)
if ( w != nullptr && w->getInterface() == nullptr)
res.append(w->getInterfaceData());
}
return res;
@ -145,7 +145,7 @@ void InterfacesTabWidget::closeTab()
int idx = this->currentIndex();
QWidget *w = this->widget(idx);
Interface *iface = dynamic_cast<InterfaceEditorWidget*>(w)->getInterface() ;
if ( iface != NULL ) deleted.append( iface );
if ( iface != nullptr ) deleted.append( iface );
this->removeTab(idx);
delete w;
if (this->count() == 0)
@ -169,7 +169,7 @@ bool InterfacesTabWidget::isValid()
{
InterfaceEditorWidget* w = dynamic_cast<InterfaceEditorWidget*>(
this->widget(i));
if (w == NULL) continue;
if (w == nullptr) continue;
if (!w->isValid())
{
this->setCurrentWidget(w);
@ -195,8 +195,8 @@ void InterfacesTabWidget::addInterfaceFromData(InterfaceData* idata)
void InterfacesTabWidget::addTab(QWidget* widget, const QString& title)
{
if ( dynamic_cast<InterfaceEditorWidget*>(widget) != NULL ||
(noTabs && dynamic_cast<QLabel*>(widget) != NULL))
if ( dynamic_cast<InterfaceEditorWidget*>(widget) != nullptr ||
(noTabs && dynamic_cast<QLabel*>(widget) != nullptr))
{
widget->setObjectName(title+"_widget");
if (!noTabs)
@ -212,7 +212,7 @@ void InterfacesTabWidget::setClusterMode(bool st)
{
InterfaceEditorWidget *w = dynamic_cast<InterfaceEditorWidget*>(
this->widget(i));
if (w!=NULL) w->setClusterMode(st);
if (w!=nullptr) w->setClusterMode(st);
}
newInterface.setVisible(!st);
delInterface.setVisible(!st);
@ -232,7 +232,7 @@ void InterfacesTabWidget::setExplanation(const QString& text)
{
InterfaceEditorWidget* w = dynamic_cast<InterfaceEditorWidget*>(
this->widget(i));
if (w!=NULL) w->setExplanation(text);
if (w!=nullptr) w->setExplanation(text);
}
}
@ -243,6 +243,6 @@ void InterfacesTabWidget::setHostOS(const QString &s)
{
InterfaceEditorWidget *w = dynamic_cast<InterfaceEditorWidget*>(
this->widget(i));
if (w != NULL) w->setHostOS(host_OS);
if (w != nullptr) w->setHostOS(host_OS);
}
}

View File

@ -80,12 +80,12 @@ void MetricEditorPanel::applyChanges()
void MetricEditorPanel::loadFWObject(libfwbuilder::FWObject *obj)
{
RoutingRule *r=RoutingRule::cast(obj);
if (r==NULL) return;
if (r==nullptr) return;
rule=r;
FWObject *o = r;
while (o!=NULL && Firewall::cast(o)==NULL) o=o->getParent();
assert(o!=NULL);
while (o!=nullptr && Firewall::cast(o)==nullptr) o=o->getParent();
assert(o!=nullptr);
m_widget->spin_box->setMinimum( 0);
m_widget->spin_box->setMaximum( 255);

View File

@ -59,7 +59,7 @@ NetworkDialogIPv6::NetworkDialogIPv6(QWidget *parent) : BaseObjectDialog(parent)
{
m_dialog = new Ui::NetworkDialogIPv6_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -70,7 +70,7 @@ void NetworkDialogIPv6::loadFWObject(FWObject *o)
{
obj=o;
NetworkIPv6 *s = dynamic_cast<NetworkIPv6*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;
@ -111,20 +111,20 @@ void NetworkDialogIPv6::validate(bool *res)
}
NetworkIPv6 *s = dynamic_cast<NetworkIPv6*>(obj);
assert(s != NULL);
assert(s != nullptr);
try
{
InetAddr(AF_INET6, m_dialog->address->text().toStdString() );
} catch (FWException &ex)
{
*res = false;
if (QApplication::focusWidget() != NULL)
if (QApplication::focusWidget() != nullptr)
{
blockSignals(true);
QMessageBox::critical(this, "Firewall Builder",
tr("Illegal IPv6 address '%1'").arg(
m_dialog->address->text()),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
blockSignals(false);
}
@ -140,13 +140,13 @@ void NetworkDialogIPv6::validate(bool *res)
else
{
*res = false;
if (QApplication::focusWidget() != NULL)
if (QApplication::focusWidget() != nullptr)
{
blockSignals(true);
QMessageBox::critical(this, "Firewall Builder",
tr("Illegal netmask '%1'").arg(
m_dialog->netmask->text() ),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
blockSignals(false);
}
@ -161,7 +161,7 @@ void NetworkDialogIPv6::applyChanges()
FWObject* new_state = cmd->getNewState();
NetworkIPv6 *s = dynamic_cast<NetworkIPv6*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname=obj->getName();
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );

View File

@ -143,7 +143,7 @@ int ObjConflictResolutionDialog::run(FWObject *o1, FWObject *o2)
FWObject *delObjLib2 = o2->getRoot()->getById(
FWObjectDatabase::DELETED_OBJECTS_ID );
if (delObjLib1!=NULL && o1->isChildOf(delObjLib1))
if (delObjLib1!=nullptr && o1->isChildOf(delObjLib1))
{
/* This is the case when an object present in the file we are
* trying to load has been deleted in the tree. We can not
@ -162,7 +162,7 @@ int ObjConflictResolutionDialog::run(FWObject *o1, FWObject *o2)
false,
false);
if (delObjLib2!=NULL && o2->isChildOf(delObjLib2))
if (delObjLib2!=nullptr && o2->isChildOf(delObjLib2))
{
/* This is the case where object o2 has been deleted in the
* file we are trying to load but is present in the tree. One

View File

@ -36,7 +36,7 @@ ObjectEditorDockWidget::ObjectEditorDockWidget(const QString &title,
Qt::WindowFlags flags) :
QDockWidget(title, parent, flags)
{
editor = NULL;
editor = nullptr;
connect(this, SIGNAL(topLevelChanged(bool)),
this, SLOT(topLevelChanged(bool)));
}
@ -45,7 +45,7 @@ ObjectEditorDockWidget::ObjectEditorDockWidget(QWidget *parent,
Qt::WindowFlags flags) :
QDockWidget(parent, flags)
{
editor = NULL;
editor = nullptr;
connect(this, SIGNAL(topLevelChanged(bool)),
this, SLOT(topLevelChanged(bool)));
}

View File

@ -57,7 +57,7 @@ using namespace libfwbuilder;
ObjectIconView::ObjectIconView(QWidget* parent, const char*, Qt::WindowFlags) :
QListWidget(parent)
{
db = NULL;
db = nullptr;
//setWindowFlags(f);
@ -82,16 +82,16 @@ bool ObjectIconView::event(QEvent *event)
//viewportToContents(pos.x(),pos.y(),cx,cy);
FWObject *obj = NULL;
FWObject *obj = nullptr;
QRect cr;
QListWidgetItem *itm = itemAt( QPoint(cx,cy) );
QModelIndex ind = indexAt( QPoint(cx,cy) );
if (itm==NULL) return false;
if (itm==nullptr) return false;
int obj_id = itm->data(Qt::UserRole).toInt();
obj = db->findInIndex(obj_id);
if (obj==NULL) return false;
if (obj==nullptr) return false;
cr = rectForIndex(ind);
cr = QRect(
@ -119,7 +119,7 @@ QDrag* ObjectIconView::dragObject()
{
QListWidgetItem *ivi = currentItem();
// currentItem returns NULL if the list is empty
if (ivi==NULL) return NULL;
if (ivi==nullptr) return nullptr;
int obj_id = ivi->data(Qt::UserRole).toInt();
FWObject *obj = db->findInIndex(obj_id);
QString icn =
@ -170,7 +170,7 @@ void ObjectIconView::dragEnterEvent( QDragEnterEvent *ev)
for (list<FWObject*>::iterator i=dragol.begin();i!=dragol.end(); ++i)
{
FWObject *dragobj = *i;
assert(dragobj!=NULL);
assert(dragobj!=nullptr);
if (FWBTree().isSystem(dragobj))
{

View File

@ -58,7 +58,7 @@ using namespace libfwbuilder;
ObjectListView::ObjectListView(QWidget* parent, const char*, Qt::WindowFlags f) :
QTreeWidget(parent)
{
db = NULL;
db = nullptr;
setWindowFlags(f);
/*setColumnWidthMode(0, QTreeWidget::Maximum);
setColumnWidthMode(1, QTreeWidget::Maximum);
@ -86,14 +86,14 @@ bool ObjectListView::event(QEvent *event)
//viewportToContents(pos.x(),pos.y(),cx,cy);
FWObject *obj=NULL;
FWObject *obj=nullptr;
QRect cr;
QTreeWidgetItem *itm = itemAt(QPoint(cx,cy - header()->height()));
if (itm==NULL) return false;
if (itm==nullptr) return false;
int obj_id = itm->data(0, Qt::UserRole).toInt();
obj = db->findInIndex(obj_id);
if (obj==NULL) return false;
if (obj==nullptr) return false;
cr = visualItemRect(itm);
@ -122,7 +122,7 @@ QDrag* ObjectListView::dragObject()
{
QTreeWidgetItem *ovi = currentItem();
// currentItem returns NULL if the list is empty
if (ovi==NULL) return NULL;
if (ovi==nullptr) return nullptr;
int obj_id = ovi->data(0, Qt::UserRole).toInt();
FWObject *obj = db->findInIndex(obj_id);
@ -183,7 +183,7 @@ void ObjectListView::dragEnterEvent( QDragEnterEvent *ev)
for (list<FWObject*>::iterator i=dragol.begin();i!=dragol.end(); ++i)
{
FWObject *dragobj = *i;
assert(dragobj!=NULL);
assert(dragobj!=nullptr);
if (FWBTree().isSystem(dragobj))
{

View File

@ -38,7 +38,7 @@ using namespace libfwbuilder;
bool ObjectListViewItem::operator< ( const QTreeWidgetItem & other ) const
{
QTreeWidget * widget = treeWidget() ;
if (widget==NULL) return false;
if (widget==nullptr) return false;
int col = widget->sortColumn ();
if (col==1)
@ -53,7 +53,7 @@ bool ObjectListViewItem::operator< ( const QTreeWidgetItem & other ) const
ICMPService * ricmp = ICMPService::cast(right);
ICMPService * licmp = ICMPService::cast(left);
if (rtcpudp != NULL && ltcpudp != NULL)
if (rtcpudp != nullptr && ltcpudp != nullptr)
{
int ls = ltcpudp->getDstRangeStart();
int rs = rtcpudp->getDstRangeStart();
@ -73,13 +73,13 @@ bool ObjectListViewItem::operator< ( const QTreeWidgetItem & other ) const
return false ;
}
}
if (rip != NULL && lip != NULL)
if (rip != nullptr && lip != nullptr)
{
int lpn = lip->getProtocolNumber();
int rpn = rip->getProtocolNumber();
return (lpn < rpn);
}
if (ricmp != NULL && licmp != NULL)
if (ricmp != nullptr && licmp != nullptr)
{
int lpn = licmp->getInt("code");
int rpn = ricmp->getInt("code");

View File

@ -111,7 +111,7 @@ ObjectManipulator::~ObjectManipulator()
}
ObjectManipulator::ObjectManipulator(QWidget *parent):
QWidget(parent), current_tree_view(0)
QWidget(parent), current_tree_view(nullptr)
{
m_objectManipulator = new Ui::ObjectManipulator_q;
m_objectManipulator->setupUi(this);
@ -120,18 +120,18 @@ ObjectManipulator::ObjectManipulator(QWidget *parent):
libs_model = new ListOfLibrariesModel();
m_objectManipulator->libs->setModel(libs_model);
m_project = NULL;
m_project = nullptr;
treeWidth = -1;
treeHeight = -1;
active = false;
current_tree_view=NULL;
current_tree_view=nullptr;
previous_lib_index = -1;
// used in duplicateWithDependencies()
dedup_marker_global_counter = time(NULL);
dedup_marker_global_counter = time(nullptr);
popup_menu = NULL;
popup_menu = nullptr;
// buildNewObjectMenu();
@ -148,7 +148,7 @@ vector<QTreeWidget*> ObjectManipulator::getTreeWidgets()
for (int i=0; i<libs_model->rowCount(); ++i)
{
QTreeWidget *objTreeView = libs_model->getTreeWidget(i);
if (objTreeView == NULL) continue;
if (objTreeView == nullptr) continue;
res.push_back(objTreeView);
}
return res;
@ -165,7 +165,7 @@ void ObjectManipulator::showDeletedObjects(bool f)
qDebug("ObjectManipulator::showDeletedObjects f=%d dobj=%p",
f, dobj);
if (dobj==NULL)
if (dobj==nullptr)
{
dobj = m_project->db()->create(Library::TYPENAME);
dobj->setId(FWObjectDatabase::DELETED_OBJECTS_ID);
@ -193,7 +193,7 @@ void ObjectManipulator::showDeletedObjects(bool f)
if (fwbdebug)
qDebug("ObjectManipulator::showDeletedObjects otv=%p", otv);
assert(otv!=NULL);
assert(otv!=nullptr);
m_objectManipulator->widgetStack->removeWidget( otv );
removeLib(idx.row());
}
@ -212,7 +212,7 @@ QString ObjectManipulator::getStandardName(FWObject *parent,
{
QStringList names;
FWObject *po = parent;
while (po!=NULL)
while (po!=nullptr)
{
names.push_front(QString::fromUtf8(po->getName().c_str()));
if (Host::cast(po)) break;
@ -236,7 +236,7 @@ void ObjectManipulator::switchingTrees(QWidget* w)
if (!new_otv)
return;//assert(new_otv)
if (current_tree_view!=NULL) current_tree_view->becomingHidden();
if (current_tree_view!=nullptr) current_tree_view->becomingHidden();
new_otv->becomingVisible();
current_tree_view = new_otv;
}
@ -404,9 +404,9 @@ static void addKeywordsMenu(ObjectManipulator *om, QMenu *menu)
void ObjectManipulator::addSubfolderActions(QList<QAction*> &AddObjectActions, FWObject *currentObj, ObjectTreeViewItem *item, bool &addSubfolder)
{
addSubfolder = item != 0;
addSubfolder = item != nullptr;
string path;
if (currentObj == NULL) {
if (currentObj == nullptr) {
path = item->getUserFolderParent()->getPath(true);
}
else {
@ -414,7 +414,7 @@ void ObjectManipulator::addSubfolderActions(QList<QAction*> &AddObjectActions, F
}
//Do not allow to create subfolders on real objects
if(item==0 && (currentObj!=NULL
if(item==nullptr && (currentObj!=nullptr
&&!Firewall::isA(currentObj)
&&!Cluster::isA(currentObj)
&&!IPv4::isA(currentObj)
@ -555,7 +555,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
QList<QAction*>::iterator iter;
QList<QAction*> AddObjectActions;
bool addSubfolder = false;
if (popup_menu == NULL)
if (popup_menu == nullptr)
{
popup_menu = new QMenu(this);
popup_menu->setObjectName("objectTreeContextMenu");
@ -565,7 +565,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
/* in extended selection mode there may be several selected items */
ObjectTreeView *objTreeView = getCurrentObjectTree();
if (objTreeView == NULL) return;
if (objTreeView == nullptr) return;
QTreeWidgetItem *item = objTreeView->itemAt(pos);//clicked item
@ -574,13 +574,13 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
getCurrentObjectTree()->getNumSelected());
ObjectTreeViewItem *otvi=dynamic_cast<ObjectTreeViewItem*>(item);
if (otvi==NULL) return; // happens when user clicks outside an item
if (otvi==nullptr) return; // happens when user clicks outside an item
lastClickedItem = otvi;
FWObject *obj = otvi->getFWObject();
if (obj == 0) {
assert(otvi->getUserFolderParent() != 0);
if (obj == nullptr) {
assert(otvi->getUserFolderParent() != nullptr);
QAction *action =
popup_menu->addAction(tr("Delete"), this, SLOT(removeUserFolder()));
/* The user-defined folder doesn't get counted as a selected obj */
@ -588,7 +588,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
action->setEnabled(false);
}
addSubfolderActions(AddObjectActions, NULL, otvi, addSubfolder);
addSubfolderActions(AddObjectActions, nullptr, otvi, addSubfolder);
for (iter=AddObjectActions.begin(); iter!=AddObjectActions.end(); iter++)
(*iter)->setEnabled(true);
@ -626,14 +626,14 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
if (RuleSet::cast(currentObj))
popup_menu->addAction(tr("Open"), this, SLOT( openSelectedRuleSet()));
QMenu *duptargets = NULL;
QAction *dupID = NULL;
QMenu *movetargets = NULL;
QMenu *duptargets = nullptr;
QAction *dupID = nullptr;
QMenu *movetargets = nullptr;
int moveTargetsCounter = 0;
if (!Interface::isA(currentObj) &&
!physAddress::isA(currentObj) &&
RuleSet::cast(currentObj)==NULL &&
RuleSet::cast(currentObj)==nullptr &&
!Library::isA(currentObj) &&
!FWBTree().isStandardFolder(currentObj))
{
@ -662,7 +662,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
{
QModelIndex idx = libs_model->index(row, 0);
FWObject *lib = libs_model->getLibrary(idx);
if (lib == NULL) continue;
if (lib == nullptr) continue;
if ( lib->getId()==FWObjectDatabase::STANDARD_LIB_ID ||
lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ||
lib->isReadOnly())
@ -779,16 +779,16 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
* object to an interface.
*/
FWObject *att = currentObj->getFirstByType(AttachedNetworks::TYPENAME);
if (att == NULL)
if (att == nullptr)
addNewObjectMenuItem(popup_menu, AttachedNetworks::TYPENAME);
// Check if we should add menu item that creates failover
// group. if parent is a cluster, allow one vrrp type
// FailoverClusterGroup per Interface only
FWObject *parent = NULL;
FWObject *parent = nullptr;
parent = currentObj->getParent();
if (parent != NULL && Cluster::isA(parent))
if (parent != nullptr && Cluster::isA(parent))
{
QAction *failover_menu_id = addNewObjectMenuItem(
popup_menu, FailoverClusterGroup::TYPENAME);
@ -797,7 +797,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
// SLOT( newFailoverClusterGroup() ) );
failover_menu_id->setEnabled(
currentObj->getFirstByType(
FailoverClusterGroup::TYPENAME) == NULL);
FailoverClusterGroup::TYPENAME) == nullptr);
}
}
@ -816,7 +816,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
}
addSubfolderActions(AddObjectActions, currentObj, NULL, addSubfolder);
addSubfolderActions(AddObjectActions, currentObj, nullptr, addSubfolder);
if (addSubfolder) {
QAction *action =
@ -846,8 +846,8 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
addKeywordsMenu(this, popup_menu);
if (Firewall::cast(currentObj)!=NULL ||
(ObjectGroup::cast(currentObj)!=NULL &&
if (Firewall::cast(currentObj)!=nullptr ||
(ObjectGroup::cast(currentObj)!=nullptr &&
currentObj->getName()=="Firewalls"))
{
bool canCreateCluster = true;
@ -870,11 +870,11 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
popup_menu->addAction( tr("Inspect"), this, SLOT( inspect()));
}
if (Interface::cast(currentObj)!=NULL)
if (Interface::cast(currentObj)!=nullptr)
{
popup_menu->addSeparator();
FWObject *h = Host::getParentHost(currentObj);
if (h != NULL) {
if (h != nullptr) {
list<FWObject*> top_level_interfaces = h->getByType(Interface::TYPENAME);
top_level_interfaces.sort(FWObjectNameCmpPredicate());
addSubinterfaceSubmenu(popup_menu, top_level_interfaces);
@ -1006,7 +1006,7 @@ bool ObjectManipulator::getDeleteMenuState(FWObject *obj)
Firewall *fw = Firewall::cast(obj->getParent());
// fw can be NULL if this ruleset is in the Deleted objects
// library
if (fw==NULL) return del_menu_item_state;
if (fw==nullptr) return del_menu_item_state;
list<FWObject*> child_objects = fw->getByType(obj->getTypeName());
if (child_objects.size()==1) del_menu_item_state = false;
}
@ -1024,7 +1024,7 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
{
inDeletedObjects = false;
if (m_project->db() == NULL)
if (m_project->db() == nullptr)
{
dupMenuItem = false;
moveMenuItem = false;
@ -1047,13 +1047,13 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
FWObject *current_library = getCurrentLib();
if (getCurrentObjectTree()==NULL) return;
if (getCurrentObjectTree()==nullptr) return;
// delete, cut and copy menu items will be enabled only if all
// selected objects have the same parent (so user can not select
// an interface and one but not all of its addresses for deletion,
// see #1676)
FWObject *parent = NULL;
FWObject *parent = nullptr;
vector<FWObject*> so = getCurrentObjectTree()->getSelectedObjects();
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
{
@ -1061,7 +1061,7 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
QString object_path = obj->getPath(true).c_str();
if (parent == NULL) parent = obj->getParent();
if (parent == nullptr) parent = obj->getParent();
else
{
if (parent != obj->getParent())
@ -1087,7 +1087,7 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
FWObjectClipboard::obj_clipboard &&
(FWObjectClipboard::obj_clipboard->size()!=0);
delMenuItem = delMenuItem && getDeleteMenuState(obj);
delMenuItem = delMenuItem && current_library != NULL &&
delMenuItem = delMenuItem && current_library != nullptr &&
current_library->getId() != FWObjectDatabase::STANDARD_LIB_ID;
#if DISABLE_PASTE_MENU_ITEM_IF_PASTE_IS_ILLEGAL
@ -1122,7 +1122,7 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
dupMenuItem=
(dupMenuItem && ! FWBTree().isStandardFolder(obj) && ! Library::isA(obj) );
inDeletedObjects = (del_obj_library!=NULL && obj->isChildOf(del_obj_library));
inDeletedObjects = (del_obj_library!=nullptr && obj->isChildOf(del_obj_library));
dupMenuItem = dupMenuItem && !inDeletedObjects;
// can't move system objects or libraries
@ -1184,7 +1184,7 @@ void ObjectManipulator::filterFirewallsFromSelection(vector<FWObject*> &so,
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
{
cl = Cluster::cast(*i);
if (cl != NULL)
if (cl != nullptr)
{
list<Firewall*> members;
cl->getMembersList(members);
@ -1201,13 +1201,13 @@ void ObjectManipulator::filterFirewallsFromSelection(vector<FWObject*> &so,
continue;
}
fw = Firewall::cast(*i);
if (fw!=NULL)
if (fw!=nullptr)
{
fo.insert(fw);
continue;
}
gr = ObjectGroup::cast(*i);
if (gr!=NULL)
if (gr!=nullptr)
{
extractFirewallsFromGroup(gr,fo);
}
@ -1247,7 +1247,7 @@ FWObject* ObjectManipulator::prepareForInsertion(FWObject *target, FWObject *obj
"&Continue", QString::null, QString::null,
0, 1 );
return NULL;
return nullptr;
}
return ta;
}
@ -1257,16 +1257,16 @@ void ObjectManipulator::editSelectedObject()
if (fwbdebug) qDebug("ObjectManipulator::editSelectedObject");
ObjectTreeView *objTreeView = getCurrentObjectTree();
if (objTreeView == NULL) return;
if (objTreeView == nullptr) return;
if (objTreeView->getNumSelected()==0) return;
FWObject *obj = getCurrentObjectTree()->getSelectedObjects().front();
if (obj==NULL) return;
if (obj==nullptr) return;
// do not edit system folders (#1729)
if (FWBTree().isSystem(obj)) return;
if (RuleSet::cast(obj)!=NULL)
if (RuleSet::cast(obj)!=nullptr)
{
// Open rule set object in the editor if it is already opened
// in RuleSetView. If we just opened it in RuleSetView, check
@ -1300,9 +1300,9 @@ void ObjectManipulator::openSelectedRuleSet()
if (getCurrentObjectTree()->getNumSelected()==0) return;
FWObject *obj = getCurrentObjectTree()->getSelectedObjects().front();
if (obj==NULL) return;
if (obj==nullptr) return;
if (RuleSet::cast(obj)!=NULL && m_project->getCurrentRuleSet()!=obj)
if (RuleSet::cast(obj)!=nullptr && m_project->getCurrentRuleSet()!=obj)
QCoreApplication::postEvent(
m_project, new openRulesetEvent(m_project->getFileName(), obj->getId()));
}
@ -1326,7 +1326,7 @@ bool ObjectManipulator::switchObjectInEditor(FWObject *obj)
qDebug("in editor: %s", edt_obj->getName().c_str());
}
if (RuleSet::cast(obj)!=NULL)
if (RuleSet::cast(obj)!=nullptr)
{
if (obj!=m_project->getCurrentRuleSet())
{
@ -1364,14 +1364,14 @@ void ObjectManipulator::selectionChanged(QTreeWidgetItem *cur)
qDebug("ObjectManipulator::selectionChanged");
QTreeWidget *qlv = getCurrentObjectTree();
if (qlv==NULL) return;
if (qlv==nullptr) return;
ObjectTreeViewItem* otvi = dynamic_cast<ObjectTreeViewItem*>(cur);
if (otvi==NULL) return;
if (otvi==nullptr) return;
FWObject *obj = otvi->getFWObject();
if (obj==NULL) return;
if (obj==nullptr) return;
if (fwbdebug) qDebug("ObjectManipulator::selectionChanged obj=%s",
obj->getName().c_str());
@ -1426,13 +1426,13 @@ void ObjectManipulator::openObjectInTree(FWObject *obj, bool /*register_in_histo
<< "obj:" << ((obj)?obj->getName().c_str():"NULL")
<< "id:" << ((obj)?obj->getId():0);
if (obj==NULL) return;
if (obj==nullptr) return;
openLibForObject(obj);
//raise();
FWObject *o=obj;
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
ObjectTreeViewItem *otvi = allItems[o];
// this changes selection and thus calls slot slectionChanged
@ -1477,7 +1477,7 @@ void ObjectManipulator::showObjectInTree(ObjectTreeViewItem *otvi)
{
if (fwbdebug)
qDebug("ObjectManipulator::showObjectInTree");
if (otvi==NULL) return;
if (otvi==nullptr) return;
ObjectTreeView* otv = otvi->getTree();
@ -1502,7 +1502,7 @@ void ObjectManipulator::libChangedById(int obj_id)
{
QModelIndex idx = libs_model->index(i, 0);
FWObject *l = libs_model->getLibrary(idx);
if (l == NULL) continue;
if (l == nullptr) continue;
if (l->getId() == obj_id)
{
libChanged(i);
@ -1517,21 +1517,21 @@ FWObject* ObjectManipulator::getNextUserLib(FWObject *after_this)
QString sid2 = "syslib000";
QString sid3 = "syslib001";
FWObject *lib = NULL;
if (after_this != NULL) lib = after_this->getLibrary();
FWObject *lib = nullptr;
if (after_this != nullptr) lib = after_this->getLibrary();
for (int i=0; i<libs_model->rowCount(); ++i)
{
QModelIndex idx = libs_model->index(i, 0);
FWObject *l = libs_model->getLibrary(idx);
if (l == NULL) continue;
if (l == nullptr) continue;
if (l == lib) continue;
QString sid1 = FWObjectDatabase::getStringId(l->getId()).c_str();
if ( sid1 == sid2 || sid1 == sid3) continue;
return l;
}
return NULL;
return nullptr;
}
void ObjectManipulator::libChanged(int list_row)
@ -1541,7 +1541,7 @@ void ObjectManipulator::libChanged(int list_row)
previous_lib_index = list_row;
QTreeWidget *objTreeView = libs_model->getTreeWidget(list_row);
if (objTreeView == NULL)
if (objTreeView == nullptr)
{
if (fwbdebug)
{
@ -1562,7 +1562,7 @@ void ObjectManipulator::libChanged(int list_row)
}
ObjectTreeViewItem *otvi = dynamic_cast<ObjectTreeViewItem*>(objTreeView->currentItem());
if (otvi == NULL)
if (otvi == nullptr)
{
if (objTreeView->invisibleRootItem()->childCount() > 0)
otvi = dynamic_cast<ObjectTreeViewItem*>(
@ -1579,7 +1579,7 @@ void ObjectManipulator::libChanged(int list_row)
void ObjectManipulator::updateCreateObjectMenu(FWObject* lib)
{
bool f = (
lib == NULL ||
lib == nullptr ||
lib->getId()==FWObjectDatabase::TEMPLATE_LIB_ID ||
lib->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ||
lib->isReadOnly()
@ -1594,7 +1594,7 @@ void ObjectManipulator::updateCreateObjectMenu(FWObject* lib)
FWObject* ObjectManipulator::getCurrentLib()
{
int idx = m_objectManipulator->libs->currentIndex();
if (idx == -1 ) return NULL;
if (idx == -1 ) return nullptr;
FWObject *lib = libs_model->getLibrary(idx);
@ -1628,7 +1628,7 @@ void ObjectManipulator::select()
<< "currentObj=" << currentObj
<< ((currentObj)?currentObj->getName().c_str():" [unknown] ");
if (currentObj==NULL) return;
if (currentObj==nullptr) return;
m_objectManipulator->libs->setCurrentIndex(
libs_model->getIdxForLib(currentObj->getLibrary()).row());
@ -1646,12 +1646,12 @@ void ObjectManipulator::select()
void ObjectManipulator::unselect()
{
FWObject *currentObj = getSelectedObject();
if (currentObj==NULL) return;
if (currentObj==nullptr) return;
for (int i=0; i<libs_model->rowCount(); ++i)
{
QTreeWidget *otv = libs_model->getTreeWidget(i);
if (otv == NULL) continue;
if (otv == nullptr) continue;
otv->clearSelection();
}
@ -1705,7 +1705,7 @@ void ObjectManipulator::simulateInstall()
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
{
fw= Firewall::cast( *i );
if (fw!=NULL)
if (fw!=nullptr)
{
fw->updateLastCompiledTimestamp();
fw->updateLastInstalledTimestamp();
@ -1721,7 +1721,7 @@ FWObject* ObjectManipulator::getSelectedObject()
ObjectTreeViewItem* otvi = dynamic_cast<ObjectTreeViewItem*>(cur);
return otvi->getFWObject();
}
return NULL;
return nullptr;
}
void ObjectManipulator::reopenCurrentItemParent()
@ -1741,7 +1741,7 @@ void ObjectManipulator::loadSectionSizes()
{
QTreeWidget *objTreeView = libs_model->getTreeWidget(i);
FWObject *lib = libs_model->getLibrary(i);
if (lib == NULL || objTreeView == NULL) continue;
if (lib == nullptr || objTreeView == nullptr) continue;
objTreeView->header()->resizeSection(
0,
@ -1760,7 +1760,7 @@ void ObjectManipulator::saveSectionSizes()
{
QTreeWidget *objTreeView = libs_model->getTreeWidget(i);
FWObject *lib = libs_model->getLibrary(i);
if (lib == NULL || objTreeView == NULL) continue;
if (lib == nullptr || objTreeView == nullptr) continue;
st->setTreeSectionSize(
m_project->getFileName(), lib->getName().c_str(), 0,
@ -1781,7 +1781,7 @@ void ObjectManipulator::loadExpandedTreeItems()
ObjectTreeView *objTreeView = libs_model->getTreeWidget(i);
FWObject *lib = libs_model->getLibrary(i);
if (lib == NULL || objTreeView == NULL) continue;
if (lib == nullptr || objTreeView == nullptr) continue;
set<int> expanded_objects;
st->getExpandedObjectIds(m_project->getFileName(),
@ -1800,7 +1800,7 @@ void ObjectManipulator::saveExpandedTreeItems()
{
ObjectTreeView *objTreeView = libs_model->getTreeWidget(i);
FWObject *lib = libs_model->getLibrary(i);
if (lib == NULL || objTreeView == NULL) continue;
if (lib == nullptr || objTreeView == nullptr) continue;
st->setExpandedObjectIds(m_project->getFileName(),
lib->getName().c_str(),
@ -1813,7 +1813,7 @@ void ObjectManipulator::setAttributesColumnEnabled(bool)
for (int i=0; i<libs_model->rowCount(); ++i)
{
ObjectTreeView *objTreeView = libs_model->getTreeWidget(i);
if (objTreeView == NULL) continue;
if (objTreeView == nullptr) continue;
objTreeView->showOrHideAttributesColumn();
}
}

View File

@ -140,7 +140,7 @@ QAction* ObjectManipulator::addNewObjectMenuItem(QMenu *menu,
void ObjectManipulator::createNewObject()
{
const QAction *action = dynamic_cast<const QAction*>(sender());
assert(action!=NULL);
assert(action!=nullptr);
QVariant v = action->data();
if (!v.isValid()) return;
@ -156,13 +156,13 @@ void ObjectManipulator::createNewObject()
qDebug() << "ObjectManipulator::createNewObject()"
<< "type:" << type_name
<< "add_to_group_id:" << add_to_group_id;
FWObject *new_obj = NULL;
FWObject *new_obj = nullptr;
if (!isObjectAllowed(type_name)) return;
QString descr = FWBTree().getTranslatableObjectTypeName(type_name);
// FWCmdMacro should be used for commands grouping
FWCmdMacro* macro = 0;
FWCmdMacro* macro = nullptr;
if (add_to_group_id == -1)
macro = new FWCmdMacro(
FWBTree().getTranslatableNewObjectMenuText(type_name));
@ -179,7 +179,7 @@ void ObjectManipulator::createNewObject()
if (type_name == Firewall::TYPENAME) new_obj = newFirewall(macro);
if (type_name == Cluster::TYPENAME) new_obj = newCluster(macro);
if (type_name == Host::TYPENAME) new_obj = newHost(macro);
if (new_obj == NULL)
if (new_obj == nullptr)
{
delete macro;
return;
@ -198,9 +198,9 @@ void ObjectManipulator::createNewObject()
//if (type_name == Routing::TYPENAME) new_obj = newRoutingRuleSet();
if (type_name == AttachedNetworks::TYPENAME) new_obj = newAttachedNetworks(macro);
if (new_obj == NULL) new_obj = createObject(type_name, descr, NULL, macro);
if (new_obj == nullptr) new_obj = createObject(type_name, descr, nullptr, macro);
if (new_obj == NULL)
if (new_obj == nullptr)
{
delete macro;
return;
@ -236,7 +236,7 @@ void ObjectManipulator::createNewObject()
m_project, new expandObjectInTreeEvent(
m_project->getFileName(), new_obj->getId()));
if (Firewall::cast(new_obj)!=NULL) // Cluster too
if (Firewall::cast(new_obj)!=nullptr) // Cluster too
{
FWObject *ruleset = new_obj->getFirstByType(Policy::TYPENAME);
if (ruleset)
@ -249,7 +249,7 @@ void ObjectManipulator::createNewObject()
list<FWObject*> newObjs;
newObjs.push_back(new_obj);
moveItems(lastClickedItem, newObjs);
lastClickedItem = NULL;
lastClickedItem = nullptr;
m_project->undoStack->push(macro);
}
@ -258,13 +258,13 @@ void ObjectManipulator::newFirewallSlot()
{
QString descr = FWBTree().getTranslatableObjectTypeName(Firewall::TYPENAME);
// FWCmdMacro should be used for commands grouping
FWCmdMacro* macro = 0;
FWCmdMacro* macro = nullptr;
macro = new FWCmdMacro(
FWBTree().getTranslatableNewObjectMenuText(Firewall::TYPENAME));
FWObject *new_obj = newFirewall(macro);
if (new_obj == NULL)
if (new_obj == nullptr)
{
delete macro;
return;
@ -332,7 +332,7 @@ FWObject* ObjectManipulator::createObject(const QString &objType,
FWObject *parent = FWBTree().getStandardSlotForObject(lib, objType);
if (parent==NULL)
if (parent==nullptr)
{
QMessageBox::warning(this,"Firewall Builder",
QObject::tr(
@ -342,7 +342,7 @@ FWObject* ObjectManipulator::createObject(const QString &objType,
.arg(objType),
"&Continue", QString::null, QString::null,
0, 1 );
return NULL;
return nullptr;
}
return actuallyCreateObject(parent, objType, objName, copyFrom, macro);
@ -357,7 +357,7 @@ FWObject* ObjectManipulator::createObject(FWObject *parent,
FWObject *lib = getCurrentLib();
int i = 0;
assert(parent!=NULL);
assert(parent!=nullptr);
if (fwbdebug)
{
@ -385,7 +385,7 @@ FWObject* ObjectManipulator::createObject(FWObject *parent,
i++;
}
if (parent==NULL) parent=lib;
if (parent==nullptr) parent=lib;
return actuallyCreateObject(parent, objType, objName, copyFrom, macro);
}
@ -396,11 +396,11 @@ FWObject* ObjectManipulator::actuallyCreateObject(FWObject *parent,
FWObject *copyFrom,
QUndoCommand* macro)
{
FWObject *nobj=NULL;
if (!isTreeReadWrite(this, parent)) return NULL;
FWObject *nobj=nullptr;
if (!isTreeReadWrite(this, parent)) return nullptr;
nobj = m_project->db()->create(objType.toLatin1().constData());
assert(nobj!=NULL);
if (copyFrom!=NULL) nobj->duplicate(copyFrom, true);
assert(nobj!=nullptr);
if (copyFrom!=nullptr) nobj->duplicate(copyFrom, true);
if (nobj->isReadOnly()) nobj->setReadOnly(false);
QString new_name = makeNameUnique(parent, objName, objType);
@ -448,7 +448,7 @@ FWObject* ObjectManipulator::newLibrary(QUndoCommand* macro)
// At this point new library is already inserted into the object tree
// but it has not been added to the QTreeWidget yet.
FWCmdAddLibrary *cmd = new FWCmdAddLibrary(
m_project, m_project->db(), NULL, QObject::tr("Create library"), macro);
m_project, m_project->db(), nullptr, QObject::tr("Create library"), macro);
FWObject *new_state = cmd->getNewState();
m_project->db()->remove(nlib, false);
new_state->add(nlib);
@ -463,10 +463,10 @@ FWObject* ObjectManipulator::newLibrary(QUndoCommand* macro)
FWObject* ObjectManipulator::newPolicyRuleSet(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
QString name = "Policy";
Firewall * fw = Firewall::cast(currentObj);
if (fw!=NULL)
if (fw!=nullptr)
{
int count = 0;
for (FWObjectTypedChildIterator it = fw->findByType(Policy::TYPENAME);it != it.end(); ++it)
@ -477,7 +477,7 @@ FWObject* ObjectManipulator::newPolicyRuleSet(QUndoCommand* macro)
name+=QString().setNum(count);
}
}
FWObject *o = createObject(currentObj, Policy::TYPENAME, name, NULL, macro);
FWObject *o = createObject(currentObj, Policy::TYPENAME, name, nullptr, macro);
this->getCurrentObjectTree()->sortItems(0, Qt::AscendingOrder);
return o;
}
@ -485,10 +485,10 @@ FWObject* ObjectManipulator::newPolicyRuleSet(QUndoCommand* macro)
FWObject* ObjectManipulator::newNATRuleSet(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
QString name = "NAT";
Firewall * fw = Firewall::cast(currentObj);
if (fw!=NULL)
if (fw!=nullptr)
{
int count = 0;
for (FWObjectTypedChildIterator it = fw->findByType(NAT::TYPENAME);
@ -500,7 +500,7 @@ FWObject* ObjectManipulator::newNATRuleSet(QUndoCommand* macro)
name += QString().setNum(count);
}
}
FWObject *o = createObject(currentObj, NAT::TYPENAME, name, NULL, macro);
FWObject *o = createObject(currentObj, NAT::TYPENAME, name, nullptr, macro);
this->getCurrentObjectTree()->sortItems(0, Qt::AscendingOrder);
return o;
}
@ -521,10 +521,10 @@ FWObject* ObjectManipulator::newFirewall(QUndoCommand* macro)
FWObject *nfw = nfd->getNewFirewall();
delete nfd;
if (nfw!=NULL)
if (nfw!=nullptr)
{
FWCmdAddObject *cmd = new FWCmdAddObject(
m_project, parent, NULL, QObject::tr("Create new Firewall"), macro);
m_project, parent, nullptr, QObject::tr("Create new Firewall"), macro);
FWObject *new_state = cmd->getNewState();
parent->remove(nfw, false);
@ -559,7 +559,7 @@ FWObject* ObjectManipulator::newCluster(QUndoCommand* macro, bool fromSelected)
fwvector.push_back(FWObject::cast(fw));
ncd->setFirewallList(fwvector);
}
if ( ncd->exec() != QDialog::Accepted) return NULL;
if ( ncd->exec() != QDialog::Accepted) return nullptr;
FWObject *ncl = ncd->getNewCluster();
delete ncd;
@ -570,7 +570,7 @@ FWObject* ObjectManipulator::newCluster(QUndoCommand* macro, bool fromSelected)
qDebug() << "ObjectManipulator::newCluster checkpoint 1";
FWCmdAddObject *cmd = new FWCmdAddObject(
m_project, parent, NULL, QObject::tr("Create new Cluster"), macro);
m_project, parent, nullptr, QObject::tr("Create new Cluster"), macro);
// newCluster dialog may create backup copies of member firewalls,
// to see them in the tree need to reload it.
cmd->setNeedTreeReload(true);
@ -591,7 +591,7 @@ void ObjectManipulator::newClusterFromSelected()
FWCmdMacro* macro = new FWCmdMacro(
FWBTree().getTranslatableNewObjectMenuText(Cluster::TYPENAME));
FWObject *ncl = newCluster(macro, true);
if (ncl == NULL)
if (ncl == nullptr)
{
delete macro;
return;
@ -602,11 +602,11 @@ void ObjectManipulator::newClusterFromSelected()
FWObject* ObjectManipulator::newClusterIface(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
QString new_name = makeNameUnique(currentObj,
findNewestInterfaceName(currentObj),
Interface::TYPENAME);
return createObject(currentObj, Interface::TYPENAME, new_name, NULL, macro);
return createObject(currentObj, Interface::TYPENAME, new_name, nullptr, macro);
}
/*
@ -617,13 +617,13 @@ FWObject* ObjectManipulator::newClusterIface(QUndoCommand* macro)
FWObject* ObjectManipulator::newStateSyncClusterGroup(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
FWObject *o = NULL;
FWObject *o = nullptr;
FWObject *cluster = currentObj;
while (cluster && !Cluster::isA(cluster)) cluster = cluster->getParent();
assert(cluster != NULL);
assert(cluster != nullptr);
QString host_os = cluster->getStr("host_OS").c_str();
list<QStringPair> lst;
@ -635,13 +635,13 @@ FWObject* ObjectManipulator::newStateSyncClusterGroup(QUndoCommand* macro)
this,"Firewall Builder",
tr("Cluster host OS %1 does not support state synchronization").arg(host_os),
"&Continue", QString::null, QString::null, 0, 1 );
return NULL;
return nullptr;
}
QString group_type = lst.front().first;
o = createObject(currentObj, StateSyncClusterGroup::TYPENAME,
tr("State Sync Group"), NULL, macro);
tr("State Sync Group"), nullptr, macro);
o->setStr("type", group_type.toStdString());
return o;
}
@ -654,9 +654,9 @@ FWObject* ObjectManipulator::newStateSyncClusterGroup(QUndoCommand* macro)
FWObject* ObjectManipulator::newFailoverClusterGroup(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
FWObject *o = NULL;
FWObject *o = nullptr;
QString group_type;
if (Interface::isA(currentObj))
@ -665,11 +665,11 @@ FWObject* ObjectManipulator::newFailoverClusterGroup(QUndoCommand* macro)
} else
{
qWarning("newClusterGroup: invalid currentObj");
return NULL;
return nullptr;
}
o = createObject(currentObj, FailoverClusterGroup::TYPENAME,
tr("Failover group"), NULL, macro);
tr("Failover group"), nullptr, macro);
o->setStr("type", group_type.toStdString());
return o;
}
@ -681,12 +681,12 @@ FWObject* ObjectManipulator::newFailoverClusterGroup(QUndoCommand* macro)
FWObject* ObjectManipulator::newAttachedNetworks(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
if (Interface::isA(currentObj))
{
FWObject *no = createObject(currentObj, AttachedNetworks::TYPENAME,
tr("Attached Networks"), NULL, macro);
tr("Attached Networks"), nullptr, macro);
FWObject *parent_host = Host::getParentHost(currentObj);
string name = parent_host->getName() +
":" + currentObj->getName() + ":attached";
@ -695,7 +695,7 @@ FWObject* ObjectManipulator::newAttachedNetworks(QUndoCommand* macro)
} else
{
qWarning("newAttachedNetworks: invalid currentObj");
return NULL;
return nullptr;
}
}
@ -710,10 +710,10 @@ FWObject* ObjectManipulator::newHost(QUndoCommand* macro)
FWObject *o = nhd->getNewHost();
delete nhd;
if (o!=NULL)
if (o!=nullptr)
{
FWCmdAddObject *cmd = new FWCmdAddObject(
m_project, parent, NULL, QObject::tr("Create new Host"), macro);
m_project, parent, nullptr, QObject::tr("Create new Host"), macro);
FWObject *new_state = cmd->getNewState();
parent->remove(o, false);
new_state->add(o);
@ -743,10 +743,10 @@ QString ObjectManipulator::findNewestInterfaceName(FWObject *parent)
FWObject* ObjectManipulator::newInterface(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
Interface *new_interface = NULL;
FWObject *parent = NULL;
Interface *new_interface = nullptr;
FWObject *parent = nullptr;
// Note that Firewall::cast matches Firewall and Cluster
if (Host::isA(currentObj) || Firewall::cast(currentObj))
@ -769,19 +769,19 @@ FWObject* ObjectManipulator::newInterface(QUndoCommand* macro)
}
}
if (parent == NULL)
if (parent == nullptr)
{
// since we can;t find quitable parent for the new interface,
// we can't create it.
return NULL;
return nullptr;
}
QString new_name = makeNameUnique(parent, findNewestInterfaceName(parent),
Interface::TYPENAME);
new_interface = Interface::cast(
createObject(parent, Interface::TYPENAME, new_name, NULL, macro));
createObject(parent, Interface::TYPENAME, new_name, nullptr, macro));
if (new_interface == NULL) return NULL;
if (new_interface == nullptr) return nullptr;
if (Interface::isA(parent))
{
@ -801,49 +801,49 @@ FWObject* ObjectManipulator::newInterface(QUndoCommand* macro)
FWObject* ObjectManipulator::newInterfaceAddress(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
if (Interface::isA(currentObj))
{
Interface *intf = Interface::cast(currentObj);
if (intf &&
(intf->isDyn() || intf->isUnnumbered() || intf->isBridgePort())
) return NULL;
) return nullptr;
QString iname = getStandardName(currentObj, IPv4::TYPENAME, "ip");
iname = makeNameUnique(currentObj, iname, IPv4::TYPENAME);
return createObject(currentObj, IPv4::TYPENAME, iname, NULL, macro);
return createObject(currentObj, IPv4::TYPENAME, iname, nullptr, macro);
}
// if current object is not interface, create address in the standard folder
return createObject(IPv4::TYPENAME,
FWBTree().getTranslatableObjectTypeName(IPv4::TYPENAME),
NULL, macro);
nullptr, macro);
}
FWObject* ObjectManipulator::newInterfaceAddressIPv6(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
if (Interface::isA(currentObj))
{
Interface *intf = Interface::cast(currentObj);
if (intf &&
(intf->isDyn() || intf->isUnnumbered() || intf->isBridgePort())
) return NULL;
) return nullptr;
QString iname = getStandardName(currentObj, IPv4::TYPENAME, "ipv6");
iname = makeNameUnique(currentObj, iname, IPv4::TYPENAME);
return createObject(currentObj, IPv6::TYPENAME, iname, NULL, macro);
return createObject(currentObj, IPv6::TYPENAME, iname, nullptr, macro);
}
// if current object is not interface, create address in the standard folder
return createObject(IPv6::TYPENAME,
FWBTree().getTranslatableObjectTypeName(IPv6::TYPENAME),
NULL, macro);
nullptr, macro);
}
FWObject* ObjectManipulator::newPhysicalAddress(QUndoCommand* macro)
{
FWObject *currentObj = getSelectedObject();
if ( currentObj->isReadOnly() ) return NULL;
if ( currentObj->isReadOnly() ) return nullptr;
if (Interface::isA(currentObj))
{
@ -854,10 +854,10 @@ FWObject* ObjectManipulator::newPhysicalAddress(QUndoCommand* macro)
.arg(QString::fromUtf8(currentObj->getParent()->getName().c_str()))
.arg(QString::fromUtf8(currentObj->getName().c_str()));
return createObject(currentObj, physAddress::TYPENAME, iname,
NULL, macro);
nullptr, macro);
}
}
return NULL;
return nullptr;
}
void ObjectManipulator::reminderAboutStandardLib()

View File

@ -91,10 +91,10 @@ void ObjectManipulator::autoRenameChildren(FWObject *obj,
if (oldName == QString::fromUtf8(obj->getName().c_str())) return;
QTreeWidgetItem *itm = allItems[obj];
assert(itm!=NULL);
assert(itm!=nullptr);
if ((QString::fromUtf8(obj->getName().c_str())!=oldName) &&
(Host::isA(obj) || Firewall::cast(obj)!=NULL || Interface::isA(obj)))
(Host::isA(obj) || Firewall::cast(obj)!=nullptr || Interface::isA(obj)))
{
autorename(obj);
}
@ -105,7 +105,7 @@ void ObjectManipulator::autorename(FWObject *obj)
if (fwbdebug)
qDebug() << "ObjectManipulator::autorename obj=" << obj->getName().c_str();
if (Host::isA(obj) || Firewall::cast(obj)!=NULL || Cluster::isA(obj))
if (Host::isA(obj) || Firewall::cast(obj)!=nullptr || Cluster::isA(obj))
{
list<FWObject*> il = obj->getByType(Interface::TYPENAME);
for (list<FWObject*>::iterator i=il.begin(); i!=il.end(); ++i)
@ -179,7 +179,7 @@ void ObjectManipulator::autorenameVlans(list<FWObject*> &obj_list)
FWObject *obj = *j;
FWObject *parent = obj->getParent();
FWObject *fw = parent;
while (fw && Firewall::cast(fw)==NULL) fw = fw->getParent();
while (fw && Firewall::cast(fw)==nullptr) fw = fw->getParent();
assert(fw);
QString obj_name = QString::fromUtf8(obj->getName().c_str());
@ -216,24 +216,24 @@ void ObjectManipulator::autorenameVlans(list<FWObject*> &obj_list)
FWObject* ObjectManipulator::duplicateObject(FWObject *targetLib, FWObject *obj)
{
if (!isTreeReadWrite(this, targetLib)) return NULL;
if (!isTreeReadWrite(this, targetLib)) return nullptr;
// we disable copy/cut/paste/duplicate menu items for objects that
// can't be copied or duplicated in
// ObjectManipulator::getMenuState() but will check here just in
// case
if (AttachedNetworks::isA(obj)) return NULL;
if (AttachedNetworks::isA(obj)) return nullptr;
openLib(targetLib);
FWObject *new_parent = FWBTree().getStandardSlotForObject(
targetLib, obj->getTypeName().c_str());
if (new_parent == NULL) new_parent = obj->getParent();
if (new_parent == nullptr) new_parent = obj->getParent();
QString newName =
makeNameUnique(new_parent,
QString::fromUtf8(obj->getName().c_str()),
obj->getTypeName().c_str());
if (!isObjectAllowed(new_parent, obj)) return NULL;
if (!isObjectAllowed(new_parent, obj)) return nullptr;
return createObject(obj->getTypeName().c_str(), newName, obj);
}
@ -243,7 +243,7 @@ void ObjectManipulator::moveObject(FWObject *targetLib, FWObject *obj)
FWObject *cl=getCurrentLib();
if (cl==targetLib) return;
FWObject *grp = NULL;
FWObject *grp = nullptr;
if (FWObjectDatabase::isA(targetLib)) grp = targetLib;
else
@ -251,7 +251,7 @@ void ObjectManipulator::moveObject(FWObject *targetLib, FWObject *obj)
grp = FWBTree().getStandardSlotForObject(
targetLib, obj->getTypeName().c_str());
}
if (grp==NULL) grp=targetLib;
if (grp==nullptr) grp=targetLib;
if (!grp->isReadOnly())
{
@ -301,15 +301,15 @@ FWObject* ObjectManipulator::actuallyPasteTo(FWObject *target,
//FWObject *res = NULL;
FWObject *ta = prepareForInsertion(target, obj);
if (ta == NULL) return NULL;
if (ta == nullptr) return nullptr;
if (!isObjectAllowed(ta, obj)) return NULL;
if (!isObjectAllowed(ta, obj)) return nullptr;
// we disable copy/cut/paste/duplicate menu items for objects that
// can't be copied or duplicated in
// ObjectManipulator::getMenuState() but will check here just in
// case
if (AttachedNetworks::isA(obj)) return NULL;
if (AttachedNetworks::isA(obj)) return nullptr;
if (fwbdebug)
qDebug() << "ObjectManipulator::actuallyPasteTo"
@ -326,7 +326,7 @@ FWObject* ObjectManipulator::actuallyPasteTo(FWObject *target,
{
if (fwbdebug) qDebug("Copy object %s (%d) to a different object tree",
obj->getName().c_str(), obj->getId());
FWCmdAddObject *cmd = new FWCmdAddObject(m_project, target, NULL,
FWCmdAddObject *cmd = new FWCmdAddObject(m_project, target, nullptr,
QObject::tr("Paste object"));
FWObject *new_state = cmd->getNewState();
cmd->setNeedTreeReload(true);
@ -343,7 +343,7 @@ FWObject* ObjectManipulator::actuallyPasteTo(FWObject *target,
}
Group *grp = Group::cast(ta);
if (grp!=NULL && !FWBTree().isSystem(ta))
if (grp!=nullptr && !FWBTree().isSystem(ta))
{
if (fwbdebug) qDebug("Copy object %s (%d) to a regular group",
obj->getName().c_str(), obj->getId());
@ -356,7 +356,7 @@ FWObject* ObjectManipulator::actuallyPasteTo(FWObject *target,
if(cp_id==o1->getId()) return o1;
FWReference *ref;
if( (ref=FWReference::cast(o1))!=NULL &&
if( (ref=FWReference::cast(o1))!=nullptr &&
cp_id==ref->getPointerId()) return o1;
}
FWCmdChange *cmd = new FWCmdChange(
@ -379,7 +379,7 @@ FWObject* ObjectManipulator::actuallyPasteTo(FWObject *target,
obj->getName().c_str(), obj->getId());
FWObject *nobj = m_project->db()->create(obj->getTypeName());
assert(nobj!=NULL);
assert(nobj!=nullptr);
//nobj->ref();
nobj->duplicate(obj, true);
if (new_name != nobj->getName().c_str())
@ -417,7 +417,7 @@ FWObject* ObjectManipulator::actuallyPasteTo(FWObject *target,
0, 1 );
}
return NULL;
return nullptr;
}
void ObjectManipulator::lockObject()
@ -510,7 +510,7 @@ void ObjectManipulator::deleteObject(FWObject *obj, QUndoCommand* macro)
FWObject *deleted_objects_lib = m_project->db()->findInIndex(
FWObjectDatabase::DELETED_OBJECTS_ID );
if (deleted_objects_lib == NULL)
if (deleted_objects_lib == nullptr)
{
FWObject *dobj = m_project->db()->createLibrary();
dobj->setId(FWObjectDatabase::DELETED_OBJECTS_ID);
@ -529,8 +529,8 @@ void ObjectManipulator::deleteObject(FWObject *obj, QUndoCommand* macro)
obj->getId() == FWObjectDatabase::DELETED_OBJECTS_ID) return;
bool is_library = Library::isA(obj);
bool is_firewall = Firewall::cast(obj) != NULL; // includes Cluster too
bool is_deleted_object = (deleted_objects_lib!=NULL && obj->isChildOf(deleted_objects_lib));
bool is_firewall = Firewall::cast(obj) != nullptr; // includes Cluster too
bool is_deleted_object = (deleted_objects_lib!=nullptr && obj->isChildOf(deleted_objects_lib));
// ruleset_visible == true if 1) we delete firewall object and one of its
// rulesets is visible in the project panel, or 2) we delete ruleset object
@ -568,7 +568,7 @@ void ObjectManipulator::deleteObject(FWObject *obj, QUndoCommand* macro)
obj,
QString("Delete object"),
macro);
if (macro==0)
if (macro==nullptr)
m_project->undoStack->push(cmd);
return;
}
@ -622,7 +622,7 @@ void ObjectManipulator::actuallyDeleteObject(FWObject *obj, QUndoCommand* macro)
QString("Delete object"),
macro);
if (macro == 0)
if (macro == nullptr)
m_project->undoStack->push(cmd);
}
@ -645,11 +645,11 @@ void ObjectManipulator::groupObjects()
QString libName = ngd.m_dialog->libs->currentText();
QString type = ObjectGroup::TYPENAME;
if (Service::cast(co)!=NULL) type=ServiceGroup::TYPENAME;
if (Interval::cast(co)!=NULL) type=IntervalGroup::TYPENAME;
if (Service::cast(co)!=nullptr) type=ServiceGroup::TYPENAME;
if (Interval::cast(co)!=nullptr) type=IntervalGroup::TYPENAME;
FWObject *parent = NULL;
FWObject *newgrp = NULL;
FWObject *parent = nullptr;
FWObject *newgrp = nullptr;
list<FWObject*> ll = m_project->db()->getByType( Library::TYPENAME );
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
@ -663,7 +663,7 @@ void ObjectManipulator::groupObjects()
*/
if (lib->isReadOnly()) return;
parent = FWBTree().getStandardSlotForObject(lib,type);
if (parent==NULL)
if (parent==nullptr)
{
if (fwbdebug)
qDebug("ObjectManipulator::groupObjects(): could not find standard slot for object of type %s in library %s",
@ -676,7 +676,7 @@ void ObjectManipulator::groupObjects()
break;
}
}
if (newgrp==NULL) return;
if (newgrp==nullptr) return;
FWCmdAddObject *cmd = new FWCmdAddObject(
m_project, parent, newgrp, QObject::tr("Create new group"));
@ -718,14 +718,14 @@ static void doKeyword(vector<FWObject *> objs, bool doAdd,
void ObjectManipulator::addNewKeywordSlot()
{
QString keyword = QInputDialog::getText(0, tr("Add New Keyword"),
QString keyword = QInputDialog::getText(nullptr, tr("Add New Keyword"),
tr("Enter new keyword to add to selected objects"));
keyword = keyword.simplified();
if (fwbdebug) {
qDebug() << "ObjectManipulator::addNewKeyword: " << keyword;
}
if (!KeywordsDialog::validateKeyword(0, keyword)) return;
if (!KeywordsDialog::validateKeyword(nullptr, keyword)) return;
doKeyword(getCurrentObjectTree()->getSelectedObjects(), true,
keyword.toUtf8().constData(), m_project);
@ -735,7 +735,7 @@ void ObjectManipulator::addNewKeywordSlot()
void ObjectManipulator::processKeywordSlot()
{
const QObject *qObj = sender();
if (qObj == 0) return;
if (qObj == nullptr) return;
const QAction *qAct = dynamic_cast<const QAction *>(qObj);
QStringList list = qAct->data().toStringList();
if (list.size() != 2) return;
@ -752,12 +752,12 @@ void ObjectManipulator::processKeywordSlot()
void ObjectManipulator::addSubfolderSlot()
{
const QAction *qAct = dynamic_cast<const QAction *>(sender());
if (qAct == 0) return;
if (qAct == nullptr) return;
FWObject *obj = getCurrentObjectTree()->getCurrentObject();
assert(obj->getId() == qAct->data().toInt());
QString folder = QInputDialog::getText(0, tr("Add Subfolder"),
QString folder = QInputDialog::getText(nullptr, tr("Add Subfolder"),
tr("Enter new subfolder name"));
folder = folder.simplified();
if (folder.isEmpty()) return;
@ -791,10 +791,10 @@ void ObjectManipulator::removeUserFolder()
{
ObjectTreeViewItem *item = dynamic_cast<ObjectTreeViewItem *>
(getCurrentObjectTree()->currentItem());
if (item == 0 || item->getUserFolderParent() == 0) return;
if (item == nullptr || item->getUserFolderParent() == nullptr) return;
ObjectTreeViewItem *parent = dynamic_cast<ObjectTreeViewItem *>
(item->parent());
assert(parent != 0);
assert(parent != nullptr);
vector<FWObject *> objs;
for (int ii = 0; ii < item->childCount(); ii++) {
@ -826,7 +826,7 @@ void ObjectManipulator::removeUserFolder()
while (!children.isEmpty()) {
ObjectTreeViewItem *child = dynamic_cast<ObjectTreeViewItem *>
(children.takeFirst());
assert(child != 0);
assert(child != nullptr);
FWObject *obj = child->getFWObject();
if (mw->isEditorVisible() && mw->getOpenedEditor() == obj) {

View File

@ -73,7 +73,7 @@ void ObjectManipulator::undeleteLibrary()
if (getCurrentObjectTree()->getNumSelected()==0) return;
FWObject *obj = getCurrentObjectTree()->getSelectedObjects().front();
if (obj==NULL) return;
if (obj==nullptr) return;
// check that obj is in Deleted objects library. We do not show menu item
// "Undelete" if it isnt, but will double check anyway
@ -88,7 +88,7 @@ void ObjectManipulator::undeleteLibrary()
obj,
reference_holders,
QString("Undelete library object"),
0);
nullptr);
m_project->undoStack->push(cmd);
}
}
@ -185,11 +185,11 @@ void ObjectManipulator::pasteObj()
{
if (getCurrentObjectTree()->getNumSelected()==0) return;
FWObject *target_object = getCurrentObjectTree()->getSelectedObjects().front();
if (target_object==NULL) return;
if (target_object==nullptr) return;
vector<std::pair<int,ProjectPanel*> >::iterator i;
int idx = 0;
FWObject *last_object = NULL;
FWObject *last_object = nullptr;
Q_UNUSED(last_object);
map<int,int> map_ids;
if (fwbdebug)
@ -254,7 +254,7 @@ void ObjectManipulator::duplicateObj(QAction *action)
ObjectTreeView* ot=getCurrentObjectTree();
ot->freezeSelection(true);
FWObject *obj;
FWObject *nobj = NULL;
FWObject *nobj = nullptr;
vector<FWObject*> so = getCurrentObjectTree()->getSimplifiedSelection();
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
{
@ -356,7 +356,7 @@ void ObjectManipulator::dumpObj()
if (getCurrentObjectTree()->getNumSelected()==0) return;
FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
if (obj==NULL) return;
if (obj==nullptr) return;
obj->dump(true,false);
}
@ -416,7 +416,7 @@ void ObjectManipulator::find()
if (getCurrentObjectTree()->getNumSelected()==0) return;
FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
if (obj==NULL) return;
if (obj==nullptr) return;
m_project->setFDObject(obj);
}
@ -425,7 +425,7 @@ void ObjectManipulator::findObject()
if (getCurrentObjectTree()->getNumSelected()==0) return;
FWObject *obj=getCurrentObjectTree()->getSelectedObjects().front();
if (obj==NULL) return;
if (obj==nullptr) return;
mw->findObject( obj );
}
@ -434,7 +434,7 @@ void ObjectManipulator::findWhereUsedSlot()
if (getCurrentObjectTree()->getNumSelected()==0) return;
FWObject *obj = getCurrentObjectTree()->getSelectedObjects().front();
if (obj==NULL) return;
if (obj==nullptr) return;
mw->findWhereUsed(obj, m_project);
}
@ -443,7 +443,7 @@ void ObjectManipulator::makeSubinterface(QAction *act)
{
int intf_id = act->data().toInt();
FWObject *new_parent_interface = m_project->db()->findInIndex(intf_id);
assert(new_parent_interface!=NULL);
assert(new_parent_interface!=nullptr);
if (getCurrentObjectTree()->getNumSelected()==0) return;
@ -474,7 +474,7 @@ void ObjectManipulator::makeSubinterface(QAction *act)
obj,
reference_holders,
QString("Make an interface a subinterface"),
0);
nullptr);
m_project->undoStack->push(cmd);
}

View File

@ -183,7 +183,7 @@ void ObjectManipulator::expandObjectInTree(FWObject *obj)
//if (FWReference::cast(o)!=NULL) o = FWReference::cast(o)->getPointer();
QTreeWidgetItem *it = allItems[o];
if (it==NULL)
if (it==nullptr)
{
if (fwbdebug) qDebug() << "#### Tree node not found";
return;
@ -196,7 +196,7 @@ void ObjectManipulator::expandOrCollapseCurrentTreeNode(QTreeWidgetItem *item,
bool expand)
{
QTreeWidgetItem *parent = item->parent();
if (expand && parent != NULL && ! parent->isExpanded())
if (expand && parent != nullptr && ! parent->isExpanded())
parent->setExpanded(true);
item->setExpanded(expand);
@ -224,14 +224,14 @@ static ObjectTreeViewItem *findUserFolder(ObjectTreeViewItem *parent,
{
if (folder.isEmpty()) return parent;
ObjectTreeViewItem *otvi = 0;
ObjectTreeViewItem *otvi = nullptr;
int childNo = 0;
while(parent->child(childNo) != NULL && otvi == 0) {
while(parent->child(childNo) != nullptr && otvi == nullptr) {
ObjectTreeViewItem *sub =
dynamic_cast<ObjectTreeViewItem *>(parent->child(childNo));
if (sub != 0 &&
sub->getUserFolderParent() != 0 &&
if (sub != nullptr &&
sub->getUserFolderParent() != nullptr &&
sub->getUserFolderName() == folder) {
otvi = sub;
return otvi;
@ -263,12 +263,12 @@ static ObjectTreeViewItem *findUserFolder(ObjectTreeViewItem *parent,
ObjectTreeViewItem* ObjectManipulator::insertObject(ObjectTreeViewItem *itm,
FWObject *obj)
{
if (FWReference::cast(obj)!=NULL) return NULL;
if (Resources::global_res->getObjResourceBool(obj,"hidden") ) return NULL;
if (FWReference::cast(obj)!=nullptr) return nullptr;
if (Resources::global_res->getObjResourceBool(obj,"hidden") ) return nullptr;
if (Resources::global_res->getResourceBool(
string("/FWBuilderResources/Type/") +
obj->getTypeName() + "/hidden")) return NULL;
obj->getTypeName() + "/hidden")) return nullptr;
ObjectTreeViewItem *item = itm;
if (!obj->getStr("folder").empty()) {
@ -276,7 +276,7 @@ ObjectTreeViewItem* ObjectManipulator::insertObject(ObjectTreeViewItem *itm,
/* If we can't find the user folder, put it under the system
folder and get rid of the folder attribute */
if (item == 0) {
if (item == nullptr) {
item = itm;
obj->setStr("folder", "");
}
@ -316,15 +316,15 @@ void ObjectManipulator::insertSubtree(FWObject *parent, FWObject *obj)
ObjectTreeViewItem* parent_item = allItems[parent];
insertSubtree(parent_item, obj);
QTreeWidgetItem *itm = allItems[parent];
if (itm==NULL) return;
refreshSubtree(itm, NULL);
if (itm==nullptr) return;
refreshSubtree(itm, nullptr);
}
void ObjectManipulator::insertSubtree(ObjectTreeViewItem *itm, FWObject *obj)
{
this->m_objectManipulator->filter->clear();
ObjectTreeViewItem *nitm = insertObject(itm, obj);
if (nitm==NULL) return;
if (nitm==nullptr) return;
if (FWBTree().isStandardFolder(obj)) nitm->setExpanded( st->getExpandTree());
@ -387,7 +387,7 @@ void ObjectManipulator::insertSubtree(ObjectTreeViewItem *itm, FWObject *obj)
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
{
FWObject *o1=*m;
if (FWReference::cast(o1)!=NULL) continue;
if (FWReference::cast(o1)!=nullptr) continue;
insertSubtree(nitm, o1);
}
@ -404,7 +404,7 @@ void ObjectManipulator::removeObjectFromTreeView(FWObject *obj)
objTreeView->clearLastSelected();
ObjectTreeViewItem *itm = allItems[obj];
allItems[obj] = NULL;
allItems[obj] = nullptr;
if (itm && itm->parent())
{
itm->parent()->takeChild(itm->parent()->indexOfChild(itm));
@ -431,11 +431,11 @@ FWObject* ObjectManipulator::findRuleSetInHistoryByParentFw(FWObject* parent)
if (RuleSet::cast(obj))
{
FWObject *parent_fw = Host::getParentHost(obj);
if (parent_fw != NULL && parent_fw == parent) return obj;
if (parent_fw != nullptr && parent_fw == parent) return obj;
}
}
return NULL;
return nullptr;
}
void ObjectManipulator::removeObjectFromHistory(FWObject *obj)
@ -509,7 +509,7 @@ void ObjectManipulator::updateObjectInTree(FWObject *obj, bool subtree)
<< "subtree=" << subtree;
QTreeWidgetItem *itm = allItems[obj];
if (itm==NULL) return;
if (itm==nullptr) return;
// first, update tree item that represents @obj. Its name or label
// (second column) might have changed
@ -528,7 +528,7 @@ void ObjectManipulator::updateObjectInTree(FWObject *obj, bool subtree)
// now if we need to update subtree, call refreshSubtree()
if (subtree)
refreshSubtree(itm, NULL);
refreshSubtree(itm, nullptr);
}
void ObjectManipulator::clearObjects()
@ -543,7 +543,7 @@ void ObjectManipulator::clearObjects()
{
QTreeWidget *objTreeView = libs_model->getTreeWidget(i);
if (objTreeView == NULL) continue;
if (objTreeView == nullptr) continue;
m_objectManipulator->widgetStack->removeWidget(objTreeView);
// delete otv;
@ -554,7 +554,7 @@ void ObjectManipulator::clearObjects()
libs_model->addStaticItems();
current_tree_view = NULL;
current_tree_view = nullptr;
if (fwbdebug) qDebug("ObjectManipulator::clearObjects done");
}
@ -580,7 +580,7 @@ void ObjectManipulator::loadObjects()
clearObjects();
FWObject *firstUserLib = NULL;
FWObject *firstUserLib = nullptr;
list<FWObject*> ll = m_project->db()->getByType( Library::TYPENAME );
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
@ -599,7 +599,7 @@ void ObjectManipulator::loadObjects()
if ( lib->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
lib->getId()!=FWObjectDatabase::TEMPLATE_LIB_ID &&
firstUserLib==NULL) firstUserLib = *i;
firstUserLib==nullptr) firstUserLib = *i;
addLib( lib );
@ -609,7 +609,7 @@ void ObjectManipulator::loadObjects()
}
if (firstUserLib==NULL) firstUserLib = ll.front();
if (firstUserLib==nullptr) firstUserLib = ll.front();
openLib( firstUserLib );
if (fwbdebug)
@ -774,9 +774,9 @@ void ObjectManipulator::moveItems(ObjectTreeViewItem *dest,
{
string folder;
if(dest != NULL)
if(dest != nullptr)
{
if (dest->getUserFolderParent() != 0) {
if (dest->getUserFolderParent() != nullptr) {
folder = dest->getUserFolderName().toUtf8().constData();
} else {
folder = dest->getFWObject()->getStr("folder");
@ -807,7 +807,7 @@ void ObjectManipulator::addUserFolderToTree(FWObject *obj,
ObjectTreeViewItem *item = allItems[obj];
if (item == 0) return;
if (item == nullptr) return;
ObjectTreeViewItem *sub = new ObjectTreeViewItem(item);
@ -834,7 +834,7 @@ std::string ObjectManipulator::getFolderNameString(libfwbuilder::FWObject *obj)
FWObject *parent = obj->getParent();
while(parent != NULL) {
while(parent != nullptr) {
result = parent->getName() + "/" + result;
parent = parent->getParent();
}
@ -848,16 +848,16 @@ void ObjectManipulator::removeUserFolderFromTree(FWObject *obj,
const QString &folder)
{
ObjectTreeViewItem *item = allItems[obj];
if (item == 0) return;
if (item == nullptr) return;
ObjectTreeViewItem *sub = findUserFolder(item, folder);
if (sub == 0) return;
if (sub == nullptr) return;
QList<QTreeWidgetItem *> children = sub->takeChildren();
while (!children.isEmpty()) {
ObjectTreeViewItem *child = dynamic_cast<ObjectTreeViewItem *>
(children.takeFirst());
assert(child != 0);
assert(child != nullptr);
FWObject *obj = child->getFWObject();
if (mw->isEditorVisible() && mw->getOpenedEditor() == obj) {
@ -870,7 +870,7 @@ void ObjectManipulator::removeUserFolderFromTree(FWObject *obj,
item->removeChild(sub);
delete sub;
refreshSubtree(item, 0);
refreshSubtree(item, nullptr);
}
@ -881,7 +881,7 @@ void ObjectManipulator::moveToFromUserFolderInTree(FWObject *obj,
{
ObjectTreeViewItem *parent = allItems[obj];
ObjectTreeViewItem *toMove = allItems[objToMove];
if (parent == 0 || toMove == 0) return;
if (parent == nullptr || toMove == nullptr) return;
ObjectTreeViewItem *oldItem = findUserFolder(parent, oldFolder);
ObjectTreeViewItem *newItem = findUserFolder(parent, newFolder);
@ -889,7 +889,7 @@ void ObjectManipulator::moveToFromUserFolderInTree(FWObject *obj,
oldItem->removeChild(toMove);
newItem->addChild(toMove);
refreshSubtree(newItem, 0);
refreshSubtree(newItem, nullptr);
}

View File

@ -63,7 +63,7 @@ void ObjectSelectorWidget::updateObjectsToUse()
{
objects_to_use.clear();
QListWidgetItem* item = m_dialog->objectList->item(0);
while (item != NULL)
while (item != nullptr)
{
QString name = item->text().split(" ")[0];
QString addr = item->data(Qt::UserRole).toString();
@ -154,7 +154,7 @@ void ObjectSelectorWidget::removeObject()
QListWidgetItem* item1 = m_dialog->objectList->item(0);
QListWidgetItem* item2;
while (item1!=0)
while (item1!=nullptr)
{
item2 = m_dialog->objectList->item(m_dialog->objectList->row(item1)+1);
if (item1->isSelected())

View File

@ -106,8 +106,8 @@ ObjectTreeView::ObjectTreeView(ProjectPanel* project,
setExpandsOnDoubleClick(false);
setDragEnabled(true);
item_before_drag_started=NULL;
lastSelected = NULL;
item_before_drag_started=nullptr;
lastSelected = nullptr;
second_click = false;
selectionFrozen = false;
expandOrCollapse = false;
@ -216,16 +216,16 @@ bool ObjectTreeView::event( QEvent *event )
{
int cx = pos.x(), cy = pos.y();
FWObject *obj=NULL;
FWObject *obj=nullptr;
QRect cr;
QTreeWidgetItem *itm = itemAt(QPoint(cx, cy - header()->height()));
if (itm==NULL) return false;
if (itm==nullptr) return false;
ObjectTreeViewItem *oivi = dynamic_cast<ObjectTreeViewItem*>(itm);
assert(oivi!=NULL);
assert(oivi!=nullptr);
obj = oivi->getFWObject();
if (obj==NULL) return false;
if (obj==nullptr) return false;
if (obj->getId() == FWObjectDatabase::ANY_ADDRESS_ID ||
obj->getId() == FWObjectDatabase::ANY_SERVICE_ID ||
@ -268,7 +268,7 @@ void ObjectTreeView::itemCollapsed(QTreeWidgetItem* itm)
expandOrCollapse = true;
ObjectTreeViewItem *otvi = dynamic_cast<ObjectTreeViewItem*>(itm);
assert(otvi!=NULL);
assert(otvi!=nullptr);
FWObject *o = otvi->getFWObject();
if (o)
{
@ -282,7 +282,7 @@ void ObjectTreeView::itemExpanded(QTreeWidgetItem* itm)
expandOrCollapse = true;
ObjectTreeViewItem *otvi=dynamic_cast<ObjectTreeViewItem*>(itm);
assert(otvi!=NULL);
assert(otvi!=nullptr);
FWObject *o = otvi->getFWObject();
if (o)
{
@ -319,7 +319,7 @@ FWObject* ObjectTreeView::getCurrentObject()
{
QTreeWidgetItem *ovi = currentItem();
ObjectTreeViewItem *otvi=dynamic_cast<ObjectTreeViewItem*>(ovi);
if (otvi==NULL) return NULL;
if (otvi==nullptr) return nullptr;
return otvi->getFWObject();
}
@ -347,7 +347,7 @@ void ObjectTreeView::updateTreeIcons()
FWObject *obj = otvi->getFWObject();
/* We can have obj==0 if it's a user-create subfolder */
if (obj == 0) continue;
if (obj == nullptr) continue;
QPixmap pm_obj;
IconSetter::setObjectIcon(obj, &pm_obj, 0);
@ -359,12 +359,12 @@ void ObjectTreeView::updateTreeIcons()
void ObjectTreeView::startDrag(Qt::DropActions supportedActions)
{
QTreeWidgetItem *ovi = currentItem();
if (ovi==NULL) return;
if (ovi==nullptr) return;
FWObject *current_obj = getCurrentObject();
/* User-defined folders can't be dragged */
if (current_obj == 0) return;
if (current_obj == nullptr) return;
if (fwbdebug) qDebug("ObjectTreeView::startDrag: this: %p current_obj: %s",
this, current_obj->getName().c_str());
@ -481,22 +481,22 @@ void ObjectTreeView::dragEnterEvent( QDragEnterEvent *ev)
static bool isValidDropTarget(QTreeWidgetItem *item, list<FWObject *> &objs)
{
ObjectTreeViewItem *dest = dynamic_cast<ObjectTreeViewItem *>(item);
if (dest == 0) return false;
if (dest == nullptr) return false;
bool dragIsNoop = true;
list<FWObject *>::const_iterator iter;
for (iter = objs.begin(); iter != objs.end(); ++iter) {
FWObject *dragobj = *iter;
assert(dragobj != 0);
assert(dragobj != nullptr);
if (Interface::cast(dragobj) != 0 ||
Interface::cast(dragobj->getParent()) != 0 ||
Policy::cast(dragobj) != 0 ||
NAT::cast(dragobj) != 0 ||
Routing::cast(dragobj) != 0) return false;
if (Interface::cast(dragobj) != nullptr ||
Interface::cast(dragobj->getParent()) != nullptr ||
Policy::cast(dragobj) != nullptr ||
NAT::cast(dragobj) != nullptr ||
Routing::cast(dragobj) != nullptr) return false;
/* See if destination is a user folder */
if (dest->getUserFolderParent() != 0) {
if (dest->getUserFolderParent() != nullptr) {
/* Dragged object has to match parent of user folder */
if (dest->getUserFolderParent() != dragobj->getParent()) {
return false;
@ -548,11 +548,11 @@ void ObjectTreeView::dragMoveEvent(QDragMoveEvent *ev)
void ObjectTreeView::dropEvent(QDropEvent *ev)
{
// only accept drops from the same instance of fwbuilder
if (ev->source() == NULL) return;
if (ev->source() == nullptr) return;
ObjectTreeViewItem *dest =
dynamic_cast<ObjectTreeViewItem *>(itemAt(ev->pos()));
if (dest == 0) {
if (dest == nullptr) {
notWanted:
ev->setAccepted(false);
return;
@ -581,7 +581,7 @@ void ObjectTreeView::mouseMoveEvent( QMouseEvent * e )
clicks and tries to drag something non-draggable. */
if (state() == DragSelectingState) return;
QTreeWidget::mouseMoveEvent(e);
if (e==NULL) return;
if (e==nullptr) return;
}
void ObjectTreeView::mousePressEvent( QMouseEvent *e )
@ -659,7 +659,7 @@ void ObjectTreeView::mouseReleaseEvent( QMouseEvent *e )
qDebug("ObjectTreeView::mouseReleaseEvent 2 selectedObjects.size()=%d getCurrentObject()=%p current object %s",
int(selectedObjects.size()),
getCurrentObject(),
(getCurrentObject()!=NULL)?getCurrentObject()->getName().c_str():"nil");
(getCurrentObject()!=nullptr)?getCurrentObject()->getName().c_str():"nil");
if (expandOrCollapse) return; // user expanded or collapsed subtree,
// no need to change object in the editor
@ -742,7 +742,7 @@ void ObjectTreeView::itemOpened ()
void ObjectTreeView::clearLastSelected()
{
lastSelected = NULL;
lastSelected = nullptr;
}
@ -779,7 +779,7 @@ void ObjectTreeView::itemSelectionChanged()
ObjectTreeViewItem *otvi = dynamic_cast<ObjectTreeViewItem*>(itm);
FWObject *obj = otvi->getFWObject();
if (obj == 0) continue;
if (obj == nullptr) continue;
selectedObjects.push_back(otvi->getFWObject());
@ -824,7 +824,7 @@ void ObjectTreeView::ExpandTreeItems(const set<int> &ids)
QTreeWidgetItem *itm = *it;
ObjectTreeViewItem *otvi=dynamic_cast<ObjectTreeViewItem*>(itm);
FWObject *obj = otvi->getFWObject();
if (obj == 0) continue;
if (obj == nullptr) continue;
if (ids.count(obj->getId()))
itm->setExpanded(true);
}
@ -852,7 +852,7 @@ QSet<QTreeWidgetItem*> ObjectTreeView::resolveParents(QTreeWidgetItem *child)
{
QSet<QTreeWidgetItem*> parents;
parents.insert(child);
if (child->parent() == NULL) return parents;
if (child->parent() == nullptr) return parents;
parents.unite(resolveParents(child->parent()));
return parents;
}
@ -1013,7 +1013,7 @@ static bool filterMatches(const QString &text,
// Support for port and ip search
if (filterMatchesCommand(text, item)) return true;
if (item->getUserFolderParent() != 0) return false;
if (item->getUserFolderParent() != nullptr) return false;
FWObject *obj = item->getFWObject();
QByteArray utf8 = text.toUtf8();
@ -1079,12 +1079,12 @@ void ObjectTreeView::setFilter(QString text)
if (filterMatches(text, otvi)) {
(*wit)->setHidden(false);
if (Firewall::cast(otvi->getFWObject()) != 0) {
if (Firewall::cast(otvi->getFWObject()) != nullptr) {
expand.push_back(otvi);
}
QTreeWidgetItem *parent = (*wit)->parent();
while (parent != 0) {
while (parent != nullptr) {
parent->setHidden(false);
parent = parent->parent();
}

View File

@ -58,16 +58,16 @@ QVariant ObjectTreeViewItem::data(int column, int role) const
QFont item_font = QTreeWidgetItem::data(column, role).value<QFont>();
FWObject *obj = getFWObject();
Firewall *o = NULL;
Firewall *o = nullptr;
if (obj!=NULL && (
if (obj!=nullptr && (
getProperty("type")==Firewall::TYPENAME ||
getProperty("type")==Cluster::TYPENAME))
{
o = Firewall::cast( obj );
}
if (o!=NULL)
if (o!=nullptr)
{
bool mf = !o->getInactive() && (o->needsCompile()) ;
item_font.setBold (mf);
@ -84,12 +84,12 @@ QVariant ObjectTreeViewItem::data(int column, int role) const
static int getRank(FWObject *obj)
{
/* User-defined folders are first */
if (obj == 0) return 0;
if (obj == nullptr) return 0;
if (Interface::cast(obj) != 0) return 5;
if (Policy::cast(obj) != 0) return 2;
if (NAT::cast(obj) != 0) return 3;
if (Routing::cast(obj) != 0) return 4;
if (Interface::cast(obj) != nullptr) return 5;
if (Policy::cast(obj) != nullptr) return 2;
if (NAT::cast(obj) != nullptr) return 3;
if (Routing::cast(obj) != nullptr) return 4;
return 1;
}

View File

@ -57,7 +57,7 @@ PhysicalAddressDialog::PhysicalAddressDialog(QWidget *parent) : BaseObjectDialog
{
m_dialog = new Ui::PhysAddressDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -71,7 +71,7 @@ void PhysicalAddressDialog::loadFWObject(FWObject *o)
{
obj=o;
physAddress *s = dynamic_cast<physAddress*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;
@ -105,7 +105,7 @@ void PhysicalAddressDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
physAddress *s = dynamic_cast<physAddress*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname=obj->getName();
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );

View File

@ -115,28 +115,28 @@ list<FWObject*> PrintingController::findAllUsedByType(list<FWObject*> &result,
FWObject *obj,
const string &type_name)
{
if (RuleElement::cast(obj)!=NULL)
if (RuleElement::cast(obj)!=nullptr)
{
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
{
FWObject *o=*m;
if (FWReference::cast(o)!=NULL)
if (FWReference::cast(o)!=nullptr)
o=FWReference::cast(o)->getPointer();
if (o->getTypeName()==type_name)
result.push_back(o);
}
}
if (RuleSet::cast(obj)!=NULL)
if (RuleSet::cast(obj)!=nullptr)
{
for (list<FWObject*>::iterator m=obj->begin(); m!=obj->end(); m++)
{
if (Rule::cast(*m)!=NULL)
if (Rule::cast(*m)!=nullptr)
{
for (list<FWObject*>::iterator n=(*m)->begin();
n!=(*m)->end(); n++)
{
if (RuleElement::cast(*n)!=NULL)
if (RuleElement::cast(*n)!=nullptr)
{
findAllUsedByType(result,*n,type_name);
}
@ -149,7 +149,7 @@ list<FWObject*> PrintingController::findAllUsedByType(list<FWObject*> &result,
{
FWObject *ruleSet;
const char* const child_types[] =
{Policy::TYPENAME, NAT::TYPENAME, Routing::TYPENAME, NULL};
{Policy::TYPENAME, NAT::TYPENAME, Routing::TYPENAME, nullptr};
for (const char* const *cptr = child_types; *cptr; ++cptr)
{
for (FWObjectTypedChildIterator it = obj->findByType(*cptr);
@ -179,9 +179,9 @@ int PrintingController::addObjectsToTable(list<FWObject*> &objects,
for (list<FWObject*>::iterator i=objects.begin(); i!=objects.end(); ++i)
{
if (Address::cast(*i)!=NULL && Address::cast(*i)->isAny()) continue;
if (Service::cast(*i)!=NULL && Service::cast(*i)->isAny()) continue;
if (Interval::cast(*i)!=NULL && Interval::cast(*i)->isAny()) continue;
if (Address::cast(*i)!=nullptr && Address::cast(*i)->isAny()) continue;
if (Service::cast(*i)!=nullptr && Service::cast(*i)->isAny()) continue;
if (Interval::cast(*i)!=nullptr && Interval::cast(*i)->isAny()) continue;
if (col>=tbl->columnCount())
{
@ -261,8 +261,8 @@ void PrintingController::findAllGroups(list<FWObject*> &objects,
{
if (fwbdebug) qDebug(" %s",(*obj)->getName().c_str());
FWObject *o = *obj;
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
if (Group::cast(o)!=NULL &&
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
if (Group::cast(o)!=nullptr &&
std::find(groups.begin(),groups.end(),o)==groups.end())
{
groups.push_back(o);
@ -287,7 +287,7 @@ void PrintingController::printRuleSet(FWObject *fw,
pr->printText(name);
RuleSetView *ruleView = RuleSetView::getRuleSetViewByType(
project, ruleset, NULL);
project, ruleset, nullptr);
ruleView->setSizePolicy( QSizePolicy( (QSizePolicy::Policy)7,
(QSizePolicy::Policy)7) );
ruleView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -311,7 +311,7 @@ void PrintingController::printRuleSet(FWObject *fw,
void PrintingController::printFirewall(FWObject *fw, ProjectPanel *project)
{
if (Firewall::cast(fw)==NULL) return ;
if (Firewall::cast(fw)==nullptr) return ;
string platform = fw->getStr("platform");
string version = fw->getStr("version");
@ -328,7 +328,7 @@ void PrintingController::printFirewall(FWObject *fw, ProjectPanel *project)
pr->printText(QObject::tr("Host OS: ") + hostOS.c_str());
const char* const child_types[] =
{Policy::TYPENAME, NAT::TYPENAME, Routing::TYPENAME, NULL};
{Policy::TYPENAME, NAT::TYPENAME, Routing::TYPENAME, nullptr};
for (const char* const *cptr = child_types; *cptr; ++cptr)
{
@ -543,7 +543,7 @@ void PrintingController::printObjects(FWObject *firewall_to_print,
j!=(*obj)->end(); ++j)
{
FWObject *o = *j;
if (FWReference::cast(o)!=NULL)
if (FWReference::cast(o)!=nullptr)
o=FWReference::cast(o)->getPointer();
groupMembers.push_back(o);
}

View File

@ -70,17 +70,17 @@ bool ProjectPanel::event(QEvent *event)
<< "rcs:"
<< rcs
<< "rcs->getFileName():"
<< QString((rcs!=NULL) ? rcs->getFileName() : "")
<< QString((rcs!=nullptr) ? rcs->getFileName() : "")
<< "file:"
<< data_file
<< "event:"
<< ev->getEventName()
<< "object:"
<< ((obj!=NULL) ? QString::fromUtf8(obj->getName().c_str()) : "")
<< "(" << ((obj!=NULL) ? obj->getTypeName().c_str() : "") << ")"
<< "id=" << ((obj!=NULL) ? obj->getId() : -1);
<< ((obj!=nullptr) ? QString::fromUtf8(obj->getName().c_str()) : "")
<< "(" << ((obj!=nullptr) ? obj->getTypeName().c_str() : "") << ")"
<< "id=" << ((obj!=nullptr) ? obj->getId() : -1);
if (event_code == UPDATE_GUI_STATE_EVENT && mdiWindow != NULL)
if (event_code == UPDATE_GUI_STATE_EVENT && mdiWindow != nullptr)
{
m_panel->om->updateCreateObjectMenu(getCurrentLib());
ev->accept();
@ -126,7 +126,7 @@ bool ProjectPanel::event(QEvent *event)
return true;
}
if (obj == NULL) return false;
if (obj == nullptr) return false;
switch (event_code)
{
@ -136,7 +136,7 @@ bool ProjectPanel::event(QEvent *event)
// this purely data structure update event.
FWObject *p = obj;
while (p && Firewall::cast(p)==NULL) p = p->getParent();
while (p && Firewall::cast(p)==nullptr) p = p->getParent();
Firewall *f = Firewall::cast(p);
// when user locks firewall object, this code tries to
// update last_modified timestamp in it because it
@ -157,10 +157,10 @@ bool ProjectPanel::event(QEvent *event)
case UPDATE_OBJECT_EVERYWHERE_EVENT:
{
Rule *rule = NULL;
RuleSet* current_ruleset = NULL;
Rule *rule = nullptr;
RuleSet* current_ruleset = nullptr;
RuleSetView* rsv = getCurrentRuleSetView();
RuleSetModel* md = NULL;
RuleSetModel* md = nullptr;
if (rsv)
{
md = (RuleSetModel*)rsv->model();
@ -250,7 +250,7 @@ bool ProjectPanel::event(QEvent *event)
// update events below will only be processed if MDI
// window exists.
if (mdiWindow == NULL) return false;
if (mdiWindow == nullptr) return false;
switch (event->type() - QEvent::User)
{
@ -326,9 +326,9 @@ bool ProjectPanel::event(QEvent *event)
FWReference *ref = FWReference::cast(obj);
if (ref)
{
RuleSet* current_ruleset = NULL;
RuleSet* current_ruleset = nullptr;
RuleSetView* rsv = getCurrentRuleSetView();
RuleSetModel* md = NULL;
RuleSetModel* md = nullptr;
if (rsv)
{
md = (RuleSetModel*)rsv->model();
@ -343,7 +343,7 @@ bool ProjectPanel::event(QEvent *event)
} else
{
FWObject *rs = obj;
while (rs && RuleSet::cast(rs)==NULL) rs = rs->getParent();
while (rs && RuleSet::cast(rs)==nullptr) rs = rs->getParent();
if (rs)
{
// reopen rule set right now, before we post event
@ -371,9 +371,9 @@ bool ProjectPanel::event(QEvent *event)
Rule *rule = Rule::cast(obj);
if (rule)
{
RuleSet* current_ruleset = NULL;
RuleSet* current_ruleset = nullptr;
RuleSetView* rsv = getCurrentRuleSetView();
RuleSetModel* md = NULL;
RuleSetModel* md = nullptr;
if (rsv)
{
md = (RuleSetModel*)rsv->model();

View File

@ -116,7 +116,7 @@ bool ProjectPanel::saveIfModified(bool include_discard_button)
switch (QMessageBox::information(this, "Firewall Builder",
message,
tr("&Save"),tr("&Cancel"),
0, // Enter = button 0
nullptr, // Enter = button 0
1 ) ) // Escape == button 1
{
case 0:
@ -175,7 +175,7 @@ QString ProjectPanel::chooseNewFileName(const QString &fname,
void ProjectPanel::fileProp()
{
if (rcs!=NULL)
if (rcs!=nullptr)
{
filePropDialog fpd(this,rcs);
fpd.setPrinter(mainW->getPrinter());
@ -193,12 +193,12 @@ bool ProjectPanel::fileNew()
if ( !nfn.isEmpty() )
{
//if (!saveIfModified() || !checkin(true)) return;
if (!systemFile && rcs!=NULL)
if (!systemFile && rcs!=nullptr)
fileClose(); // fileClose calls load(this)
else
loadStandardObjects();
visibleFirewall = NULL;
visibleFirewall = nullptr;
setFileName(nfn);
save();
setupAutoSave();
@ -210,10 +210,10 @@ bool ProjectPanel::fileNew()
if (fwbdebug)
qDebug("ProjectPanel::fileNew() rcs=%p rcs->getFileName()='%s'",
rcs, rcs == 0 ? "<null>" :
rcs, rcs == nullptr ? "<null>" :
rcs->getFileName().toLatin1().constData());
return (rcs!=NULL);
return (rcs!=nullptr);
}
bool ProjectPanel::loadFile(const QString &fileName, bool load_rcs_head)
@ -241,7 +241,7 @@ bool ProjectPanel::loadFile(const QString &fileName, bool load_rcs_head)
if (!saveIfModified() || !checkin(true)) return false;
if (!systemFile && rcs!=NULL)
if (!systemFile && rcs!=nullptr)
{
if (mw->isEditorVisible()) mw->hideEditor();
reset();
@ -252,8 +252,8 @@ bool ProjectPanel::loadFile(const QString &fileName, bool load_rcs_head)
//if preview cannot give RCS,
//get a new RCS from file dialog
if (new_rcs==NULL) new_rcs = new RCS(fileName);
if (new_rcs==NULL) return false;
if (new_rcs==nullptr) new_rcs = new RCS(fileName);
if (new_rcs==nullptr) return false;
try
{
@ -334,7 +334,7 @@ void ProjectPanel::fileSaveAs()
{
db()->setDirty(false); // so it wont ask if user wants to save
rcs->abandon();
if (rcs!=NULL) delete rcs;
if (rcs!=nullptr) delete rcs;
rcs = new RCS("");
setFileName(newFileName);
save();
@ -381,13 +381,13 @@ void ProjectPanel::fileDiscard()
if (mw->isEditorVisible()) mw->hideEditor();
if (rcs) delete rcs;
rcs=NULL;
rcs=nullptr;
FWObjectClipboard::obj_clipboard->clear();
firewalls.clear();
visibleFirewall = NULL;
visibleRuleSet = NULL;
visibleFirewall = nullptr;
visibleRuleSet = nullptr;
clearFirewallTabs();
clearObjects();
@ -715,20 +715,20 @@ bool ProjectPanel::exportLibraryTest(list<FWObject*> &selectedLibs)
if (std::find(selectedLibs.begin(),selectedLibs.end(),tgtlib)!=selectedLibs.end()) continue;
if (RuleElement::cast(pp)!=NULL)
if (RuleElement::cast(pp)!=nullptr)
{
FWObject *fw = pp;
FWObject *rule = pp;
FWObject *ruleset = pp;
FWObject *iface = pp;
while (rule!=NULL && Rule::cast(rule)==NULL)
while (rule!=nullptr && Rule::cast(rule)==nullptr)
rule=rule->getParent();
while (ruleset!=NULL && RuleSet::cast(ruleset)==NULL)
while (ruleset!=nullptr && RuleSet::cast(ruleset)==nullptr)
ruleset=ruleset->getParent();
while (iface!=NULL && Interface::cast(iface)==NULL)
while (iface!=nullptr && Interface::cast(iface)==nullptr)
iface=iface->getParent();
while (fw!=NULL && Firewall::cast(fw)==NULL)
while (fw!=nullptr && Firewall::cast(fw)==nullptr)
fw=fw->getParent();
s = QObject::tr("Library %1: Firewall '%2' (%3 rule #%4) uses "
@ -814,7 +814,7 @@ void ProjectPanel::exportLibraryTo(QString fname,list<FWObject*> &selectedLibs,
void ProjectPanel::setupAutoSave()
{
if ( st->getBool("Environment/autoSaveFile") &&
rcs!=NULL && rcs->getFileName()!="")
rcs!=nullptr && rcs->getFileName()!="")
{
int p = st->getInt("Environment/autoSaveFilePeriod");
autosaveTimer->start( p*1000*60 );
@ -828,7 +828,7 @@ void ProjectPanel::findExternalRefs(FWObject *lib,
list<FWReference*> &extRefs)
{
FWReference *ref=FWReference::cast(root);
if (ref!=NULL)
if (ref!=nullptr)
{
FWObject *plib = ref->getPointer()->getLibrary();
if ( plib->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
@ -851,7 +851,7 @@ void ProjectPanel::findExternalRefs(FWObject *lib,
FWObject* ProjectPanel::loadLibrary(const string &libfpath)
{
MessageBoxUpgradePredicate upgrade_predicate(mainW);
FWObject *last_new_lib = NULL;
FWObject *last_new_lib = nullptr;
try
{
@ -869,7 +869,7 @@ FWObject* ProjectPanel::loadLibrary(const string &libfpath)
++it)
{
FWObject *obj = ndb->findInIndex(*it);
assert(obj!=NULL);
assert(obj!=nullptr);
int new_id = FWObjectDatabase::generateUniqueId();
obj->setId(new_id);
id_mapping[*it] = new_id;
@ -1007,7 +1007,7 @@ bool ProjectPanel::loadFromRCS(RCS *_rcs)
MessageBoxUpgradePredicate upgrade_predicate(mainW);
assert(_rcs!=NULL);
assert(_rcs!=nullptr);
rcs = _rcs;
try
@ -1106,7 +1106,7 @@ bool ProjectPanel::loadFromRCS(RCS *_rcs)
* read-only.
*/
FWObject *slib = objdb->findInIndex(FWObjectDatabase::STANDARD_LIB_ID);
if (slib!=NULL )
if (slib!=nullptr )
{
if (fwbdebug)
qDebug("standard library read-only status: %d, "
@ -1310,7 +1310,7 @@ bool ProjectPanel::checkin(bool unlock)
/* doing checkin only if we did checkout so rcs!=NULL */
QString rlog="";
if (systemFile || rcs==NULL || !rcs->isCheckedOut() || rcs->isTemp())
if (systemFile || rcs==nullptr || !rcs->isCheckedOut() || rcs->isTemp())
return true;
if (rcs->isDiff())

View File

@ -50,7 +50,7 @@ using namespace std;
void ProjectPanel::saveState()
{
QString file_name ;
if (rcs!=NULL) file_name = rcs->getFileName();
if (rcs!=nullptr) file_name = rcs->getFileName();
if (fwbdebug)
qDebug( ) << "ProjectPanel::saveState " << this
<< "title " << mdiWindow->windowTitle()
@ -83,7 +83,7 @@ void ProjectPanel::saveState()
void ProjectPanel::loadState(bool)
{
if (rcs==NULL) return;
if (rcs==nullptr) return;
QString filename = rcs->getFileName();
// This function can end up being called recursively because some
@ -106,7 +106,7 @@ void ProjectPanel::loadState(bool)
if (!mdiWindow->isMaximized() && mdiWindow)
{
if (fwbdebug) qDebug("ProjectPanel::loadState show normal");
setWindowState(0);
setWindowState(nullptr);
int x = st->getInt("Window/"+filename+"/x");
int y = st->getInt("Window/"+filename+"/y");
int width = st->getInt("Window/"+filename+"/width");
@ -144,7 +144,7 @@ void ProjectPanel::loadState(bool)
void ProjectPanel::saveMainSplitter()
{
QString fileName ;
if (rcs!=NULL) fileName = rcs->getFileName();
if (rcs!=nullptr) fileName = rcs->getFileName();
#ifdef TREE_IS_DOCKABLE
// Save position of splitters regardless of the window state
@ -182,7 +182,7 @@ void ProjectPanel::saveMainSplitter()
void ProjectPanel::loadMainSplitter()
{
QString fileName ;
if (rcs!=NULL) fileName = rcs->getFileName();
if (rcs!=nullptr) fileName = rcs->getFileName();
if (fwbdebug)
qDebug() << QString("ProjectPanel::loadMainSplitter() filename=%1")
@ -242,10 +242,10 @@ void ProjectPanel::collapseRules()
void ProjectPanel::loadOpenedRuleSet()
{
if (rcs==NULL) return;
if (rcs==nullptr) return;
QString filename = rcs->getFileName();
if (m_panel->om->getCurrentLib() == NULL) return;
if (m_panel->om->getCurrentLib() == nullptr) return;
int id = st->getVisibleRuleSetId(
filename, m_panel->om->getCurrentLib()->getName().c_str());
@ -276,10 +276,10 @@ void ProjectPanel::loadOpenedRuleSet()
void ProjectPanel::saveOpenedRuleSet()
{
if (rcs==NULL) return;
if (rcs==nullptr) return;
QString filename = rcs->getFileName();
if (visibleRuleSet!=NULL)
if (visibleRuleSet!=nullptr)
{
st->setVisibleRuleSet(filename,
visibleRuleSet->getLibrary()->getName().c_str(),
@ -291,10 +291,10 @@ void ProjectPanel::saveOpenedRuleSet()
void ProjectPanel::saveLastOpenedLib()
{
QString filename = "";
if (rcs!=NULL) filename = rcs->getFileName();
if (rcs!=nullptr) filename = rcs->getFileName();
FWObject* obj = m_panel->om->getCurrentLib();
if (obj!=NULL)
if (obj!=nullptr)
{
std::string sid = FWObjectDatabase::getStringId(obj->getId());
st->setStr("Window/" + filename + "/LastLib", sid.c_str() );
@ -307,7 +307,7 @@ void ProjectPanel::loadLastOpenedLib()
if (fwbdebug) qDebug("ProjectPanel::loadLastOpenedLib()");
QString filename = "";
if (rcs!=NULL) filename = rcs->getFileName();
if (rcs!=nullptr) filename = rcs->getFileName();
QString sid = st->getStr("Window/" + filename + "/LastLib");
if (filename!="" && sid!="")
{
@ -334,7 +334,7 @@ void ProjectPanel::loadLastOpenedLib()
void ProjectPanel::loadFirstNonStandardLib()
{
list<FWObject*> all_libs = db()->getByType(Library::TYPENAME);
FWObject *first_non_system_lib = NULL;
FWObject *first_non_system_lib = nullptr;
for (list<FWObject*>::iterator i=all_libs.begin(); i!=all_libs.end(); ++i)
{
int lib_id = (*i)->getId();
@ -342,7 +342,7 @@ void ProjectPanel::loadFirstNonStandardLib()
if (lib_id == FWObjectDatabase::STANDARD_LIB_ID) continue;
if (lib_id == FWObjectDatabase::TEMPLATE_LIB_ID) continue;
if (first_non_system_lib==NULL) first_non_system_lib = (*i);
if (first_non_system_lib==nullptr) first_non_system_lib = (*i);
if ((*i)->getName()=="User")
{
first_non_system_lib = *i;

View File

@ -83,7 +83,7 @@ RCSFilePreview::RCSFilePreview(QWidget *parent): QDialog(parent)
if (fwbdebug) qDebug("RCSFilePreview: constructor done");
rcs = NULL;
rcs = nullptr;
RO = false;
}
@ -96,7 +96,7 @@ RCSFilePreview::~RCSFilePreview()
void RCSFilePreview::openReadOnly()
{
if (rcs!=NULL) rcs->setRO(true);
if (rcs!=nullptr) rcs->setRO(true);
RO = true;
accept();
}
@ -111,7 +111,7 @@ void RCSFilePreview::selectedRevision(QTreeWidgetItem *itm)
if (itm == m_widget->RCSTreeView->topLevelItem(0)) return;
QString rev = itm->text(0);
assert(rcs!=NULL);
assert(rcs!=nullptr);
rcs->setSelectedRev(rev);
m_widget->comment->setText( rcsComments[rev] );
if (fwbdebug)
@ -131,7 +131,7 @@ bool RCSFilePreview::showFileRLog( const QString &filename )
m_widget->RCSTreeView->clear();
if (rcs!=NULL) delete rcs;
if (rcs!=nullptr) delete rcs;
rcs = new RCS(filename);
if (rcs->revisions.size()==0)
@ -155,8 +155,8 @@ bool RCSFilePreview::showFileRLog( const QString &filename )
QList<Revision>::iterator i;
QList<RCSViewItem*> itemList;
QList<RCSViewItem*>::iterator ili;
RCSViewItem* latest_revision_item = NULL;
RCSViewItem* latest_date_item = NULL;
RCSViewItem* latest_revision_item = nullptr;
RCSViewItem* latest_date_item = nullptr;
string latest_revision = "1.0";
QString latest_date = "";
@ -164,7 +164,7 @@ bool RCSFilePreview::showFileRLog( const QString &filename )
{
rcsComments[(*i).rev] = (*i).log;
RCSViewItem *itm = NULL;
RCSViewItem *itm = nullptr;
if (st->getRCSFilePreviewStyle()==1)
{
// List style
@ -187,7 +187,7 @@ bool RCSFilePreview::showFileRLog( const QString &filename )
if ((*ili)->text(0) == branch_root)
{
QTreeWidgetItem *br = *ili;
if (br!=NULL) itm = addRevision((*i), br);
if (br!=nullptr) itm = addRevision((*i), br);
}
}
}
@ -222,7 +222,7 @@ bool RCSFilePreview::showFileRLog( const QString &filename )
SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(selectedRevision(QTreeWidgetItem*)));
RCSViewItem* show_item = NULL;
RCSViewItem* show_item = nullptr;
if (m_widget->RCSTreeView->sortColumn()==0 && latest_revision_item)
show_item = latest_revision_item;

View File

@ -81,7 +81,7 @@ RuleOptionsDialog::RuleOptionsDialog(QWidget *parent) :
connectSignalsOfAllWidgetsToSlotChange();
firewall = NULL;
firewall = nullptr;
init=false;
}
@ -425,7 +425,7 @@ void RuleOptionsDialog::applyChanges()
{
FWObject *tag_object = m_dialog->iptTagDropArea->getObject();
// if tag_object==NULL, setTagObject clears setting in the rule
policy_rule->setTagging(tag_object != NULL);
policy_rule->setTagging(tag_object != nullptr);
policy_rule->setTagObject(tag_object);
policy_rule->setClassification(
@ -440,7 +440,7 @@ void RuleOptionsDialog::applyChanges()
{
FWObject *tag_object = m_dialog->pfTagDropArea->getObject();
// if tag_object==NULL, setTagObject clears setting in the rule
policy_rule->setTagging(tag_object != NULL);
policy_rule->setTagging(tag_object != nullptr);
policy_rule->setTagObject(tag_object);
policy_rule->setClassification(

View File

@ -91,7 +91,7 @@ RuleSetDiffDialog::RuleSetDiffDialog(ProjectPanel *project, QWidget *parent) :
Library* RuleSetDiffDialog::findUserLibrary(FWObjectDatabase *db)
{
Library *lib = NULL;
Library *lib = nullptr;
foreach (FWObject *obj, db->getByType(Library::TYPENAME))
{
if (obj->getName() == "User")

View File

@ -209,7 +209,7 @@ void RuleSetViewDelegate::paintRule(QPainter *painter,
QVariant v = index.data(Qt::DisplayRole);
if (!v.isValid()) return;
if (node != 0)
if (node != nullptr)
{
QString color = getRuleColor(node);
if (!color.isEmpty())
@ -352,7 +352,7 @@ void RuleSetViewDelegate::paintObject(
//if (fwbdebug) qDebug() << "RuleSetViewDelegate::paintObject";
RuleElement *re = (RuleElement *)v.value<void *>();
if (re==NULL) return;
if (re==nullptr) return;
DrawingContext ctx = initContext(option.rect, true);
@ -361,7 +361,7 @@ void RuleSetViewDelegate::paintObject(
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
{
FWObject *o1 = FWReference::getObject(*i);
if (o1==NULL) continue ;
if (o1==nullptr) continue ;
QRect itemRect = QRect(ctx.objectRect.left(), y, ctx.objectRect.width(), ctx.itemHeight);
@ -578,7 +578,7 @@ QSize RuleSetViewDelegate::calculateCellSizeForComment(const QModelIndex & index
QSize RuleSetViewDelegate::calculateCellSizeForObject(const QModelIndex & index) const
{
RuleElement *re = (RuleElement *)index.data(Qt::DisplayRole).value<void *>();
if (re == 0) return QSize(0,0);
if (re == nullptr) return QSize(0,0);
int itemHeight = getItemHeight();
QSize iconSize = getIconSize();
@ -591,12 +591,12 @@ QSize RuleSetViewDelegate::calculateCellSizeForObject(const QModelIndex & index)
FWObject *o1= *j;
FWObject *o2 = o1;
string o1ref = "";
if (FWReference::cast(o1)!=NULL)
if (FWReference::cast(o1)!=nullptr)
{
o1ref = FWReference::cast(o1)->getPointerId();
o2=FWReference::cast(o1)->getPointer();
}
if (o2!=NULL)
if (o2!=nullptr)
{
QString ot = objectText(re,o2);

View File

@ -73,7 +73,7 @@ StartTipDialog::StartTipDialog(QWidget *parent): QDialog(parent)
// we use separate Help() object for the tip of the day becayse it should
// have different size and should not be persistent
Help *h = new Help(NULL, "");
Help *h = new Help(nullptr, "");
int tip_no = 1;
while (true)
{

View File

@ -56,7 +56,7 @@ TCPServiceDialog::TCPServiceDialog(QWidget *parent) : BaseObjectDialog(parent)
m_dialog = new Ui::TCPServiceDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -70,7 +70,7 @@ void TCPServiceDialog::loadFWObject(FWObject *o)
{
obj=o;
TCPService *s = dynamic_cast<TCPService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;

View File

@ -64,7 +64,7 @@ TagServiceDialog::TagServiceDialog(QWidget *parent) : BaseObjectDialog(parent)
{
m_dialog = new Ui::TagServiceDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -73,7 +73,7 @@ void TagServiceDialog::loadFWObject(FWObject *o)
{
obj=o;
TagService *s = dynamic_cast<TagService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;
@ -98,7 +98,7 @@ void TagServiceDialog::validate(bool *res)
{
*res=true;
TagService *s = dynamic_cast<TagService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
}
@ -111,7 +111,7 @@ void TagServiceDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
TagService *s = dynamic_cast<TagService*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname = obj->getName();
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );

View File

@ -32,10 +32,10 @@
#include <QFile>
#include "FWBApplication.h"
TutorialDialog * TutorialDialog::dialog = NULL;
TutorialDialog * TutorialDialog::dialog = nullptr;
TutorialDialog::TutorialDialog(QString tutorial, QWidget *parent) :
QDialog(NULL),
QDialog(nullptr),
ui(new Ui::TutorialDialog_q)
{
Q_UNUSED(parent)
@ -50,7 +50,7 @@ TutorialDialog::TutorialDialog(QString tutorial, QWidget *parent) :
void TutorialDialog::showTutorial(QString tutorial)
{
if (dialog != NULL)
if (dialog != nullptr)
{
dialog->initializeTutorial(tutorial);
dialog->showNormal();

View File

@ -55,7 +55,7 @@ UDPServiceDialog::UDPServiceDialog(QWidget *parent) : BaseObjectDialog(parent)
m_dialog = new Ui::UDPServiceDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -69,7 +69,7 @@ void UDPServiceDialog::loadFWObject(FWObject *o)
{
obj=o;
UDPService *s = dynamic_cast<UDPService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;

View File

@ -56,7 +56,7 @@ UserDialog::UserDialog(QWidget *parent) : BaseObjectDialog(parent)
{
m_dialog = new Ui::UserDialog_q;
m_dialog->setupUi(this);
obj=NULL;
obj=nullptr;
connectSignalsOfAllWidgetsToSlotChange();
}
@ -67,7 +67,7 @@ void UserDialog::loadFWObject(FWObject *o)
{
obj=o;
UserService *s = dynamic_cast<UserService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
init=true;
@ -94,7 +94,7 @@ void UserDialog::validate(bool *res)
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
UserService *s = dynamic_cast<UserService*>(obj);
assert(s!=NULL);
assert(s!=nullptr);
}
@ -105,7 +105,7 @@ void UserDialog::applyChanges()
FWObject* new_state = cmd->getNewState();
UserService *s = dynamic_cast<UserService*>(new_state);
assert(s!=NULL);
assert(s!=nullptr);
string oldname = obj->getName();
s->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );

View File

@ -52,7 +52,7 @@ bsdIfaceOptsDialog::bsdIfaceOptsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *ifopt = (Interface::cast(obj))->getOptionsObject();
cluster_interface = (Cluster::cast(obj->getParent()) != NULL);
cluster_interface = (Cluster::cast(obj->getParent()) != nullptr);
setInterfaceTypes(m_dialog->iface_type, Interface::cast(obj),
ifopt->getStr("type").c_str());
@ -108,7 +108,7 @@ void bsdIfaceOptsDialog::accept()
// new_state is a copy of the interface object
FWObject* new_state = cmd->getNewState();
FWOptions* ifopt = Interface::cast(new_state)->getOptionsObject();
assert(ifopt!=NULL);
assert(ifopt!=nullptr);
if (cluster_interface)
{

View File

@ -52,7 +52,7 @@ carpOptionsDialog::carpOptionsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *gropt = FWOptions::cast(obj);
assert(gropt != NULL);
assert(gropt != nullptr);
data.registerOption(m_dialog->carp_password,
gropt,

View File

@ -60,14 +60,14 @@ clusterMembersDialog::clusterMembersDialog(QWidget *parent, FWObject *o)
// if empty, retry with parent of parent (interface level)
if (host_os.isEmpty())
{
FWObject *parent = NULL;
FWObject *parent = nullptr;
parent = obj->getParent();
if (parent == NULL)
if (parent == nullptr)
{
throw FWException("clusterMembersDialog: parent is NULL!");
}
parent = parent->getParent();
if (parent == NULL)
if (parent == nullptr)
{
throw FWException("clusterMembersDialog: parent is NULL!");
}
@ -120,9 +120,9 @@ void clusterMembersDialog::getSelectedMembers()
{
// get fw and interface pointer from interface reference
Interface *iface = NULL;
Interface *iface = nullptr;
iface = Interface::cast(FWReference::cast((*it))->getPointer());
assert(iface != NULL);
assert(iface != nullptr);
Firewall *fw = Firewall::cast(Host::getParentHost(iface));
//Firewall *fw = Firewall::cast(iface->getParentHost());
@ -135,7 +135,7 @@ void clusterMembersDialog::getSelectedMembers()
}
// create ClusterMember object
ClusterMember *new_member = createMember(fw, iface, master);
if (new_member == NULL)
if (new_member == nullptr)
{
qWarning() << "clusterMembersDialog: could not create new "
"cluster member";
@ -183,7 +183,7 @@ void clusterMembersDialog::getPossibleMembers()
// valid member, add to member list
ClusterMember *new_member = createMember(fw);
if (new_member == NULL)
if (new_member == nullptr)
{
qWarning() << "clusterMembersDialog: could not create new "
"cluster member";
@ -200,7 +200,7 @@ void clusterMembersDialog::updateSelectedTable()
table_update = true;
m_dialog->fwSelectedTable->setRowCount(selected.size());
QTableWidgetItem *item = NULL;
QTableWidgetItem *item = nullptr;
int row = 0;
for (t_memberList::const_iterator it = selected.begin();
it != selected.end(); it++)
@ -211,7 +211,7 @@ void clusterMembersDialog::updateSelectedTable()
item = m_dialog->fwSelectedTable->item(row, 0);
const char *new_text = (*it)->fwobj->getName().c_str();
if (item == NULL)
if (item == nullptr)
{
item = new QTableWidgetItem;
item->setText(new_text);
@ -226,7 +226,7 @@ void clusterMembersDialog::updateSelectedTable()
// Column "Interface"
item = m_dialog->fwSelectedTable->item(row, 1);
new_text = (*it)->iface_cluster->getName().c_str();
if (item == NULL)
if (item == nullptr)
{
item = new QTableWidgetItem;
item->setText(new_text);
@ -241,7 +241,7 @@ void clusterMembersDialog::updateSelectedTable()
// Column "Master"
item = m_dialog->fwSelectedTable->item(row, 2);
Qt::CheckState state = (*it)->is_master ? Qt::Checked : Qt::Unchecked;
if (item == NULL)
if (item == nullptr)
{
item = new QTableWidgetItem;
item->setCheckState(state);
@ -305,15 +305,15 @@ ClusterMember*
clusterMembersDialog::createMember(Firewall *fw,
Interface *cluster_iface, bool master)
{
if (fw == NULL)
if (fw == nullptr)
{
return NULL;
return nullptr;
}
ClusterMember *new_member = new ClusterMember;
new_member->fwobj = fw;
new_member->is_master = master;
if (cluster_iface != NULL)
if (cluster_iface != nullptr)
{
new_member->iface_cluster = cluster_iface;
}

View File

@ -50,13 +50,13 @@ conntrackOptionsDialog::conntrackOptionsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *gropt = FWOptions::cast(obj);
assert(gropt != NULL);
assert(gropt != nullptr);
FWObject *p = obj;
while (p && Cluster::cast(p)==NULL) p = p->getParent();
assert(p != NULL);
while (p && Cluster::cast(p)==nullptr) p = p->getParent();
assert(p != nullptr);
Cluster *cluster = Cluster::cast(p);
Resources *os_res = Resources::os_res[cluster->getStr("host_OS")];
assert(os_res != NULL);
assert(os_res != nullptr);
string default_address =
os_res->getResourceStr("/FWBuilderResources/Target/protocols/conntrack/default_address");
@ -125,7 +125,7 @@ bool conntrackOptionsDialog::validate()
QMessageBox::critical(
this, "Firewall Builder",
tr("Invalid IP address '%1'").arg(m_dialog->conntrack_address->text()),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
return false;
}

View File

@ -60,10 +60,10 @@ freebsdAdvancedDialog::freebsdAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
QStringList threeStateMapping;
@ -117,7 +117,7 @@ void freebsdAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions *fwopt=(Firewall::cast(new_state))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
data.saveAll(fwopt);

View File

@ -50,13 +50,13 @@ heartbeatOptionsDialog::heartbeatOptionsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *gropt = FWOptions::cast(obj);
assert(gropt != NULL);
assert(gropt != nullptr);
FWObject *p = obj;
while (p && Cluster::cast(p)==NULL) p = p->getParent();
assert(p != NULL);
while (p && Cluster::cast(p)==nullptr) p = p->getParent();
assert(p != nullptr);
Cluster *cluster = Cluster::cast(p);
Resources *os_res = Resources::os_res[cluster->getStr("host_OS")];
assert(os_res != NULL);
assert(os_res != nullptr);
string default_address =
os_res->getResourceStr(
@ -126,7 +126,7 @@ bool heartbeatOptionsDialog::validate()
QMessageBox::critical(
this, "Firewall Builder",
tr("Invalid IP address '%1'").arg(m_dialog->heartbeat_address->text()),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
return false;
}

View File

@ -71,7 +71,7 @@ void ChooseObjectsPage::initializePage()
} catch (FWException &ex)
{
QMessageBox::critical( NULL , "Firewall Builder",
QMessageBox::critical( nullptr , "Firewall Builder",
ex.toString().c_str(),
QString::null,QString::null);
}

View File

@ -63,7 +63,7 @@ void CreateObjectsPage::initializePage()
m_dialog->progressBar->setFormat("%v / %m");
m_dialog->progressBar->setMaximum(objects.size() / 2);
FWObject *last_object = NULL;
FWObject *last_object = nullptr;
QString name;
QString addr;
int counter = 1;
@ -95,7 +95,7 @@ void CreateObjectsPage::initializePage()
if (! type.isEmpty())
{
Address *obj = Address::cast(mw->createObject(type, name));
assert(obj!=NULL);
assert(obj!=nullptr);
obj->setName(name.toUtf8().constData());
obj->setAddress(InetAddr(addr.toStdString()));
obj->setNetmask(InetAddr(InetAddr::getAllOnes()));

View File

@ -63,7 +63,7 @@ bool IC_FileNamePage::validatePage()
if ( ! f.exists())
{
QMessageBox::critical( NULL , "Firewall Builder",
QMessageBox::critical( nullptr , "Firewall Builder",
tr("File %1 does not exist").arg(file_name),
QString::null,QString::null);
return false;
@ -71,7 +71,7 @@ bool IC_FileNamePage::validatePage()
if ( ! f.isReadable())
{
QMessageBox::critical( NULL , "Firewall Builder",
QMessageBox::critical( nullptr , "Firewall Builder",
tr("Can not read file %1").arg(file_name),
QString::null,QString::null);
return false;

View File

@ -111,7 +111,7 @@ void IC_NetworkZonesPage::setNetworkZones()
Firewall *fw =
dynamic_cast<ImportFirewallConfigurationWizard*>(wizard())->getFirewall();
if (fw == NULL) return;
if (fw == nullptr) return;
// read and configure network zones
list<FWObject*> all_interfaces = fw->getByTypeDeep(Interface::TYPENAME);
@ -128,11 +128,11 @@ void IC_NetworkZonesPage::setNetworkZones()
if ( ! ltwi.empty())
{
QTableWidgetItem *itm2 = ltwi[0];
assert(itm2!=NULL);
assert(itm2!=nullptr);
int row = itm2->row();
QComboBox *cb = dynamic_cast<QComboBox*>(
m_dialog->iface_nz_list->cellWidget(row, 3));
assert(cb!=NULL);
assert(cb!=nullptr);
int network_zone_int_id =
cb->itemData(cb->currentIndex(), Qt::UserRole).toInt();
if (network_zone_int_id != 0)

View File

@ -48,7 +48,7 @@ IC_ProgressPage::IC_ProgressPage(QWidget *parent) : QWizardPage(parent)
{
m_dialog = new Ui::IC_ProgressPage_q;
m_dialog->setupUi(this);
importer = NULL;
importer = nullptr;
errors_count = 0;
warnings_count = 0;
@ -76,7 +76,7 @@ IC_ProgressPage::~IC_ProgressPage()
{
disconnect(this, SLOT(logLine(QString)));
disconnect(this, SLOT(importerFinished()));
if (importer != NULL && importer->isRunning()) importer->stop();
if (importer != nullptr && importer->isRunning()) importer->stop();
}
int IC_ProgressPage::nextId() const
@ -103,20 +103,20 @@ bool IC_ProgressPage::validatePage()
<< "importer=" << importer
<< "isRunning=" << ((importer) ? importer->isRunning() : 0);
if (importer != NULL && importer->isRunning()) return false;
if (importer != nullptr && importer->isRunning()) return false;
return true;
}
bool IC_ProgressPage::isComplete() const
{
if (importer != NULL && importer->isRunning()) return false;
if (importer != nullptr && importer->isRunning()) return false;
return true;
}
void IC_ProgressPage::importerDestroyed(QObject *obj)
{
if (fwbdebug_ic) qDebug() << "IC_ProgressPage::importerDestroyed() obj=" << obj;
if (obj == importer) importer = NULL;
if (obj == importer) importer = nullptr;
}
void IC_ProgressPage::initializePage()
@ -124,7 +124,7 @@ void IC_ProgressPage::initializePage()
if (fwbdebug_ic)
qDebug() << "IC_ProgressPage::initializePage()";
if (importer != NULL && importer->isRunning())
if (importer != nullptr && importer->isRunning())
{
if (fwbdebug_ic) qDebug() << "importer is still runnig; stopping";
importer->stop();
@ -178,7 +178,7 @@ void IC_ProgressPage::cleanupPage()
if (fwbdebug_ic) qDebug() << "IC_ProgressPage::cleanupPage()";
disconnect(this, SLOT(logLine(QString)));
disconnect(this, SLOT(importerFinished()));
if (importer != NULL && importer->isRunning()) importer->stop();
if (importer != nullptr && importer->isRunning()) importer->stop();
// if (importer != NULL && importer->isRunning()) importer->wait();
}

View File

@ -53,7 +53,7 @@ using namespace libfwbuilder;
ImportFirewallConfigurationWizard::ImportFirewallConfigurationWizard(
QWidget *parent, FWObjectDatabase *_db) : QWizard(parent)
{
fw = NULL;
fw = nullptr;
db_orig = _db;
db_copy = new FWObjectDatabase();
db_copy->duplicate(_db, false);
@ -104,7 +104,7 @@ void ImportFirewallConfigurationWizard::accept()
if (fwbdebug) qDebug() << "ImportFirewallConfigurationWizard::accept()"
<< "fw=" << fw;
if (fw != NULL && (platform == "pix" || platform == "fwsm"))
if (fw != nullptr && (platform == "pix" || platform == "fwsm"))
dynamic_cast<IC_NetworkZonesPage*>(
page(Page_NetworkZones))->setNetworkZones();

View File

@ -64,7 +64,7 @@ ImporterThread::ImporterThread(QWidget *ui,
this->firewallName = firewallName;
this->fileName = fileName;
this->deduplicate = deduplicate;
importer = NULL;
importer = nullptr;
stopFlag = false;
addStandardComments = false;
}
@ -98,7 +98,7 @@ void ImporterThread::run()
std::istringstream instream(buffer.join("\n").toStdString());
importer = NULL;
importer = nullptr;
if (platform == "iosacl") importer = new IOSImporter(
lib, instream, logger, firewallName.toUtf8().constData());

View File

@ -81,7 +81,7 @@ bool instDialog::runCompiler(Firewall *fw)
currentProgressBar->setFormat("%v/%m");
QTreeWidgetItem* item = opListMapping[fw->getId()];
assert(item!=NULL);
assert(item!=nullptr);
currentFWLabel->setText(QString::fromUtf8(fw->getName().c_str()));
m_dialog->fwWorkList->scrollToItem(item);

View File

@ -98,7 +98,7 @@ bool instDialog::runInstaller(Firewall *fw, bool installing_many_firewalls)
currentProgressBar->setFormat("%v/%m");
QTreeWidgetItem* item = opListMapping[fw->getId()];
assert(item!=NULL);
assert(item!=nullptr);
currentFWLabel->setText(QString::fromUtf8(fw->getName().c_str()));
m_dialog->fwWorkList->scrollToItem(item);
@ -113,7 +113,7 @@ bool instDialog::runInstaller(Firewall *fw, bool installing_many_firewalls)
if (fwbdebug)
qDebug() << "instDialog::runInstaller:" << " cnf.user=" << cnf.user;
if (installer!=NULL)
if (installer!=nullptr)
delete installer;
if (isCiscoFamily())
@ -161,13 +161,13 @@ void instDialog::stopInstall()
proc.terminate(); // try to close proc.
QTimer::singleShot(1000, &proc, SLOT(kill())); //if it doesn't respond, kill it
if (installer != NULL)
if (installer != nullptr)
{
if (fwbdebug)
qDebug() << "instDialog::stopInstall killing installer";
installer->terminate();
delete installer;
installer = NULL;
installer = nullptr;
}
// to terminate whole install sequence rather than just current

View File

@ -143,7 +143,7 @@ QTreeWidgetItem* instDialog::createTreeItem(QTreeWidgetItem* parent,
// Mark cluster members
// If parent!=NULL, new tree item corresponds to the cluster member
item->setData(1, Qt::UserRole, QVariant(parent!=NULL));
item->setData(1, Qt::UserRole, QVariant(parent!=nullptr));
// it is useful to know how many members does this cluster have. If this is
// not a cluster, store 0
@ -196,8 +196,8 @@ void instDialog::setFlags(QTreeWidgetItem* item)
bool install_only_on_primary_member = Resources::getTargetCapabilityBool(
platform, "install_only_on_primary");
Cluster *cluster = NULL;
FWObject *master_interface = NULL;
Cluster *cluster = nullptr;
FWObject *master_interface = nullptr;
if (parent)
{
@ -250,7 +250,7 @@ void instDialog::setFlags(QTreeWidgetItem* item)
// If this platform requires installation only on
// the master, disable and uncheck checkbox for the standby.
if (install_only_on_primary_member && master_interface != NULL)
if (install_only_on_primary_member && master_interface != nullptr)
{
QString txt = item->text(0);
if (master_interface->isChildOf(fw))
@ -262,12 +262,12 @@ void instDialog::setFlags(QTreeWidgetItem* item)
// Standby
item->setText(0, QString("%1 (standby)").arg(txt));
item->setCheckState(INSTALL_CHECKBOX_COLUMN, Qt::Unchecked);
item->setFlags(0);
item->setFlags(nullptr);
}
}
}
if (cluster==NULL)
if (cluster==nullptr)
{
// we are adding firewall that is not cluster member, it
// needs "compile" checkbox
@ -572,7 +572,7 @@ void instDialog::fillCompileSelectList()
{
cl = *i;
QTreeWidgetItem* cluster_item = createTreeItem(NULL, cl);
QTreeWidgetItem* cluster_item = createTreeItem(nullptr, cl);
m_dialog->selectTable->addTopLevelItem(cluster_item);
list<Firewall*> members;
@ -591,7 +591,7 @@ void instDialog::fillCompileSelectList()
i!=working_list_of_firewalls.end(); ++i)
{
fw = *i;
QTreeWidgetItem* fw_item = createTreeItem(NULL, fw);
QTreeWidgetItem* fw_item = createTreeItem(nullptr, fw);
m_dialog->selectTable->addTopLevelItem(fw_item);
}
@ -706,13 +706,13 @@ void instDialog::cancelClicked()
proc.kill();
}
if (installer != NULL)
if (installer != nullptr)
{
if (fwbdebug)
qDebug() << "instDialog::cancelClicked killing installer";
installer->terminate();
delete installer;
installer = NULL;
installer = nullptr;
}
QDialog::reject();
@ -906,14 +906,14 @@ void instDialog::selectAllFirewalls()
if (fwbdebug) qDebug("instDialog::selectAllFirewalls");
setSelectStateAll(INSTALL_CHECKBOX_COLUMN, Qt::Checked);
setSelectStateAll(COMPILE_CHECKBOX_COLUMN, Qt::Checked);
tableItemChanged(NULL, 0);
tableItemChanged(nullptr, 0);
}
void instDialog::deselectAllFirewalls()
{
setSelectStateAll(INSTALL_CHECKBOX_COLUMN, Qt::Unchecked);
setSelectStateAll(COMPILE_CHECKBOX_COLUMN, Qt::Unchecked);
tableItemChanged(NULL, 0);
tableItemChanged(nullptr, 0);
}
void instDialog::setSelectStateAll(int column, Qt::CheckState select)
@ -975,7 +975,7 @@ void instDialog::fillCompileUIList()
{
f = (*i);
item = new InstallFirewallViewItem(
NULL,//m_dialog->fwWorkList,
nullptr,//m_dialog->fwWorkList,
QString::fromUtf8(f->getName().c_str()),
false);
@ -1023,7 +1023,7 @@ void instDialog::fillInstallUIList()
{
f = (*i);
item = new InstallFirewallViewItem(
NULL,
nullptr,
QString::fromUtf8(f->getName().c_str()),
false);
@ -1106,14 +1106,14 @@ bool instDialog::getInstOptions(Firewall *fw, bool installing_many_firewalls)
{
canceledAll = true;
delete inst_opt_dlg;
inst_opt_dlg = NULL;
inst_opt_dlg = nullptr;
return false;
}
if (resultCode == QDialog::Rejected)
{
delete inst_opt_dlg;
inst_opt_dlg = NULL;
inst_opt_dlg = nullptr;
return false;
}
@ -1156,7 +1156,7 @@ void instDialog::readInstallerOptionsFromFirewallObject(Firewall *fw)
<< "fw=" << fw
<< QString( (fw) ? QString::fromUtf8(fw->getName().c_str()) : "");
FWOptions *fwopt = NULL;
FWOptions *fwopt = nullptr;
if (fw)
{
fwopt = fw->getOptionsObject();
@ -1300,7 +1300,7 @@ void instDialog::readInstallerOptionsFromDialog(Firewall *fw,
QString adm_user;
FWOptions *fwopt = NULL;
FWOptions *fwopt = nullptr;
if (fw)
{
fwopt = cnf.fwobj->getOptionsObject();
@ -1440,12 +1440,12 @@ void instDialog::closeEvent(QCloseEvent *)
qDebug() << "instDialog::closeEvent killing process";
proc.kill();
}
if (installer != NULL)
if (installer != nullptr)
{
if (fwbdebug)
qDebug() << "instDialog::closeEvent killing installer";
installer->terminate();
delete installer;
installer = NULL;
installer = nullptr;
}
}

View File

@ -62,10 +62,10 @@ iosAdvancedDialog::iosAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
/* Page "General" */
data.registerOption( m_dialog->ios_set_host_name , fwoptions, "ios_set_host_name" );
@ -87,7 +87,7 @@ void iosAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);

View File

@ -79,7 +79,7 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
string vers="version_"+obj->getStr("version");
string platform = obj->getStr("platform"); // should be 'iosacl'
@ -193,7 +193,7 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
}
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.registerOption(m_dialog->ipv4before_2, fwoptions,
"ipv4_6_order",
@ -324,10 +324,10 @@ void iosaclAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* options = Firewall::cast(new_state)->getOptionsObject();
assert(options!=NULL);
assert(options!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(options);

View File

@ -74,10 +74,10 @@ ipcopAdvancedDialog::ipcopAdvancedDialog(QWidget *parent,FWObject *o)
setWindowTitle(QObject::tr("%1 advanced settings").arg(description.c_str()));
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
/*
fwoptions->setStr("firewall_dir", "/etc/rc.d/");
@ -182,10 +182,10 @@ void ipcopAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -67,10 +67,10 @@ ipcoposAdvancedDialog::ipcoposAdvancedDialog(QWidget *parent,FWObject *o)
setWindowTitle(QObject::tr("%1 advanced settings").arg(description.c_str()));
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
QStringList threeStateMapping;
@ -190,7 +190,7 @@ void ipcoposAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);

View File

@ -65,10 +65,10 @@ ipfAdvancedDialog::ipfAdvancedDialog(QWidget *parent,FWObject *o)
QStringList slm;
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
if (fwbdebug)
qDebug("%s",Resources::getTargetOptionStr(
@ -164,10 +164,10 @@ void ipfAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -64,10 +64,10 @@ ipfwAdvancedDialog::ipfwAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
if (fwbdebug)
qDebug("%s",Resources::getTargetOptionStr(
@ -144,10 +144,10 @@ void ipfwAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -70,10 +70,10 @@ iptAdvancedDialog::iptAdvancedDialog(QWidget *parent,FWObject *o)
setWindowTitle(QObject::tr("%1 advanced settings").arg(description.c_str()));
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
if (fwbdebug)
qDebug("%s",Resources::getTargetOptionStr(
@ -246,10 +246,10 @@ void iptAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -62,10 +62,10 @@ junosAdvancedDialog::junosAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
/* Page "General" */
data.registerOption( m_dialog->junos_set_host_name , fwoptions, "junos_set_host_name" );
@ -87,7 +87,7 @@ void junosAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);

View File

@ -79,7 +79,7 @@ junosaclAdvancedDialog::junosaclAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
string vers="version_"+obj->getStr("version");
string platform = obj->getStr("platform"); // should be 'junosacl'
@ -193,7 +193,7 @@ junosaclAdvancedDialog::junosaclAdvancedDialog(QWidget *parent,FWObject *o)
}
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.registerOption(m_dialog->ipv4before_2, fwoptions,
"ipv4_6_order",
@ -315,10 +315,10 @@ void junosaclAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* options = Firewall::cast(new_state)->getOptionsObject();
assert(options!=NULL);
assert(options!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(options);

View File

@ -61,10 +61,10 @@ linksysAdvancedDialog::linksysAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
/*
* since v2.0.3 we do not need to know shell prompt on linksys. Will
* remove the page completely when code becomes stable.
@ -139,7 +139,7 @@ void linksysAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);
@ -157,7 +157,7 @@ void linksysAdvancedDialog::reject()
void linksysAdvancedDialog::setDefaultPrompts()
{
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
m_dialog->linksys_prompt1->setText(
Resources::getTargetOptionStr("sveasoft","default/prompt1").c_str() );
m_dialog->linksys_prompt2->setText(

View File

@ -68,10 +68,10 @@ linux24AdvancedDialog::linux24AdvancedDialog(QWidget *parent,FWObject *o)
setWindowTitle(QObject::tr("%1 advanced settings").arg(description.c_str()));
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
QStringList threeStateMapping;
@ -205,10 +205,10 @@ void linux24AdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -54,7 +54,7 @@ linux24IfaceOptsDialog::linux24IfaceOptsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *ifopt = (Interface::cast(obj))->getOptionsObject();
cluster_interface = (Cluster::cast(obj->getParent()) != NULL);
cluster_interface = (Cluster::cast(obj->getParent()) != nullptr);
setInterfaceTypes(m_dialog->iface_type, Interface::cast(obj),
ifopt->getStr("type").c_str());
@ -105,7 +105,7 @@ void linux24IfaceOptsDialog::accept()
// new_state is a copy of the interface object
FWObject* new_state = cmd->getNewState();
FWOptions* ifopt = Interface::cast(new_state)->getOptionsObject();
assert(ifopt!=NULL);
assert(ifopt!=nullptr);
if (cluster_interface)
{
@ -182,7 +182,7 @@ bool linux24IfaceOptsDialog::validate()
QString combobox = m_dialog->iface_type->currentText();
QString type = m_dialog->iface_type->itemData(
m_dialog->iface_type->currentIndex()).toString();
QWidget *focus = NULL;
QWidget *focus = nullptr;
QString message;
if (type == "vrrp")

View File

@ -59,17 +59,17 @@ void ListOfLibrariesModel::addStaticItems()
Qt::ItemFlags ListOfLibrariesModel::flags(const QModelIndex &index) const
{
int row = index.row();
if (row < 0 || row >= items.size()) return 0;
if (row < 0 || row >= items.size()) return nullptr;
FWObject *lib = items.at(index.row()).lib;
if (lib == NULL) return Qt::ItemIsEnabled;
if (lib == nullptr) return Qt::ItemIsEnabled;
else return QStringListModel::flags(index);
}
bool ListOfLibrariesModel::insertRows(int row, int count, const QModelIndex & parent)
{
for (int c=0; c < count; ++c)
items.insert(row, _item_data("", NULL, NULL));
items.insert(row, _item_data("", nullptr, nullptr));
return QStringListModel::insertRows(row, count, parent);
}
@ -103,7 +103,7 @@ void ListOfLibrariesModel::sort(int column, Qt::SortOrder order)
for (int i=0; i<rowCount(); ++i)
{
FWObject *l = getLibrary(i);
if (l==NULL) continue;
if (l==nullptr) continue;
list.append(items.at(i));
}
@ -115,7 +115,7 @@ void ListOfLibrariesModel::sort(int column, Qt::SortOrder order)
int pos = 0;
foreach(QString itm, top_static_items)
{
list.insert(pos, _item_data(itm, NULL, NULL));
list.insert(pos, _item_data(itm, nullptr, nullptr));
pos++;
}
@ -127,7 +127,7 @@ void ListOfLibrariesModel::sort(int column, Qt::SortOrder order)
QString text = list.at(i).name;
insertRows(i, 1);
QModelIndex idx = index(i, 0);
QStringListModel::setData(idx, indentLibName(text, list.at(i).lib!=NULL), Qt::DisplayRole);
QStringListModel::setData(idx, indentLibName(text, list.at(i).lib!=nullptr), Qt::DisplayRole);
items[i] = list[i];
}
}
@ -157,7 +157,7 @@ FWObject* ListOfLibrariesModel::getLibrary(QModelIndex idx)
FWObject* ListOfLibrariesModel::getLibrary(int row)
{
if (row < 0 || row >= items.size()) return NULL;
if (row < 0 || row >= items.size()) return nullptr;
return items[row].lib;
}
@ -168,7 +168,7 @@ ObjectTreeView* ListOfLibrariesModel::getTreeWidget(QModelIndex idx)
ObjectTreeView* ListOfLibrariesModel::getTreeWidget(int row)
{
if (row < 0 || row >= items.size()) return NULL;
if (row < 0 || row >= items.size()) return nullptr;
return items[row].tree;
}
@ -177,7 +177,7 @@ void ListOfLibrariesModel::setData(QModelIndex idx, const QString &name, FWObjec
int row = idx.row();
if (row < 0 || row >= items.size()) return ;
items[row] = _item_data(name, lib, otv);
QStringListModel::setData(idx, indentLibName(name, lib!=NULL), Qt::DisplayRole);
QStringListModel::setData(idx, indentLibName(name, lib!=nullptr), Qt::DisplayRole);
}
void ListOfLibrariesModel::setName(QModelIndex idx, const QString &name)
@ -185,7 +185,7 @@ void ListOfLibrariesModel::setName(QModelIndex idx, const QString &name)
int row = idx.row();
if (row < 0 || row >= items.size()) return ;
items[row].name = name;
QStringListModel::setData(idx, indentLibName(name, items.at(row).lib!=NULL), Qt::DisplayRole);
QStringListModel::setData(idx, indentLibName(name, items.at(row).lib!=nullptr), Qt::DisplayRole);
}
QString ListOfLibrariesModel::indentLibName(const QString &name, bool indent)

View File

@ -60,10 +60,10 @@ macosxAdvancedDialog::macosxAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
QStringList threeStateMapping;
@ -107,7 +107,7 @@ void macosxAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);

View File

@ -74,10 +74,10 @@ void NetworkZoneManager::load(FWObjectDatabase *_db)
if ( library->getId()==FWObjectDatabase::DELETED_OBJECTS_ID ) continue;
o1 = library->findObjectByName(ObjectGroup::TYPENAME, "Objects");
assert(o1!=NULL);
assert(o1!=nullptr);
o2 = o1->findObjectByName(ObjectGroup::TYPENAME, "Groups");
if (o2==NULL)
if (o2==nullptr)
{
if (fwbdebug)
qDebug() << "NetworkZoneManager::NetworkZoneManager():"
@ -96,7 +96,7 @@ void NetworkZoneManager::load(FWObjectDatabase *_db)
}
o2=o1->findObjectByName(ObjectGroup::TYPENAME,"Networks");
if (o2==NULL)
if (o2==nullptr)
{
if (fwbdebug)
qDebug() << "NetworkZoneManager::NetworkZoneManager():"

View File

@ -55,7 +55,7 @@ using namespace std;
newClusterDialog::newClusterDialog(QWidget *parentw, FWObject *_p)
: QDialog(parentw), ncl(NULL), fwlist(NULL), tmpldb(NULL)
: QDialog(parentw), ncl(nullptr), fwlist(nullptr), tmpldb(nullptr)
{
parent = _p;
db = parent->getRoot();
@ -307,7 +307,7 @@ void newClusterDialog::finishClicked()
if (unloadTemplatesLib)
{
delete tmpldb;
tmpldb = NULL;
tmpldb = nullptr;
unloadTemplatesLib = false;
}

View File

@ -60,7 +60,7 @@ void newClusterDialog::createNewCluster()
this->m_dialog->interfaceSelector->getInterfaces();
typedef QPair<Firewall*, bool> fwpair;
Firewall *master = NULL;
Firewall *master = nullptr;
QList<QPair<Firewall*, bool> > member_firewalls =
this->m_dialog->firewallSelector->getSelectedFirewalls();
foreach(fwpair member, member_firewalls)
@ -71,7 +71,7 @@ void newClusterDialog::createNewCluster()
FWObject *o;
o = db->create(Cluster::TYPENAME);
if (o == NULL)
if (o == nullptr)
{
QDialog::accept();
return;
@ -196,7 +196,7 @@ void newClusterDialog::createNewCluster()
failover_grp->addRef(member_intf);
if (master!=NULL && member_fw == master)
if (master!=nullptr && member_fw == master)
{
std::string masteriface_id =
FWObjectDatabase::getStringId(member_intf->getId());
@ -220,7 +220,7 @@ void newClusterDialog::createNewCluster()
StateSyncClusterGroup::cast(state_sync_members));
// Copy rule sets if requested
Firewall *source = NULL;
Firewall *source = nullptr;
foreach (QRadioButton* btn, copy_rules_from_buttons.keys())
{
if (btn->isChecked() && btn != noPolicy)
@ -236,7 +236,7 @@ void newClusterDialog::createNewCluster()
QString filename = pp->getFileName();
if (source == NULL)
if (source == nullptr)
{
if (fwbdebug)
qDebug() << "newClusterDialog::createNewCluster() checkpoint 5";
@ -256,9 +256,9 @@ void newClusterDialog::createNewCluster()
// <source>, need to close it because we are about to delete that
// rule set object
RuleSet* current_ruleset = NULL;
RuleSet* current_ruleset = nullptr;
RuleSetView* rsv = pp->getCurrentRuleSetView();
RuleSetModel* md = NULL;
RuleSetModel* md = nullptr;
if (rsv)
{
md = (RuleSetModel*)rsv->model();
@ -283,7 +283,7 @@ void newClusterDialog::createNewCluster()
string name_bak = fw->getName() + "-bak";
FWCmdAddObject *cmd = new FWCmdAddObject(
mw->activeProject(), fwgroup, NULL,
mw->activeProject(), fwgroup, nullptr,
QString("Create new Firewall %1")
.arg(QString::fromUtf8(name_bak.c_str())));
cmd->setNeedTreeReload(true);

View File

@ -75,7 +75,7 @@ void newFirewallDialog::createFirewallFromTemplate()
{
QListWidgetItem *itm = m_dialog->templateList->currentItem();
FWObject *template_fw = templates[itm];
assert (template_fw!=NULL);
assert (template_fw!=nullptr);
string platform = readPlatform(m_dialog->platform).toLatin1().constData();
string host_os = readHostOS(m_dialog->hostOS).toLatin1().constData();

View File

@ -62,10 +62,10 @@ nxosAdvancedDialog::nxosAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
/* Page "General" */
data.registerOption( m_dialog->nxos_set_host_name , fwoptions, "nxos_set_host_name" );
@ -87,7 +87,7 @@ void nxosAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);

View File

@ -79,7 +79,7 @@ nxosaclAdvancedDialog::nxosaclAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
string vers="version_"+obj->getStr("version");
string platform = obj->getStr("platform"); // should be 'nxosacl'
@ -193,7 +193,7 @@ nxosaclAdvancedDialog::nxosaclAdvancedDialog(QWidget *parent,FWObject *o)
}
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.registerOption(m_dialog->ipv4before_2, fwoptions,
"ipv4_6_order",
@ -327,10 +327,10 @@ void nxosaclAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* options = Firewall::cast(new_state)->getOptionsObject();
assert(options!=NULL);
assert(options!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(options);

View File

@ -51,13 +51,13 @@ openaisOptionsDialog::openaisOptionsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *gropt = FWOptions::cast(obj);
assert(gropt != NULL);
assert(gropt != nullptr);
FWObject *p = obj;
while (p && Cluster::cast(p)==NULL) p = p->getParent();
assert(p != NULL);
while (p && Cluster::cast(p)==nullptr) p = p->getParent();
assert(p != nullptr);
Cluster *cluster = Cluster::cast(p);
Resources *os_res = Resources::os_res[cluster->getStr("host_OS")];
assert(os_res != NULL);
assert(os_res != nullptr);
string default_address =
os_res->getResourceStr(
@ -123,7 +123,7 @@ bool openaisOptionsDialog::validate()
QMessageBox::critical(
this, "Firewall Builder",
tr("Invalid IP address '%1'").arg(m_dialog->openais_address->text()),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
return false;
}

View File

@ -61,10 +61,10 @@ openbsdAdvancedDialog::openbsdAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
QStringList threeStateMapping;
@ -117,10 +117,10 @@ void openbsdAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -67,10 +67,10 @@ pfAdvancedDialog::pfAdvancedDialog(QWidget *parent,FWObject *o)
string version = obj->getStr("version");
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
if (fwbdebug)
qDebug("%s", Resources::getTargetOptionStr(
@ -460,10 +460,10 @@ void pfAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -49,7 +49,7 @@ pfsyncOptionsDialog::pfsyncOptionsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *gropt = FWOptions::cast(obj);
assert(gropt != NULL);
assert(gropt != nullptr);
data.registerOption(m_dialog->syncpeer,
gropt,

View File

@ -170,7 +170,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget*parent, FWObject *o)
syslogFacilityMapping.push_back("23");
FWOptions *fwoptions = (Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
/* Page Script */
@ -193,7 +193,7 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget*parent, FWObject *o)
}
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.registerOption( m_dialog->short_script, fwoptions, "short_script");
@ -371,137 +371,137 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget*parent, FWObject *o)
allFixups.push_back(fixupControl(
m_dialog->pix_ctiqbe_switch,
m_dialog->pix_ctiqbe_port,
NULL,
NULL,
nullptr,
nullptr,
"ctiqbe_fixup", "ctiqbe", 0));
allFixups.push_back(fixupControl(
m_dialog->pix_dns_switch,
m_dialog->pix_dns_max_length,
NULL,
NULL,
nullptr,
nullptr,
"dns_fixup", "dns", 1));
allFixups.push_back(fixupControl(
m_dialog->pix_espike_switch,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
"espike_fixup", "esp-ike", 2));
allFixups.push_back(fixupControl(
m_dialog->pix_ftp_switch,
m_dialog->pix_ftp_port,
NULL,
nullptr,
m_dialog->pix_ftp_strict,
"ftp_fixup", "ftp", 3));
allFixups.push_back(fixupControl(
m_dialog->pix_h323h225_switch,
m_dialog->pix_h323h225_port1,
m_dialog->pix_h323h225_port2,
NULL,
nullptr,
"h323_h225_fixup", "h323 h225", 4));
allFixups.push_back(fixupControl(
m_dialog->pix_h323ras_switch,
m_dialog->pix_h323ras_port1,
m_dialog->pix_h323ras_port2,
NULL,
nullptr,
"h323_ras_fixup", "h323 ras", 5));
allFixups.push_back(fixupControl(
m_dialog->pix_http_switch,
m_dialog->pix_http_port1,
m_dialog->pix_http_port2,
NULL,
nullptr,
"http_fixup", "http", 6));
allFixups.push_back(fixupControl(
m_dialog->pix_icmperror_switch,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
"icmp_error_fixup", "icmp error", 7));
allFixups.push_back(fixupControl(
m_dialog->pix_ils_switch,
m_dialog->pix_ils_port1,
m_dialog->pix_ils_port2,
NULL,
nullptr,
"ils_fixup", "ils", 8));
allFixups.push_back(fixupControl(
m_dialog->pix_mgcp_switch,
m_dialog->pix_mgcp_gateway_port,
m_dialog->pix_mgcp_call_agent_port,
NULL,
nullptr,
"mgcp_fixup", "mgcp", 9));
allFixups.push_back(fixupControl(
m_dialog->pix_pptp_switch,
m_dialog->pix_pptp_port,
NULL,
NULL,
nullptr,
nullptr,
"pptp_fixup", "pptp", 10));
allFixups.push_back(fixupControl(
m_dialog->pix_rsh_switch,
m_dialog->pix_rsh_port1,
NULL,
NULL,
nullptr,
nullptr,
"rsh_fixup", "rsh", 11));
allFixups.push_back(fixupControl(
m_dialog->pix_rtsp_switch,
m_dialog->pix_rtsp_port,
NULL,
NULL,
nullptr,
nullptr,
"rtsp_fixup", "rtsp", 12));
allFixups.push_back(fixupControl(
m_dialog->pix_sip_switch,
m_dialog->pix_sip_port1,
m_dialog->pix_sip_port2,
NULL,
nullptr,
"sip_fixup", "sip", 13));
allFixups.push_back(fixupControl(
m_dialog->pix_sipudp_switch,
m_dialog->pix_sip_udp_port1,
NULL,
NULL,
nullptr,
nullptr,
"sip_udp_fixup", "sip udp", 14));
allFixups.push_back(fixupControl(
m_dialog->pix_skinny_switch,
m_dialog->pix_skinny_port1,
m_dialog->pix_skinny_port2,
NULL,
nullptr,
"skinny_fixup", "skinny", 15));
allFixups.push_back(fixupControl(
m_dialog->pix_smtp_switch,
m_dialog->pix_smtp_port1,
m_dialog->pix_smtp_port2,
NULL,
nullptr,
"smtp_fixup", "smtp", 16));
allFixups.push_back(fixupControl(
m_dialog->pix_sqlnet_switch,
m_dialog->pix_sqlnet_port1,
m_dialog->pix_sqlnet_port2,
NULL,
nullptr,
"sqlnet_fixup", "sqlnet", 17));
allFixups.push_back(fixupControl(
m_dialog->pix_tftp_switch,
m_dialog->pix_tftp_port,
NULL,
NULL,
nullptr,
nullptr,
"tftp_fixup", "tftp", 18));
allFixups.push_back(fixupControl(
m_dialog->pix_ip_options_eool_switch,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
"ip_options_eool_fixup", "IP options", 19));
allFixups.push_back(fixupControl(
m_dialog->pix_ip_options_nop_switch,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
"ip_options_nop_fixup", "IP options", 20));
allFixups.push_back(fixupControl(
m_dialog->pix_ip_options_rtralt_switch,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
"ip_options_rtralt_fixup", "IP options", 21));
QStringList allowed_fixups =
@ -521,17 +521,17 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget*parent, FWObject *o)
qDebug() << "pixAdvancedDialog::pixAdvancedDialog fwopt:"
<< fi->fwoption;
if (fi->switch_widget!=NULL)
if (fi->switch_widget!=nullptr)
connect( fi->switch_widget, SIGNAL(activated(int)),
this, SLOT(fixupCmdChanged()));
if (fi->arg1!=NULL) connect( fi->arg1, SIGNAL(valueChanged(int)),
if (fi->arg1!=nullptr) connect( fi->arg1, SIGNAL(valueChanged(int)),
this, SLOT(fixupCmdChanged()));
if (fi->arg2!=NULL) connect( fi->arg2, SIGNAL(valueChanged(int)),
if (fi->arg2!=nullptr) connect( fi->arg2, SIGNAL(valueChanged(int)),
this, SLOT(fixupCmdChanged()));
if (fi->arg3!=NULL) connect( fi->arg3, SIGNAL(clicked()),
if (fi->arg3!=nullptr) connect( fi->arg3, SIGNAL(clicked()),
this, SLOT(fixupCmdChanged()));
bool active = allowed_fixups.contains(fi->fwoption);
@ -718,7 +718,7 @@ void pixAdvancedDialog::changeAllFixups(int state)
void pixAdvancedDialog::loadFixups()
{
FWOptions *options=(Firewall::cast(obj))->getOptionsObject();
assert(options!=NULL);
assert(options!=nullptr);
for (list<fixupControl>::iterator fi=allFixups.begin(); fi!=allFixups.end(); fi++)
{
@ -801,7 +801,7 @@ void pixAdvancedDialog::displayCommands()
* object back
*/
FWOptions *options = (Firewall::cast(obj))->getOptionsObject();
assert(options!=NULL);
assert(options!=nullptr);
FWOptions *backup_options = new FWOptions();
backup_options->duplicate(options, false);
@ -838,10 +838,10 @@ void pixAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);
@ -910,7 +910,7 @@ void pixAdvancedDialog::setDefaultTimeoutValue(const QString &option)
{
string platform = obj->getStr("platform"); // could be 'pix' or 'fwsm'
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
string vers="version_"+obj->getStr("version");
@ -927,7 +927,7 @@ void pixAdvancedDialog::setDefaultTimeoutValue(const QString &option)
void pixAdvancedDialog::defaultTimeouts()
{
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
string vers="version_"+obj->getStr("version");

View File

@ -50,7 +50,7 @@ pixFailoverOptionsDialog::pixFailoverOptionsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *gropt = FWOptions::cast(obj);
assert(gropt != NULL);
assert(gropt != nullptr);
data.registerOption(m_dialog->pix_failover_key,
gropt,
@ -90,7 +90,7 @@ void pixFailoverOptionsDialog::reject()
bool pixFailoverOptionsDialog::validate()
{
bool valid = true;
QWidget *focus = NULL;
QWidget *focus = nullptr;
QString message;
// key must be set

View File

@ -63,10 +63,10 @@ pixosAdvancedDialog::pixosAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
/* Page "General" */
data.registerOption(
@ -130,7 +130,7 @@ void pixosAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);

View File

@ -52,7 +52,7 @@ pixosIfaceOptsDialog::pixosIfaceOptsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *ifopt = (Interface::cast(obj))->getOptionsObject();
cluster_interface = (Cluster::cast(obj->getParent()) != NULL);
cluster_interface = (Cluster::cast(obj->getParent()) != nullptr);
setInterfaceTypes(m_dialog->iface_type, Interface::cast(obj),
ifopt->getStr("type").c_str());
@ -97,7 +97,7 @@ void pixosIfaceOptsDialog::accept()
// new_state is a copy of the interface object
FWObject* new_state = cmd->getNewState();
FWOptions* ifopt = Interface::cast(new_state)->getOptionsObject();
assert(ifopt!=NULL);
assert(ifopt!=nullptr);
if (cluster_interface)
{
@ -156,7 +156,7 @@ bool pixosIfaceOptsDialog::validate()
QString combobox = m_dialog->iface_type->currentText();
QString type = m_dialog->iface_type->itemData(
m_dialog->iface_type->currentIndex()).toString();
QWidget *focus = NULL;
QWidget *focus = nullptr;
QString message;
if (type == "8021q")

View File

@ -196,15 +196,15 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
{
bool res = true;
FWObject *p;
PolicyRule *rule = NULL;
PolicyRule *rule = nullptr;
p = opt;
do {
p = p->getParent();
if (PolicyRule::cast(p)!=NULL) rule = PolicyRule::cast(p);
} while ( p!=NULL && Firewall::cast(p)==NULL );
if (PolicyRule::cast(p)!=nullptr) rule = PolicyRule::cast(p);
} while ( p!=nullptr && Firewall::cast(p)==nullptr );
if (p==NULL)
if (p==nullptr)
{
qDebug() << "isDefaultPolicyRuleOptions()"
<< "Can not locate parent Firewall object for the options object";
@ -315,7 +315,7 @@ bool isDefaultPolicyRuleOptions(FWOptions *opt)
res = true;
}
if (rule!=NULL)
if (rule!=nullptr)
{
PolicyRule::Action act = rule->getAction();
@ -348,9 +348,9 @@ bool isDefaultNATRuleOptions(FWOptions *opt)
p=opt;
do { p=p->getParent();
} while ( p!=NULL && Firewall::cast(p)==NULL );
} while ( p!=nullptr && Firewall::cast(p)==nullptr );
assert(p!=NULL);
assert(p!=nullptr);
QString platform = p->getStr("platform").c_str();
@ -496,7 +496,7 @@ void getVersionsForPlatform(const QString &platform, std::list<QStringPair> &res
void getStateSyncTypesForOS(const QString &host_os, std::list<QStringPair> &res)
{
Resources* os_res = Resources::os_res[host_os.toStdString()];
if (os_res==NULL) return;
if (os_res==nullptr) return;
list<string> protocols;
os_res->getResourceStrList("/FWBuilderResources/Target/protocols/state_sync",
protocols);
@ -506,7 +506,7 @@ void getStateSyncTypesForOS(const QString &host_os, std::list<QStringPair> &res)
void getFailoverTypesForOS(const QString &host_os, std::list<QStringPair> &res)
{
Resources* os_res = Resources::os_res[host_os.toStdString()];
if (os_res==NULL) return;
if (os_res==nullptr) return;
list<string> protocols;
os_res->getResourceStrList("/FWBuilderResources/Target/protocols/failover",
protocols);
@ -518,7 +518,7 @@ void getInterfaceTypes(Interface *iface, list<QStringPair> &res)
FWObject *fw = iface->getParent();
string host_os = fw->getStr("host_OS");
Resources* os_res = Resources::os_res[host_os];
if (os_res==NULL) return;
if (os_res==nullptr) return;
list<string> interface_types;
if (Cluster::isA(fw))
@ -546,11 +546,11 @@ void getSubInterfaceTypes(Interface *iface, list<QStringPair> &res)
{
FWObject *p = Host::getParentHost(iface);
//FWObject *p = iface->getParentHost();
assert(p!=NULL);
assert(p!=nullptr);
QString host_os = p->getStr("host_OS").c_str();
Resources* os_res = Resources::os_res[host_os.toStdString()];
if (os_res==NULL) return;
if (os_res==nullptr) return;
FWOptions *ifopt;
ifopt = Interface::cast(iface)->getOptionsObject();
@ -589,13 +589,13 @@ void setInterfaceTypes(QComboBox *iface_type,
// it could be one.
FWObject *p = Host::getParentHost(iface);
//FWObject *p = iface->getParentHost();
assert(p!=NULL);
assert(p!=nullptr);
QString host_os = p->getStr("host_OS").c_str();
QString obj_name = iface->getName().c_str();
Resources* os_res = Resources::os_res[p->getStr("host_OS")];
string os_family = p->getStr("host_OS");
if (os_res!=NULL)
if (os_res!=nullptr)
os_family = os_res->getResourceStr("/FWBuilderResources/Target/family");
std::unique_ptr<interfaceProperties> int_prop(
@ -746,7 +746,7 @@ QString getRuleAction(Rule *rule)
QString getActionNameForPlatform(Firewall *fw, Rule *rule)
{
if (fw==NULL) return "";
if (fw==nullptr) return "";
PolicyRule *policy_rule = PolicyRule::cast(rule);
NATRule *nat_rule = NATRule::cast(rule);
string act;
@ -757,7 +757,7 @@ QString getActionNameForPlatform(Firewall *fw, Rule *rule)
QString getActionNameForPlatform(Firewall *fw, const std::string &action)
{
if (fw==NULL) return "";
if (fw==nullptr) return "";
string platform = fw->getStr("platform");
string name;
try
@ -1052,11 +1052,11 @@ void _repackStringList(list<string> &list1, list<QStringPair> &list2)
void setDefaultStateSyncGroupAttributes(StateSyncClusterGroup *grp)
{
FWObject *p = grp;
while (p && Cluster::cast(p)==NULL) p = p->getParent();
assert(p != NULL);
while (p && Cluster::cast(p)==nullptr) p = p->getParent();
assert(p != nullptr);
Cluster *cluster = Cluster::cast(p);
Resources *os_res = Resources::os_res[cluster->getStr("host_OS")];
assert(os_res != NULL);
assert(os_res != nullptr);
list<string> protocols;
os_res->getResourceStrList("/FWBuilderResources/Target/protocols/state_sync",
@ -1071,14 +1071,14 @@ void setDefaultStateSyncGroupAttributes(StateSyncClusterGroup *grp)
void setDefaultFailoverGroupAttributes(FailoverClusterGroup *grp)
{
FWObject *p = grp;
while (p && Cluster::cast(p)==NULL) p = p->getParent();
assert(p != NULL);
while (p && Cluster::cast(p)==nullptr) p = p->getParent();
assert(p != nullptr);
Cluster *cluster = Cluster::cast(p);
Resources *os_res = Resources::os_res[cluster->getStr("host_OS")];
assert(os_res != NULL);
assert(os_res != nullptr);
FWOptions *gropt = grp-> getOptionsObject();
assert(gropt != NULL);
assert(gropt != nullptr);
string failover_protocol = grp->getStr("type");

View File

@ -79,7 +79,7 @@ procurveaclAdvancedDialog::procurveaclAdvancedDialog(QWidget *parent,FWObject *o
obj=o;
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
// As of 4.1.0 we do not support scp install method for Procurve
// I could not figure out how to copy configuration to the switch
@ -201,7 +201,7 @@ procurveaclAdvancedDialog::procurveaclAdvancedDialog(QWidget *parent,FWObject *o
}
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.registerOption(m_dialog->ipv4before_2, fwoptions,
"ipv4_6_order",
@ -326,10 +326,10 @@ void procurveaclAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* options = Firewall::cast(new_state)->getOptionsObject();
assert(options!=NULL);
assert(options!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(options);

View File

@ -62,10 +62,10 @@ secuwallAdvancedDialog::secuwallAdvancedDialog(QWidget *parent, FWObject *o)
setWindowTitle(QObject::tr("%1 advanced settings").arg(description.c_str()));
FWOptions *fwoptions=(Firewall::cast(obj))->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.registerOption(m_dialog->logTCPseq, fwoptions, "log_tcp_seq");
data.registerOption(m_dialog->logTCPopt, fwoptions, "log_tcp_opt");
@ -198,10 +198,10 @@ void secuwallAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
Management *mgmt = (Firewall::cast(new_state))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
data.saveAll(fwoptions);

View File

@ -41,7 +41,7 @@ secuwallIfaceOptsDialog::secuwallIfaceOptsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *ifopt = (Interface::cast(obj))->getOptionsObject();
cluster_interface = (Cluster::cast(obj->getParent()) != NULL);
cluster_interface = (Cluster::cast(obj->getParent()) != nullptr);
setInterfaceTypes(m_dialog->iface_type, Interface::cast(obj),
ifopt->getStr("type").c_str());
@ -100,7 +100,7 @@ void secuwallIfaceOptsDialog::accept()
// new_state is a copy of the interface object
FWObject* new_state = cmd->getNewState();
FWOptions* ifopt = Interface::cast(new_state)->getOptionsObject();
assert(ifopt!=NULL);
assert(ifopt!=nullptr);
if (cluster_interface)
{

View File

@ -55,7 +55,7 @@ secuwallosAdvancedDialog::secuwallosAdvancedDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *fwopt = (Firewall::cast(obj))->getOptionsObject();
assert(fwopt != NULL);
assert(fwopt != nullptr);
// mappings from value to QComboBox index
QStringList threeStateMapping;
@ -235,7 +235,7 @@ void secuwallosAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);
@ -328,7 +328,7 @@ void secuwallosAdvancedDialog::buttonOpenURLClicked()
bool secuwallosAdvancedDialog::validate()
{
bool valid = true;
QWidget *focus = NULL;
QWidget *focus = nullptr;
QString message;
// widgets to verify

View File

@ -100,7 +100,7 @@ void ND_ChooseObjectTypePage::changeTargetObject(const QString &buf)
{
QTreeWidgetItem* item = m_dialog->typeChangingList->topLevelItem(0);
while (item!=0)
while (item!=nullptr)
{
if (item->isSelected())
{

View File

@ -77,7 +77,7 @@ void ND_CreateObjectsPage::initializePage()
m_dialog->progressBar->setFormat("%v / %m");
m_dialog->progressBar->setMaximum(objectsToUse->size() / 2 + networks->size());
FWObject *last_object = NULL;
FWObject *last_object = nullptr;
string type, name, a;
int counter = 0;
@ -90,7 +90,7 @@ void ND_CreateObjectsPage::initializePage()
Address *net = Address::cast(
mw->createObject(type.c_str(), name.c_str()));
assert(net!=NULL);
assert(net!=nullptr);
net->setName(name);
net->setAddress(od.addr);
@ -123,7 +123,7 @@ void ND_CreateObjectsPage::initializePage()
if (type==Host::TYPENAME || type==Firewall::TYPENAME)
{
FWObject *o=NULL;
FWObject *o=nullptr;
o = mw->createObject(type.c_str(), name.c_str());
o->setName(name);
@ -239,7 +239,7 @@ void ND_CreateObjectsPage::initializePage()
"important to review and fix generated objects if you "
"use MAC address spoofing."
),
tr("&Continue"), 0, 0,
tr("&Continue"), nullptr, nullptr,
0 );
@ -254,7 +254,7 @@ void ND_CreateObjectsPage::initializePage()
FWObject *intf = addInterface(
o, in, in->subinterfaces.size()!=0);
if (intf == NULL) continue;
if (intf == nullptr) continue;
list<InterfaceData*>::iterator sit;
for (sit=in->subinterfaces.begin();
@ -281,7 +281,7 @@ void ND_CreateObjectsPage::initializePage()
Network *net=dynamic_cast<Network*>(
mw->createObject(type.c_str(),name.c_str())
);
assert(net!=NULL);
assert(net!=nullptr);
net->setName(name);
net->setAddress(InetAddr(a));
net->setNetmask(InetAddr(InetAddr(a)));
@ -291,7 +291,7 @@ void ND_CreateObjectsPage::initializePage()
IPv4 *obj=dynamic_cast<IPv4*>(
mw->createObject(type.c_str(),name.c_str())
);
assert(obj!=NULL);
assert(obj!=nullptr);
obj->setName(name);
obj->setAddress(InetAddr(a));
obj->setNetmask(InetAddr(InetAddr::getAllOnes()));
@ -322,13 +322,13 @@ FWObject* ND_CreateObjectsPage::addInterface(FWObject *parent, InterfaceData *in
if ( ! includeUnnumbered && ! skip_ip_address_check)
{
if (in->addr_mask.size()==0) return NULL;
if (in->addr_mask.size()==0) return nullptr;
if (in->addr_mask.front()->getAddressPtr()->isAny())
return NULL;
return nullptr;
}
QString obj_name = in->name.c_str();
Interface *itf = NULL;
Interface *itf = nullptr;
itf = Interface::cast(
mw->createObject(parent,
QString(Interface::TYPENAME), obj_name));

View File

@ -60,10 +60,10 @@ solarisAdvancedDialog::solarisAdvancedDialog(QWidget *parent,FWObject *o)
obj=o;
FWOptions *fwopt=(Firewall::cast(obj))->getOptionsObject();
assert(fwopt!=NULL);
assert(fwopt!=nullptr);
Management *mgmt=(Firewall::cast(obj))->getManagementObject();
assert(mgmt!=NULL);
assert(mgmt!=nullptr);
QStringList threeStateMapping;
@ -119,7 +119,7 @@ void solarisAdvancedDialog::accept()
// new_state is a copy of the fw object
FWObject* new_state = cmd->getNewState();
FWOptions* fwoptions = Firewall::cast(new_state)->getOptionsObject();
assert(fwoptions!=NULL);
assert(fwoptions!=nullptr);
data.saveAll(fwoptions);

View File

@ -52,7 +52,7 @@ vlanOnlyIfaceOptsDialog::vlanOnlyIfaceOptsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *ifopt = (Interface::cast(obj))->getOptionsObject();
cluster_interface = (Cluster::cast(obj->getParent()) != NULL);
cluster_interface = (Cluster::cast(obj->getParent()) != nullptr);
setInterfaceTypes(m_dialog->iface_type, Interface::cast(obj),
ifopt->getStr("type").c_str());
@ -95,7 +95,7 @@ void vlanOnlyIfaceOptsDialog::accept()
// new_state is a copy of the interface object
FWObject* new_state = cmd->getNewState();
FWOptions* ifopt = Interface::cast(new_state)->getOptionsObject();
assert(ifopt!=NULL);
assert(ifopt!=nullptr);
if (cluster_interface)
{
@ -150,7 +150,7 @@ bool vlanOnlyIfaceOptsDialog::validate()
QString combobox = m_dialog->iface_type->currentText();
QString type = m_dialog->iface_type->itemData(
m_dialog->iface_type->currentIndex()).toString();
QWidget *focus = NULL;
QWidget *focus = nullptr;
QString message;
if (type == "vrrp")

View File

@ -50,7 +50,7 @@ vrrpOptionsDialog::vrrpOptionsDialog(QWidget *parent, FWObject *o)
obj = o;
FWOptions *gropt = FWOptions::cast(obj);
assert(gropt != NULL);
assert(gropt != nullptr);
data.registerOption(m_dialog->vrrp_secret,
gropt,
@ -99,7 +99,7 @@ void vrrpOptionsDialog::reject()
bool vrrpOptionsDialog::validate()
{
bool valid = true;
QWidget *focus = NULL;
QWidget *focus = nullptr;
QString message;
// vrrp secret must be set

View File

@ -65,7 +65,7 @@ using namespace libfwbuilder;
using namespace fwcompiler;
FWObjectDatabase *objdb = NULL;
FWObjectDatabase *objdb = nullptr;
class UpgradePredicate: public XMLTools::UpgradePredicate
{

View File

@ -61,7 +61,7 @@ TableFactory::TableFactory(BaseCompiler *comp, Firewall *fwall,
firewall = fwall;
ruleSetName = "";
group_registry = _group_registry;
dbroot = NULL;
dbroot = nullptr;
persistent_tables = new ObjectGroup();
persistent_tables->setName("PF Tables");
persistent_objects->add(persistent_tables);
@ -93,7 +93,7 @@ string TableFactory::generateTblID(RuleElement *re)
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
{
FWObject *o = *i;
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
lids.push_back(FWObjectDatabase::getStringId(o->getId()));
}
lids.sort();
@ -165,7 +165,7 @@ void TableFactory::createTablesForRE(RuleElement *re, Rule *rule)
string tblID = generateTblID(re);
FWObject *tblgrp = NULL;
FWObject *tblgrp = nullptr;
list<FWObject*> objects_in_groups;
list<FWObject*> objects;
@ -309,7 +309,7 @@ string TableFactory::PrintTables()
output << "table ";
output << "<" << grp->getName() << "> ";
MultiAddressRunTime *atrt = MultiAddressRunTime::cast(grp);
if (atrt!=NULL &&
if (atrt!=nullptr &&
atrt->getSubstitutionTypeName()==AddressTable::TYPENAME)
{
output << "persist";
@ -332,10 +332,10 @@ string TableFactory::PrintTables()
{
if (i!=grp->begin()) output << ", ";
FWObject *o = FWReference::getObject(*i);
if (o==NULL) compiler->abort("broken table object ");
if (o==nullptr) compiler->abort("broken table object ");
MultiAddressRunTime *atrt = MultiAddressRunTime::cast(o);
if (atrt!=NULL)
if (atrt!=nullptr)
{
if (atrt->getSubstitutionTypeName()==DNSName::TYPENAME)
{
@ -353,7 +353,7 @@ string TableFactory::PrintTables()
} else
{
Address *A=Address::cast( o );
if (A==NULL)
if (A==nullptr)
compiler->abort("table object must be an address: '" +
o->getTypeName()+"'");

View File

@ -65,7 +65,7 @@ using namespace libfwbuilder;
using namespace fwcompiler;
FWObjectDatabase *objdb = NULL;
FWObjectDatabase *objdb = nullptr;
class UpgradePredicate: public XMLTools::UpgradePredicate

View File

@ -65,7 +65,7 @@ using namespace libfwbuilder;
using namespace fwcompiler;
FWObjectDatabase *objdb = NULL;
FWObjectDatabase *objdb = nullptr;
class UpgradePredicate: public XMLTools::UpgradePredicate
{