summaryrefslogtreecommitdiff
path: root/helpcompiler/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-10 10:16:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-10 10:31:27 +0100
commit2df257e95e655de7b0f888b033a56cd800d3002e (patch)
tree289bad43a8dbeb85e0af6447eadf87c79f13fdb6 /helpcompiler/source
parent06c5c630201152964c19c47262a5a54fcb6cf6c2 (diff)
loplugin:nullptr (automatic rewrite)
Change-Id: I6e34abccb0bda1c76e30ab973b8fd827d6c99c72
Diffstat (limited to 'helpcompiler/source')
-rw-r--r--helpcompiler/source/BasCodeTagger.cxx30
-rw-r--r--helpcompiler/source/HelpCompiler.cxx10
-rw-r--r--helpcompiler/source/HelpLinker.cxx36
-rw-r--r--helpcompiler/source/HelpSearch.cxx2
4 files changed, 39 insertions, 39 deletions
diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx
index 89aca5418088..e1c485583ab8 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -11,12 +11,12 @@
LibXmlTreeWalker::LibXmlTreeWalker( xmlDocPtr doc )
{
- if ( doc == NULL )
+ if ( doc == nullptr )
throw BasicCodeTagger::NULL_DOCUMENT;
m_pCurrentNode = xmlDocGetRootElement( doc );
- if ( m_pCurrentNode == NULL )
+ if ( m_pCurrentNode == nullptr )
throw BasicCodeTagger::EMPTY_DOCUMENT;
- else if ( m_pCurrentNode->xmlChildrenNode != NULL )
+ else if ( m_pCurrentNode->xmlChildrenNode != nullptr )
m_Queue.push_back( m_pCurrentNode->xmlChildrenNode );
nextNode();
}
@@ -25,7 +25,7 @@ void LibXmlTreeWalker::nextNode()
{
//next node
- if ( m_pCurrentNode->next == NULL )
+ if ( m_pCurrentNode->next == nullptr )
{
m_pCurrentNode = m_Queue.front();
m_Queue.pop_front();
@@ -33,19 +33,19 @@ void LibXmlTreeWalker::nextNode()
else
m_pCurrentNode = m_pCurrentNode->next;
//queue children if they exist
- if ( m_pCurrentNode->xmlChildrenNode != NULL )
+ if ( m_pCurrentNode->xmlChildrenNode != nullptr )
m_Queue.push_back( m_pCurrentNode->xmlChildrenNode );
}
void LibXmlTreeWalker::ignoreCurrNodesChildren()
{
- if ( m_pCurrentNode->xmlChildrenNode != NULL )
+ if ( m_pCurrentNode->xmlChildrenNode != nullptr )
m_Queue.pop_back();
}
bool LibXmlTreeWalker::end()
{
- return m_pCurrentNode->next == NULL && m_Queue.empty();
+ return m_pCurrentNode->next == nullptr && m_Queue.empty();
}
@@ -54,17 +54,17 @@ bool LibXmlTreeWalker::end()
BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ):
m_Highlighter(HIGHLIGHT_BASIC)
{
- if ( rootDoc == NULL )
+ if ( rootDoc == nullptr )
throw NULL_DOCUMENT;
m_pDocument = rootDoc;
- m_pXmlTreeWalker = NULL;
+ m_pXmlTreeWalker = nullptr;
m_bTaggingCompleted = false;
}
BasicCodeTagger::~BasicCodeTagger()
{
- if ( m_pXmlTreeWalker != NULL )
+ if ( m_pXmlTreeWalker != nullptr )
delete m_pXmlTreeWalker;
}
//!Gathers all the <bascode> tag nodes from xml tree.
@@ -77,7 +77,7 @@ void BasicCodeTagger::getBasicCodeContainerNodes()
m_BasicCodeContainerTags.clear();
- if ( m_pXmlTreeWalker != NULL )
+ if ( m_pXmlTreeWalker != nullptr )
delete m_pXmlTreeWalker;
m_pXmlTreeWalker = new LibXmlTreeWalker( m_pDocument );
@@ -111,7 +111,7 @@ void BasicCodeTagger::tagBasCodeParagraphs()
{
currBascodeNode = m_BasicCodeContainerTags.front();
currParagraph = currBascodeNode->xmlChildrenNode; //first <paragraph>
- while ( currParagraph != NULL )
+ while ( currParagraph != nullptr )
{
tagParagraph( currParagraph );
currParagraph=currParagraph->next;
@@ -126,14 +126,14 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
//1. get paragraph text
xmlChar* codeSnippet;
codeSnippet = xmlNodeListGetString( m_pDocument, paragraph->xmlChildrenNode, 1 );
- if ( codeSnippet == NULL )
+ if ( codeSnippet == nullptr )
{
return; //no text, nothing more to do here
}
//2. delete every child from paragraph (except attributes)
xmlNodePtr curNode = paragraph->xmlChildrenNode;
xmlNodePtr sibling;
- while ( curNode != NULL )
+ while ( curNode != nullptr )
{
sibling = curNode->next;
xmlUnlinkNode( curNode );
@@ -155,7 +155,7 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
if ( i->tokenType != TT_WHITESPACE )
{
xmlChar* typeStr = getTypeString( i->tokenType );
- curNode = xmlNewTextChild( paragraph, 0, reinterpret_cast<xmlChar const *>("item"), 0 );
+ curNode = xmlNewTextChild( paragraph, nullptr, reinterpret_cast<xmlChar const *>("item"), nullptr );
xmlNewProp( curNode, reinterpret_cast<xmlChar const *>("type"), typeStr );
xmlAddChild( curNode, text );
xmlFree( typeStr );
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index c4a3eaa34282..af8154749795 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -70,9 +70,9 @@ void HelpCompiler::tagBasicCodeExamples( xmlDocPtr doc )
xmlDocPtr HelpCompiler::compactXhpForJar( xmlDocPtr doc )
{
- static xsltStylesheetPtr compact = NULL;
+ static xsltStylesheetPtr compact = nullptr;
static const char *params[2 + 1];
- params[0] = NULL;
+ params[0] = nullptr;
xmlDocPtr compacted;
if (!compact)
@@ -119,7 +119,7 @@ void HelpCompiler::saveXhpForJar( xmlDocPtr doc, const fs::path &filePath )
xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
{
- static xsltStylesheetPtr cur = NULL;
+ static xsltStylesheetPtr cur = nullptr;
xmlDocPtr res;
if( bExtensionMode )
@@ -144,7 +144,7 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath)
int nbparams = 0;
params[nbparams++] = "fsroot";
params[nbparams++] = fsroot.c_str();
- params[nbparams] = NULL;
+ params[nbparams] = nullptr;
}
xmlDocPtr doc = xmlParseFile(filePath.native_file_string().c_str());
if( !doc )
@@ -175,7 +175,7 @@ xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const std::string& appl)
{
std::string tmp="";
xmlChar * prop = xmlGetProp(list, reinterpret_cast<xmlChar const *>("select"));
- if (prop != 0)
+ if (prop != nullptr)
{
if (strcmp(reinterpret_cast<char *>(prop), "sys") == 0)
{
diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx
index 6c40d14afe61..8b8f89563f27 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -84,7 +84,7 @@ void IndexerPreProcessor::processDocument
if( m_xsltStylesheetPtrCaption )
{
- xmlDocPtr resCaption = xsltApplyStylesheet( m_xsltStylesheetPtrCaption, doc, NULL );
+ xmlDocPtr resCaption = xsltApplyStylesheet( m_xsltStylesheetPtrCaption, doc, nullptr );
xmlNodePtr pResNodeCaption = resCaption->xmlChildrenNode;
if( pResNodeCaption )
{
@@ -107,7 +107,7 @@ void IndexerPreProcessor::processDocument
if( m_xsltStylesheetPtrContent )
{
- xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, NULL );
+ xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, nullptr );
xmlNodePtr pResNodeContent = resContent->xmlChildrenNode;
if( pResNodeContent )
{
@@ -151,7 +151,7 @@ struct Data
void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const std::string& aValueStr )
{
- if( pFile == NULL )
+ if( pFile == nullptr )
return;
char cLF = 10;
unsigned int nKeyLen = aKeyStr.length();
@@ -193,7 +193,7 @@ public:
#else
FILE* pFile = fopen( rFileName.native_file_string().c_str(), "wb" );
#endif
- if( pFile == NULL )
+ if( pFile == nullptr )
return;
DataHashtable::const_iterator aEnd = _hash.end();
@@ -260,7 +260,7 @@ void HelpLinker::addBookmark( FILE* pFile_DBHelp, std::string thishid,
for (size_t j = 0; j < titleB.length(); ++j)
dataB[i++] = titleB[j];
- if( pFile_DBHelp != NULL )
+ if( pFile_DBHelp != nullptr )
{
std::string aValueStr( dataB.begin(), dataB.end() );
writeKeyValue_DBHelp( pFile_DBHelp, thishid, aValueStr );
@@ -481,7 +481,7 @@ void HelpLinker::link() throw(HelpProcessingException, BasicCodeTagger::TaggerEx
helpTextId = URLEncoder::encode(helpTextId);
- if( pFileHelpText_DBHelp != NULL )
+ if( pFileHelpText_DBHelp != nullptr )
writeKeyValue_DBHelp( pFileHelpText_DBHelp, helpTextId, helpTextText );
}
}
@@ -507,16 +507,16 @@ void HelpLinker::link() throw(HelpProcessingException, BasicCodeTagger::TaggerEx
catch( const HelpProcessingException& )
{
// catch HelpProcessingException to avoid locking data bases
- if( pFileHelpText_DBHelp != NULL )
+ if( pFileHelpText_DBHelp != nullptr )
fclose( pFileHelpText_DBHelp );
- if( pFileDbBase_DBHelp != NULL )
+ if( pFileDbBase_DBHelp != nullptr )
fclose( pFileDbBase_DBHelp );
throw;
}
- if( pFileHelpText_DBHelp != NULL )
+ if( pFileHelpText_DBHelp != nullptr )
fclose( pFileHelpText_DBHelp );
- if( pFileDbBase_DBHelp != NULL )
+ if( pFileDbBase_DBHelp != nullptr )
fclose( pFileDbBase_DBHelp );
helpKeyword.dump_DBHelp( keyWordFileName_DBHelp);
@@ -875,7 +875,7 @@ void HelpLinker::main( std::vector<std::string> &args,
}
// Variable to set an exception in "C" StructuredXMLErrorFunction
-static const HelpProcessingException* GpXMLParsingException = NULL;
+static const HelpProcessingException* GpXMLParsingException = nullptr;
extern "C" void StructuredXMLErrorFunction(void *userData, xmlErrorPtr error)
{
@@ -884,14 +884,14 @@ extern "C" void StructuredXMLErrorFunction(void *userData, xmlErrorPtr error)
std::string aErrorMsg = error->message;
std::string aXMLParsingFile;
- if( error->file != NULL )
+ if( error->file != nullptr )
aXMLParsingFile = error->file;
int nXMLParsingLine = error->line;
HelpProcessingException* pException = new HelpProcessingException( aErrorMsg, aXMLParsingFile, nXMLParsingLine );
GpXMLParsingException = pException;
// Reset error handler
- xmlSetStructuredErrorFunc( NULL, NULL );
+ xmlSetStructuredErrorFunc( nullptr, nullptr );
}
HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpProcessingException& e )
@@ -941,7 +941,7 @@ bool compileExtensionHelp
std::string aStdStrDestination = pDestination;
// Set error handler
- xmlSetStructuredErrorFunc( NULL, StructuredXMLErrorFunction );
+ xmlSetStructuredErrorFunc( nullptr, StructuredXMLErrorFunction );
try
{
std::unique_ptr<HelpLinker> pHelpLinker(new HelpLinker());
@@ -949,11 +949,11 @@ bool compileExtensionHelp
}
catch( const HelpProcessingException& e )
{
- if( GpXMLParsingException != NULL )
+ if( GpXMLParsingException != nullptr )
{
o_rHelpProcessingErrorInfo = *GpXMLParsingException;
delete GpXMLParsingException;
- GpXMLParsingException = NULL;
+ GpXMLParsingException = nullptr;
}
else
{
@@ -962,7 +962,7 @@ bool compileExtensionHelp
bSuccess = false;
}
// Reset error handler
- xmlSetStructuredErrorFunc( NULL, NULL );
+ xmlSetStructuredErrorFunc( nullptr, nullptr );
// i83624: Tree files
// The following basically checks if the help.tree is well formed XML.
@@ -983,7 +983,7 @@ bool compileExtensionHelp
aFile.read( s.get(), len, ret );
aFile.close();
- XML_Parser parser = XML_ParserCreate( 0 );
+ XML_Parser parser = XML_ParserCreate( nullptr );
XML_Status parsed = XML_Parse( parser, s.get(), int( len ), true );
if (XML_STATUS_ERROR == parsed)
diff --git a/helpcompiler/source/HelpSearch.cxx b/helpcompiler/source/HelpSearch.cxx
index 6b0c4202c9cc..603b11795ef8 100644
--- a/helpcompiler/source/HelpSearch.cxx
+++ b/helpcompiler/source/HelpSearch.cxx
@@ -42,7 +42,7 @@ bool HelpSearch::query(OUString const &queryStr, bool captionOnly,
for (size_t i = 0; i < hits->length(); ++i) {
lucene::document::Document &doc = hits->doc(i); // Document* belongs to Hits.
wchar_t const *path = doc.get(L"path");
- rDocuments.push_back(TCHARArrayToOUString(path != 0 ? path : L""));
+ rDocuments.push_back(TCHARArrayToOUString(path != nullptr ? path : L""));
rScores.push_back(hits->score(i));
}