[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/source
Caolán McNamara
caolanm at redhat.com
Tue Jun 26 20:10:30 UTC 2018
sw/source/core/inc/scriptinfo.hxx | 4 ++--
sw/source/core/text/itradj.cxx | 13 +++++++------
sw/source/core/text/porlay.cxx | 4 ++--
3 files changed, 11 insertions(+), 10 deletions(-)
New commits:
commit dea1fae8502d2614f57ed94a967db1cb36eb4a5e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 26 12:45:19 2018 +0100
forcepoint#49 survive more kashidas than expected
Change-Id: I66aa5389b3d80d1fe2f6898e8920eb37ca064381
contains...
can use simple vector here
Change-Id: Ia1565a946f9ac6d607fb6802b19e561fc9afc66d
and...
pass vector as arg, rather than raw pointer
Change-Id: Id97df4cce7a2ce28f1a5e7cc30e27cf4ce9261d1
Reviewed-on: https://gerrit.libreoffice.org/56476
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index 9386f1309e8e..e3d64b1627f3 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -306,11 +306,11 @@ public:
/** retrieves kashida opportunities for a given text range.
- pKashidaPositions: buffer to receive the char indices of the
+ rKashidaPositions: buffer to receive the char indices of the
kashida opportunities relative to the paragraph
*/
void GetKashidaPositions(TextFrameIndex nStt, TextFrameIndex nLen,
- TextFrameIndex* pKashidaPosition);
+ std::vector<TextFrameIndex>& rKashidaPosition);
/** Use regular blank justification instead of kashdida justification for the given line of text.
nStt Start char index of the line referring to the paragraph.
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 76e115318422..8383292105bc 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -132,9 +132,10 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf,
// kashida positions found in SwScriptInfo are not necessarily valid in every font
// if two characters are replaced by a ligature glyph, there will be no place for a kashida
- std::unique_ptr<TextFrameIndex[]> pKashidaPos(new TextFrameIndex[rKashidas]);
- std::unique_ptr<TextFrameIndex[]> pKashidaPosDropped(new TextFrameIndex[rKashidas]);
- rSI.GetKashidaPositions ( nIdx, rItr.GetLength(), pKashidaPos.get() );
+ std::vector<TextFrameIndex> aKashidaPos;
+ rSI.GetKashidaPositions(nIdx, rItr.GetLength(), aKashidaPos);
+ assert(aKashidaPos.size() >= static_cast<size_t>(rKashidas));
+ std::vector<TextFrameIndex> aKashidaPosDropped(aKashidaPos.size());
sal_Int32 nKashidaIdx = 0;
while ( rKashidas && nIdx < nEnd )
{
@@ -165,12 +166,12 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& rInf,
nKashidasDropped = rInf.GetOut()->ValidateKashidas(
rInf.GetText(), sal_Int32(nIdx), sal_Int32(nNext - nIdx),
nKashidasInAttr,
- reinterpret_cast<sal_Int32*>(pKashidaPos.get() + nKashidaIdx),
- reinterpret_cast<sal_Int32*>(pKashidaPosDropped.get()));
+ reinterpret_cast<sal_Int32*>(aKashidaPos.data() + nKashidaIdx),
+ reinterpret_cast<sal_Int32*>(aKashidaPosDropped.data()));
rInf.GetOut()->SetLayoutMode ( nOldLayout );
if ( nKashidasDropped )
{
- rSI.MarkKashidasInvalid(nKashidasDropped, pKashidaPosDropped.get());
+ rSI.MarkKashidasInvalid(nKashidasDropped, aKashidaPosDropped.data());
rKashidas -= nKashidasDropped;
nGluePortion -= TextFrameIndex(nKashidasDropped);
}
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 06baf68a148c..11e78a915433 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1977,7 +1977,7 @@ void SwScriptInfo::MarkKashidaInvalid(size_t const nKashPos)
// retrieve the kashida positions in the given text range
void SwScriptInfo::GetKashidaPositions(
TextFrameIndex const nStt, TextFrameIndex const nLen,
- TextFrameIndex *const pKashidaPosition)
+ std::vector<TextFrameIndex>& rKashidaPosition)
{
size_t nCntKash = 0;
while( nCntKash < CountKashida() )
@@ -1994,7 +1994,7 @@ void SwScriptInfo::GetKashidaPositions(
{
if ( nEnd <= GetKashida( nCntKashEnd ) )
break;
- pKashidaPosition [ nCntKashEnd - nCntKash ] = GetKashida ( nCntKashEnd );
+ rKashidaPosition.push_back(GetKashida(nCntKashEnd));
nCntKashEnd++;
}
}
More information about the Libreoffice-commits
mailing list