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>
This commit is contained in:
parent
2b52452843
commit
01639b7cc2
@ -391,6 +391,8 @@ void QProcessPrivate::Channel::clear()
|
|||||||
process->stdoutChannel.type = Normal;
|
process->stdoutChannel.type = Normal;
|
||||||
process->stdoutChannel.process = nullptr;
|
process->stdoutChannel.process = nullptr;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = Normal;
|
type = Normal;
|
||||||
|
@ -231,23 +231,13 @@ public:
|
|||||||
Q_DECLARE_PUBLIC(QProcess)
|
Q_DECLARE_PUBLIC(QProcess)
|
||||||
|
|
||||||
struct Channel {
|
struct Channel {
|
||||||
enum ProcessChannelType {
|
enum ProcessChannelType : char {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
PipeSource = 1,
|
PipeSource = 1,
|
||||||
PipeSink = 2,
|
PipeSink = 2,
|
||||||
Redirect = 3
|
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();
|
void clear();
|
||||||
|
|
||||||
Channel &operator=(const QString &fileName)
|
Channel &operator=(const QString &fileName)
|
||||||
@ -273,19 +263,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString file;
|
QString file;
|
||||||
QProcessPrivate *process;
|
QProcessPrivate *process = nullptr;
|
||||||
QSocketNotifier *notifier;
|
#ifdef Q_OS_UNIX
|
||||||
#ifdef Q_OS_WIN
|
QSocketNotifier *notifier = nullptr;
|
||||||
|
#else
|
||||||
union {
|
union {
|
||||||
QWindowsPipeReader *reader;
|
QWindowsPipeReader *reader = nullptr;
|
||||||
QWindowsPipeWriter *writer;
|
QWindowsPipeWriter *writer;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
Q_PIPE pipe[2];
|
Q_PIPE pipe[2] = {INVALID_Q_PIPE, INVALID_Q_PIPE};
|
||||||
|
|
||||||
unsigned type : 2;
|
ProcessChannelType type = Normal;
|
||||||
bool closed : 1;
|
bool closed = false;
|
||||||
bool append : 1;
|
bool append = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
QProcessPrivate();
|
QProcessPrivate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user