diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-20 18:26:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-21 08:49:56 +0200 |
commit | 7272951c121735a7350fa70840b255b7ef831f1a (patch) | |
tree | 52033c5b70c6c2c24ec5c507b7d38eca257356a5 /unoxml | |
parent | d943b42214321c630147176210733399c57e6f19 (diff) |
loplugin:referencecasting in unotools..uui
Change-Id: Ia2c991591e65deb00710ab7a5b73bc42ae6b1b46
Reviewed-on: https://gerrit.libreoffice.org/76031
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/attributesmap.cxx | 16 | ||||
-rw-r--r-- | unoxml/source/dom/document.cxx | 16 | ||||
-rw-r--r-- | unoxml/source/dom/element.cxx | 4 | ||||
-rw-r--r-- | unoxml/source/rdf/librdf_repository.cxx | 25 |
4 files changed, 21 insertions, 40 deletions
diff --git a/unoxml/source/dom/attributesmap.cxx b/unoxml/source/dom/attributesmap.cxx index 4c0a86c17074..9ff0298bdc7b 100644 --- a/unoxml/source/dom/attributesmap.cxx +++ b/unoxml/source/dom/attributesmap.cxx @@ -164,9 +164,7 @@ namespace DOM static_cast<OWeakObject*>(this), DOMExceptionType_NOT_FOUND_ERR); } - Reference< XNode > const xRet( - m_pElement->removeAttributeNode(xAttr), UNO_QUERY); - return xRet; + return m_pElement->removeAttributeNode(xAttr); } /** @@ -185,9 +183,7 @@ namespace DOM static_cast<OWeakObject*>(this), DOMExceptionType_NOT_FOUND_ERR); } - Reference< XNode > const xRet( - m_pElement->removeAttributeNode(xAttr), UNO_QUERY); - return xRet; + return m_pElement->removeAttributeNode(xAttr); } /** @@ -204,9 +200,7 @@ namespace DOM DOMExceptionType_HIERARCHY_REQUEST_ERR); } // no MutexGuard needed: m_pElement is const - Reference< XNode > const xRet( - m_pElement->setAttributeNode(xAttr), UNO_QUERY); - return xRet; + return m_pElement->setAttributeNode(xAttr); } /** @@ -223,9 +217,7 @@ namespace DOM DOMExceptionType_HIERARCHY_REQUEST_ERR); } // no MutexGuard needed: m_pElement is const - Reference< XNode > const xRet( - m_pElement->setAttributeNodeNS(xAttr), UNO_QUERY); - return xRet; + return m_pElement->setAttributeNodeNS(xAttr); } } diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index fc89b8aa4980..4b7d246e867d 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -726,7 +726,7 @@ namespace DOM Reference< XAttr > const xNew = xDocument->createAttribute(xAttr->getName()); xNew->setValue(xAttr->getValue()); - xNode.set(xNew, UNO_QUERY); + xNode = xNew; break; } case NodeType_CDATA_SECTION_NODE: @@ -735,7 +735,7 @@ namespace DOM UNO_QUERY_THROW); Reference< XCDATASection > const xNewCData = xDocument->createCDATASection(xCData->getData()); - xNode.set(xNewCData, UNO_QUERY); + xNode = xNewCData; break; } case NodeType_COMMENT_NODE: @@ -744,7 +744,7 @@ namespace DOM UNO_QUERY_THROW); Reference< XComment > const xNewComment = xDocument->createComment(xComment->getData()); - xNode.set(xNewComment, UNO_QUERY); + xNode = xNewComment; break; } case NodeType_DOCUMENT_FRAGMENT_NODE: @@ -753,7 +753,7 @@ namespace DOM UNO_QUERY_THROW); Reference< XDocumentFragment > const xNewFrag = xDocument->createDocumentFragment(); - xNode.set(xNewFrag, UNO_QUERY); + xNode = xNewFrag; break; } case NodeType_ELEMENT_NODE: @@ -798,7 +798,7 @@ namespace DOM } } } - xNode.set(xNewElement, UNO_QUERY); + xNode = xNewElement; break; } case NodeType_ENTITY_REFERENCE_NODE: @@ -807,7 +807,7 @@ namespace DOM UNO_QUERY_THROW); Reference< XEntityReference > const xNewRef( xDocument->createEntityReference(xRef->getNodeName())); - xNode.set(xNewRef, UNO_QUERY); + xNode = xNewRef; break; } case NodeType_PROCESSING_INSTRUCTION_NODE: @@ -817,7 +817,7 @@ namespace DOM Reference< XProcessingInstruction > const xNewPi( xDocument->createProcessingInstruction( xPi->getTarget(), xPi->getData())); - xNode.set(xNewPi, UNO_QUERY); + xNode = xNewPi; break; } case NodeType_TEXT_NODE: @@ -825,7 +825,7 @@ namespace DOM Reference< XText > const xText(xImportedNode, UNO_QUERY_THROW); Reference< XText > const xNewText( xDocument->createTextNode(xText->getData())); - xNode.set(xNewText, UNO_QUERY); + xNode = xNewText; break; } case NodeType_ENTITY_NODE: diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index 6ed9ba1ebd1e..e5e82b2613cd 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -632,7 +632,7 @@ namespace DOM "DOMAttrModified"), UNO_QUERY); event->initMutationEvent("DOMAttrModified", true, false, - Reference< XNode >(getAttributeNode(name), UNO_QUERY), + getAttributeNode(name), oldValue, value, name, aChangeType); guard.clear(); // release mutex before calling event handlers @@ -713,7 +713,7 @@ namespace DOM "DOMAttrModified"), UNO_QUERY); event->initMutationEvent( "DOMAttrModified", true, false, - Reference< XNode >(getAttributeNodeNS(namespaceURI, OUString(reinterpret_cast<char const *>(pLName), strlen(reinterpret_cast<char const *>(pLName)), RTL_TEXTENCODING_UTF8)), UNO_QUERY), + getAttributeNodeNS(namespaceURI, OUString(reinterpret_cast<char const *>(pLName), strlen(reinterpret_cast<char const *>(pLName)), RTL_TEXTENCODING_UTF8)), oldValue, value, qualifiedName, aChangeType); guard.clear(); // release mutex before calling event handlers diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 6268da4ff4c9..26f4a950518c 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -2287,10 +2287,8 @@ librdf_TypeConverter::Statement librdf_TypeConverter::extractStatement_NoLock( { std::shared_ptr<Resource> const pSubject( extractResource_NoLock(i_xSubject)); - const uno::Reference<rdf::XResource> xPredicate(i_xPredicate, - uno::UNO_QUERY); std::shared_ptr<URI> const pPredicate( - std::dynamic_pointer_cast<URI>(extractResource_NoLock(xPredicate))); + std::dynamic_pointer_cast<URI>(extractResource_NoLock(i_xPredicate))); std::shared_ptr<Node> const pObject(extractNode_NoLock(i_xObject)); return Statement(pSubject, pPredicate, pObject); } @@ -2381,8 +2379,7 @@ librdf_TypeConverter::convertToXResource(librdf_node* i_pNode) const OString(reinterpret_cast<const sal_Char*>(label)), RTL_TEXTENCODING_UTF8) ); try { - return uno::Reference<rdf::XResource>( - rdf::BlankNode::create(m_xContext, labelU), uno::UNO_QUERY); + return rdf::BlankNode::create(m_xContext, labelU); } catch (const lang::IllegalArgumentException &) { css::uno::Any anyEx = cppu::getCaughtException(); throw lang::WrappedTargetRuntimeException( @@ -2390,8 +2387,7 @@ librdf_TypeConverter::convertToXResource(librdf_node* i_pNode) const "illegal blank node label", m_rRep, anyEx); } } else { - return uno::Reference<rdf::XResource>(convertToXURI(i_pNode), - uno::UNO_QUERY); + return convertToXURI(i_pNode); } } @@ -2400,8 +2396,7 @@ librdf_TypeConverter::convertToXNode(librdf_node* i_pNode) const { if (!i_pNode) return nullptr; if (!librdf_node_is_literal(i_pNode)) { - return uno::Reference<rdf::XNode>(convertToXResource(i_pNode), - uno::UNO_QUERY); + return convertToXResource(i_pNode); } const unsigned char* value( librdf_node_get_literal_value(i_pNode) ); if (!value) { @@ -2420,19 +2415,13 @@ librdf_TypeConverter::convertToXNode(librdf_node* i_pNode) const const OUString langU( OStringToOUString( OString(reinterpret_cast<const sal_Char*>(lang)), RTL_TEXTENCODING_UTF8) ); - return uno::Reference<rdf::XNode>( - rdf::Literal::createWithLanguage(m_xContext, valueU, langU), - uno::UNO_QUERY); + return rdf::Literal::createWithLanguage(m_xContext, valueU, langU); } else if (pType) { uno::Reference<rdf::XURI> xType(convertToXURI(pType)); OSL_ENSURE(xType.is(), "convertToXNode: null uri"); - return uno::Reference<rdf::XNode>( - rdf::Literal::createWithType(m_xContext, valueU, xType), - uno::UNO_QUERY); + return rdf::Literal::createWithType(m_xContext, valueU, xType); } else { - return uno::Reference<rdf::XNode>( - rdf::Literal::create(m_xContext, valueU), - uno::UNO_QUERY); + return rdf::Literal::create(m_xContext, valueU); } } |