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

Caolán McNamara caolanm at redhat.com
Fri Feb 24 11:29:32 UTC 2017


 vcl/source/filter/wmf/winwmf.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit c7cf94f70f4673b1f6933dbd28cbd89ab459fc45
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 24 11:28:44 2017 +0000

    clarify this code a little bit
    
    no logic change intended
    
    Change-Id: I620822e71386bae05312474423c22b84d8608cbd

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index b8ac93d..810aa10 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -537,6 +537,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
             if( nLen )
             {
                 sal_Int32 nOriginalTextLen = nLen;
+                sal_Int32 nOriginalBlockLen = ( nOriginalTextLen + 1 ) &~ 1;
                 Rectangle aRect;
                 if( nOptions & ETO_CLIPPED )
                 {
@@ -544,11 +545,11 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
                     const Point aPt2( ReadPoint() );
                     aRect = Rectangle( aPt1, aPt2 );
                 }
-                std::unique_ptr<char[]> pChar(new char[ ( nOriginalTextLen + 1 ) &~ 1 ]);
-                pWMF->ReadBytes(pChar.get(), (nOriginalTextLen + 1) &~ 1);
-                OUString aText( pChar.get(), (sal_uInt16)nOriginalTextLen, pOut->GetCharSet() );// after this conversion the text may contain
-                sal_Int32 nNewTextLen = aText.getLength();                                      // less character (japanese version), so the
-                                                                                                // dxAry will not fit
+                std::unique_ptr<char[]> pChar(new char[nOriginalBlockLen]);
+                pWMF->ReadBytes(pChar.get(), nOriginalBlockLen);
+                OUString aText(pChar.get(), nOriginalTextLen, pOut->GetCharSet()); // after this conversion the text may contain
+                sal_Int32 nNewTextLen = aText.getLength();                         // less character (japanese version), so the
+                                                                                   // dxAry will not fit
                 if ( nNewTextLen )
                 {
                     std::unique_ptr<long[]> pDXAry, pDYAry;


More information about the Libreoffice-commits mailing list