diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-03-18 17:53:03 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-19 10:51:04 +0000 |
commit | b3be89a02c8d90f4620cc16d1e386c6912904bd6 (patch) | |
tree | b4fa81c494c5e5f1271982daf6ed7c0bcca41547 /vcl | |
parent | fd697550825a091d9ee21c16ef25e011b1f201c4 (diff) |
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@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/generic/print/printerjob.cxx | 8 |
1 files changed, 2 insertions, 6 deletions
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); } |