Fix warning when using QXmlInputSource with non opened QIODevice

Calling setTextModeEnabled on a QIODevice that is not open generates
a warning as a result of QTBUG-20905. Previously, it caused incorrect
behaviour when called with true.
Now only call it if the QIODevice passed in is already opened.
If not open, then it is opened by the xml reader without text mode,
so there is no difference in behaviour.

xml autotests still pass, although this removes several QWARN messages
from the qdom autotest.

Task-number: QTBUG-22659
Change-Id: Ie3137e44fe776bff6371ebd008428110168717ec
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
This commit is contained in:
Shane Kearns 2011-11-10 17:16:25 +00:00 committed by Qt by Nokia
parent 96611a677f
commit d457f148cf

View File

@ -1321,7 +1321,8 @@ QXmlInputSource::QXmlInputSource(QIODevice *dev)
{
init();
d->inputDevice = dev;
d->inputDevice->setTextModeEnabled(false);
if (dev->isOpen())
d->inputDevice->setTextModeEnabled(false);
}
/*!