Bug 86918 - Can't use new dirfile data source
Summary: Can't use new dirfile data source
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-10 15:57 UTC by Netterfield
Modified: 2004-08-11 20:09 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2004-08-10 15:57:18 UTC
Version:           0.99-devel (using KDE 3.2 BRANCH >= 20040204, Mandrake Linux Cooker i586 - Cooker)
Compiler:          gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
OS:                Linux (i686) release 2.6.2-3mdk

In neither the data wizard, nor in the change file dialog, can you change to a new dirfile.  In the data wizard, <next> remains disabled if you try, and in changeFileDialog, it complains that the data file is invalid.
Comment 1 George Staikos 2004-08-11 17:04:36 UTC
Can't reproduce this in the data wizard.
Comment 2 George Staikos 2004-08-11 17:10:41 UTC
Seems to work in the vector dialog for me too.
Comment 3 Netterfield 2004-08-11 18:49:09 UTC
I see it on two machines, both with clean installs. 
(make clean, make dist-clean, make -f Makefile.cvs, configure, make uninstall, 
make, make install)

run kst; open the default dir file with the wizard.  All is well.  
try to open a different dirfile with the wizard - doesn't work.

Does anyone else see this?

On August 11, 2004 11:10 am, George Staikos wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
> http://bugs.kde.org/show_bug.cgi?id=86918
> staikos kde org changed:
>
>            What    |Removed                     |Added
> ---------------------------------------------------------------------------
>- Status|NEW                         |UNCONFIRMED
>
>
>
> ------- Additional Comments From staikos kde org  2004-08-11 17:10 -------
> Seems to work in the vector dialog for me too.

Comment 4 George Staikos 2004-08-11 19:55:52 UTC
On Wednesday 11 August 2004 12:49, netterfield@astro.utoronto.ca wrote:
> 18:49 ------- I see it on two machines, both with clean installs.
> (make clean, make dist-clean, make -f Makefile.cvs, configure, make
> uninstall, make, make install)
>
> run kst; open the default dir file with the wizard.  All is well.
> try to open a different dirfile with the wizard - doesn't work.
>
> Does anyone else see this?

   Ok I figured out how to reproduce it.  It's not a problem if the dirfile 
has the same contents, for some reason.

Comment 5 George Staikos 2004-08-11 20:03:57 UTC
  Appears to be a bit of a design flaw in getdata.c.  It gets confused on 
subsequent sessions.  Attempting to fix now...

Comment 6 George Staikos 2004-08-11 20:09:16 UTC
CVS commit by staikos: 

the field is not cacheable here.  a second instance of the dirfile reader
has completely different fields...
CCMAIL: 86918-done@bugs.kde.org


  M +2 -3      dirfile.cpp   1.11
  M +10 -13    getdata.c   1.15


--- kdeextragear-2/kst/kst/datasources/dirfile/dirfile.cpp  #1.10:1.11
@@ -126,5 +126,5 @@ void DirFileSource::save(QTextStream &ts
 }
 
-#include <kdebug.h>
+//#include <kdebug.h>
 
 extern "C" {
@@ -135,5 +135,4 @@ KstDataSource *create_dirfile(const QStr
 QStringList provides_dirfile() {
   QStringList rc;
-  // create the stringlist
   rc += "Directory of Binary Files";
   return rc;
@@ -149,5 +148,5 @@ int understands_dirfile(const QString& f
   }
 
-  //kdDebug() << "Don't understand.  FrameCount=" << frameCount << " err=" << err << endl;
+  //kdDebug() << "Don't understand.  filename = [" << filename << "] FrameCount=" << frameCount << " err=" << err << endl;
   return 0;
 }

--- kdeextragear-2/kst/kst/datasources/dirfile/getdata.c  #1.14:1.15
@@ -1364,7 +1364,6 @@ int GetNFrames(const char *filename_in, 
   struct stat statbuf;
   int nf;
+  char field_buf[80];
   const char *field;
-  static char default_field[80];
-  static int default_set = 0;
   int i;
   
@@ -1390,16 +1389,13 @@ int GetNFrames(const char *filename_in, 
 
   if (in_field == NULL) {
-    if (!default_set) {
       /* check for first valid raw field */
       for (i=0; i<F->n_raw; i++) {
         sprintf(raw_data_filename,"%s/%s", filename, F->rawEntries[i].field);
         if (stat(raw_data_filename, &statbuf) >=0) {
-          strncpy(default_field, F->rawEntries[i].field, 79);
+        strncpy(field_buf, F->rawEntries[i].field, 79);
           i = F->n_raw;
         }
       }
-      default_set = 1;
-    }
-    field = default_field;
+    field = field_buf;
   } else {
     field = in_field;
@@ -1451,2 +1447,3 @@ int GetSamplesPerFrame(const char *filen
   return (GetSPF(field_name, F, error_code));
 }
+/* vim: ts=2 sw=2 et */