diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:17:21 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:29 +0100 |
commit | a96b564aeeea6cd27d68084327d11be615ebc0a8 (patch) | |
tree | 122c691378f9a14c4c06dd5618e13a5b73d92226 /idlc | |
parent | 85552d865b8dcd059b0eb33c42c8a491f88402e3 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: Ic42387288c96436915956ede2eb510b9c3fbc49b
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/inc/idlc/astattribute.hxx | 8 | ||||
-rw-r--r-- | idlc/inc/idlc/astinterface.hxx | 2 | ||||
-rw-r--r-- | idlc/inc/idlc/astoperation.hxx | 2 | ||||
-rw-r--r-- | idlc/inc/idlc/astsequence.hxx | 4 | ||||
-rw-r--r-- | idlc/inc/idlc/asttypedef.hxx | 2 | ||||
-rw-r--r-- | idlc/source/astdeclaration.cxx | 2 | ||||
-rw-r--r-- | idlc/source/astdump.cxx | 4 | ||||
-rw-r--r-- | idlc/source/astenum.cxx | 2 | ||||
-rw-r--r-- | idlc/source/astexpression.cxx | 134 | ||||
-rw-r--r-- | idlc/source/astinterface.cxx | 8 | ||||
-rw-r--r-- | idlc/source/astoperation.cxx | 4 | ||||
-rw-r--r-- | idlc/source/astscope.cxx | 36 | ||||
-rw-r--r-- | idlc/source/aststack.cxx | 8 | ||||
-rw-r--r-- | idlc/source/aststruct.cxx | 10 | ||||
-rw-r--r-- | idlc/source/aststructinstance.cxx | 4 | ||||
-rw-r--r-- | idlc/source/fehelper.cxx | 14 | ||||
-rw-r--r-- | idlc/source/idlc.cxx | 24 | ||||
-rw-r--r-- | idlc/source/idlccompile.cxx | 20 | ||||
-rw-r--r-- | idlc/source/idlcmain.cxx | 6 | ||||
-rw-r--r-- | idlc/source/idlcproduce.cxx | 2 | ||||
-rw-r--r-- | idlc/source/options.cxx | 6 |
21 files changed, 151 insertions, 151 deletions
diff --git a/idlc/inc/idlc/astattribute.hxx b/idlc/inc/idlc/astattribute.hxx index 733dbd9e2419..86e4c0de7c74 100644 --- a/idlc/inc/idlc/astattribute.hxx +++ b/idlc/inc/idlc/astattribute.hxx @@ -47,16 +47,16 @@ public: OUString const * getDoc, DeclList const * getExc, OUString const * setDoc, DeclList const * setExc) { - if (getDoc != 0) { + if (getDoc != nullptr) { m_getDocumentation = *getDoc; } - if (getExc != 0) { + if (getExc != nullptr) { m_getExceptions = *getExc; } - if (setDoc != 0) { + if (setDoc != nullptr) { m_setDocumentation = *setDoc; } - if (setExc != 0) { + if (setExc != nullptr) { m_setExceptions = *setExc; } } diff --git a/idlc/inc/idlc/astinterface.hxx b/idlc/inc/idlc/astinterface.hxx index b5804d58864b..99f9dee5eea5 100644 --- a/idlc/inc/idlc/astinterface.hxx +++ b/idlc/inc/idlc/astinterface.hxx @@ -85,7 +85,7 @@ private: INTERFACE_INDIRECT_MANDATORY, INTERFACE_DIRECT_MANDATORY }; struct VisibleMember { - explicit VisibleMember(AstDeclaration const * theMandatory = 0): + explicit VisibleMember(AstDeclaration const * theMandatory = nullptr): mandatory(theMandatory) {} typedef std::map< OString, AstDeclaration const * > Optionals; diff --git a/idlc/inc/idlc/astoperation.hxx b/idlc/inc/idlc/astoperation.hxx index 88570918c162..a0a4f7b86cc6 100644 --- a/idlc/inc/idlc/astoperation.hxx +++ b/idlc/inc/idlc/astoperation.hxx @@ -39,7 +39,7 @@ public: bool isVariadic() const; - bool isConstructor() const { return m_pReturnType == 0; } + bool isConstructor() const { return m_pReturnType == nullptr; } void setExceptions(DeclList const * pExceptions); sal_uInt16 nExceptions() diff --git a/idlc/inc/idlc/astsequence.hxx b/idlc/inc/idlc/astsequence.hxx index 1169d8645f9c..1eefbea3f949 100644 --- a/idlc/inc/idlc/astsequence.hxx +++ b/idlc/inc/idlc/astsequence.hxx @@ -27,7 +27,7 @@ public: AstSequence(AstType const * pMemberType, AstScope* pScope) : AstType(NT_sequence, OString("[]")+pMemberType->getScopedName(), pScope) , m_pMemberType(pMemberType) - , m_pRelativName(NULL) + , m_pRelativName(nullptr) {} virtual ~AstSequence() { @@ -39,7 +39,7 @@ public: { return m_pMemberType; } virtual bool isUnsigned() const override - { return m_pMemberType != 0 && m_pMemberType->isUnsigned(); } + { return m_pMemberType != nullptr && m_pMemberType->isUnsigned(); } virtual const sal_Char* getRelativName() const override; private: diff --git a/idlc/inc/idlc/asttypedef.hxx b/idlc/inc/idlc/asttypedef.hxx index bc9c79d5d395..d31b7d62fc6f 100644 --- a/idlc/inc/idlc/asttypedef.hxx +++ b/idlc/inc/idlc/asttypedef.hxx @@ -34,7 +34,7 @@ public: { return m_pBaseType; } virtual bool isUnsigned() const override - { return m_pBaseType != 0 && m_pBaseType->isUnsigned(); } + { return m_pBaseType != nullptr && m_pBaseType->isUnsigned(); } virtual bool dump(RegistryKey& rKey) override; private: diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx index c23894ed902a..b9e11db7b6a2 100644 --- a/idlc/source/astdeclaration.cxx +++ b/idlc/source/astdeclaration.cxx @@ -132,7 +132,7 @@ bool AstDeclaration::dump(RegistryKey& rKey) { DeclList::const_iterator iter = pScope->getIteratorBegin(); DeclList::const_iterator end = pScope->getIteratorEnd(); - AstDeclaration* pDecl = NULL; + AstDeclaration* pDecl = nullptr; while ( iter != end && bRet) { pDecl = *iter; diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx index a352e9430cda..ea267b28b652 100644 --- a/idlc/source/astdump.cxx +++ b/idlc/source/astdump.cxx @@ -250,7 +250,7 @@ bool AstService::dump(RegistryKey& rKey) break; case NT_property: - static_cast<AstAttribute *>(*i)->dumpBlob(writer, propertyIndex++, 0); + static_cast<AstAttribute *>(*i)->dumpBlob(writer, propertyIndex++, nullptr); break; case NT_interface_member: @@ -388,7 +388,7 @@ void AstAttribute::dumpExceptions( DeclList const & exceptions, RTMethodMode flags, sal_uInt16 * methodIndex) { if (!exceptions.empty()) { - OSL_ASSERT(methodIndex != 0); + OSL_ASSERT(methodIndex != nullptr); sal_uInt16 idx = (*methodIndex)++; // exceptions.size() <= SAL_MAX_UINT16 already checked in // AstInterface::dump: diff --git a/idlc/source/astenum.cxx b/idlc/source/astenum.cxx index 14318b7b1787..cb2a4572b3b1 100644 --- a/idlc/source/astenum.cxx +++ b/idlc/source/astenum.cxx @@ -52,7 +52,7 @@ AstConstant* AstEnum::checkValue(AstExpression* pExpr) if ( pExpr->getExprValue()->u.lval > m_enumValueCount ) m_enumValueCount = pExpr->getExprValue()->u.lval + 1; - return NULL; + return nullptr; } bool AstEnum::dump(RegistryKey& rKey) diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx index 593cdb65cd14..cb5a044a27f1 100644 --- a/idlc/source/astexpression.cxx +++ b/idlc/source/astexpression.cxx @@ -33,8 +33,8 @@ AstExpression::AstExpression(ExprComb c, AstExpression *pExpr1, AstExpression *p : m_combOperator(c) , m_subExpr1(pExpr1) , m_subExpr2(pExpr2) - , m_exprValue(NULL) - , m_pSymbolicName(NULL) + , m_exprValue(nullptr) + , m_pSymbolicName(nullptr) { fillDefinitionDetails(); @@ -42,10 +42,10 @@ AstExpression::AstExpression(ExprComb c, AstExpression *pExpr1, AstExpression *p AstExpression::AstExpression(sal_Int32 l) : m_combOperator(EC_none) - , m_subExpr1(NULL) - , m_subExpr2(NULL) - , m_exprValue(NULL) - , m_pSymbolicName(NULL) + , m_subExpr1(nullptr) + , m_subExpr2(nullptr) + , m_exprValue(nullptr) + , m_pSymbolicName(nullptr) { fillDefinitionDetails(); @@ -56,10 +56,10 @@ AstExpression::AstExpression(sal_Int32 l) AstExpression::AstExpression(sal_Int32 l, ExprType et) : m_combOperator(EC_none) - , m_subExpr1(NULL) - , m_subExpr2(NULL) - , m_exprValue(NULL) - , m_pSymbolicName(NULL) + , m_subExpr1(nullptr) + , m_subExpr2(nullptr) + , m_exprValue(nullptr) + , m_pSymbolicName(nullptr) { fillDefinitionDetails(); @@ -70,10 +70,10 @@ AstExpression::AstExpression(sal_Int32 l, ExprType et) AstExpression::AstExpression(sal_Int64 h) : m_combOperator(EC_none) - , m_subExpr1(NULL) - , m_subExpr2(NULL) - , m_exprValue(NULL) - , m_pSymbolicName(NULL) + , m_subExpr1(nullptr) + , m_subExpr2(nullptr) + , m_exprValue(nullptr) + , m_pSymbolicName(nullptr) { fillDefinitionDetails(); @@ -84,10 +84,10 @@ AstExpression::AstExpression(sal_Int64 h) AstExpression::AstExpression(sal_uInt64 uh) : m_combOperator(EC_none) - , m_subExpr1(NULL) - , m_subExpr2(NULL) - , m_exprValue(NULL) - , m_pSymbolicName(NULL) + , m_subExpr1(nullptr) + , m_subExpr2(nullptr) + , m_exprValue(nullptr) + , m_pSymbolicName(nullptr) { fillDefinitionDetails(); @@ -98,10 +98,10 @@ AstExpression::AstExpression(sal_uInt64 uh) AstExpression::AstExpression(double d) : m_combOperator(EC_none) - , m_subExpr1(NULL) - , m_subExpr2(NULL) - , m_exprValue(NULL) - , m_pSymbolicName(NULL) + , m_subExpr1(nullptr) + , m_subExpr2(nullptr) + , m_exprValue(nullptr) + , m_pSymbolicName(nullptr) { fillDefinitionDetails(); @@ -112,9 +112,9 @@ AstExpression::AstExpression(double d) AstExpression::AstExpression(OString* scopedName) : m_combOperator(EC_symbol) - , m_subExpr1(NULL) - , m_subExpr2(NULL) - , m_exprValue(NULL) + , m_subExpr1(nullptr) + , m_subExpr2(nullptr) + , m_exprValue(nullptr) , m_pSymbolicName(scopedName) { fillDefinitionDetails(); @@ -136,7 +136,7 @@ AstExpression::~AstExpression() static bool coerce_value(AstExprValue *ev, ExprType t) { - if (ev == NULL) + if (ev == nullptr) return false; switch (t) @@ -692,7 +692,7 @@ bool AstExpression::coerce(ExprType t) /* * Is it already of the right type? */ - if (m_exprValue != NULL && m_exprValue->et == t) + if (m_exprValue != nullptr && m_exprValue->et == t) return true; /* * OK, must coerce @@ -701,7 +701,7 @@ bool AstExpression::coerce(ExprType t) * If already evaluated, return the result */ evaluate(); - if (m_exprValue == NULL) + if (m_exprValue == nullptr) return false; /* @@ -765,7 +765,7 @@ bool AstExpression::operator==(AstExpression *pExpr) return bRet; evaluate(); pExpr->evaluate(); - if (m_exprValue == NULL || pExpr->getExprValue() == NULL) + if (m_exprValue == nullptr || pExpr->getExprValue() == nullptr) return bRet; if (m_exprValue->et != pExpr->getExprValue()->et) return bRet; @@ -817,7 +817,7 @@ bool AstExpression::compare(AstExpression *pExpr) return bRet; evaluate(); pExpr->evaluate(); - if (m_exprValue == NULL || pExpr->getExprValue() == NULL) + if (m_exprValue == nullptr || pExpr->getExprValue() == nullptr) return bRet; if (m_exprValue->et != pExpr->getExprValue()->et) return bRet; @@ -863,7 +863,7 @@ bool AstExpression::compare(AstExpression *pExpr) void AstExpression::fillDefinitionDetails() { - m_pScope = idlc()->scopes()->depth() > 0 ? idlc()->scopes()->top() : NULL; + m_pScope = idlc()->scopes()->depth() > 0 ? idlc()->scopes()->top() : nullptr; m_lineNo = idlc()->getLineNumber(); m_fileName = idlc()->getFileName(); } @@ -873,7 +873,7 @@ void AstExpression::evaluate() /* * Already evaluated? */ - if ( m_exprValue != NULL ) + if ( m_exprValue != nullptr ) return; /* * OK, must evaluate operator @@ -914,18 +914,18 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bin_op() if ( m_combOperator == EC_mod ) eType = ET_hyper; - if (m_subExpr1 == NULL || m_subExpr2 == NULL) - return NULL; + if (m_subExpr1 == nullptr || m_subExpr2 == nullptr) + return nullptr; m_subExpr1->evaluate(); - if (m_subExpr1->getExprValue() == NULL) - return NULL; + if (m_subExpr1->getExprValue() == nullptr) + return nullptr; if (!m_subExpr1->coerce(eType)) - return NULL; + return nullptr; m_subExpr2->evaluate(); - if (m_subExpr2->getExprValue() == NULL) - return NULL; + if (m_subExpr2->getExprValue() == nullptr) + return nullptr; if (!m_subExpr2->coerce(eType)) - return NULL; + return nullptr; std::unique_ptr< AstExprValue > retval(new AstExprValue()); retval->et = eType; @@ -934,7 +934,7 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bin_op() { case EC_mod: if (m_subExpr2->getExprValue()->u.hval == 0) - return NULL; + return nullptr; retval->u.hval = m_subExpr1->getExprValue()->u.hval % m_subExpr2->getExprValue()->u.hval; break; case EC_add: @@ -948,11 +948,11 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bin_op() break; case EC_div: if (m_subExpr2->getExprValue()->u.dval == 0.0) - return NULL; + return nullptr; retval->u.dval = m_subExpr1->getExprValue()->u.dval / m_subExpr2->getExprValue()->u.dval; break; default: - return NULL; + return nullptr; } return retval; @@ -960,18 +960,18 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bin_op() std::unique_ptr<AstExprValue> AstExpression::eval_bit_op() { - if (m_subExpr1 == NULL || m_subExpr2 == NULL) - return NULL; + if (m_subExpr1 == nullptr || m_subExpr2 == nullptr) + return nullptr; m_subExpr1->evaluate(); - if (m_subExpr1->getExprValue() == NULL) - return NULL; + if (m_subExpr1->getExprValue() == nullptr) + return nullptr; if (!m_subExpr1->coerce(ET_long)) - return NULL; + return nullptr; m_subExpr2->evaluate(); - if (m_subExpr2->getExprValue() == NULL) - return NULL; + if (m_subExpr2->getExprValue() == nullptr) + return nullptr; if (!m_subExpr2->coerce(ET_long)) - return NULL; + return nullptr; std::unique_ptr< AstExprValue > retval(new AstExprValue()); retval->et = ET_long; @@ -994,7 +994,7 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bit_op() retval->u.lval = m_subExpr1->getExprValue()->u.lval >> m_subExpr2->getExprValue()->u.lval; break; default: - return NULL; + return nullptr; } return retval; @@ -1002,13 +1002,13 @@ std::unique_ptr<AstExprValue> AstExpression::eval_bit_op() std::unique_ptr<AstExprValue> AstExpression::eval_un_op() { - if (m_subExpr1 == NULL) - return NULL; + if (m_subExpr1 == nullptr) + return nullptr; m_subExpr1->evaluate(); - if (m_subExpr1->getExprValue() == NULL) - return NULL; + if (m_subExpr1->getExprValue() == nullptr) + return nullptr; if (!m_subExpr1->coerce(ET_double)) - return NULL; + return nullptr; std::unique_ptr< AstExprValue > retval(new AstExprValue()); retval->et = ET_double; @@ -1023,11 +1023,11 @@ std::unique_ptr<AstExprValue> AstExpression::eval_un_op() break; case EC_bit_neg: if (!m_subExpr1->coerce(ET_long)) - return NULL; + return nullptr; retval->u.lval = ~m_subExpr1->getExprValue()->u.lval; break; default: - return NULL; + return nullptr; } return retval; @@ -1035,17 +1035,17 @@ std::unique_ptr<AstExprValue> AstExpression::eval_un_op() AstExprValue* AstExpression::eval_symbol() { - AstScope *pScope = 0; + AstScope *pScope = nullptr; AstDeclaration *pDecl; AstConstant *pConst; /* * Is there a symbol stored? */ - if (m_pSymbolicName == NULL) + if (m_pSymbolicName == nullptr) { ErrorHandler::evalError(this); - return NULL; + return nullptr; } /* * Get current scope for lookup @@ -1055,16 +1055,16 @@ AstExprValue* AstExpression::eval_symbol() if ( !pScope ) { ErrorHandler::lookupError(*m_pSymbolicName); - return NULL; + return nullptr; } /* * Do lookup */ pDecl = pScope->lookupByName(*m_pSymbolicName); - if (pDecl == NULL) + if (pDecl == nullptr) { ErrorHandler::lookupError(*m_pSymbolicName); - return NULL; + return nullptr; } /* * Is it a constant? @@ -1073,11 +1073,11 @@ AstExprValue* AstExpression::eval_symbol() pDecl->getNodeType() != NT_enum_val) { ErrorHandler::constantExpected(pDecl, *m_pSymbolicName); - return NULL; + return nullptr; } if (!ErrorHandler::checkPublished(pDecl)) { - return NULL; + return nullptr; } /* * OK, now evaluate the constant we just got, to produce its value diff --git a/idlc/source/astinterface.cxx b/idlc/source/astinterface.cxx index 8dae59ea2bd7..e1336fb0a3f5 100644 --- a/idlc/source/astinterface.cxx +++ b/idlc/source/astinterface.cxx @@ -34,9 +34,9 @@ AstInterface::AstInterface(const OString& name, , AstScope(NT_interface) , m_mandatoryInterfaces(0) , m_bIsDefined(false) - , m_bSingleInheritance(pInherits != 0) + , m_bSingleInheritance(pInherits != nullptr) { - if (pInherits != 0) { + if (pInherits != nullptr) { addInheritedInterface(pInherits, false, OUString()); } } @@ -317,7 +317,7 @@ void AstInterface::checkMemberClashes( VisibleMembers::const_iterator i( m_visibleMembers.find(member->getLocalName())); if (i != m_visibleMembers.end()) { - if (i->second.mandatory != 0) { + if (i->second.mandatory != nullptr) { if (i->second.mandatory->getScopedName() != member->getScopedName()) { DoubleMemberDeclaration d; @@ -383,7 +383,7 @@ void AstInterface::addOptionalVisibleMembers(AstInterface const * ifc) { VisibleMembers::value_type( (*i)->getLocalName(), VisibleMember())).first; } - if (visible->second.mandatory == 0) { + if (visible->second.mandatory == nullptr) { visible->second.optionals.insert( VisibleMember::Optionals::value_type(ifc->getScopedName(), *i)); } diff --git a/idlc/source/astoperation.cxx b/idlc/source/astoperation.cxx index 6e9f6753a064..921a3e5365b1 100644 --- a/idlc/source/astoperation.cxx +++ b/idlc/source/astoperation.cxx @@ -27,7 +27,7 @@ void AstOperation::setExceptions(DeclList const * pExceptions) { - if (pExceptions != 0) { + if (pExceptions != nullptr) { m_exceptions = *pExceptions; } } @@ -45,7 +45,7 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index) RTMethodMode methodMode = RTMethodMode::TWOWAY; OUString returnTypeName; - if (m_pReturnType == 0) { + if (m_pReturnType == nullptr) { returnTypeName = "void"; } else { returnTypeName = OStringToOUString( diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index cd8a48387496..23b62fa45675 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -42,14 +42,14 @@ AstScope::~AstScope() AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl) { - AstDeclaration* pDeclaration = NULL; + AstDeclaration* pDeclaration = nullptr; - if ((pDeclaration = lookupForAdd(pDecl)) != NULL) + if ((pDeclaration = lookupForAdd(pDecl)) != nullptr) { if ( pDecl->hasAncestor(pDeclaration) ) { ErrorHandler::error2(EIDL_REDEF_SCOPE, pDecl, pDeclaration); - return NULL; + return nullptr; } if ( (pDecl->getNodeType() == pDeclaration->getNodeType()) && (pDecl->getNodeType() == NT_sequence @@ -76,7 +76,7 @@ AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl) } ErrorHandler::error2(EIDL_REDEF_SCOPE, scopeAsDecl(this), pDecl); - return NULL; + return nullptr; } m_declarations.push_back(pDecl); @@ -101,17 +101,17 @@ sal_uInt16 AstScope::getNodeCount(NodeType nodeType) AstDeclaration* AstScope::lookupByName(const OString& scopedName) { - AstDeclaration* pDecl = NULL; - AstScope* pScope = NULL; + AstDeclaration* pDecl = nullptr; + AstScope* pScope = nullptr; if (scopedName.isEmpty()) - return NULL; + return nullptr; // If name starts with "::" start look up in global scope if ( isGlobal(scopedName) ) { pDecl = scopeAsDecl(this); if ( !pDecl ) - return NULL; + return nullptr; pScope = pDecl->getScope(); // If this is the global scope ... @@ -146,7 +146,7 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName) if ( pScope ) pDecl = pScope->lookupByName(scopedName); else - pDecl = NULL; + pDecl = nullptr; // Special case for scope which is an interface. We // have to look in the inherited interfaces as well. @@ -185,7 +185,7 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName) pDecl = pScope->lookupByName(scopedName); } else { - pDecl = NULL; + pDecl = nullptr; } } @@ -206,7 +206,7 @@ AstDeclaration* AstScope::lookupByNameLocal(const OString& name) const return pDecl; ++iter; } - return NULL; + return nullptr; } AstDeclaration* AstScope::lookupInInherited(const OString& scopedName) const @@ -214,7 +214,7 @@ AstDeclaration* AstScope::lookupInInherited(const OString& scopedName) const const AstInterface* pInterface = dynamic_cast<const AstInterface*>(this); if ( !pInterface ) - return NULL; + return nullptr; // Can't look in an interface which was not yet defined if ( !pInterface->getScope() ) @@ -239,17 +239,17 @@ AstDeclaration* AstScope::lookupInInherited(const OString& scopedName) const ++iter; } // Not found - return NULL; + return nullptr; } AstDeclaration* AstScope::lookupPrimitiveType(ExprType type) { - AstDeclaration* pDecl = NULL; - AstScope* pScope = NULL; + AstDeclaration* pDecl = nullptr; + AstScope* pScope = nullptr; OString typeName; pDecl = scopeAsDecl(this); if ( !pDecl ) - return NULL; + return nullptr; pScope = pDecl->getScope(); if ( pScope) return pScope->lookupPrimitiveType(type); @@ -316,13 +316,13 @@ AstDeclaration* AstScope::lookupPrimitiveType(ExprType type) return pDecl; } - return NULL; + return nullptr; } AstDeclaration* AstScope::lookupForAdd(AstDeclaration* pDecl) { if ( !pDecl ) - return NULL; + return nullptr; AstDeclaration* pRetDecl = lookupByNameLocal(pDecl->getLocalName()); diff --git a/idlc/source/aststack.cxx b/idlc/source/aststack.cxx index e971152b8715..83fed47377eb 100644 --- a/idlc/source/aststack.cxx +++ b/idlc/source/aststack.cxx @@ -45,14 +45,14 @@ AstStack::~AstStack() AstScope* AstStack::top() { if (m_top < 1) - return NULL; + return nullptr; return m_stack[m_top - 1]; } AstScope* AstStack::bottom() { if (m_top == 0) - return NULL; + return nullptr; return m_stack[0]; } @@ -61,7 +61,7 @@ AstScope* AstStack::nextToTop() AstScope *tmp, *retval; if (depth() < 2) - return NULL; + return nullptr; tmp = top(); // Save top (void) pop(); // Pop it @@ -77,7 +77,7 @@ AstScope* AstStack::topNonNull() if ( m_stack[i - 1] ) return m_stack[i - 1]; } - return NULL; + return nullptr; } AstStack* AstStack::push(AstScope* pScope) diff --git a/idlc/source/aststruct.cxx b/idlc/source/aststruct.cxx index d2232990e615..2fb9d6ffc869 100644 --- a/idlc/source/aststruct.cxx +++ b/idlc/source/aststruct.cxx @@ -34,7 +34,7 @@ AstStruct::AstStruct( i != typeParameters.end(); ++i) { m_typeParameters.push_back( - new AstType(NT_type_parameter, *i, 0)); + new AstType(NT_type_parameter, *i, nullptr)); } } @@ -67,7 +67,7 @@ AstDeclaration const * AstStruct::findTypeParameter(OString const & name) return *i; } } - return 0; + return nullptr; } bool AstStruct::isType() const { @@ -108,9 +108,9 @@ bool AstStruct::dump(RegistryKey& rKey) ? TYPEREG_VERSION_0 : TYPEREG_VERSION_1), getDocumentation(), emptyStr, typeClass, m_bPublished, OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), - m_pBaseType == 0 ? 0 : 1, nMember, 0, + m_pBaseType == nullptr ? 0 : 1, nMember, 0, static_cast< sal_uInt16 >(m_typeParameters.size())); - if (m_pBaseType != 0) { + if (m_pBaseType != nullptr) { aBlob.setSuperTypeName( 0, OStringToOUString( @@ -121,7 +121,7 @@ bool AstStruct::dump(RegistryKey& rKey) { DeclList::const_iterator iter = getIteratorBegin(); DeclList::const_iterator end = getIteratorEnd(); - AstMember* pMember = NULL; + AstMember* pMember = nullptr; sal_uInt16 index = 0; while ( iter != end ) { diff --git a/idlc/source/aststructinstance.cxx b/idlc/source/aststructinstance.cxx index f5477464d829..3c5bb6740c34 100644 --- a/idlc/source/aststructinstance.cxx +++ b/idlc/source/aststructinstance.cxx @@ -32,7 +32,7 @@ OString createName( AstType const * typeTemplate, DeclList const * typeArguments) { OStringBuffer buf(typeTemplate->getScopedName()); - if (typeArguments != 0) { + if (typeArguments != nullptr) { buf.append('<'); for (DeclList::const_iterator i(typeArguments->begin()); i != typeArguments->end(); ++i) @@ -40,7 +40,7 @@ OString createName( if (i != typeArguments->begin()) { buf.append(','); } - if (*i != 0) { + if (*i != nullptr) { buf.append((*i)->getScopedName()); } } diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx index 2a5fb1d3468c..4e4c549dc5b0 100644 --- a/idlc/source/fehelper.cxx +++ b/idlc/source/fehelper.cxx @@ -49,20 +49,20 @@ AstType const * FeDeclarator::compose(AstDeclaration const * pDecl) { const AstType* pType; - if ( pDecl == 0 ) + if ( pDecl == nullptr ) { - return NULL; + return nullptr; } if ( !pDecl->isType() ) { ErrorHandler::noTypeError(pDecl); - return NULL; + return nullptr; } pType = static_cast<const AstType*>(pDecl); - if (m_declType == FD_simple || m_pComplexPart == NULL) + if (m_declType == FD_simple || m_pComplexPart == nullptr) return pType; - return NULL; // return through this statement should not happen + return nullptr; // return through this statement should not happen } FeInheritanceHeader::FeInheritanceHeader( @@ -70,9 +70,9 @@ FeInheritanceHeader::FeInheritanceHeader( std::vector< OString > * typeParameters) : m_nodeType(nodeType) , m_pName(pName) - , m_pInherits(NULL) + , m_pInherits(nullptr) { - if (typeParameters != 0) { + if (typeParameters != nullptr) { m_typeParameters = *typeParameters; } initializeInherits(pInherits); diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx index 94d152501a01..97fe49a2a1bc 100644 --- a/idlc/source/idlc.cxx +++ b/idlc/source/idlc.cxx @@ -42,7 +42,7 @@ AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope) { - if (pScope == NULL) return NULL; + if (pScope == nullptr) return nullptr; switch( pScope->getScopeNodeType() ) { @@ -65,13 +65,13 @@ AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope) case NT_enum: return static_cast<AstEnum*>(pScope); default: - return NULL; + return nullptr; } } AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl) { - if (pDecl == NULL) return NULL; + if (pDecl == nullptr) return nullptr; switch(pDecl->getNodeType()) { @@ -94,7 +94,7 @@ AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl) case NT_operation: return static_cast<AstOperation*>(pDecl); default: - return NULL; + return nullptr; } } @@ -120,7 +120,7 @@ static void SAL_CALL predefineXInterface(AstModule* pRoot) pParentScope = pModule; // define XInterface - AstInterface* pInterface = new AstInterface(OString("XInterface"), NULL, pParentScope); + AstInterface* pInterface = new AstInterface(OString("XInterface"), nullptr, pParentScope); pInterface->setDefined(); pInterface->setPredefined(true); pInterface->setPublished(); @@ -211,7 +211,7 @@ Idlc::Idlc(Options* pOptions) { m_pScopes = new AstStack(); // init root object after construction - m_pRoot = NULL; + m_pRoot = nullptr; m_pErrorHandler = new ErrorHandler(); m_bGenerateDoc = m_pOptions->isValid("-C"); } @@ -226,7 +226,7 @@ Idlc::~Idlc() void Idlc::init() { delete m_pRoot; - m_pRoot = new AstModule(NT_root, OString(), NULL); + m_pRoot = new AstModule(NT_root, OString(), nullptr); // push the root node on the stack m_pScopes->push(m_pRoot); @@ -253,7 +253,7 @@ void Idlc::reset() m_pScopes->clear(); delete m_pRoot; - m_pRoot = new AstModule(NT_root, OString(), NULL); + m_pRoot = new AstModule(NT_root, OString(), nullptr); // push the root node on the stack m_pScopes->push(m_pRoot); @@ -348,7 +348,7 @@ Idlc::dumpDeps(OString const& rDepFile, OString const& rTarget) return ::osl::FileBase::E_None == rc; } -static Idlc* pStaticIdlc = NULL; +static Idlc* pStaticIdlc = nullptr; Idlc* SAL_CALL idlc() { @@ -364,7 +364,7 @@ Idlc* SAL_CALL setIdlc(Options* pOptions) } AstDeclaration const * resolveTypedefs(AstDeclaration const * type) { - if (type != 0) { + if (type != nullptr) { while (type->getNodeType() == NT_typedef) { type = static_cast< AstTypeDef const * >(type)->getBaseType(); } @@ -377,8 +377,8 @@ AstDeclaration const * deconstructAndResolveTypedefs( { *rank = 0; for (;;) { - if (type == 0) { - return 0; + if (type == nullptr) { + return nullptr; } switch (type->getNodeType()) { case NT_typedef: diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index beb9fb8648dc..d217517f35c2 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -174,7 +174,7 @@ bool copyFile(const OString* source, const OString& target) { bool bRet = true; - FILE* pSource = source == 0 ? stdin : fopen(source->getStr(), "rb"); + FILE* pSource = source == nullptr ? stdin : fopen(source->getStr(), "rb"); if ( !pSource ) return false; @@ -195,7 +195,7 @@ bool copyFile(const OString* source, const OString& target) { if ( (fwrite(pBuffer, 1, readSize, pTarget)) != readSize || ferror(pTarget) ) { - if (source != 0) { + if (source != nullptr) { fclose(pSource); } fclose(pTarget); @@ -204,7 +204,7 @@ bool copyFile(const OString* source, const OString& target) } } - if (source != 0) { + if (source != nullptr) { fclose(pSource); } if ( fflush(pTarget) ) @@ -221,7 +221,7 @@ sal_Int32 compileFile(const OString * pathname) OString preprocFile = makeTempName(OString("idlf_")); OString fileName; - if (pathname == 0) { + if (pathname == nullptr) { fileName = "stdin"; } else { fileName = *pathname; @@ -231,7 +231,7 @@ sal_Int32 compileFile(const OString * pathname) { fprintf(stderr, "%s: could not copy %s%s to %s\n", idlc()->getOptions()->getProgramName().getStr(), - pathname == 0 ? "" : "file ", fileName.getStr(), + pathname == nullptr ? "" : "file ", fileName.getStr(), tmpFile.getStr()); exit(99); } @@ -315,11 +315,11 @@ sal_Int32 compileFile(const OString * pathname) #else // SYSTEM_UCPP cpp = OUString(UCPP); #endif - oslProcess hProcess = NULL; + oslProcess hProcess = nullptr; oslProcessError procError = osl_Process_E_None; const int nCmdArgs = lCppArgs.size(); - rtl_uString** pCmdArgs = 0; + rtl_uString** pCmdArgs = nullptr; pCmdArgs = static_cast<rtl_uString**>(rtl_allocateZeroMemory(nCmdArgs * sizeof(rtl_uString*))); ::std::vector< OUString >::iterator iter = lCppArgs.begin(); @@ -331,7 +331,7 @@ sal_Int32 compileFile(const OString * pathname) } procError = osl_executeProcess( cpp.pData, pCmdArgs, nCmdArgs, osl_Process_WAIT, - 0, startDir.pData, 0, 0, &hProcess ); + nullptr, startDir.pData, nullptr, 0, &hProcess ); oslProcessInfo hInfo; hInfo.Size = (sal_uInt32)(sizeof(oslProcessInfo)); @@ -348,7 +348,7 @@ sal_Int32 compileFile(const OString * pathname) else fprintf(stderr, "%s: preprocessing %s%s failed\n", pOptions->getProgramName().getStr(), - pathname == 0 ? "" : "file ", fileName.getStr()); + pathname == nullptr ? "" : "file ", fileName.getStr()); osl_freeProcessHandle(hProcess); rtl_freeMemory(pCmdArgs); @@ -377,7 +377,7 @@ sal_Int32 compileFile(const OString * pathname) // parse file yyin = fopen(preprocFile.getStr(), "r"); - if (yyin == NULL) + if (yyin == nullptr) { fprintf(stderr, "%s: Could not open cpp output file %s\n", pOptions->getProgramName().getStr(), preprocFile.getStr()); diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx index 86a9755b1d08..616a3aa135bf 100644 --- a/idlc/source/idlcmain.cxx +++ b/idlc/source/idlcmain.cxx @@ -47,7 +47,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) fprintf( stdout, "%s: Compiling stdin\n", options.getProgramName().getStr()); - nErrors = compileFile(0); + nErrors = compileFile(nullptr); if ( ( idlc()->getWarningCount() > 0 ) && !options.quiet() ) { fprintf( stdout, "%s: detected %lu warnings compiling stdin\n", @@ -68,7 +68,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if (nErrors > 0) { removeIfExists(outputUrl); } else { - nErrors = produceFile(outputUrl, 0); + nErrors = produceFile(outputUrl, nullptr); } idlc()->reset(); } @@ -132,7 +132,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } else { sPair_t const pair(depFileUrl, outputFile); nErrors = produceFile(outputFileUrl, - (options.isValid("-M")) ? &pair : 0); + (options.isValid("-M")) ? &pair : nullptr); } idlc()->reset(); diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index f40cb06ed0e4..fba3d6bbe0af 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -39,7 +39,7 @@ using namespace ::osl; -StringList* pCreatedDirectories = NULL; +StringList* pCreatedDirectories = nullptr; static bool checkOutputPath(const OString& completeName) { diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index f4aad143bb05..229e5b45f5a7 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -62,7 +62,7 @@ Options::~Options() // static bool Options::checkArgument (std::vector< std::string > & rArgs, char const * arg, size_t len) { - bool result = ((arg != 0) && (len > 0)); + bool result = ((arg != nullptr) && (len > 0)); OSL_PRECOND(result, "idlc::Options::checkArgument(): invalid arguments"); if (result) { @@ -117,7 +117,7 @@ bool Options::checkArgument (std::vector< std::string > & rArgs, char const * ar bool Options::checkCommandFile (std::vector< std::string > & rArgs, char const * filename) { FILE * fp = fopen(filename, "r"); - if (fp == 0) + if (fp == nullptr) { fprintf(stderr, "ERROR: can't open command file \"%s\"\n", filename); return false; @@ -175,7 +175,7 @@ bool Options::checkCommandFile (std::vector< std::string > & rArgs, char const * bool Options::badOption(char const * reason, std::string const & rArg) throw(IllegalArgument) { OStringBuffer message; - if (reason != 0) + if (reason != nullptr) { message.append(reason); message.append(" option '"); message.append(rArg.c_str()); message.append("'"); throw IllegalArgument(message.makeStringAndClear()); |