diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-10 11:36:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-10 14:03:35 +0000 |
commit | 9960002118fda6515c6985bc2908a69c0568a71d (patch) | |
tree | 3926d9f283f4ed0004a1171387272cb85a29b138 /vcl | |
parent | 9050cc641a7449e270a26bcaeae4f75d4b862d3f (diff) |
coverity#1079165 Uninitialized scalar variable
Change-Id: I49284d409bbe678e1e018c9d9502d79db5553faa
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 9a096039487c..4cfbca205619 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3055,8 +3055,8 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, sal_Int32* pEncToUnicodeIndex, int nGlyphs ) { - int nMapped = 0, n = 0; - for( n = 0; n < nGlyphs; n++ ) + int nMapped = 0; + for (int n = 0; n < nGlyphs; ++n) if( pUnicodes[pEncToUnicodeIndex[n]] && pUnicodesPerGlyph[n] ) nMapped++; @@ -3083,7 +3083,7 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8* pEncoding, "endcodespacerange\n" ); int nCount = 0; - for( n = 0; n < nGlyphs; n++ ) + for (int n = 0; n < nGlyphs; ++n) { if( pUnicodes[pEncToUnicodeIndex[n]] && pUnicodesPerGlyph[n] ) { @@ -8509,8 +8509,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool sal_uInt8 pMappedGlyphs[nMaxGlyphs]; sal_Int32 pMappedFontObjects[nMaxGlyphs]; std::vector<sal_Ucs> aUnicodes; - aUnicodes.reserve( nMaxGlyphs ); - sal_Int32 pUnicodesPerGlyph[nMaxGlyphs]; + aUnicodes.reserve(nMaxGlyphs); + std::vector<sal_Int32> aUnicodesPerGlyph; + aUnicodes.reserve(nMaxGlyphs); bool bVertical = m_aCurrentPDFState.m_aFont.IsVertical(); int nGlyphs; int nIndex = 0; @@ -8644,7 +8645,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool for( int i = 0; i < nGlyphs; i++ ) { // default case: 1 glyph is one unicode - pUnicodesPerGlyph[i] = 1; + aUnicodesPerGlyph.push_back(1); if (pGlyphs[i]->mnCharPos >= nMinCharPos && pGlyphs[i]->mnCharPos <= nMaxCharPos) { int nChars = 1; @@ -8662,7 +8663,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool } else if (nChars == 0) nChars = 1; - pUnicodesPerGlyph[i] = nChars; + aUnicodesPerGlyph.back() = nChars; for( int n = 0; n < nChars; n++ ) aUnicodes.push_back( rText[ start + n ] ); } @@ -8677,7 +8678,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool // mapping is possible } - registerGlyphs( nGlyphs, pGlyphs, pGlyphWidths, aUnicodes.data(), pUnicodesPerGlyph, pMappedGlyphs, pMappedFontObjects, pFallbackFonts ); + registerGlyphs( nGlyphs, pGlyphs, pGlyphWidths, aUnicodes.data(), aUnicodesPerGlyph.data(), pMappedGlyphs, pMappedFontObjects, pFallbackFonts ); for( int i = 0; i < nGlyphs; i++ ) { |