[SCM] Tcl interface to FITS Files branch, debian, updated. 957360d99637535843c7c1cc648afca4b71e31df

Ole Streicher debian at liska.ath.cx
Thu Sep 27 09:04:02 UTC 2012


The following commit has been merged in the debian branch:
commit 957360d99637535843c7c1cc648afca4b71e31df
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Thu Sep 27 11:03:55 2012 +0200

    fix format error for file size; more cfitsio tests

diff --git a/debian/patches/fix_compiler_warnings.patch b/debian/patches/fix_compiler_warnings.patch
index 2961837..46f82ef 100644
--- a/debian/patches/fix_compiler_warnings.patch
+++ b/debian/patches/fix_compiler_warnings.patch
@@ -3,7 +3,18 @@ Description: Correct warnings with -Werror=format-security and conversion
  from pointer to int.
 --- a/fitsIO.c
 +++ b/fitsIO.c
-@@ -1782,7 +1782,7 @@
+@@ -81,8 +81,9 @@
+ {
+    int i,status=0;
+    int simple,extend;
+-   long pcount, gcount, rowlen, varidat;
++   long pcount, gcount, rowlen;
+    LONGLONG tbcol[FITS_COLMAX];
++   LONGLONG varidat;
+    char tmpStr[80];
+    char tmpKey[FLEN_KEYWORD];
+    Tcl_HashEntry *thisEntry; 
+@@ -1782,7 +1783,7 @@
  
     case TDOUBLE:
        dblData = (double *) ckalloc(nCol*nRow*sizeof(double));
@@ -12,7 +23,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  
        ffgsfd(curFile->fptr, 
  	     1,
-@@ -1826,7 +1826,7 @@
+@@ -1826,7 +1827,7 @@
  
     case TLONGLONG:
        longlongData = (LONGLONG *) ckalloc(nCol*nRow*sizeof(LONGLONG));
@@ -21,7 +32,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  
        ffgsfjj(curFile->fptr, 
  	      1,
-@@ -1875,7 +1875,7 @@
+@@ -1875,7 +1876,7 @@
  
     case TFLOAT:
        floatData = (float *) ckalloc(nCol*nRow*sizeof(float));
@@ -30,7 +41,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  
        ffgsfe(curFile->fptr, 
  	     1,
-@@ -1920,7 +1920,7 @@
+@@ -1920,7 +1921,7 @@
     case TLONG:
     case TINT:
        intData = (int *) ckalloc(nRow*nCol*sizeof(int));
@@ -39,7 +50,7 @@ Description: Correct warnings with -Werror=format-security and conversion
        ffgsfk(curFile->fptr, 
  	     1,
  	     curFile->CHDUInfo.image.naxes,
-@@ -1963,7 +1963,7 @@
+@@ -1963,7 +1964,7 @@
  
     case TSHORT:
        shortData = (short *) ckalloc(nCol*nRow*sizeof(short));
@@ -48,7 +59,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  
        ffgsfi(curFile->fptr, 
  	     1,
-@@ -2007,7 +2007,7 @@
+@@ -2007,7 +2008,7 @@
  
     case TBYTE:
        byteData = (unsigned char *) ckalloc(nCol*nRow*sizeof(unsigned char));
@@ -57,18 +68,29 @@ Description: Correct warnings with -Werror=format-security and conversion
  
        ffgsfb(curFile->fptr, 
  	     1,
-@@ -3977,8 +3977,8 @@
+@@ -3976,9 +3977,9 @@
+     if ( ifCSV == 1 )
        fprintf(fPtr, "\"");
      if ( ifPrintRow == 1 ) {
-       sprintf(outputStr, "%d", m);
+-      sprintf(outputStr, "%d", m);
 -      fprintf(fPtr, outputStr);
 -      fprintf(fPtr, sepString);
++      sprintf(outputStr, "%lld", m);
 +      fprintf(fPtr, "%s", outputStr);
 +      fprintf(fPtr, "%s", sepString);
      }
  
      saveVectorTableRowToAscii(curFile, filename, fileStatus, m, 1, fCol, nCols, baseColNum, ifCSV,
-@@ -4191,9 +4191,9 @@
+@@ -4180,7 +4181,7 @@
+ 	} else if( anyf ) {
+ 	  /* */
+ 	} else {
+-	  strcpy(outputStr,longlongValue[0]);
++	  sprintf(outputStr,colFormat,longlongValue[0]);
+ 	} 
+ 	break;
+     
+@@ -4191,9 +4192,9 @@
  	return TCL_ERROR;
      }
  
@@ -80,7 +102,7 @@ Description: Correct warnings with -Werror=format-security and conversion
    }
  
    return TCL_OK;
-@@ -4406,9 +4406,9 @@
+@@ -4406,9 +4407,9 @@
  	  fprintf(fPtr, rowFormatStr, outputStr);
  	} else {
  	  /* don't pad */
@@ -92,7 +114,7 @@ Description: Correct warnings with -Werror=format-security and conversion
        }
        for (j=0; j< nCols; j++) {
  
-@@ -4423,7 +4423,7 @@
+@@ -4423,7 +4424,7 @@
                                       0, sepString, ifVariableVec, colFStr[j], dataType, fPtr, ifFixedFormat);
             if ( ifFixedFormat == 0 ) {
                if ( j < nCols-1 ) {
@@ -101,7 +123,7 @@ Description: Correct warnings with -Werror=format-security and conversion
                }
             }
            
-@@ -4716,7 +4716,7 @@
+@@ -4716,7 +4717,7 @@
     	 if ( ifFixedFormat == 0 ) {
     	   if ( j != nCols-1 )
     	     /* print sepString if we're not on last column */
@@ -110,7 +132,7 @@ Description: Correct warnings with -Werror=format-security and conversion
     	 }
          }
        }
-@@ -4875,7 +4875,7 @@
+@@ -4875,7 +4876,7 @@
  
     case TDOUBLE:
        dblData = (double *) ckalloc(nCols*nRows*sizeof(double));
@@ -119,7 +141,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  
        ffgsfd(curFile->fptr, 
  	     0,
-@@ -4905,8 +4905,8 @@
+@@ -4905,8 +4906,8 @@
  	if ( ifPrintRow == 1 ) {
  	  int rowNum = fRow + j;
  	  sprintf(outputStr, "%d", rowNum);
@@ -130,7 +152,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	for (i=0; i<nCols ; i++ ) {
  	  tmpIndex = j*nCols + i;
-@@ -4916,9 +4916,9 @@
+@@ -4916,9 +4917,9 @@
  	    sprintf(outputStr,"%#.10E", dblData[tmpIndex]);
  	    /* sprintf(outputStr,"%s", dblData[tmpIndex]); */
  	  }
@@ -142,7 +164,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	if ( ifCSV == 1)
  	  fprintf(fPtr, "\"");
-@@ -4929,7 +4929,7 @@
+@@ -4929,7 +4930,7 @@
  
     case TLONGLONG:
        longlongData = (LONGLONG *) ckalloc(nCols*nRows*sizeof(LONGLONG));
@@ -151,7 +173,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  
        ffgsfjj(curFile->fptr, 
  	     0,
-@@ -4959,8 +4959,8 @@
+@@ -4959,8 +4960,8 @@
  	if ( ifPrintRow == 1 ) {
  	  int rowNum = fRow + j;
  	  sprintf(outputStr, "%d", rowNum);
@@ -162,7 +184,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	for (i=0; i<nCols ; i++ ) {
  	  tmpIndex = j*nCols + i;
-@@ -4973,9 +4973,9 @@
+@@ -4973,9 +4974,9 @@
  	    sprintf(outputStr,"%lld", longlongData[tmpIndex]);
  #endif
  	  }
@@ -174,7 +196,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	if ( ifCSV == 1)
  	  fprintf(fPtr, "\"");
-@@ -4986,7 +4986,7 @@
+@@ -4986,7 +4987,7 @@
  
     case TFLOAT:
        floatData = (float *) ckalloc(nCols*nRows*sizeof(float));
@@ -183,7 +205,7 @@ Description: Correct warnings with -Werror=format-security and conversion
        ffgsfe(curFile->fptr, 
  	     0,
  	     curFile->CHDUInfo.image.naxes,
-@@ -5015,8 +5015,8 @@
+@@ -5015,8 +5016,8 @@
  	if ( ifPrintRow == 1) {
  	  int rowNum = fRow + j;
  	  sprintf(outputStr, "%d", rowNum);
@@ -194,7 +216,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	for (i=0; i<nCols ; i++ ) {
  	  tmpIndex = j*nCols + i;
-@@ -5025,9 +5025,9 @@
+@@ -5025,9 +5026,9 @@
  	  } else {
  	    sprintf(outputStr,"%#.5f", floatData[tmpIndex]); 
  	  }
@@ -206,7 +228,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	if ( ifCSV == 1)
  	  fprintf(fPtr, "\"");
-@@ -5039,7 +5039,7 @@
+@@ -5039,7 +5040,7 @@
  
     case TINT:
        intData = (int *) ckalloc(nRows*nCols*sizeof(int));
@@ -215,7 +237,7 @@ Description: Correct warnings with -Werror=format-security and conversion
        ffgsfk(curFile->fptr, 
  	     0,
  	     curFile->CHDUInfo.image.naxes,
-@@ -5068,8 +5068,8 @@
+@@ -5068,8 +5069,8 @@
  	if ( ifPrintRow == 1) {
  	  int rowNum = fRow + j;
  	  sprintf(outputStr, "%d", rowNum);
@@ -226,7 +248,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	for (i=0; i<nCols ; i++ ) {
  	  tmpIndex = j*nCols + i;
-@@ -5078,9 +5078,9 @@
+@@ -5078,9 +5079,9 @@
  	  } else {
  	    sprintf(outputStr,"%d", intData[tmpIndex]); 
  	  }
@@ -238,7 +260,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	if ( ifCSV == 1)
  	  fprintf(fPtr, "\"");
-@@ -5092,7 +5092,7 @@
+@@ -5092,7 +5093,7 @@
  
     case TSHORT:
        shortData = (short *) ckalloc(nCols*nRows*sizeof(short));
@@ -247,7 +269,7 @@ Description: Correct warnings with -Werror=format-security and conversion
        ffgsfi(curFile->fptr, 
  	     0,
  	     curFile->CHDUInfo.image.naxes,
-@@ -5121,8 +5121,8 @@
+@@ -5121,8 +5122,8 @@
  	if ( ifPrintRow == 1) {
  	  int rowNum = fRow + j;
  	  sprintf(outputStr, "%d", rowNum);
@@ -258,7 +280,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	for (i=0; i<nCols ; i++ ) {
  	  tmpIndex = j*nCols + i;
-@@ -5131,9 +5131,9 @@
+@@ -5131,9 +5132,9 @@
  	  } else {
  	    sprintf(outputStr,"%d", shortData[tmpIndex]); 
  	  }
@@ -270,7 +292,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	if ( ifCSV == 1)
  	  fprintf(fPtr, "\"");
-@@ -5145,7 +5145,7 @@
+@@ -5145,7 +5146,7 @@
  
     case TBYTE:
        byteData = (unsigned char *) ckalloc(nCols*nRows*sizeof(unsigned char));
@@ -279,7 +301,7 @@ Description: Correct warnings with -Werror=format-security and conversion
        ffgsfb(curFile->fptr, 
  	     0,
  	     curFile->CHDUInfo.image.naxes,
-@@ -5174,8 +5174,8 @@
+@@ -5174,8 +5175,8 @@
  	if ( ifPrintRow == 1) {
  	  int rowNum = fRow + j;
  	  sprintf(outputStr, "%d", rowNum);
@@ -290,7 +312,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	for (i=0; i<nCols ; i++ ) {
  	  tmpIndex = j*nCols + i;
-@@ -5184,9 +5184,9 @@
+@@ -5184,9 +5185,9 @@
  	  } else {
  	    sprintf(outputStr,"%u", byteData[tmpIndex]); 
  	  }
@@ -302,7 +324,7 @@ Description: Correct warnings with -Werror=format-security and conversion
  	}
  	if ( ifCSV == 1)
  	  fprintf(fPtr, "\"");
-@@ -7120,13 +7120,13 @@
+@@ -7120,13 +7121,13 @@
     uniqueNum = 0;
     if (isMerge == 0  ) {
        for (i=0; i<numRows; i++) {
diff --git a/debian/patches/fix_fitsCmds.patch b/debian/patches/fix_fitsCmds.patch
index 27fc268..263c4d1 100644
--- a/debian/patches/fix_fitsCmds.patch
+++ b/debian/patches/fix_fitsCmds.patch
@@ -8,6 +8,15 @@ Description: Fix some bugs in fitsCmds.c:
     "get translatedKeywords".
 --- a/fitsCmds.c
 +++ b/fitsCmds.c
+@@ -360,7 +360,7 @@
+    
+    } else if( !strcmp("filesize",argv[2]) ) {
+ 
+-      sprintf(result,"%ld",curFile->fptr->Fptr->filesize/2880);
++      sprintf(result,"%lld",curFile->fptr->Fptr->filesize/2880);
+       Tcl_SetResult(curFile->interp, result, TCL_VOLATILE);
+ 
+    } else if( !strcmp("hdutype",argv[2]) ) {
 @@ -976,8 +976,8 @@
        int naxis = 2;
        long naxes[2];
diff --git a/debian/rules b/debian/rules
index a83a829..6f3ab6e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,7 +9,7 @@ override_dh_auto_configure:
 
 override_dh_auto_test:
 	( cd debian/tests; \
-	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o fitssize fitssize.c -lcfitsio; \
+	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -I/usr/include/tcl -o fitssize fitssize.c -lcfitsio; \
 	./fitssize; \
 	rm -f fitssize; \
 	TCLLIBPATH=../.. tclsh all.tcl)
diff --git a/debian/tests/fitssize.c b/debian/tests/fitssize.c
index 089398b..88de9ea 100644
--- a/debian/tests/fitssize.c
+++ b/debian/tests/fitssize.c
@@ -1,11 +1,8 @@
 /* gcc fitssize.c -lcfitsio -o fitssize */
 
-#include <sys/types.h>
+#include "../../fitsTclInt.h"
 #include <sys/stat.h>
-#include <stdio.h>
 #include <unistd.h>
-#include <string.h>
-#include <fitsio.h>
 
 int status = 0;
 
@@ -22,9 +19,9 @@ void create_fits(const char *fname) {
     fits_close_file(fptr, &status);
 }
 
-long get_size(const char *fname) {
+LONGLONG get_size(const char *fname) {
     fitsfile *infptr;
-    long filesize;
+    LONGLONG filesize;
     fits_open_file(&infptr, fname, READONLY, &status);
     filesize = infptr->Fptr->filesize;
     fits_close_file(infptr, &status);
@@ -33,7 +30,7 @@ long get_size(const char *fname) {
 
 int main(void) {
     char fname[] = "fileXXXXXX";
-    long fitssize;
+    LONGLONG fitssize;
     struct stat sbuf;
     close(mkstemp(fname));
     unlink(fname);
@@ -43,7 +40,11 @@ int main(void) {
     stat(fname, &sbuf);
     unlink(fname);
 
-    printf("CFITSIO size check: cfitsio = %li;  stat = %li\n", fitssize, (long)sbuf.st_size);
+    printf("CFITSIO size check: cfitsio = %li;  stat = %li\n", (long)fitssize, (long)sbuf.st_size);
+    printf("(long long):   %lld * 2880\n",(long long)(fitssize/2880));
+    printf("no cast; %%ld:  %ld * 2880\n",fitssize/2880);
+    printf("no cast; %%lld: %lld * 2880\n",fitssize/2880);
+    printf("sizeof(long long) = %lu sizeof(LONGLONG) = %lu\n",sizeof(long long), sizeof(LONGLONG));
     if (fitssize != (long)sbuf.st_size)
 	printf("*** CFITSIO reported wrong length! ***\n");
     if (status)

-- 
Tcl interface to FITS Files



More information about the debian-science-commits mailing list