[Libreoffice-commits] core.git: sc/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Mon Dec 4 07:08:15 UTC 2017
sc/source/ui/inc/printfun.hxx | 2 +-
sc/source/ui/view/printfun.cxx | 37 ++++++++++---------------------------
2 files changed, 11 insertions(+), 28 deletions(-)
New commits:
commit 75702b13961e545809ce1f2b5a45787f42ffcbc6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat Dec 2 01:12:23 2017 +0900
Convert from unique_ptr<bool[]> to vector<bool>
Change-Id: Ie8b6a7bb3c3a624ece42bf57c93fe76f1f4ad3db
Reviewed-on: https://gerrit.libreoffice.org/45688
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 6926a0b5b9fe..0bdd59cbb6eb 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -103,7 +103,7 @@ private:
SCROW nStartRow;
SCROW nEndRow;
size_t nPagesX;
- std::unique_ptr<bool[]> pHidden;
+ std::vector<bool> aHidden;
//! Cache Number of really visible?
public:
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 8ee6dd233ab8..44b0c9a32d7c 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -101,11 +101,8 @@ ScPageRowEntry::ScPageRowEntry(const ScPageRowEntry& r)
nStartRow = r.nStartRow;
nEndRow = r.nEndRow;
nPagesX = r.nPagesX;
- if (r.pHidden && nPagesX)
- {
- pHidden.reset( new bool[nPagesX] );
- memcpy( pHidden.get(), r.pHidden.get(), nPagesX * sizeof(bool) );
- }
+ aHidden = r.aHidden;
+ aHidden.resize(nPagesX, false);
}
ScPageRowEntry& ScPageRowEntry::operator=(const ScPageRowEntry& r)
@@ -113,25 +110,15 @@ ScPageRowEntry& ScPageRowEntry::operator=(const ScPageRowEntry& r)
nStartRow = r.nStartRow;
nEndRow = r.nEndRow;
nPagesX = r.nPagesX;
- if (r.pHidden && nPagesX)
- {
- pHidden.reset( new bool[nPagesX] );
- memcpy( pHidden.get(), r.pHidden.get(), nPagesX * sizeof(bool) );
- }
- else
- pHidden.reset();
-
+ aHidden = r.aHidden;
+ aHidden.resize(nPagesX, false);
return *this;
}
void ScPageRowEntry::SetPagesX(size_t nNew)
{
- if (pHidden)
- {
- OSL_FAIL("SetPagesX not after SetHidden");
- pHidden.reset();
- }
nPagesX = nNew;
+ aHidden.resize(nPagesX, false);
}
void ScPageRowEntry::SetHidden(size_t nX)
@@ -142,28 +129,24 @@ void ScPageRowEntry::SetHidden(size_t nX)
--nPagesX;
else
{
- if (!pHidden)
- {
- pHidden.reset( new bool[nPagesX] );
- memset( pHidden.get(), false, nPagesX * sizeof(bool) );
- }
- pHidden[nX] = true;
+ aHidden.resize(nPagesX, false);
+ aHidden[nX] = true;
}
}
}
bool ScPageRowEntry::IsHidden(size_t nX) const
{
- return nX>=nPagesX || ( pHidden && pHidden[nX] ); //! inline?
+ return nX >= nPagesX || aHidden[nX]; //! inline?
}
size_t ScPageRowEntry::CountVisible() const
{
- if ( pHidden )
+ if (!aHidden.empty())
{
size_t nVis = 0;
for (size_t i=0; i<nPagesX; i++)
- if (!pHidden[i])
+ if (!aHidden[i])
++nVis;
return nVis;
}
More information about the Libreoffice-commits
mailing list