diff --git a/src/tz.cpp b/src/tz.cpp index 4ca7188..e308b74 100644 --- a/src/tz.cpp +++ b/src/tz.cpp @@ -194,9 +194,9 @@ struct index_entry_t { #ifdef _WIN32 static CONSTDATA char folder_delimiter = '\\'; -#else // !_WIN32 +#elif !defined(ANDROID) && !defined(__ANDROID__) static CONSTDATA char folder_delimiter = '/'; -#endif // !_WIN32 +#endif // !defined(WIN32) && !defined(ANDROID) && !defined(__ANDROID__) #if defined(__GNUC__) && __GNUC__ < 5 // GCC 4.9 Bug 61489 Wrong warning with -Wmissing-field-initializers @@ -616,6 +616,7 @@ get_tzdb_list() return tz_db; } +#if !defined(ANDROID) && !defined(__ANDROID__) inline static char @@ -644,6 +645,7 @@ get_alpha_word(std::istream& in) s.push_back(static_cast(in.get())); return s; } +#endif // !defined(ANDROID) && !defined(__ANDROID__) inline static @@ -654,6 +656,7 @@ is_prefix_of(std::string const& key, std::string const& value) return key.compare(0, size, value, 0, size) == 0; } +#if !defined(ANDROID) && !defined(__ANDROID__) static unsigned parse_month(std::istream& in) @@ -673,6 +676,7 @@ parse_month(std::istream& in) throw std::runtime_error("oops: bad month name: " + s); return static_cast(++m); } +#endif // !defined(ANDROID) && !defined(__ANDROID__) #if !USE_OS_TZDB @@ -2895,24 +2899,14 @@ operator<<(std::ostream& os, const leap_second& x) #if USE_OS_TZDB +#if !defined(ANDROID) && !defined(__ANDROID__) static std::string get_version() { - using namespace std; -#if defined(ANDROID) || defined(__ANDROID__) - auto path = get_tz_dir() + string("/tzdata"); - ifstream in{path}; - bionic_tzdata_header_t hdr{}; - if (in) - { - in.read(reinterpret_cast(&hdr), sizeof(bionic_tzdata_header_t)); - return string(hdr.tzdata_version).replace(0, 6, ""); - } -#else - auto path = get_tz_dir() + string("/+VERSION"); - ifstream in{path}; - string version; + auto path = get_tz_dir() + std::string("/+VERSION"); + std::ifstream in{path}; + std::string version; if (in) { in >> version; @@ -2925,11 +2919,9 @@ get_version() in >> version; return version; } -#endif // defined(ANDROID) || defined(__ANDROID__) return "unknown"; } -#if !defined(ANDROID) && !defined(__ANDROID__) static std::vector find_read_and_leap_seconds()