summaryrefslogtreecommitdiff
path: root/src/serialport/qwinoverlappedionotifier.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2017-09-28 13:22:28 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2017-10-12 08:44:59 +0000
commit42b0324d3c37d9bde5e06e183ec770c7556341c2 (patch)
tree21a03b3c8bbcbb8503993915c07104eeb721581a /src/serialport/qwinoverlappedionotifier.cpp
parent07e1fc7bb93dc4c306d8e64f4cb88d42177cba2e (diff)
downloadqtserialport-42b0324d3c37d9bde5e06e183ec770c7556341c2.tar.gz
Use C++11 member class initialization
Change-Id: I427b993a3a71f199029a8956cdf0dc2c98f0e444 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/serialport/qwinoverlappedionotifier.cpp')
-rw-r--r--src/serialport/qwinoverlappedionotifier.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/serialport/qwinoverlappedionotifier.cpp b/src/serialport/qwinoverlappedionotifier.cpp
index 6ec7463..dfae3b0 100644
--- a/src/serialport/qwinoverlappedionotifier.cpp
+++ b/src/serialport/qwinoverlappedionotifier.cpp
@@ -101,13 +101,13 @@ QT_BEGIN_NAMESPACE
struct IOResult
{
- IOResult(DWORD n = 0, DWORD e = 0, OVERLAPPED *p = 0)
+ IOResult(DWORD n = 0, DWORD e = 0, OVERLAPPED *p = nullptr)
: numberOfBytes(n), errorCode(e), overlapped(p)
{}
- DWORD numberOfBytes;
- DWORD errorCode;
- OVERLAPPED *overlapped;
+ DWORD numberOfBytes = 0;
+ DWORD errorCode = 0;
+ OVERLAPPED *overlapped = nullptr;
};
@@ -117,11 +117,6 @@ class QWinOverlappedIoNotifierPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWinOverlappedIoNotifier)
public:
- QWinOverlappedIoNotifierPrivate()
- : hHandle(INVALID_HANDLE_VALUE)
- {
- }
-
OVERLAPPED *waitForAnyNotified(QDeadlineTimer deadline);
void notify(DWORD numberOfBytes, DWORD errorCode, OVERLAPPED *overlapped);
void _q_notified();
@@ -130,9 +125,9 @@ public:
static QWinIoCompletionPort *iocp;
static HANDLE iocpInstanceLock;
static unsigned int iocpInstanceRefCount;
- HANDLE hHandle;
- HANDLE hSemaphore;
- HANDLE hResultsMutex;
+ HANDLE hHandle = INVALID_HANDLE_VALUE;
+ HANDLE hSemaphore = nullptr;
+ HANDLE hResultsMutex = nullptr;
QAtomicInt waiting;
QQueue<IOResult> results;
};
@@ -147,8 +142,7 @@ class QWinIoCompletionPort : protected QThread
public:
QWinIoCompletionPort()
: finishThreadKey(reinterpret_cast<ULONG_PTR>(this)),
- drainQueueKey(reinterpret_cast<ULONG_PTR>(this + 1)),
- hPort(INVALID_HANDLE_VALUE)
+ drainQueueKey(reinterpret_cast<ULONG_PTR>(this + 1))
{
setObjectName(QLatin1String("I/O completion port thread"));
HANDLE hIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
@@ -208,9 +202,9 @@ public:
protected:
void run()
{
- DWORD dwBytesRead;
- ULONG_PTR pulCompletionKey;
- OVERLAPPED *overlapped;
+ DWORD dwBytesRead = 0;
+ ULONG_PTR pulCompletionKey = 0;
+ OVERLAPPED *overlapped = nullptr;
DWORD msecs = INFINITE;
forever {
@@ -253,11 +247,11 @@ protected:
private:
const ULONG_PTR finishThreadKey;
const ULONG_PTR drainQueueKey;
- HANDLE hPort;
+ HANDLE hPort = INVALID_HANDLE_VALUE;
QSet<QWinOverlappedIoNotifierPrivate *> notifiers;
QMutex mutex;
QMutex drainQueueMutex;
- HANDLE hQueueDrainedEvent;
+ HANDLE hQueueDrainedEvent = nullptr;
};