Add qWarning when trying to read or write a closed device

Change-Id: Ifda057d122a30d88749c6401185457f1900a913b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Laszlo Papp 2013-10-03 23:17:34 +01:00 committed by The Qt Project
parent 2c7ad71adb
commit fe1cbe9ca7

View File

@ -99,8 +99,10 @@ void debugBinaryString(const char *data, qint64 maxlen)
#define CHECK_WRITABLE(function, returnType) \
do { \
if ((d->openMode & WriteOnly) == 0) { \
if (d->openMode == NotOpen) \
if (d->openMode == NotOpen) { \
qWarning("QIODevice::"#function": device not open"); \
return returnType; \
} \
qWarning("QIODevice::"#function": ReadOnly device"); \
return returnType; \
} \
@ -109,8 +111,10 @@ void debugBinaryString(const char *data, qint64 maxlen)
#define CHECK_READABLE(function, returnType) \
do { \
if ((d->openMode & ReadOnly) == 0) { \
if (d->openMode == NotOpen) \
if (d->openMode == NotOpen) { \
qWarning("QIODevice::"#function": device not open"); \
return returnType; \
} \
qWarning("QIODevice::"#function": WriteOnly device"); \
return returnType; \
} \