Call WritePS with length argument, where known

...which also avoids clang-analyzer-deadcode.DeadStores on the final update of
the length variable when assembling the data prior to the call

Change-Id: I046b1fa253e1d26a09c5095516e336b471b2e2f0
This commit is contained in:
Stephan Bergmann
2015-10-08 15:58:55 +02:00
parent 57cfc82a14
commit 3e3a37ebdc
4 changed files with 12 additions and 12 deletions

View File

@@ -489,7 +489,7 @@ PrinterGfx::DrawPS1GrayImage (const PrinterBmp& rBitmap, const Rectangle& rArea)
nChar += psp::appendStr (" string readhexstring pop}\n", pGrayImage + nChar); nChar += psp::appendStr (" string readhexstring pop}\n", pGrayImage + nChar);
nChar += psp::appendStr ("image\n", pGrayImage + nChar); nChar += psp::appendStr ("image\n", pGrayImage + nChar);
WritePS (mpPageBody, pGrayImage); WritePS (mpPageBody, pGrayImage, nChar);
// image body // image body
std::unique_ptr<HexEncoder> xEncoder(new HexEncoder (mpPageBody)); std::unique_ptr<HexEncoder> xEncoder(new HexEncoder (mpPageBody));
@@ -540,7 +540,7 @@ PrinterGfx::writePS2ImageHeader (const Rectangle& rArea, psp::ImageType nType)
nChar += psp::getValueOf (nCompressType, pImage + nChar); nChar += psp::getValueOf (nCompressType, pImage + nChar);
nChar += psp::appendStr (" psp_imagedict image\n", pImage + nChar); nChar += psp::appendStr (" psp_imagedict image\n", pImage + nChar);
WritePS (mpPageBody, pImage); WritePS (mpPageBody, pImage, nChar);
} }
void void
@@ -573,7 +573,7 @@ PrinterGfx::writePS2Colorspace(const PrinterBmp& rBitmap, psp::ImageType nType)
nChar += psp::appendStr ("\npsp_lzwstring\n", pImage + nChar); nChar += psp::appendStr ("\npsp_lzwstring\n", pImage + nChar);
else else
nChar += psp::appendStr ("\npsp_ascii85string\n", pImage + nChar); nChar += psp::appendStr ("\npsp_ascii85string\n", pImage + nChar);
WritePS (mpPageBody, pImage); WritePS (mpPageBody, pImage, nChar);
std::unique_ptr<ByteEncoder> xEncoder(mbCompressBmp ? new LZWEncoder(mpPageBody) std::unique_ptr<ByteEncoder> xEncoder(mbCompressBmp ? new LZWEncoder(mpPageBody)
: new Ascii85Encoder(mpPageBody)); : new Ascii85Encoder(mpPageBody));

View File

@@ -802,7 +802,7 @@ PrinterGfx::PSSetFont ()
nChar += psp::appendStr (" 0 0] makefont setfont\n", pSetFont + nChar); nChar += psp::appendStr (" 0 0] makefont setfont\n", pSetFont + nChar);
} }
WritePS (mpPageBody, pSetFont); WritePS (mpPageBody, pSetFont, nChar);
} }
} }
@@ -827,7 +827,7 @@ PrinterGfx::PSRotate (sal_Int32 nAngle)
nChar += psp::getValueOf (nTenthAngle, pRotate + nChar); nChar += psp::getValueOf (nTenthAngle, pRotate + nChar);
nChar += psp::appendStr (" rotate\n", pRotate + nChar); nChar += psp::appendStr (" rotate\n", pRotate + nChar);
WritePS (mpPageBody, pRotate); WritePS (mpPageBody, pRotate, nChar);
} }
void void
@@ -994,7 +994,7 @@ PrinterGfx::PSScale (double fScaleX, double fScaleY)
nChar += psp::getValueOfDouble (pScale + nChar, fScaleY, 5); nChar += psp::getValueOfDouble (pScale + nChar, fScaleY, 5);
nChar += psp::appendStr (" scale\n", pScale + nChar); nChar += psp::appendStr (" scale\n", pScale + nChar);
WritePS (mpPageBody, pScale); WritePS (mpPageBody, pScale, nChar);
} }
/* psshowtext helper routines: draw an hex string for show/xshow */ /* psshowtext helper routines: draw an hex string for show/xshow */
@@ -1044,7 +1044,7 @@ PrinterGfx::PSDeltaArray (const sal_Int32 *pArray, sal_Int16 nEntries)
} }
nChar += psp::appendStr (" 0]\n", pPSArray + nChar); nChar += psp::appendStr (" 0]\n", pPSArray + nChar);
WritePS (mpPageBody, pPSArray); WritePS (mpPageBody, pPSArray, nChar);
} }
/* the DrawText equivalent, pDeltaArray may be NULL. For Type1 fonts or single byte /* the DrawText equivalent, pDeltaArray may be NULL. For Type1 fonts or single byte

View File

@@ -408,7 +408,7 @@ GlyphSet::PSDefineReencodedFont (osl::File* pOutFile, sal_Int32 nGlyphSetID)
nSize += psp::appendStr (" psp_definefont\n", nSize += psp::appendStr (" psp_definefont\n",
pEncodingVector + nSize); pEncodingVector + nSize);
psp::WritePS (pOutFile, pEncodingVector); psp::WritePS (pOutFile, pEncodingVector, nSize);
} }
OString OString
@@ -672,7 +672,7 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx)
} }
nSize += psp::appendStr ("] def\n", pEncodingVector + nSize); nSize += psp::appendStr ("] def\n", pEncodingVector + nSize);
psp::WritePS (pOutFile, pEncodingVector); psp::WritePS (pOutFile, pEncodingVector, nSize);
PSDefineReencodedFont (pOutFile, nGlyphSetID); PSDefineReencodedFont (pOutFile, nGlyphSetID);
} }

View File

@@ -627,7 +627,7 @@ PrinterJob::StartPage (const JobData& rJobSetup)
nChar += psp::getValueOf (mnHeightPt - mnTMarginPt, pBBox + nChar); nChar += psp::getValueOf (mnHeightPt - mnTMarginPt, pBBox + nChar);
nChar += psp::appendStr ("\n", pBBox + nChar); nChar += psp::appendStr ("\n", pBBox + nChar);
WritePS (pPageHeader, pBBox); WritePS (pPageHeader, pBBox, nChar);
/* #i7262# #i65491# write setup only before first page /* #i7262# #i65491# write setup only before first page
* (to %%Begin(End)Setup, instead of %%Begin(End)PageSetup) * (to %%Begin(End)Setup, instead of %%Begin(End)PageSetup)
@@ -666,7 +666,7 @@ PrinterJob::EndPage ()
nChar = psp::appendStr ("grestore grestore\n", pTrailer); nChar = psp::appendStr ("grestore grestore\n", pTrailer);
nChar += psp::appendStr ("showpage\n", pTrailer + nChar); nChar += psp::appendStr ("showpage\n", pTrailer + nChar);
nChar += psp::appendStr ("%%PageTrailer\n\n", pTrailer + nChar); nChar += psp::appendStr ("%%PageTrailer\n\n", pTrailer + nChar);
WritePS (pPageBody, pTrailer); WritePS (pPageBody, pTrailer, nChar);
// this page is done for now, close it to avoid having too many open fd's // this page is done for now, close it to avoid having too many open fd's
@@ -814,7 +814,7 @@ bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob, bool bWr
pTranslate + nChar); pTranslate + nChar);
} }
WritePS (pFile, pTranslate); WritePS (pFile, pTranslate, nChar);
return bSuccess; return bSuccess;
} }