[Libreoffice-commits] .: 3 commits - editeng/source extensions/Library_pl.mk extensions/source

Michael Stahl mst at kemper.freedesktop.org
Tue Jan 10 01:54:29 PST 2012


 editeng/source/editeng/edtspell.cxx          |   46 ++++++++++++++++++---------
 extensions/Library_pl.mk                     |    4 +-
 extensions/source/plugin/aqua/sysplug.mm     |   19 +++++++++--
 extensions/source/plugin/base/xplugin.cxx    |    2 -
 extensions/source/plugin/inc/plugin/impl.hxx |    6 ---
 extensions/source/plugin/unx/nppapi.cxx      |    4 +-
 6 files changed, 57 insertions(+), 24 deletions(-)

New commits:
commit 2af8b95af8730fc68ad6fcd3eaab38a799eef580
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jan 10 10:37:56 2012 +0100

    editeng: fix STL conversion dfbf0cabfa8310502e19642d56c746cc0d454d27
    
    - iterators should be compared with !=, not <
    - iterator invalidation on erase should be avoided by using the
      iterator that is returned by erase
    - in WrongList::operator== only one iterator was incremented

diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index a356257..77a65dd 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -242,7 +242,7 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS
             nInvalidEnd = nPos+nNew;
     }
 
-    for (WrongList::iterator i = begin(); i < end(); ++i)
+    for (WrongList::iterator i = begin(); i != end(); ++i)
     {
         sal_Bool bRefIsValid = sal_True;
         if (i->nEnd >= nPos)
@@ -312,7 +312,7 @@ void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted )
         }
     }
 
-    for (WrongList::reverse_iterator i = rbegin(); i < rend(); ++i)
+    for (WrongList::iterator i = begin(); i != end(); )
     {
         sal_Bool bDelWrong = sal_False;
         if (i->nEnd >= nPos)
@@ -345,7 +345,13 @@ void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted )
         }
         DBG_ASSERT(i->nStart < i->nEnd, "TextInserted, WrongRange: Start >= End?!" );
         if ( bDelWrong )
-            erase(--(i.base()));
+        {
+            i = erase(i);
+        }
+        else
+        {
+            ++i;
+        }
     }
 
     DBG_ASSERT( !DbgIsBuggy(), "InsertWrong: WrongList broken!" );
@@ -357,7 +363,7 @@ sal_Bool WrongList::NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const
         rnStart get the start position, is possibly adjusted wrt. Wrong start
         rnEnd does not have to be initialized.
     */
-    for (WrongList::const_iterator i = begin(); i < end(); ++i)
+    for (WrongList::const_iterator i = begin(); i != end(); ++i)
     {
         if ( i->nEnd > rnStart )
         {
@@ -371,7 +377,7 @@ sal_Bool WrongList::NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const
 
 sal_Bool WrongList::HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const
 {
-    for (WrongList::const_iterator i = begin(); i < end(); ++i)
+    for (WrongList::const_iterator i = begin(); i != end(); ++i)
     {
         if (i->nStart == nStart && i->nEnd == nEnd)
             return sal_True;
@@ -383,7 +389,7 @@ sal_Bool WrongList::HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const
 
 sal_Bool WrongList::HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const
 {
-    for (WrongList::const_iterator i = begin(); i < end(); ++i)
+    for (WrongList::const_iterator i = begin(); i != end(); ++i)
     {
         if (i->nEnd >= nStart && i->nStart < nEnd)
             return sal_True;
@@ -396,7 +402,7 @@ sal_Bool WrongList::HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const
 void WrongList::ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd,
             const ContentNode* pNode )
 {
-    for (WrongList::reverse_iterator i = rbegin(); i < rend(); ++i)
+    for (WrongList::iterator i = begin(); i != end(); )
     {
         if (i->nEnd > nStart && i->nStart < nEnd)
         {
@@ -407,10 +413,20 @@ void WrongList::ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd,
                 while (i->nStart < pNode->Len() &&
                        (pNode->GetChar(i->nStart) == ' ' ||
                         pNode->IsFeature(i->nStart)))
+                {
                     ++(i->nStart);
+                }
+                ++i;
             }
             else
-                erase(--(i.base()));
+            {
+                i = erase(i);
+                // no increment here
+            }
+        }
+        else
+        {
+            ++i;
         }
     }
 
@@ -421,7 +437,7 @@ void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd,
             sal_Bool bClearRange )
 {
     WrongList::iterator nPos = end();
-    for (WrongList::iterator i = begin(); i < end(); ++i)
+    for (WrongList::iterator i = begin(); i != end(); ++i)
     {
         if (i->nStart >= nStart )
         {
@@ -440,7 +456,7 @@ void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd,
         }
     }
 
-    if(nPos < end())
+    if (nPos != end())
         insert(nPos, WrongRange(nStart, nEnd));
     else
         push_back(WrongRange(nStart, nEnd));
@@ -458,7 +474,7 @@ WrongList* WrongList::Clone() const
 {
     WrongList* pNew = new WrongList;
     pNew->reserve(size());
-    for (WrongList::const_iterator i = begin(); i < end(); ++i)
+    for (WrongList::const_iterator i = begin(); i != end(); ++i)
         pNew->push_back(*i);
     return pNew;
 }
@@ -475,9 +491,11 @@ bool WrongList::operator==(const WrongList& rCompare) const
     WrongList::const_iterator rCA = begin();
     WrongList::const_iterator rCB = rCompare.begin();
 
-    for(; rCA < end(); ++rCA)
+    for (; rCA != end(); ++rCA, ++rCB)
+    {
         if(rCA->nStart != rCB->nStart || rCA->nEnd != rCB->nEnd)
             return false;
+    }
 
     return true;
 }
@@ -487,9 +505,9 @@ sal_Bool WrongList::DbgIsBuggy() const
 {
     // Check if the ranges overlap.
     sal_Bool bError = sal_False;
-    for (WrongList::const_iterator i = begin(); !bError && (i < end()); ++i)
+    for (WrongList::const_iterator i = begin(); !bError && (i != end()); ++i)
     {
-        for (WrongList::const_iterator j = i + 1; !bError && (j < end()); ++j)
+        for (WrongList::const_iterator j = i + 1; !bError && (j != end()); ++j)
         {
             // 1) Start before, End after the second Start
             if (i->nStart <= j->nStart && i->nEnd >= j->nStart)
commit 14da1611e8c18925f4faa81dfaf792ef1b3fd00a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jan 10 10:36:36 2012 +0100

    extensions: plugin: mac unused param warnings

diff --git a/extensions/source/plugin/aqua/sysplug.mm b/extensions/source/plugin/aqua/sysplug.mm
index 1696a7a..55d3c57 100644
--- a/extensions/source/plugin/aqua/sysplug.mm
+++ b/extensions/source/plugin/aqua/sysplug.mm
@@ -173,6 +173,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)drawRect: (NSRect) i_aRect
 {
+    (void) i_aRect; // unused
     m_pCom->drawView( m_pImpl );
 }
 
@@ -189,6 +190,7 @@ struct FakeEventRecord : public EventRecord
 // NSResponder
 -(void)mouseMoved:   (NSEvent*)i_pEvent
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -196,6 +198,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)mouseDown:    (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = mouseDown;
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -203,6 +206,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)mouseDragged: (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -210,6 +214,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)mouseUp:      (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = mouseUp;
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -217,6 +222,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)rightMouseDown:    (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = mouseDown;
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -224,6 +230,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)rightMouseDragged: (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -231,6 +238,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)rightMouseUp:      (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = mouseUp;
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -238,6 +246,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)otherMouseDown:    (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = mouseDown;
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -245,6 +254,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)otherMouseDragged: (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -252,6 +262,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)otherMouseUp:      (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = mouseUp;
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -259,6 +270,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)mouseEntered: (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -266,6 +278,7 @@ struct FakeEventRecord : public EventRecord
 
 -(void)mouseExited:  (NSEvent*)i_pEvent;
 {
+    (void) i_pEvent; // unused
     FakeEventRecord aRec;
     aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
     m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
@@ -280,6 +293,8 @@ MacPluginComm::MacPluginComm( const rtl::OUString& i_rMimetype, const rtl::OUStr
       m_hPlugLib( NULL ),
       m_pNullTimer( NULL )
 {
+    (void) i_rMimetype; // unused
+    (void) i_pParent; // unused
     // initialize plugin function table
     memset( &m_aNPPfuncs, 0, sizeof( m_aNPPfuncs ) );
 
commit bec239e847da2b8112de79f18c6f62eb52b47bc1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jan 10 10:32:51 2012 +0100

    extensions: plugin: fix build a bit more on Mac

diff --git a/extensions/Library_pl.mk b/extensions/Library_pl.mk
index b6a3700..96bcdb5 100644
--- a/extensions/Library_pl.mk
+++ b/extensions/Library_pl.mk
@@ -104,7 +104,7 @@ $(eval $(call gb_Library_set_include,pl,\
 	-I$(FRAMEWORKSHOME)/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/Current/Headers \
 ))
 
-endif # GUIBASE=aqua
+else # GUIBASE!=aqua
 
 ifeq ($(ENABLE_GTK),TRUE)
 $(eval $(call gb_Library_add_defs,pl,\
@@ -126,6 +126,8 @@ $(eval $(call gb_Library_add_libs,pl,\
 	-lX11 \
 ))
 
+endif # GUIBASE=aqua
+
 endif # GUI=UNX
 
 $(eval $(call gb_Library_add_linked_libs,pl,\
diff --git a/extensions/source/plugin/aqua/sysplug.mm b/extensions/source/plugin/aqua/sysplug.mm
index 8db2dce..1696a7a 100644
--- a/extensions/source/plugin/aqua/sysplug.mm
+++ b/extensions/source/plugin/aqua/sysplug.mm
@@ -77,9 +77,9 @@ struct SysPlugData
     return ::boost::shared_ptr<SysPlugData>(new SysPlugData);
 }
 
-void XPlugin_Impl::SetSysPlugDataParentView(SystemEnvData* pEnvData)
+void XPlugin_Impl::SetSysPlugDataParentView(SystemEnvData const& rEnvData)
 {
-    m_pSysPlugData.m_pParentView = pEnvData->pView;
+    m_pSysPlugData->m_pParentView = rEnvData.pView;
 }
 
 extern "C" {
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
index 4cce131..0a9618d 100644
--- a/extensions/source/plugin/base/xplugin.cxx
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -566,7 +566,7 @@ void XPlugin_Impl::loadPlugin()
                  NULL );
 #ifdef QUARTZ
     // m_aNPWindow is set up in the MacPluginComm from the view
-    SetSysPlugDataParentView(pEnvData);
+    SetSysPlugDataParentView(*pEnvData);
 #elif defined( UNX )
     XSync( (Display*)pEnvData->pDisplay, False );
     m_aNPWindow.window      = (void*)pEnvData->aWindow;
diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx
index 4ba1b9a..5316fbe 100644
--- a/extensions/source/plugin/inc/plugin/impl.hxx
+++ b/extensions/source/plugin/inc/plugin/impl.hxx
@@ -72,10 +72,6 @@
 #include <list>
 
 #ifdef WNT
-#include "plugin/win/sysplug.hxx"
-#endif
-
-#ifdef WNT
 #include <plugin/win/sysplug.hxx>
 #elif defined(QUARTZ)
 #include "plugin/aqua/sysplug.hxx"
@@ -157,7 +153,7 @@ private:
     sal_Bool                        m_bIsDisposed;
 
 #ifdef QUARTZ
-    void SetSysPlugDataParentView(SystemEnvData* pEnvData);
+    void SetSysPlugDataParentView(SystemEnvData const& rEnvData);
 #endif
 
     void prependArg( const char* pName, const char* pValue ); // arguments will be strdup'ed
diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx
index 15aeba5..04c3778 100644
--- a/extensions/source/plugin/unx/nppapi.cxx
+++ b/extensions/source/plugin/unx/nppapi.cxx
@@ -35,9 +35,11 @@
 
 #include <cstdarg>
 
-#include <plugin/impl.hxx>
 #include <vcl/svapp.hxx>
 
+#include <plugin/unx/plugcon.hxx>
+#include <plugin/impl.hxx>
+
 std::vector<PluginConnector*> PluginConnector::allConnectors;
 
 PluginConnector::PluginConnector( int nSocket ) :


More information about the Libreoffice-commits mailing list