KProcess Line Mode Patch
Thiago Macieira
thiago at kde.org
Mon Dec 1 14:55:49 GMT 2008
On Monday 01 December 2008 15:36:29 Oswald Buddenhagen wrote:
> i wonder why you preferred to create a patch to KProcess instead of
> trying it via QTextStream as i suggested (and no, it is not my task to
> feed you the solution)? or if you did your homework, why you decided not
> to include the results into the argumentation?
QTextStream (as well as QDataStream) have some issues operating on sequential
QIODevices. They were made for using on QFile and QBuffer (QByteArray). So
they don't like when the read() functions return incomplete data.
By the way, that makes me realise yet another problem with the patch:
6) The code returns QStringList instead of QList<QByteArray>. That's
incorrect, since at this level (QIODevices) we don't know the encoding yet.
The code should operate on QByteArray only and leave the encoding to the upper
layer. Right now, it's using the codecForLocale, which often is not what you
want.
(which QTextStream does for you already, including BOM detection for UTF-16)
Please compile your code with #define QT_NO_CAST_FROM_ASCII and #define
QT_NO_CAST_TO_ASCII to avoid such issues.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Software Engineer - Nokia, Qt Software
Qt Software is hiring - ask me
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081201/ba5196fa/attachment.sig>
More information about the kde-core-devel
mailing list