Fix QIODevice::getChar optimization
commit98a05681851db9d88b1364af52be543715fbe306
authorJoão Abecasis <joao@abecasis.name>
Mon, 16 Nov 2009 12:07:53 +0000 (16 13:07 +0100)
committerJoão Abecasis <joao@abecasis.name>
Tue, 17 Nov 2009 13:00:51 +0000 (17 14:00 +0100)
treeea6822c15c8fee57288369cc5745616e63a88d84
parentd5eb850f8c2524aa5573bb4e672b195724e5b5ad
Fix QIODevice::getChar optimization

In Text mode there would be a huge penalty on each '\r' found even if
the internal buffer was not exhausted, because we would repeatedly
remove the '\r' from the buffer and put it back it. Before following
through to the unoptimized code, anyway.

Instead, we now loop over the internal buffer until we find a suitable
character.

Reduced code duplication by having QIODevice::getChar directly call
QIODevice::read and letting compilers do their job.

Reviewed-by: Markus Goetz
src/corelib/io/qiodevice.cpp