diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 878f52fd004..d5c2c8980b4 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -391,6 +391,8 @@ void QProcessPrivate::Channel::clear() process->stdoutChannel.type = Normal; process->stdoutChannel.process = nullptr; break; + default: + break; } type = Normal; diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 6df359e4414..78bbe01cf24 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -231,23 +231,13 @@ public: Q_DECLARE_PUBLIC(QProcess) struct Channel { - enum ProcessChannelType { + enum ProcessChannelType : char { Normal = 0, PipeSource = 1, PipeSink = 2, Redirect = 3 - // if you add "= 4" here, increase the number of bits below }; - Channel() : process(nullptr), notifier(nullptr), type(Normal), closed(false), append(false) - { - pipe[0] = INVALID_Q_PIPE; - pipe[1] = INVALID_Q_PIPE; -#ifdef Q_OS_WIN - reader = 0; -#endif - } - void clear(); Channel &operator=(const QString &fileName) @@ -273,19 +263,20 @@ public: } QString file; - QProcessPrivate *process; - QSocketNotifier *notifier; -#ifdef Q_OS_WIN + QProcessPrivate *process = nullptr; +#ifdef Q_OS_UNIX + QSocketNotifier *notifier = nullptr; +#else union { - QWindowsPipeReader *reader; + QWindowsPipeReader *reader = nullptr; QWindowsPipeWriter *writer; }; #endif - Q_PIPE pipe[2]; + Q_PIPE pipe[2] = {INVALID_Q_PIPE, INVALID_Q_PIPE}; - unsigned type : 2; - bool closed : 1; - bool append : 1; + ProcessChannelType type = Normal; + bool closed = false; + bool append = false; }; QProcessPrivate();