reindenting the uncrustified code by Xcode
fixed memory leaks and clang warnings