fdo#39440 - cppcheck cleanliness

- Fixed some The scope of the variable 'x' can be reduced.

Change-Id: I6b586314b2ed201249dc52469cc4bb86b99f79d2
Reviewed-on: https://gerrit.libreoffice.org/7665
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>