[Libreoffice-commits] core.git: Branch 'libreoffice-5-4-0' - hwpfilter/source

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Jul 21 04:17:24 UTC 2017


 hwpfilter/source/hinfo.cxx  |   18 ++++++++++++++++++
 hwpfilter/source/hinfo.h    |   24 ++++++++++++++++++++----
 hwpfilter/source/hpara.cxx  |    1 -
 hwpfilter/source/hstyle.cxx |    2 +-
 4 files changed, 39 insertions(+), 6 deletions(-)

New commits:
commit 2f75ce44545fd4b424e9257a35d6281d5ecb3b8f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jul 16 03:17:29 2017 +0200

    don't use memset on structure with std::shared_ptr member
    
    Change-Id: Ie6033b9820435bb6a45aa70f9a48115000571e0f
    Reviewed-on: https://gerrit.libreoffice.org/40004
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit c7fe625c8d41f648f89765abc40bb7b8fd4ed12a)
    Reviewed-on: https://gerrit.libreoffice.org/40010
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx
index 2e5d4b1c9a16..26e2847ff048 100644
--- a/hwpfilter/source/hinfo.cxx
+++ b/hwpfilter/source/hinfo.cxx
@@ -194,6 +194,24 @@ bool HWPSummary::Read(HWPFile & hwpf)
     return (!hwpf.State());
 }
 
+ParaShape::ParaShape()
+    : index(0)
+    , left_margin(0)
+    , right_margin(0)
+    , indent(0)
+    , lspacing(0)
+    , pspacing_prev(0)
+    , pspacing_next(0)
+    , condense(0)
+    , arrange_type(0)
+    , shade(0)
+    , outline(0)
+    , outline_continue(0)
+    , pagebreak(0)
+{
+    reserved[0] = 0;
+    reserved[1] = 0;
+}
 
 void ParaShape::Read(HWPFile & hwpf)
 {
diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h
index 7adc9e94ac30..590b5f962e7c 100644
--- a/hwpfilter/source/hinfo.h
+++ b/hwpfilter/source/hinfo.h
@@ -242,23 +242,37 @@ struct CharShape
 /**
  * @short Tab properties
  */
-typedef struct
+struct TabSet
 {
     unsigned char type;
     unsigned char dot_continue;
     hunit     position;
-} TabSet;
+    TabSet()
+        : type(0)
+        , dot_continue(0)
+        , position(0)
+    {
+    }
+};
 
 /**
  * @short Column properties
  */
-typedef struct
+struct ColumnDef
 {
     unsigned char ncols;
     unsigned char separator;
     hunit     spacing;
     hunit     columnlen, columnlen0;
-} ColumnDef;
+    ColumnDef()
+        : ncols(0)
+        , separator(0)
+        , spacing(0)
+        , columnlen(0)
+        , columnlen0(0)
+    {
+    }
+};
 
 /**
  * @short Style of paragraph
@@ -287,6 +301,8 @@ struct ParaShape
     unsigned char pagebreak;
 
     void  Read(HWPFile &);
+
+    ParaShape();
 };
 #endif // INCLUDED_HWPFILTER_SOURCE_HINFO_H
 
diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx
index f93e6b5c120f..397a24f84a16 100644
--- a/hwpfilter/source/hpara.cxx
+++ b/hwpfilter/source/hpara.cxx
@@ -79,7 +79,6 @@ HWPPara::HWPPara()
     , pshape(new ParaShape)
 {
     memset(cshape.get(), 0, sizeof(CharShape));
-    memset(pshape.get(), 0, sizeof(ParaShape));
 }
 
 HWPPara::~HWPPara()
diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx
index 6c29a500d2b5..d43b3c8fc785 100644
--- a/hwpfilter/source/hstyle.cxx
+++ b/hwpfilter/source/hstyle.cxx
@@ -108,7 +108,7 @@ void HWPStyle::SetParaShape(int n, ParaShape * pshapep)
         if (pshapep)
             DATA[n].pshape = *pshapep;
         else
-            memset(&DATA[n].pshape, 0, sizeof(ParaShape));
+            DATA[n].pshape = ParaShape();
     }
 }
 


More information about the Libreoffice-commits mailing list