Fix more warnings to make it pass -Wextra -Wshadow -Wunsafe-loop-optimiz...

...ations

Signed-off-by: Paul Fertser <fercerpav@gmail.com>