Fix cast warnings (errors) when targetting 4.5

Change-Id: I40aac0dbd4bbbc27de7f8a1d3cc505c60fe77020
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/36302
Tested-by: Hudson CI