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

Stephan Bergmann sbergman at redhat.com
Thu Oct 8 07:02:07 PDT 2015


 vcl/generic/print/bitmap_gfx.cxx |    6 +++---
 vcl/generic/print/common_gfx.cxx |    8 ++++----
 vcl/generic/print/glyphset.cxx   |    4 ++--
 vcl/generic/print/printerjob.cxx |    6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 3e3a37ebdc14f709fc970b291a9869bac6f9ba35
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 8 15:58:55 2015 +0200

    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

diff --git a/vcl/generic/print/bitmap_gfx.cxx b/vcl/generic/print/bitmap_gfx.cxx
index a5c9699..317b24e 100644
--- a/vcl/generic/print/bitmap_gfx.cxx
+++ b/vcl/generic/print/bitmap_gfx.cxx
@@ -489,7 +489,7 @@ PrinterGfx::DrawPS1GrayImage (const PrinterBmp& rBitmap, const Rectangle& rArea)
     nChar += psp::appendStr  (" string readhexstring pop}\n",   pGrayImage + nChar);
     nChar += psp::appendStr  ("image\n",                        pGrayImage + nChar);
 
-    WritePS (mpPageBody, pGrayImage);
+    WritePS (mpPageBody, pGrayImage, nChar);
 
     // image body
     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::appendStr  (" psp_imagedict image\n", pImage + nChar);
 
-    WritePS (mpPageBody, pImage);
+    WritePS (mpPageBody, pImage, nChar);
 }
 
 void
@@ -573,7 +573,7 @@ PrinterGfx::writePS2Colorspace(const PrinterBmp& rBitmap, psp::ImageType nType)
                 nChar += psp::appendStr ("\npsp_lzwstring\n", pImage + nChar);
             else
                 nChar += psp::appendStr ("\npsp_ascii85string\n", pImage + nChar);
-            WritePS (mpPageBody, pImage);
+            WritePS (mpPageBody, pImage, nChar);
 
             std::unique_ptr<ByteEncoder> xEncoder(mbCompressBmp ? new LZWEncoder(mpPageBody)
                                                     : new Ascii85Encoder(mpPageBody));
diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx
index 58a11ca..6ec58b6 100644
--- a/vcl/generic/print/common_gfx.cxx
+++ b/vcl/generic/print/common_gfx.cxx
@@ -802,7 +802,7 @@ PrinterGfx::PSSetFont ()
             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::appendStr (" rotate\n",  pRotate + nChar);
 
-    WritePS (mpPageBody, pRotate);
+    WritePS (mpPageBody, pRotate, nChar);
 }
 
 void
@@ -994,7 +994,7 @@ PrinterGfx::PSScale (double fScaleX, double fScaleY)
     nChar += psp::getValueOfDouble (pScale + nChar, fScaleY, 5);
     nChar += psp::appendStr        (" scale\n", pScale + nChar);
 
-    WritePS (mpPageBody, pScale);
+    WritePS (mpPageBody, pScale, nChar);
 }
 
 /* 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);
-    WritePS (mpPageBody, pPSArray);
+    WritePS (mpPageBody, pPSArray, nChar);
 }
 
 /* the DrawText equivalent, pDeltaArray may be NULL. For Type1 fonts or single byte
diff --git a/vcl/generic/print/glyphset.cxx b/vcl/generic/print/glyphset.cxx
index cf6d289..0c835e8 100644
--- a/vcl/generic/print/glyphset.cxx
+++ b/vcl/generic/print/glyphset.cxx
@@ -408,7 +408,7 @@ GlyphSet::PSDefineReencodedFont (osl::File* pOutFile, sal_Int32 nGlyphSetID)
     nSize += psp::appendStr (" psp_definefont\n",
                                   pEncodingVector + nSize);
 
-    psp::WritePS (pOutFile, pEncodingVector);
+    psp::WritePS (pOutFile, pEncodingVector, nSize);
 }
 
 OString
@@ -672,7 +672,7 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx)
         }
 
         nSize += psp::appendStr ("] def\n", pEncodingVector + nSize);
-        psp::WritePS (pOutFile, pEncodingVector);
+        psp::WritePS (pOutFile, pEncodingVector, nSize);
 
         PSDefineReencodedFont (pOutFile, nGlyphSetID);
     }
diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx
index 887ca33..fd42783 100644
--- a/vcl/generic/print/printerjob.cxx
+++ b/vcl/generic/print/printerjob.cxx
@@ -627,7 +627,7 @@ PrinterJob::StartPage (const JobData& rJobSetup)
     nChar += psp::getValueOf (mnHeightPt - mnTMarginPt, pBBox + nChar);
     nChar += psp::appendStr  ("\n",                     pBBox + nChar);
 
-    WritePS (pPageHeader, pBBox);
+    WritePS (pPageHeader, pBBox, nChar);
 
     /* #i7262# #i65491# write setup only before first page
      *  (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 ("showpage\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
 
@@ -814,7 +814,7 @@ bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob, bool bWr
                                  pTranslate + nChar);
     }
 
-    WritePS (pFile, pTranslate);
+    WritePS (pFile, pTranslate, nChar);
 
     return bSuccess;
 }


More information about the Libreoffice-commits mailing list