Index: trunk/SophyaExt/FitsIOServer/fabtcolread.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fabtcolread.cc	(revision 3114)
+++ trunk/SophyaExt/FitsIOServer/fabtcolread.cc	(revision 3128)
@@ -209,4 +209,19 @@
  int sta=0; long val=0;
  if(fits_read_key(fitsptr,TLONG,keyname,&val,NULL,&sta))
+   printerror(sta);
+ return val;
+}
+
+/*!
+  Read a fitsheader key into long
+  \param fitsptr : cfitio pointer to Fits file
+  \param keyname : name of the key
+  \return value into long long
+*/
+LONGLONG FitsOpenFile::ReadKeyLL(fitsfile *fitsptr,char *keyname)
+{
+ if(keyname==NULL || fitsptr==NULL) return 0;
+ int sta=0; LONGLONG val=0;
+ if(fits_read_key(fitsptr,TLONGLONG,keyname,&val,NULL,&sta))
    printerror(sta);
  return val;
@@ -267,5 +282,5 @@
   fbt.Print(3);
   // Read element by element
-  for(long i=0;i<fbt.GetNbLine();i++) {
+  for(LONGLONG i=0;i<fbt.GetNbLine();i++) {
     double x = fbt.Read(i);
     double y = fbt2.Read(i);
@@ -274,5 +289,5 @@
   // Read into a vector
   TVector<double> data;
-  long n = fbt.Read(32,50,data);
+  LONGLONG n = fbt.Read(32,50,data);
     cout<<"Number of values read: "<<n<<endl;
   data.ReSize(100);
@@ -402,5 +417,5 @@
 
  // Get number of rows
- if(fits_get_num_rows(GetFitsPtr(),&NBline,&sta)) {
+ if(fits_get_num_rowsll(GetFitsPtr(),&NBline,&sta)) {
    FitsOpenFile::printerror(sta);
    throw NotAvailableOperation("FitsABTColRd::Init: Error getting number of rows\n");
@@ -425,5 +440,5 @@
 
  // Get column type
- if(fits_get_coltype(GetFitsPtr(),ColNum+1,&ColTypeCode,NULL,NULL,&sta)) {
+ if(fits_get_coltypell(GetFitsPtr(),ColNum+1,&ColTypeCode,NULL,NULL,&sta)) {
    FitsOpenFile::printerror(sta);
    throw ParmError("FitsABTColRd::Init: Error getting column type\n");
@@ -436,12 +451,14 @@
  // Get column name back, tunit, tform
  char tunit[64], tform[64], tdisp[64];
- long repeat=0; double tscale=1., tzero=0.;
+ LONGLONG repeat=0; double tscale=1., tzero=0.;
  int rc=0;
  if(HDUType()==BINARY_TBL) {
-   fits_get_bcolparms(GetFitsPtr(),ColNum+1,labelcol,tunit,tform
+   fits_get_bcolparmsll(GetFitsPtr(),ColNum+1,labelcol,tunit,tform
                      ,&repeat,&tscale,&tzero,NULL,tdisp,&sta);
  } else {
-   fits_get_acolparms(GetFitsPtr(),ColNum+1,labelcol,&repeat,tunit,tform
+   long repeatlng;
+   fits_get_acolparms(GetFitsPtr(),ColNum+1,labelcol,&repeatlng,tunit,tform
                      ,&tscale,&tzero,NULL,tdisp,&sta);
+   repeat = repeatlng;
  }
  if(rc) {
@@ -525,4 +542,14 @@
 {
  return FitsOpenFile::ReadKeyL(GetFitsPtr(),keyname);
+}
+
+/*!
+  Read a fitsheader key into long long
+  \param keyname : name of the key
+  \return value into long long
+*/
+LONGLONG FitsABTColRd::ReadKeyLL(char *keyname)
+{
+ return FitsOpenFile::ReadKeyLL(GetFitsPtr(),keyname);
 }
 
@@ -549,5 +576,5 @@
   \endverbatim
 */
-double FitsABTColRd::Read(long n,bool usebuffer)
+double FitsABTColRd::Read(LONGLONG n,bool usebuffer)
 // Attention: n=nline [0,NBline[, cfistio veut [1,NBline]
 // Attention: colnum  [0,NBcol[ , cfistio veut [1,NBcol]
@@ -581,5 +608,5 @@
  if(n<LineDeb || n>LineFin) {
    NFitsRead++;
-   long row1,row2,nrow;
+   LONGLONG row1,row2,nrow;
    if(BuffSens>0) { // Cas remplissage forward
      row1 = n+1;
@@ -640,5 +667,5 @@
   \endverbatim
 */
-long FitsABTColRd::Read(long n1,long n2,TVector<double>& data)
+LONGLONG FitsABTColRd::Read(LONGLONG n1,LONGLONG n2,TVector<double>& data)
 {
  if(n1<0 || n1>=NBline)
@@ -649,8 +676,8 @@
  if(n2>=NBline) n2 = NBline-1;
 
- sa_size_t nread = n2-n1+1;
+ LONGLONG nread = n2-n1+1;
  if(data.Size()<nread) data.SetSize(nread);
 
- //for(long i=n1;i<=n2;i++) data(i-n1) = Read(i);
+ //for(LONGLONG i=n1;i<=n2;i++) data(i-n1) = Read(i);
  int sta=0;
  fits_read_col(GetFitsPtr(),TDOUBLE,ColNum+1,n1+1,1,nread,NULL,data.Data(),NULL,&sta);
@@ -664,5 +691,5 @@
 
 /*! idem before but for TVector of float */
-long FitsABTColRd::Read(long n1,long n2,TVector<float>& data)
+LONGLONG FitsABTColRd::Read(LONGLONG n1,LONGLONG n2,TVector<float>& data)
 {
  if(n1<0 || n1>=NBline)
@@ -673,8 +700,8 @@
  if(n2>=NBline) n2 = NBline-1;
 
- sa_size_t nread = n2-n1+1;
+ LONGLONG nread = n2-n1+1;
  if(data.Size()<nread) data.SetSize(nread);
 
- //for(long i=n1;i<=n2;i++) data(i-n1) = Read(i);
+ //for(LONGLONG i=n1;i<=n2;i++) data(i-n1) = Read(i);
  int sta=0;
  fits_read_col(GetFitsPtr(),TFLOAT,ColNum+1,n1+1,1,nread,NULL,data.Data(),NULL,&sta);
@@ -688,5 +715,5 @@
 
 /*! idem before but for TVector of unsigned short */
-long FitsABTColRd::Read(long n1,long n2,TVector<uint_2>& data)
+LONGLONG FitsABTColRd::Read(LONGLONG n1,LONGLONG n2,TVector<uint_2>& data)
 {
  if(n1<0 || n1>=NBline)
@@ -697,5 +724,5 @@
  if(n2>=NBline) n2 = NBline-1;
 
- sa_size_t nread = n2-n1+1;
+ LONGLONG nread = n2-n1+1;
  if(data.Size()<nread) data.SetSize(nread);
 
@@ -711,5 +738,5 @@
 
 /*! idem before but for TVector of int_4 */
-long FitsABTColRd::Read(long n1,long n2,TVector<int_4>& data)
+LONGLONG FitsABTColRd::Read(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
 {
  if(n1<0 || n1>=NBline)
@@ -720,8 +747,8 @@
  if(n2>=NBline) n2 = NBline-1;
 
- sa_size_t nread = n2-n1+1;
+ LONGLONG nread = n2-n1+1;
  if(data.Size()<nread) data.SetSize(nread);
 
- //for(long i=n1;i<=n2;i++) data(i-n1) = Read(i);
+ //for(LONGLONG i=n1;i<=n2;i++) data(i-n1) = Read(i);
  int sta=0;
  int T = (sizeof(long)==4) ? TLONG: TINT;
@@ -736,5 +763,5 @@
 
 /*! idem before but for TVector of int_8 */
-long FitsABTColRd::Read(long n1,long n2,TVector<int_8>& data)
+LONGLONG FitsABTColRd::Read(LONGLONG n1,LONGLONG n2,TVector<int_8>& data)
 {
 #ifdef TLONGLONG
@@ -746,5 +773,5 @@
  if(n2>=NBline) n2 = NBline-1;
 
- sa_size_t nread = n2-n1+1;
+ LONGLONG nread = n2-n1+1;
  if(data.Size()<nread) data.SetSize(nread);
 
@@ -773,7 +800,7 @@
   \return <0 means not found
 */
-long FitsABTColRd::FirstRow(double val1,double val2,long rowstart)
-{
- long row = -1;
+LONGLONG FitsABTColRd::FirstRow(double val1,double val2,LONGLONG rowstart)
+{
+ LONGLONG row = -1;
  if(NBline==0) return row;
  // Change buffer for efficiency
@@ -782,5 +809,5 @@
  if(rowstart<0) rowstart = 0;
  if(rowstart>=NBline) rowstart = NBline-1;
- for(long i=rowstart;i<NBline;i++) {
+ for(LONGLONG i=rowstart;i<NBline;i++) {
    double val = Read(i);
    if(val<val1 || val>val2) continue;
@@ -802,7 +829,7 @@
   \endverbatim
 */
-long FitsABTColRd::LastRow(double val1,double val2,long rowstart)
-{
- long row = -1;
+LONGLONG FitsABTColRd::LastRow(double val1,double val2,LONGLONG rowstart)
+{
+ LONGLONG row = -1;
  if(NBline==0) return row;
  // Change buffer for efficiency
@@ -810,5 +837,5 @@
  if(bsens>=0) {ChangeBuffer(BuffLen,-1); bchange=true;}
  if(rowstart<0 || rowstart>=NBline) rowstart = NBline-1;
- for(long i=rowstart;i>=0;i--) {
+ for(LONGLONG i=rowstart;i>=0;i--) {
    double val = Read(i);
    if(val<val1 || val>val2) continue;
@@ -853,5 +880,5 @@
   fbt.Print(3);
   // Read element by element
-  for(long i=0;i<fbt.GetNbLine();i++) {
+  for(LONGLONG i=0;i<fbt.GetNbLine();i++) {
     double x = fbt.Read(i);
     if(i%lpmod==0) cout<<i<<": "<<x<<endl;
@@ -859,5 +886,5 @@
   // Read into a vector
   TVector<double> data;
-  long n = fbt.Read(32,50,data);
+  LONGLONG n = fbt.Read(32,50,data);
     cout<<"Number of values read: "<<n<<endl;
   data.ReSize(100);
@@ -1027,5 +1054,6 @@
  // Get NAXIS 1 et 2
  int nfound=0;
- if(fits_read_keys_lng(GetFitsPtr(),"NAXIS",1,2,Naxis,&nfound,&sta)) {
+ // car fits_read_keys_lnglng n'est pas prototype dans longnam.h
+ if(ffgknjj(GetFitsPtr(),"NAXIS",1,2,Naxis,&nfound,&sta)) {
    FitsOpenFile::printerror(sta);
    throw RangeCheckError("FitsImg2DRd::Init: Error reading NAXIS cards\n");
@@ -1065,4 +1093,14 @@
 {
  return FitsOpenFile::ReadKeyL(GetFitsPtr(),keyname);
+}
+
+/*!
+  Read a fitsheader key into long long
+  \param keyname : name of the key
+  \return value into long long
+*/
+LONGLONG FitsImg2DRd::ReadKeyLL(char *keyname)
+{
+ return FitsOpenFile::ReadKeyLL(GetFitsPtr(),keyname);
 }
 
@@ -1088,5 +1126,5 @@
 \warning TMatrix data(Naxis2,Naxis1)
 */
-size_t FitsImg2DRd::Read(TMatrix<uint_2>& data)
+LONGLONG FitsImg2DRd::Read(TMatrix<uint_2>& data)
 {
  int sta=0;
@@ -1094,6 +1132,6 @@
  data.ReSize(Naxis[1],Naxis[0]);
 
- for(int j=0;j<Naxis[1];j++) {
-   long deb = j*Naxis[0]+1, nel = Naxis[0];
+ for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = j*Naxis[0]+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TUSHORT,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1102,5 +1140,5 @@
        NotAvailableOperation("FitsImg2DRd::Read(TMatrix<uint_2>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(j,i) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(j,i) = arr[i];
  }
 
@@ -1110,5 +1148,5 @@
 
 /*! Read image into a TMatrix<int_4> */
-size_t FitsImg2DRd::Read(TMatrix<int_4>& data)
+LONGLONG FitsImg2DRd::Read(TMatrix<int_4>& data)
 {
  int sta=0;
@@ -1117,6 +1155,6 @@
  int T = (sizeof(long)==4) ? TLONG: TINT;
 
- for(int j=0;j<Naxis[1];j++) {
-   long deb = j*Naxis[0]+1, nel = Naxis[0];
+ for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = j*Naxis[0]+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),T,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1125,5 +1163,5 @@
        NotAvailableOperation("FitsImg2DRd::Read(TMatrix<int_4>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(j,i) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(j,i) = arr[i];
  }
 
@@ -1133,5 +1171,5 @@
 
 /*! Read image into a TMatrix<int_8> */
-size_t FitsImg2DRd::Read(TMatrix<int_8>& data)
+LONGLONG FitsImg2DRd::Read(TMatrix<int_8>& data)
 {
  int sta=0;
@@ -1139,6 +1177,6 @@
  data.ReSize(Naxis[1],Naxis[0]);
 
- for(int j=0;j<Naxis[1];j++) {
-   long deb = j*Naxis[0]+1, nel = Naxis[0];
+ for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = j*Naxis[0]+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TLONGLONG,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1147,5 +1185,5 @@
        NotAvailableOperation("FitsImg2DRd::Read(TMatrix<int_8>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(j,i) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(j,i) = arr[i];
  }
 
@@ -1155,5 +1193,5 @@
 
 /*! Read image into a TMatrix<float> */
-size_t FitsImg2DRd::Read(TMatrix<float>& data)
+LONGLONG FitsImg2DRd::Read(TMatrix<float>& data)
 {
  int sta=0;
@@ -1161,6 +1199,6 @@
  data.ReSize(Naxis[1],Naxis[0]);
 
- for(int j=0;j<Naxis[1];j++) {
-   long deb = j*Naxis[0]+1, nel = Naxis[0];
+ for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = j*Naxis[0]+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TFLOAT,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1169,5 +1207,5 @@
        NotAvailableOperation("FitsImg2DRd::Read(TMatrix<float>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(j,i) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(j,i) = arr[i];
  }
 
@@ -1177,5 +1215,5 @@
 
 /*! Read image into a TMatrix<double> */
-size_t FitsImg2DRd::Read(TMatrix<double>& data)
+LONGLONG FitsImg2DRd::Read(TMatrix<double>& data)
 {
  int sta=0;
@@ -1183,6 +1221,6 @@
  data.ReSize(Naxis[1],Naxis[0]);
 
- for(int j=0;j<Naxis[1];j++) {
-   long deb = j*Naxis[0]+1, nel = Naxis[0];
+ for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = j*Naxis[0]+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TDOUBLE,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1191,5 +1229,5 @@
        NotAvailableOperation("FitsImg2DRd::Read(TMatrix<double>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(j,i) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(j,i) = arr[i];
  }
 
@@ -1343,5 +1381,6 @@
  // Get NAXIS 1, 2 et 3
  int nfound=0;
- if(fits_read_keys_lng(GetFitsPtr(),"NAXIS",1,3,Naxis,&nfound,&sta)) {
+ // car fits_read_keys_lnglng n'est pas prototype dans longnam.h
+ if(ffgknjj(GetFitsPtr(),"NAXIS",1,3,Naxis,&nfound,&sta)) {
    FitsOpenFile::printerror(sta);
    throw RangeCheckError("FitsImg3DRd::Init: Error reading NAXIS cards\n");
@@ -1384,4 +1423,14 @@
 
 /*!
+  Read a fitsheader key into long long
+  \param keyname : name of the key
+  \return value into long long
+*/
+LONGLONG FitsImg3DRd::ReadKeyLL(char *keyname)
+{
+ return FitsOpenFile::ReadKeyLL(GetFitsPtr(),keyname);
+}
+
+/*!
   Read a fitsheader key into string
   \param keyname : name of the key
@@ -1401,5 +1450,5 @@
 Read 3D image into a TArray<uint_2>
 */
-size_t FitsImg3DRd::Read(TArray<uint_2>& data)
+LONGLONG FitsImg3DRd::Read(TArray<uint_2>& data)
 {
  int sta=0;
@@ -1407,6 +1456,6 @@
  sa_size_t ndim[3] = {Naxis[0],Naxis[1],Naxis[2]}; data.ReSize(3,ndim);
 
- for(int k=0;k<Naxis[2];k++) for(int j=0;j<Naxis[1];j++) {
-   long deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
+ for(LONGLONG k=0;k<Naxis[2];k++) for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TUSHORT,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1415,5 +1464,5 @@
        NotAvailableOperation("FitsImg3DRd::Read(TArray<uint_2>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
  }
 
@@ -1423,5 +1472,5 @@
 
 /*! Read 3D image into a TArray<int_4> */
-size_t FitsImg3DRd::Read(TArray<int_4>& data)
+LONGLONG FitsImg3DRd::Read(TArray<int_4>& data)
 {
  int sta=0;
@@ -1430,6 +1479,6 @@
  int T = (sizeof(long)==4) ? TLONG: TINT;
 
- for(int k=0;k<Naxis[2];k++) for(int j=0;j<Naxis[1];j++) {
-   long deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
+ for(LONGLONG k=0;k<Naxis[2];k++) for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),T,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1438,5 +1487,5 @@
        NotAvailableOperation("FitsImg3DRd::Read(TArray<int_4>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
  }
 
@@ -1446,5 +1495,5 @@
 
 /*! Read 3D image into a TArray<int_8> */
-size_t FitsImg3DRd::Read(TArray<int_8>& data)
+LONGLONG FitsImg3DRd::Read(TArray<int_8>& data)
 {
  int sta=0;
@@ -1452,6 +1501,6 @@
  sa_size_t ndim[3] = {Naxis[0],Naxis[1],Naxis[2]}; data.ReSize(3,ndim);
 
- for(int k=0;k<Naxis[2];k++) for(int j=0;j<Naxis[1];j++) {
-   long deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
+ for(LONGLONG k=0;k<Naxis[2];k++) for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TLONGLONG,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1460,5 +1509,5 @@
        NotAvailableOperation("FitsImg3DRd::Read(TArray<int_8>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
  }
 
@@ -1468,5 +1517,5 @@
 
 /*! Read 3D image into a TArray<float> */
-size_t FitsImg3DRd::Read(TArray<float>& data)
+LONGLONG FitsImg3DRd::Read(TArray<float>& data)
 {
  int sta=0;
@@ -1474,6 +1523,6 @@
  sa_size_t ndim[3] = {Naxis[0],Naxis[1],Naxis[2]}; data.ReSize(3,ndim);
 
- for(int k=0;k<Naxis[2];k++) for(int j=0;j<Naxis[1];j++) {
-   long deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
+ for(LONGLONG k=0;k<Naxis[2];k++) for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TFLOAT,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1482,5 +1531,5 @@
        NotAvailableOperation("FitsImg3DRd::Read(TArray<float>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
  }
 
@@ -1490,5 +1539,5 @@
 
 /*! Read 3D image into a TArray<double> */
-size_t FitsImg3DRd::Read(TArray<double>& data)
+LONGLONG FitsImg3DRd::Read(TArray<double>& data)
 {
  int sta=0;
@@ -1496,6 +1545,6 @@
  sa_size_t ndim[3] = {Naxis[0],Naxis[1],Naxis[2]}; data.ReSize(3,ndim);
 
- for(int k=0;k<Naxis[2];k++) for(int j=0;j<Naxis[1];j++) {
-   long deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
+ for(LONGLONG k=0;k<Naxis[2];k++) for(LONGLONG j=0;j<Naxis[1];j++) {
+   LONGLONG deb = Naxis[0]*(j+Naxis[1]*k)+1, nel = Naxis[0];
    fits_read_img(GetFitsPtr(),TDOUBLE,deb,nel,&NulVal,arr,NULL,&sta);
    if(sta) {
@@ -1504,5 +1553,5 @@
        NotAvailableOperation("FitsImg3DRd::Read(TArray<double>): Error Reading Fits file\n");
    }
-   for(int i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
+   for(LONGLONG i=0;i<Naxis[0];i++) data(i,j,k) = arr[i];
  }
 
