vcl/source/gdi/pdfwriter_impl.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit d22d862ce6abd28a5859571b465459489da430d8
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Nov 21 12:15:34 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Nov 21 13:51:36 2024 +0100

    tdf#163486: PVS: Expression is always true
    
    Since
    commit 47a173edb603538521a035157efb6ef684238087
    Author: Noel Grandin <noelgran...@gmail.com>
    Date:   Sat Sep 15 18:36:08 2018 +0200
    
        use std::vector in PDFWriterImpl for encryption buffer
    
    V547    Expression 'buffOK' is always true.
    
    Change-Id: I66b0f4de18cfca398da0b4091d980b259f5e9dfe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176916
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 88a9853ca392..5adb2e53358a 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1661,16 +1661,14 @@ bool PDFWriterImpl::writeBufferBytes( const void* 
pBuffer, sal_uInt64 nBytes )
     }
     else
     {
-        bool  buffOK = true;
         if (m_aPDFEncryptor.m_bEncryptThisStream)
         {
             /* implement the encryption part of the PDF spec encryption 
algorithm 3.1 */
             m_vEncryptionBuffer.resize(nBytes);
-            if (buffOK)
-                rtl_cipher_encodeARCFOUR(m_aPDFEncryptor.m_aCipher, pBuffer, 
static_cast<sal_Size>(nBytes), m_vEncryptionBuffer.data(), 
static_cast<sal_Size>(nBytes));
+            rtl_cipher_encodeARCFOUR(m_aPDFEncryptor.m_aCipher, pBuffer, 
static_cast<sal_Size>(nBytes), m_vEncryptionBuffer.data(), 
static_cast<sal_Size>(nBytes));
         }
 
-        const void* pWriteBuffer = (m_aPDFEncryptor.m_bEncryptThisStream && 
buffOK) ? m_vEncryptionBuffer.data()  : pBuffer;
+        const void* pWriteBuffer = m_aPDFEncryptor.m_bEncryptThisStream ? 
m_vEncryptionBuffer.data()  : pBuffer;
         m_DocDigest.update(static_cast<unsigned char const*>(pWriteBuffer), 
static_cast<sal_uInt32>(nBytes));
 
         if (m_aFile.write(pWriteBuffer, nBytes, nWritten) != osl::File::E_None)

Reply via email to