mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Fix possible race conditions in msgid().
This commit is contained in:
@@ -95,15 +95,8 @@ inline QByteArray str_const_toByteArray(const str_const &str) {
|
||||
return QByteArray::fromRawData(str.c_str(), str.size());
|
||||
}
|
||||
|
||||
void unixtimeInit();
|
||||
void unixtimeSet(TimeId serverTime, bool force = false);
|
||||
TimeId unixtime();
|
||||
uint64 msgid();
|
||||
int GetNextRequestId();
|
||||
|
||||
QDateTime ParseDateTime(TimeId serverTime);
|
||||
TimeId ServerTimeFromParsed(const QDateTime &date);
|
||||
|
||||
inline void mylocaltime(struct tm * _Tm, const time_t * _Time) {
|
||||
#ifdef Q_OS_WIN
|
||||
localtime_s(_Tm, _Time);
|
||||
@@ -183,17 +176,6 @@ T rand_value() {
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void memset_rand_bad(void *data, uint32 len) {
|
||||
for (uchar *i = reinterpret_cast<uchar*>(data), *e = i + len; i != e; ++i) {
|
||||
*i = uchar(rand() & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void memsetrnd_bad(T &value) {
|
||||
memset_rand_bad(&value, sizeof(value));
|
||||
}
|
||||
|
||||
class ReadLockerAttempt {
|
||||
public:
|
||||
ReadLockerAttempt(not_null<QReadWriteLock*> lock) : _lock(lock), _locked(_lock->tryLockForRead()) {
|
||||
|
Reference in New Issue
Block a user