summaryrefslogtreecommitdiff
path: root/sal/textenc
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-19 11:07:02 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-19 13:51:34 +0000
commit2ee336fb556ceb1d7e1ee8017c27539da7fe543b (patch)
tree7332ba839b28f112397104596a601c3506bd5973 /sal/textenc
parent5712983f18e7cdec16ea20a9b3d94a1586de543e (diff)
fdo#39440 sal: reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: Id5f90757571e76a2c05a4cbd37020e1f6a6b2033 Reviewed-on: https://gerrit.libreoffice.org/13544 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sal/textenc')
-rw-r--r--sal/textenc/convertsimple.cxx3
-rw-r--r--sal/textenc/tcvtbyte.cxx6
-rw-r--r--sal/textenc/tcvtmb.cxx9
3 files changed, 6 insertions, 12 deletions
diff --git a/sal/textenc/convertsimple.cxx b/sal/textenc/convertsimple.cxx
index 6f5b500ad697..076641638982 100644
--- a/sal/textenc/convertsimple.cxx
+++ b/sal/textenc/convertsimple.cxx
@@ -517,7 +517,6 @@ sal_Size sal::detail::textenc::convertCharToUnicode(
sal_Size nSrcBytes, sal_Unicode * pDestBuf, sal_Size nDestChars,
sal_uInt32 nFlags, sal_uInt32 * pInfo, sal_Size * pSrcCvtBytes)
{
- unsigned char c;
sal_Unicode cConv;
const ImplByteConvertData* pConvertData = (const ImplByteConvertData*)pData;
sal_Unicode* pEndDestBuf;
@@ -528,7 +527,7 @@ sal_Size sal::detail::textenc::convertCharToUnicode(
pEndSrcBuf = pSrcBuf+nSrcBytes;
while ( pSrcBuf < pEndSrcBuf )
{
- c = (unsigned char)*pSrcBuf;
+ unsigned char c = (unsigned char)*pSrcBuf;
if ( c < 0x80 )
cConv = c;
else
diff --git a/sal/textenc/tcvtbyte.cxx b/sal/textenc/tcvtbyte.cxx
index 94336da659e3..0248e01570b8 100644
--- a/sal/textenc/tcvtbyte.cxx
+++ b/sal/textenc/tcvtbyte.cxx
@@ -32,7 +32,6 @@ sal_Size ImplSymbolToUnicode( SAL_UNUSED_PARAMETER const void*,
SAL_UNUSED_PARAMETER sal_uInt32,
sal_uInt32* pInfo, sal_Size* pSrcCvtBytes )
{
- unsigned char c;
sal_Unicode* pEndDestBuf;
const char* pEndSrcBuf;
@@ -48,7 +47,7 @@ sal_Size ImplSymbolToUnicode( SAL_UNUSED_PARAMETER const void*,
}
/* 0-31 (all Control-Character get the same Unicode value) */
- c = (unsigned char)*pSrcBuf;
+ unsigned char c = (unsigned char)*pSrcBuf;
if ( c <= 0x1F )
*pDestBuf = (sal_Unicode)c;
else
@@ -127,7 +126,6 @@ sal_Size ImplUpperCharToUnicode( const void* pData,
SAL_UNUSED_PARAMETER sal_uInt32, sal_uInt32* pInfo,
sal_Size* pSrcCvtBytes )
{
- unsigned char c;
sal_Unicode cConv;
const ImplByteConvertData* pConvertData = (const ImplByteConvertData*)pData;
sal_Unicode* pEndDestBuf;
@@ -144,7 +142,7 @@ sal_Size ImplUpperCharToUnicode( const void* pData,
}
while ( pSrcBuf < pEndSrcBuf )
{
- c = (unsigned char)*pSrcBuf;
+ unsigned char c = (unsigned char)*pSrcBuf;
if (c < 0x80)
cConv = c;
else
diff --git a/sal/textenc/tcvtmb.cxx b/sal/textenc/tcvtmb.cxx
index 8f84e7f077da..80c49554ba47 100644
--- a/sal/textenc/tcvtmb.cxx
+++ b/sal/textenc/tcvtmb.cxx
@@ -221,8 +221,6 @@ sal_Size ImplUnicodeToDBCS( const void* pData, SAL_UNUSED_PARAMETER void*,
{
sal_uInt16 cConv;
sal_Unicode c;
- unsigned char nHighChar;
- unsigned char nLowChar;
const ImplUniToDBCSHighTab* pHighEntry;
const ImplDBCSConvertData* pConvertData = (const ImplDBCSConvertData*)pData;
const ImplUniToDBCSHighTab* pHighTab = pConvertData->mpToDBCSHighTab;
@@ -241,8 +239,8 @@ sal_Size ImplUnicodeToDBCS( const void* pData, SAL_UNUSED_PARAMETER void*,
while ( pSrcBuf < pEndSrcBuf )
{
c = *pSrcBuf;
- nHighChar = (unsigned char)((c >> 8) & 0xFF);
- nLowChar = (unsigned char)(c & 0xFF);
+ unsigned char nHighChar = (unsigned char)((c >> 8) & 0xFF);
+ unsigned char nLowChar = (unsigned char)(c & 0xFF);
/* get entry for the high byte */
pHighEntry = pHighTab+nHighChar;
@@ -382,7 +380,6 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
sal_uInt32 nFlags, sal_uInt32* pInfo,
sal_Size* pSrcCvtBytes )
{
- unsigned char c;
unsigned char cLead = '\0';
unsigned char cTrail = '\0';
sal_Unicode cConv;
@@ -397,7 +394,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
pEndSrcBuf = pSrcBuf+nSrcBytes;
while ( pSrcBuf < pEndSrcBuf )
{
- c = (unsigned char)*pSrcBuf;
+ unsigned char c = (unsigned char)*pSrcBuf;
/* ASCII */
if ( c <= 0x7F )