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

Caolán McNamara caolanm at redhat.com
Tue Apr 7 06:59:25 PDT 2015


 vcl/generic/glyphs/gcach_layout.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 75a3ade6f31c7a1b9b6e1d260eec7130845ed11f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 7 14:55:52 2015 +0100

    invalid index on load of ooo86460-1.xls
    
    because TextLayoutCache took an OUString arg, passing reinterpret_cast<const
    UChar *>(rArgs.mpStr) as an input created a temp string from mpStr, but ctor
    stops at first NULL of course unless length arg is passed and input string
    contains nulls. Just take a sal_Unicode* as input.
    
    Change-Id: I452cf6fa61155456fbeceeda105e2e15557a21b3

diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index e42008e..4f98620 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -364,10 +364,10 @@ namespace vcl {
     {
     public:
         std::vector<vcl::Run> runs;
-        TextLayoutCache(OUString const& rString, sal_Int32 const nEnd)
+        TextLayoutCache(sal_Unicode const* pStr, sal_Int32 const nEnd)
         {
             vcl::ScriptRun aScriptRun(
-                reinterpret_cast<const UChar *>(rString.getStr()),
+                reinterpret_cast<const UChar *>(pStr),
                 nEnd);
             while (aScriptRun.next())
             {
@@ -381,7 +381,7 @@ namespace vcl {
 std::shared_ptr<vcl::TextLayoutCache> ServerFontLayout::CreateTextLayoutCache(
         OUString const& rString) const
 {
-    return std::make_shared<vcl::TextLayoutCache>(rString, rString.getLength());
+    return std::make_shared<vcl::TextLayoutCache>(rString.getStr(), rString.getLength());
 }
 
 bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
@@ -413,8 +413,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
     }
     else
     {
-        pNewScriptRun.reset(new vcl::TextLayoutCache(
-            reinterpret_cast<const UChar *>(rArgs.mpStr), rArgs.mnEndCharPos));
+        pNewScriptRun.reset(new vcl::TextLayoutCache(rArgs.mpStr, rArgs.mnEndCharPos));
         pTextLayout = pNewScriptRun.get();
     }
 


More information about the Libreoffice-commits mailing list