Mac: Do not convert charset of strftime result (removes dependency on iconv, and confirmed to work without conversion anyway).
parent
a380dc1356
commit
5e58b99352
|
@ -17,9 +17,11 @@
|
||||||
#include "astro.h"
|
#include "astro.h"
|
||||||
#include <celutil/util.h>
|
#include <celutil/util.h>
|
||||||
|
|
||||||
|
#ifndef TARGET_OS_MAC
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -445,11 +447,13 @@ astro::Date::Date(double jd)
|
||||||
tzname = "UTC";
|
tzname = "UTC";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TARGET_OS_MAC
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
bool astro::Date::utf8Locale = false;
|
bool astro::Date::utf8Locale = false;
|
||||||
bool astro::Date::utf8LocaleSet = false;
|
bool astro::Date::utf8LocaleSet = false;
|
||||||
iconv_t astro::Date::utf8Iconv;
|
iconv_t astro::Date::utf8Iconv;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
const char* astro::Date::toCStr(Format format) const
|
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);
|
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
|
// The string returned by strftime is in the current locale's charset
|
||||||
// which may not be UTF-8
|
// which may not be UTF-8
|
||||||
if (!astro::Date::utf8LocaleSet)
|
if (!astro::Date::utf8LocaleSet)
|
||||||
|
@ -505,6 +510,7 @@ const char* astro::Date::toCStr(Format format) const
|
||||||
iconv(astro::Date::utf8Iconv, &inBuff, &in, &outBuff, &out);
|
iconv(astro::Date::utf8Iconv, &inBuff, &in, &outBuff, &out);
|
||||||
return utf8Date;
|
return utf8Date;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
switch(format)
|
switch(format)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,9 +16,11 @@
|
||||||
#include <celmath/vecmath.h>
|
#include <celmath/vecmath.h>
|
||||||
#include <celengine/univcoord.h>
|
#include <celengine/univcoord.h>
|
||||||
|
|
||||||
|
#ifndef TARGET_OS_MAC
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SOLAR_ABSMAG 4.83f
|
#define SOLAR_ABSMAG 4.83f
|
||||||
#define LN_MAG 1.085736
|
#define LN_MAG 1.085736
|
||||||
|
@ -61,12 +63,14 @@ namespace astro
|
||||||
std::string tzname; // timezone name
|
std::string tzname; // timezone name
|
||||||
double seconds;
|
double seconds;
|
||||||
|
|
||||||
|
#ifndef TARGET_OS_MAC
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
private:
|
private:
|
||||||
// Static members used to store locale related UTF-8 information
|
// Static members used to store locale related UTF-8 information
|
||||||
static bool utf8Locale;
|
static bool utf8Locale;
|
||||||
static bool utf8LocaleSet;
|
static bool utf8LocaleSet;
|
||||||
static iconv_t utf8Iconv;
|
static iconv_t utf8Iconv;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue