diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-15 01:57:12 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-10-17 09:53:42 +0200 |
commit | d51db77c8d87f210785a8a8c6dd875f7bacddb3c (patch) | |
tree | fd1ab208d49e85371fc9bb321539ce137bdaf719 /hwpfilter | |
parent | c8eaadb5d70f42723517bb028f363e37726be256 (diff) |
Remove some memset calls
Replace them with default initialization or calloc
Change-Id: I747f53c2ced2d0473fd5a5ede4f8520a0633dcc1
Reviewed-on: https://gerrit.libreoffice.org/80805
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r-- | hwpfilter/source/hbox.cxx | 1 | ||||
-rw-r--r-- | hwpfilter/source/hbox.h | 11 | ||||
-rw-r--r-- | hwpfilter/source/hinfo.cxx | 3 | ||||
-rw-r--r-- | hwpfilter/source/hinfo.h | 24 | ||||
-rw-r--r-- | hwpfilter/source/hwpread.cxx | 3 |
5 files changed, 14 insertions, 28 deletions
diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index d3a2033290a5..2af25d8793c3 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -354,7 +354,6 @@ Picture::Picture() , pictype(0) , ishyper(false) { - memset(&picinfo, 0, sizeof(picinfo)); } Picture::~Picture() diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h index 2c8489a14d0f..344c5594e2e0 100644 --- a/hwpfilter/source/hbox.h +++ b/hwpfilter/source/hbox.h @@ -257,7 +257,7 @@ struct FBoxStyle * [0-2][] : out/in/cell margin * [][0-3] : left/right/top/bottom */ - short margin[3][4]; // out : left, right, top, bottom + short margin[3][4] = {}; // out : left, right, top, bottom /** * Index of floating object */ @@ -280,7 +280,6 @@ struct FBoxStyle , cap_len(0) , cell(nullptr) { - memset(margin, 0, sizeof(margin)); } }; @@ -619,7 +618,7 @@ struct Picture: public FBox * Ratio of magnification or reduction. */ hunit scale[2]; - PicDef picinfo; + PicDef picinfo = {}; char reserved3[9]; std::vector<std::unique_ptr<HWPPara>> caption; @@ -827,7 +826,7 @@ struct PageNumCtrl: public HBox */ struct MailMerge: public HBox { - unsigned char field_name[20]; + unsigned char field_name[20] = {}; hchar dummy; MailMerge(); @@ -892,8 +891,8 @@ struct TocMark: public HBox */ struct IndexMark: public HBox { - hchar keyword1[60]; - hchar keyword2[60]; + hchar keyword1[60] = {}; + hchar keyword2[60] = {}; unsigned short pgno; hchar dummy; diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx index 7ca6648d8221..025e54b7a6de 100644 --- a/hwpfilter/source/hinfo.cxx +++ b/hwpfilter/source/hinfo.cxx @@ -58,9 +58,6 @@ HWPInfo::HWPInfo() , info_block_len(0) { back_info.isset = false; - memset(reserved1, 0, sizeof(reserved1)); - memset(annotation, 0, sizeof(annotation)); - memset(bordermargin, 0, sizeof(bordermargin)); } HWPInfo::~HWPInfo() diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h index 2cdaba65b2da..c415783e26a2 100644 --- a/hwpfilter/source/hinfo.h +++ b/hwpfilter/source/hinfo.h @@ -69,16 +69,16 @@ struct PaperInfo struct PaperBackInfo { char type; // 0- background color, 1 - external image, 2- embedded image - char reserved1[8]; + char reserved1[8] = {}; int luminance; /* ???? ( -100 ~ 100 ) */ int contrast; /* ???? ( -100 ~ 100 ) */ char effect; /* 0-????????, 1-????????????, 2-???? */ - char reserved2[8]; - char filename[260 + 1]; // filename - unsigned char color[3]; //0 - red, 1 - green, 2 - blue + char reserved2[8] = {}; + char filename[260 + 1] = {}; // filename + unsigned char color[3] = {}; //0 - red, 1 - green, 2 - blue unsigned short flag; /* 0 - ????????, 1 - ????????, 2 - ??????, 3 - ???????? */ int range; /* 0-????, 1-????????, 3-??????, 4-?????? */ - char reserved3[27]; + char reserved3[27] = {}; int size; std::vector<char> data; // image data bool isset; @@ -92,11 +92,6 @@ struct PaperBackInfo , size(0) , isset(false) { - memset(reserved1, 0, sizeof(reserved1)); - memset(reserved2, 0, sizeof(reserved2)); - memset(filename, 0, sizeof(filename)); - memset(color, 0, sizeof(color)); - memset(reserved3, 0, sizeof(reserved3)); } }; @@ -108,12 +103,11 @@ struct DocChainInfo { unsigned char chain_page_no; unsigned char chain_footnote_no; - unsigned char chain_filename[CHAIN_MAX_PATH]; + unsigned char chain_filename[CHAIN_MAX_PATH] = {}; DocChainInfo() : chain_page_no(0) , chain_footnote_no(0) { - memset(chain_filename, 0, sizeof(chain_filename)); } }; @@ -167,12 +161,12 @@ class DLLEXPORT HWPInfo * Sets the attribute of read-only or read/write. */ short readonly; - unsigned char reserved1[4]; + unsigned char reserved1[4] = {}; /** * Information about document chain */ DocChainInfo chain_info; - unsigned char annotation[ANNOTATION_LEN]; + unsigned char annotation[ANNOTATION_LEN] = {}; short encrypted; // unsigned char reserved2[6]; short beginpagenum; /* ?????????? ???? */ @@ -189,7 +183,7 @@ class DLLEXPORT HWPInfo /** * Information about page layout */ - hunit bordermargin[4]; + hunit bordermargin[4] = {}; short borderline; unsigned char empty_line_hide; diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index d734d58f0335..43a15635ba9d 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -745,7 +745,6 @@ MailMerge::MailMerge() : HBox(CH_MAIL_MERGE) , dummy(0) { - memset(field_name, 0, sizeof(field_name)); } bool MailMerge::Read(HWPFile & hwpf) @@ -823,8 +822,6 @@ IndexMark::IndexMark() , pgno(0) , dummy(0) { - memset(keyword1, 0, sizeof(keyword1)); - memset(keyword2, 0, sizeof(keyword2)); } bool IndexMark::Read(HWPFile & hwpf) |