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)); return rpl::single(ContentWithoutPreview(item, repaint));
} }
constexpr auto kFullLoaded = 2; constexpr auto kFullLoaded = 2;
constexpr auto kSomeLoaded = 1;
constexpr auto kNotLoaded = 0;
const auto loadedLevel = [=] { const auto loadedLevel = [=] {
constexpr auto kSomeLoaded = 1;
constexpr auto kNotLoaded = 0;
const auto preview = media->replyPreview(); const auto preview = media->replyPreview();
return media->replyPreviewLoaded() return media->replyPreviewLoaded()
? kFullLoaded ? kFullLoaded

View file

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

View file

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

View file

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

View file

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

View file

@ -134,20 +134,13 @@ PRIVATE
) )
if (WIN32) if (WIN32)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options_if_exists(lib_tgvoip_bundled
target_compile_options(lib_tgvoip_bundled PRIVATE
PRIVATE /wd4005 # 'identifier' : macro redefinition
/wd4005 /wd4068 # unknown pragma
/wd4244 # conversion from 'int' to 'float', possible loss of data (several in webrtc) /wd4996 # deprecated
/wd5055 # operator '>' deprecated between enumerations and floating-point types /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()
elseif (APPLE) elseif (APPLE)
target_compile_definitions(lib_tgvoip_bundled target_compile_definitions(lib_tgvoip_bundled
PUBLIC PUBLIC