Kaydet (Commit) 2a727074 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use std::fill instead of memset

...to avoid GCC 8 -Werror=class-memaccess ("clearing an object of non-trivial
type ‘struct SwSrchChrAttr’").  Similar to
<https://gerrit.libreoffice.org/#/c/48488/> "Allocate ImpXPolygon::pPointAry as
a true Point[]", std::fill appears to produce adequate code here with recent
compilers.

Change-Id: I3ee0bc15e852b80e0429c8e0a4bc48424af9c5a3
Reviewed-on: https://gerrit.libreoffice.org/48518Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst cae452a1
......@@ -43,6 +43,8 @@
#include <pamtyp.hxx>
#include <swundo.hxx>
#include <boost/optional.hpp>
#include <algorithm>
#include <memory>
using namespace ::com::sun::star;
......@@ -183,6 +185,8 @@ struct SwSrchChrAttr
sal_Int32 nStt;
sal_Int32 nEnd;
SwSrchChrAttr(): nWhich(0), nStt(0), nEnd(0) {}
SwSrchChrAttr( const SfxPoolItem& rItem,
sal_Int32 nStart, sal_Int32 nAnyEnd )
: nWhich( rItem.Which() ), nStt( nStart ), nEnd( nAnyEnd )
......@@ -253,8 +257,8 @@ SwAttrCheckArr::~SwAttrCheckArr()
void SwAttrCheckArr::SetNewSet( const SwTextNode& rTextNd, const SwPaM& rPam )
{
memset( pFndArr, 0, nArrLen * sizeof(SwSrchChrAttr) );
memset( pStackArr, 0, nArrLen * sizeof(SwSrchChrAttr) );
std::fill(pFndArr, pFndArr + nArrLen, SwSrchChrAttr());
std::fill(pStackArr, pStackArr + nArrLen, SwSrchChrAttr());
nFound = 0;
nStackCnt = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment