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

Change #if-ery to be more in line with cmake logic (LINUX = NOT WIN32 AND NOT APPLE)

This commit is contained in:
Ilya Fedin
2023-09-15 09:51:42 +04:00
committed by John Preston
parent c12743925e
commit 7906be37b6
19 changed files with 93 additions and 93 deletions

View File

@@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <client/windows/handler/exception_handler.h>
#pragma warning(pop)
#elif defined Q_OS_UNIX // Q_OS_WIN
#else // Q_OS_WIN
#include <execinfo.h>
#include <sys/syscall.h>
@@ -197,13 +197,15 @@ const int HandledSignals[] = {
SIGABRT,
SIGFPE,
SIGILL,
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
SIGBUS,
SIGTRAP,
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
};
#ifdef Q_OS_UNIX
#ifdef Q_OS_WIN
void SignalHandler(int signum) {
#else // Q_OS_WIN
struct sigaction OldSigActions[32]/* = { 0 }*/;
void RestoreSignalHandlers() {
@@ -229,9 +231,7 @@ void InvokeOldSignalHandler(int signum, siginfo_t *info, void *ucontext) {
void SignalHandler(int signum, siginfo_t *info, void *ucontext) {
RestoreSignalHandlers();
#else // Q_OS_UNIX
void SignalHandler(int signum) {
#endif // else for Q_OS_UNIX
#endif // else for Q_OS_WIN
const char* name = 0;
switch (signum) {
@@ -253,9 +253,9 @@ void SignalHandler(int signum) {
ReportingThreadId = nullptr;
}
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
InvokeOldSignalHandler(signum, info, ucontext);
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
}
bool SetSignalHandlers = true;
@@ -267,9 +267,9 @@ google_breakpad::ExceptionHandler* BreakpadExceptionHandler = 0;
bool DumpCallback(const wchar_t* _dump_dir, const wchar_t* _minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool success)
#elif defined Q_OS_MAC // Q_OS_WIN
bool DumpCallback(const char* _dump_dir, const char* _minidump_id, void *context, bool success)
#elif defined Q_OS_UNIX // Q_OS_MAC
#else // Q_OS_MAC
bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, bool success)
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
{
if (CrashLogged) return success;
CrashLogged = true;
@@ -370,7 +370,7 @@ void StartCatching() {
false)) { // asynchronous_start
}
#endif // else for MAC_USE_BREAKPAD
#elif defined Q_OS_UNIX
#else
BreakpadExceptionHandler = new google_breakpad::ExceptionHandler(
google_breakpad::MinidumpDescriptor(QFile::encodeName(dumpspath).toStdString()),
/*FilterCallback*/ 0,
@@ -379,7 +379,7 @@ void StartCatching() {
true,
-1
);
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS
}

View File

@@ -49,9 +49,9 @@ extern "C" {
#endif // else of Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
#include <unistd.h>
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
namespace Core {
namespace {
@@ -448,9 +448,9 @@ bool UnpackUpdate(const QString &filepath) {
bool executable = false;
stream >> relativeName >> fileSize >> fileInnerData;
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
stream >> executable;
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
if (stream.status() != QDataStream::Ok) {
LOG(("Update Error: cant read file from downloaded stream, status: %1").arg(stream.status()));
return false;
@@ -1554,10 +1554,10 @@ bool checkReadyUpdate() {
#elif defined Q_OS_MAC // Q_OS_WIN
QString curUpdater = (cExeDir() + cExeName() + u"/Contents/Frameworks/Updater"_q);
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Telegram.app/Contents/Frameworks/Updater"_q);
#elif defined Q_OS_UNIX // Q_OS_MAC
#else // Q_OS_MAC
QString curUpdater = (cExeDir() + u"Updater"_q);
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater"_q);
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
if (!updater.exists()) {
QFileInfo current(curUpdater);
if (!current.exists()) {
@@ -1591,7 +1591,7 @@ bool checkReadyUpdate() {
ClearAll();
return false;
}
#elif defined Q_OS_UNIX // Q_OS_MAC
#else // Q_OS_MAC
// if the files in the directory are owned by user, while the directory is not,
// update will still fail since it's not possible to remove files
if (QFile::exists(curUpdater)
@@ -1619,7 +1619,7 @@ bool checkReadyUpdate() {
return false;
}
}
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
#ifdef Q_OS_MAC
base::Platform::RemoveQuarantine(QFileInfo(curUpdater).absolutePath());