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

List:       kde-commits
Subject:    Re: KDE/kdelibs/kde3support/kdeui
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2007-06-18 9:23:03
Message-ID: 20070618092302.GB4170 () ugly ! local
[Download RAW message or body]

On Sun, Jun 17, 2007 at 09:35:54PM +0000, Andreas Pakulat wrote:
> --- trunk/KDE/kdelibs/kde3support/kdeui/k3spell.cpp #676887:676888
> @@ -96,11 +113,11 @@
> -//  Connects a slot to K3ProcIO's output signal
> -#define OUTPUT(x) (connect (proc, SIGNAL (readReady(K3ProcIO *)), this, SLOT (x(K3ProcIO *))))
> +//  Connects a slot to KProcess's output signal
> +#define OUTPUT(x) (connect (proc, SIGNAL (readyReadStandardOutput()), this, SLOT (x())))
>
>  // Disconnect a slot from...
> -#define NOOUTPUT(x) (disconnect (proc, SIGNAL (readReady(K3ProcIO *)), this, SLOT (x(K3ProcIO *))))
> +#define NOOUTPUT(x) (disconnect (proc, SIGNAL (readyReadStandardOutput()), this, SLOT (x())))
>
IOCCC nomination pending. :)
fwiw, this slot-switching is very risky. if multiple lines get only one
notification because of some processing delay, everything will break
down. this needs a proper state machine in *one* slot.
yes, i know that this is not your code and that this is a compat class.
but do we want to keep potentially serious bugs in it?

> @@ -79,6 +79,23 @@
>    QList<BufferedWord> unchecked;
>    QTimer *checkNextTimer;
>    bool aspellV6;
> +  QTextCodec* m_codec;
> +  QString convertQByteArray( const QByteArray& b )
> +  {
> +      QTextCodec* originalCodec = QTextCodec::codecForCStrings();
> +      QTextCodec::setCodecForCStrings( m_codec );
> +      QString s( b );
> +      QTextCodec::setCodecForCStrings( originalCodec );
> +      return s;
> +  }
> +  QByteArray convertQString( const QString& s )
> +  {
> +      QTextCodec* originalCodec = QTextCodec::codecForCStrings();
> +      QTextCodec::setCodecForCStrings( m_codec );
> +      QByteArray b = s.toAscii();
> +      QTextCodec::setCodecForCStrings( originalCodec );
> +      return b;
> +  }
>  };
>  
errm, hallo?
how about m_coded->{from,to}Unicode?

> @@ -160,7 +177,7 @@
> -    proc->resetAll();
> +    proc->reset();
>
this is completely pointless. whatever functions of resetAll() are
needed, they have to be reimplemented.

> @@ -329,14 +350,16 @@
> -  if ( proc->readln( line, true ) == -1 )
> +  QByteArray data;
> +  qint64 read = proc->readLine(data.data(),data.count());
> +  if ( read == -1 )
>
what is *this* supposed to be? yes, untested. ;)

> @@ -497,14 +520,14 @@
> -  QString blank_line;
> -  while (proc->readln( blank_line, true ) != -1); // eat spurious blanks
> +  QByteArray data;
> +  while (proc->readLine( data.data(), data.count() ) != -1 ); // eat spurious blanks
>  
lalala ...

> @@ -543,23 +566,23 @@
> -  QString blank_line;
> -  while (proc->readln( blank_line, true ) != -1); // eat spurious blanks
> +  QByteArray data;
> +  while (proc->readLine( data.data(), data.count() ) != -1 ); // eat spurious blanks
>  
> -  QString blank_line;
> -  while (proc->readln( blank_line, true ) != -1); // eat the blank line
> +  QByteArray data;
> +  while (proc->readLine( data.data(), data.count() ) != -1 ); // eat spurious blanks
>  
> @@ -612,17 +635,17 @@
> -  QString blank_line;
> -  proc->readln( blank_line, true ); // eat the blank line
> +  QByteArray data;
> +  while (proc->readLine( data.data(), data.count() ) != -1 ); // eat spurious blanks
>  
> @@ -850,18 +873,20 @@
> -    tempe=proc->readln( line, true ); //get ispell's response
> +    QByteArray data;
> +    tempe = proc->readLine( data.data(), data.count() ); //get ispell's response
> @@ -1050,7 +1076,9 @@
> -    tempe = proc->readln( line, false ); //get ispell's response
> +    QByteArray data;
> +    tempe = proc->readLine( data.data(), data.count() ); //get ispell's response
> +    line = d->convertQByteArray( data );

> @@ -1114,13 +1142,13 @@
> -    proc->enableReadSignals(true);
> +//     proc->enableReadSignals(true);
>
> -  proc->ackRead();
> +//   proc->ackRead();
>  
> @@ -1185,7 +1213,7 @@
> -  proc->ackRead();
> +//   proc->ackRead();
>
delete 'em. the flaky handshaking is gone.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
[prev in list] [next in list] [prev in thread] [next in thread] 

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