diff --git a/Aquaria/Network.cpp b/Aquaria/Network.cpp index 5d09349..cc9f71d 100644 --- a/Aquaria/Network.cpp +++ b/Aquaria/Network.cpp @@ -103,7 +103,7 @@ protected: data->fp = fopen(data->tempFilename.c_str(), "wb"); if(!data->fp) { - fprintf(stderr, "SOCKET: Failed to save %u bytes, file not open"); + fprintf(stderr, "SOCKET: Failed to save %u bytes, file not open", size); data->fail = true; // TODO: and now? return; diff --git a/Aquaria/UserSettings.cpp b/Aquaria/UserSettings.cpp index 9d41677..9fadfde 100644 --- a/Aquaria/UserSettings.cpp +++ b/Aquaria/UserSettings.cpp @@ -40,7 +40,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #ifdef BBGE_BUILD_MACOSX - #include + #include + #include + #include + +// veeery clunky. +static std::string _CFToStdString(CFStringRef cs) +{ + char buf[1024]; + CFStringGetCString(cs, &buf[0], 2048, kCFStringEncodingUTF8); + return &buf[0]; +} + #endif void UserSettings::save() @@ -647,30 +658,24 @@ void UserSettings::getSystemLocale() } #elif BBGE_BUILD_MACOSX CFLocaleRef locale = CFLocaleCopyCurrent(); - CFTypeRef type; + CFArrayRef langs = CFLocaleCopyPreferredLanguages(); CFStringRef buf; - type = CFLocaleGetValue(locale, kCFLocaleLanguageCode); - - if ((buf = CFLocaleCopyDisplayNameForPropertyValue(locale, kCFLocaleLanguageCode, type)) != NULL) + if ((buf = (CFStringRef)CFLocaleGetValue(locale, kCFLocaleLanguageCode)) != NULL) { - system.locale = buf; + system.locale = _CFToStdString(buf); CFRelease(buf); - CFRelease(type); - type = CFLocaleGetValue(locale, kCFLocaleCountryCode); - - if ((buf = CFLocaleCopyDisplayNameForPropertyValue(locale, kCFLocaleCountryCode, type)) != NULL) + if ((buf = (CFStringRef)CFArrayGetValueAtIndex(langs, 0)) != NULL) { system.locale += "_"; - system.locale += buf; + system.locale += _CFToStdString(buf); CFRelease(buf); } - - CFRelease(type); } CFRelease(locale); + CFRelease(langs); #else const char *lang = (const char *)getenv("LANG");