[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 3 commits - oox/source package/source

Fridrich Å trba fridrich.strba at bluewin.ch
Thu May 30 03:46:24 PDT 2013


 oox/source/docprop/docprophandler.cxx |   41 ++++++++++------------------------
 package/source/zipapi/ZipFile.cxx     |    1 
 2 files changed, 13 insertions(+), 29 deletions(-)

New commits:
commit d360333f83e3115219c3928525060c6c2a8711db
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu May 30 12:30:08 2013 +0200

    Accept even more corrupted zip documents as long as we can read them
    
    Change-Id: I8d039664d6c33d978b9addc3f35cbeae86d6c710
    (cherry picked from commit 1b049bd2dae52dc154ea6bee075a254a9b6cc318)

diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 9a894f4..f9da68b 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -691,7 +691,6 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
         // with timestamp difference in the central directory entry and local
         // file header.
         bBroken = rEntry.nVersion != nVersion
-                        || (rEntry.nFlag & ~6L) != (nFlag & ~6L)
                         || rEntry.nPathLen != nPathLen
                         || !rEntry.sPath.equals( sLOCPath );
     }
commit 8951752ba204da513460d520c47c96dc8be9cbf1
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu May 30 12:41:53 2013 +0200

    Fix tinderbox failures due to missing include
    
    Change-Id: Ied4c829bbe3038e483524669a85a0a7eaa055eb9
    (cherry picked from commit 319ac1fded32875416c668b51e6566ecacd1c0e1)

diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 90da8a4..08cfda0 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -25,6 +25,7 @@
 
 #include <osl/time.h>
 
+#include <vector>
 #include <boost/algorithm/string.hpp>
 
 #include "oox/helper/attributelist.hxx"
commit 693707e338922d8dc7578975a1990e8a1cba6a53
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu May 30 11:46:35 2013 +0200

    Fix crash with fdo60063-1.docx
    
    Compared to the original version, this one tries hard
    not to produce empty keywords.
    
    Change-Id: I11d036c2d54cde2d3c311a77c115011246f38d0a
    Reviewed-on: https://gerrit.libreoffice.org/4091
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
    (cherry picked from commit b2f97d77237cde249b4c40acc8ad3f7f8755e768)

diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index d81199f..90da8a4 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,39 +160,21 @@ uno::Sequence< OUString > OOXMLDocPropHandler::GetKeywordsSet( const OUString& a
 {
     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"), boost::token_compress_on );
 
-        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 >();
 }
 // ------------------------------------------------


More information about the Libreoffice-commits mailing list