hwpfilter/source/hcode.cxx | 2 ++ hwpfilter/source/hwpfile.h | 2 +- vcl/source/gdi/pdfwriter_impl2.cxx | 27 +++++++++++++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-)
New commits: commit 7443c3c27bdc3b2eba1718351269e884f6c32ed7 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 20 21:18:04 2018 +0000 forcepoint #4 Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: I569ca80267ad9b5a21da0029ba903d2a4c45a035 diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 1f40defbd425..c7fd2a4031df 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1605,11 +1605,8 @@ inline bool isSet( const Scanline i_pLine, long i_nIndex ) return (i_pLine[ i_nIndex/8 ] & (0x80 >> (i_nIndex&7))) != 0; } -long findBitRun( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_bSet ) +long findBitRunImpl( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_bSet ) { - if( i_nStartIndex < 0 ) - return i_nW; - long nIndex = i_nStartIndex; if( nIndex < i_nW ) { @@ -1671,6 +1668,24 @@ long findBitRun( const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_b return nIndex < i_nW ? nIndex : i_nW; } +long findBitRun(const Scanline i_pLine, long i_nStartIndex, long i_nW, bool i_bSet) +{ + if (i_nStartIndex < 0) + return i_nW; + + return findBitRunImpl(i_pLine, i_nStartIndex, i_nW, i_bSet); +} + +long findBitRun(const Scanline i_pLine, long i_nStartIndex, long i_nW) +{ + if (i_nStartIndex < 0) + return i_nW; + + const bool bSet = i_nStartIndex < i_nW && isSet(i_pLine, i_nStartIndex); + + return findBitRunImpl(i_pLine, i_nStartIndex, i_nW, bSet); +} + struct BitStreamState { sal_uInt8 mnBuffer; @@ -1974,7 +1989,7 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap ) long nRefIndex1 = bRefSet ? 0 : findBitRun( pRefLine, 0, nW, bRefSet ); for( ; nLineIndex < nW; ) { - long nRefIndex2 = findBitRun( pRefLine, nRefIndex1, nW, isSet( pRefLine, nRefIndex1 ) ); + long nRefIndex2 = findBitRun( pRefLine, nRefIndex1, nW ); if( nRefIndex2 >= nRunIndex1 ) { long nDiff = nRefIndex1 - nRunIndex1; @@ -2004,7 +2019,7 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap ) { // difference too large, horizontal coding // emit horz code 001 putG4Bits( 3, 0x1, aBitState ); - long nRunIndex2 = findBitRun( pCurLine, nRunIndex1, nW, isSet( pCurLine, nRunIndex1 ) ); + long nRunIndex2 = findBitRun( pCurLine, nRunIndex1, nW ); bool bWhiteFirst = ( nLineIndex + nRunIndex1 == 0 || ! isSet( pCurLine, nLineIndex ) ); putG4Span( nRunIndex1 - nLineIndex, bWhiteFirst, aBitState ); putG4Span( nRunIndex2 - nRunIndex1, ! bWhiteFirst, aBitState ); commit 611218c17de754ac6876b32a60b934a1e7daa440 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 20 16:33:38 2018 +0000 forcepoint #2 Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: Ie2b644a3c4c1c165334768eea73d451f07f97def diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index e9a088c97137..9aaa9e98f04a 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -1217,6 +1217,8 @@ hchar_string hstr2ucsstr(hchar const* hstr) hchar_string kstr2hstr(unsigned char const* src) { hchar_string ret; + if (!src) + return ret; for (unsigned int i = 0; src[i] != '\0' ; i++) { if ( src[i] < 127 ) commit e66edca7e21bfee9c0c1a431bf31a1e4818459f4 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Feb 20 16:26:21 2018 +0000 forcepoint #1 Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: Ic5e9a9d0f8f8d35cb6b39e68338ba029948a4ce0 diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index d58faa569a7b..3fab3a5b3dd4 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -227,7 +227,7 @@ class DLLEXPORT HWPFile HWPInfo& GetHWPInfo(void) { return _hwpInfo; } HWPFont& GetHWPFont(void) { return _hwpFont; } HWPStyle& GetHWPStyle(void) { return _hwpStyle; } - HWPPara *GetFirstPara(void) { return plist.front(); } + HWPPara *GetFirstPara(void) { return !plist.empty() ? plist.front() : nullptr; } EmPicture *GetEmPicture(Picture *pic); EmPicture *GetEmPictureByName(char * name); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits