[Libreoffice-commits] core.git: vcl/unx

Julien Nabet serval2412 at yahoo.fr
Sun Mar 19 10:51:25 UTC 2017


 vcl/unx/generic/print/printerjob.cxx |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

New commits:
commit b3be89a02c8d90f4620cc16d1e386c6912904bd6
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Mar 18 17:53:03 2017 +0100

    cppcheck: alloca (vcl/printerjob)
    
    Remove it since useless
    Add an assert to pBuffer
    Remove an useless variable
    
    Change-Id: Icac2bc6582ca6f2bebe628e9454b9212206b269d
    Reviewed-on: https://gerrit.libreoffice.org/35408
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx
index 1f9689ac9bb2..13dd71711c2e 100644
--- a/vcl/unx/generic/print/printerjob.cxx
+++ b/vcl/unx/generic/print/printerjob.cxx
@@ -38,7 +38,6 @@
 
 #include <osl/thread.h>
 #include <osl/security.hxx>
-#include <sal/alloca.h>
 #include <sal/macros.h>
 
 #include <algorithm>
@@ -55,21 +54,18 @@ namespace psp
 bool
 AppendPS (FILE* pDst, osl::File* pSrc, unsigned char* pBuffer)
 {
-    sal_uInt32 nBlockSize = nBLOCKSIZE;
+    assert(pBuffer);
     if ((pDst == nullptr) || (pSrc == nullptr))
         return false;
 
     if (pSrc->setPos(osl_Pos_Absolut, 0) != osl::FileBase::E_None)
         return false;
 
-    if (pBuffer == nullptr)
-        pBuffer = static_cast<unsigned char*>(alloca (nBlockSize));
-
     sal_uInt64 nIn = 0;
     sal_uInt64 nOut = 0;
     do
     {
-        pSrc->read  (pBuffer, nBlockSize, nIn);
+        pSrc->read  (pBuffer, nBLOCKSIZE, nIn);
         if (nIn > 0)
             nOut = fwrite (pBuffer, 1, sal::static_int_cast<sal_uInt32>(nIn), pDst);
     }


More information about the Libreoffice-commits mailing list