From 5e58b99352a90b4cd80c2812247468a318ba4212 Mon Sep 17 00:00:00 2001 From: Da Woon Jung Date: Sat, 15 Mar 2008 15:20:41 +0000 Subject: [PATCH] Mac: Do not convert charset of strftime result (removes dependency on iconv, and confirmed to work without conversion anyway). --- src/celengine/astro.cpp | 6 ++++++ src/celengine/astro.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/celengine/astro.cpp b/src/celengine/astro.cpp index 6f448d845..32d0ee622 100644 --- a/src/celengine/astro.cpp +++ b/src/celengine/astro.cpp @@ -17,9 +17,11 @@ #include "astro.h" #include +#ifndef TARGET_OS_MAC #ifdef __GNUC__ #include #endif +#endif using namespace std; @@ -445,11 +447,13 @@ astro::Date::Date(double jd) tzname = "UTC"; } +#ifndef TARGET_OS_MAC #ifdef __GNUC__ bool astro::Date::utf8Locale = false; bool astro::Date::utf8LocaleSet = false; iconv_t astro::Date::utf8Iconv; #endif +#endif const char* astro::Date::toCStr(Format format) const { @@ -484,6 +488,7 @@ const char* astro::Date::toCStr(Format format) const size_t in = strftime(date, sizeof(date), strftime_format, &cal_time); +#ifndef TARGET_OS_MAC // The string returned by strftime is in the current locale's charset // which may not be UTF-8 if (!astro::Date::utf8LocaleSet) @@ -505,6 +510,7 @@ const char* astro::Date::toCStr(Format format) const iconv(astro::Date::utf8Iconv, &inBuff, &in, &outBuff, &out); return utf8Date; } +#endif #else switch(format) { diff --git a/src/celengine/astro.h b/src/celengine/astro.h index 13f3fcc83..be80f02bc 100644 --- a/src/celengine/astro.h +++ b/src/celengine/astro.h @@ -16,9 +16,11 @@ #include #include +#ifndef TARGET_OS_MAC #ifdef __GNUC__ #include #endif +#endif #define SOLAR_ABSMAG 4.83f #define LN_MAG 1.085736 @@ -61,12 +63,14 @@ namespace astro std::string tzname; // timezone name double seconds; +#ifndef TARGET_OS_MAC #ifdef __GNUC__ private: // Static members used to store locale related UTF-8 information static bool utf8Locale; static bool utf8LocaleSet; static iconv_t utf8Iconv; +#endif #endif };