Index: trunk/SophyaExt/FitsIOServer/fitsfile.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 1771)
+++ trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 1978)
@@ -254,5 +254,11 @@
   taille_des_chaines_.clear();
   dvl_.Clear();
+
+  dnull_ = 1.e-300;
+  fnull_ = 1.e-33;
+  inull_= 99999;
+  cnull_= string("xxx");
   
+
 }
 
@@ -742,9 +748,9 @@
 {
   int status= 0;
-  int    anull;
-  double dnull= 0.;
-  float fnull= 0.;
-  int inull= 0;
-  char* cnull= "";
+  int    anynul;
+  double dnull= dnull_;
+  float fnull= fnull_;
+  int inull= inull_;
+  char* cnull= const_cast<char*>(cnull_.c_str());
   int dcount = 0.;
   int fcount = 0.;
@@ -769,25 +775,25 @@
 	case FitsDataType_double :
 	  {
-	  fits_read_col(fptr_,TDOUBLE,ncol+1,ligneALire,premierElement,1,&dnull,&ddata[dcount++],&anull,&status);
+	  fits_read_col(fptr_,TDOUBLE,ncol+1,ligneALire,premierElement,1,&dnull,&ddata[dcount++],&anynul,&status);
 	    break;
 	  }
 	case FitsDataType_float :	  
-	  fits_read_col(fptr_,TFLOAT,ncol+1,ligneALire,premierElement,1,&fnull,&fdata[fcount++],&anull,&status);
+	  fits_read_col(fptr_,TFLOAT,ncol+1,ligneALire,premierElement,1,&fnull,&fdata[fcount++],&anynul,&status);
 	  break;
 	case  FitsDataType_int :
 	  fits_read_col(fptr_,TINT,ncol+1,ligneALire,premierElement,1,&inull,&idata[icount++],
-			&anull,&status);
+			&anynul,&status);
 	  break;
 	case  FitsDataType_long :
-	  fits_read_col(fptr_,TLONG,ncol+1,ligneALire,premierElement,1,&inull,&idata[icount++], &anull,&status);
+	  fits_read_col(fptr_,TLONG,ncol+1,ligneALire,premierElement,1,&inull,&idata[icount++], &anynul,&status);
 	case  FitsDataType_byte :
 	  {
 	    unsigned char uschar = 0;
-	    fits_read_col(fptr_,TBYTE,ncol+1,ligneALire,premierElement,1,&inull,&uschar, &anull,&status);
+	    fits_read_col(fptr_,TBYTE,ncol+1,ligneALire,premierElement,1,&inull,&uschar, &anynul,&status);
 	    idata[icount++] = (int)uschar;
 	  }
 	  break;
 	case FitsDataType_char :
-	  fits_read_col(fptr_,TSTRING,ncol+1,ligneALire,premierElement,1,cnull,&cdata[ccount++],&anull,&status);
+	  fits_read_col(fptr_,TSTRING,ncol+1,ligneALire,premierElement,1,cnull,&cdata[ccount++],&anynul,&status);
 	  break;
 	}
@@ -806,9 +812,9 @@
 {
   int status= 0;
-  int    anull;
-  double dnull= 0.;
-  float fnull= 0.;
-  int inull= 0;
-  char* cnull= "";
+  int    anynul;
+  double dnull= dnull_;
+  float fnull= fnull_;
+  int inull= inull_;
+  char* cnull=  const_cast<char*>(cnull_.c_str());
   int dcount = 0.;
   int fcount = 0.;
@@ -822,21 +828,21 @@
 	{ 
 	case FitsDataType_double :
-	  fits_read_col(fptr_,TDOUBLE,ncol+1,NoLine+1,1,1,&dnull,&ligne.ddata_[dcount++],&anull,&status);
+	  fits_read_col(fptr_,TDOUBLE,ncol+1,NoLine+1,1,1,&dnull,&ligne.ddata_[dcount++],&anynul,&status);
 	  break;
 	case FitsDataType_float :
-	  fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&ligne.fdata_[fcount++],&anull,&status);
+	  fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&ligne.fdata_[fcount++],&anynul,&status);
 	  break;
 	case FitsDataType_int :
-	  fits_read_col(fptr_,TINT,ncol+1,NoLine+1,1,1,&inull,&ligne.idata_[icount++], &anull,&status);
+	  fits_read_col(fptr_,TINT,ncol+1,NoLine+1,1,1,&inull,&ligne.idata_[icount++], &anynul,&status);
 	  break;
 	case FitsDataType_long :
-	  fits_read_col(fptr_,TLONG,ncol+1,NoLine+1,1,1,&inull,&ligne.ldata_[icount++], &anull,&status);
+	  fits_read_col(fptr_,TLONG,ncol+1,NoLine+1,1,1,&inull,&ligne.ldata_[icount++], &anynul,&status);
 	  break;
 	case FitsDataType_byte :
-	  fits_read_col(fptr_,TBYTE,ncol+1,NoLine+1,1,1,&inull,&ligne.bdata_[icount++], &anull,&status);
+	  fits_read_col(fptr_,TBYTE,ncol+1,NoLine+1,1,1,&inull,&ligne.bdata_[icount++], &anynul,&status);
 	  break;
 	case FitsDataType_char :
 	  char* chaine = new char[taille_des_chaines_[ccount]];
-	  fits_read_col(fptr_,TSTRING,ncol+1,NoLine+1,1,1,cnull,&chaine,&anull,&status);
+	  fits_read_col(fptr_,TSTRING,ncol+1,NoLine+1,1,1,cnull,&chaine,&anynul,&status);
 	  ligne.cdata_[ccount++] = string(chaine);
 	  break;
@@ -857,11 +863,11 @@
 {
   int status= 0;
-  int    anull;
-  float fnull= 0.;
+  int    anynul;
+  float fnull= fnull_;
   long nels=1;
   int ncol;
   for (ncol=0; ncol<nbcols_; ncol++)
     {
-      fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&fdata[ncol],&anull,&status);
+      fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&fdata[ncol],&anynul,&status);
       if (status)
 	{
@@ -892,20 +898,9 @@
 	}
       long nels=nentries;
-      int    anull;
-      // no checking for undefined pixels
-      double dnull= 0.;
-      //     fits_read_key(fptr_,TDOUBLE,"BAD_DATA",&dnull,NULL,&status);
-      //  if (status != 0) 
-      //	{
-      //	  dnull = -1.6375e30;  // default value
-      //	  status = 0;
-      //	}
-      //   if (nentries != nrows_*repeat)
-      //	{
-      //	  cout << " found " << nentries << " pixels, expected:  " << nrows_*repeat << endl;
-	  //	  throw PException(" FitsFile:::GetBinTabFCol ");
-      //	}
+      int    anynul;
+      double dnull= dnull_;
+
       fits_read_col(fptr_,TDOUBLE,NoCol+1,1,1,nels,&dnull,valeurs,
-			    &anull,&status);
+			    &anynul,&status);
       if( status )
 	{
@@ -931,20 +926,8 @@
 	}
       long nels=nentries;
-      int    anull;
-      // no checking for undefined pixels
-      float fnull= 0.;
-      //     fits_read_key(fptr_,TFLOAT,"BAD_DATA",&fnull,NULL,&status);
-      //    if (status != 0) 
-      //	{
-      //	  fnull = -1.6375e30;  // default value
-      //	  status = 0;
-      //	}
-      //  if (nentries != nrows_*repeat)
-      //	{
-      //	  cout << " found " << nentries << " pixels, expected:  " << nrows_*repeat << endl;
-	  //	  throw PException(" FitsFile:::GetBinTabFCol ");
-      //	}
+      int    anynul;
+      float fnull= fnull_;
       fits_read_col(fptr_,TFLOAT,NoCol+1,1,1,nels,&fnull,valeurs,
-			    &anull,&status);
+			    &anynul,&status);
       if( status ) printerrorAndContinue( status,"erreur lecture de colonne" );
     }
@@ -967,18 +950,6 @@
 	}
       long nels=nentries;
-      // no checking for undefined pixels
-      int    anull;
-      int inull= 0;
-      //     fits_read_key(fptr_,TINT,"BAD_DATA",&inull,NULL,&status);
-      //     if (status != 0) 
-      //	{
-      //	  inull = -999999;  // default value
-      //	  status = 0;
-      //	}
-      // if (nentries != nrows_*repeat)
-      //	{
-      //	  cout << " found " << nentries << " pixels, expected:  " << nrows_*repeat << endl;
-	  //	  throw PException(" FitsFile:::GetBinTabFCol ");
-      //	}
+      int    anynul;
+      int inull= inull_;
 
 
@@ -986,5 +957,5 @@
       // voir commentaire dans putColToFits()
       fits_read_col(fptr_,TINT,NoCol+1,1,1,nels,&inull,valeurs,
-			    &anull,&status);
+			    &anynul,&status);
       if( status ) printerrorAndContinue( status,"erreur lecture de colonne" );
     }
@@ -1006,16 +977,10 @@
 	}
       long nels=nentries;
-      // no checking for undefined pixels
-      int    anull;
-      char* cnull= "";
-      // if (nentries != nrows_*repeat/width)
-      //	{
-      //	  cout << " found " << nentries << " pixels, expected:  " << nrows_*repeat/width << endl;
-	  //	  throw PException(" FitsFile:::GetBinTabFCol ");
-      //	}
+      int    anynul;
+      char* cnull=  const_cast<char*>(cnull_.c_str());
       long frow=1;
       long felem=1;
       fits_read_col(fptr_,TSTRING,NoCol+1,frow,felem,nels,cnull,valeurs,
-		    &anull,&status);
+		    &anynul,&status);
       if( status ) printerrorAndContinue( status,"erreur lecture de colonne" );
     }
@@ -1039,10 +1004,9 @@
 	}
   
-      // no checking for undefined pixels
-      int    anull;
-      double dnull= 0.;
+      int    anynul;
+      double dnull= dnull_;
   
       long nels= nentries;
-      fits_read_img(fptr_,TDOUBLE,1,nels,&dnull,map,&anull,&status);
+      fits_read_img(fptr_,TDOUBLE,1,nels,&dnull,map,&anynul,&status);
       if( status ) printerror( status );
     }
@@ -1072,10 +1036,9 @@
 	  cout << " Conversion to float achieved by cfitsio lib" << endl;
 	}
-      // no checking for undefined pixels
-      int   anull;
-      float fnull= 0.;
+      int   anynul;
+      float fnull= fnull_;
       
       long nels= nentries;
-      fits_read_img(fptr_,TFLOAT,1,nels,&fnull, map,&anull,&status);
+      fits_read_img(fptr_,TFLOAT,1,nels,&fnull, map,&anynul,&status);
       if( status ) printerror( status );
     }
@@ -1105,10 +1068,9 @@
 	  cout << " Conversion to float achieved by cfitsio lib" << endl;
 	}
-      // no checking for undefined pixels
-      int   anull;
-      float fnull= 0.;
+      int   anynul;
+      float fnull= fnull_;
       
       long nels= nentries;
-      fits_read_img(fptr_,TINT,1,nels,&fnull,map,&anull,&status);
+      fits_read_img(fptr_,TINT,1,nels,&fnull,map,&anynul,&status);
       if( status ) printerror( status );
     }
@@ -1327,4 +1289,7 @@
 	    case 'C':
 	      fits_read_key(fileptr,TSTRING,keyname,strval,comment,&status);
+              if ( strncmp(keyname,"TTYPE",5) == 0 || 
+		   strncmp(keyname,"TFORM",5) == 0 ||
+		   strncmp(keyname,"TBCOL",5) == 0 ) break;
 	      dvl[keyname]= strval;
 	      dvl.SetComment(keyname, comment);
@@ -1352,5 +1317,5 @@
 	}
     } 
-  //  dvl_.Print();
+  //    dvl.Print();
 } 
 
@@ -1811,5 +1776,5 @@
   int k;
   int status= 0;
-  int    anull;
+  int    anynul;
   int ncol=0;
   long nels=1;
