From 394602a80a205565f72de09a62c2ddb190f4fe89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 6 Jun 2023 15:02:55 +0200 Subject: Use qintptr for socket handles Because the real handle is also the size of a pointer, not int Change-Id: Ic2efdd56a5deffe9bd130ce02e549efd68d6a337 Reviewed-by: Qt CI Bot Reviewed-by: Timur Pocheptsov --- src/corelib/kernel/qeventdispatcher_win.cpp | 12 ++++++------ src/corelib/kernel/qeventdispatcher_win_p.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 020805f16f..f3721d912a 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -136,7 +136,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA QSNDict *sn_vec[4] = { &d->sn_read, &d->sn_write, &d->sn_except, &d->sn_read }; QSNDict *dict = sn_vec[type]; - QSockNot *sn = dict ? dict->value(wp) : 0; + QSockNot *sn = dict ? dict->value(qintptr(wp)) : 0; if (sn == nullptr) { d->postActivateSocketNotifiers(); } else { @@ -409,7 +409,7 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId) } } -void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event) +void QEventDispatcherWin32Private::doWsaAsyncSelect(qintptr socket, long event) { Q_ASSERT(internalHwnd); // BoundsChecker may emit a warning for WSAAsyncSelect when event == 0 @@ -558,7 +558,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); - int sockfd = notifier->socket(); + qintptr sockfd = notifier->socket(); int type = notifier->type(); #ifndef QT_NO_DEBUG if (sockfd < 0) { @@ -582,7 +582,7 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) const char *t[] = { "Read", "Write", "Exception" }; /* Variable "socket" below is a function pointer. */ qWarning("QSocketNotifier: Multiple socket notifiers for " - "same socket %d and type %s", sockfd, t[type]); + "same socket %" PRIdQINTPTR " and type %s", sockfd, t[type]); } QSockNot *sn = new QSockNot; @@ -626,7 +626,7 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); #ifndef QT_NO_DEBUG - int sockfd = notifier->socket(); + qintptr sockfd = notifier->socket(); if (sockfd < 0) { qWarning("QEventDispatcherWin32::unregisterSocketNotifier: invalid socket identifier"); return; @@ -643,7 +643,7 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier { Q_D(QEventDispatcherWin32); int type = notifier->type(); - int sockfd = notifier->socket(); + qintptr sockfd = notifier->socket(); Q_ASSERT(sockfd >= 0); QSFDict::iterator it = d->active_fd.find(sockfd); diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index e6ea6b28c3..558490a85e 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -71,9 +71,9 @@ private: struct QSockNot { QSocketNotifier *obj; - int fd; + qintptr fd; }; -typedef QHash QSNDict; +typedef QHash QSNDict; struct QSockFd { long event; @@ -82,7 +82,7 @@ struct QSockFd { explicit inline QSockFd(long ev = 0, long ma = 0) : event(ev), mask(ma), selected(false) { } }; -typedef QHash QSFDict; +typedef QHash QSFDict; struct WinTimerInfo { // internal timer info QObject *dispatcher; @@ -135,7 +135,7 @@ public: QSFDict active_fd; bool activateNotifiersPosted; void postActivateSocketNotifiers(); - void doWsaAsyncSelect(int socket, long event); + void doWsaAsyncSelect(qintptr socket, long event); bool closingDown = false; -- cgit v1.2.3