2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Start data export in lib_export.

This commit is contained in:
John Preston
2018-06-02 17:29:21 +03:00
parent c2fa149ffd
commit c587c011d2
52 changed files with 1994 additions and 320 deletions

View File

@@ -54,11 +54,13 @@ static_assert(sizeof(MTPdouble) == 8, "Basic types size check failed");
// Unixtime functions
namespace {
std::atomic<int> GlobalAtomicRequestId = 0;
QReadWriteLock unixtimeLock;
volatile int32 unixtimeDelta = 0;
volatile bool unixtimeWasSet = false;
volatile uint64 _msgIdStart, _msgIdLocal = 0, _msgIdMsStart;
int32 _reqId = 0;
void _initMsgIdConstants() {
#ifdef Q_OS_WIN
@@ -433,12 +435,12 @@ uint64 msgid() {
return result + (_msgIdLocal += 4);
}
int32 reqid() {
QWriteLocker locker(&unixtimeLock);
if (_reqId == INT_MAX) {
_reqId = 0;
int GetNextRequestId() {
const auto result = ++GlobalAtomicRequestId;
if (result == std::numeric_limits<int>::max() / 2) {
GlobalAtomicRequestId = 0;
}
return ++_reqId;
return result;
}
// crc32 hash, taken somewhere from the internet