diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-06 19:51:04 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-11 06:15:26 +0000 |
commit | 0e55feea6a6bb516c4198960b14192f363f08601 (patch) | |
tree | 3b6c9912c46423c089e8ee9f7533caabf8f1e6c3 /bridges/source/cpp_uno | |
parent | 7557f23b31dcfb4d86c122bb34d9675c0db9a694 (diff) |
reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: I1122494e295af756ef3cc32717fe204505aeb9e3
Reviewed-on: https://gerrit.libreoffice.org/13335
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'bridges/source/cpp_uno')
4 files changed, 7 insertions, 13 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx index 906058465c23..a8f27b646305 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx @@ -357,11 +357,9 @@ static void cpp_call( void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion - bool bSimpleReturn = true; if (pReturnTypeDescr) { - if (arm::return_in_hidden_param( pReturnTypeRef ) ) - bSimpleReturn = false; + bool bSimpleReturn = !arm::return_in_hidden_param( pReturnTypeRef ); if (bSimpleReturn) pCppReturn = pUnoReturn; // direct way for simple types diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx index 752137fbedc8..0a25f486692b 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx @@ -406,11 +406,9 @@ static void cpp_call( void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion - bool bSimpleReturn = true; if (pReturnTypeDescr) { - if (arm::return_in_hidden_param( pReturnTypeRef ) ) - bSimpleReturn = false; + bool bSimpleReturn = !arm::return_in_hidden_param( pReturnTypeRef ) if (bSimpleReturn) pCppReturn = pUnoReturn; // direct way for simple types diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx index 01bb74abd3ea..342ab9cef0fa 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx @@ -316,15 +316,13 @@ static void cpp_call( void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion bool bOverflow = false; - bool bSimpleReturn = true; if (pReturnTypeDescr) { #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "return type is %d\n", pReturnTypeDescr->eTypeClass); #endif - if (ppc64::return_in_hidden_param(pReturnTypeRef)) - bSimpleReturn = false; + bool bSimpleReturn =!ppc64::return_in_hidden_param(pReturnTypeRef); if (bSimpleReturn) { diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx index ed0e6cffd99c..c1815b449d7f 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx @@ -42,10 +42,11 @@ static sal_Int32 invoke_count_words(char * pPT) { sal_Int32 overflow = 0, gpr = 0, fpr = 0; - int c; // character of parameter type being decoded while (*pPT != 'X') { - c = *pPT; + // character of parameter type being decoded + const int c = *pPT; + switch (c) { case 'D': /* type is double */ if (fpr < 2) fpr++; else overflow+=2; @@ -84,10 +85,9 @@ invoke_copy_to_stack(sal_Int32 * pStackLongs, char * pPT, sal_Int32* d_ov, sal_I sal_Int32 *d_gpr = d_ov + overflow; sal_Int64 *d_fpr = (sal_Int64 *)(d_gpr + 5); sal_Int32 gpr = 0, fpr = 0; - char c; while (*pPT != 'X') { - c = *pPT; + const char c = *pPT; switch (c) { case 'D': /* type is double */ if (fpr < 2) |