summaryrefslogtreecommitdiff
path: root/vcl/generic
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2015-01-17 00:59:10 +0100
committerNoel Grandin <noelgrandin@gmail.com>2015-01-19 07:21:02 +0000
commitec9c7ebb575b592e188c5f6b545570b11744d063 (patch)
treee84517c0d8bfb9d004752a8b06c3812a181a7130 /vcl/generic
parent54defd1bd3359c95e45891c7294847d0cebca753 (diff)
fdo#39440 vcl: reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: Ib6b9651b828287665f7248052855f0da2779806e Reviewed-on: https://gerrit.libreoffice.org/13968 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl/generic')
-rw-r--r--vcl/generic/fontmanager/parseAFM.cxx18
-rw-r--r--vcl/generic/print/bitmap_gfx.cxx3
-rw-r--r--vcl/generic/print/text_gfx.cxx3
3 files changed, 9 insertions, 15 deletions
diff --git a/vcl/generic/fontmanager/parseAFM.cxx b/vcl/generic/fontmanager/parseAFM.cxx
index b3a7f7ae8144..6d341ba33516 100644
--- a/vcl/generic/fontmanager/parseAFM.cxx
+++ b/vcl/generic/fontmanager/parseAFM.cxx
@@ -360,13 +360,12 @@ static int parseGlobals( FileInputStream* fp, GlobalFontInfo* gfi )
{
bool cont = true, save = (gfi != NULL);
int error = ok;
- char *keyword;
int direction = -1;
int tokenlen;
while (cont)
{
- keyword = token(fp, tokenlen);
+ char *keyword = token(fp, tokenlen);
if (keyword == NULL)
/* Have reached an early and unexpected EOF. */
@@ -564,11 +563,10 @@ static int parseCharWidths( FileInputStream* fp, int* cwi)
{
bool cont = true, save = (cwi != NULL);
int pos = 0, error = ok, tokenlen;
- char *keyword;
while (cont)
{
- keyword = token(fp,tokenlen);
+ char *keyword = token(fp,tokenlen);
/* Have reached an early and unexpected EOF. */
/* Set flag and stop parsing */
if (keyword == NULL)
@@ -717,11 +715,10 @@ static int parseCharMetrics( FileInputStream* fp, FontInfo* fi)
bool cont = true, firstTime = true;
int error = ok, count = 0, tokenlen;
CharMetricInfo *temp = fi->cmi;
- char *keyword;
while (cont)
{
- keyword = token(fp,tokenlen);
+ char *keyword = token(fp,tokenlen);
if (keyword == NULL)
{
error = earlyEOF;
@@ -873,11 +870,10 @@ static int parseTrackKernData( FileInputStream* fp, FontInfo* fi)
{
bool cont = true, save = (fi->tkd != NULL);
int pos = 0, error = ok, tcount = 0, tokenlen;
- char *keyword;
while (cont)
{
- keyword = token(fp,tokenlen);
+ char *keyword = token(fp,tokenlen);
if (keyword == NULL)
{
@@ -980,11 +976,10 @@ static int parsePairKernData( FileInputStream* fp, FontInfo* fi)
{
bool cont = true, save = (fi->pkd != NULL);
int pos = 0, error = ok, pcount = 0, tokenlen;
- char *keyword;
while (cont)
{
- keyword = token(fp,tokenlen);
+ char *keyword = token(fp,tokenlen);
if (keyword == NULL)
{
@@ -1109,11 +1104,10 @@ static int parseCompCharData( FileInputStream* fp, FontInfo* fi)
{
bool cont = true, firstTime = true, save = (fi->ccd != NULL);
int pos = 0, j = 0, error = ok, ccount = 0, pcount = 0, tokenlen;
- char *keyword;
while (cont)
{
- keyword = token(fp,tokenlen);
+ char *keyword = token(fp,tokenlen);
if (keyword == NULL)
/* Have reached an early and unexpected EOF. */
/* Set flag and stop parsing */
diff --git a/vcl/generic/print/bitmap_gfx.cxx b/vcl/generic/print/bitmap_gfx.cxx
index 9a6d7e873927..dc6997de92a2 100644
--- a/vcl/generic/print/bitmap_gfx.cxx
+++ b/vcl/generic/print/bitmap_gfx.cxx
@@ -625,12 +625,11 @@ PrinterGfx::DrawPS2MonoImage (const PrinterBmp& rBitmap, const Rectangle& rArea)
for (long nRow = rArea.Top(); nRow <= rArea.Bottom(); nRow++)
{
long nBitPos = 0;
- unsigned char nBit = 0;
unsigned char nByte = 0;
for (long nColumn = rArea.Left(); nColumn <= rArea.Right(); nColumn++)
{
- nBit = rBitmap.GetPixelIdx (nRow, nColumn);
+ unsigned char nBit = rBitmap.GetPixelIdx (nRow, nColumn);
nByte |= nBit << (7 - nBitPos);
if (++nBitPos == 8)
diff --git a/vcl/generic/print/text_gfx.cxx b/vcl/generic/print/text_gfx.cxx
index a262b826d8e2..eeaa02925153 100644
--- a/vcl/generic/print/text_gfx.cxx
+++ b/vcl/generic/print/text_gfx.cxx
@@ -442,7 +442,7 @@ bool PrinterGfx::drawVerticalizedText(
int nTextScale = maVirtualStatus.mnTextWidth ? maVirtualStatus.mnTextWidth : maVirtualStatus.mnTextHeight;
int nNormalAngle = mnTextAngle;
- int nDeltaAngle, nLastPos = 0;
+ int nLastPos = 0;
double fSin = sin( -2.0*M_PI*nNormalAngle/3600 );
double fCos = cos( -2.0*M_PI*nNormalAngle/3600 );
@@ -453,6 +453,7 @@ bool PrinterGfx::drawVerticalizedText(
Point aPoint( rPoint );
for( int i = 0; i < nLen; )
{
+ int nDeltaAngle;
while( ( nDeltaAngle = getVerticalDeltaAngle( pStr[i] ) ) == 0 && i < nLen )
i++;
if( i <= nLen && i > nLastPos )