Patch a number of errors caused by clang

There are certain codeing styles that clang doesn't like such
as not performing explicit casts when assigning to a struct. Also
had to remove some functions as there is a builtin from gcc that
clang does not yet support