[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Fri Jan 16 01:39:00 CET 2004


CVS commit by staikos: 

what a tricky little bug this was.  Properly update stdin.


  M +5 -2      stdinsource.cpp   1.3


--- kdeextragear-2/kst/kst/stdinsource.cpp  #1.2:1.3
@@ -52,4 +52,5 @@ KstObject::UpdateType KstStdinSource::up
   int i = 0;
   bool new_data = false;
+  bool got_some = false;
 
   FILE *fp = _file->fstream();
@@ -70,7 +71,8 @@ KstObject::UpdateType KstStdinSource::up
 
     new_data = false;
-    if (retval) {
+    if (retval > 0) {
       char *fgs = fgets(instr, 4096, stdin);
       if (fgs && fp) {
+        got_some = true;
         fputs(instr, fp);
         new_data = true;
@@ -79,7 +81,8 @@ KstObject::UpdateType KstStdinSource::up
   } while (++i < 100000 && new_data);
 
+  kdDebug() << "Read " << i << " samples" << endl;
   fflush(fp);
 
-  if (new_data) {
+  if (got_some) {
     return _src ? _src->update(u) : KstObject::NO_CHANGE;
   } else {





More information about the Kst mailing list