summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-03 21:56:19 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-01-25 11:18:50 +0100
commitf9cb7e5274befe0b422716fa55f3829f63f33b90 (patch)
tree55b457ad7e6c77c96b62aa4baa721b20e1bcd5e1
parent419fdda2475293ae06ad0c05bde570345456645c (diff)
ofz#26122 allow NINSIZE input full elements
Change-Id: Ifbde8fc055a91e23db08508a34ce4664d2f1f96f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103906 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit fb0c3f9d8964f8c0f40238559c32d9d73cba6b55)
-rw-r--r--vcl/source/font/fontcharmap.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx
index 17f9065261ab..11a6a366e208 100644
--- a/vcl/source/font/fontcharmap.cxx
+++ b/vcl/source/font/fontcharmap.cxx
@@ -333,7 +333,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
static const int NINSIZE = 64;
static const int NOUTSIZE = 64;
- sal_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 )
@@ -344,25 +345,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<sal_Char>(cMin >> 8);
+ cCharsInp.push_back(static_cast<char>(cMin >> 8));
if( (cMin >= 0x0100) || (cMin < 0x00A0) )
- cCharsInp[ j++ ] = static_cast<sal_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] );
}
}