Kaydet (Commit) 2e3f5c8d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Prevent nonsensical comparations between OUString and nullptr_t

...now that

1b98f38c css.xml.sax.XAttributeList is broken by design
074defe2 Strange OUString null check
a24105a8 Nonsensical OUString null check
9799fe3d Nonsensical OUString null check
d6b9fea9 Nonsensical OUString null check
f2de7d05 This apparently always wanted to check that _rChars.trim() is non-empty
a8cfc979 SvxBrushItem::GetGraphicLink no longer returns a pointer

are fixed.  (OString didn't have this problem with overloaded operator ==/!=,
but had a similar issue with nullptr_t that OUString in turn didn't have,
f2016230 "Rule out OString(std::nullptr_t)".)

Change-Id: I4ca0e1f5a911448e7bc9b8c5dddff5993d61ef18
üst 1b98f38c
......@@ -1588,6 +1588,17 @@ public:
friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 )
{ return !(operator == ( pStr1, rStr2 )); }
#if defined LIBO_INTERNAL_ONLY
// Prevent the above overloads from being selected for nonsensical code like
//
// if (ouIdAttr == nullptr)
//
friend bool operator ==(OUString const &, std::nullptr_t) = delete;
friend bool operator ==(std::nullptr_t, OUString const &) = delete;
friend bool operator !=(OUString const &, std::nullptr_t) = delete;
friend bool operator !=(std::nullptr_t, OUString const &) = delete;
#endif
friend bool operator < ( const OUString& rStr1, const OUString& rStr2 )
{ return rStr1.compareTo( rStr2 ) < 0; }
friend bool operator > ( const OUString& rStr1, const OUString& rStr2 )
......
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