2007-11-12 Marcus Brinkmann <marcus@g10code.de>

* kdpipeiodevice.cpp: New version from Frank Osterfeld.
This commit is contained in:
Marcus Brinkmann 2007-11-12 11:34:13 +00:00
parent 4a86704d19
commit acf868bc7f
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2007-11-12 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp: New version from Frank Osterfeld.
2007-10-11 Marcus Brinkmann <marcus@g10code.de> 2007-10-11 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp: New version from Frank Osterfeld. * kdpipeiodevice.cpp: New version from Frank Osterfeld.

View File

@ -276,7 +276,7 @@ bool KDPipeIODevice::open( int fd, OpenMode mode ) { KDAB_CHECK_THIS;
bool KDPipeIODevice::open( Qt::HANDLE h, OpenMode mode ) { KDAB_CHECK_THIS; bool KDPipeIODevice::open( Qt::HANDLE h, OpenMode mode ) { KDAB_CHECK_THIS;
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
return d->doOpen( 0, h, mode ); return d->doOpen( -1, h, mode );
#else #else
Q_UNUSED( h ); Q_UNUSED( h );
Q_UNUSED( mode ); Q_UNUSED( mode );
@ -341,12 +341,15 @@ void KDPipeIODevice::Private::emitReadyRead()
bool KDPipeIODevice::Private::doOpen( int fd_, Qt::HANDLE handle_, OpenMode mode_ ) { bool KDPipeIODevice::Private::doOpen( int fd_, Qt::HANDLE handle_, OpenMode mode_ ) {
if ( q->isOpen() || fd_ < 0 ) if ( q->isOpen() )
return false; return false;
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
if ( !handle_ ) if ( !handle_ )
return false; return false;
#else
if ( fd_ < 0 )
return false;
#endif #endif
if ( !(mode_ & ReadWrite) ) if ( !(mode_ & ReadWrite) )
@ -662,7 +665,9 @@ void KDPipeIODevice::close() { KDAB_CHECK_THIS;
waitAndDelete( d->reader ); waitAndDelete( d->reader );
#undef waitAndDelete #undef waitAndDelete
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
qDebug( "Closing handle" ); if ( d->fd != -1 )
_close( d->fd );
else
CloseHandle( d->handle ); CloseHandle( d->handle );
#else #else
::close( d->fd ); ::close( d->fd );