From 5d353ff608760799a25aa8e6d016d8414d2f1fc3 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Nov 2015 10:26:03 +0100 Subject: loplugin:nullptr (automatic rewrite) Change-Id: I31e61fc91dff70f32143d84ccf308f2bbc9c740e --- test/source/bootstrapfixture.cxx | 2 +- test/source/diff/diff.cxx | 22 +++++++++++----------- test/source/htmltesttools.cxx | 2 +- test/source/vclbootstrapprotector.cxx | 2 +- test/source/xmltesttools.cxx | 2 +- test/source/xmlwriter.cxx | 10 +++++----- 6 files changed, 20 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index d8633d23fc10..8812adb21d0f 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -68,7 +68,7 @@ void test_init_impl(bool bAssertOnDialog, bool bNeedUCB, // Make GraphicConverter work, normally done in desktop::Desktop::Main() Application::SetFilterHdl( - LINK(0, test::BootstrapFixture, ImplInitFilterHdl)); + LINK(nullptr, test::BootstrapFixture, ImplInitFilterHdl)); if (bNeedUCB) { diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx index 8128e75a0a77..9b62c68f69c2 100644 --- a/test/source/diff/diff.cxx +++ b/test/source/diff/diff.cxx @@ -38,8 +38,8 @@ struct tolerance } tolerance() - : elementName(NULL) - , attribName(NULL) + : elementName(nullptr) + , attribName(nullptr) , relative(false) , value(0.0) { @@ -156,8 +156,8 @@ void XMLDiff::loadToleranceFile(xmlDocPtr xmlToleranceFile) return; } #endif - xmlNodePtr child = NULL; - for (child = root->children; child != NULL; child = child->next) + xmlNodePtr child = nullptr; + for (child = root->children; child != nullptr; child = child->next) { // assume a valid xml file if(child->type != XML_ELEMENT_NODE) @@ -196,7 +196,7 @@ bool checkForEmptyChildren(xmlNodePtr node) if(!node) return true; - for(; node != NULL; node = node->next) + for(; node != nullptr; node = node->next) { if (node->type == XML_ELEMENT_NODE) return false; @@ -225,9 +225,9 @@ bool XMLDiff::compareElements(xmlNode* node1, xmlNode* node2) #endif // compare children - xmlNode* child2 = NULL; - xmlNode* child1 = NULL; - for(child1 = node1->children, child2 = node2->children; child1 != NULL && child2 != NULL; child1 = child1->next, child2 = child2->next) + xmlNode* child2 = nullptr; + xmlNode* child1 = nullptr; + for(child1 = node1->children, child2 = node2->children; child1 != nullptr && child2 != nullptr; child1 = child1->next, child2 = child2->next) { if (child1->type == XML_ELEMENT_NODE) { @@ -290,9 +290,9 @@ bool compareValuesWithTolerance(double val1, double val2, double tolerance, bool bool XMLDiff::compareAttributes(xmlNodePtr node1, xmlNodePtr node2) { - xmlAttrPtr attr1 = NULL; - xmlAttrPtr attr2 = NULL; - for(attr1 = node1->properties, attr2 = node2->properties; attr1 != NULL && attr2 != NULL; attr1 = attr1->next, attr2 = attr2->next) + xmlAttrPtr attr1 = nullptr; + xmlAttrPtr attr2 = nullptr; + for(attr1 = node1->properties, attr2 = node2->properties; attr1 != nullptr && attr2 != nullptr; attr1 = attr1->next, attr2 = attr2->next) { #if USE_CPPUNIT cppunitAssertEqual(attr1->name, attr2->name); diff --git a/test/source/htmltesttools.cxx b/test/source/htmltesttools.cxx index 85d65c0c0d71..f876dec101a2 100644 --- a/test/source/htmltesttools.cxx +++ b/test/source/htmltesttools.cxx @@ -30,7 +30,7 @@ htmlDocPtr HtmlTestTools::parseHtmlStream(SvStream* pStream) std::unique_ptr pBuffer(new sal_uInt8[nSize + 1]); pStream->Read(pBuffer.get(), nSize); pBuffer[nSize] = 0; - return htmlParseDoc(reinterpret_cast(pBuffer.get()), NULL); + return htmlParseDoc(reinterpret_cast(pBuffer.get()), nullptr); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/vclbootstrapprotector.cxx b/test/source/vclbootstrapprotector.cxx index de762829ab03..3fbb0a9d3892 100644 --- a/test/source/vclbootstrapprotector.cxx +++ b/test/source/vclbootstrapprotector.cxx @@ -81,7 +81,7 @@ IMPL_STATIC_LINK_NOARG_TYPED(Protector, deinitHook, LinkParamNone*, void) } css::uno::Reference( context, css::uno::UNO_QUERY_THROW)->dispose(); - comphelper::setProcessServiceFactory(0); + comphelper::setProcessServiceFactory(nullptr); } } diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index f1b6484f107e..02ef2793686b 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -139,7 +139,7 @@ void XmlTestTools::assertXPathNoAttribute(xmlDocPtr pXmlDoc, const OString& rXPa 1, xmlXPathNodeSetGetLength(pXmlNodes)); xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath + "' unexpected '" + rAttribute + "' attribute").getStr(), - static_cast(0), xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()))); + static_cast(nullptr), xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()))); xmlXPathFreeObject(pXmlObj); } diff --git a/test/source/xmlwriter.cxx b/test/source/xmlwriter.cxx index 80f63993c145..d19284185153 100644 --- a/test/source/xmlwriter.cxx +++ b/test/source/xmlwriter.cxx @@ -41,7 +41,7 @@ int lclCloseCallback(void* pContext) XmlWriter::XmlWriter(SvStream* pStream) : mpStream(pStream), - mpWriter(NULL) + mpWriter(nullptr) {} XmlWriter::~XmlWriter() @@ -49,12 +49,12 @@ XmlWriter::~XmlWriter() void XmlWriter::startDocument() { - if (mpWriter == NULL && mpStream != NULL) + if (mpWriter == nullptr && mpStream != nullptr) { - xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO(lclWriteCallback, lclCloseCallback, mpStream, NULL); + xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO(lclWriteCallback, lclCloseCallback, mpStream, nullptr); mpWriter = xmlNewTextWriter(xmlOutBuffer); xmlTextWriterSetIndent(mpWriter, 1); - xmlTextWriterStartDocument(mpWriter, NULL, "UTF-8", NULL); + xmlTextWriterStartDocument(mpWriter, nullptr, "UTF-8", nullptr); } } @@ -62,7 +62,7 @@ void XmlWriter::endDocument() { xmlTextWriterEndDocument(mpWriter); xmlFreeTextWriter(mpWriter); - mpWriter = NULL; + mpWriter = nullptr; } void XmlWriter::element(const OString& name) -- cgit