[Libreoffice-commits] core.git: 5 commits - bin/findunusedcode chart2/source include/svx sc/source svx/source sw/source unusedcode.easy vcl/source

Caolán McNamara caolanm at redhat.com
Mon Nov 10 02:44:56 PST 2014


 bin/findunusedcode                                     |    2 
 chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx |    5 -
 chart2/source/controller/inc/dlg_ChartType_UNO.hxx     |    2 
 include/svx/svdograf.hxx                               |    1 
 sc/source/ui/optdlg/calcoptionsdlg.cxx                 |    4 -
 sc/source/ui/optdlg/calcoptionsdlg.hxx                 |    1 
 svx/source/svdraw/svdglue.cxx                          |   13 ++--
 svx/source/svdraw/svdograf.cxx                         |    5 -
 sw/source/core/unocore/unoobj.cxx                      |   13 +++-
 sw/source/ui/envelp/envfmt.cxx                         |    4 -
 unusedcode.easy                                        |    1 
 vcl/source/fontsubset/sft.cxx                          |   55 +++++++++++++----
 12 files changed, 69 insertions(+), 37 deletions(-)

New commits:
commit cfafbcaa3ffcbee4f715fe940c860bedc4db9bb2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 10 09:20:13 2014 +0000

    callcatcher: unused code
    
    Change-Id: I2ead5d998c3b1b3cde1222fee6f072bf09ab0021

diff --git a/bin/findunusedcode b/bin/findunusedcode
index 5b22056..61ba654 100755
--- a/bin/findunusedcode
+++ b/bin/findunusedcode
@@ -25,7 +25,7 @@ echo "--without-doxygen
 --enable-gtk3
 --enable-kde4
 --enable-dbus
---enable-gstreamer
+--enable-gstreamer-1-0
 --disable-gstreamer-0-10" \
   > autogen.input
 
diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
index 9cd0f7c..68c6c18 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
@@ -25,11 +25,6 @@
 namespace chart
 {
 using namespace ::com::sun::star;
-uno::Reference< uno::XInterface >
-            SAL_CALL ChartTypeUnoDlg::Create(const uno::Reference< uno::XComponentContext >& _xContext)
-{
-    return *(new ChartTypeUnoDlg(_xContext));
-}
 ChartTypeUnoDlg::ChartTypeUnoDlg( const uno::Reference< uno::XComponentContext >& _xContext )
                     : ChartTypeUnoDlg_BASE( _xContext )
 {
diff --git a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
index 98bb3d1..9a00d96 100644
--- a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
@@ -39,8 +39,6 @@ public:
     // XServiceInfo - static methods
     static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void);
     static OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
-    static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-            SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >&);
 private:
     virtual ~ChartTypeUnoDlg();
 
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index d6cb3d2..399bcbd 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -138,7 +138,6 @@ public:
 
 private:
     void                    ForceSwapIn() const;
-    void                    ForceSwapOut() const;
 
 public:
     void                    SetGraphicLink(const OUString& rFileName, const OUString& rReferer, const OUString& rFilterName);
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 06e74fa..1510411 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -812,10 +812,6 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
     }
 }
 
-void ScCalcOptionsDialog::WhiteAndBlackListSelectionChanged()
-{
-}
-
 OUString ScCalcOptionsDialog::toString(formula::FormulaGrammar::AddressConvention eConv) const
 {
     switch (eConv)
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index d8115c2..bc52291 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -53,7 +53,6 @@ private:
     void SelectedDeviceChanged();
     void SpinButtonValueChanged();
     void EditFieldValueChanged(Control *pCtrl);
-    void WhiteAndBlackListSelectionChanged();
 #if HAVE_FEATURE_OPENCL
     void fillOpenCLList();
 #endif
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index ca34e7e..c2bbeb1 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -588,11 +588,6 @@ void SdrGrafObj::ForceSwapIn() const
     }
 }
 
-void SdrGrafObj::ForceSwapOut() const
-{
-    pGraphic->FireSwapOutRequest();
-}
-
 void SdrGrafObj::ImpLinkAnmeldung()
 {
     sfx2::LinkManager* pLinkManager = pModel != NULL ? pModel->GetLinkManager() : NULL;
diff --git a/unusedcode.easy b/unusedcode.easy
index 433c410..2eb975d 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -166,7 +166,6 @@ apitest::XTextContent::testGetAnchor()
 apitest::XTextField::testGetPresentation()
 basegfx::tools::containsOnlyHorizontalAndVerticalEdges(basegfx::B2DPolyPolygon const&)
 canvas::createSurfaceProxyManager(boost::shared_ptr<canvas::IRenderModule> const&)
-chart::ChartTypeUnoDlg::Create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
 chart::ShapeToolbarController::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
 comphelper::OAccessibleImplementationAccess::setStateBit(short, bool)
 comphelper::ThreadPool::getSharedOptimalPool()
commit 2275d77e09a0e378b3d6a65dd98c54eee3df06b2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 10 10:23:42 2014 +0000

    coverity#1222237 Untrusted value as argument
    
    Change-Id: Ie74695e442b0df7fead2442f2b0d64658d083338

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index d66e158..9ee4988 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -2118,11 +2118,29 @@ static void GlyphOffsetsDispose(GlyphOffsets *_this)
 
 static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen)
 {
+    if (sfntLen < 12)
+    {
+        SAL_WARN( "vcl.fonts", "DumpSfnts sfntLen is too short: "
+            << sfntLen << " legal min is: " << sfntLen);
+        return;
+    }
+
+    const sal_uInt32 nSpaceForTables = sfntLen - 12;
+    const sal_uInt32 nTableSize = 16;
+    const sal_uInt32 nMaxPossibleTables = nSpaceForTables/nTableSize;
+
     HexFmt *h = HexFmtNew(outf);
     sal_uInt16 i, numTables = GetUInt16(sfntP, 4, 1);
     GlyphOffsets *go = GlyphOffsetsNew(sfntP, sfntLen);
     sal_uInt8 pad[] = {0,0,0,0};                     /* zeroes                       */
 
+    if (numTables > nMaxPossibleTables)
+    {
+        SAL_WARN( "vcl.fonts", "DumpSfnts claimed to have "
+            << numTables  << " tables, but only space for " << nMaxPossibleTables);
+        numTables = nMaxPossibleTables;
+    }
+
     assert(numTables <= 9);                                 /* Type42 has 9 required tables */
 
     sal_uInt32* offs = (sal_uInt32*)scalloc(numTables, sizeof(sal_uInt32));
@@ -2132,7 +2150,8 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen)
     HexFmtBlockWrite(h, sfntP, 12);                         /* stream out the Offset Table    */
     HexFmtBlockWrite(h, sfntP+12, 16 * numTables);          /* stream out the Table Directory */
 
-    for (i=0; i<numTables; i++) {
+    for (i=0; i<numTables; i++)
+    {
         sal_uInt32 nLargestFixedOffsetPos = 12 + 16 * i + 12;
         sal_uInt32 nMinSize = nLargestFixedOffsetPos + sizeof(sal_uInt32);
         if (nMinSize > sfntLen)
@@ -2144,16 +2163,33 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen)
 
         sal_uInt32 tag = GetUInt32(sfntP, 12 + 16 * i, 1);
         sal_uInt32 off = GetUInt32(sfntP, 12 + 16 * i + 8, 1);
+        if (off > sfntLen)
+        {
+            SAL_WARN( "vcl.fonts", "DumpSfnts claims offset of "
+                << off << " but max possible is " << sfntLen);
+            break;
+        }
+        sal_uInt8 *pRecordStart = sfntP + off;
         sal_uInt32 len = GetUInt32(sfntP, nLargestFixedOffsetPos, 1);
+        sal_uInt32 nMaxLenPossible = sfntLen - off;
+        if (len > nMaxLenPossible)
+        {
+            SAL_WARN( "vcl.fonts", "DumpSfnts claims len of "
+                << len << " but only space for " << nMaxLenPossible);
+            break;
+        }
 
-        if (tag != T_glyf) {
-            HexFmtBlockWrite(h, sfntP + off, len);
-        } else {
-            sal_uInt8 *glyf = sfntP + off;
-            sal_uInt32 o, l, j;
-            for (j = 0; j < go->nGlyphs - 1; j++) {
-                o = go->offs[j];
-                l = go->offs[j + 1] - o;
+        if (tag != T_glyf)
+        {
+            HexFmtBlockWrite(h, pRecordStart, len);
+        }
+        else
+        {
+            sal_uInt8 *glyf = pRecordStart;
+            for (sal_uInt32 j = 0; j < go->nGlyphs - 1; j++)
+            {
+                sal_uInt32 o = go->offs[j];
+                sal_uInt32 l = go->offs[j + 1] - o;
                 HexFmtBlockWrite(h, glyf + o, l);
             }
         }
@@ -2164,7 +2200,6 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen)
     GlyphOffsetsDispose(go);
     HexFmtDispose(h);
     free(offs);
-//    free(lens);
 }
 
 int  CreateT42FromTTGlyphs(TrueTypeFont  *ttf,
commit 710cfc4de6c76f52f2a2df4b0ea7a62d9f2c0dce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 10 10:15:04 2014 +0000

    coverity#1242522 silence Arguments in wrong order
    
    Change-Id: I248a99b1c0755c54d4f7dbdd291f382d7d99b9ce

diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 17623df..fd44a82 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -207,8 +207,10 @@ IMPL_LINK_INLINE_START( SwEnvFmtPage, ModifyHdl, Edit *, pEdit )
 
     if (pEdit == m_pSizeWidthField || pEdit == m_pSizeHeightField)
     {
+        long nRotatedWidth = lHeight;
+        long nRotatedHeight = lWidth;
         Paper ePaper = SvxPaperInfo::GetSvxPaper(
-            Size(lHeight, lWidth), MAP_TWIP, true);
+            Size(nRotatedWidth, nRotatedHeight), MAP_TWIP, true);
         for (size_t i = 0; i < aIDs.size(); ++i)
             if (aIDs[i] == (sal_uInt16)ePaper)
                 m_pSizeFormatBox->SelectEntryPos(static_cast<sal_Int32>(i));
commit 544cbe1a523f613ca5fc7ff7a6ee24442f75c516
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 10 10:05:42 2014 +0000

    coverity#1251167 Logically dead code
    
    Change-Id: I8294eaf8109ab5b8bc7972da1e5fa2ba9ad819fb

diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
index fe7acb1..c19a3cc 100644
--- a/svx/source/svdraw/svdglue.cxx
+++ b/svx/source/svdraw/svdglue.cxx
@@ -163,11 +163,14 @@ long SdrGluePoint::EscDirToAngle(sal_uInt16 nEsc) const
 sal_uInt16 SdrGluePoint::EscAngleToDir(long nAngle) const
 {
     nAngle=NormAngle360(nAngle);
-    if (nAngle>=31500 || nAngle<4500) return SDRESC_RIGHT;
-    if (nAngle<13500) return SDRESC_TOP;
-    if (nAngle<22500) return SDRESC_LEFT;
-    if (nAngle<31500) return SDRESC_BOTTOM;
-    return 0;
+    if (nAngle>=31500 || nAngle<4500)
+        return SDRESC_RIGHT;
+    if (nAngle<13500)
+        return SDRESC_TOP;
+    if (nAngle<22500)
+        return SDRESC_LEFT;
+    /* (nAngle<31500)*/
+    return SDRESC_BOTTOM;
 }
 
 void SdrGluePoint::Rotate(const Point& rRef, long nAngle, double sn, double cs, const SdrObject* pObj)
commit db99f38e0ae7e7269c15e74e846215ffb90ce9b3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 10 09:59:03 2014 +0000

    coverity#1000853 Uncaught exception
    
    Change-Id: Id55768822a6a932dace1e30cb03175880ba3ca6a

diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 6a7b2f2..9d7ddef 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -19,6 +19,7 @@
 
 #include <com/sun/star/table/TableSortField.hpp>
 #include <comphelper/string.hxx>
+#include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <osl/endian.h>
 #include <rtl/ustrbuf.hxx>
@@ -2336,7 +2337,17 @@ void SAL_CALL SwXTextCursor::setPropertyValues(
         aPropertyValues[ i ].Name = aPropertyNames[ i ];
         aPropertyValues[ i ].Value = aValues[ i ];
     }
-    SwUnoCursorHelper::SetPropertyValues( rUnoCursor, m_pImpl->m_rPropSet, aPropertyValues );
+    try
+    {
+        SwUnoCursorHelper::SetPropertyValues( rUnoCursor, m_pImpl->m_rPropSet, aPropertyValues );
+    }
+    catch (const css::beans::UnknownPropertyException& e)
+    {
+        uno::Any a(cppu::getCaughtException());
+        throw lang::WrappedTargetException(
+            "wrapped Exception " + e.Message,
+            uno::Reference<uno::XInterface>(), a);
+    }
 }
 
 uno::Sequence< uno::Any > SAL_CALL


More information about the Libreoffice-commits mailing list