summaryrefslogtreecommitdiffstats
path: root/include/com
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-05-03 15:26:01 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-05-03 15:26:01 +0200
commit0b1e4a306705d8c25db6e233244101ba6c4c16b6 (patch)
treee3ce34a2d884bb5469aa0e15e8d66b6aa08a876e /include/com
parentPrevent Any ctor from reinterpreting bool* as sal_Bool* (diff)
downloadcore-0b1e4a306705d8c25db6e233244101ba6c4c16b6.tar.gz
core-0b1e4a306705d8c25db6e233244101ba6c4c16b6.zip
Prevent Any::setValue from reinterpreting bool* as sal_Bool*
...which only happens ot work in environments where sizeof (bool) == 1. The simpler alternative is to use the operator <<= template without passing explicit UNO type information, anyway. The std::nullptr_t overloads are needed to disambiguate calls with a nullptr argument. (Which can at least be meaningful for VOID, but for other types what it happens to do is store a default value of the given type.) As std::nullptr_t is only C++11, this all needs to be LIBO_INTERNAL_ONLY. Change-Id: Iff06a6ba94250bd4ae4afc937c2a2bfa75f0888f
Diffstat (limited to 'include/com')
-rw-r--r--include/com/sun/star/uno/Any.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h
index c46a59e2f0cc..90107d5cbb4b 100644
--- a/include/com/sun/star/uno/Any.h
+++ b/include/com/sun/star/uno/Any.h
@@ -213,6 +213,18 @@ public:
*/
inline void SAL_CALL setValue( const void * pData_, typelib_TypeDescription * pTypeDescr );
+#if defined LIBO_INTERNAL_ONLY
+ void setValue(bool const *, Type const &) = delete;
+ void setValue(bool const *, typelib_TypeDescriptionReference *) = delete;
+ void setValue(bool const *, typelib_TypeDescription *) = delete;
+ void setValue(std::nullptr_t, Type const & type)
+ { setValue(static_cast<void *>(nullptr), type); }
+ void setValue(std::nullptr_t, typelib_TypeDescriptionReference * type)
+ { setValue(static_cast<void *>(nullptr), type); }
+ void setValue(std::nullptr_t, typelib_TypeDescription * type)
+ { setValue(static_cast<void *>(nullptr), type); }
+#endif
+
/** Clears this any. If the any already contains a value, that value will be destructed
and its memory freed. After this has been called, the any does not contain a value.
*/