[libxml++/libxml++-2-40] Still more use of nullptr instead of 0
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml++/libxml++-2-40] Still more use of nullptr instead of 0
- Date: Fri, 9 Oct 2015 14:19:05 +0000 (UTC)
commit 11353eaf05974225d25026ee8444beea9141c5b4
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Fri Oct 9 16:15:16 2015 +0200
Still more use of nullptr instead of 0
libxml++/exceptions/exception.h | 4 +-
libxml++/io/parserinputbuffer.cc | 6 +-
libxml++/parsers/domparser.cc | 12 +++---
libxml++/parsers/domparser.h | 4 +-
libxml++/parsers/saxparser.cc | 68 +++++++++++++++---------------
libxml++/parsers/saxparser.h | 2 +-
libxml++/relaxngschema.cc | 2 +-
libxml++/schema.cc | 2 +-
libxml++/schema.h | 12 +++---
libxml++/validators/dtdvalidator.cc | 8 ++--
libxml++/validators/dtdvalidator.h | 4 +-
libxml++/validators/relaxngvalidator.cc | 2 +-
libxml++/validators/relaxngvalidator.h | 4 +-
libxml++/validators/xsdvalidator.cc | 2 +-
libxml++/validators/xsdvalidator.h | 4 +-
libxml++/xsdschema.cc | 2 +-
16 files changed, 68 insertions(+), 70 deletions(-)
---
diff --git a/libxml++/exceptions/exception.h b/libxml++/exceptions/exception.h
index dffbe5a..d3dade7 100644
--- a/libxml++/exceptions/exception.h
+++ b/libxml++/exceptions/exception.h
@@ -1,5 +1,3 @@
-// -*- C++ -*-
-
/* exception.h
*
* Copyright (C) 2002 The libxml++ development team
@@ -57,7 +55,7 @@ private:
*
* @newin{2,36}
*
- * @param error Pointer to an _xmlError struct or <tt>0</tt>. If <tt>0</tt>,
+ * @param error Pointer to an _xmlError struct or <tt>nullptr</tt>. If <tt>nullptr</tt>,
* the error returned by xmlGetLastError() is used.
* @returns A formatted text string. If the error struct does not contain an
* error (error->code == XML_ERR_OK), an empty string is returned.
diff --git a/libxml++/io/parserinputbuffer.cc b/libxml++/io/parserinputbuffer.cc
index 891b5ac..e4d2473 100644
--- a/libxml++/io/parserinputbuffer.cc
+++ b/libxml++/io/parserinputbuffer.cc
@@ -1,4 +1,4 @@
-/* document.h
+/* parserinputbuffer.cc
* this file is part of libxml++
*
* copyright (C) 2003 by libxml++ developer's team
@@ -39,7 +39,7 @@ namespace xmlpp
&ParserInputBufferCallback::on_close,
static_cast<void*>(this),
XML_CHAR_ENCODING_NONE);
- if(impl_ == 0)
+ if (!impl_)
{
throw internal_error("Cannot initialise underlying xmlParserInputBuffer");
}
@@ -54,7 +54,7 @@ namespace xmlpp
bool result = do_close();
// the underlying structure is being freed by libxml, the pointer will soon be
// invalid.
- impl_ = 0;
+ impl_ = nullptr;
return result;
}
diff --git a/libxml++/parsers/domparser.cc b/libxml++/parsers/domparser.cc
index e8ba7ed..ebb0135 100644
--- a/libxml++/parsers/domparser.cc
+++ b/libxml++/parsers/domparser.cc
@@ -138,11 +138,11 @@ void DomParser::parse_stream(std::istream& in)
xmlResetLastError();
context_ = xmlCreatePushParserCtxt(
- 0, // Setting those two parameters to 0 force the parser
- 0, // to create a document while parsing.
- 0, // chunk
- 0, // size
- 0); // no filename for fetching external entities
+ nullptr, // Setting those two parameters to nullptr force the parser
+ nullptr, // to create a document while parsing.
+ nullptr, // chunk
+ 0, // size
+ nullptr); // no filename for fetching external entities
if(!context_)
{
@@ -169,7 +169,7 @@ void DomParser::parse_stream(std::istream& in)
firstParseError = parseError;
}
- const int parseError = xmlParseChunk(context_, 0, 0, 1 /* last chunk */);
+ const int parseError = xmlParseChunk(context_, nullptr, 0, 1 /* last chunk */);
if (parseError != XML_ERR_OK && firstParseError == XML_ERR_OK)
firstParseError = parseError;
diff --git a/libxml++/parsers/domparser.h b/libxml++/parsers/domparser.h
index f90aa7a..da262be 100644
--- a/libxml++/parsers/domparser.h
+++ b/libxml++/parsers/domparser.h
@@ -80,12 +80,12 @@ public:
operator bool() const;
/** Get the parsed document.
- * @returns A pointer to the parsed document, or <tt>0</tt>.
+ * @returns A pointer to the parsed document, or <tt>nullptr</tt>.
*/
Document* get_document();
/** Get the parsed document.
- * @returns A pointer to the parsed document, or <tt>0</tt>.
+ * @returns A pointer to the parsed document, or <tt>nullptr</tt>.
*/
const Document* get_document() const;
diff --git a/libxml++/parsers/saxparser.cc b/libxml++/parsers/saxparser.cc
index 17531b2..adb2570 100644
--- a/libxml++/parsers/saxparser.cc
+++ b/libxml++/parsers/saxparser.cc
@@ -44,37 +44,37 @@ SaxParser::SaxParser(bool use_get_entity)
{
xmlSAXHandler temp = {
SaxParserCallback::internal_subset,
- 0, // isStandalone
- 0, // hasInternalSubset
- 0, // hasExternalSubset
- 0, // resolveEntity
- use_get_entity ? SaxParserCallback::get_entity : 0, // getEntity
+ nullptr, // isStandalone
+ nullptr, // hasInternalSubset
+ nullptr, // hasExternalSubset
+ nullptr, // resolveEntity
+ use_get_entity ? SaxParserCallback::get_entity : nullptr, // getEntity
SaxParserCallback::entity_decl, // entityDecl
- 0, // notationDecl
- 0, // attributeDecl
- 0, // elementDecl
- 0, // unparsedEntityDecl
- 0, // setDocumentLocator
+ nullptr, // notationDecl
+ nullptr, // attributeDecl
+ nullptr, // elementDecl
+ nullptr, // unparsedEntityDecl
+ nullptr, // setDocumentLocator
SaxParserCallback::start_document, // startDocument
SaxParserCallback::end_document, // endDocument
SaxParserCallback::start_element, // startElement
SaxParserCallback::end_element, // endElement
- 0, // reference
+ nullptr, // reference
SaxParserCallback::characters, // characters
- 0, // ignorableWhitespace
- 0, // processingInstruction
+ nullptr, // ignorableWhitespace
+ nullptr, // processingInstruction
SaxParserCallback::comment, // comment
SaxParserCallback::warning, // warning
SaxParserCallback::error, // error
SaxParserCallback::fatal_error, // fatalError
- 0, // getParameterEntity
+ nullptr, // getParameterEntity
SaxParserCallback::cdata_block, // cdataBlock
- 0, // externalSubset
- 0, // initialized
- 0, // private
- 0, // startElementNs
- 0, // endElementNs
- 0, // serror
+ nullptr, // externalSubset
+ 0, // initialized
+ nullptr, // private
+ nullptr, // startElementNs
+ nullptr, // endElementNs
+ nullptr, // serror
};
*sax_handler_ = temp;
}
@@ -227,10 +227,10 @@ void SaxParser::parse_stream(std::istream& in)
context_ = xmlCreatePushParserCtxt(
sax_handler_.get(),
- 0, // user_data
- 0, // chunk
- 0, // size
- 0); // no filename for fetching external entities
+ nullptr, // user_data
+ nullptr, // chunk
+ 0, // size
+ nullptr); // no filename for fetching external entities
if(!context_)
{
@@ -262,7 +262,7 @@ void SaxParser::parse_stream(std::istream& in)
if( ! exception_ )
{
//This is called just to terminate parsing.
- const int parseError = xmlParseChunk(context_, 0 /* chunk */, 0 /* size */, 1 /* terminate (1 or 0) */);
+ const int parseError = xmlParseChunk(context_, nullptr /* chunk */, 0 /* size */, 1 /* terminate (1 or
0) */);
if (parseError != XML_ERR_OK && firstParseError == XML_ERR_OK)
firstParseError = parseError;
@@ -296,10 +296,10 @@ void SaxParser::parse_chunk_raw(const unsigned char* contents, size_type bytes_c
{
context_ = xmlCreatePushParserCtxt(
sax_handler_.get(),
- 0, // user_data
- 0, // chunk
- 0, // size
- 0); // no filename for fetching external entities
+ nullptr, // user_data
+ nullptr, // chunk
+ 0, // size
+ nullptr); // no filename for fetching external entities
if(!context_)
{
@@ -337,10 +337,10 @@ void SaxParser::finish_chunk_parsing()
{
context_ = xmlCreatePushParserCtxt(
sax_handler_.get(),
- 0, // this, // user_data
- 0, // chunk
- 0, // size
- 0); // no filename for fetching external entities
+ nullptr, // user_data
+ nullptr, // chunk
+ 0, // size
+ nullptr); // no filename for fetching external entities
if(!context_)
{
@@ -354,7 +354,7 @@ void SaxParser::finish_chunk_parsing()
int parseError = XML_ERR_OK;
if(!exception_)
//This is called just to terminate parsing.
- parseError = xmlParseChunk(context_, 0 /* chunk */, 0 /* size */, 1 /* terminate (1 or 0) */);
+ parseError = xmlParseChunk(context_, nullptr /* chunk */, 0 /* size */, 1 /* terminate (1 or 0) */);
auto error_str = format_xml_parser_error(context_);
if (error_str.empty() && parseError != XML_ERR_OK)
diff --git a/libxml++/parsers/saxparser.h b/libxml++/parsers/saxparser.h
index 6b3405a..965ef03 100644
--- a/libxml++/parsers/saxparser.h
+++ b/libxml++/parsers/saxparser.h
@@ -196,7 +196,7 @@ protected:
* Unlike the DomParser, the SaxParser will also tell you about entity references for the 5 predefined
entities.
*
* @param name The entity reference name.
- * @returns The resolved xmlEntity for the entity reference, or <tt>0</tt> if not found.
+ * @returns The resolved xmlEntity for the entity reference, or <tt>nullptr</tt> if not found.
* You must include libxml/parser.h in order to use this C struct.
* This instance will not be freed by the caller.
*/
diff --git a/libxml++/relaxngschema.cc b/libxml++/relaxngschema.cc
index 96bd880..1bd69bc 100644
--- a/libxml++/relaxngschema.cc
+++ b/libxml++/relaxngschema.cc
@@ -91,7 +91,7 @@ void RelaxNGSchema::parse_memory(const Glib::ustring& contents)
void RelaxNGSchema::parse_document(const Document* document)
{
if (!document)
- throw parse_error("RelaxNGSchema::parse_document(): document must not be 0.");
+ throw parse_error("RelaxNGSchema::parse_document(): document must not be nullptr.");
// xmlRelaxNGNewDocParserCtxt() takes a copy of the xmlDoc.
parse_context(xmlRelaxNGNewDocParserCtxt(const_cast<xmlDoc*>(document->cobj())));
diff --git a/libxml++/schema.cc b/libxml++/schema.cc
index 1b39b24..7d117ae 100644
--- a/libxml++/schema.cc
+++ b/libxml++/schema.cc
@@ -104,7 +104,7 @@ void Schema::release_underlying()
Document* Schema::get_document()
{
if (!(impl_ && impl_->doc))
- return 0;
+ return nullptr;
if (!impl_->doc->_private) // Possible if *this was created with Schema(xmlSchema* schema).
new Document(impl_->doc); // Sets impl_->doc->_private
diff --git a/libxml++/schema.h b/libxml++/schema.h
index 69299c8..f412703 100644
--- a/libxml++/schema.h
+++ b/libxml++/schema.h
@@ -38,14 +38,14 @@ public:
explicit Schema(_xmlSchema* schema);
/** Create a schema from an XML document.
- * @param document XMLSchema document, 0 to create an empty schema document.
+ * @param document XMLSchema document, <tt>nullptr</tt> to create an empty schema document.
* @param embed If true, the document will be deleted when
* the schema is deleted or another document is set.
* @throws xmlpp::parse_error
* @throws xmlpp::internal_error If an empty schema document can't be created.
* @deprecated Use XsdSchema instead.
*/
- explicit Schema(Document* document = 0, bool embed = false);
+ explicit Schema(Document* document = nullptr, bool embed = false);
~Schema();
//TODO: Remove virtual when we can break ABI?
@@ -53,13 +53,13 @@ public:
/** Set a new document to the schema.
* If the old schema document is owned by the schema (embed == true), the old
* schema document and all its nodes are deleted.
- * @param document XMLSchema document, 0 to create an empty schema document.
+ * @param document XMLSchema document, <tt>nullptr</tt> to create an empty schema document.
* @param embed If true, the document will be deleted when the schema is deleted or another document is
set.
* @throws xmlpp::parse_error
* @throws xmlpp::internal_error If an empty schema document can't be created.
* @deprecated Use XsdSchema::parse_document() instead.
*/
- virtual void set_document(Document* document = 0, bool embed = false);
+ virtual void set_document(Document* document = nullptr, bool embed = false);
/** @deprecated There is no replacement.
*/
@@ -74,13 +74,13 @@ public:
Glib::ustring get_version() const;
/** Get the schema document.
- * @returns A pointer to the schema document, or <tt>0</tt> if none exists.
+ * @returns A pointer to the schema document, or <tt>nullptr</tt> if none exists.
* @deprecated There is no replacement.
*/
Document* get_document();
/** Get the schema document.
- * @returns A pointer to the schema document, or <tt>0</tt> if none exists.
+ * @returns A pointer to the schema document, or <tt>nullptr</tt> if none exists.
* @deprecated There is no replacement.
*/
const Document* get_document() const;
diff --git a/libxml++/validators/dtdvalidator.cc b/libxml++/validators/dtdvalidator.cc
index be4e6ca..018f17f 100644
--- a/libxml++/validators/dtdvalidator.cc
+++ b/libxml++/validators/dtdvalidator.cc
@@ -55,8 +55,8 @@ void DtdValidator::parse_subset(const Glib::ustring& external,const Glib::ustrin
xmlResetLastError();
auto dtd = xmlParseDTD(
- external.empty() ? 0 : (const xmlChar *)external.c_str(),
- system.empty() ? 0 : (const xmlChar *)system.c_str());
+ external.empty() ? nullptr : (const xmlChar *)external.c_str(),
+ system.empty() ? nullptr : (const xmlChar *)system.c_str());
if (!dtd)
{
@@ -82,7 +82,7 @@ void DtdValidator::parse_stream(std::istream& in)
IStreamParserInputBuffer ibuff( in );
- auto dtd = xmlIOParseDTD( 0, ibuff.cobj(), XML_CHAR_ENCODING_UTF8 );
+ auto dtd = xmlIOParseDTD(nullptr, ibuff.cobj(), XML_CHAR_ENCODING_UTF8);
if (!dtd)
{
@@ -125,7 +125,7 @@ bool DtdValidator::validate(const Document* doc)
{
if (!doc)
{
- throw internal_error("Document pointer cannot be 0.");
+ throw internal_error("Document pointer cannot be nullptr.");
}
if (!dtd_)
diff --git a/libxml++/validators/dtdvalidator.h b/libxml++/validators/dtdvalidator.h
index 01b04c1..6448584 100644
--- a/libxml++/validators/dtdvalidator.h
+++ b/libxml++/validators/dtdvalidator.h
@@ -73,12 +73,12 @@ public:
operator bool() const;
/** Get the parsed DTD.
- * @returns A pointer to the parsed DTD, or <tt>0</tt>.
+ * @returns A pointer to the parsed DTD, or <tt>nullptr</tt>.
*/
Dtd* get_dtd();
/** Get the parsed DTD.
- * @returns A pointer to the parsed DTD, or <tt>0</tt>.
+ * @returns A pointer to the parsed DTD, or <tt>nullptr</tt>.
*/
const Dtd* get_dtd() const;
diff --git a/libxml++/validators/relaxngvalidator.cc b/libxml++/validators/relaxngvalidator.cc
index 0d00560..04e28fd 100644
--- a/libxml++/validators/relaxngvalidator.cc
+++ b/libxml++/validators/relaxngvalidator.cc
@@ -132,7 +132,7 @@ void RelaxNGValidator::initialize_valid()
void RelaxNGValidator::validate(const Document* document)
{
if (!document)
- throw internal_error("RelaxNGValidator::validate(): document must not be 0.");
+ throw internal_error("RelaxNGValidator::validate(): document must not be nullptr.");
if (!*this)
throw internal_error("RelaxNGValidator::validate(): Must have a schema to validate document");
diff --git a/libxml++/validators/relaxngvalidator.h b/libxml++/validators/relaxngvalidator.h
index f9138a3..5cd5ad7 100644
--- a/libxml++/validators/relaxngvalidator.h
+++ b/libxml++/validators/relaxngvalidator.h
@@ -126,12 +126,12 @@ public:
virtual operator BoolExpr() const;
/** Get the schema.
- * @returns A pointer to the schema, or <tt>0</tt>.
+ * @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
RelaxNGSchema* get_schema();
/** Get the schema.
- * @returns A pointer to the schema, or <tt>0</tt>.
+ * @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
const RelaxNGSchema* get_schema() const;
diff --git a/libxml++/validators/xsdvalidator.cc b/libxml++/validators/xsdvalidator.cc
index 674296e..07f1fe3 100644
--- a/libxml++/validators/xsdvalidator.cc
+++ b/libxml++/validators/xsdvalidator.cc
@@ -130,7 +130,7 @@ void XsdValidator::initialize_valid()
void XsdValidator::validate(const Document* document)
{
if (!document)
- throw internal_error("XsdValidator::validate(): document must not be 0.");
+ throw internal_error("XsdValidator::validate(): document must not be nullptr.");
if (!*this)
throw internal_error("XsdValidator::validate(): Must have a schema to validate document");
diff --git a/libxml++/validators/xsdvalidator.h b/libxml++/validators/xsdvalidator.h
index 2f14cb0..941d7f1 100644
--- a/libxml++/validators/xsdvalidator.h
+++ b/libxml++/validators/xsdvalidator.h
@@ -117,12 +117,12 @@ public:
virtual operator BoolExpr() const;
/** Get the schema.
- * @returns A pointer to the schema, or <tt>0</tt>.
+ * @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
XsdSchema* get_schema();
/** Get the schema.
- * @returns A pointer to the schema, or <tt>0</tt>.
+ * @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
const XsdSchema* get_schema() const;
diff --git a/libxml++/xsdschema.cc b/libxml++/xsdschema.cc
index 94a9238..38981fe 100644
--- a/libxml++/xsdschema.cc
+++ b/libxml++/xsdschema.cc
@@ -94,7 +94,7 @@ void XsdSchema::parse_memory(const Glib::ustring& contents)
void XsdSchema::parse_document(const Document* document)
{
if (!document)
- throw parse_error("XsdSchema::parse_document(): document must not be 0.");
+ throw parse_error("XsdSchema::parse_document(): document must not be nullptr.");
xmlResetLastError();
release_underlying();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]