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

Caolán McNamara caolanm at redhat.com
Tue Jan 14 05:10:10 PST 2014


 sfx2/source/control/thumbnailviewitem.cxx |    2 +-
 sw/source/core/edit/edglss.cxx            |   14 ++++++--------
 vcl/source/edit/texteng.cxx               |    4 ++--
 3 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 8638560a8b24116bdb26a43fd183ec758410543f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 13:06:12 2014 +0000

    longparas: don't truncate lone glossary entries
    
    Change-Id: Ib74830671694f2c78adc7a11296971a7edd2f781

diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 81e6452..5bb7440 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -313,25 +313,23 @@ sal_Bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk )
             SwAsciiOptions aAsciiOpt( xWrt->GetAsciiOptions() );
             aAsciiOpt.SetCharSet( RTL_TEXTENCODING_UCS2 );
             xWrt->SetAsciiOptions( aAsciiOpt );
-            xWrt->bUCS2_WithStartChar = sal_False;
+            xWrt->bUCS2_WithStartChar = false;
 
-            long lLen;
-            if( !IsError( aWriter.Write( xWrt ) ) &&
-                STRING_MAXLEN > (( lLen  = aStream.GetSize() )
-                                        / sizeof( sal_Unicode )) + 1 )
+            if (!IsError(aWriter.Write(xWrt)))
             {
                 aStream.WriteUInt16( (sal_Unicode)'\0' );
 
                 const sal_Unicode *p = (sal_Unicode*)aStream.GetBuffer();
-                if( p )
+                if (p)
                     rBuf = OUString(p);
                 else
                 {
-                    rtl_uString *pStr = rtl_uString_alloc(lLen / sizeof( sal_Unicode ));
+                    sal_Size nLen = aStream.GetSize();
+                    rtl_uString *pStr = rtl_uString_alloc(nLen / sizeof( sal_Unicode ));
                     aStream.Seek( 0 );
                     aStream.ResetError();
                     //endian specific?, yipes!
-                    aStream.Read(pStr->buffer, lLen);
+                    aStream.Read(pStr->buffer, nLen);
                     rBuf = OUString(pStr, SAL_NO_ACQUIRE);
                 }
             }
commit d610e8618e04075d99bbbf78fc741637914f1c7e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 14 12:51:07 2014 +0000

    longparas: none of the callers check for the error case
    
    so we can safely change the return of 0xFFFF to 0 without
    changing any callers. Which makes this safe seeing as before
    now every caller would have done something stupid with the
    results
    
    Change-Id: I10d9f12525de10661ed82f3405e6c728d38be106

diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 9f60f37..5ca236e 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -323,7 +323,7 @@ void ThumbnailViewItem::addTextPrimitives (const OUString& rText, const Thumbnai
 
     // Create the text primitives
     sal_uInt16 nLineStart = 0;
-    for (sal_uInt16 i=0; i<aTextEngine.GetLineCount(0); ++i)
+    for (sal_uInt16 i=0; i < aTextEngine.GetLineCount(0); ++i)
     {
         sal_uInt16 nLineLength = aTextEngine.GetLineLen(0, i);
         double nLineWidth = aTextDev.getTextWidth (aText, nLineStart, nLineLength);
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index c2eac53..68a4200 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1260,7 +1260,7 @@ sal_uInt16 TextEngine::GetLineCount( sal_uLong nParagraph ) const
     if ( pPPortion )
         return pPPortion->GetLines().size();
 
-    return 0xFFFF;
+    return 0;
 }
 
 sal_uInt16 TextEngine::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const
@@ -1274,7 +1274,7 @@ sal_uInt16 TextEngine::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) cons
         return pLine->GetLen();
     }
 
-    return 0xFFFF;
+    return 0;
 }
 
 sal_uLong TextEngine::CalcParaHeight( sal_uLong nParagraph ) const


More information about the Libreoffice-commits mailing list