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 { ...@@ -35,7 +35,7 @@ struct OOO_DLLPUBLIC_XMLREADER Span {
char const * begin; char const * begin;
sal_Int32 length; sal_Int32 length;
inline Span(): begin(0), length(0) {} inline Span(): begin(nullptr), length(0) {}
// init length to avoid compiler warnings // init length to avoid compiler warnings
inline Span(char const * theBegin, sal_Int32 theLength): inline Span(char const * theBegin, sal_Int32 theLength):
...@@ -45,9 +45,9 @@ struct OOO_DLLPUBLIC_XMLREADER Span { ...@@ -45,9 +45,9 @@ struct OOO_DLLPUBLIC_XMLREADER Span {
begin(literal), length(N - 1) 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 { inline bool equals(Span const & text) const {
return length == text.length return length == text.length
......
...@@ -29,7 +29,7 @@ namespace xmlreader { ...@@ -29,7 +29,7 @@ namespace xmlreader {
void Pad::add(char const * begin, sal_Int32 length) { void Pad::add(char const * begin, sal_Int32 length) {
assert( assert(
begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0)); begin != nullptr && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
if (length != 0) { if (length != 0) {
flushSpan(); flushSpan();
if (buffer_.isEmpty()) { if (buffer_.isEmpty()) {
...@@ -42,7 +42,7 @@ void Pad::add(char const * begin, sal_Int32 length) { ...@@ -42,7 +42,7 @@ void Pad::add(char const * begin, sal_Int32 length) {
void Pad::addEphemeral(char const * begin, sal_Int32 length) { void Pad::addEphemeral(char const * begin, sal_Int32 length) {
assert( assert(
begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0)); begin != nullptr && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
if (length != 0) { if (length != 0) {
flushSpan(); flushSpan();
buffer_.append(begin, length); buffer_.append(begin, length);
......
...@@ -34,7 +34,7 @@ namespace xmlreader { ...@@ -34,7 +34,7 @@ namespace xmlreader {
OUString Span::convertFromUtf8() const { OUString Span::convertFromUtf8() const {
assert(is()); assert(is());
rtl_uString * s = 0; rtl_uString * s = nullptr;
if (!rtl_convertStringToUString( if (!rtl_convertStringToUString(
&s, begin, length, RTL_TEXTENCODING_UTF8, &s, begin, length, RTL_TEXTENCODING_UTF8,
(RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
......
...@@ -56,9 +56,9 @@ bool isSpace(char c) { ...@@ -56,9 +56,9 @@ bool isSpace(char c) {
XmlReader::XmlReader(char const *sStr, size_t nLength) XmlReader::XmlReader(char const *sStr, size_t nLength)
: fileUrl_("stream") : fileUrl_("stream")
, fileHandle_(0) , fileHandle_(nullptr)
, fileSize_(0) , fileSize_(0)
, fileAddress_(0) , fileAddress_(nullptr)
{ {
namespaceIris_.push_back(Span("http://www.w3.org/XML/1998/namespace")); namespaceIris_.push_back(Span("http://www.w3.org/XML/1998/namespace"));
namespaces_.push_back(NamespaceData(Span("xml"), NAMESPACE_XML)); namespaces_.push_back(NamespaceData(Span("xml"), NAMESPACE_XML));
...@@ -70,7 +70,7 @@ XmlReader::XmlReader(char const *sStr, size_t nLength) ...@@ -70,7 +70,7 @@ XmlReader::XmlReader(char const *sStr, size_t nLength)
XmlReader::XmlReader(OUString const & fileUrl) XmlReader::XmlReader(OUString const & fileUrl)
: fileUrl_(fileUrl) : fileUrl_(fileUrl)
, fileHandle_(0) , fileHandle_(nullptr)
{ {
oslFileError e = osl_openFile( oslFileError e = osl_openFile(
fileUrl_.pData, &fileHandle_, osl_File_OpenFlag_Read); fileUrl_.pData, &fileHandle_, osl_File_OpenFlag_Read);
...@@ -164,7 +164,7 @@ XmlReader::Result XmlReader::nextItem(Text reportText, Span * data, int * nsId) ...@@ -164,7 +164,7 @@ XmlReader::Result XmlReader::nextItem(Text reportText, Span * data, int * nsId)
} }
bool XmlReader::nextAttribute(int * nsId, Span * localName) { bool XmlReader::nextAttribute(int * nsId, Span * localName) {
assert(nsId != 0 && localName != 0); assert(nsId != nullptr && localName != nullptr);
if (firstAttribute_) { if (firstAttribute_) {
currentAttribute_ = attributes_.begin(); currentAttribute_ = attributes_.begin();
firstAttribute_ = false; firstAttribute_ = false;
...@@ -174,7 +174,7 @@ bool XmlReader::nextAttribute(int * nsId, Span * localName) { ...@@ -174,7 +174,7 @@ bool XmlReader::nextAttribute(int * nsId, Span * localName) {
if (currentAttribute_ == attributes_.end()) { if (currentAttribute_ == attributes_.end()) {
return false; return false;
} }
if (currentAttribute_->nameColon == 0) { if (currentAttribute_->nameColon == nullptr) {
*nsId = NAMESPACE_NONE; *nsId = NAMESPACE_NONE;
*localName = Span( *localName = Span(
currentAttribute_->nameBegin, currentAttribute_->nameBegin,
...@@ -361,7 +361,7 @@ Span XmlReader::scanCdataSection() { ...@@ -361,7 +361,7 @@ Span XmlReader::scanCdataSection() {
} }
bool XmlReader::scanName(char const ** nameColon) { bool XmlReader::scanName(char const ** nameColon) {
assert(nameColon != 0 && *nameColon == 0); assert(nameColon != nullptr && *nameColon == nullptr);
for (char const * begin = pos_;; ++pos_) { for (char const * begin = pos_;; ++pos_) {
switch (peek()) { switch (peek()) {
case '\0': // i.e., EOF case '\0': // i.e., EOF
...@@ -383,7 +383,7 @@ bool XmlReader::scanName(char const ** nameColon) { ...@@ -383,7 +383,7 @@ bool XmlReader::scanName(char const ** nameColon) {
} }
int XmlReader::scanNamespaceIri(char const * begin, char const * end) { 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)); Span iri(handleAttributeValue(begin, end, false));
for (NamespaceIris::size_type i = 0; i < namespaceIris_.size(); ++i) { for (NamespaceIris::size_type i = 0; i < namespaceIris_.size(); ++i) {
if (namespaceIris_[i].equals(iri)) { if (namespaceIris_[i].equals(iri)) {
...@@ -395,7 +395,7 @@ int XmlReader::scanNamespaceIri(char const * begin, char const * end) { ...@@ -395,7 +395,7 @@ int XmlReader::scanNamespaceIri(char const * begin, char const * end) {
char const * XmlReader::handleReference(char const * position, 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; ++position;
if (*position == '#') { if (*position == '#') {
++position; ++position;
...@@ -603,9 +603,9 @@ Span XmlReader::handleAttributeValue( ...@@ -603,9 +603,9 @@ Span XmlReader::handleAttributeValue(
} }
XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) { XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
assert(nsId != 0 && localName); assert(nsId != nullptr && localName);
char const * nameBegin = pos_; char const * nameBegin = pos_;
char const * nameColon = 0; char const * nameColon = nullptr;
if (!scanName(&nameColon)) { if (!scanName(&nameColon)) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"bad tag name in " + fileUrl_ ); "bad tag name in " + fileUrl_ );
...@@ -626,7 +626,7 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) { ...@@ -626,7 +626,7 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
"missing whitespace before attribute in " + fileUrl_ ); "missing whitespace before attribute in " + fileUrl_ );
} }
char const * attrNameBegin = pos_; char const * attrNameBegin = pos_;
char const * attrNameColon = 0; char const * attrNameColon = nullptr;
if (!scanName(&attrNameColon)) { if (!scanName(&attrNameColon)) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"bad attribute name in " + fileUrl_ ); "bad attribute name in " + fileUrl_ );
...@@ -651,12 +651,12 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) { ...@@ -651,12 +651,12 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
} }
char const * valueEnd = pos_ + i; char const * valueEnd = pos_ + i;
pos_ += i + 1; pos_ += i + 1;
if (attrNameColon == 0 && if (attrNameColon == nullptr &&
Span(attrNameBegin, attrNameEnd - attrNameBegin).equals("xmlns")) Span(attrNameBegin, attrNameEnd - attrNameBegin).equals("xmlns"))
{ {
hasDefaultNs = true; hasDefaultNs = true;
defaultNsId = scanNamespaceIri(valueBegin, valueEnd); defaultNsId = scanNamespaceIri(valueBegin, valueEnd);
} else if (attrNameColon != 0 && } else if (attrNameColon != nullptr &&
Span(attrNameBegin, attrNameColon - attrNameBegin).equals( Span(attrNameBegin, attrNameColon - attrNameBegin).equals(
"xmlns")) "xmlns"))
{ {
...@@ -690,7 +690,7 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) { ...@@ -690,7 +690,7 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
ElementData( ElementData(
Span(nameBegin, nameEnd - nameBegin), inheritedNamespaces, Span(nameBegin, nameEnd - nameBegin), inheritedNamespaces,
defaultNsId)); defaultNsId));
if (nameColon == 0) { if (nameColon == nullptr) {
*nsId = defaultNsId; *nsId = defaultNsId;
*localName = Span(nameBegin, nameEnd - nameBegin); *localName = Span(nameBegin, nameEnd - nameBegin);
} else { } else {
...@@ -706,7 +706,7 @@ XmlReader::Result XmlReader::handleEndTag() { ...@@ -706,7 +706,7 @@ XmlReader::Result XmlReader::handleEndTag() {
"spurious end tag in " + fileUrl_ ); "spurious end tag in " + fileUrl_ );
} }
char const * nameBegin = pos_; char const * nameBegin = pos_;
char const * nameColon = 0; char const * nameColon = nullptr;
if (!scanName(&nameColon) || if (!scanName(&nameColon) ||
!elements_.top().name.equals(nameBegin, pos_ - nameBegin)) !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