Kaydet (Commit) 1e661634 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

Change-Id: I86546bcf9b476c73da2d6bff30ee1e56933f69c4
üst 51b45df6
......@@ -35,7 +35,7 @@ struct OOO_DLLPUBLIC_XMLREADER Span {
char const * begin;
sal_Int32 length;
inline Span(): begin(0), length(0) {}
inline Span(): begin(nullptr), length(0) {}
// init length to avoid compiler warnings
inline Span(char const * theBegin, sal_Int32 theLength):
......@@ -45,9 +45,9 @@ struct OOO_DLLPUBLIC_XMLREADER Span {
begin(literal), length(N - 1)
{}
inline void clear() throw() { begin = 0; }
inline void clear() throw() { begin = nullptr; }
inline bool is() const { return begin != 0; }
inline bool is() const { return begin != nullptr; }
inline bool equals(Span const & text) const {
return length == text.length
......
......@@ -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);
......
......@@ -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 |
......
......@@ -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))
{
......
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