[Libreoffice-commits] .: 9 commits - starmath/source sw/CppunitTest_sw_test_filters.mk sw/prj sw/qa sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Jun 20 03:12:49 PDT 2011


 starmath/source/node.cxx            |    6 +--
 sw/CppunitTest_sw_test_filters.mk   |    4 ++
 sw/prj/build.lst                    |    2 -
 sw/qa/core/filters-test.cxx         |   21 ++++++++----
 sw/source/filter/ww8/ww8par.cxx     |    2 -
 sw/source/filter/ww8/ww8par2.cxx    |   16 ---------
 sw/source/filter/ww8/ww8par3.cxx    |   15 --------
 sw/source/filter/ww8/ww8par5.cxx    |   27 ++++++++-------
 sw/source/filter/ww8/ww8scan.cxx    |   61 ++++++++++++++++++++++++------------
 sw/source/filter/ww8/ww8scan.hxx    |    5 ++
 sw/source/filter/ww8/ww8toolbar.cxx |   19 +++++++----
 11 files changed, 101 insertions(+), 77 deletions(-)

New commits:
commit e6d4eb92c36d00ba2d2a5074fc6d517f00ff86dd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 20 10:46:31 2011 +0100

    add some more test prerequisites

diff --git a/sw/CppunitTest_sw_test_filters.mk b/sw/CppunitTest_sw_test_filters.mk
index 8ee54cf..3e30451 100644
--- a/sw/CppunitTest_sw_test_filters.mk
+++ b/sw/CppunitTest_sw_test_filters.mk
@@ -85,8 +85,11 @@ $(eval $(call gb_RdbTarget_RdbTarget,sw_filters_test))
 $(eval $(call gb_RdbTarget_add_components,sw_filters_test,\
     sw/util/sw \
     sw/util/msword \
+    forms/util/frm \
+    dbaccess/util/dba \
     sfx2/util/sfx \
     framework/util/fwk \
+    toolkit/util/tk \
     unoxml/source/service/unoxml \
     fileaccess/source/fileacc \
     comphelper/util/comphelp \
diff --git a/sw/prj/build.lst b/sw/prj/build.lst
index 39e49fd..fd8edc9 100644
--- a/sw/prj/build.lst
+++ b/sw/prj/build.lst
@@ -1,2 +1,2 @@
-sw      sw      :    filter TRANSLATIONS:translations connectivity writerperfect vbahelper svx stoc writerfilter unoxml fileaccess package comphelper LIBXSLT:libxslt NULL
+sw      sw      :    filter TRANSLATIONS:translations connectivity writerperfect vbahelper svx stoc writerfilter unoxml fileaccess package forms toolkit dbaccess comphelper LIBXSLT:libxslt NULL
 sw sw\prj nmake - all sw_prj   NULL
commit e5470ded69b55ded23fcc8d6842c98a53e8d21bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 20 10:45:39 2011 +0100

    survive missing storage

diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index e237c51..ac5f53b 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -773,21 +773,24 @@ sal_uInt16 SwWW8ImplReader::End_Field()
 
                             // Store it now!
                             uno::Reference< embed::XStorage > xDocStg = GetDoc().GetDocStorage();
-                            uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
-                                    rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::WRITE );
-                            SotStorageRef xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId );
-
-                            if ( xObjDst.Is() )
+                            if (xDocStg.is())
                             {
-                                xSrc1->CopyTo( xObjDst );
+                                uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
+                                        rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::WRITE );
+                                SotStorageRef xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId );
 
-                                if ( !xObjDst->GetError() )
-                                    xObjDst->Commit();
-                            }
+                                if ( xObjDst.Is() )
+                                {
+                                    xSrc1->CopyTo( xObjDst );
 
-                            uno::Reference< embed::XTransactedObject > xTransact( xOleStg, uno::UNO_QUERY );
-                            if ( xTransact.is() )
-                                xTransact->commit();
+                                    if ( !xObjDst->GetError() )
+                                        xObjDst->Commit();
+                                }
+
+                                uno::Reference< embed::XTransactedObject > xTransact( xOleStg, uno::UNO_QUERY );
+                                if ( xTransact.is() )
+                                    xTransact->commit();
+                            }
 
                             // Store the OLE Id as a parameter
                             pFieldmark->GetParameters()->insert(
commit 719ef58a4602205de41cc6e6f1b7fc1de2c74423
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 20 00:11:10 2011 +0100

    survive missing uiconfig

diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 66c6fea..49f06a5 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -237,13 +237,20 @@ bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
 {
     for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
     {
-        uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-        uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
-        CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
-        helper.setMSOCommandMap( new MSOWordCommandConvertor() );
+        try
+        {
+            uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+            uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
+            CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
+            helper.setMSOCommandMap( new MSOWordCommandConvertor() );
 
-        if ( !(*it).ImportCustomToolBar( *this, helper ) )
-            return false;
+            if ( !(*it).ImportCustomToolBar( *this, helper ) )
+                return false;
+        }
+        catch(...)
+        {
+            continue;
+        }
     }
     return false;
 }
commit 79593ab2d55304678e719eae27aa8f65c195f613
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 20 00:10:26 2011 +0100

    ByteString -> rtl::OStringBuffer

diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 15cc458..f4709a2 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -564,7 +564,7 @@ void SmNode::DumpAsDot(std::ostream &out, String* label, int number, int& id, in
             eq.SearchAndReplaceAll(String::CreateFromAscii("\\"), String::CreateFromAscii("\\\\"));
             eq.SearchAndReplaceAll(String::CreateFromAscii("\""), String::CreateFromAscii("\\\""));
             out<<"label= \"Equation: \\\"";
-            out<<ByteString( eq, RTL_TEXTENCODING_UTF8).GetBuffer();
+            out<< rtl::OUStringToOString(eq, RTL_TEXTENCODING_UTF8).getStr();
             out<<"\\\"\";"<<std::endl;
         }
     }
@@ -605,13 +605,13 @@ void SmNode::DumpAsDot(std::ostream &out, String* label, int number, int& id, in
         case NPLACE:           out<<"SmPlaceNode"; break;
         case NTEXT:
             out<<"SmTextNode: ";
-            out<< ByteString( ((SmTextNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).GetBuffer();
+            out<< rtl::OUStringToOString(((SmTextNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).getStr();
             break;
         case NSPECIAL:             out<<"SmSpecialNode"; break;
         case NGLYPH_SPECIAL:   out<<"SmGlyphSpecialNode"; break;
         case NMATH:
             out<<"SmMathSymbolNode: ";
-            out<< ByteString( ((SmMathSymbolNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).GetBuffer();
+            out<< rtl::OUStringToOString(((SmMathSymbolNode*)this)->GetText(), RTL_TEXTENCODING_UTF8).getStr();
             break;
         case NBLANK:           out<<"SmBlankNode"; break;
         case NERROR:           out<<"SmErrorNode"; break;
commit b1e7c0e02e790e15beb19477767127e2a952fbd3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jun 19 23:36:23 2011 +0100

    add package as a test requirement

diff --git a/sw/CppunitTest_sw_test_filters.mk b/sw/CppunitTest_sw_test_filters.mk
index 6fe972f..8ee54cf 100644
--- a/sw/CppunitTest_sw_test_filters.mk
+++ b/sw/CppunitTest_sw_test_filters.mk
@@ -94,6 +94,7 @@ $(eval $(call gb_RdbTarget_add_components,sw_filters_test,\
 
 $(eval $(call gb_RdbTarget_add_old_components,sw_filters_test,\
     i18npool \
+    package2 \
     ucb1 \
     ucpfile1 \
 ))
commit 92ececaf7b5cea7cc7db2906a835a900efdf19a2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jun 19 22:22:01 2011 +0100

    ignore dot files, and print info about indeterminate loads

diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 6a2d611..68ad334 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -132,17 +132,27 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin
             recursiveScan(rFilter, sURL, rUserData, nExpected);
         else
         {
-            sal_Int32 nGitIndex = sURL.lastIndexOfAsciiL(
-                RTL_CONSTASCII_STRINGPARAM(".gitignore"));
+            sal_Int32 nLastSlash = sURL.lastIndexOf('/');
 
-            if (nGitIndex == sURL.getLength() - RTL_CONSTASCII_LENGTH(".gitignore"))
+            //ignore .files
+            if (
+                 (nLastSlash != -1) && (nLastSlash+1 < sURL.getLength()) &&
+                 (sURL.getStr()[nLastSlash+1] == '.')
+               )
+            {
                 continue;
+            }
 
+            rtl::OString aRes(rtl::OUStringToOString(sURL,
+                osl_getThreadTextEncoding()));
+            if (nExpected == indeterminate)
+            {
+                fprintf(stderr, "loading %s\n", aRes.getStr());
+            }
             bool bRes = load(rFilter, sURL, rUserData);
-            rtl::OString aRes(rtl::OUStringToOString(sURL, osl_getThreadTextEncoding()));
             if (nExpected == indeterminate)
             {
-                printf("indeterminate pass/fail %s was %d\n", aRes.getStr(), bRes);
+                fprintf(stderr, "pass/fail was %d\n", bRes);
                 continue;
             }
             CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == nExpected);
@@ -184,7 +194,6 @@ void FiltersTest::testCVEs()
     recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Word 97")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/ww8/fail")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CWW8")), false);
 
     recursiveScan(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Word 97")), m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/writer/sw/qa/core/data/ww8/indeterminate")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CWW8")), indeterminate);
-
 #endif
 }
 
commit 8f7cefedc563313ee7bcc6641f505caee50fd100
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jun 19 22:09:17 2011 +0100

    Resolves: #i118018# fExtChar affects only < 8 (if at all)

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 70d4cc0..3a18004 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1372,9 +1372,14 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
     if( nFcPos == WW8_FC_MAX )
         return nFallBackCpEnd;
 
+    bool bIsUnicode;
+    if (pWw8Fib->nVersion >= 8)
+        bIsUnicode = false;
+    else
+        bIsUnicode = pWw8Fib->fExtChar ? true : false;
+
     if( pPieceIter )    // Complex File ?
     {
-        bool bIsUnicode = false;
         sal_uLong nOldPos = pPieceIter->GetIdx();
 
         for (pPieceIter->SetIdx(0);
@@ -1388,15 +1393,14 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
                 break;
             }
             sal_Int32 nFcStart  = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
-            if( 8 <= pWw8Fib->nVersion )
+            if (pWw8Fib->nVersion >= 8)
             {
                 nFcStart = WW8PLCFx_PCD::TransformPieceAddress( nFcStart,
                                                                 bIsUnicode );
             }
             else
             {
-                if (pWw8Fib->fExtChar)
-                    bIsUnicode=true;
+                bIsUnicode = pWw8Fib->fExtChar ? true : false;
             }
             sal_Int32 nLen = (nCpEnd - nCpStart) * (bIsUnicode ? 2 : 1);
 
@@ -1431,11 +1435,13 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
         */
         return nFallBackCpEnd;
     }
+
     // No complex file
-    if (!pWw8Fib->fExtChar)
+    if (!bIsUnicode)
         nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin);
     else
         nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin + 1) / 2;
+
     return nFallBackCpEnd;
 }
 
@@ -1451,8 +1457,14 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
     if( !pIsUnicode )
         pIsUnicode = &bIsUnicode;
 
+    if (pWw8Fib->nVersion >= 8)
+        *pIsUnicode = false;
+    else
+        *pIsUnicode = pWw8Fib->fExtChar ? true : false;
+
     if( pPieceIter )
-    {   // Complex File
+    {
+        // Complex File
         if( pNextPieceCp )
             *pNextPieceCp = WW8_CP_MAX;
 
@@ -1480,16 +1492,10 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
             *pNextPieceCp = nCpEnd;
 
         WW8_FC nRet = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
-        if (8 > pWw8Fib->nVersion)
-        {
-            if (pWw8Fib->fExtChar)
-                *pIsUnicode=true;
-            else
-                *pIsUnicode = false;
-        }
-        else
+        if (pWw8Fib->nVersion >= 8)
             nRet = WW8PLCFx_PCD::TransformPieceAddress( nRet, *pIsUnicode );
-
+        else
+            *pIsUnicode = pWw8Fib->fExtChar ? true : false;
 
         nRet += (nCpPos - nCpStart) * (*pIsUnicode ? 2 : 1);
 
@@ -1497,10 +1503,6 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
     }
 
     // No complex file
-    if (pWw8Fib->fExtChar)
-        *pIsUnicode = true;
-    else
-        *pIsUnicode = false;
     return pWw8Fib->fcMin + nCpPos * (*pIsUnicode ? 2 : 1);
 }
 
commit ed13d8706bdad927efc0b77b446c640bbd9471d2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jun 18 00:39:59 2011 +0100

    handle truncated stream

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d75f8cc..90b2871 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5341,7 +5341,7 @@ sal_uLong SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss)
         m_bRegardHindiDigits = aVal[ 12 ] > 0;
     }
 
-    sal_uInt16 nMagic;
+    sal_uInt16 nMagic(0);
     *pStrm >> nMagic;
 
     // beachte: 6 steht fuer "6 ODER 7",  7 steht fuer "NUR 7"
commit 1490cfac3661a253c16b0a3dc6e047f6630dac9c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 17 23:48:50 2011 +0100

    merge these sprm finders and do it right

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 9c14be0..67e7dfb 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3687,21 +3687,7 @@ const sal_uInt8* WW8RStyle::HasParaSprm( sal_uInt16 nId ) const
     if( !pParaSprms || !nSprmsLen )
         return 0;
 
-    const sal_uInt8* pSprms = pParaSprms;
-    sal_uInt16 i, x;
-
-    for( i=0; i < nSprmsLen; )
-    {
-        sal_uInt16 nAktId = maSprmParser.GetSprmId(pSprms);
-        // Sprm found ?
-        if( nAktId == nId )
-            return pSprms + maSprmParser.DistanceToData(nId);
-
-        x = maSprmParser.GetSprmSize(nAktId, pSprms);
-        i = i + x;
-        pSprms += x;
-    }
-    return 0;                               // Sprm not found
+    return maSprmParser.findSprmData(nId, pParaSprms, nSprmsLen);
 }
 
 void WW8RStyle::ImportSprms(sal_uInt8 *pSprms, short nLen, bool bPap)
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 6b54aaa..e05b1aa 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -470,20 +470,7 @@ SV_IMPL_PTRARR( WW8LFOInfos, WW8LFOInfo_Ptr );
 sal_uInt8* WW8ListManager::GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms,
     sal_uInt8 nLen)
 {
-    sal_uInt8* pSprms = &rSprms;
-    sal_uInt16 nRemLen=nLen;
-    while (nRemLen > (maSprmParser.getVersion()?1:0))
-    {
-        sal_uInt16 nAktId = maSprmParser.GetSprmId(pSprms);
-        if( nAktId == nId ) // Sprm found
-            return pSprms + maSprmParser.DistanceToData(nId);
-
-        // gib Zeiger auf Daten
-        sal_uInt16 nSize = maSprmParser.GetSprmSize(nAktId, pSprms);
-        pSprms += nSize;
-        nRemLen -= nSize;
-    }
-    return 0;                           // Sprm not found
+    return maSprmParser.findSprmData(nId, &rSprms, nLen);
 }
 
 class ListWithId : public std::unary_function<const WW8LSTInfo *, bool>
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index b7c43d5..70d4cc0 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -7278,6 +7278,27 @@ sal_uInt16 wwSprmParser::DistanceToData(sal_uInt16 nId) const
     return 1 + mnDelta + SprmDataOfs(nId);
 }
 
+sal_uInt8* wwSprmParser::findSprmData(sal_uInt16 nId, sal_uInt8* pSprms,
+    sal_uInt16 nLen) const
+{
+    while (nLen > (getVersion()?1:0))
+    {
+        sal_uInt16 nAktId = GetSprmId(pSprms);
+        if (nAktId == nId) // Sprm found
+            return pSprms + DistanceToData(nId);
+
+        // gib Zeiger auf Daten
+        sal_uInt16 nSize = GetSprmSize(nAktId, pSprms);
+        OSL_ENSURE(nSize <= nLen, "sprm longer than remaining bytes");
+        //Clip to available size if wrong
+        nSize = std::min(nSize, nLen);
+        pSprms += nSize;
+        nLen -= nSize;
+    }
+    // Sprm not found
+    return 0;
+}
+
 SEPr::SEPr() :
     bkc(2), fTitlePage(0), fAutoPgn(0), nfcPgn(0), fUnlocked(0), cnsPgn(0),
     fPgnRestart(0), fEndNote(1), lnc(0), grpfIhdt(0), nLnnMod(0), dxaLnn(0),
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 0bb532a..7d809d8 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -145,6 +145,11 @@ public:
     /// The minimum acceptable sprm len possible for this type of parser
     int MinSprmLen() const { return (IsSevenMinus(meVersion)) ? 2 : 3; }
 
+    /// Returns the offset to data of the first sprm of id nId, 0
+    //  if not found. nLen must be the <= length of pSprms
+    sal_uInt8* findSprmData(sal_uInt16 nId, sal_uInt8* pSprms, sal_uInt16 nLen)
+        const;
+
     inline int getVersion() const { return meVersion; } //cmc, I'm dubious about the usage of this, how can it be 0
 };
 


More information about the Libreoffice-commits mailing list