Skip to content

Commit a96e5fa

Browse files
ya1gauravmurraycu
authored andcommitted
Use nullptr instead of 0 at missing places - C++-11
1 parent a6e487e commit a96e5fa

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

libxml++/document.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Dtd* Document::get_internal_subset() const
201201
{
202202
auto dtd = xmlGetIntSubset(impl_);
203203
if(!dtd)
204-
return 0;
204+
return nullptr;
205205

206206
if(!dtd->_private)
207207
dtd->_private = new Dtd(dtd);
@@ -226,7 +226,7 @@ Element* Document::get_root_node()
226226
{
227227
auto root = xmlDocGetRootElement(impl_);
228228
if(root == nullptr)
229-
return 0;
229+
return nullptr;
230230
else
231231
{
232232
Node::create_wrapper(root);
@@ -270,7 +270,7 @@ Element* Document::create_root_node_by_import(const Node* node,
270270
bool recursive)
271271
{
272272
if (!node)
273-
return 0;
273+
return nullptr;
274274

275275
//Create the node, by copying:
276276
auto imported_node = xmlDocCopyNode(const_cast<xmlNode*>(node->cobj()), impl_, recursive);

libxml++/nodes/element.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Attribute* Element::get_attribute(const Glib::ustring& name,
6767
{
6868
ns_uri = get_namespace_uri_for_prefix(ns_prefix);
6969
if (ns_uri.empty())
70-
return 0; // No such prefix.
70+
return nullptr; // No such prefix.
7171
}
7272

7373
// The return value of xmlHasNsProp() may be either an xmlAttr*, pointing to an
@@ -82,7 +82,7 @@ Attribute* Element::get_attribute(const Glib::ustring& name,
8282
return reinterpret_cast<Attribute*>(attr->_private);
8383
}
8484

85-
return 0;
85+
return nullptr;
8686
}
8787

8888
const Attribute* Element::get_attribute(const Glib::ustring& name,
@@ -128,7 +128,7 @@ Attribute* Element::set_attribute(const Glib::ustring& name, const Glib::ustring
128128
return reinterpret_cast<Attribute*>(attr->_private);
129129
}
130130
else
131-
return 0;
131+
return nullptr;
132132
}
133133

134134
void Element::remove_attribute(const Glib::ustring& name, const Glib::ustring& ns_prefix)
@@ -155,7 +155,7 @@ Element* Element::add_child_element(xmlpp::Node* previous_sibling,
155155
const Glib::ustring& name, const Glib::ustring& ns_prefix)
156156
{
157157
if (!previous_sibling)
158-
return 0;
158+
return nullptr;
159159

160160
auto child = create_new_child_element_node(name, ns_prefix);
161161
auto node = xmlAddNextSibling(previous_sibling->cobj(), child);
@@ -166,7 +166,7 @@ Element* Element::add_child_element_before(xmlpp::Node* next_sibling,
166166
const Glib::ustring& name, const Glib::ustring& ns_prefix)
167167
{
168168
if (!next_sibling)
169-
return 0;
169+
return nullptr;
170170

171171
auto child = create_new_child_element_node(name, ns_prefix);
172172
auto node = xmlAddPrevSibling(next_sibling->cobj(), child);
@@ -186,7 +186,7 @@ Element* Element::add_child_element_with_new_ns(xmlpp::Node* previous_sibling,
186186
const Glib::ustring& ns_uri, const Glib::ustring& ns_prefix)
187187
{
188188
if (!previous_sibling)
189-
return 0;
189+
return nullptr;
190190

191191
auto child = create_new_child_element_node_with_new_ns(name, ns_uri, ns_prefix);
192192
auto node = xmlAddNextSibling(previous_sibling->cobj(), child);
@@ -198,7 +198,7 @@ Element* Element::add_child_element_before_with_new_ns(xmlpp::Node* next_sibling
198198
const Glib::ustring& ns_uri, const Glib::ustring& ns_prefix)
199199
{
200200
if (!next_sibling)
201-
return 0;
201+
return nullptr;
202202

203203
auto child = create_new_child_element_node_with_new_ns(name, ns_uri, ns_prefix);
204204
auto node = xmlAddPrevSibling(next_sibling->cobj(), child);
@@ -302,13 +302,13 @@ TextNode* Element::add_child_text(const Glib::ustring& content)
302302
Node::create_wrapper(node);
303303
return static_cast<TextNode*>(node->_private);
304304
}
305-
return 0;
305+
return nullptr;
306306
}
307307

308308
TextNode* Element::add_child_text(xmlpp::Node* previous_sibling, const Glib::ustring& content)
309309
{
310310
if(!previous_sibling)
311-
return 0;
311+
return nullptr;
312312

313313
if(cobj()->type == XML_ELEMENT_NODE)
314314
{
@@ -324,13 +324,13 @@ TextNode* Element::add_child_text(xmlpp::Node* previous_sibling, const Glib::ust
324324
Node::create_wrapper(node);
325325
return static_cast<TextNode*>(node->_private);
326326
}
327-
return 0;
327+
return nullptr;
328328
}
329329

330330
TextNode* Element::add_child_text_before(xmlpp::Node* next_sibling, const Glib::ustring& content)
331331
{
332332
if(!next_sibling)
333-
return 0;
333+
return nullptr;
334334

335335
if(cobj()->type == XML_ELEMENT_NODE)
336336
{
@@ -346,7 +346,7 @@ TextNode* Element::add_child_text_before(xmlpp::Node* next_sibling, const Glib::
346346
Node::create_wrapper(node);
347347
return static_cast<TextNode*>(node->_private);
348348
}
349-
return 0;
349+
return nullptr;
350350
}
351351

352352
bool Element::has_child_text() const

libxml++/nodes/node.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ const Element* Node::get_parent() const
238238
Element* Node::get_parent()
239239
{
240240
if(!(cobj()->parent && cobj()->parent->type == XML_ELEMENT_NODE))
241-
return 0;
241+
return nullptr;
242242

243243
Node::create_wrapper(cobj()->parent);
244244
return static_cast<Element*>(cobj()->parent->_private);
@@ -252,7 +252,7 @@ const Node* Node::get_next_sibling() const
252252
Node* Node::get_next_sibling()
253253
{
254254
if(!cobj()->next)
255-
return 0;
255+
return nullptr;
256256

257257
Node::create_wrapper(cobj()->next);
258258
return static_cast<Node*>(cobj()->next->_private);
@@ -266,7 +266,7 @@ const Node* Node::get_previous_sibling() const
266266
Node* Node::get_previous_sibling()
267267
{
268268
if(!cobj()->prev)
269-
return 0;
269+
return nullptr;
270270

271271
Node::create_wrapper(cobj()->prev);
272272
return static_cast<Node*>(cobj()->prev->_private);
@@ -276,7 +276,7 @@ Node* Node::get_first_child(const Glib::ustring& name)
276276
{
277277
auto child = impl_->children;
278278
if(!child)
279-
return 0;
279+
return nullptr;
280280

281281
do
282282
{
@@ -285,7 +285,7 @@ Node* Node::get_first_child(const Glib::ustring& name)
285285
}
286286
while((child = child->next));
287287

288-
return 0;
288+
return nullptr;
289289
}
290290

291291
const Node* Node::get_first_child(const Glib::ustring& name) const
@@ -320,7 +320,7 @@ void Node::remove_node(Node* node)
320320
Node* Node::import_node(const Node* node, bool recursive)
321321
{
322322
if (!node)
323-
return 0;
323+
return nullptr;
324324

325325
//Create the node, by copying:
326326
auto imported_node = xmlDocCopyNode(const_cast<xmlNode*>(node->cobj()), impl_->doc, recursive);

libxml++/parsers/textreader.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ Node* TextReader::get_current_node()
301301
}
302302

303303
check_for_exceptions();
304-
return 0;
304+
return nullptr;
305305
}
306306

307307
const Node* TextReader::get_current_node() const
@@ -329,7 +329,7 @@ Node* TextReader::expand()
329329
}
330330

331331
check_for_exceptions();
332-
return 0;
332+
return nullptr;
333333
}
334334

335335
bool TextReader::next()

0 commit comments

Comments
 (0)