lint: reduce scope

Fix some lint warnings of kind
```
style (variableScope): The scope of the variable '…' can be reduced
```
This is defined as 'unsigned int', why not change it along with the PR (in a separate commit)?