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

Andrew Walker arwalker at sumusltd.com
Fri Feb 6 22:55:13 CET 2004


CVS commit by arwalker: 

Ensure that iStatus is set to 0 before calling any cftisio routines.
Set the value for the number of elements to be read correctly.


  M +27 -20    lfiio.cpp   1.2


--- kdeextragear-2/kst/kst/datasources/lfiio/lfiio.cpp  #1.1:1.2
@@ -74,5 +74,5 @@ KstObject::UpdateType LFIIOSource::updat
   int                   iColNumber;
   int                   iNumCols;
-  int                   iStatus;
+  int                   iStatus = 0;
   int                   iResult = 0;
   int                   iTypeCode;
@@ -115,4 +115,6 @@ KstObject::UpdateType LFIIOSource::updat
               strName.setNum( i );
               _strListColNames.append( strName );
+              
+              iStatus = 0;
             }
 
@@ -135,4 +137,5 @@ KstObject::UpdateType LFIIOSource::updat
         }
       }
+      iStatus = 0;
       fits_close_file( ffits, &iStatus );   
     }
@@ -151,5 +154,5 @@ int LFIIOSource::readField( double *v, c
   int       iCol;
   int       iRead = -1;
-  int       iStatus;
+  int       iStatus = 0;
   int       iAnyNull;
   int       iResult = 0;
@@ -175,6 +178,5 @@ int LFIIOSource::readField( double *v, c
       _valid = false;
 
-      QFile file( _filename );
-      if( file.exists( ) )
+      if( !_filename.isNull( ) && !_filename.isEmpty( ) )
       {
         iResult = fits_open_table( &ffits, _filename.ascii( ), READONLY, &iStatus );
@@ -189,9 +191,14 @@ int LFIIOSource::readField( double *v, c
                 fits_modify_vector_len( ffits, iCol+1, 1, &iStatus );
 
-          iResult = fits_read_col( ffits, TDOUBLE, iCol+1, s+1, 1, n+1, &dNan, v, &iAnyNull, &iStatus );
+          iStatus = 0;
+          iResult = fits_read_col( ffits, TDOUBLE, iCol+1, s+1, 1, n, &dNan, v, &iAnyNull, &iStatus );
                 if( iResult == 0 )
                 {
             iRead = n;
                 }
+          else
+          {
+            iStatus = 0;
+          }
 
           fits_close_file( ffits, &iStatus );      
@@ -309,5 +316,5 @@ bool understands_lfiio( const QString& f
   fitsfile* ffits;
   bool      bRetVal = false;
-  int       iStatus;
+  int       iStatus = 0;
 
   //





More information about the Kst mailing list