]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
win32: cleanup VSSClient constructor
authorAlain Spineux <alain@baculasystems.com>
Thu, 16 Feb 2023 10:50:56 +0000 (11:50 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
- VSSClient is a pure class that has virtual methods, using a
  memset() to initialize the class is not appropriate because the object
  include a VPTR that is initialized by the constructor
- gcc 11.3 complains about that
- initializing the class the right way cannot be wrong
- Using C++11 in-member class initializers (we are not building win32 on
  centos 5 anymore but on modern platforms :-)

bacula/src/win32/filed/vss.cpp
bacula/src/win32/filed/vss.h

index cd8154aee8869160699142f133f20bca943751e5..c7e572178be7370d00940af79a20030d68288398 100644 (file)
@@ -164,7 +164,6 @@ VSSPathConvertW(const wchar_t *szFilePath, wchar_t *szShadowPath, int nBuflen)
 // Constructor
 VSSClient::VSSClient()
 {
-    memset(this, 0, sizeof(VSSClient));
     m_pAlistWriterState = New(alist(10, not_owned_by_alist));
     m_pAlistWriterInfoText = New(alist(10, owned_by_alist));
     m_uidCurrentSnapshotSet = GUID_NULL;
index c5fe4366b3211194a5c3e334e1c6c6aaad4e30a8..38cd21ced12a966528b788d701adf4c201018153 100644 (file)
@@ -74,25 +74,25 @@ private:
     virtual void QuerySnapshotSet(GUID snapshotSetID) = 0;
 
 protected:
-    JCR       *m_jcr;
+    JCR       *m_jcr = NULL;
 
-    DWORD      m_dwContext;
+    DWORD      m_dwContext = 0;
 
-    IUnknown*  m_pVssObject;
-    GUID       m_uidCurrentSnapshotSet;
+    IUnknown*  m_pVssObject = NULL;
+    GUID       m_uidCurrentSnapshotSet = GUID_NULL;
 
-    MTab      *m_VolumeList;
+    MTab      *m_VolumeList = NULL;
 
-    alist     *m_pAlistWriterState;
-    alist     *m_pAlistWriterInfoText;
+    alist     *m_pAlistWriterState = NULL;
+    alist     *m_pAlistWriterInfoText = NULL;
 
-    bool       m_bCoInitializeCalled;
-    bool       m_bCoInitializeSecurityCalled;
-    bool       m_bDuringRestore;  /* true if we are doing a restore */
-    bool       m_bBackupIsInitialized;
-    bool       m_bWriterStatusCurrent;
+    bool       m_bCoInitializeCalled = false;
+    bool       m_bCoInitializeSecurityCalled = false;
+    bool       m_bDuringRestore = false;  /* true if we are doing a restore */
+    bool       m_bBackupIsInitialized = false;
+    bool       m_bWriterStatusCurrent = false;
 
-    WCHAR     *m_metadata;
+    WCHAR     *m_metadata = NULL;
 
     void       CreateVSSVolumeList();
     void       DeleteVSSVolumeList();