Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4091

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/91/4091/1

Fix crash with fdo60063-1.docx

Change-Id: I11d036c2d54cde2d3c311a77c115011246f38d0a
---
M oox/source/docprop/docprophandler.cxx
1 file changed, 11 insertions(+), 27 deletions(-)



diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index d81199f..60e425f 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -25,6 +25,8 @@
 
 #include <osl/time.h>
 
+#include <boost/algorithm/string.hpp>
+
 #include "oox/helper/attributelist.hxx"
 
 using namespace ::com::sun::star;
@@ -158,37 +160,19 @@
 {
     if ( !aChars.isEmpty() )
     {
-        uno::Sequence< OUString > aResult( 20 );
-        sal_Int32 nCounter = 0;
+        std::string aUtf8Chars = OUStringToOString(aChars, RTL_TEXTENCODING_UTF8).getStr();
+        std::vector<std::string> aUtf8Result;
+        boost::split(aUtf8Result, aUtf8Chars, boost::is_any_of(" ,;:\t"));
 
-        const sal_Unicode* pStr = aChars.getStr();
-        for( sal_Int32 nInd = 0; nInd < aChars.getLength() && pStr[nInd] != 0; nInd++ )
+        if (!aUtf8Result.empty())
         {
-            switch( pStr[nInd] )
-            {
-            case (sal_Unicode)' ':
-            case (sal_Unicode)',':
-            case (sal_Unicode)';':
-            case (sal_Unicode)':':
-            case (sal_Unicode)'\t':
-                // this is a delimiter
-                // unfortunately I did not find any specification for the possible delimiters
-                if ( !aResult[nCounter].isEmpty() )
-                {
-                    if ( nCounter >= aResult.getLength() )
-                        aResult.realloc( nCounter + 10 );
-                    nCounter++;
-                }
-                break;
+            uno::Sequence< OUString > aResult(aUtf8Result.size());
+            OUString* pResultValues = aResult.getArray();
+            for (std::vector<std::string>::const_iterator i = aUtf8Result.begin(); i != 
aUtf8Result.end(); ++i, ++pResultValues)
+                *pResultValues = OUString(i->c_str(), 
static_cast<sal_Int32>(i->size()),RTL_TEXTENCODING_UTF8);
 
-            default:
-                // this should be a part of keyword
-                aResult[nCounter] += OUString( (sal_Unicode)pStr[nInd] );
-            }
+            return aResult;
         }
-
-        aResult.realloc( nCounter + 1 );
-        return aResult;
     }
 
     return uno::Sequence< OUString >();

-- 
To view, visit https://gerrit.libreoffice.org/4091
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11d036c2d54cde2d3c311a77c115011246f38d0a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Fridrich Strba <fridrich@documentfoundation.org>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.