The code did not compile with GCC.

Converted a few "const" into "#define" to make it compile.

Added several casts to quieten some clang -Weverything messages.

Fixed the printfs in main (I hope).

There should not be functional changes.