[OSX] Remove all direct calls to CFStringGetCString and CFStringGetCStringPtr

This adds a new util function DarwinCFStringToString that handles errors
and tries to first get the pointer otherwise copies the string into a
std::string. It also makes sure to use CFStringGetSystemEncoding()
everywhere so we don't get in trouble for using a hardcoded encoding.
Merge pull request #2082 from tru/cfstring_get_cstring_spring_cleaning

[OSX] Remove all direct calls to CFStringGetCString and CFStringGetCStringPtr