diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:28:02 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:58 +0100 |
commit | 6dea86213c495721790462a7037b0fafc6efa522 (patch) | |
tree | 67bb0fe226c6c8e74e5a640c910da89ff110d458 /unoxml/source | |
parent | cf7dc8bc19650fe5e814205b512dffad8299c276 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I4f9d6c93a0bdbba290277a41537ba2728d1ee4f5
Diffstat (limited to 'unoxml/source')
23 files changed, 264 insertions, 264 deletions
diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx index bf03d9ac5d87..d6ee2ef72b84 100644 --- a/unoxml/source/dom/attr.cxx +++ b/unoxml/source/dom/attr.cxx @@ -47,7 +47,7 @@ namespace DOM xmlNsPtr CAttr::GetNamespace(xmlNodePtr const pNode) { if (!m_pNamespace.get()) { - return 0; + return nullptr; } xmlChar const*const pUri(reinterpret_cast<xmlChar const*>( m_pNamespace->first.getStr())); @@ -102,7 +102,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if ((0 == m_aNodePtr) || (0 == m_aAttrPtr)) { + if ((nullptr == m_aNodePtr) || (nullptr == m_aAttrPtr)) { return OUString(); } OUString const aName(reinterpret_cast<char const *>(m_aAttrPtr->name), @@ -119,11 +119,11 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if ((0 == m_aNodePtr) || (0 == m_aAttrPtr)) { - return 0; + if ((nullptr == m_aNodePtr) || (nullptr == m_aAttrPtr)) { + return nullptr; } - if (0 == m_aAttrPtr->parent) { - return 0; + if (nullptr == m_aAttrPtr->parent) { + return nullptr; } Reference< XElement > const xRet( static_cast< XNode* >(GetOwnerDocument().GetCNode( @@ -152,10 +152,10 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if ((0 == m_aNodePtr) || (0 == m_aAttrPtr)) { + if ((nullptr == m_aNodePtr) || (nullptr == m_aAttrPtr)) { return OUString(); } - if (0 == m_aAttrPtr->children) { + if (nullptr == m_aAttrPtr->children) { return OUString(); } char const*const pContent((m_aAttrPtr->children) @@ -173,7 +173,7 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if ((0 == m_aNodePtr) || (0 == m_aAttrPtr)) { + if ((nullptr == m_aNodePtr) || (nullptr == m_aAttrPtr)) { return; } @@ -191,10 +191,10 @@ namespace DOM m_aAttrPtr->children = xmlStringGetNodeList(m_aAttrPtr->doc, buffer.get()); xmlNodePtr tmp = m_aAttrPtr->children; - while (tmp != NULL) { + while (tmp != nullptr) { tmp->parent = m_aNodePtr; tmp->doc = m_aAttrPtr->doc; - if (tmp->next == NULL) + if (tmp->next == nullptr) m_aNodePtr->last = tmp; tmp = tmp->next; } diff --git a/unoxml/source/dom/attributesmap.cxx b/unoxml/source/dom/attributesmap.cxx index 3f2568899759..13be27c55ec1 100644 --- a/unoxml/source/dom/attributesmap.cxx +++ b/unoxml/source/dom/attributesmap.cxx @@ -45,10 +45,10 @@ namespace DOM sal_Int32 count = 0; xmlNodePtr pNode = m_pElement->GetNodePtr(); - if (pNode != NULL) + if (pNode != nullptr) { xmlAttrPtr cur = pNode->properties; - while (cur != NULL) + while (cur != nullptr) { count++; cur = cur->next; @@ -67,12 +67,12 @@ namespace DOM Reference< XNode > aNode; xmlNodePtr pNode = m_pElement->GetNodePtr(); - if (pNode != NULL) + if (pNode != nullptr) { OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8); xmlChar const * xName = reinterpret_cast<xmlChar const *>(o1.getStr()); xmlAttrPtr cur = pNode->properties; - while (cur != NULL) + while (cur != nullptr) { if( strcmp(reinterpret_cast<char const *>(xName), reinterpret_cast<char const *>(cur->name)) == 0) { @@ -98,7 +98,7 @@ namespace DOM Reference< XNode > aNode; xmlNodePtr pNode = m_pElement->GetNodePtr(); - if (pNode != NULL) + if (pNode != nullptr) { OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8); xmlChar const * xName = reinterpret_cast<xmlChar const *>(o1.getStr()); @@ -107,7 +107,7 @@ namespace DOM reinterpret_cast<xmlChar const*>(o2.getStr()); xmlNsPtr const pNs = xmlSearchNsByHref(pNode->doc, pNode, xNs); xmlAttrPtr cur = pNode->properties; - while (cur != NULL && pNs != NULL) + while (cur != nullptr && pNs != nullptr) { if( strcmp(reinterpret_cast<char const *>(xName), reinterpret_cast<char const *>(cur->name)) == 0 && cur->ns == pNs) @@ -132,11 +132,11 @@ namespace DOM Reference< XNode > aNode; xmlNodePtr pNode = m_pElement->GetNodePtr(); - if (pNode != NULL) + if (pNode != nullptr) { xmlAttrPtr cur = pNode->properties; sal_Int32 count = 0; - while (cur != NULL) + while (cur != nullptr) { if (count == index) { diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx index e1d7534edb21..0f1be2eec1f2 100644 --- a/unoxml/source/dom/characterdata.cxx +++ b/unoxml/source/dom/characterdata.cxx @@ -65,7 +65,7 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); xmlNodeAddContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(arg, RTL_TEXTENCODING_UTF8).getStr())); @@ -84,7 +84,7 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { // get current data std::shared_ptr<xmlChar const> const pContent( @@ -119,10 +119,10 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aData; - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { OSL_ENSURE(m_aNodePtr->content, "character data node with NULL content, please inform lars.oppermann@sun.com!"); - if (m_aNodePtr->content != NULL) + if (m_aNodePtr->content != nullptr) { aData = OUString(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); } @@ -139,7 +139,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); sal_Int32 length = 0; - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { OUString aData(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); length = aData.getLength(); @@ -155,7 +155,7 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { // get current data std::shared_ptr<xmlChar const> const pContent( @@ -190,7 +190,7 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { // get current data std::shared_ptr<xmlChar const> const pContent( @@ -225,7 +225,7 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8); xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(data, RTL_TEXTENCODING_UTF8).getStr())); @@ -245,7 +245,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aStr; - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { // get current data std::shared_ptr<xmlChar const> const pContent( diff --git a/unoxml/source/dom/childlist.cxx b/unoxml/source/dom/childlist.cxx index e993d64fb2fd..d301d7aa9a59 100644 --- a/unoxml/source/dom/childlist.cxx +++ b/unoxml/source/dom/childlist.cxx @@ -44,13 +44,13 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); sal_Int32 length = 0; - if (m_pNode != NULL) + if (m_pNode != nullptr) { xmlNodePtr cur = m_pNode->GetNodePtr(); - if (0 != cur) { + if (nullptr != cur) { cur = cur->children; } - while (cur != NULL) + while (cur != nullptr) { length++; cur = cur->next; @@ -67,13 +67,13 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (m_pNode != NULL) + if (m_pNode != nullptr) { xmlNodePtr cur = m_pNode->GetNodePtr(); - if (0 != cur) { + if (nullptr != cur) { cur = cur->children; } - while (cur != NULL) + while (cur != nullptr) { if (index-- == 0) { return Reference< XNode >( @@ -82,7 +82,7 @@ namespace DOM cur = cur->next; } } - return 0; + return nullptr; } } diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index f17910ba1268..f43d0846cc01 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -60,14 +60,14 @@ namespace DOM { // find the doc type xmlNodePtr cur = i_pDocument->children; - while (cur != NULL) + while (cur != nullptr) { if ((cur->type == XML_DOCUMENT_TYPE_NODE) || (cur->type == XML_DTD_NODE)) { return cur; } } - return 0; + return nullptr; } /// get the pointer to the root element node of the document @@ -75,7 +75,7 @@ namespace DOM { // find the document element xmlNodePtr cur = i_pDocument->children; - while (cur != NULL) + while (cur != nullptr) { if (cur->type == XML_ELEMENT_NODE) break; @@ -162,8 +162,8 @@ namespace DOM ::rtl::Reference<CNode> CDocument::GetCNode(xmlNodePtr const pNode, bool const bCreate) { - if (0 == pNode) { - return 0; + if (nullptr == pNode) { + return nullptr; } //check whether there is already an instance for this node nodemap_t::const_iterator const i = m_NodeMap.find(pNode); @@ -178,7 +178,7 @@ namespace DOM } } - if (!bCreate) { return 0; } + if (!bCreate) { return nullptr; } // there is not yet an instance wrapping this node, // create it and store it in the map @@ -259,7 +259,7 @@ namespace DOM break; } - if (pCNode != 0) { + if (pCNode != nullptr) { bool const bInserted = m_NodeMap.insert( nodemap_t::value_type(pNode, ::std::make_pair(WeakReference<XNode>(pCNode.get()), @@ -268,7 +268,7 @@ namespace DOM OSL_ASSERT(bInserted); if (!bInserted) { // if insertion failed, delete new instance and return null - return 0; + return nullptr; } } @@ -286,9 +286,9 @@ namespace DOM { i_xHandler->startDocument(); for (xmlNodePtr pChild = m_aNodePtr->children; - pChild != 0; pChild = pChild->next) { + pChild != nullptr; pChild = pChild->next) { ::rtl::Reference<CNode> const pNode = GetCNode(pChild); - OSL_ENSURE(pNode != 0, "CNode::get returned 0"); + OSL_ENSURE(pNode != nullptr, "CNode::get returned 0"); pNode->saxify(i_xHandler); } i_xHandler->endDocument(); @@ -298,9 +298,9 @@ namespace DOM { rContext.mxDocHandler->startDocument(); for (xmlNodePtr pChild = m_aNodePtr->children; - pChild != 0; pChild = pChild->next) { + pChild != nullptr; pChild = pChild->next) { ::rtl::Reference<CNode> const pNode = GetCNode(pChild); - OSL_ENSURE(pNode != 0, "CNode::get returned 0"); + OSL_ENSURE(pNode != nullptr, "CNode::get returned 0"); pNode->fastSaxify(rContext); } rContext.mxDocHandler->endDocument(); @@ -314,10 +314,10 @@ namespace DOM return true; case NodeType_ELEMENT_NODE: // there may be only one! - return 0 == lcl_getDocumentRootPtr(m_aDocPtr); + return nullptr == lcl_getDocumentRootPtr(m_aDocPtr); case NodeType_DOCUMENT_TYPE_NODE: // there may be only one! - return 0 == lcl_getDocumentType(m_aDocPtr); + return nullptr == lcl_getDocumentType(m_aDocPtr); default: return false; } @@ -397,8 +397,8 @@ namespace DOM // setup libxml IO and write data to output stream IOContext ioctx = {m_rOutputStream, false}; xmlOutputBufferPtr pOut = xmlOutputBufferCreateIO( - writeCallback, closeCallback, &ioctx, NULL); - xmlSaveFileTo(pOut, m_aNodePtr->doc, NULL); + writeCallback, closeCallback, &ioctx, nullptr); + xmlSaveFileTo(pOut, m_aNodePtr->doc, nullptr); } // call listeners @@ -439,7 +439,7 @@ namespace DOM OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8); xmlChar const *xName = reinterpret_cast<xmlChar const *>(o1.getStr()); - xmlAttrPtr const pAttr = xmlNewDocProp(m_aDocPtr, xName, NULL); + xmlAttrPtr const pAttr = xmlNewDocProp(m_aDocPtr, xName, nullptr); ::rtl::Reference< CAttr > const pCAttr( dynamic_cast< CAttr* >(GetCNode( reinterpret_cast<xmlNodePtr>(pAttr)).get())); @@ -472,7 +472,7 @@ namespace DOM } oUri = OUStringToOString(ns, RTL_TEXTENCODING_UTF8); xmlAttrPtr const pAttr = xmlNewDocProp(m_aDocPtr, - reinterpret_cast<xmlChar const*>(oName.getStr()), 0); + reinterpret_cast<xmlChar const*>(oName.getStr()), nullptr); ::rtl::Reference< CAttr > const pCAttr( dynamic_cast< CAttr* >(GetCNode( reinterpret_cast<xmlNodePtr>(pAttr)).get())); @@ -538,7 +538,7 @@ namespace DOM OString o1 = OUStringToOString(tagName, RTL_TEXTENCODING_UTF8); xmlChar const *xName = reinterpret_cast<xmlChar const *>(o1.getStr()); - xmlNodePtr const pNode = xmlNewDocNode(m_aDocPtr, NULL, xName, NULL); + xmlNodePtr const pNode = xmlNewDocNode(m_aDocPtr, nullptr, xName, nullptr); Reference< XElement > const xRet( static_cast< XNode* >(GetCNode(pNode).get()), UNO_QUERY_THROW); @@ -573,7 +573,7 @@ namespace DOM // xmlNsPtr aNsPtr = xmlNewReconciledNs? // xmlNsPtr aNsPtr = xmlNewGlobalNs? - xmlNodePtr const pNode = xmlNewDocNode(m_aDocPtr, NULL, xName, NULL); + xmlNodePtr const pNode = xmlNewDocNode(m_aDocPtr, nullptr, xName, nullptr); xmlNsPtr const pNs = xmlNewNs(pNode, xUri, xPrefix); xmlSetNs(pNode, pNs); Reference< XElement > const xRet( @@ -654,7 +654,7 @@ namespace DOM ::osl::MutexGuard const g(m_Mutex); xmlNodePtr const pNode = lcl_getDocumentRootPtr(m_aDocPtr); - if (!pNode) { return 0; } + if (!pNode) { return nullptr; } Reference< XElement > const xRet( static_cast< XNode* >(GetCNode(pNode).get()), UNO_QUERY); @@ -664,13 +664,13 @@ namespace DOM static xmlNodePtr lcl_search_element_by_id(const xmlNodePtr cur, const xmlChar* id) { - if (cur == NULL) - return NULL; + if (cur == nullptr) + return nullptr; // look in current node if (cur->type == XML_ELEMENT_NODE) { xmlAttrPtr a = cur->properties; - while (a != NULL) + while (a != nullptr) { if (a->atype == XML_ATTRIBUTE_ID) { if (strcmp(reinterpret_cast<char*>(a->children->content), reinterpret_cast<char const *>(id)) == 0) @@ -681,7 +681,7 @@ namespace DOM } // look in children xmlNodePtr result = lcl_search_element_by_id(cur->children, id); - if (result != NULL) + if (result != nullptr) return result; result = lcl_search_element_by_id(cur->next, id); return result; @@ -698,7 +698,7 @@ namespace DOM OString o1 = OUStringToOString(elementId, RTL_TEXTENCODING_UTF8); xmlChar const *xId = reinterpret_cast<xmlChar const *>(o1.getStr()); xmlNodePtr const pStart = lcl_getDocumentRootPtr(m_aDocPtr); - if (!pStart) { return 0; } + if (!pStart) { return nullptr; } xmlNodePtr const pNode = lcl_search_element_by_id(pStart, xId); Reference< XElement > const xRet( static_cast< XNode* >(GetCNode(pNode).get()), @@ -962,12 +962,12 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - OSL_ASSERT(0 != m_aNodePtr); - if (0 == m_aNodePtr) { - return 0; + OSL_ASSERT(nullptr != m_aNodePtr); + if (nullptr == m_aNodePtr) { + return nullptr; } xmlDocPtr const pClone(xmlCopyDoc(m_aDocPtr, (bDeep) ? 1 : 0)); - if (0 == pClone) { return 0; } + if (nullptr == pClone) { return nullptr; } Reference< XNode > const xRet( static_cast<CNode*>(CDocument::CreateCDocument(pClone).get())); return xRet; @@ -976,7 +976,7 @@ namespace DOM Reference< XEvent > SAL_CALL CDocument::createEvent(const OUString& aType) throw (RuntimeException, std::exception) { // does not need mutex currently - events::CEvent *pEvent = 0; + events::CEvent *pEvent = nullptr; if ( aType == "DOMSubtreeModified" || aType == "DOMNodeInserted" || aType == "DOMNodeRemoved" || aType == "DOMNodeRemovedFromDocument" || aType == "DOMNodeInsertedIntoDocument" || aType == "DOMAttrModified" || aType == "DOMCharacterDataModified") @@ -1008,7 +1008,7 @@ namespace DOM // add new namespaces to root node xmlNodePtr const pRoot = lcl_getDocumentRootPtr(m_aDocPtr); - if (0 != pRoot) { + if (nullptr != pRoot) { const beans::StringPair * pSeq = i_rNamespaces.getConstArray(); for (const beans::StringPair *pNsDef = pSeq; pNsDef < pSeq + i_rNamespaces.getLength(); ++pNsDef) { @@ -1037,7 +1037,7 @@ namespace DOM // add new namespaces to root node xmlNodePtr const pRoot = lcl_getDocumentRootPtr(m_aDocPtr); - if (0 != pRoot) { + if (nullptr != pRoot) { const beans::StringPair * pSeq = i_rNamespaces.getConstArray(); for (const beans::StringPair *pNsDef = pSeq; pNsDef < pSeq + i_rNamespaces.getLength(); ++pNsDef) { diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx index 37d4de501c6d..b48344cf4130 100644 --- a/unoxml/source/dom/documentbuilder.cxx +++ b/unoxml/source/dom/documentbuilder.cxx @@ -106,7 +106,7 @@ namespace DOM const char* CDocumentBuilder::aImplementationName = "com.sun.star.comp.xml.dom.DocumentBuilder"; const char* CDocumentBuilder::aSupportedServiceNames[] = { "com.sun.star.xml.dom.DocumentBuilder", - NULL + nullptr }; OUString CDocumentBuilder::_getImplementationName() @@ -116,7 +116,7 @@ namespace DOM Sequence<OUString> CDocumentBuilder::_getSupportedServiceNames() { Sequence<OUString> aSequence; - for (int i=0; aSupportedServiceNames[i]!=NULL; i++) { + for (int i=0; aSupportedServiceNames[i]!=nullptr; i++) { aSequence.realloc(i+1); aSequence[i]=(OUString::createFromAscii(aSupportedServiceNames[i])); } @@ -246,10 +246,10 @@ namespace DOM CDocumentBuilder *builder = static_cast< CDocumentBuilder* >(ctxt->_private); Reference< XEntityResolver > resolver = builder->getEntityResolver(); OUString sysid; - if (systemId != 0) + if (systemId != nullptr) sysid = OUString(reinterpret_cast<char const *>(systemId), strlen(reinterpret_cast<char const *>(systemId)), RTL_TEXTENCODING_UTF8); OUString pubid; - if (publicId != 0) + if (publicId != nullptr) pubid = OUString(reinterpret_cast<char const *>(publicId), strlen(reinterpret_cast<char const *>(publicId)), RTL_TEXTENCODING_UTF8); // resolve the entity @@ -336,9 +336,9 @@ namespace DOM c.close = false; c.freeOnClose = false; xmlDocPtr const pDoc = xmlCtxtReadIO(pContext.get(), - xmlIO_read_func, xmlIO_close_func, &c, 0, 0, 0); + xmlIO_read_func, xmlIO_close_func, &c, nullptr, nullptr, 0); - if (pDoc == 0) { + if (pDoc == nullptr) { throwEx(pContext.get()); } Reference< XDocument > const xRet( @@ -360,8 +360,8 @@ namespace DOM // xmlSetExternalEntityLoader(external_entity_loader); OString oUri = OUStringToOString(sUri, RTL_TEXTENCODING_UTF8); char *uri = const_cast<char*>(oUri.getStr()); - xmlDocPtr pDoc = xmlCtxtReadFile(pContext.get(), uri, 0, 0); - if (pDoc == 0) { + xmlDocPtr pDoc = xmlCtxtReadFile(pContext.get(), uri, nullptr, 0); + if (pDoc == nullptr) { throwEx(pContext.get()); } Reference< XDocument > const xRet( diff --git a/unoxml/source/dom/documenttype.cxx b/unoxml/source/dom/documenttype.cxx index 73a0c3e96134..af63d89d79cb 100644 --- a/unoxml/source/dom/documenttype.cxx +++ b/unoxml/source/dom/documenttype.cxx @@ -50,7 +50,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); css::uno::Reference< XNamedNodeMap > aMap; - if (m_aDtdPtr != NULL) + if (m_aDtdPtr != nullptr) { aMap.set(new CEntitiesMap(this)); } @@ -76,7 +76,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aName; - if (m_aDtdPtr != NULL) + if (m_aDtdPtr != nullptr) { aName = OUString(reinterpret_cast<char const *>(m_aDtdPtr->name), strlen(reinterpret_cast<char const *>(m_aDtdPtr->name)), RTL_TEXTENCODING_UTF8); } @@ -91,7 +91,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); css::uno::Reference< XNamedNodeMap > aMap; - if (m_aDtdPtr != NULL) + if (m_aDtdPtr != nullptr) { aMap.set(new CNotationsMap(this)); } @@ -106,7 +106,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aId; - if (m_aDtdPtr != NULL) + if (m_aDtdPtr != nullptr) { aId = OUString(reinterpret_cast<char const *>(m_aDtdPtr->name), strlen(reinterpret_cast<char const *>(m_aDtdPtr->ExternalID)), RTL_TEXTENCODING_UTF8); } @@ -121,7 +121,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aId; - if (m_aDtdPtr != NULL) + if (m_aDtdPtr != nullptr) { aId = OUString(reinterpret_cast<char const *>(m_aDtdPtr->name), strlen(reinterpret_cast<char const *>(m_aDtdPtr->SystemID)), RTL_TEXTENCODING_UTF8); } diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index 48abfdd21649..6d40570a45e5 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -59,7 +59,7 @@ namespace DOM new comphelper::AttributeList(); OUString type = ""; // add namespace definitions to attributes - for (xmlNsPtr pNs = m_aNodePtr->nsDef; pNs != 0; pNs = pNs->next) { + for (xmlNsPtr pNs = m_aNodePtr->nsDef; pNs != nullptr; pNs = pNs->next) { const xmlChar *pPrefix = pNs->prefix ? pNs->prefix : reinterpret_cast<const xmlChar*>(""); OUString prefix(reinterpret_cast<const sal_Char*>(pPrefix), strlen(reinterpret_cast<const char*>(pPrefix)), @@ -74,10 +74,10 @@ namespace DOM } // add attributes for (xmlAttrPtr pAttr = m_aNodePtr->properties; - pAttr != 0; pAttr = pAttr->next) { + pAttr != nullptr; pAttr = pAttr->next) { ::rtl::Reference<CNode> const pNode = GetOwnerDocument().GetCNode( reinterpret_cast<xmlNodePtr>(pAttr)); - OSL_ENSURE(pNode != 0, "CNode::get returned 0"); + OSL_ENSURE(pNode != nullptr, "CNode::get returned 0"); OUString prefix = pNode->getPrefix(); OUString name = (prefix.isEmpty()) ? pNode->getLocalName() @@ -93,10 +93,10 @@ namespace DOM i_xHandler->startElement(name, xAttrList); // recurse for (xmlNodePtr pChild = m_aNodePtr->children; - pChild != 0; pChild = pChild->next) { + pChild != nullptr; pChild = pChild->next) { ::rtl::Reference<CNode> const pNode( GetOwnerDocument().GetCNode(pChild)); - OSL_ENSURE(pNode != 0, "CNode::get returned 0"); + OSL_ENSURE(pNode != nullptr, "CNode::get returned 0"); pNode->saxify(i_xHandler); } i_xHandler->endElement(name); @@ -111,10 +111,10 @@ namespace DOM // add attributes i_rContext.mxAttribList->clear(); for (xmlAttrPtr pAttr = m_aNodePtr->properties; - pAttr != 0; pAttr = pAttr->next) { + pAttr != nullptr; pAttr = pAttr->next) { ::rtl::Reference<CNode> const pNode = GetOwnerDocument().GetCNode( reinterpret_cast<xmlNodePtr>(pAttr)); - OSL_ENSURE(pNode != 0, "CNode::get returned 0"); + OSL_ENSURE(pNode != nullptr, "CNode::get returned 0"); const xmlChar* xName = pAttr->name; sal_Int32 nAttributeToken=FastToken::DONTKNOW; @@ -175,10 +175,10 @@ namespace DOM // recurse for (xmlNodePtr pChild = m_aNodePtr->children; - pChild != 0; pChild = pChild->next) { + pChild != nullptr; pChild = pChild->next) { ::rtl::Reference<CNode> const pNode( GetOwnerDocument().GetCNode(pChild)); - OSL_ENSURE(pNode != 0, "CNode::get returned 0"); + OSL_ENSURE(pNode != nullptr, "CNode::get returned 0"); pNode->fastSaxify(i_rContext); } @@ -235,7 +235,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return OUString(); } // search properties @@ -258,15 +258,15 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8); xmlChar const*const pName = reinterpret_cast<xmlChar const*>(o1.getStr()); xmlAttrPtr const pAttr = xmlHasProp(m_aNodePtr, pName); - if (0 == pAttr) { - return 0; + if (nullptr == pAttr) { + return nullptr; } Reference< XAttr > const xRet( static_cast< XNode* >(GetOwnerDocument().GetCNode( @@ -284,8 +284,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8); xmlChar const*const pName = @@ -294,8 +294,8 @@ namespace DOM xmlChar const*const pNS = reinterpret_cast<xmlChar const*>(o2.getStr()); xmlAttrPtr const pAttr = xmlHasNsProp(m_aNodePtr, pName, pNS); - if (0 == pAttr) { - return 0; + if (nullptr == pAttr) { + return nullptr; } Reference< XAttr > const xRet( static_cast< XNode* >(GetOwnerDocument().GetCNode( @@ -315,7 +315,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return OUString(); } OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8); @@ -326,7 +326,7 @@ namespace DOM reinterpret_cast<xmlChar const*>(o2.getStr()); std::shared_ptr<xmlChar const> const pValue( xmlGetNsProp(m_aNodePtr, pName, pNS), xmlFree); - if (0 == pValue) { + if (nullptr == pValue) { return OUString(); } OUString const ret(reinterpret_cast<sal_Char const*>(pValue.get()), @@ -376,7 +376,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return OUString(); } OUString const ret(reinterpret_cast<char const *>(m_aNodePtr->name), @@ -396,7 +396,7 @@ namespace DOM OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8); xmlChar const *xName = reinterpret_cast<xmlChar const *>(o1.getStr()); - return (m_aNodePtr != NULL && xmlHasProp(m_aNodePtr, xName) != NULL); + return (m_aNodePtr != nullptr && xmlHasProp(m_aNodePtr, xName) != nullptr); } /** @@ -413,7 +413,7 @@ namespace DOM xmlChar const *xName = reinterpret_cast<xmlChar const *>(o1.getStr()); OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8); xmlChar const *xNs = reinterpret_cast<xmlChar const *>(o2.getStr()); - return (m_aNodePtr != NULL && xmlHasNsProp(m_aNodePtr, xName, xNs) != NULL); + return (m_aNodePtr != nullptr && xmlHasNsProp(m_aNodePtr, xName, xNs) != nullptr); } /** @@ -424,7 +424,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return; } OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8); @@ -449,7 +449,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return; } OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8); @@ -479,8 +479,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } ::rtl::Reference<CNode> const pCNode( @@ -538,7 +538,7 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { throw RuntimeException(); } @@ -557,9 +557,9 @@ namespace DOM throw e; } - xmlAttrPtr res = NULL; + xmlAttrPtr res = nullptr; xmlChar const*const pContent( - (pAttr->children) ? pAttr->children->content : 0); + (pAttr->children) ? pAttr->children->content : nullptr); if (bNS) { xmlNsPtr const pNs( pCAttr->GetNamespace(m_aNodePtr) ); @@ -623,14 +623,14 @@ namespace DOM OString o2 = OUStringToOString(value, RTL_TEXTENCODING_UTF8); xmlChar const *xValue = reinterpret_cast<xmlChar const *>(o2.getStr()); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { throw RuntimeException(); } OUString oldValue; AttrChangeType aChangeType = AttrChangeType_MODIFICATION; std::shared_ptr<xmlChar const> const pOld( xmlGetProp(m_aNodePtr, xName), xmlFree); - if (pOld == 0) { + if (pOld == nullptr) { aChangeType = AttrChangeType_ADDITION; xmlNewProp(m_aNodePtr, xName, xValue); } else { @@ -667,8 +667,8 @@ namespace DOM ::osl::ClearableMutexGuard guard(m_rMutex); OString o1, o2, o3, o4, o5; - xmlChar const *xPrefix = NULL; - xmlChar const *xLName = NULL; + xmlChar const *xPrefix = nullptr; + xmlChar const *xLName = nullptr; o1 = OUStringToOString(qualifiedName, RTL_TEXTENCODING_UTF8); xmlChar const *xQName = reinterpret_cast<xmlChar const *>(o1.getStr()); sal_Int32 idx = qualifiedName.indexOf(':'); @@ -691,14 +691,14 @@ namespace DOM xmlChar const *xURI= reinterpret_cast<xmlChar const *>(o4.getStr()); xmlChar const *xValue = reinterpret_cast<xmlChar const *>(o5.getStr()); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { throw RuntimeException(); } //find the right namespace xmlNsPtr pNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, xPrefix); // if no namespace found, create a new one - if (pNs == NULL) { + if (pNs == nullptr) { pNs = xmlNewNs(m_aNodePtr, xURI, xPrefix); } @@ -713,7 +713,7 @@ namespace DOM AttrChangeType aChangeType = AttrChangeType_MODIFICATION; std::shared_ptr<xmlChar const> const pOld( xmlGetNsProp(m_aNodePtr, xLName, pNs->href), xmlFree); - if (pOld == 0) { + if (pOld == nullptr) { aChangeType = AttrChangeType_ADDITION; xmlNewNsProp(m_aNodePtr, pNs, xLName, xValue); } else { @@ -756,7 +756,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aName; - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { const xmlChar* xName = m_aNodePtr->name; aName = OUString(reinterpret_cast<const char*>(xName), strlen(reinterpret_cast<const char*>(xName)), RTL_TEXTENCODING_UTF8); diff --git a/unoxml/source/dom/elementlist.cxx b/unoxml/source/dom/elementlist.cxx index e67e5f46c14d..8867d38bbf43 100644 --- a/unoxml/source/dom/elementlist.cxx +++ b/unoxml/source/dom/elementlist.cxx @@ -87,7 +87,7 @@ namespace DOM : m_pElement(pElement) , m_rMutex(rMutex) , m_pName(lcl_initXmlString(rName)) - , m_pURI((pURI) ? lcl_initXmlString(*pURI) : 0) + , m_pURI((pURI) ? lcl_initXmlString(*pURI) : nullptr) , m_bRebuild(true) { } @@ -134,7 +134,7 @@ namespace DOM } } - while (pNode != NULL ) + while (pNode != nullptr ) { if (pNode->type == XML_ELEMENT_NODE && (strcmp(reinterpret_cast<char const *>(pNode->name), reinterpret_cast<char*>(m_pName.get())) == 0)) @@ -142,14 +142,14 @@ namespace DOM if (!m_pURI) { m_nodevector.push_back(pNode); } else { - if (pNode->ns != NULL && (0 == + if (pNode->ns != nullptr && (0 == strcmp(reinterpret_cast<char const *>(pNode->ns->href), reinterpret_cast<char*>(m_pURI.get())))) { m_nodevector.push_back(pNode); } } } - if (pNode->children != NULL) buildlist(pNode->children, false); + if (pNode->children != nullptr) buildlist(pNode->children, false); if (!start) pNode = pNode->next; else break; // fold back @@ -179,7 +179,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); - if (!m_pElement.is()) { return 0; } + if (!m_pElement.is()) { return nullptr; } buildlist(m_pElement->GetNodePtr()); if (m_nodevector.size() <= static_cast<size_t>(index)) { diff --git a/unoxml/source/dom/elementlist.hxx b/unoxml/source/dom/elementlist.hxx index 7e4bf688dc6a..a95258373911 100644 --- a/unoxml/source/dom/elementlist.hxx +++ b/unoxml/source/dom/elementlist.hxx @@ -66,7 +66,7 @@ namespace DOM public: CElementListImpl(::rtl::Reference<CElement> const& pElement, ::osl::Mutex & rMutex, - OUString const& rName, OUString const*const pURI = 0); + OUString const& rName, OUString const*const pURI = nullptr); void registerListener(CElement & rElement); @@ -96,7 +96,7 @@ namespace DOM public: CElementList(::rtl::Reference<CElement> const& pElement, ::osl::Mutex & rMutex, - OUString const& rName, OUString const*const pURI = 0); + OUString const& rName, OUString const*const pURI = nullptr); /** The number of nodes in the list. diff --git a/unoxml/source/dom/entity.cxx b/unoxml/source/dom/entity.cxx index 269237e0642c..61d0420c60eb 100644 --- a/unoxml/source/dom/entity.cxx +++ b/unoxml/source/dom/entity.cxx @@ -70,7 +70,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aID; - if(m_aEntityPtr != NULL) + if(m_aEntityPtr != nullptr) { aID = OUString(reinterpret_cast<char const *>(m_aEntityPtr->ExternalID), strlen(reinterpret_cast<char const *>(m_aEntityPtr->ExternalID)), RTL_TEXTENCODING_UTF8); } @@ -85,7 +85,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aID; - if(m_aEntityPtr != NULL) + if(m_aEntityPtr != nullptr) { aID = OUString(reinterpret_cast<char const *>(m_aEntityPtr->SystemID), strlen(reinterpret_cast<char const *>(m_aEntityPtr->SystemID)), RTL_TEXTENCODING_UTF8); } @@ -96,7 +96,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aName; - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { const xmlChar* xName = m_aNodePtr->name; aName = OUString(reinterpret_cast<char const *>(xName), strlen(reinterpret_cast<char const *>(xName)), RTL_TEXTENCODING_UTF8); diff --git a/unoxml/source/dom/entityreference.cxx b/unoxml/source/dom/entityreference.cxx index 6ef84b26cb99..ebe19dcdaeb1 100644 --- a/unoxml/source/dom/entityreference.cxx +++ b/unoxml/source/dom/entityreference.cxx @@ -54,7 +54,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aName; - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { const xmlChar* xName = m_aNodePtr->name; aName = OUString(reinterpret_cast<char const *>(xName), strlen(reinterpret_cast<char const *>(xName)), RTL_TEXTENCODING_UTF8); diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index bf378c087044..c0c28e148c96 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -72,7 +72,7 @@ namespace DOM void addNamespaces(Context& io_rContext, xmlNodePtr pNode) { // add node's namespaces to current context - for (xmlNsPtr pNs = pNode->nsDef; pNs != 0; pNs = pNs->next) { + for (xmlNsPtr pNs = pNode->nsDef; pNs != nullptr; pNs = pNs->next) { const xmlChar *pPrefix = pNs->prefix; // prefix can be NULL when xmlns attribute is empty (xmlns="") OString prefix(reinterpret_cast<const sal_Char*>(pPrefix), @@ -140,7 +140,7 @@ namespace DOM // keep containing document alive // (but not if this is a document; that would create a leak!) , m_xDocument( (m_aNodePtr->type != XML_DOCUMENT_NODE) - ? &const_cast<CDocument&>(rDocument) : 0 ) + ? &const_cast<CDocument&>(rDocument) : nullptr ) , m_rMutex(const_cast< ::osl::Mutex & >(rMutex)) { OSL_ASSERT(m_aNodePtr); @@ -149,14 +149,14 @@ namespace DOM void CNode::invalidate() { //remove from list if this wrapper goes away - if (m_aNodePtr != 0 && m_xDocument.is()) { + if (m_aNodePtr != nullptr && m_xDocument.is()) { m_xDocument->RemoveCNode(m_aNodePtr, this); } // #i113663#: unlinked nodes will not be freed by xmlFreeDoc if (m_bUnlinked) { xmlFreeNode(m_aNodePtr); } - m_aNodePtr = 0; + m_aNodePtr = nullptr; } CNode::~CNode() @@ -174,7 +174,7 @@ namespace DOM CNode::GetImplementation(uno::Reference<uno::XInterface> const& xNode) { uno::Reference<lang::XUnoTunnel> const xUnoTunnel(xNode, UNO_QUERY); - if (!xUnoTunnel.is()) { return 0; } + if (!xUnoTunnel.is()) { return nullptr; } CNode *const pCNode( reinterpret_cast< CNode* >( ::sal::static_int_cast< sal_IntPtr >( xUnoTunnel->getSomething(theCNodeUnoTunnelId::get().getSeq())))); @@ -193,14 +193,14 @@ namespace DOM { // recursively exchange any references to oldNs with references to newNs xmlNodePtr cur = aNode; - while (cur != 0) + while (cur != nullptr) { if (cur->ns == oldNs) cur->ns = newNs; if (cur->type == XML_ELEMENT_NODE) { xmlAttrPtr curAttr = cur->properties; - while(curAttr != 0) + while(curAttr != nullptr) { if (curAttr->ns == oldNs) curAttr->ns = newNs; @@ -217,35 +217,35 @@ namespace DOM xmlNodePtr cur = aNode; //handle attributes - if (cur != NULL && cur->type == XML_ELEMENT_NODE) + if (cur != nullptr && cur->type == XML_ELEMENT_NODE) { xmlAttrPtr curAttr = cur->properties; - while(curAttr != 0) + while(curAttr != nullptr) { - if (curAttr->ns != NULL) + if (curAttr->ns != nullptr) { xmlNsPtr ns = xmlSearchNs(cur->doc, aParent, curAttr->ns->prefix); - if (ns != NULL) + if (ns != nullptr) curAttr->ns = ns; } curAttr = curAttr->next; } } - while (cur != NULL) + while (cur != nullptr) { nscleanup(cur->children, cur); - if (cur->ns != NULL) + if (cur->ns != nullptr) { xmlNsPtr ns = xmlSearchNs(cur->doc, aParent, cur->ns->prefix); - if (ns != NULL && ns != cur->ns && strcmp(reinterpret_cast<char const *>(ns->href), reinterpret_cast<char const *>(cur->ns->href))==0) + if (ns != nullptr && ns != cur->ns && strcmp(reinterpret_cast<char const *>(ns->href), reinterpret_cast<char const *>(cur->ns->href))==0) { xmlNsPtr curDef = cur->nsDef; xmlNsPtr *refp = &(cur->nsDef); // insert point - while (curDef != NULL) + while (curDef != nullptr) { ns = xmlSearchNs(cur->doc, aParent, curDef->prefix); - if (ns != NULL && ns != curDef && strcmp(reinterpret_cast<char const *>(ns->href), reinterpret_cast<char const *>(curDef->href))==0) + if (ns != nullptr && ns != curDef && strcmp(reinterpret_cast<char const *>(ns->href), reinterpret_cast<char const *>(curDef->href))==0) { // reconnect ns pointers in sub-tree to newly found ns before // removing redundant nsdecl to prevent dangling pointers. @@ -291,7 +291,7 @@ namespace DOM { ::osl::ClearableMutexGuard guard(m_rMutex); - if (0 == m_aNodePtr) { return 0; } + if (nullptr == m_aNodePtr) { return nullptr; } CNode *const pNewChild(CNode::GetImplementation(xNewChild)); if (!pNewChild) { throw RuntimeException(); } @@ -311,7 +311,7 @@ namespace DOM e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; throw e; } - if (cur->parent != NULL) { + if (cur->parent != nullptr) { DOMException e; e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; throw e; @@ -323,7 +323,7 @@ namespace DOM } // check whether this is an attribute node; it needs special handling - xmlNodePtr res = NULL; + xmlNodePtr res = nullptr; if (cur->type == XML_ATTRIBUTE_NODE) { xmlChar const*const pChildren((cur->children) @@ -352,7 +352,7 @@ namespace DOM } } - if (!res) { return 0; } + if (!res) { return nullptr; } // use custom ns cleanup instead of // xmlReconciliateNs(m_aNodePtr->doc, m_aNodePtr); @@ -361,7 +361,7 @@ namespace DOM ::rtl::Reference<CNode> const pNode = GetOwnerDocument().GetCNode(res); - if (!pNode.is()) { return 0; } + if (!pNode.is()) { return nullptr; } // dispatch DOMNodeInserted event, target is the new node // this node is the related node @@ -393,12 +393,12 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } ::rtl::Reference<CNode> const pNode = GetOwnerDocument().GetCNode( xmlCopyNode(m_aNodePtr, (bDeep) ? 1 : 0)); - if (!pNode.is()) { return 0; } + if (!pNode.is()) { return nullptr; } pNode->m_bUnlinked = true; // not linked yet return pNode.get(); } @@ -422,8 +422,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } Reference< XNodeList > const xNodeList(new CChildList(this, m_rMutex)); return xNodeList; @@ -437,8 +437,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } Reference< XNode > const xNode( GetOwnerDocument().GetCNode(m_aNodePtr->children).get()); @@ -453,8 +453,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } Reference< XNode > const xNode( GetOwnerDocument().GetCNode(xmlGetLastChild(m_aNodePtr)).get()); @@ -481,9 +481,9 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aURI; - if (m_aNodePtr != NULL && + if (m_aNodePtr != nullptr && (m_aNodePtr->type == XML_ELEMENT_NODE || m_aNodePtr->type == XML_ATTRIBUTE_NODE) && - m_aNodePtr->ns != NULL) + m_aNodePtr->ns != nullptr) { const xmlChar* xHref = m_aNodePtr->ns->href; aURI = OUString(reinterpret_cast<char const *>(xHref), strlen(reinterpret_cast<char const *>(xHref)), RTL_TEXTENCODING_UTF8); @@ -499,8 +499,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } Reference< XNode > const xNode( GetOwnerDocument().GetCNode(m_aNodePtr->next).get()); @@ -564,8 +564,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } Reference< XDocument > const xDoc(& GetOwnerDocument()); return xDoc; @@ -579,8 +579,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } Reference< XNode > const xNode( GetOwnerDocument().GetCNode(m_aNodePtr->parent).get()); @@ -596,12 +596,12 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aPrefix; - if (m_aNodePtr != NULL && + if (m_aNodePtr != nullptr && (m_aNodePtr->type == XML_ELEMENT_NODE || m_aNodePtr->type == XML_ATTRIBUTE_NODE) && - m_aNodePtr->ns != NULL) + m_aNodePtr->ns != nullptr) { const xmlChar* xPrefix = m_aNodePtr->ns->prefix; - if( xPrefix != NULL ) + if( xPrefix != nullptr ) aPrefix = OUString(reinterpret_cast<char const *>(xPrefix), strlen(reinterpret_cast<char const *>(xPrefix)), RTL_TEXTENCODING_UTF8); } return aPrefix; @@ -616,8 +616,8 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { - return 0; + if (nullptr == m_aNodePtr) { + return nullptr; } Reference< XNode > const xNode( GetOwnerDocument().GetCNode(m_aNodePtr->prev).get()); @@ -632,7 +632,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - return (m_aNodePtr != NULL && m_aNodePtr->properties != NULL); + return (m_aNodePtr != nullptr && m_aNodePtr->properties != nullptr); } /** @@ -643,7 +643,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - return (m_aNodePtr != NULL && m_aNodePtr->children != NULL); + return (m_aNodePtr != nullptr && m_aNodePtr->children != nullptr); } /** @@ -681,7 +681,7 @@ namespace DOM throw e; } // already has parent - if (pNewChild->parent != NULL) + if (pNewChild->parent != nullptr) { DOMException e; e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; @@ -702,14 +702,14 @@ namespace DOM xmlNodePtr cur = m_aNodePtr->children; //search child before which to insert - while (cur != NULL) + while (cur != nullptr) { if (cur == pRefChild) { // insert before pNewChild->next = cur; pNewChild->prev = cur->prev; cur->prev = pNewChild; - if (pNewChild->prev != NULL) { + if (pNewChild->prev != nullptr) { pNewChild->prev->next = pNewChild; } pNewChild->parent = cur->parent; @@ -866,7 +866,7 @@ namespace DOM throw e; } // already has parent - if (pNew->parent != NULL) { + if (pNew->parent != nullptr) { DOMException e; e.Code = DOMExceptionType_HIERARCHY_REQUEST_ERR; throw e; @@ -897,16 +897,16 @@ namespace DOM xmlNodePtr cur = m_aNodePtr->children; //find old node in child list - while (cur != NULL) + while (cur != nullptr) { if(cur == pOld) { // exchange nodes pNew->prev = pOld->prev; - if (pNew->prev != NULL) + if (pNew->prev != nullptr) pNew->prev->next = pNew; pNew->next = pOld->next; - if (pNew->next != NULL) + if (pNew->next != nullptr) pNew->next->prev = pNew; pNew->parent = pOld->parent; // coverity[var_deref_op] pNew->parent cannot be NULL here @@ -914,9 +914,9 @@ namespace DOM pNew->parent->children = pNew; if(pNew->parent->last == pOld) pNew->parent->last = pNew; - pOld->next = NULL; - pOld->prev = NULL; - pOld->parent = NULL; + pOld->next = nullptr; + pOld->prev = nullptr; + pOld->parent = nullptr; pOldNode->m_bUnlinked = true; pNewNode->m_bUnlinked = false; // will be deleted by xmlFreeDoc } @@ -967,7 +967,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if ((0 == m_aNodePtr) || + if ((nullptr == m_aNodePtr) || ((m_aNodePtr->type != XML_ELEMENT_NODE) && (m_aNodePtr->type != XML_ATTRIBUTE_NODE))) { @@ -977,7 +977,7 @@ namespace DOM } OString o1 = OUStringToOString(prefix, RTL_TEXTENCODING_UTF8); xmlChar const *pBuf = reinterpret_cast<xmlChar const *>(o1.getStr()); - if (m_aNodePtr != NULL && m_aNodePtr->ns != NULL) + if (m_aNodePtr != nullptr && m_aNodePtr->ns != nullptr) { xmlFree(const_cast<xmlChar *>(m_aNodePtr->ns->prefix)); m_aNodePtr->ns->prefix = xmlStrdup(pBuf); diff --git a/unoxml/source/dom/notation.cxx b/unoxml/source/dom/notation.cxx index fa9e1d74ee67..f64e31bca34b 100644 --- a/unoxml/source/dom/notation.cxx +++ b/unoxml/source/dom/notation.cxx @@ -59,7 +59,7 @@ namespace DOM ::osl::MutexGuard const g(m_rMutex); OUString aName; - if (m_aNodePtr != NULL) + if (m_aNodePtr != nullptr) { const xmlChar* xName = m_aNodePtr->name; aName = OUString(reinterpret_cast<char const *>(xName), strlen(reinterpret_cast<char const *>(xName)), RTL_TEXTENCODING_UTF8); diff --git a/unoxml/source/dom/processinginstruction.cxx b/unoxml/source/dom/processinginstruction.cxx index 79b2f1cdd157..1cda0809808f 100644 --- a/unoxml/source/dom/processinginstruction.cxx +++ b/unoxml/source/dom/processinginstruction.cxx @@ -54,13 +54,13 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return OUString(); } char const*const pContent( reinterpret_cast<char const*>(m_aNodePtr->content)); - if (0 == pContent) { + if (nullptr == pContent) { return OUString(); } OUString const ret(pContent, strlen(pContent), RTL_TEXTENCODING_UTF8); @@ -75,13 +75,13 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return OUString(); } char const*const pName( reinterpret_cast<char const*>(m_aNodePtr->name)); - if (0 == pName) { + if (nullptr == pName) { return OUString(); } OUString const ret(pName, strlen(pName), RTL_TEXTENCODING_UTF8); @@ -96,7 +96,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { throw RuntimeException(); } @@ -113,7 +113,7 @@ namespace DOM { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_aNodePtr) { + if (nullptr == m_aNodePtr) { return OUString(); } diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx index be04b5fae7db..786f3700b9f0 100644 --- a/unoxml/source/dom/saxbuilder.cxx +++ b/unoxml/source/dom/saxbuilder.cxx @@ -41,7 +41,7 @@ namespace DOM const char* CSAXDocumentBuilder::aImplementationName = "com.sun.star.comp.xml.dom.SAXDocumentBuilder"; const char* CSAXDocumentBuilder::aSupportedServiceNames[] = { "com.sun.star.xml.dom.SAXDocumentBuilder", - NULL + nullptr }; CSAXDocumentBuilder::CSAXDocumentBuilder(const Reference< XMultiServiceFactory >& mgr) @@ -56,7 +56,7 @@ namespace DOM Sequence<OUString> CSAXDocumentBuilder::_getSupportedServiceNames() { Sequence<OUString> aSequence; - for (int i=0; aSupportedServiceNames[i]!=NULL; i++) { + for (int i=0; aSupportedServiceNames[i]!=nullptr; i++) { aSequence.realloc(i+1); aSequence[i]=(OUString::createFromAscii(aSupportedServiceNames[i])); } diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx index 04051f2d64a7..b58e67f454b8 100644 --- a/unoxml/source/events/eventdispatcher.cxx +++ b/unoxml/source/events/eventdispatcher.cxx @@ -40,7 +40,7 @@ namespace DOM { namespace events { ? (& m_CaptureListeners) : (& m_TargetListeners); // get the multimap for the specified type - ListenerMap *pMap = 0; + ListenerMap *pMap = nullptr; TypeListenerMap::const_iterator tIter = pTMap->find(aType); if (tIter == pTMap->end()) { // the map has to be created @@ -49,7 +49,7 @@ namespace DOM { namespace events { } else { pMap = tIter->second; } - if (pMap !=0) + if (pMap !=nullptr) pMap->insert(ListenerMap::value_type(pNode, aListener)); } @@ -113,7 +113,7 @@ namespace DOM { namespace events { xmlNodePtr const pNode, Reference<XNode> const& xNode, Reference< XEvent > const& i_xEvent) const { - CEvent *pEvent = 0; // pointer to internal event representation + CEvent *pEvent = nullptr; // pointer to internal event representation OUString const aType = i_xEvent->getType(); if (aType == "DOMSubtreeModified" || @@ -192,7 +192,7 @@ namespace DOM { namespace events { ::osl::MutexGuard g(rMutex); xmlNodePtr cur = pNode; - while (cur != NULL) + while (cur != nullptr) { Reference< XEventTarget > const xRef( rDocument.GetCNode(cur).get()); diff --git a/unoxml/source/rdf/CURI.cxx b/unoxml/source/rdf/CURI.cxx index 49a7ec45ea7a..bcfc5b00af71 100644 --- a/unoxml/source/rdf/CURI.cxx +++ b/unoxml/source/rdf/CURI.cxx @@ -100,8 +100,8 @@ const char s_nsODF [] = void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant) { - const char *ns(0); - const char *ln(0); + const char *ns(nullptr); + const char *ln(nullptr); switch (i_Constant) { case css::rdf::URIs::XSD_NCNAME: diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 9096b0648421..95a48afd54cb 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -517,7 +517,7 @@ librdf_GraphResult::hasMoreElements() throw (uno::RuntimeException, std::excepti librdf_node* librdf_GraphResult::getContext_Lock() const { if (!m_pStream.get() || librdf_stream_end(m_pStream.get())) - return NULL; + return nullptr; librdf_node *pCtxt( static_cast<librdf_node *> #if LIBRDF_VERSION >= 10012 (librdf_stream_get_context2(m_pStream.get())) ); @@ -550,7 +550,7 @@ throw (uno::RuntimeException, container::NoSuchElementException, } // NB: pCtxt may be null here if this is result of a graph query if (pCtxt && isInternalContext(pCtxt)) { - pCtxt = 0; // XML ID context is implementation detail! + pCtxt = nullptr; // XML ID context is implementation detail! } rdf::Statement Stmt( m_xRep->getTypeConverter().convertToStatement(pStmt, pCtxt) ); @@ -655,9 +655,9 @@ throw (uno::RuntimeException, container::NoSuchElementException, boost::shared_array<librdf_node*> pNodes( new librdf_node*[count], NodeArrayDeleter(count)); for (int i = 0; i < count; ++i) { - pNodes[i] = 0; + pNodes[i] = nullptr; } - if (librdf_query_results_get_bindings(m_pQueryResult.get(), NULL, + if (librdf_query_results_get_bindings(m_pQueryResult.get(), nullptr, pNodes.get())) { rdf::QueryException e( @@ -856,8 +856,8 @@ librdf_Repository::librdf_Repository( uno::Reference< uno::XComponentContext > const & i_xContext) : /*BaseMutex(),*/ m_xContext(i_xContext) // m_pWorld (static_cast<librdf_world *>(0), safe_librdf_free_world ), - , m_pStorage(static_cast<librdf_storage*>(0), safe_librdf_free_storage) - , m_pModel (static_cast<librdf_model *>(0), safe_librdf_free_model ) + , m_pStorage(static_cast<librdf_storage*>(nullptr), safe_librdf_free_storage) + , m_pModel (static_cast<librdf_model *>(nullptr), safe_librdf_free_model ) , m_NamedGraphs() , m_TypeConverter(i_xContext, *this) { @@ -913,7 +913,7 @@ throw (uno::RuntimeException, std::exception) { ::osl::MutexGuard g(m_aMutex); const std::shared_ptr<librdf_node> pNode( - librdf_new_node_from_blank_identifier(m_pWorld.get(), NULL), + librdf_new_node_from_blank_identifier(m_pWorld.get(), nullptr), safe_librdf_free_node); if (!pNode) { throw uno::RuntimeException( @@ -1021,7 +1021,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, } const std::shared_ptr<librdf_parser> pParser( - librdf_new_parser(m_pWorld.get(), "rdfxml", NULL, NULL), + librdf_new_parser(m_pWorld.get(), "rdfxml", nullptr, nullptr), safe_librdf_free_parser); if (!pParser) { throw uno::RuntimeException( @@ -1073,7 +1073,7 @@ void addChaffWhenEncryptedStorage(const uno::Reference< io::XOutputStream > &rSt { unsigned char *postcomment = reinterpret_cast<unsigned char*>(strchr(reinterpret_cast<char*>(pBuffer), '\n')); - if (postcomment != NULL) + if (postcomment != nullptr) { ++postcomment; @@ -1182,7 +1182,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, // #i116443#: abbrev breaks when certain URIs are used as data types // const char *format("rdfxml-abbrev"); const std::shared_ptr<librdf_serializer> pSerializer( - librdf_new_serializer(m_pWorld.get(), format, NULL, NULL), + librdf_new_serializer(m_pWorld.get(), format, nullptr, nullptr), safe_librdf_free_serializer); if (!pSerializer) { throw uno::RuntimeException( @@ -1200,11 +1200,11 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, safe_librdf_free_uri); const std::shared_ptr<librdf_node> p0( librdf_new_node_from_literal(m_pWorld.get(), - reinterpret_cast<const unsigned char*> ("0"), NULL, 0), + reinterpret_cast<const unsigned char*> ("0"), nullptr, 0), safe_librdf_free_node); const std::shared_ptr<librdf_node> p1( librdf_new_node_from_literal(m_pWorld.get(), - reinterpret_cast<const unsigned char*> ("1"), NULL, 0), + reinterpret_cast<const unsigned char*> ("1"), nullptr, 0), safe_librdf_free_node); if (!pWriteBaseURI || !pRelativeURI || !p0 || !p1) { throw uno::RuntimeException( @@ -1274,7 +1274,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, if (iter != m_NamedGraphs.end()) { return uno::Reference<rdf::XNamedGraph>(iter->second.get()); } else { - return 0; + return nullptr; } } @@ -1385,8 +1385,8 @@ throw (uno::RuntimeException, rdf::QueryException, rdf::RepositoryException, std const OString query( OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) ); const std::shared_ptr<librdf_query> pQuery( - librdf_new_query(m_pWorld.get(), s_sparql, NULL, - reinterpret_cast<const unsigned char*> (query.getStr()), NULL), + librdf_new_query(m_pWorld.get(), s_sparql, nullptr, + reinterpret_cast<const unsigned char*> (query.getStr()), nullptr), safe_librdf_free_query); if (!pQuery) { throw rdf::QueryException( @@ -1434,8 +1434,8 @@ throw (uno::RuntimeException, rdf::QueryException, rdf::RepositoryException, std const OString query( OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) ); const std::shared_ptr<librdf_query> pQuery( - librdf_new_query(m_pWorld.get(), s_sparql, NULL, - reinterpret_cast<const unsigned char*> (query.getStr()), NULL), + librdf_new_query(m_pWorld.get(), s_sparql, nullptr, + reinterpret_cast<const unsigned char*> (query.getStr()), nullptr), safe_librdf_free_query); if (!pQuery) { throw rdf::QueryException( @@ -1472,8 +1472,8 @@ throw (uno::RuntimeException, rdf::QueryException, rdf::RepositoryException, std const OString query( OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) ); const std::shared_ptr<librdf_query> pQuery( - librdf_new_query(m_pWorld.get(), s_sparql, NULL, - reinterpret_cast<const unsigned char*> (query.getStr()), NULL), + librdf_new_query(m_pWorld.get(), s_sparql, nullptr, + reinterpret_cast<const unsigned char*> (query.getStr()), nullptr), safe_librdf_free_query); if (!pQuery) { throw rdf::QueryException( @@ -1667,7 +1667,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, try { const uno::Reference<container::XEnumeration> xIter( - getStatementsGraph_NoLock(0, 0, 0, xXmlId, true) ); + getStatementsGraph_NoLock(nullptr, nullptr, nullptr, xXmlId, true) ); OSL_ENSURE(xIter.is(), "getStatementRDFa: no result?"); if (!xIter.is()) throw uno::RuntimeException(); while (xIter->hasMoreElements()) { @@ -1709,7 +1709,7 @@ librdf_statement *rdfa_context_stream_map_handler( return i_pStatement; } } - return 0; + return nullptr; }; uno::Reference< container::XEnumeration > SAL_CALL @@ -1749,7 +1749,7 @@ throw (uno::RuntimeException, rdf::RepositoryException, std::exception) } if (librdf_stream_add_map(pStream.get(), rdfa_context_stream_map_handler, - 0, 0)) { + nullptr, nullptr)) { throw rdf::RepositoryException( "librdf_Repository::getStatementsRDFa: " "librdf_stream_add_map failed", *this); @@ -2057,7 +2057,7 @@ librdf_world *librdf_TypeConverter::createWorld_Lock() const "librdf_TypeConverter::createWorld: librdf_new_world failed", m_rRep); } - librdf_world_set_raptor_init_handler(pWorld, 0, &librdf_raptor_init); + librdf_world_set_raptor_init_handler(pWorld, nullptr, &librdf_raptor_init); //FIXME logger, digest, features? xsltSecurityPrefsPtr origprefs = xsltGetDefaultSecurityPrefs(); librdf_world_open(pWorld); @@ -2076,7 +2076,7 @@ librdf_TypeConverter::createStorage_Lock(librdf_world *i_pWorld) const { librdf_storage *pStorage( // librdf_new_storage(i_pWorld, "memory", NULL, "contexts='yes'") ); - librdf_new_storage(i_pWorld, "hashes", NULL, + librdf_new_storage(i_pWorld, "hashes", nullptr, "contexts='yes',hash-type='memory'") ); if (!pStorage) { throw uno::RuntimeException( @@ -2089,7 +2089,7 @@ librdf_TypeConverter::createStorage_Lock(librdf_world *i_pWorld) const librdf_model *librdf_TypeConverter::createModel_Lock( librdf_world *i_pWorld, librdf_storage * i_pStorage) const { - librdf_model *pRepository( librdf_new_model(i_pWorld, i_pStorage, NULL) ); + librdf_model *pRepository( librdf_new_model(i_pWorld, i_pStorage, nullptr) ); if (!pRepository) { throw uno::RuntimeException( "librdf_TypeConverter::createModel: librdf_new_model failed", @@ -2121,7 +2121,7 @@ librdf_uri* librdf_TypeConverter::mkURI_Lock( librdf_world* i_pWorld, reinterpret_cast<const unsigned char *>(i_rURI.getStr()))); if (!pURI) { throw uno::RuntimeException( - "librdf_TypeConverter::mkURI: librdf_new_uri failed", 0); + "librdf_TypeConverter::mkURI: librdf_new_uri failed", nullptr); } return pURI; } @@ -2152,7 +2152,7 @@ librdf_TypeConverter::extractResource_NoLock( librdf_node* librdf_TypeConverter::mkResource_Lock( librdf_world* i_pWorld, Resource const*const i_pResource) { - if (!i_pResource) return 0; + if (!i_pResource) return nullptr; BlankNode const*const pBlankNode( dynamic_cast<BlankNode const*>(i_pResource)); if (pBlankNode) { @@ -2163,7 +2163,7 @@ librdf_node* librdf_TypeConverter::mkResource_Lock( librdf_world* i_pWorld, if (!pNode) { throw uno::RuntimeException( "librdf_TypeConverter::mkResource: " - "librdf_new_node_from_blank_identifier failed", 0); + "librdf_new_node_from_blank_identifier failed", nullptr); } return pNode; } else { // assumption: everything else is URI @@ -2175,7 +2175,7 @@ librdf_node* librdf_TypeConverter::mkResource_Lock( librdf_world* i_pWorld, if (!pNode) { throw uno::RuntimeException( "librdf_TypeConverter::mkResource: " - "librdf_new_node_from_uri_string failed", 0); + "librdf_new_node_from_uri_string failed", nullptr); } return pNode; } @@ -2219,7 +2219,7 @@ librdf_TypeConverter::extractNode_NoLock( librdf_node* librdf_TypeConverter::mkNode_Lock( librdf_world* i_pWorld, Node const*const i_pNode) { - if (!i_pNode) return 0; + if (!i_pNode) return nullptr; Resource const*const pResource(dynamic_cast<Resource const*>(i_pNode)); if (pResource) { return mkResource_Lock(i_pWorld, pResource); @@ -2227,19 +2227,19 @@ librdf_node* librdf_TypeConverter::mkNode_Lock( librdf_world* i_pWorld, Literal const*const pLiteral(dynamic_cast<Literal const*>(i_pNode)); assert(pLiteral); - librdf_node * ret(0); + librdf_node * ret(nullptr); if (pLiteral->language.isEmpty()) { if (!pLiteral->type) { ret = librdf_new_node_from_literal(i_pWorld, reinterpret_cast<const unsigned char*>(pLiteral->value.getStr()) - , NULL, 0); + , nullptr, 0); } else { const std::shared_ptr<librdf_uri> pDatatype( mkURI_Lock(i_pWorld, *pLiteral->type), safe_librdf_free_uri); ret = librdf_new_node_from_typed_literal(i_pWorld, reinterpret_cast<const unsigned char*>(pLiteral->value.getStr()) - , NULL, pDatatype.get()); + , nullptr, pDatatype.get()); } } else { if (!pLiteral->type) { @@ -2248,12 +2248,12 @@ librdf_node* librdf_TypeConverter::mkNode_Lock( librdf_world* i_pWorld, , pLiteral->language.getStr(), 0); } else { OSL_FAIL("mkNode: invalid literal"); - return 0; + return nullptr; } } if (!ret) { throw uno::RuntimeException( - "librdf_TypeConverter::mkNode: librdf_new_node_from_literal failed", 0); + "librdf_TypeConverter::mkNode: librdf_new_node_from_literal failed", nullptr); } return ret; } @@ -2279,8 +2279,8 @@ librdf_statement* librdf_TypeConverter::mkStatement_Lock(librdf_world* i_pWorld, { librdf_node *const pSubject( mkResource_Lock(i_pWorld, i_rStatement.pSubject.get()) ); - librdf_node* pPredicate(0); - librdf_node* pObject(0); + librdf_node* pPredicate(nullptr); + librdf_node* pObject(nullptr); try { pPredicate = mkResource_Lock(i_pWorld, i_rStatement.pPredicate.get()); try { @@ -2299,7 +2299,7 @@ librdf_statement* librdf_TypeConverter::mkStatement_Lock(librdf_world* i_pWorld, if (!pStatement) { throw uno::RuntimeException( "librdf_TypeConverter::mkStatement: " - "librdf_new_statement_from_nodes failed", 0); + "librdf_new_statement_from_nodes failed", nullptr); } return pStatement; } @@ -2307,7 +2307,7 @@ librdf_statement* librdf_TypeConverter::mkStatement_Lock(librdf_world* i_pWorld, uno::Reference<rdf::XURI> librdf_TypeConverter::convertToXURI(librdf_uri* i_pURI) const { - if (!i_pURI) return 0; + if (!i_pURI) return nullptr; const unsigned char* uri( librdf_uri_as_string(i_pURI) ); if (!uri) { throw uno::RuntimeException( @@ -2329,7 +2329,7 @@ librdf_TypeConverter::convertToXURI(librdf_uri* i_pURI) const uno::Reference<rdf::XURI> librdf_TypeConverter::convertToXURI(librdf_node* i_pNode) const { - if (!i_pNode) return 0; + if (!i_pNode) return nullptr; if (librdf_node_is_resource(i_pNode)) { librdf_uri* pURI( librdf_node_get_uri(i_pNode) ); if (!pURI) { @@ -2340,14 +2340,14 @@ librdf_TypeConverter::convertToXURI(librdf_node* i_pNode) const return convertToXURI(pURI); } else { OSL_FAIL("convertToXURI: unknown librdf_node"); - return 0; + return nullptr; } } uno::Reference<rdf::XResource> librdf_TypeConverter::convertToXResource(librdf_node* i_pNode) const { - if (!i_pNode) return 0; + if (!i_pNode) return nullptr; if (librdf_node_is_blank(i_pNode)) { const unsigned char* label( librdf_node_get_blank_identifier(i_pNode) ); if (!label) { @@ -2375,7 +2375,7 @@ librdf_TypeConverter::convertToXResource(librdf_node* i_pNode) const uno::Reference<rdf::XNode> librdf_TypeConverter::convertToXNode(librdf_node* i_pNode) const { - if (!i_pNode) return 0; + if (!i_pNode) return nullptr; if (!librdf_node_is_literal(i_pNode)) { return uno::Reference<rdf::XNode>(convertToXResource(i_pNode), uno::UNO_QUERY); diff --git a/unoxml/source/rdf/librdf_services.cxx b/unoxml/source/rdf/librdf_services.cxx index 1a53d81ebbac..c26054a03fc8 100644 --- a/unoxml/source/rdf/librdf_services.cxx +++ b/unoxml/source/rdf/librdf_services.cxx @@ -34,20 +34,20 @@ static ::cppu::ImplementationEntry const entries[] = { { &comp_CBlankNode::_create, &comp_CBlankNode::_getImplementationName, &comp_CBlankNode::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, 0, 0 }, + &::cppu::createSingleComponentFactory, nullptr, 0 }, { &comp_CURI::_create, &comp_CURI::_getImplementationName, &comp_CURI::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, 0, 0 }, + &::cppu::createSingleComponentFactory, nullptr, 0 }, { &comp_CLiteral::_create, &comp_CLiteral::_getImplementationName, &comp_CLiteral::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, 0, 0 }, + &::cppu::createSingleComponentFactory, nullptr, 0 }, { &comp_librdf_Repository::_create, &comp_librdf_Repository::_getImplementationName, &comp_librdf_Repository::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } + &::cppu::createSingleComponentFactory, nullptr, 0 }, + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; SAL_DLLPUBLIC_EXPORT void * SAL_CALL unordf_component_getFactory( diff --git a/unoxml/source/service/services.cxx b/unoxml/source/service/services.cxx index bd77845935bc..87ad21acd5ab 100644 --- a/unoxml/source/service/services.cxx +++ b/unoxml/source/service/services.cxx @@ -44,7 +44,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL unoxml_component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/) { - void* pReturn = NULL ; + void* pReturn = nullptr ; if ( pImplementationName && pServiceManager ) { // Define variables which are used in following macros. diff --git a/unoxml/source/xpath/nodelist.cxx b/unoxml/source/xpath/nodelist.cxx index 4b54bdfb497d..766a96e80ee9 100644 --- a/unoxml/source/xpath/nodelist.cxx +++ b/unoxml/source/xpath/nodelist.cxx @@ -32,9 +32,9 @@ namespace XPath std::shared_ptr<xmlXPathObject> const& rxpathObj) : m_pDocument(pDocument) , m_rMutex(rMutex) - , m_pNodeSet(0) + , m_pNodeSet(nullptr) { - if (rxpathObj != 0 && rxpathObj->type == XPATH_NODESET) + if (rxpathObj != nullptr && rxpathObj->type == XPATH_NODESET) { m_pNodeSet = rxpathObj->nodesetval; m_pXPathObj = rxpathObj; @@ -49,7 +49,7 @@ namespace XPath ::osl::MutexGuard const g(m_rMutex); sal_Int32 value = 0; - if (m_pNodeSet != NULL) + if (m_pNodeSet != nullptr) value = xmlXPathNodeSetGetLength(m_pNodeSet); return value; } @@ -62,8 +62,8 @@ namespace XPath { ::osl::MutexGuard const g(m_rMutex); - if (0 == m_pNodeSet) { - return 0; + if (nullptr == m_pNodeSet) { + return nullptr; } xmlNodePtr const pNode = xmlXPathNodeSetItem(m_pNodeSet, index); Reference< XNode > const xNode(m_pDocument->GetCNode(pNode).get()); diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index fca018cfd60a..937ac4f9af47 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -60,7 +60,7 @@ namespace XPath const char* CXPathAPI::aImplementationName = "com.sun.star.comp.xml.xpath.XPathAPI"; const char* CXPathAPI::aSupportedServiceNames[] = { "com.sun.star.xml.xpath.XPathAPI", - NULL + nullptr }; OUString CXPathAPI::_getImplementationName() @@ -71,7 +71,7 @@ namespace XPath Sequence<OUString> CXPathAPI::_getSupportedServiceNames() { Sequence<OUString> aSequence; - for (int i=0; aSupportedServiceNames[i]!=NULL; i++) { + for (int i=0; aSupportedServiceNames[i]!=nullptr; i++) { aSequence.realloc(i+1); aSequence[i]=(OUString::createFromAscii(aSupportedServiceNames[i])); } @@ -147,9 +147,9 @@ namespace XPath ::osl::MutexGuard const g(pCNode->GetOwnerDocument().GetMutex()); xmlNodePtr pNode = pCNode->GetNodePtr(); - while (pNode != 0) { + while (pNode != nullptr) { xmlNsPtr curDef = pNode->nsDef; - while (curDef != 0) { + while (curDef != nullptr) { const xmlChar* xHref = curDef->href; OUString aURI(reinterpret_cast<char const *>(xHref), strlen(reinterpret_cast<char const *>(xHref)), RTL_TEXTENCODING_UTF8); const xmlChar* xPre = curDef->prefix; @@ -358,13 +358,13 @@ namespace XPath /* Create xpath evaluation context */ std::shared_ptr<xmlXPathContext> const xpathCtx( xmlXPathNewContext(pDoc), xmlXPathFreeContext); - if (xpathCtx == 0) { throw XPathException(); } + if (xpathCtx == nullptr) { throw XPathException(); } // set context node xpathCtx->node = pNode; // error handling xpathCtx->error = structured_error_func; - xmlSetGenericErrorFunc(NULL, generic_error_func); + xmlSetGenericErrorFunc(nullptr, generic_error_func); // register namespaces and extension lcl_registerNamespaces(xpathCtx.get(), nsmap); @@ -375,8 +375,8 @@ namespace XPath xmlChar const *xStr = reinterpret_cast<xmlChar const *>(o1.getStr()); std::shared_ptr<xmlXPathObject> const xpathObj( xmlXPathEval(xStr, xpathCtx.get()), xmlXPathFreeObject); - xmlSetGenericErrorFunc(NULL, NULL); - if (0 == xpathObj) { + xmlSetGenericErrorFunc(nullptr, nullptr); + if (nullptr == xpathObj) { // OSL_ENSURE(xpathCtx->lastError == NULL, xpathCtx->lastError->message); throw XPathException(); } |