2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 15:15:13 +00:00

some warnings fixed, TDESKTOP_DISABLE_NETWORK_PROXY macro added

This commit is contained in:
John Preston
2016-03-20 11:16:35 +03:00
parent 2cbda4e1e5
commit 0b2bcbc3e9
25 changed files with 143 additions and 105 deletions

View File

@@ -642,14 +642,26 @@ namespace SignalHandlers {
return stream;
}
template <bool Unsigned, typename Type>
struct _writeNumberSignAndRemoveIt {
static void call(Type &number) {
if (number < 0) {
_writeChar('-');
number = -number;
}
}
};
template <typename Type>
struct _writeNumberSignAndRemoveIt<true, Type> {
static void call(Type &number) {
}
};
template <typename Type>
const dump &_writeNumber(const dump &stream, Type number) {
if (!CrashDumpFile) return stream;
if (number < 0) {
_writeChar('-');
number = -number;
}
_writeNumberSignAndRemoveIt<(Type(-1) > Type(0)), Type>::call(number);
Type upper = 1, prev = number / 10;
while (prev >= upper) {
upper *= 10;
@@ -937,7 +949,10 @@ namespace SignalHandlers {
Status start() {
CrashDumpPath = cWorkingDir() + qsl("tdata/working");
#ifdef Q_OS_WIN
if (FILE *f = _wfopen(CrashDumpPath.toStdWString().c_str(), L"rb")) {
FILE *f = nullptr;
if (_wfopen_s(&f, CrashDumpPath.toStdWString().c_str(), L"rb") != 0) {
f = nullptr;
} else {
#else
if (FILE *f = fopen(QFile::encodeName(CrashDumpPath).constData(), "rb")) {
#endif
@@ -964,12 +979,18 @@ namespace SignalHandlers {
}
#ifdef Q_OS_WIN
CrashDumpFile = _wfopen(CrashDumpPath.toStdWString().c_str(), L"wb");
if (_wfopen_s(&CrashDumpFile, CrashDumpPath.toStdWString().c_str(), L"wb") != 0) {
CrashDumpFile = nullptr;
}
#else
CrashDumpFile = fopen(QFile::encodeName(CrashDumpPath).constData(), "wb");
#endif
if (CrashDumpFile) {
#ifdef Q_OS_WIN
CrashDumpFileNo = _fileno(CrashDumpFile);
#else
CrashDumpFileNo = fileno(CrashDumpFile);
#endif
if (SetSignalHandlers) {
#ifndef Q_OS_WIN
struct sigaction sigact;