Fix compiler warnings

These commits fix compiler warnings, reported by gcc and clang.  They have been tested on Linux with and without DEB macro.
There may be trouble with ac8d554 and Borland compiler, everything else looks safe to me.