Fix gcc compiler warnings from -Wall, including:

unused variables or methods (-Wunused)
uninitialized variables (-Wuninitialized)
signed/unsigned comparisons (-Wsign-compare)
order of initiliazers (-Wreorder)