Skip to content

Commit

Permalink
Fix unused functions on Android
Browse files Browse the repository at this point in the history
... spotted with `-Wall`

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
  • Loading branch information
basilgello authored and HowardHinnant committed Sep 30, 2024
1 parent fca69e3 commit 447f5a3
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/tz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -616,6 +616,7 @@ get_tzdb_list()
return tz_db;
}

#if !defined(ANDROID) && !defined(__ANDROID__)
inline
static
char
Expand Down Expand Up @@ -644,6 +645,7 @@ get_alpha_word(std::istream& in)
s.push_back(static_cast<char>(in.get()));
return s;
}
#endif // !defined(ANDROID) && !defined(__ANDROID__)

inline
static
Expand All @@ -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)
Expand All @@ -673,6 +676,7 @@ parse_month(std::istream& in)
throw std::runtime_error("oops: bad month name: " + s);
return static_cast<unsigned>(++m);
}
#endif // !defined(ANDROID) && !defined(__ANDROID__)

#if !USE_OS_TZDB

Expand Down Expand Up @@ -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<char*>(&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;
Expand All @@ -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<leap_second>
find_read_and_leap_seconds()
Expand Down

0 comments on commit 447f5a3

Please sign in to comment.