[Libreoffice-commits] core.git: sd/source

Stephan Bergmann sbergman at redhat.com
Fri Jun 10 16:33:45 UTC 2016


 sd/source/filter/eppt/eppt.hxx   |    2 +-
 sd/source/filter/eppt/epptso.cxx |   10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 6bca1cd1e47039878684105db537a120a39c3675
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jun 10 18:30:49 2016 +0200

    css.presentation.PresentationOrder is of UNO type LONG
    
    ...i.e., sal_Int32, so cannot be read by casting the Any's value to sal_uInt16.
    When writing out to PPT format, silently clamp the sal_Int32 to the sal_uInt16
    range.
    
    Change-Id: If428f54f19c347a59719bc457c28a68053b7a9ef

diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
index ed901c0..4f6958c 100644
--- a/sd/source/filter/eppt/eppt.hxx
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -238,7 +238,7 @@ class PPTWriter : public PPTWriterBase, public PPTExBulletProvider
         void                ImplWriteObjectEffect( SvStream& rSt,
                                 css::presentation::AnimationEffect eEffect,
                                 css::presentation::AnimationEffect eTextEffect,
-                                sal_uInt16 nOrder );
+                                sal_Int32 nOrder );
         void                ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAction eAction, bool bMediaClickAction );
         void                ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj );
         void                ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj );
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 529be00..b397775 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -21,6 +21,8 @@
 
 #include <cstdlib>
 
+#include <basegfx/numeric/ftools.hxx>
+#include <o3tl/any.hxx>
 #include <osl/endian.h>
 #include <eppt.hxx>
 #include "text.hxx"
@@ -1380,7 +1382,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
 void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
     css::presentation::AnimationEffect eAe,
     css::presentation::AnimationEffect eTe,
-    sal_uInt16 nOrder )
+    sal_Int32 nOrder )
 {
     EscherExContainer aAnimationInfo( rSt, EPP_AnimationInfo );
     EscherExAtom aAnimationInfoAtom( rSt, EPP_AnimationInfoAtom, 0, 1 );
@@ -1888,7 +1890,7 @@ void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
         nDimColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(mAny.getValue()) ) | 0xfe000000;
 
     rSt.WriteUInt32( nDimColor ).WriteUInt32( nFlags ).WriteUInt32( nSoundRef ).WriteUInt32( nDelayTime )
-       .WriteUInt16( nOrder )                                   // order of build ( 1.. )
+       .WriteUInt16( basegfx::clamp<sal_Int32>(nOrder, 0, SAL_MAX_UINT16) ) // order of build ( 1.. )
        .WriteUInt16( nSlideCount ).WriteUChar( nBuildType ).WriteUChar( nFlyMethod ).WriteUChar( nFlyDirection )
        .WriteUChar( nAfterEffect ).WriteUChar( nSubEffect ).WriteUChar( nOleVerb )
        .WriteUInt16( 0 );                               // PadWord
@@ -2155,7 +2157,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
     // sal_uInt32  nGroupLevel = 0;
 
     sal_uInt32  nInstance, nGroups, nShapes, nShapeCount, nPer, nLastPer, nIndices, nOlePictureId;
-    sal_uInt16  nEffectCount;
+    sal_Int32  nEffectCount;
     css::awt::Point   aTextRefPoint;
 
     ResetGroupTable( nShapes = mXShapes->getCount() );
@@ -2205,7 +2207,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
             css::presentation::AnimationEffect eTe;
 
             if ( ImplGetPropertyValue( "PresentationOrder" ) )
-                nEffectCount = *static_cast<sal_uInt16 const *>(mAny.getValue());
+                nEffectCount = *o3tl::doAccess<sal_Int32>(mAny);
 
             bool bEffect = ImplGetEffect( mXPropSet, eAe, eTe, bIsSound );
             css::presentation::ClickAction eCa = css::presentation::ClickAction_NONE;


More information about the Libreoffice-commits mailing list