[Libreoffice-commits] core.git: include/rtl
Stephan Bergmann
sbergman at redhat.com
Mon Oct 31 12:28:50 UTC 2016
include/rtl/ustring.hxx | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 2e3f5c8dd3b21efe83269f603e26ac20f3adde64
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Oct 31 13:23:34 2016 +0100
Prevent nonsensical comparations between OUString and nullptr_t
...now that
1b98f38 css.xml.sax.XAttributeList is broken by design
074defe Strange OUString null check
a24105a Nonsensical OUString null check
9799fe3 Nonsensical OUString null check
d6b9fea Nonsensical OUString null check
f2de7d0 This apparently always wanted to check that _rChars.trim() is non-empty
a8cfc97 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,
f20162304d73bc01955e9ef6506c3bd1c7016c48 "Rule out OString(std::nullptr_t)".)
Change-Id: I4ca0e1f5a911448e7bc9b8c5dddff5993d61ef18
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 5c09765..5880a98 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -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 )
More information about the Libreoffice-commits
mailing list