summaryrefslogtreecommitdiff
path: root/xmlreader
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-10 10:29:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-10 10:32:02 +0100
commit1e661634129bb692294972b5b61df2874632d14d (patch)
treef877dab1866494687d83c73387dbe5458d8dbb80 /xmlreader
parent51b45df6bba163dec7ba91c700de695ad517e5dd (diff)
loplugin:nullptr (automatic rewrite)
Change-Id: I86546bcf9b476c73da2d6bff30ee1e56933f69c4
Diffstat (limited to 'xmlreader')
-rw-r--r--xmlreader/source/pad.cxx4
-rw-r--r--xmlreader/source/span.cxx2
-rw-r--r--xmlreader/source/xmlreader.cxx30
3 files changed, 18 insertions, 18 deletions
diff --git a/xmlreader/source/pad.cxx b/xmlreader/source/pad.cxx
index 94040bbd2493..ce45f805f496 100644
--- a/xmlreader/source/pad.cxx
+++ b/xmlreader/source/pad.cxx
@@ -29,7 +29,7 @@ namespace xmlreader {
void Pad::add(char const * begin, sal_Int32 length) {
assert(
- begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
+ begin != nullptr && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
if (length != 0) {
flushSpan();
if (buffer_.isEmpty()) {
@@ -42,7 +42,7 @@ void Pad::add(char const * begin, sal_Int32 length) {
void Pad::addEphemeral(char const * begin, sal_Int32 length) {
assert(
- begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
+ begin != nullptr && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
if (length != 0) {
flushSpan();
buffer_.append(begin, length);
diff --git a/xmlreader/source/span.cxx b/xmlreader/source/span.cxx
index 2d85df9f0918..b2d78a87fb74 100644
--- a/xmlreader/source/span.cxx
+++ b/xmlreader/source/span.cxx
@@ -34,7 +34,7 @@ namespace xmlreader {
OUString Span::convertFromUtf8() const {
assert(is());
- rtl_uString * s = 0;
+ rtl_uString * s = nullptr;
if (!rtl_convertStringToUString(
&s, begin, length, RTL_TEXTENCODING_UTF8,
(RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx
index b384f8a670a5..011a09485d2c 100644
--- a/xmlreader/source/xmlreader.cxx
+++ b/xmlreader/source/xmlreader.cxx
@@ -56,9 +56,9 @@ bool isSpace(char c) {
XmlReader::XmlReader(char const *sStr, size_t nLength)
: fileUrl_("stream")
- , fileHandle_(0)
+ , fileHandle_(nullptr)
, fileSize_(0)
- , fileAddress_(0)
+ , fileAddress_(nullptr)
{
namespaceIris_.push_back(Span("http://www.w3.org/XML/1998/namespace"));
namespaces_.push_back(NamespaceData(Span("xml"), NAMESPACE_XML));
@@ -70,7 +70,7 @@ XmlReader::XmlReader(char const *sStr, size_t nLength)
XmlReader::XmlReader(OUString const & fileUrl)
: fileUrl_(fileUrl)
- , fileHandle_(0)
+ , fileHandle_(nullptr)
{
oslFileError e = osl_openFile(
fileUrl_.pData, &fileHandle_, osl_File_OpenFlag_Read);
@@ -164,7 +164,7 @@ XmlReader::Result XmlReader::nextItem(Text reportText, Span * data, int * nsId)
}
bool XmlReader::nextAttribute(int * nsId, Span * localName) {
- assert(nsId != 0 && localName != 0);
+ assert(nsId != nullptr && localName != nullptr);
if (firstAttribute_) {
currentAttribute_ = attributes_.begin();
firstAttribute_ = false;
@@ -174,7 +174,7 @@ bool XmlReader::nextAttribute(int * nsId, Span * localName) {
if (currentAttribute_ == attributes_.end()) {
return false;
}
- if (currentAttribute_->nameColon == 0) {
+ if (currentAttribute_->nameColon == nullptr) {
*nsId = NAMESPACE_NONE;
*localName = Span(
currentAttribute_->nameBegin,
@@ -361,7 +361,7 @@ Span XmlReader::scanCdataSection() {
}
bool XmlReader::scanName(char const ** nameColon) {
- assert(nameColon != 0 && *nameColon == 0);
+ assert(nameColon != nullptr && *nameColon == nullptr);
for (char const * begin = pos_;; ++pos_) {
switch (peek()) {
case '\0': // i.e., EOF
@@ -383,7 +383,7 @@ bool XmlReader::scanName(char const ** nameColon) {
}
int XmlReader::scanNamespaceIri(char const * begin, char const * end) {
- assert(begin != 0 && begin <= end);
+ assert(begin != nullptr && begin <= end);
Span iri(handleAttributeValue(begin, end, false));
for (NamespaceIris::size_type i = 0; i < namespaceIris_.size(); ++i) {
if (namespaceIris_[i].equals(iri)) {
@@ -395,7 +395,7 @@ int XmlReader::scanNamespaceIri(char const * begin, char const * end) {
char const * XmlReader::handleReference(char const * position, char const * end)
{
- assert(position != 0 && *position == '&' && position < end);
+ assert(position != nullptr && *position == '&' && position < end);
++position;
if (*position == '#') {
++position;
@@ -603,9 +603,9 @@ Span XmlReader::handleAttributeValue(
}
XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
- assert(nsId != 0 && localName);
+ assert(nsId != nullptr && localName);
char const * nameBegin = pos_;
- char const * nameColon = 0;
+ char const * nameColon = nullptr;
if (!scanName(&nameColon)) {
throw css::uno::RuntimeException(
"bad tag name in " + fileUrl_ );
@@ -626,7 +626,7 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
"missing whitespace before attribute in " + fileUrl_ );
}
char const * attrNameBegin = pos_;
- char const * attrNameColon = 0;
+ char const * attrNameColon = nullptr;
if (!scanName(&attrNameColon)) {
throw css::uno::RuntimeException(
"bad attribute name in " + fileUrl_ );
@@ -651,12 +651,12 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
}
char const * valueEnd = pos_ + i;
pos_ += i + 1;
- if (attrNameColon == 0 &&
+ if (attrNameColon == nullptr &&
Span(attrNameBegin, attrNameEnd - attrNameBegin).equals("xmlns"))
{
hasDefaultNs = true;
defaultNsId = scanNamespaceIri(valueBegin, valueEnd);
- } else if (attrNameColon != 0 &&
+ } else if (attrNameColon != nullptr &&
Span(attrNameBegin, attrNameColon - attrNameBegin).equals(
"xmlns"))
{
@@ -690,7 +690,7 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
ElementData(
Span(nameBegin, nameEnd - nameBegin), inheritedNamespaces,
defaultNsId));
- if (nameColon == 0) {
+ if (nameColon == nullptr) {
*nsId = defaultNsId;
*localName = Span(nameBegin, nameEnd - nameBegin);
} else {
@@ -706,7 +706,7 @@ XmlReader::Result XmlReader::handleEndTag() {
"spurious end tag in " + fileUrl_ );
}
char const * nameBegin = pos_;
- char const * nameColon = 0;
+ char const * nameColon = nullptr;
if (!scanName(&nameColon) ||
!elements_.top().name.equals(nameBegin, pos_ - nameBegin))
{