Fixes to allow GCC4.7 building
Combined code changes (trailblazerz)

Signed-off-by: Daniel Tarrant <daniel.g.tarrant@gmail.com>
Merge remote-tracking branch 'upstream/cm-10.1' into testing