[Libreoffice-commits] core.git: include/comphelper
Stephan Bergmann
sbergman at redhat.com
Mon May 30 16:33:57 UTC 2016
include/comphelper/extract.hxx | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
New commits:
commit 00a45faf5ef929572c6f0df686716aec991503be
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon May 30 18:31:43 2016 +0200
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
diff --git a/include/comphelper/extract.hxx b/include/comphelper/extract.hxx
index 4584954..2b5ae0a 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 );
}
/**
More information about the Libreoffice-commits
mailing list