Mac: Do not convert charset of strftime result (removes dependency on iconv, and confirmed to work without conversion anyway).

ver1_5_1
Da Woon Jung 2008-03-15 15:20:41 +00:00
parent a380dc1356
commit 5e58b99352
2 changed files with 10 additions and 0 deletions

View File

@ -17,9 +17,11 @@
#include "astro.h"
#include <celutil/util.h>
#ifndef TARGET_OS_MAC
#ifdef __GNUC__
#include <langinfo.h>
#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)
{

View File

@ -16,9 +16,11 @@
#include <celmath/vecmath.h>
#include <celengine/univcoord.h>
#ifndef TARGET_OS_MAC
#ifdef __GNUC__
#include <iconv.h>
#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
};