Fixed all warnings on GCC 4.8 with -Wall -pedantic -Wextra.