diff options
-rw-r--r-- | vcl/source/font/fontcharmap.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx index 0f638beff51c..5ddd4a0fd5f1 100644 --- a/vcl/source/font/fontcharmap.cxx +++ b/vcl/source/font/fontcharmap.cxx @@ -294,7 +294,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 ) @@ -303,25 +304,26 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) sal_UCS4 cEnd = *(pCP++); while( cMin < cEnd ) { - 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] ); } } |