[Libreoffice-commits] core.git: 5 commits - jvmfwk/plugins sax/qa sw/source

Stephan Bergmann sbergman at redhat.com
Tue Feb 11 23:08:12 PST 2014


 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |    7 +++----
 sax/qa/cppunit/test_converter.cxx                   |    4 ++--
 sw/source/core/unocore/unostyle.cxx                 |   18 ++++--------------
 3 files changed, 9 insertions(+), 20 deletions(-)

New commits:
commit ba826a22c63b5045d93a91f13c2ba856bdf77a64
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 11 16:45:52 2014 +0100

    Simplify string handling
    
    Change-Id: I1b79bfd7e7e92fc8f4937e6b9ae9ec9468839ea6

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 481847e..a7ee90a 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -646,7 +646,6 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     options[n].optionString= (char *) "abort";
     options[n].extraInfo= (void* )(sal_IntPtr)abort_handler;
     ++n;
-    OString sClassPathProp("-Djava.class.path=");
     OString sClassPathOption;
     for (int i = 0; i < cOptions; i++)
     {
@@ -654,12 +653,12 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2)
     // in the class path in order to have applet support.
         OString sClassPath = arOptions[i].optionString;
-        if (sClassPath.match(sClassPathProp, 0))
+        if (sClassPath.startsWith("-Djava.class.path="))
         {
-            char sep[] =  {SAL_PATHSEPARATOR, 0};
             OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion);
             if (!sAddPath.isEmpty())
-                sClassPathOption = sClassPath + OString(sep) + sAddPath;
+                sClassPathOption = sClassPath + OString(SAL_PATHSEPARATOR)
+                    + sAddPath;
             else
                 sClassPathOption = sClassPath;
             options[n].optionString = (char *) sClassPathOption.getStr();
commit 972d71dafda82f227149cb2e4fc6eb3a84886d89
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 11 17:31:53 2014 +0100

    At least assert here
    
    ...or is that assumption incorrect and GetOldPageDesc should rather return a
    pointer that may be null?
    
    Change-Id: I256b9085d5143c3cf2f8d3146d109c3c99edffc2

diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index e46a2cc..cdec84e 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -75,6 +75,7 @@
 #include "ccoll.hxx"
 #include "unocore.hrc"
 
+#include <cassert>
 #include <set>
 
 #define STYLE_FAMILY_COUNT 5            // we have 5 style families
@@ -1638,6 +1639,7 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
             }
         }
     }
+    assert(pOldPageDesc != 0);
     return *pOldPageDesc;
 }
 
commit 151f3d665581d887cda1e36b817afb124c5c789e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 11 17:28:43 2014 +0100

    Do not reference a dangling OUString
    
    Change-Id: I0908d1300d0d1acb515345ccbdf6cdc2bf44d6a5

diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d92b6aa..e46a2cc 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1587,7 +1587,7 @@ struct SwStyleBase_Impl
     rtl::Reference< SwDocStyleSheet > mxNewBase;
     SfxItemSet*         pItemSet;
 
-    const OUString&     rStyleName;
+    OUString     rStyleName;
 
     SwStyleBase_Impl(SwDoc& rSwDoc, const OUString& rName) :
         rDoc(rSwDoc),
commit 7fb6ae28ae7bebd67c2b9bf2cf517f1f7bb2777e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 11 16:31:47 2014 +0100

    nPDescPos is never read
    
    ...since b48f4e99e1d2935f84bc2fac1e6670dd83939673 "#86296# use page descriptor
    only if necessary", and this nicely removes the odd
    
      for(i = 0; i < nPDescCount + 1; i++)
    
    loop that read past the end of the maPageDescs vector.
    
    Change-Id: I9b0f24231774eef7231eff4b053fd56c020c6e69

diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index b483d61..d92b6aa 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1588,14 +1588,12 @@ struct SwStyleBase_Impl
     SfxItemSet*         pItemSet;
 
     const OUString&     rStyleName;
-    sal_uInt16              nPDescPos;
 
     SwStyleBase_Impl(SwDoc& rSwDoc, const OUString& rName) :
         rDoc(rSwDoc),
         pOldPageDesc(0),
         pItemSet(0),
-        rStyleName(rName),
-        nPDescPos(0xffff)
+        rStyleName(rName)
         {}
 
     ~SwStyleBase_Impl(){ delete pItemSet; }
@@ -1624,7 +1622,6 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
             if(rDesc.GetName() == rStyleName)
             {
                 pOldPageDesc = & rDesc;
-                nPDescPos = i;
                 break;
             }
         }
@@ -1639,15 +1636,6 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
                     break;
                 }
             }
-            for(i = 0; i < nPDescCount + 1; i++)
-            {
-                const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
-                if(rDesc.GetName() == rStyleName)
-                {
-                    nPDescPos = i;
-                    break;
-                }
-            }
         }
     }
     return *pOldPageDesc;
commit fa2045807a5dce837bf9392528fcf88ceccd356f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 11 16:31:22 2014 +0100

    Improve output in case of test failure
    
    Change-Id: If094349998d41972f50e12363a5a223ee87fdcec

diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index cbc3ae0..4a0008b 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -116,7 +116,7 @@ static void doTestDurationF(char const*const pis)
     bool bSuccess = Converter::convertDuration(od,
             OUString::createFromAscii(pis));
     SAL_INFO("sax.cppunit","" << (od.Negative ? "-" : "+") << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.NanoSeconds << "n");
-    CPPUNIT_ASSERT(!bSuccess);
+    CPPUNIT_ASSERT_MESSAGE(pis, !bSuccess);
 }
 
 void ConverterTest::testDuration()
@@ -281,7 +281,7 @@ static void doTestTimeF(char const*const pis)
     bool bSuccess = Converter::parseTimeOrDateTime(odt, 0,
             OUString::createFromAscii(pis));
     SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << "  H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds);
-    CPPUNIT_ASSERT(!bSuccess);
+    CPPUNIT_ASSERT_MESSAGE(pis, !bSuccess);
 }
 
 void ConverterTest::testTime() // time or dateTime + horrible backcompat mess


More information about the Libreoffice-commits mailing list