Remove a write-only variable

This fixes warnings with GCC about a variable that is set but
not used.
Use an unsigned variable for comparison with unsigned values

This avoids warnings about comparison between signed and unsigned.
Initialize a local variable

This fixes warnings with GCC about a variable that may be used
uninitialized (if iResProperty was an incorrect value).
Merge pull request #1668 from mstorsjo/fix-warnings

Fix build warnings with GCC