[Libreoffice-commits] core.git: sw/source

Stephan Bergmann sbergman at redhat.com
Wed Jul 31 03:08:27 PDT 2013


 sw/source/core/doc/visiturl.cxx |   48 +++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

New commits:
commit 8434c577ae2b45d70baff4ba0a00048bc0f10e6a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jul 31 12:07:51 2013 +0200

    Work around MSVC "may be uninitialized" warnings
    
    Change-Id: Ibac83d2d97f178605f717fc675853d86101195e3

diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
index 74e5716..78f51e9 100644
--- a/sw/source/core/doc/visiturl.cxx
+++ b/sw/source/core/doc/visiturl.cxx
@@ -56,32 +56,36 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
             (sBkmk = pIURL->GetMark()).Insert( INET_MARK_TOKEN, 0 );
 
         bool bAction = false, bUnLockView = false;
-        const SwFmtINetFmt* pItem;
-        const SwTxtINetFmt* pTxtAttr;
-        const SwTxtNode* pTxtNd;
-        sal_uInt32 n, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
-        for( n = 0; n < nMaxItems; ++n )
-            if( 0 != (pItem = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem2(
-                RES_TXTATR_INETFMT, n ) ) &&
-                ( pItem->GetValue() == sURL ||
-                    ( sBkmk.Len() && pItem->GetValue() == sBkmk )) &&
-                0 != ( pTxtAttr = pItem->GetTxtINetFmt()) &&
-                0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) )
+        sal_uInt32 nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
+        for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+        {
+            const SwFmtINetFmt* pItem = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem2(RES_TXTATR_INETFMT, n );
+            if( pItem != 0 &&
+                ( pItem->GetValue() == sURL || ( sBkmk.Len() && pItem->GetValue() == sBkmk )))
             {
-                if( !bAction && pESh )
+                const SwTxtINetFmt* pTxtAttr = pItem->GetTxtINetFmt();
+                if (pTxtAttr != 0)
                 {
-                    pESh->StartAllAction();
-                    bAction = true;
-                    bUnLockView = !pESh->IsViewLocked();
-                    pESh->LockView( sal_True );
+                    const SwTxtNode* pTxtNd = pTxtAttr->GetpTxtNode();
+                    if (pTxtNd != 0)
+                    {
+                        if( !bAction && pESh )
+                        {
+                            pESh->StartAllAction();
+                            bAction = true;
+                            bUnLockView = !pESh->IsViewLocked();
+                            pESh->LockView( sal_True );
+                        }
+                        const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false );
+                        const SwTxtAttr* pAttr = pTxtAttr;
+                        SwUpdateAttr aUpdateAttr( *pAttr->GetStart(),
+                                                  *pAttr->GetEnd(),
+                                                  RES_FMT_CHG );
+                        ((SwTxtNode*)pTxtNd)->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
+                    }
                 }
-                const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false );
-                const SwTxtAttr* pAttr = pTxtAttr;
-                SwUpdateAttr aUpdateAttr( *pAttr->GetStart(),
-                                          *pAttr->GetEnd(),
-                                          RES_FMT_CHG );
-                ((SwTxtNode*)pTxtNd)->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
             }
+        }
 
         if( bAction )
             pESh->EndAllAction();


More information about the Libreoffice-commits mailing list