[Kst] kdeextragear-2/kst/kst/datasources/planck

George Staikos staikos at kde.org
Wed Feb 4 16:01:30 CET 2004


CVS commit by staikos: 

finally sort out all the issues with this plugin.  it no longer loops forever,
and can read partial or whole streams


  M +10 -6     planck.cpp   1.11


--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp  #1.10:1.11
@@ -55,6 +55,10 @@ KstObject::UpdateType PlanckSource::upda
 
 int PlanckSource::readField(double *v, const QString& field, int s, int n) {
-
+  kdDebug() << "Planck read field " << field << " - " << n << " samples from " << s << endl;
   if (field.lower() == "index") {
+    if (n < 0) {
+      v[0] = double(s);
+      return 1;
+    }
     for (int i = 0; i < n; ++i) {
       v[i] = double(s + i);
@@ -77,10 +81,10 @@ int PlanckSource::readField(double *v, c
   }
 
-  if (s + n >= count) { // trying to read past the end
-    n = count - s - 1;
+  if (n < 0) { // reading less than 0 -> read only one sample!
+    n = 1;
   }
 
-  if (n < 0) { // reading less than 0 -> read to the end!
-    n = end - start - s;
+  if (s + n > count) { // trying to read past the end
+    n = count - s;
   }
 
@@ -90,5 +94,5 @@ int PlanckSource::readField(double *v, c
   }
 
-  return _planckTOI->readObject(field, v, start + s, start + s + n);
+  return _planckTOI->readObject(field, v, start + s, start + s + n - 1);
 }
 





More information about the Kst mailing list