[Libreoffice-commits] core.git: 5 commits - basic/qa basic/source lotuswordpro/source sw/source unusedcode.easy writerfilter/source

Thomas Arnhold thomas at arnhold.org
Mon May 12 20:27:05 PDT 2014


 basic/qa/cppunit/test_vba.cxx                         |    1 
 basic/qa/vba_tests/cdec.vb                            |   72 ++++++++++++++++++
 basic/source/sbx/sbxdec.cxx                           |    8 +-
 lotuswordpro/source/filter/lwpfilter.cxx              |   34 --------
 lotuswordpro/source/filter/lwpfilter.hxx              |   37 ---------
 sw/source/filter/html/css1atr.cxx                     |   33 --------
 unusedcode.easy                                       |    1 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    2 
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |    1 
 9 files changed, 80 insertions(+), 109 deletions(-)

New commits:
commit c4e301acd08df41a7236d24e454417393b707207
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Tue May 13 05:23:49 2014 +0200

    basic: Add CDec unit test
    
    Change-Id: I9152f00239e5d407f9b33016caadb6a01770fed3

diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 846cebb..87c6512 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -39,6 +39,7 @@ void VBATest::testMiscVBAFunctions()
 {
     const char* macroSource[] = {
         "bytearraystring.vb",
+        "cdec.vb",
 // datevalue test seems to depend on both locale and language
 // settings, should try and rewrite the test to deal with that
 // for some reason tinderboxes don't seem to complain leaving enabled
diff --git a/basic/qa/vba_tests/cdec.vb b/basic/qa/vba_tests/cdec.vb
new file mode 100644
index 0000000..50757de
--- /dev/null
+++ b/basic/qa/vba_tests/cdec.vb
@@ -0,0 +1,72 @@
+Option VBASupport 1
+Option Explicit
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+result = verify_testCDec()
+If failCount <> 0 And passCount > 0 Then
+    doUnitTest = result
+Else
+    doUnitTest = "OK"
+End If
+End Function
+
+Function verify_testCDec() as String
+    passCount = 0
+    failCount = 0
+
+    result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+    Dim testName As String
+    Dim ret As Double
+    testName = "Test CDec function"
+    On Error GoTo errorHandler
+    
+    ret = CDec("")
+    TestLog_ASSERT ret = 0, "Converts the string to uppercase characters:" & ret
+
+    ret = CDec("1234")
+    TestLog_ASSERT ret = "1234", "Converts the string to uppercase characters:" & ret
+
+    ret = CDec("  1234  ")
+    TestLog_ASSERT ret = 1234, "Converts the string to uppercase characters:" & ret
+
+    '''''''''''''''
+    ' Those are erroneous, see i#64348
+    ret = CDec("1234-")
+    TestLog_ASSERT ret = -1234, "Converts the string to uppercase characters:" & ret
+
+    ret = CDec("  1234  -")
+    TestLog_ASSERT ret = -1234, "Converts the string to uppercase characters:" & ret
+
+    ret = CDec("79228162514264400000000000000")
+    TestLog_ASSERT ret = 62406456049664, "Converts the string to uppercase characters:" & ret
+
+    result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+    verify_testCDec = result
+
+    Exit Function
+errorHandler:
+        TestLog_ASSERT (False), testName & ": hit error handler"
+End Function
+
+Sub TestLog_ASSERT(assertion As Boolean, Optional testId As String, Optional testComment As String)
+
+    If assertion = True Then
+        passCount = passCount + 1
+    Else
+        Dim testMsg As String
+        If Not IsMissing(testId) Then
+            testMsg = testMsg + " : " + testId
+        End If
+        If Not IsMissing(testComment) And Not (testComment = "") Then
+            testMsg = testMsg + " (" + testComment + ")"
+        End If
+
+        result = result & Chr$(10) & " Failed: " & testMsg
+        failCount = failCount + 1
+    End If
+    
+End Sub
commit 375b01bf747bb206c3fd6bad0acbd38271a8fb86
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Tue May 13 05:22:47 2014 +0200

    i#64348 basic: fix CDec() crash if string is empty
    
    Change-Id: I92e9472e14c00a6550081f0d58a352faa5b78b98

diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 59f5e01..f0cab34 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -194,6 +194,8 @@ void SbxDecimal::setUInt( unsigned int val )
 
 bool SbxDecimal::setString( OUString* pOUString )
 {
+    assert(pOUString);
+
     static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
 
     // Convert delimiter
@@ -471,7 +473,11 @@ start:
         case SbxLPSTR:
         case SbxSTRING:
         case SbxBYREF | SbxSTRING:
-            pnDecRes->setString( p->pOUString ); break;
+            if( !p->pOUString )
+                pnDecRes->setString( new OUString );
+            else
+                pnDecRes->setString( p->pOUString );
+            break;
         case SbxOBJECT:
         {
             SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
commit 52136cd3a2737aa913bd59d1d5d88c841a984846
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Tue May 13 01:26:09 2014 +0200

    writerfilter: unused mnRefCount
    
    Change-Id: Ideab32a5cb6a2ccc4ee91ca60ede70cd325d2b93

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 0506136..1a436ce 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -125,7 +125,6 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
   mpStream(NULL),
   mnTableDepth(0),
   mnInstanceNumber(mnInstanceCount),
-  mnRefCount(0),
   inPositionV(false),
   m_xContext(context),
   m_bDiscardChildren(false),
@@ -150,7 +149,6 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
   mpStream(pContext->mpStream),
   mnTableDepth(pContext->mnTableDepth),
   mnInstanceNumber(mnInstanceCount),
-  mnRefCount(0),
   inPositionV(pContext->inPositionV),
   m_xContext(pContext->m_xContext),
   m_bDiscardChildren(pContext->m_bDiscardChildren),
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 799395f..e9d81cf 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -292,7 +292,6 @@ protected:
     uno::Reference< uno::XComponentContext > getComponentContext();
 
     sal_uInt32 mnInstanceNumber;
-    sal_uInt32 mnRefCount;
 
     bool inPositionV;
 
commit e834206767b33d5fadc8100ada95c1f383d8363c
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Tue May 13 00:57:03 2014 +0200

    unusedcode.easy: remove LWPFilterReader::LWPFilterReader()
    
    Change-Id: Iefbf36d2ce0f98c61a0d9f5d04b77a3505980e80

diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx
index 010ac9f..30ca558 100644
--- a/lotuswordpro/source/filter/lwpfilter.cxx
+++ b/lotuswordpro/source/filter/lwpfilter.cxx
@@ -59,12 +59,9 @@
  ************************************************************************/
 #include "lwpfilter.hxx"
 #include "lwpresource.hxx"
-//for sax stream
 #include "xfilter/xfsaxstream.hxx"
-//for file parser
 #include "lwp9reader.hxx"
 #include "lwpsvstream.hxx"
-//for container reset
 #include "xfilter/xffontfactory.hxx"
 #include "xfilter/xfstylemanager.hxx"
 
@@ -80,7 +77,6 @@
 
 #include <cppuhelper/supportsservice.hxx>
 
-#include <tools/stream.hxx>
 #include <sfx2/docfile.hxx>
 
 #include <boost/scoped_ptr.hpp>
@@ -97,36 +93,6 @@ using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star;
 using ::com::sun::star::uno::Sequence;
 
-LWPFilterReader::LWPFilterReader()
-{
-}
-
-LWPFilterReader::~LWPFilterReader()
-{
-}
-
-sal_Bool LWPFilterReader::filter( const Sequence< PropertyValue >& aDescriptor )
-    throw( RuntimeException, std::exception )
-{
-    OUString sURL;
-    for( sal_Int32 i = 0; i < aDescriptor.getLength(); i++ )
-    {
-        //Note we should attempt to use "InputStream" if it exists first!
-        if ( aDescriptor[i].Name == "URL" )
-            aDescriptor[i].Value >>= sURL;
-    }
-
-    SvFileStream inputStream( sURL, STREAM_READ );
-    if ( inputStream.IsEof() || ( inputStream.GetError() != SVSTREAM_OK ) )
-        return sal_False;
-
-    return (ReadWordproFile(inputStream, m_DocumentHandler) == 0);
-}
-
-void LWPFilterReader::cancel() throw (com::sun::star::uno::RuntimeException, std::exception)
-{
-}
-
  /**
  * @descr   decompressed small file
  * @param   pCompressed - real file stream
diff --git a/lotuswordpro/source/filter/lwpfilter.hxx b/lotuswordpro/source/filter/lwpfilter.hxx
index 6f82a1d..54ca0cf 100644
--- a/lotuswordpro/source/filter/lwpfilter.hxx
+++ b/lotuswordpro/source/filter/lwpfilter.hxx
@@ -86,43 +86,6 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::text;
 using namespace ::com::sun::star;
 
-/**
- * @brief
- * Implements the XFilter interface.
- * This is not the entry for the filter, but a proto of LwpFilterImportFilter.
- */
-class LWPFilterReader : public WeakImplHelper1< XFilter >
-{
-public:
-    LWPFilterReader();
-    virtual ~LWPFilterReader();
-
-public:
-    /**
-     * @descr   loading the file. It's call be SfxObejctShell::ImportFrom.
-     * @param   aDescriptor the parameters include file URL or XInputStream object, from which the filter can
-     *          get which file to import.
-     */
-    virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor )
-        throw( RuntimeException, std::exception ) SAL_OVERRIDE;
-
-    /**
-     * @descr   stop loading the file.
-     */
-    virtual void SAL_CALL cancel() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-    /**
-     * @descr   get the XDocumentHandler interface.
-     */
-    void setDocumentHandler( uno::Reference< XDocumentHandler >& xHandler )
-    {
-        m_DocumentHandler = xHandler;
-    }
-
-private:
-    uno::Reference< XDocumentHandler > m_DocumentHandler;
-};
-
 //test code
 int ReadWordproFile(SvStream &rStream, uno::Reference<XDocumentHandler>& XDoc);
 
diff --git a/unusedcode.easy b/unusedcode.easy
index a8cc134..15235e2 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -25,7 +25,6 @@ GDriveSession::GDriveSession()
 Json::Json(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Json, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, Json> > > const&)
 Json::Json(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::shared_ptr<libcmis::Property>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::shared_ptr<libcmis::Property> > > > const&)
 Json::swap(Json&)
-LWPFilterReader::LWPFilterReader()
 MenuBar::AddMenuBarButton(Image const&, Link const&, rtl::OUString const&, unsigned short)
 MenuBar::GetMenuBarButtonRectPixel(unsigned short)
 MenuBar::RemoveMenuBarButton(unsigned short)
commit ce300bf2854c3f4d4cc965c631b5905833af6749
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Tue May 13 00:32:32 2014 +0200

    SAL_INT64_IS_STRUCT is never defined
    
    Change-Id: I326a429beec5fd1932afff0a1f50522426de15e2

diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 2a69f95..2a9f969 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -53,7 +53,6 @@
 #include <sfx2/htmlmode.hxx>
 #include <svl/urihelper.hxx>
 #include <tools/urlobj.hxx>
-#include <tools/bigint.hxx>
 #include <unotools/charclass.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <charfmt.hxx>
@@ -359,37 +358,6 @@ static void AddUnitPropertyValue(OStringBuffer &rOut, long nVal,
     bool bOutLongVal = true;
     if( nVal > LONG_MAX / nMul )
     {
-        // needs a BigInt to translate this unit
-#ifdef SAL_INT64_IS_STRUCT
-        BigInt nBigVal( nVal );
-        nBigVal *= nMul;
-        nBigVal /= nDiv;
-        nBigVal += 5;
-        nBigVal /= 10;
-
-        if( nBigVal.IsLong() )
-        {
-            // a long is sufficient
-            nLongVal = (long)nBigVal;
-        }
-        else
-        {
-            BigInt nBigFac( nFac );
-            BigInt nBig10( 10 );
-            rOut += (long)(nBigVal / nBigFac);
-            if( !(nBigVal % nBigFac).IsZero() )
-            {
-                rOut.append('.');
-                while( nFac > 1 && !(nBigVal % nBigFac).IsZero() )
-                {
-                    nFac /= 10;
-                    nBigFac = nFac;
-                    rOut.append(OString::number((nBigVal / nBigFac) % nBig10));
-                }
-            }
-            bOutLongVal = false;
-        }
-#else
         sal_Int64 nBigVal( nVal );
         nBigVal *= nMul;
         nBigVal /= nDiv;
@@ -415,7 +383,6 @@ static void AddUnitPropertyValue(OStringBuffer &rOut, long nVal,
             }
             bOutLongVal = false;
         }
-#endif
     }
     else
     {


More information about the Libreoffice-commits mailing list