[Libreoffice-commits] .: 2 commits - svl/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Sep 13 05:36:38 PDT 2011


 svl/source/svdde/ddecli.cxx |    2 +-
 svl/source/svdde/ddeimp.hxx |   15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 006b71d4e9caebb9a0f76688f129b490aa778188
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 13 13:35:35 2011 +0100

    move init into default ctor, and make non-copyable

diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index fa01928..0edab7f 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -43,14 +43,6 @@
 DdeInstData* ImpInitInstData()
 {
     DdeInstData* pData = new DdeInstData;
-    pData->nRefCount = 0;
-    pData->aConnections.clear();
-    pData->hCurConvSvr = 0;
-    pData->hDdeInstSvr = 0;
-    pData->nInstanceSvr = 0;
-    pData->pServicesSvr = NULL;
-    pData->hDdeInstCli = 0;
-    pData-> nInstanceCli = 0;
 
     DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE );
     *ppInst = pData;
diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx
index d3b7d84..a6f7cd5 100644
--- a/svl/source/svdde/ddeimp.hxx
+++ b/svl/source/svdde/ddeimp.hxx
@@ -34,6 +34,7 @@
 
 #include <tools/string.hxx>
 #include <tools/shl.hxx>
+#include <boost/noncopyable.hpp>
 #include <vector>
 
 class DdeService;
@@ -122,8 +123,9 @@ struct DdeDataImp
 class DdeConnection;
 class DdeServices;
 
-struct DdeInstData
+class DdeInstData : private boost::noncopyable
 {
+public:
     sal_uInt16          nRefCount;
     std::vector<DdeConnection*> aConnections;
     // Server
@@ -134,6 +136,17 @@ struct DdeInstData
     // Client
     DWORD           hDdeInstCli;
     short           nInstanceCli;
+
+    DdeInstData()
+        : nRefCount(0)
+        , hCurConvSvr(0)
+        , hDdeInstSvr(0)
+        , nInstanceSvr(0)
+        , pServicesSvr(NULL)
+        , hDdeInstCli(0)
+        , nInstanceCli(0)
+    {
+    }
 };
 
 #ifndef SHL_SVDDE
commit 2240a98e68db581993621451701e3e47495895e4
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Sep 11 13:27:43 2011 +0200

    wrong initialization of DdeInstData with memset despite std::vector
    
    Thanks cppchecker for  detecting this

diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index 3f6ffaf..fa01928 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -43,7 +43,15 @@
 DdeInstData* ImpInitInstData()
 {
     DdeInstData* pData = new DdeInstData;
-    memset( pData,0,sizeof(DdeInstData) );
+    pData->nRefCount = 0;
+    pData->aConnections.clear();
+    pData->hCurConvSvr = 0;
+    pData->hDdeInstSvr = 0;
+    pData->nInstanceSvr = 0;
+    pData->pServicesSvr = NULL;
+    pData->hDdeInstCli = 0;
+    pData-> nInstanceCli = 0;
+
     DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE );
     *ppInst = pData;
     return pData;


More information about the Libreoffice-commits mailing list