Reapply 612785f39e325b0578be89e09b0e32d7d08d471e fixing GCC warnings

See 612785f39e325b0578be89e09b0e32d7d08d471e for details. The warning is
exactly the same as before, with the exact same solution as before.

Change-Id: I2f6cbc64234696f1d240611f376ab5daf8d0f89c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>