Codecs fixes as of November, 11, 2014

This pull-request fixes various warnings and errors produced by cppcheck, scan-build make, clang and gcc.