You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-remove-GetSwapFloat-no...

156 lines
5.1 KiB

From a3cb93b3917608f5b329321caea8d699b80b1ddf Mon Sep 17 00:00:00 2001
From: Michael Stahl <mstahl@redhat.com>
Date: Fri, 27 Oct 2017 11:51:28 +0200
Subject: [PATCH] remove GetSwapFloat nonsense from all 3 EMF readers
SvStream::ReadFloat already does that, and SvStream is initialised
to SvStreamEndian::LITTLE by default.
Change-Id: I5859e43014533bcebef9d4b8f0678c516193b92e
---
cppcanvas/source/inc/implrenderer.hxx | 23 -----------------------
drawinglayer/source/tools/emfphelperdata.cxx | 23 -----------------------
emfio/source/reader/emfreader.cxx | 14 --------------
emfio/source/reader/mtftools.cxx | 9 ---------
4 files changed, 69 deletions(-)
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 15b610306304..e61f3407169a 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -133,20 +133,6 @@ namespace cppcanvas
eDy = eDx*f.eM12 + eDy*f.eM22 + f.eDy;
}
-#ifdef OSL_BIGENDIAN
-// little endian <-> big endian switch
-static float GetSwapFloat( SvStream& rSt )
-{
- float fTmp;
- sal_Int8* pPtr = (sal_Int8*)&fTmp;
- rSt.ReadSChar( pPtr[3] );
- rSt.ReadSChar( pPtr[2] );
- rSt.ReadSChar( pPtr[1] );
- rSt.ReadSChar( pPtr[0] );
- return fTmp;
-}
-#endif
-
friend SvStream& ReadXForm( SvStream& rIn, XForm& rXForm )
{
if ( sizeof( float ) != 4 )
@@ -156,17 +142,8 @@ static float GetSwapFloat( SvStream& rSt )
}
else
{
-#ifdef OSL_BIGENDIAN
- rXForm.eM11 = GetSwapFloat( rIn );
- rXForm.eM12 = GetSwapFloat( rIn );
- rXForm.eM21 = GetSwapFloat( rIn );
- rXForm.eM22 = GetSwapFloat( rIn );
- rXForm.eDx = GetSwapFloat( rIn );
- rXForm.eDy = GetSwapFloat( rIn );
-#else
rIn.ReadFloat( rXForm.eM11 ).ReadFloat( rXForm.eM12 ).ReadFloat( rXForm.eM21 ).ReadFloat( rXForm.eM22 )
.ReadFloat( rXForm.eDx ).ReadFloat( rXForm.eDy );
-#endif
}
return rIn;
}
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 75f1c3c8f3f3..79ce930a5358 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -43,20 +43,6 @@
namespace emfplushelper
{
-#ifdef OSL_BIGENDIAN
- // little endian <-> big endian switch
- static float GetSwapFloat(SvStream& rStream)
- {
- float fTmp;
- sal_Int8* pPtr = (sal_Int8*)&fTmp;
- rStream.ReadSChar(pPtr[3]);
- rStream.ReadSChar(pPtr[2]);
- rStream.ReadSChar(pPtr[1]);
- rStream.ReadSChar(pPtr[0]);
- return fTmp;
- }
-#endif
-
const char* emfTypeToName(sal_uInt16 type)
{
switch (type)
@@ -265,16 +251,7 @@ namespace emfplushelper
float eM22(0.0);
float eDx(0.0);
float eDy(0.0);
-#ifdef OSL_BIGENDIAN
- eM11 = GetSwapFloat(rIn);
- eM12 = GetSwapFloat(rIn);
- eM21 = GetSwapFloat(rIn);
- eM22 = GetSwapFloat(rIn);
- eDx = GetSwapFloat(rIn);
- eDy = GetSwapFloat(rIn);
-#else
rIn.ReadFloat(eM11).ReadFloat(eM12).ReadFloat(eM21).ReadFloat(eM22).ReadFloat(eDx).ReadFloat(eDy);
-#endif
rTarget = basegfx::B2DHomMatrix(
eM11, eM21, eDx,
eM12, eM22, eDy);
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 8ff413b79033..f865487e00d1 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -305,20 +305,6 @@ record_type_name(sal_uInt32 nRecType)
#endif
}
-#ifdef OSL_BIGENDIAN
-// little endian <-> big endian switch
-static float GetSwapFloat(SvStream& rStream)
-{
- float fTmp;
- sal_Int8* pPtr = (sal_Int8*)&fTmp;
- rStream.ReadSChar(pPtr[3]);
- rStream.ReadSChar(pPtr[2]);
- rStream.ReadSChar(pPtr[1]);
- rStream.ReadSChar(pPtr[0]);
- return fTmp;
-}
-#endif
-
struct BLENDFUNCTION
{
unsigned char aBlendOperation;
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index b6de61d1f6bc..038000e9a185 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -56,21 +56,12 @@ namespace emfio
}
else
{
-#ifdef OSL_BIGENDIAN
- rXForm.eM11 = GetSwapFloat(rInStream);
- rXForm.eM12 = GetSwapFloat(rInStream);
- rXForm.eM21 = GetSwapFloat(rInStream);
- rXForm.eM22 = GetSwapFloat(rInStream);
- rXForm.eDx = GetSwapFloat(rInStream);
- rXForm.eDy = GetSwapFloat(rInStream);
-#else
rInStream.ReadFloat(rXForm.eM11);
rInStream.ReadFloat(rXForm.eM12);
rInStream.ReadFloat(rXForm.eM21);
rInStream.ReadFloat(rXForm.eM22);
rInStream.ReadFloat(rXForm.eDx);
rInStream.ReadFloat(rXForm.eDy);
-#endif
}
return rInStream;
}
--
2.14.1