Fix compilation warnings:
 - assignment used as condition warnings for the error checking
 - writeable char constant warning.
 - Fix sprintf of size_t values to not (potentially) print garbage.
 - Remove extra parentheses around condition in if().
 - Replace explicit NULL dereference by a call to abort().