Enlarge pLongRefList to avoid accesses out of bounds

This fixes warnings about "array subscript is above array bounds".
Use the right data type for a local variable

All the values assigned into this variable, and compared with this
variable, are int32_t.

This avoids warnings about comparison between signed and unsigned
types.
Remove an unused variable

This fixes warnings about variables that are set but not used.
Initialize a variable to avoid warnings about possibly uninitialized use
Merge pull request #907 from mstorsjo/warning-fix

Get rid of some build warnings