[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 5 13:32:30 UTC 2020
vcl/source/font/fontcharmap.cxx | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
New commits:
commit 9a6e63efc564372594cd70444e81e411df14c9df
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 3 21:56:19 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Oct 5 15:31:56 2020 +0200
ofz#26122 allow NINSIZE input full elements
Change-Id: Ifbde8fc055a91e23db08508a34ce4664d2f1f96f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103802
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx
index c29fd3cdbd22..af85334514aa 100644
--- a/vcl/source/font/fontcharmap.cxx
+++ b/vcl/source/font/fontcharmap.cxx
@@ -332,7 +332,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
static const int NINSIZE = 64;
static const int NOUTSIZE = 64;
- char cCharsInp[ NINSIZE ];
+ std::vector<char> cCharsInp;
+ cCharsInp.reserve(NINSIZE);
sal_Unicode cCharsOut[ NOUTSIZE ];
sal_UCS4* pCP = pCodePairs;
for( int i = 0; i < nRangeCount; ++i )
@@ -343,25 +344,26 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
// input codepoints in 0..SAL_MAX_UINT16 range
while (cMin < cEnd && cMin <= SAL_MAX_UINT16)
{
- int j = 0;
- for(; (cMin < cEnd) && (j < NINSIZE); ++cMin )
+ for (int j = 0; (cMin < cEnd) && (j < NINSIZE); ++cMin, ++j)
{
if( cMin >= 0x0100 )
- cCharsInp[ j++ ] = static_cast<char>(cMin >> 8);
+ cCharsInp.push_back(static_cast<char>(cMin >> 8));
if( (cMin >= 0x0100) || (cMin < 0x00A0) )
- cCharsInp[ j++ ] = static_cast<char>(cMin);
+ cCharsInp.push_back(static_cast<char>(cMin));
}
sal_uInt32 nCvtInfo;
sal_Size nSrcCvtBytes;
int nOutLen = rtl_convertTextToUnicode(
aConverter, aCvtContext,
- cCharsInp, j, cCharsOut, NOUTSIZE,
+ cCharsInp.data(), cCharsInp.size(), cCharsOut, NOUTSIZE,
RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE
| RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE,
&nCvtInfo, &nSrcCvtBytes );
- for( j = 0; j < nOutLen; ++j )
+ cCharsInp.clear();
+
+ for (int j = 0; j < nOutLen; ++j)
aSupportedCodePoints.insert( cCharsOut[j] );
}
}
More information about the Libreoffice-commits
mailing list