[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdepim/enterprise4/kdepimlibs/qgpgme
From:       Marc Mutz <mutz () kde ! org>
Date:       2009-10-30 14:34:28
Message-ID: 1256913268.696538.7340.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1042721 by mutz:

QIODeviceDataProvider: use QProcess-specific API to detect error cases to get some \
poor-mans-error-handling until we fix this on a higher level

 M  +10 -2     dataprovider.cpp  


--- branches/kdepim/enterprise4/kdepimlibs/qgpgme/dataprovider.cpp #1042720:1042721
@@ -23,6 +23,7 @@
 #include <qgpgme/dataprovider.h>
 
 #include <QIODevice>
+#include <QProcess>
 
 #include <stdio.h>
 #include <string.h>
@@ -162,7 +163,14 @@
 static qint64 blocking_read( const boost::shared_ptr<QIODevice> & io, char * buffer, \
qint64 maxSize ) {  while ( !io->bytesAvailable() )
         if ( !io->waitForReadyRead( -1 ) )
-            return 0; // assume EOF (loses error cases :/ )
+            if ( const QProcess * const p = qobject_cast<QProcess*>( io.get() ) )
+                return p->error() == QProcess::UnknownError
+                    && p->exitStatus() == QProcess::NormalExit
+                    && p->exitCode() == 0
+                    ? 0
+                    : errno = EIO, -1 ;
+            else
+                return 0; // assume EOF (loses error cases :/ )
 
     return io->read( buffer, maxSize );
 }
@@ -194,7 +202,7 @@
 
 ssize_t QIODeviceDataProvider::write( const void * buffer, size_t bufSize ) {
 #ifndef NDEBUG
-  qDebug( "QIODeviceDataProvider::write( %p, %lu )", buffer, static_cast<unsigned \
long>( bufSize ) ); +  //qDebug( "QIODeviceDataProvider::write( %p, %lu )", buffer, \
static_cast<unsigned long>( bufSize ) );  #endif
   if ( bufSize == 0 )
     return 0;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic