mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Moved to g++ 4.9, fixed some warnings, codegen used for Linux build.
This commit is contained in:
@@ -45,52 +45,22 @@ uint64 _SharedMemoryLocation[4] = { 0x00, 0x01, 0x02, 0x03 };
|
||||
|
||||
// Base types compile-time check
|
||||
|
||||
#ifdef TDESKTOP_CUSTOM_NULLPTR
|
||||
NullPointerClass nullptr;
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
template <typename T, int N>
|
||||
class _TypeSizeCheckerHelper {
|
||||
public:
|
||||
_TypeSizeCheckerHelper() {
|
||||
int _BadTypeSize[N ? -1 : 1];
|
||||
(void)sizeof(_BadTypeSize);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class _TypeSizeCheckerHelper<T, 0> {
|
||||
public:
|
||||
_TypeSizeCheckerHelper() {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, int N>
|
||||
class _TypeSizeChecker {
|
||||
_TypeSizeCheckerHelper<T, N - sizeof(T)> checker;
|
||||
};
|
||||
|
||||
void _typesCheck() {
|
||||
_TypeSizeChecker<char, 1>();
|
||||
_TypeSizeChecker<uchar, 1>();
|
||||
_TypeSizeChecker<int16, 2>();
|
||||
_TypeSizeChecker<uint16, 2>();
|
||||
_TypeSizeChecker<int32, 4>();
|
||||
_TypeSizeChecker<uint32, 4>();
|
||||
_TypeSizeChecker<int64, 8>();
|
||||
_TypeSizeChecker<uint64, 8>();
|
||||
_TypeSizeChecker<float32, 4>();
|
||||
_TypeSizeChecker<float64, 8>();
|
||||
|
||||
_TypeSizeChecker<mtpPrime, 4>();
|
||||
_TypeSizeChecker<MTPint, 4>();
|
||||
_TypeSizeChecker<MTPlong, 8>();
|
||||
_TypeSizeChecker<MTPint128, 16>();
|
||||
_TypeSizeChecker<MTPint256, 32>();
|
||||
_TypeSizeChecker<MTPdouble, 8>();
|
||||
}
|
||||
}
|
||||
static_assert(sizeof(char) == 1, "Basic types size check failed");
|
||||
static_assert(sizeof(uchar) == 1, "Basic types size check failed");
|
||||
static_assert(sizeof(int16) == 2, "Basic types size check failed");
|
||||
static_assert(sizeof(uint16) == 2, "Basic types size check failed");
|
||||
static_assert(sizeof(int32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(uint32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(int64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(uint64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(float32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(float64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(mtpPrime) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(MTPint) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(MTPlong) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(MTPint128) == 16, "Basic types size check failed");
|
||||
static_assert(sizeof(MTPint256) == 32, "Basic types size check failed");
|
||||
static_assert(sizeof(MTPdouble) == 8, "Basic types size check failed");
|
||||
|
||||
// Unixtime functions
|
||||
|
||||
|
@@ -29,34 +29,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
namespace InlineBots {
|
||||
|
||||
namespace {
|
||||
|
||||
using ResultsByLoaderMap = QMap<FileLoader*, Result*>;
|
||||
NeverFreedPointer<ResultsByLoaderMap> ResultsByLoader;
|
||||
|
||||
void regLoader(FileLoader *loader, Result *result) {
|
||||
ResultsByLoader.createIfNull([]() -> ResultsByLoaderMap* {
|
||||
return new ResultsByLoaderMap();
|
||||
});
|
||||
ResultsByLoader->insert(loader, result);
|
||||
}
|
||||
|
||||
void unregLoader(FileLoader *loader) {
|
||||
if (!ResultsByLoader) {
|
||||
return;
|
||||
}
|
||||
ResultsByLoader->remove(loader);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Result *getResultFromLoader(FileLoader *loader) {
|
||||
if (!ResultsByLoader) {
|
||||
return nullptr;
|
||||
}
|
||||
return ResultsByLoader->value(loader, nullptr);
|
||||
}
|
||||
|
||||
Result::Result(const Creator &creator) : _queryId(creator.queryId), _type(creator.type) {
|
||||
}
|
||||
|
||||
|
@@ -120,6 +120,5 @@ private:
|
||||
std_::unique_ptr<internal::SendData> sendData;
|
||||
|
||||
};
|
||||
Result *getResultFromLoader(FileLoader *loader);
|
||||
|
||||
} // namespace InlineBots
|
||||
|
@@ -48,27 +48,6 @@ namespace {
|
||||
return result;
|
||||
}
|
||||
|
||||
FileKey fromFilePart(const QString &val) {
|
||||
FileKey result = 0;
|
||||
int32 i = val.size();
|
||||
if (i != 0x10) return 0;
|
||||
|
||||
while (i > 0) {
|
||||
--i;
|
||||
result <<= 4;
|
||||
|
||||
uint16 ch = val.at(i).unicode();
|
||||
if (ch >= 'A' && ch <= 'F') {
|
||||
result |= (ch - 'A') + 0x0A;
|
||||
} else if (ch >= '0' && ch <= '9') {
|
||||
result |= (ch - '0');
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString _basePath, _userBasePath;
|
||||
|
||||
bool _started = false;
|
||||
@@ -360,10 +339,6 @@ namespace {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fileExists(const FileKey &fkey, int options = UserPath | SafePath) {
|
||||
return fileExists(toFilePart(fkey), options);
|
||||
}
|
||||
|
||||
bool readFile(FileReadDescriptor &result, const QString &name, int options = UserPath | SafePath) {
|
||||
if (options & UserPath) {
|
||||
if (!_userWorking()) return false;
|
||||
|
@@ -1591,7 +1591,7 @@ public:
|
||||
if (_wLeft < si.width) {
|
||||
lineText = lineText.mid(0, currentBlock->from() - _localFrom) + _Elide;
|
||||
lineLength = currentBlock->from() + _Elide.size() - _lineStart;
|
||||
_selection.to = _selection.to = qMin(_selection.to, currentBlock->from());
|
||||
_selection.to = qMin(_selection.to, currentBlock->from());
|
||||
setElideBidi(currentBlock->from(), _Elide.size());
|
||||
elideSaveBlock(blockIndex - 1, _endBlock, currentBlock->from(), elideWidth);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user