Tons of compilation bugs fixed

This commit is contained in:
Stanislav Ershov 2017-11-27 13:16:11 +03:00
parent a2785b8a62
commit 7d3d01a117
17 changed files with 88 additions and 99 deletions

View File

@ -26,11 +26,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <openssl/bio.h>
#include <openssl/err.h>
#ifdef Q_OS_WIN // use Lzma SDK for win
#include <LzmaLib.h>
#else // Q_OS_WIN
//#ifdef Q_OS_WIN // use Lzma SDK for win
//#include <LzmaLib.h>
//#else // Q_OS_WIN
#include <lzma.h>
#endif // else of Q_OS_WIN
//#endif // else of Q_OS_WIN
#include "application.h"
#include "platform/platform_specific.h"
@ -244,11 +244,11 @@ void UpdateChecker::unpackUpdate() {
return fatalFail();
}
#ifdef Q_OS_WIN // use Lzma SDK for win
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
#else // Q_OS_WIN
//#ifdef Q_OS_WIN // use Lzma SDK for win
// const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
//#else // Q_OS_WIN
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = 0, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hOriginalSizeLen; // header
#endif // Q_OS_WIN
//#endif // Q_OS_WIN
QByteArray compressed = outputFile.readAll();
int32 compressedLen = compressed.size() - hSize;
@ -306,14 +306,14 @@ void UpdateChecker::unpackUpdate() {
uncompressed.resize(uncompressedLen);
size_t resultLen = uncompressed.size();
#ifdef Q_OS_WIN // use Lzma SDK for win
SizeT srcLen = compressedLen;
int uncompressRes = LzmaUncompress((uchar*)uncompressed.data(), &resultLen, (const uchar*)(compressed.constData() + hSize), &srcLen, (const uchar*)(compressed.constData() + hSigLen + hShaLen), LZMA_PROPS_SIZE);
if (uncompressRes != SZ_OK) {
LOG(("Update Error: could not uncompress lzma, code: %1").arg(uncompressRes));
return fatalFail();
}
#else // Q_OS_WIN
//#ifdef Q_OS_WIN // use Lzma SDK for win
// SizeT srcLen = compressedLen;
// int uncompressRes = LzmaUncompress((uchar*)uncompressed.data(), &resultLen, (const uchar*)(compressed.constData() + hSize), &srcLen, (const uchar*)(compressed.constData() + hSigLen + hShaLen), LZMA_PROPS_SIZE);
// if (uncompressRes != SZ_OK) {
// LOG(("Update Error: could not uncompress lzma, code: %1").arg(uncompressRes));
// return fatalFail();
// }
//#else // Q_OS_WIN
lzma_stream stream = LZMA_STREAM_INIT;
lzma_ret ret = lzma_stream_decoder(&stream, UINT64_MAX, LZMA_CONCATENATED);
@ -356,7 +356,7 @@ void UpdateChecker::unpackUpdate() {
LOG(("Error in decompression: %1 (error code %2)").arg(msg).arg(res));
return fatalFail();
}
#endif // Q_OS_WIN
//#endif // Q_OS_WIN
tempDir.mkdir(tempDir.absolutePath());

View File

@ -806,9 +806,9 @@ bool Generator::writeReplacements() {
QMap<QChar, QVector<int>> byCharIndices;
suggestionsSource_->stream() << "\
struct ReplacementStruct {\n\
small emojiSize;\n\
small replacementSize;\n\
small wordsCount;\n\
smallchar emojiSize;\n\
smallchar replacementSize;\n\
smallchar wordsCount;\n\
};\n\
\n\
const utf16char ReplacementData[] = {";
@ -833,7 +833,7 @@ const utf16char ReplacementData[] = {";
}
suggestionsSource_->stream() << " };\n\
\n\
const small ReplacementWordLengths[] = {";
const smallchar ReplacementWordLengths[] = {";
startBinary();
for (auto &replace : replaces_.list) {
auto wordLengths = QStringList();
@ -846,7 +846,7 @@ const small ReplacementWordLengths[] = {";
const ReplacementStruct ReplacementInitData[] = {\n";
for (auto &replace : replaces_.list) {
suggestionsSource_->stream() << "\
{ small(" << replace.id.size() << "), small(" << replace.replacement.size() << "), small(" << replace.words.size() << ") },\n";
{ smallchar(" << replace.id.size() << "), smallchar(" << replace.replacement.size() << "), smallchar(" << replace.words.size() << ") },\n";
}
suggestionsSource_->stream() << "};\n\
\n\

View File

@ -44,8 +44,8 @@ int main(int argc, char *argv[]) {
#else
QCoreApplication::addLibraryPath("/usr/lib/qt5/plugins");
#endif
setenv("QT_STYLE_OVERRIDE", "qwerty", false);
unsetenv("QT_QPA_PLATFORMTHEME");
qputenv("QT_STYLE_OVERRIDE", "qwerty");
qunsetenv("QT_QPA_PLATFORMTHEME");
int result = 0;
{

View File

@ -18,20 +18,20 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/audio_win.h"
#include "platform/win/windows_dlls.h"
#include "media/media_audio.h"
#include <mmdeviceapi.h>
#include <audioclient.h>
#include <wrl\client.h>
using namespace Microsoft::WRL;
namespace Platform {
namespace Audio {
namespace {
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
// Inspired by Chromium.
class DeviceListener : public IMMNotificationClient {

View File

@ -18,6 +18,8 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include <ShlGuid.h>
#include "platform/win/file_utilities_win.h"
#include "mainwindow.h"
@ -26,8 +28,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "lang/lang_keys.h"
#include "messenger.h"
#include <Shlwapi.h>
#include <Windowsx.h>
HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &, int hbitmapFormat);
@ -420,9 +420,9 @@ bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption,
} else {
files = dialog.selectedFiles().mid(0, 1);
}
if (type == Type::ReadFile || type == Type::ReadFiles) {
remoteContent = dialog.selectedRemoteContent();
}
// if (type == Type::ReadFile || type == Type::ReadFiles) {
// remoteContent = dialog.selectedRemoteContent();
// }
return true;
}
@ -432,4 +432,4 @@ bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption,
}
} // namespace FileDialog
} // namespace Platform
} // namespace Platform

View File

@ -18,6 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/main_window_win.h"
#include "styles/style_window.h"
@ -34,17 +35,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <qpa/qplatformnativeinterface.h>
#include <Shobjidl.h>
#include <shellapi.h>
#include <WtsApi32.h>
#include <roapi.h>
#include <wrl\client.h>
#include <wrl\implements.h>
#include <windows.ui.notifications.h>
#include <Windowsx.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) < (b) ? (b) : (a))
#include <gdiplus.h>
@ -229,7 +219,7 @@ public:
destroy();
return false;
}
SetWindowLong(hwnds[i], GWL_HWNDPARENT, (LONG)hwnd);
SetWindowLong(hwnds[i], GWLP_HWNDPARENT, (LONG)hwnd);
dcs[i] = CreateCompatibleDC(screenDC);
if (!dcs[i]) {
@ -705,18 +695,18 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) {
switch (mode) {
case dbiwmWindowAndTray: {
psSetupTrayIcon();
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWLP_HWNDPARENT);
if (psOwner) {
SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0);
SetWindowLong(ps_hWnd, GWLP_HWNDPARENT, 0);
psRefreshTaskbarIcon();
}
} break;
case dbiwmTrayOnly: {
psSetupTrayIcon();
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWLP_HWNDPARENT);
if (!psOwner) {
SetWindowLong(ps_hWnd, GWL_HWNDPARENT, (LONG)ps_tbHider_hWnd);
SetWindowLong(ps_hWnd, GWLP_HWNDPARENT, (LONG)ps_tbHider_hWnd);
}
} break;
@ -727,9 +717,9 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) {
}
trayIcon = 0;
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWLP_HWNDPARENT);
if (psOwner) {
SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0);
SetWindowLong(ps_hWnd, GWLP_HWNDPARENT, 0);
psRefreshTaskbarIcon();
}
} break;

View File

@ -18,6 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/notifications_manager_win.h"
#include "window/notifications_utilities.h"
@ -27,14 +28,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "mainwindow.h"
#include "base/task_queue.h"
#include <Shobjidl.h>
#include <shellapi.h>
#include <roapi.h>
#include <wrl\client.h>
#include <wrl\implements.h>
#include <windows.ui.notifications.h>
#include <strsafe.h>
#include <intsafe.h>

View File

@ -18,6 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/specific_win.h"
#include "platform/win/main_window_win.h"
@ -33,35 +34,14 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "passcodewidget.h"
#include "base/task_queue.h"
#include <Shobjidl.h>
#include <shellapi.h>
#include <roapi.h>
#include <wrl\client.h>
#include <wrl\implements.h>
#include <windows.ui.notifications.h>
#pragma warning(push)
#pragma warning(disable:4091)
#include <dbghelp.h>
#include <shlobj.h>
#pragma warning(pop)
#include <Shlwapi.h>
#include <Strsafe.h>
#include <Windowsx.h>
#include <WtsApi32.h>
#include <SDKDDKVer.h>
#include <sal.h>
#include <Psapi.h>
#include <strsafe.h>
#include <ObjBase.h>
#include <propvarutil.h>
#include <functiondiscoverykeys.h>
#include <intsafe.h>
#include <guiddef.h>
#include <qpa/qplatformnativeinterface.h>

View File

@ -18,6 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/window_title_win.h"
#include "ui/widgets/buttons.h"

View File

@ -18,17 +18,13 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/windows_app_user_model_id.h"
#include "platform/win/windows_dlls.h"
#include <propvarutil.h>
#include <propkey.h>
#include <roapi.h>
#include <wrl\client.h>
#include <wrl\implements.h>
#include <windows.ui.notifications.h>
using namespace Microsoft::WRL;
namespace Platform {

View File

@ -18,6 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/windows_dlls.h"
namespace Platform {

View File

@ -20,9 +20,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <windows.h>
#include <shlobj.h>
#include <roapi.h>
namespace Platform {
namespace Dlls {

View File

@ -18,6 +18,7 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
#include "platform/win/windows_event_filter.h"
#include "mainwindow.h"

View File

@ -53,6 +53,36 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#define MAC_USE_BREAKPAD
#endif // OS_MAC_STORE
#ifdef Q_OS_WIN
#include <SDKDDKVer.h>
// Windows Header Files:
#include <Windows.h>
#include <Windowsx.h>
#include <sal.h>
#include <Psapi.h>
#include <strsafe.h>
#include <objbase.h>
#include <ShObjIdl.h>
#include <propvarutil.h>
#include <functiondiscoverykeys.h>
#include <intsafe.h>
#include <guiddef.h>
#include <Shlwapi.h>
#include <roapi.h>
#include <wrl\client.h>
#include <wrl\implements.h>
#include <windows.ui.notifications.h>
#include <ShlObj.h>
#include <Shobjidl.h>
#include <shellapi.h>
#include <WtsApi32.h>
#include <Mmdeviceapi.h>
#include <audioclient.h>
#endif
#include <QtWidgets/QtWidgets>
#include <QtNetwork/QtNetwork>

View File

@ -337,9 +337,9 @@ void NewAvatarButton::paintEvent(QPaintEvent *e) {
}
void NewAvatarButton::setImage(const QImage &image) {
auto small = image.scaled(size() * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
Images::prepareCircle(small);
_image = App::pixmapFromImageInPlace(std::move(small));
auto smallImg = image.scaled(size() * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
Images::prepareCircle(smallImg);
_image = App::pixmapFromImageInPlace(std::move(smallImg));
_image.setDevicePixelRatio(cRetinaFactor());
update();
}

View File

@ -159,7 +159,7 @@ private:
class UsedWordGuard {
public:
UsedWordGuard(std::vector<small> &map, int index);
UsedWordGuard(std::vector<smallchar> &map, int index);
UsedWordGuard(const UsedWordGuard &other) = delete;
UsedWordGuard(UsedWordGuard &&other);
UsedWordGuard &operator=(const UsedWordGuard &other) = delete;
@ -168,16 +168,16 @@ private:
~UsedWordGuard();
private:
std::vector<small> &_map;
std::vector<smallchar> &_map;
int _index = 0;
small _guarded = 0;
smallchar _guarded = 0;
};
std::vector<small> _currentItemWordsUsedMap;
std::vector<smallchar> _currentItemWordsUsedMap;
};
Completer::UsedWordGuard::UsedWordGuard(std::vector<small> &map, int index) : _map(map), _index(index) {
Completer::UsedWordGuard::UsedWordGuard(std::vector<smallchar> &map, int index) : _map(map), _index(index) {
Expects(_map.size() > _index);
if (!_map[_index]) {
_guarded = _map[_index] = 1;
@ -297,7 +297,7 @@ void Completer::initWordsTracking() {
maxWordsCount = wordsCount;
}
}
_currentItemWordsUsedMap = std::vector<small>(maxWordsCount, 0);
_currentItemWordsUsedMap = std::vector<smallchar>(maxWordsCount, 0);
}
void Completer::filterInitialList() {

View File

@ -25,7 +25,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace Ui {
namespace Emoji {
using small = unsigned char;
using smallchar = unsigned char;
using medium = unsigned short;
using utf16char = unsigned short;