summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-06-02 16:03:31 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2021-06-03 00:38:05 +0300
commit01639b7cc25aa9235eb86b072cd4aa1cfd767069 (patch)
treedad6499fb2299696837926956b05a5dd451daccb /src/corelib/io
parent2b524528435047fe4b47991cb57ecfb5de5645b5 (diff)
QProcess: refine 'Channel' structure
- exclude unused notifier pointer on Windows; - use default initialization for members; - avoid bit fields in declarations as there are extra padding bytes anyway. Change-Id: I2e03c4c269c885c90c0a6d18b8a935885f4b3feb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess.cpp2
-rw-r--r--src/corelib/io/qprocess_p.h29
2 files changed, 12 insertions, 19 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 878f52fd00..d5c2c8980b 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 6df359e441..78bbe01cf2 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();