Fix type mismatches in malloc/calloc/realloc, and fix compilation on clang

Two things are present in this request:
 * A fix for type mismatches between the sizeof()s used when determining the size of a malloc/realloc/calloc, and the type being assigned to. This caught one situation(bam_plcmd.c:208) where more memory was being allocated than necessary (on 64 bit systems only).
* A fix for compilation using the clang compiler on Mac.