[Libreoffice-commits] core.git: include/rtl

Stephan Bergmann sbergman at redhat.com
Mon Oct 31 15:29:39 UTC 2016


 include/rtl/ustring.hxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 40633e32f3925e2041a45b6a574d6b9bd4e844a7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 31 13:38:24 2016 +0100

    Revert "Revert "Prevent nonsensical comparations between OUString and nullptr_t""
    
    This reverts commit e559c0c9cbfd819f22ef695a9823bb71f4385b58; just turn the
    deleted overloads into non-friend functions (and rely on any other overloads to
    be still found via ADL).
    
    Change-Id: I2af834162cab2e71ed9e32ae6903bc9f86d77ba2
    Reviewed-on: https://gerrit.libreoffice.org/30441
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 5c09765..ff6b834 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -3226,6 +3226,18 @@ public:
     }
 };
 
+#if defined LIBO_INTERNAL_ONLY
+// Prevent the operator ==/!= overloads with 'sal_Unicode const *' paramter from
+// being selected for nonsensical code like
+//
+//   if (ouIdAttr == nullptr)
+//
+void operator ==(OUString const &, std::nullptr_t) = delete;
+void operator ==(std::nullptr_t, OUString const &) = delete;
+void operator !=(OUString const &, std::nullptr_t) = delete;
+void operator !=(std::nullptr_t, OUString const &) = delete;
+#endif
+
 #if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
 /// @cond INTERNAL
 


More information about the Libreoffice-commits mailing list