Error check inprovements in cdump and dump

There are some functions that return just -1 in error cases.
And some functions use immediate values instead of macros.
They are not well-formed in some coding rules.