Fix compilation for Termux.
GitOrigin-RevId: d6ef97baaf2f48846189f89bc5c0c8ec824a2990
This commit is contained in:
parent
70438d829a
commit
9579edbd04
@ -5,23 +5,28 @@
|
|||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
class DhConfig {
|
class DhConfig {
|
||||||
public:
|
public:
|
||||||
int32 version = 0;
|
int32 version = 0;
|
||||||
string prime;
|
string prime;
|
||||||
int32 g = 0;
|
int32 g = 0;
|
||||||
|
|
||||||
bool empty() const {
|
bool empty() const {
|
||||||
return prime.empty();
|
return prime.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store(StorerT &storer) const {
|
void store(StorerT &storer) const {
|
||||||
storer.store_int(version);
|
storer.store_int(version);
|
||||||
storer.store_string(prime);
|
storer.store_string(prime);
|
||||||
storer.store_int(g);
|
storer.store_int(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParserT>
|
template <class ParserT>
|
||||||
void parse(ParserT &parser) {
|
void parse(ParserT &parser) {
|
||||||
version = parser.fetch_int();
|
version = parser.fetch_int();
|
||||||
@ -29,4 +34,5 @@ class DhConfig {
|
|||||||
g = parser.fetch_int();
|
g = parser.fetch_int();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -56,6 +56,19 @@ struct TimeNsec {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// remove libc compatibility hacks if any: we have our own hacks
|
||||||
|
#ifdef st_atimespec
|
||||||
|
#undef st_atimespec
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef st_atimensec
|
||||||
|
#undef st_atimensec
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef st_atime_nsec
|
||||||
|
#undef st_atime_nsec
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct TimeNsec<T, void_t<char, decltype(T::st_atimespec), decltype(T::st_mtimespec)>> {
|
struct TimeNsec<T, void_t<char, decltype(T::st_atimespec), decltype(T::st_mtimespec)>> {
|
||||||
static std::pair<decltype(decltype(T::st_atimespec)::tv_nsec), decltype(decltype(T::st_mtimespec)::tv_nsec)> get(
|
static std::pair<decltype(decltype(T::st_atimespec)::tv_nsec), decltype(decltype(T::st_mtimespec)::tv_nsec)> get(
|
||||||
@ -78,6 +91,13 @@ struct TimeNsec<T, void_t<int, decltype(T::st_atim), decltype(T::st_mtim)>> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct TimeNsec<T, void_t<long, decltype(T::st_atime_nsec), decltype(T::st_mtime_nsec)>> {
|
||||||
|
static std::pair<decltype(T::st_atime_nsec), decltype(T::st_mtime_nsec)> get(const T &s) {
|
||||||
|
return {s.st_atime_nsec, s.st_mtime_nsec};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Stat from_native_stat(const struct ::stat &buf) {
|
Stat from_native_stat(const struct ::stat &buf) {
|
||||||
auto time_nsec = TimeNsec<struct ::stat>::get(buf);
|
auto time_nsec = TimeNsec<struct ::stat>::get(buf);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user