diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-16 17:35:52 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-17 07:31:17 +0000 |
commit | afb5143639598bdc7f78ba000569d80e10d0fbe4 (patch) | |
tree | bdcb00001e370eac8eaae92b3ac873dc69c42263 /forms/source/xforms | |
parent | d8b05b5951fd446ff3fa904a6f68846f1abdb2fe (diff) |
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: I1d037e87c69b1a7de019f1abf1f729bf7e28d762
Reviewed-on: https://gerrit.libreoffice.org/13494
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'forms/source/xforms')
-rw-r--r-- | forms/source/xforms/xpathlib/xpathlib.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index 70c473e6c1ef..e8183c3c0246 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -153,10 +153,9 @@ void xforms_minFunction(xmlXPathParserContextPtr ctxt, int nargs) xmlNodeSetPtr pNodeSet = xmlXPathPopNodeSet(ctxt); if (xmlXPathCheckError(ctxt)) XP_ERROR(XPATH_INVALID_TYPE); double nMinimum = 0; - double nNumber = 0; for (int i = 0; i < xmlXPathNodeSetGetLength(pNodeSet); i++) { - nNumber = xmlXPathCastNodeToNumber(xmlXPathNodeSetItem(pNodeSet, i)); + double nNumber = xmlXPathCastNodeToNumber(xmlXPathNodeSetItem(pNodeSet, i)); if (xmlXPathIsNaN(nNumber)) { xmlXPathReturnNumber(ctxt, xmlXPathNAN); @@ -176,10 +175,9 @@ void xforms_maxFunction(xmlXPathParserContextPtr ctxt, int nargs) xmlNodeSetPtr pNodeSet = xmlXPathPopNodeSet(ctxt); if (xmlXPathCheckError(ctxt)) XP_ERROR(XPATH_INVALID_TYPE); double nMaximum = 0; - double nNumber = 0; for (int i = 0; i < xmlXPathNodeSetGetLength(pNodeSet); i++) { - nNumber = xmlXPathCastNodeToNumber(xmlXPathNodeSetItem(pNodeSet, i)); + double nNumber = xmlXPathCastNodeToNumber(xmlXPathNodeSetItem(pNodeSet, i)); if (xmlXPathIsNaN(nNumber)) { xmlXPathReturnNumber(ctxt, xmlXPathNAN); @@ -197,11 +195,10 @@ void xforms_countNonEmptyFunction(xmlXPathParserContextPtr ctxt, int nargs) if (nargs != 1) XP_ERROR(XPATH_INVALID_ARITY); xmlNodeSetPtr pNodeSet = xmlXPathPopNodeSet(ctxt); if (xmlXPathCheckError(ctxt)) XP_ERROR(XPATH_INVALID_TYPE); - xmlChar *aString; sal_Int32 nNotEmpty = 0; for (int i = 0; i < xmlXPathNodeSetGetLength(pNodeSet); i++) { - aString = xmlXPathCastNodeToString(xmlXPathNodeSetItem(pNodeSet, i)); + const xmlChar *aString = xmlXPathCastNodeToString(xmlXPathNodeSetItem(pNodeSet, i)); if (*aString != 0) nNotEmpty++; } xmlXPathReturnNumber(ctxt, nNotEmpty); |