[Libreoffice-commits] core.git: 2 commits - cppcanvas/source drawinglayer/source emfio/source
Michael Stahl
mstahl at redhat.com
Fri Oct 27 10:40:48 UTC 2017
cppcanvas/source/inc/implrenderer.hxx | 23 -----------------------
drawinglayer/source/tools/emfphelperdata.cxx | 23 -----------------------
emfio/source/reader/emfreader.cxx | 27 +--------------------------
emfio/source/reader/mtftools.cxx | 9 ---------
4 files changed, 1 insertion(+), 81 deletions(-)
New commits:
commit 404208f23c944a7d06e16bfb92b12fc58de775ad
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Oct 27 12:07:10 2017 +0200
emfio: don't reinvent read_uInt16s_ToOUString
Change-Id: Ib12923762b5dd4d255c89a5acc54fdc5678a58ed
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index f865487e00d1..a6f6d218fa98 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1587,18 +1587,7 @@ namespace emfio
{
if ( ( nLen * sizeof(sal_Unicode) ) <= ( mnEndPos - mpInputStream->Tell() ) )
{
- std::unique_ptr<sal_Unicode[]> pBuf(new sal_Unicode[ nLen ]);
- mpInputStream->ReadBytes(pBuf.get(), nLen << 1);
- #ifdef OSL_BIGENDIAN
- sal_Char nTmp, *pTmp = (sal_Char*)( pBuf.get() + nLen );
- while ( pTmp-- != (sal_Char*)pBuf.get() )
- {
- nTmp = *pTmp--;
- pTmp[ 1 ] = *pTmp;
- *pTmp = nTmp;
- }
- #endif
- aText = OUString(pBuf.get(), nLen);
+ aText = read_uInt16s_ToOUString(*mpInputStream, nLen);
}
}
commit a3cb93b3917608f5b329321caea8d699b80b1ddf
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Oct 27 11:51:28 2017 +0200
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
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;
}
More information about the Libreoffice-commits
mailing list