diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-05-30 18:31:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-05-30 18:31:43 +0200 |
commit | 00a45faf5ef929572c6f0df686716aec991503be (patch) | |
tree | 131d922f5dca6792eb850454b012034075394905 | |
parent | d8545e78e7d27bb704cef9befa3cc0ff65c68bb3 (diff) |
Fix int2enum
* The data argument to the Any ctor call needs to point at sal_Int32, not int.
* All calls to int2enum guarantee that rType is an enum type, so assert that.
Change-Id: I0ccd498420638fee80aeeccc93d9c1e3309f83b0
-rw-r--r-- | include/comphelper/extract.hxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/comphelper/extract.hxx b/include/comphelper/extract.hxx index 4584954b2864..2b5ae0a88dfc 100644 --- a/include/comphelper/extract.hxx +++ b/include/comphelper/extract.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_COMPHELPER_EXTRACT_HXX #define INCLUDED_COMPHELPER_EXTRACT_HXX +#include <sal/config.h> + +#include <cassert> + #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/uno/TypeClass.hpp> #include <com/sun/star/uno/Type.hxx> @@ -38,12 +42,8 @@ namespace cppu inline css::uno::Any SAL_CALL int2enum( sal_Int32 nEnum, const css::uno::Type & rType ) { - if (rType.getTypeClass() == css::uno::TypeClass_ENUM) - { - int nVal = nEnum; - return css::uno::Any( &nVal, rType ); - } - return css::uno::Any(); + assert(rType.getTypeClass() == css::uno::TypeClass_ENUM); + return css::uno::Any( &nEnum, rType ); } /** |