Fix warnings on Windows

This commit is contained in:
Ilya Fedin 2024-07-03 22:55:10 +04:00 committed by John Preston
parent 8d0d9bb0bd
commit aa140b2919
6 changed files with 16 additions and 24 deletions

View file

@ -76,9 +76,9 @@ namespace {
return rpl::single(ContentWithoutPreview(item, repaint));
}
constexpr auto kFullLoaded = 2;
constexpr auto kSomeLoaded = 1;
constexpr auto kNotLoaded = 0;
const auto loadedLevel = [=] {
constexpr auto kSomeLoaded = 1;
constexpr auto kNotLoaded = 0;
const auto preview = media->replyPreview();
return media->replyPreviewLoaded()
? kFullLoaded

View file

@ -167,7 +167,7 @@ void SimilarChannels::draw(Painter &p, const PaintContext &context) const {
_hasHeavyPart = 1;
validateLastPremiumLock();
const auto drawOne = [&](const Channel &channel) {
const auto geometry = channel.geometry.translated(-_scrollLeft, 0);
const auto geometry = channel.geometry.translated(-int(_scrollLeft), 0);
const auto right = geometry.x() + geometry.width();
if (right <= 0) {
return;
@ -501,7 +501,7 @@ TextState SimilarChannels::textState(
return result;
}
for (const auto &channel : _channels) {
if (channel.geometry.translated(-_scrollLeft, 0).contains(point)) {
if (channel.geometry.translated(-int(_scrollLeft), 0).contains(point)) {
result.link = channel.link;
_lastPoint = point
+ QPoint(_scrollLeft, 0)

View file

@ -98,7 +98,6 @@ BOOL CALLBACK FindToActivate(HWND hwnd, LPARAM lParam) {
return TRUE;
}
// Found a Top-Level window.
auto level = 0;
if (WindowIdFromHWND(hwnd) == request->windowId) {
request->result = hwnd;
request->resultLevel = 3;
@ -310,8 +309,8 @@ void psDoFixPrevious() {
if (oldKeyRes2 == ERROR_SUCCESS) RegCloseKey(oldKey2);
if (existNew1 || existNew2) {
const auto deleteKeyRes1 = existOld1 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr1.c_str()) : ERROR_SUCCESS;
const auto deleteKeyRes2 = existOld2 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr2.c_str()) : ERROR_SUCCESS;
if (existOld1) RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr1.c_str());
if (existOld2) RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr2.c_str());
}
QString userDesktopLnk, commonDesktopLnk;
@ -326,7 +325,7 @@ void psDoFixPrevious() {
}
QFile userDesktopFile(userDesktopLnk), commonDesktopFile(commonDesktopLnk);
if (QFile::exists(userDesktopLnk) && QFile::exists(commonDesktopLnk) && userDesktopLnk != commonDesktopLnk) {
bool removed = QFile::remove(commonDesktopLnk);
QFile::remove(commonDesktopLnk);
}
} catch (...) {
}

View file

@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unique_qptr.h"
namespace Window {
class CounterLayerArgs;
struct CounterLayerArgs;
} // namespace Window
namespace Ui {

View file

@ -553,7 +553,7 @@ bool ReadSetting(
const auto proxy = readProxy();
if (proxy) {
list.push_back(proxy);
} else if (index < -list.size()) {
} else if (index < -int64(list.size())) {
++index;
} else if (index > list.size()) {
--index;

View file

@ -134,20 +134,13 @@ PRIVATE
)
if (WIN32)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(lib_tgvoip_bundled
PRIVATE
/wd4005
/wd4244 # conversion from 'int' to 'float', possible loss of data (several in webrtc)
/wd5055 # operator '>' deprecated between enumerations and floating-point types
)
else()
target_compile_definitions(lib_tgvoip_bundled
PUBLIC
# Doesn't build with mingw for now
TGVOIP_NO_DSP
)
endif()
target_compile_options_if_exists(lib_tgvoip_bundled
PRIVATE
/wd4005 # 'identifier' : macro redefinition
/wd4068 # unknown pragma
/wd4996 # deprecated
/wd5055 # operator '>' deprecated between enumerations and floating-point types
)
elseif (APPLE)
target_compile_definitions(lib_tgvoip_bundled
PUBLIC