Kaydet (Commit) 60c40af0 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

Change-Id: I54bf272b404d2302cafbde73ec5061ea2cd966ab
üst de63cac2
......@@ -75,7 +75,7 @@ class SAX_DLLPUBLIC FastAttributeList : public ::cppu::WeakImplHelper1< css::xml
{
public:
FastAttributeList( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& xTokenHandler,
FastTokenHandlerBase *pOptHandlerBase = NULL );
FastTokenHandlerBase *pOptHandlerBase = nullptr );
virtual ~FastAttributeList();
void clear();
......
......@@ -82,7 +82,7 @@ namespace sax
}
DocumentHandlerAdapter(const css::uno::Reference< css::xml::sax::XDocumentHandler >& delegate);
DocumentHandlerAdapter() :
m_handler(css::uno::Reference< css::xml::sax::XDocumentHandler > (0, css::uno::UNO_QUERY))
m_handler(css::uno::Reference< css::xml::sax::XDocumentHandler > (nullptr, css::uno::UNO_QUERY))
{
}
;
......@@ -201,7 +201,7 @@ namespace sax
}
protected:
ExtendedDocumentHandlerAdapter() :
m_handler(css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > (0, css::uno::UNO_QUERY))
m_handler(css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > (nullptr, css::uno::UNO_QUERY))
{
}
ExtendedDocumentHandlerAdapter(
......
......@@ -82,8 +82,8 @@ class XMLFile2UTFConverter
public:
XMLFile2UTFConverter( ):
m_bStarted( false ),
m_pText2Unicode( 0 ),
m_pUnicode2Text( 0 )
m_pText2Unicode( nullptr ),
m_pUnicode2Text( nullptr )
{}
~XMLFile2UTFConverter();
......
......@@ -34,7 +34,7 @@ public:
void AttributesTest::test()
{
uno::Reference<sax_fastparser::FastAttributeList> xAttributeList( new sax_fastparser::FastAttributeList(NULL) );
uno::Reference<sax_fastparser::FastAttributeList> xAttributeList( new sax_fastparser::FastAttributeList(nullptr) );
xAttributeList->add(1, "1");
xAttributeList->add(2, OString("2"));
......
......@@ -87,7 +87,7 @@ void ConverterTest::tearDown()
}
static void doTest(util::Duration const & rid, char const*const pis,
char const*const i_pos = 0)
char const*const i_pos = nullptr)
{
char const*const pos((i_pos) ? i_pos : pis);
util::Duration od;
......@@ -163,18 +163,18 @@ static bool eqDateTime(const util::DateTime& a, const util::DateTime& b) {
}
static void doTest(util::DateTime const & rdt, char const*const pis,
char const*const i_pos = 0)
char const*const i_pos = nullptr)
{
char const*const pos((i_pos) ? i_pos : pis);
OUString is(OUString::createFromAscii(pis));
util::DateTime odt;
SAL_INFO("sax.cppunit","about to convert '" << is << "'");
bool bSuccess( Converter::parseDateTime(odt, 0, is) );
bool bSuccess( Converter::parseDateTime(odt, nullptr, is) );
SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << (bool)odt.IsUTC);
CPPUNIT_ASSERT(bSuccess);
CPPUNIT_ASSERT(eqDateTime(rdt, odt));
OUStringBuffer buf;
Converter::convertDateTime(buf, odt, 0, true);
Converter::convertDateTime(buf, odt, nullptr, true);
SAL_INFO("sax.cppunit","" << buf.toString());
CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(pos),
buf.makeStringAndClear());
......@@ -183,7 +183,7 @@ static void doTest(util::DateTime const & rdt, char const*const pis,
static void doTestDateTimeF(char const*const pis)
{
util::DateTime odt;
bool bSuccess = Converter::parseDateTime(odt, 0,
bool bSuccess = Converter::parseDateTime(odt, nullptr,
OUString::createFromAscii(pis));
SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds);
CPPUNIT_ASSERT(!bSuccess);
......@@ -258,18 +258,18 @@ void ConverterTest::testDateTime()
}
static void doTestTime(util::DateTime const & rdt, char const*const pis,
char const*const i_pos = 0)
char const*const i_pos = nullptr)
{
char const*const pos((i_pos) ? i_pos : pis);
OUString is(OUString::createFromAscii(pis));
util::DateTime odt;
SAL_INFO("sax.cppunit","about to convert '" << is << "'");
bool bSuccess( Converter::parseTimeOrDateTime(odt, 0, is) );
bool bSuccess( Converter::parseTimeOrDateTime(odt, nullptr, is) );
SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << (bool)odt.IsUTC);
CPPUNIT_ASSERT(bSuccess);
CPPUNIT_ASSERT(eqDateTime(rdt, odt));
OUStringBuffer buf;
Converter::convertTimeOrDateTime(buf, odt, 0);
Converter::convertTimeOrDateTime(buf, odt, nullptr);
SAL_INFO("sax.cppunit","" << buf.toString());
CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(pos),
buf.makeStringAndClear());
......@@ -278,7 +278,7 @@ static void doTestTime(util::DateTime const & rdt, char const*const pis,
static void doTestTimeF(char const*const pis)
{
util::DateTime odt;
bool bSuccess = Converter::parseTimeOrDateTime(odt, 0,
bool bSuccess = Converter::parseTimeOrDateTime(odt, nullptr,
OUString::createFromAscii(pis));
SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds);
CPPUNIT_ASSERT_MESSAGE(pis, !bSuccess);
......
......@@ -435,7 +435,7 @@ void SaxExpatParser::parseStream( const InputSource& structSource)
}
// create parser with proper encoding
entity.pParser = XML_ParserCreate( 0 );
entity.pParser = XML_ParserCreate( nullptr );
if( ! entity.pParser )
{
throw SAXException("Couldn't create parser",
......@@ -457,7 +457,7 @@ void SaxExpatParser::parseStream( const InputSource& structSource)
XML_SetNotationDeclHandler( entity.pParser, call_callbackNotationDecl );
XML_SetExternalEntityRefHandler( entity.pParser,
call_callbackExternalEntityRef);
XML_SetUnknownEncodingHandler( entity.pParser, call_callbackUnknownEncoding ,0);
XML_SetUnknownEncodingHandler( entity.pParser, call_callbackUnknownEncoding ,nullptr);
if( m_pImpl->rExtendedDocumentHandler.is() ) {
......@@ -802,7 +802,7 @@ void SaxExpatParser_Impl::callbackEntityDecl(
XML_StopParser(pImpl->getEntity().pParser, XML_FALSE);
pImpl->exception = SAXParseException(
"SaxExpatParser: internal entity declaration, stopping",
0, css::uno::Any(),
nullptr, css::uno::Any(),
pImpl->rDocumentLocator->getPublicId(),
pImpl->rDocumentLocator->getSystemId(),
pImpl->rDocumentLocator->getLineNumber(),
......@@ -874,7 +874,7 @@ bool SaxExpatParser_Impl::callbackExternalEntityRef(
}
if( entity.structSource.aInputStream.is() ) {
entity.pParser = XML_ExternalEntityParserCreate( parser , context, 0 );
entity.pParser = XML_ExternalEntityParserCreate( parser , context, nullptr );
if( ! entity.pParser )
{
return false;
......
......@@ -109,7 +109,7 @@ public:
explicit SaxWriterHelper(Reference< XOutputStream > m_TempOut)
: m_out(m_TempOut)
, m_Sequence(SEQUENCESIZE)
, mp_Sequence(NULL)
, mp_Sequence(nullptr)
, nLastLineFeedPos(0)
, nCurrentPos(0)
, m_bStartElementFinished(true)
......@@ -875,7 +875,7 @@ class SAXWriter :
{
public:
SAXWriter()
: m_pSaxWriterHelper(NULL)
: m_pSaxWriterHelper(nullptr)
, m_bDocStarted(false)
, m_bIsCDATA(false)
, m_bForceLineBreak(false)
......
......@@ -347,8 +347,8 @@ void XMLFile2UTFConverter::initializeDecoding()
Text2UnicodeConverter::Text2UnicodeConverter( const OString &sEncoding )
: m_convText2Unicode(NULL)
, m_contextText2Unicode(NULL)
: m_convText2Unicode(nullptr)
, m_contextText2Unicode(nullptr)
, m_rtlEncoding(RTL_TEXTENCODING_DONTKNOW)
{
rtl_TextEncoding encoding = rtl_getTextEncodingFromMimeCharset( sEncoding.getStr() );
......
......@@ -333,7 +333,7 @@ class FastLocatorImpl : public WeakImplHelper< XLocator >
public:
explicit FastLocatorImpl(FastSaxParserImpl *p) : mpParser(p) {}
void dispose() { mpParser = 0; }
void dispose() { mpParser = nullptr; }
void checkDispose() throw (RuntimeException) { if( !mpParser ) throw DisposedException(); }
//XLocator
......@@ -371,7 +371,7 @@ OUString SAL_CALL FastLocatorImpl::getSystemId() throw (RuntimeException, std::e
}
ParserData::ParserData()
: mpTokenHandler( NULL )
: mpTokenHandler( nullptr )
{}
ParserData::~ParserData()
......@@ -380,16 +380,16 @@ ParserData::~ParserData()
Entity::Entity(const ParserData& rData)
: ParserData(rData)
, mnProducedEventsSize(0)
, mpProducedEvents(NULL)
, mpProducedEvents(nullptr)
, mbEnableThreads(false)
, mpParser(NULL)
, mpParser(nullptr)
{
}
Entity::Entity(const Entity& e)
: ParserData(e)
, mnProducedEventsSize(0)
, mpProducedEvents(NULL)
, mpProducedEvents(nullptr)
, mbEnableThreads(e.mbEnableThreads)
, maStructSource(e.maStructSource)
, mpParser(e.mpParser)
......@@ -413,7 +413,7 @@ void Entity::startElement( Event *pEvent )
const OUString& aElementName = pEvent->msElementName;
// Use un-wrapped pointers to avoid significant acquire/release overhead
XFastContextHandler *pParentContext = NULL;
XFastContextHandler *pParentContext = nullptr;
if( !maContextStack.empty() )
{
pParentContext = maContextStack.top().mxContext.get();
......@@ -454,7 +454,7 @@ void Entity::startElement( Event *pEvent )
}
// swap the reference we own in to avoid referencing thrash.
maContextStack.top().mxContext.set( static_cast<XFastContextHandler *>( xContext.get() ) );
xContext.set( NULL, UNO_REF_NO_ACQUIRE );
xContext.set( nullptr, UNO_REF_NO_ACQUIRE );
}
catch (const Exception&)
{
......@@ -610,7 +610,7 @@ FastSaxParserImpl::FastSaxParserImpl( FastSaxParser* ) :
#if 0
mpFront(pFront),
#endif
mpTop(NULL)
mpTop(nullptr)
{
mxDocumentLocator.set( new FastLocatorImpl( this ) );
}
......@@ -902,7 +902,7 @@ void FastSaxParserImpl::produce( bool bForceFlush )
}
rEntity.maPendingEvents.push(rEntity.mpProducedEvents);
rEntity.mpProducedEvents = 0;
rEntity.mpProducedEvents = nullptr;
aGuard.clear(); // unlock
......@@ -970,7 +970,7 @@ void FastSaxParserImpl::pushEntity( const Entity& rEntity )
void FastSaxParserImpl::popEntity()
{
maEntities.pop();
mpTop = !maEntities.empty() ? &maEntities.top() : NULL;
mpTop = !maEntities.empty() ? &maEntities.top() : nullptr;
}
// starts parsing with actual parser !
......@@ -997,7 +997,7 @@ void FastSaxParserImpl::parse()
nRead = rEntity.maConverter.readAndConvert( seqOut, BUFFER_SIZE );
if( nRead <= 0 )
{
if( rEntity.mpParser != NULL )
if( rEntity.mpParser != nullptr )
{
if( xmlParseChunk( rEntity.mpParser, reinterpret_cast<const char*>(seqOut.getConstArray()), 0, 1 ) != XML_ERR_OK )
rEntity.throwException( mxDocumentLocator, true );
......@@ -1006,11 +1006,11 @@ void FastSaxParserImpl::parse()
}
bool bContinue = true;
if( rEntity.mpParser == NULL )
if( rEntity.mpParser == nullptr )
{
// create parser with proper encoding (needs the first chunk of data)
rEntity.mpParser = xmlCreatePushParserCtxt( &callbacks, this,
reinterpret_cast<const char*>(seqOut.getConstArray()), nRead, NULL );
reinterpret_cast<const char*>(seqOut.getConstArray()), nRead, nullptr );
if( !rEntity.mpParser )
throw SAXException("Couldn't create parser", Reference< XInterface >(), Any() );
......@@ -1075,7 +1075,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
for (int i = 0; i < numNamespaces * 2; i += 2)
{
// namespaces[] is (prefix/URI)
if( namespaces[ i ] != NULL )
if( namespaces[ i ] != nullptr )
{
DefineNamespace( OString( XML_CAST( namespaces[ i ] )),
OUString( XML_CAST( namespaces[ i + 1 ] ), strlen( XML_CAST( namespaces[ i + 1 ] )), RTL_TEXTENCODING_UTF8 ));
......@@ -1091,7 +1091,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
// #158414# second: fill attribute list with other attributes
for (int i = 0; i < numAttributes * 5; i += 5)
{
if( attributes[ i + 1 ] != NULL )
if( attributes[ i + 1 ] != nullptr )
{
sal_Int32 nAttributeToken = GetTokenWithPrefix( attributes[ i + 1 ], strlen( XML_CAST( attributes[ i + 1 ] )), attributes[ i ], strlen( XML_CAST( attributes[ i ] )));
if( nAttributeToken != FastToken::DONTKNOW )
......@@ -1111,7 +1111,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
}
}
if( prefix != NULL )
if( prefix != nullptr )
rEvent.mnElementToken = GetTokenWithPrefix( prefix, strlen( XML_CAST( prefix )), localName, strlen( XML_CAST( localName )));
else if( !rEvent.msNamespace.isEmpty() )
rEvent.mnElementToken = GetTokenWithContextNamespace( nNamespaceToken, localName, strlen( XML_CAST( localName )));
......@@ -1120,7 +1120,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
if( rEvent.mnElementToken == FastToken::DONTKNOW )
{
if( prefix != NULL )
if( prefix != nullptr )
{
rEvent.msNamespace = OUString( XML_CAST( URI ), strlen( XML_CAST( URI )), RTL_TEXTENCODING_UTF8 );
nNamespaceToken = GetNamespaceToken( rEvent.msNamespace );
......
......@@ -126,8 +126,8 @@ bool Converter::convertMeasure( sal_Int32& rValue,
{
OSL_ENSURE( MeasureUnit::TWIP == nTargetUnit || MeasureUnit::POINT == nTargetUnit ||
MeasureUnit::MM_100TH == nTargetUnit || MeasureUnit::MM_10TH == nTargetUnit, "unit is not supported");
const sal_Char *aCmpsL[2] = { 0, 0 };
const sal_Char *aCmpsU[2] = { 0, 0 };
const sal_Char *aCmpsL[2] = { nullptr, nullptr };
const sal_Char *aCmpsU[2] = { nullptr, nullptr };
double aScales[2] = { 1., 1. };
if( MeasureUnit::TWIP == nTargetUnit )
......@@ -209,7 +209,7 @@ bool Converter::convertMeasure( sal_Int32& rValue,
}
}
if( aCmpsL[0] == NULL )
if( aCmpsL[0] == nullptr )
return false;
double nScale = 0.;
......@@ -286,7 +286,7 @@ void Converter::convertMeasure( OUStringBuffer& rBuffer,
long nMul = 1000;
long nDiv = 1;
long nFac = 100;
const sal_Char* psUnit = 0;
const sal_Char* psUnit = nullptr;
switch( nSourceUnit )
{
case MeasureUnit::TWIP:
......@@ -1409,7 +1409,7 @@ bool Converter::parseDateTime( util::DateTime& rDateTime,
const OUString& rString )
{
bool isDateTime;
return parseDateOrDateTime(0, rDateTime, isDateTime, pTimeZoneOffset,
return parseDateOrDateTime(nullptr, rDateTime, isDateTime, pTimeZoneOffset,
rString);
}
......@@ -1864,7 +1864,7 @@ bool Converter::parseTimeOrDateTime(
{
bool dummy;
return lcl_parseDateTime(
0, rDateTime, dummy, pTimeZoneOffset, rString, true);
nullptr, rDateTime, dummy, pTimeZoneOffset, rString, true);
}
/** convert ISO "date" or "dateTime" string to util::DateTime or util::Date */
......@@ -2094,7 +2094,7 @@ double Converter::GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUn
if(nSourceUnit != nTargetUnit)
{
const sal_Char* psUnit = 0;
const sal_Char* psUnit = nullptr;
switch(nSourceUnit)
{
......@@ -2610,7 +2610,7 @@ bool Converter::convertAny(OUStringBuffer& rsValue,
aTempValue.Seconds = 0;
aTempValue.Minutes = 0;
aTempValue.Hours = 0;
::sax::Converter::convertDateTime(rsValue, aTempValue, 0);
::sax::Converter::convertDateTime(rsValue, aTempValue, nullptr);
}
else
if (rValue >>= aTime)
......@@ -2632,7 +2632,7 @@ bool Converter::convertAny(OUStringBuffer& rsValue,
{
rsType.append("date");
bConverted = true;
::sax::Converter::convertDateTime(rsValue, aDateTime, 0);
::sax::Converter::convertDateTime(rsValue, aDateTime, nullptr);
}
}
break;
......
......@@ -59,7 +59,7 @@ namespace sax_fastparser {
: maCachedOutputStream()
, maMarkStack()
, mbMarkStackEmpty(true)
, mpDoubleStr(NULL)
, mpDoubleStr(nullptr)
, mnDoubleStrCapacity(RTL_STR_MAX_VALUEOFDOUBLE)
{
rtl_string_new_WithLength(&mpDoubleStr, mnDoubleStrCapacity);
......@@ -83,7 +83,7 @@ namespace sax_fastparser {
{
rtl_math_doubleToString(
&mpDoubleStr, &mnDoubleStrCapacity, 0, value, rtl_math_StringFormat_G,
RTL_STR_MAX_VALUEOFDOUBLE - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', 0,
RTL_STR_MAX_VALUEOFDOUBLE - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', nullptr,
0, sal_True);
write(mpDoubleStr->buffer, mpDoubleStr->length);
......
......@@ -80,7 +80,7 @@ public:
from the element.
*/
void startFastElement( ::sal_Int32 Element, FastAttributeList* pAttrList = NULL );
void startFastElement( ::sal_Int32 Element, FastAttributeList* pAttrList = nullptr );
/** receives notification of the end of an known element.
@see startFastElement
......@@ -104,7 +104,7 @@ public:
from the element.
*/
void singleFastElement( ::sal_Int32 Element, FastAttributeList* pAttrList = NULL );
void singleFastElement( ::sal_Int32 Element, FastAttributeList* pAttrList = nullptr );
// C++ helpers
void writeId( ::sal_Int32 Element );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment