[Libreoffice-commits] core.git: 6 commits - sd/source

Norbert Thiebaud nthiebaud at gmail.com
Sat Jul 5 21:58:36 PDT 2014


 sd/source/filter/eppt/epptso.cxx                |   10 +++---
 sd/source/ui/docshell/docshel3.cxx              |   39 ++++++++++++------------
 sd/source/ui/func/futempl.cxx                   |   17 ++++------
 sd/source/ui/remotecontrol/BluetoothServer.cxx  |   31 +++++++++++--------
 sd/source/ui/remotecontrol/DiscoveryService.cxx |   31 +++++++++++--------
 5 files changed, 72 insertions(+), 56 deletions(-)

New commits:
commit 59af5e5b2983a341f8dd14bce56af86478badaa9
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Jul 6 06:46:07 2014 +0200

    coverity#735324: Unchecked return value
    
    Change-Id: I7d6dcf0f64be944df1a94db27d1ee86f1bf2229c

diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index 0c5444c..8ff19b5 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -186,15 +186,14 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
         case SID_STYLE_NEW_BY_EXAMPLE:
         {
             // at the moment, the dialog to enter the name of the template is still opened
-            mpView->AreObjectsMarked();
-                SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
-                if(p)
-                {
-                    pSSPool->Remove(p);
-                    p = 0;
-                }
-                pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
-                pStyleSheet->SetParent(SD_RESSTR(STR_STANDARD_STYLESHEET_NAME));
+            SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
+            if(p)
+            {
+                pSSPool->Remove(p);
+                p = 0;
+            }
+            pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
+            pStyleSheet->SetParent(SD_RESSTR(STR_STANDARD_STYLESHEET_NAME));
         }
         break;
 
commit 44ba417d72a006fe8a9d30122a42bbdf7a7066ce
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Jul 6 06:35:59 2014 +0200

    coverity#982181: Unchecked return value
    
    Change-Id: Idcac7155b9cd3ee94c3ed773a0e6e7f24a48d47a

diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 916638c..e40fa13 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1243,10 +1243,12 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
             const uno::Reference< beans::XPropertySet > xPropSet( mXModel, uno::UNO_QUERY );
             if ( xPropSet.is() )
             {
-                ImplGetPropertyValue( xPropSet, OUString( "TabStop" ) );
-                sal_Int32 nTabStop( 0 );
-                if ( mAny >>= nTabStop )
-                    nDefaultTabSizeSrc = nTabStop;
+                if(ImplGetPropertyValue( xPropSet, OUString( "TabStop" ) ))
+                {
+                    sal_Int32 nTabStop( 0 );
+                    if ( mAny >>= nTabStop )
+                        nDefaultTabSizeSrc = nTabStop;
+                }
             }
             const sal_uInt32 nDefaultTabSize = MapSize( awt::Size( nDefaultTabSizeSrc, 1 ) ).Width;
             sal_uInt32  nDefaultTabs = std::abs( maRect.GetWidth() ) / nDefaultTabSize;
commit cbb081e2d4bb6d6ded1bd3ff97fc53e5a874a12c
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Jul 6 06:31:25 2014 +0200

    coverity#982182: Unchecked return value
    
    Change-Id: I5a1820339ea598a606c46a1e03cd296fe81ef22f

diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index d37dc3b..5dbebe7 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -152,22 +152,29 @@ void SAL_CALL DiscoveryService::run()
         memset( aBuffer, 0, sizeof(char) * BUFFER_SIZE );
         sockaddr_in aAddr;
         socklen_t aLen = sizeof( aAddr );
-        recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, (sockaddr*) &aAddr, &aLen );
-        OString aString( aBuffer, strlen( "LOREMOTE_SEARCH" ) );
-        if ( aString == "LOREMOTE_SEARCH" )
+        if(recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, (sockaddr*) &aAddr, &aLen ) > 0)
         {
-            OStringBuffer aStringBuffer("LOREMOTE_ADVERTISE\n");
-            aStringBuffer.append( OUStringToOString(
-                osl::SocketAddr::getLocalHostname(), RTL_TEXTENCODING_UTF8 ) )
-                .append( "\n\n" );
-            if ( sendto( mSocket, aStringBuffer.getStr(),
-                aStringBuffer.getLength(), 0, (sockaddr*) &aAddr,
-                         sizeof(aAddr) ) <= 0 )
+            OString aString( aBuffer, strlen( "LOREMOTE_SEARCH" ) );
+            if ( aString == "LOREMOTE_SEARCH" )
             {
-                // Read error or closed socket -- we are done.
-                return;
+                OStringBuffer aStringBuffer("LOREMOTE_ADVERTISE\n");
+                aStringBuffer.append( OUStringToOString(
+                                              osl::SocketAddr::getLocalHostname(), RTL_TEXTENCODING_UTF8 ) )
+                    .append( "\n\n" );
+                if ( sendto( mSocket, aStringBuffer.getStr(),
+                             aStringBuffer.getLength(), 0, (sockaddr*) &aAddr,
+                             sizeof(aAddr) ) <= 0 )
+                {
+                    // Write error or closed socket -- we are done.
+                    return;
+                }
             }
         }
+        else
+        {
+            // Read error or closed socket -- we are done.
+            return;
+        }
     }
 }
 
commit 0612430277f4cfb38b9c1eb0d5471e4bdbe1db00
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Jul 6 06:24:46 2014 +0200

    coverity#1202762: Unchecked return value
    
    Change-Id: Ic69a6507df5444175b6aba4de01ca94d9a28be09

diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index ea99e0c..7d586ca 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -769,22 +769,27 @@ setDBusBooleanProperty( DBusConnection *pConnection, DBusObject *pAdapter,
     DBusMessage *pMsg = pProperties->getMethodCall( "Set" );
 
     DBusMessageIter itIn;
-    dbus_message_iter_init_append( pMsg, &itIn );
-    const char* pInterface = "org.bluez.Adapter1";
-    dbus_message_iter_append_basic( &itIn, DBUS_TYPE_STRING, &pInterface );
-    dbus_message_iter_append_basic( &itIn, DBUS_TYPE_STRING, &pPropertyName );
-
+    if(!dbus_message_iter_init_append( pMsg, &itIn ))
     {
-        DBusMessageIter varIt;
-        dbus_message_iter_open_container( &itIn, DBUS_TYPE_VARIANT,
-                                        DBUS_TYPE_BOOLEAN_AS_STRING, &varIt );
-        dbus_bool_t bDBusBoolean = bBoolean;
-        dbus_message_iter_append_basic( &varIt, DBUS_TYPE_BOOLEAN, &bDBusBoolean );
-        dbus_message_iter_close_container( &itIn, &varIt );
+        SAL_WARN( "sdremote.bluetooth", "error init dbus" );
     }
+    else
+    {
+        const char* pInterface = "org.bluez.Adapter1";
+        dbus_message_iter_append_basic( &itIn, DBUS_TYPE_STRING, &pInterface );
+        dbus_message_iter_append_basic( &itIn, DBUS_TYPE_STRING, &pPropertyName );
 
-    pMsg = sendUnrefAndWaitForReply( pConnection, pMsg );
+        {
+            DBusMessageIter varIt;
+            dbus_message_iter_open_container( &itIn, DBUS_TYPE_VARIANT,
+                                              DBUS_TYPE_BOOLEAN_AS_STRING, &varIt );
+            dbus_bool_t bDBusBoolean = bBoolean;
+            dbus_message_iter_append_basic( &varIt, DBUS_TYPE_BOOLEAN, &bDBusBoolean );
+            dbus_message_iter_close_container( &itIn, &varIt );
+        }
 
+        pMsg = sendUnrefAndWaitForReply( pConnection, pMsg );
+    }
     if( !pMsg )
     {
         SAL_WARN( "sdremote.bluetooth", "no valid reply / timeout" );
commit f914d63ef46ccc4f62228edc394353948a1a3da4
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Jul 6 06:16:49 2014 +0200

    coverity#1202763: Unchecked return value
    
    Change-Id: I82d098f269bae2f4deb7e997b03e4267e6a86bea

diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index d778f56..ea99e0c 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -932,7 +932,7 @@ DBusHandlerResult ProfileMessageFunction
 
                 // Bluez gives us non-blocking sockets, but our code relies
                 // on blocking behaviour.
-                fcntl(nDescriptor, F_SETFL, fcntl(nDescriptor, F_GETFL) & ~O_NONBLOCK);
+                (void)fcntl(nDescriptor, F_SETFL, fcntl(nDescriptor, F_GETFL) & ~O_NONBLOCK);
 
                 SAL_INFO( "sdremote.bluetooth", "connection accepted " << nDescriptor);
                 Communicator* pCommunicator = new Communicator( new BufferedStreamSocket( nDescriptor ) );
commit 15a3cd62b0129909480e37d19c922359accdb096
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Jul 6 06:09:14 2014 +0200

    coverity#1209589: Dereference after null check
    
    Change-Id: I75d26707a7a3c0febef11b7e1c2218b8abfb7832

diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx
index 40abf39..a80746e 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -289,27 +289,30 @@ void DrawDocShell::Execute( SfxRequest& rReq )
             }
             else
             {
-                // setting the new language...
-                if (!aNewLangTxt.isEmpty())
+                if( mpViewShell )
                 {
-                    const OUString aDocumentLangPrefix("Default_");
-                    const OUString aStrNone("LANGUAGE_NONE");
-                    const OUString aStrResetLangs("RESET_LANGUAGES");
-                    sal_Int32 nPos = -1;
-                    if (-1 != (nPos = aNewLangTxt.indexOf( aDocumentLangPrefix , 0 )))
+                    // setting the new language...
+                    if (!aNewLangTxt.isEmpty())
                     {
-                        aNewLangTxt = aNewLangTxt.replaceAt( nPos, aDocumentLangPrefix.getLength(), "" );
+                        const OUString aDocumentLangPrefix("Default_");
+                        const OUString aStrNone("LANGUAGE_NONE");
+                        const OUString aStrResetLangs("RESET_LANGUAGES");
+                        sal_Int32 nPos = -1;
+                        if (-1 != (nPos = aNewLangTxt.indexOf( aDocumentLangPrefix , 0 )))
+                        {
+                            aNewLangTxt = aNewLangTxt.replaceAt( nPos, aDocumentLangPrefix.getLength(), "" );
+                        }
+                        else
+                        {
+                            break;
+                        }
+                        if (aNewLangTxt == aStrNone)
+                            lcl_setLanguage( mpViewShell->GetDoc(), OUString() );
+                        else if (aNewLangTxt == aStrResetLangs)
+                            lcl_setLanguage( mpViewShell->GetDoc(), OUString(), true );
+                        else
+                            lcl_setLanguage( mpViewShell->GetDoc(), aNewLangTxt );
                     }
-                    else
-                    {
-                        break;
-                    }
-                    if (aNewLangTxt == aStrNone)
-                        lcl_setLanguage( mpViewShell->GetDoc(), OUString() );
-                    else if (aNewLangTxt == aStrResetLangs)
-                        lcl_setLanguage( mpViewShell->GetDoc(), OUString(), true );
-                    else
-                        lcl_setLanguage( mpViewShell->GetDoc(), aNewLangTxt );
                 }
             }
         }


More information about the Libreoffice-commits mailing list