"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fitscore.c" between
cfitsio-3.49.tar.gz and cfitsio-4.0.0.tar.gz

About: CFITSIO is a library of C and Fortran subroutines for reading and writing data files in the FITS (Flexible Image Transport System) data format.

fitscore.c  (cfitsio-3.49):fitscore.c  (cfitsio-4.0.0)
skipping to change at line 75 skipping to change at line 75
int STREAM_DRIVER = 0; int STREAM_DRIVER = 0;
struct lconv *lcxxx; struct lconv *lcxxx;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
float ffvers(float *version) /* IO - version number */ float ffvers(float *version) /* IO - version number */
/* /*
return the current version number of the FITSIO software return the current version number of the FITSIO software
*/ */
{ {
*version = (float) 3.49; *version = (float) 4.0;
/* Aug 2020 /* May 2021
Previous releases: Previous releases:
*version = 3.49 Aug 2020
*version = 3.48 Apr 2020 *version = 3.48 Apr 2020
*version = 3.47 May 2019 *version = 3.47 May 2019
*version = 3.46 Oct 2018 *version = 3.46 Oct 2018
*version = 3.45 May 2018 *version = 3.45 May 2018
*version = 3.44 Apr 2018 *version = 3.44 Apr 2018
*version = 3.43 Mar 2018 *version = 3.43 Mar 2018
*version = 3.42 Mar 2017 *version = 3.42 Mar 2017
*version = 3.41 Nov 2016 *version = 3.41 Nov 2016
*version = 3.40 Oct 2016 *version = 3.40 Oct 2016
*version = 3.39 Apr 2016 *version = 3.39 Apr 2016
skipping to change at line 5497 skipping to change at line 5498
int ffgcprll( fitsfile *fptr, /* I - FITS file pointer */ int ffgcprll( fitsfile *fptr, /* I - FITS file pointer */
int colnum, /* I - column number (1 = 1st column of table) */ int colnum, /* I - column number (1 = 1st column of table) */
LONGLONG firstrow, /* I - first row (1 = 1st row of table) */ LONGLONG firstrow, /* I - first row (1 = 1st row of table) */
LONGLONG firstelem, /* I - first element within vector (1 = 1st) */ LONGLONG firstelem, /* I - first element within vector (1 = 1st) */
LONGLONG nelem, /* I - number of elements to read or write */ LONGLONG nelem, /* I - number of elements to read or write */
int writemode, /* I - = 1 if writing data, = 0 if reading data */ int writemode, /* I - = 1 if writing data, = 0 if reading data */
/* If = 2, then writing data, but don't modify */ /* If = 2, then writing data, but don't modify */
/* the returned values of repeat and incre. */ /* the returned values of repeat and incre. */
/* If = -1, then reading data in reverse */ /* If = -1, then reading data in reverse */
/* direction. */ /* direction. */
/* If writemode has 16 added, then treat */
/* TSTRING column as TBYTE vector */
double *scale, /* O - FITS scaling factor (TSCALn keyword value) */ double *scale, /* O - FITS scaling factor (TSCALn keyword value) */
double *zero, /* O - FITS scaling zero pt (TZEROn keyword value) */ double *zero, /* O - FITS scaling zero pt (TZEROn keyword value) */
char *tform, /* O - ASCII column format: value of TFORMn keyword */ char *tform, /* O - ASCII column format: value of TFORMn keyword */
long *twidth, /* O - width of ASCII column (characters) */ long *twidth, /* O - width of ASCII column (characters) */
int *tcode, /* O - column datatype code: I*4=41, R*4=42, etc */ int *tcode, /* O - abs(column datatype code): I*4=41, R*4=42, etc */
int *maxelem, /* O - max number of elements that fit in buffer */ int *maxelem, /* O - max number of elements that fit in buffer */
LONGLONG *startpos,/* O - offset in file to starting row & column * / LONGLONG *startpos,/* O - offset in file to starting row & column * /
LONGLONG *elemnum, /* O - starting element number ( 0 = 1st element) * / LONGLONG *elemnum, /* O - starting element number ( 0 = 1st element) * /
long *incre, /* O - byte offset between elements within a row */ long *incre, /* O - byte offset between elements within a row */
LONGLONG *repeat, /* O - number of elements in a row (vector column) * / LONGLONG *repeat, /* O - number of elements in a row (vector column) * /
LONGLONG *rowlen, /* O - length of a row, in bytes * / LONGLONG *rowlen, /* O - length of a row, in bytes * /
int *hdutype, /* O - HDU type: 0, 1, 2 = primary, table, bintable */ int *hdutype, /* O - HDU type: 0, 1, 2 = primary, table, bintable */
LONGLONG *tnull, /* O - null value for integer columns */ LONGLONG *tnull, /* O - null value for integer columns */
char *snull, /* O - null value for ASCII table columns */ char *snull, /* O - null value for ASCII table columns */
int *status) /* IO - error status */ int *status) /* IO - error status */
skipping to change at line 5534 skipping to change at line 5537
if (fptr->HDUposition != (fptr->Fptr)->curhdu) { if (fptr->HDUposition != (fptr->Fptr)->curhdu) {
/* reset position to the correct HDU if necessary */ /* reset position to the correct HDU if necessary */
ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status);
} else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) {
/* rescan header if data structure is undefined */ /* rescan header if data structure is undefined */
if ( ffrdef(fptr, status) > 0) if ( ffrdef(fptr, status) > 0)
return(*status); return(*status);
} else if (writemode > 0) { } else if (writemode > 0 && writemode != 15) {
/* Only terminate the header with the END card if */ /* Only terminate the header with the END card if */
/* writing to the stdout stream (don't have random access). */ /* writing to the stdout stream (don't have random access). */
/* Initialize STREAM_DRIVER to be the device number for */ /* Initialize STREAM_DRIVER to be the device number for */
/* writing FITS files directly out to the stdout stream. */ /* writing FITS files directly out to the stdout stream. */
/* This only needs to be done once and is thread safe. */ /* This only needs to be done once and is thread safe. */
if (STREAM_DRIVER <= 0 || STREAM_DRIVER > 40) { if (STREAM_DRIVER <= 0 || STREAM_DRIVER > 40) {
urltype2driver("stream://", &STREAM_DRIVER); urltype2driver("stream://", &STREAM_DRIVER);
} }
skipping to change at line 5629 skipping to change at line 5632
if (*hdutype == ASCII_TBL && snull[0] == '\0') if (*hdutype == ASCII_TBL && snull[0] == '\0')
{ {
/* In ASCII tables, a null value is equivalent to all spaces */ /* In ASCII tables, a null value is equivalent to all spaces */
strcpy(snull, " "); /* maximum of 17 spaces */ strcpy(snull, " "); /* maximum of 17 spaces */
nulpos = minvalue(17, *twidth); /* truncate to width of column */ nulpos = minvalue(17, *twidth); /* truncate to width of column */
snull[nulpos] = '\0'; snull[nulpos] = '\0';
} }
/* Special case: use writemode = 15,16,17,18 to interpret TSTRING columns
as TBYTE vectors instead (but not for ASCII tables).
writemode = 15 equivalent to writemode =-1
writemode = 16 equivalent to writemode = 0
writemode = 17 equivalent to writemode = 1
writemode = 18 equivalent to writemode = 2
*/
if (writemode >= 15 && writemode <= 18) {
if (abs(*tcode) == TSTRING && *hdutype != ASCII_TBL ) {
*incre = 1; /* each element is 1 byte wide */
if (*tcode < 0) *repeat = *twidth; /* variable columns appear to put wid
th in *twidth */
*twidth = 1; /* width of each element */
*scale = 1.0; /* no scaling */
*zero = 0.0;
*tnull = NULL_UNDEFINED; /* don't test for nulls */
*maxelem = DBUFFSIZE;
if (*tcode < 0) {
*tcode = -TBYTE; /* variable-length */
} else {
*tcode = TBYTE;
}
}
/* translate to the equivalent as listed above */
writemode -= 16;
}
/* Special case: interpret writemode = -1 as reading data, but */ /* Special case: interpret writemode = -1 as reading data, but */
/* don't do error check for exceeding the range of pixels */ /* don't do error check for exceeding the range of pixels */
if (writemode == -1) if (writemode == -1)
{ {
writemode = 0; writemode = 0;
rangecheck = 0; rangecheck = 0;
} }
/* Special case: interprete 'X' column as 'B' */ /* Special case: interprete 'X' column as 'B' */
if (abs(*tcode) == TBIT) if (abs(*tcode) == TBIT)
{ {
*tcode = *tcode / TBIT * TBYTE; *tcode = *tcode / TBIT * TBYTE;
*repeat = (*repeat + 7) / 8; *repeat = (*repeat + 7) / 8;
} }
/* Special case: support the 'rAw' format in BINTABLEs */ /* Special case: support the 'rAw' format in BINTABLEs */
if (*hdutype == BINARY_TBL && *tcode == TSTRING) { if (*hdutype == BINARY_TBL && *tcode == TSTRING) {
*repeat = *repeat / *twidth; /* repeat = # of unit strings in field */ if (*twidth)
*repeat = *repeat / *twidth; /* repeat = # of unit strings in field *
/
else
*repeat = 0;
} }
else if (*hdutype == BINARY_TBL && *tcode == -TSTRING) { else if (*hdutype == BINARY_TBL && *tcode == -TSTRING) {
/* variable length string */ /* variable length string */
*incre = 1; *incre = 1;
*twidth = (long) nelem; *twidth = (long) nelem;
} }
if (*hdutype == ASCII_TBL) if (*hdutype == ASCII_TBL)
*elemnum = 0; /* ASCII tables don't have vector elements */ *elemnum = 0; /* ASCII tables don't have vector elements */
else else
skipping to change at line 5680 skipping to change at line 5715
} }
/* calculate no. of pixels that fit in buffer */ /* calculate no. of pixels that fit in buffer */
/* allow for case where floats are 8 bytes long */ /* allow for case where floats are 8 bytes long */
if (abs(*tcode) == TFLOAT) if (abs(*tcode) == TFLOAT)
*maxelem = DBUFFSIZE / sizeof(float); *maxelem = DBUFFSIZE / sizeof(float);
else if (abs(*tcode) == TDOUBLE) else if (abs(*tcode) == TDOUBLE)
*maxelem = DBUFFSIZE / sizeof(double); *maxelem = DBUFFSIZE / sizeof(double);
else if (abs(*tcode) == TSTRING) else if (abs(*tcode) == TSTRING)
{ {
*maxelem = (DBUFFSIZE - 1)/ *twidth; /* leave room for final \0 */ if (*twidth)
*maxelem = (DBUFFSIZE - 1)/ *twidth; /* leave room for final \0 */
else
*maxelem = DBUFFSIZE - 1;
if (*maxelem == 0) { if (*maxelem == 0) {
snprintf(message,FLEN_ERRMSG, snprintf(message,FLEN_ERRMSG,
"ASCII string column is too wide: %ld; max supported width is %d", "ASCII string column is too wide: %ld; max supported width is %d",
*twidth, DBUFFSIZE - 1); *twidth, DBUFFSIZE - 1);
ffpmsg(message); ffpmsg(message);
return(*status = COL_TOO_WIDE); return(*status = COL_TOO_WIDE);
} }
} }
else else
*maxelem = DBUFFSIZE / *twidth; *maxelem = DBUFFSIZE / *twidth;
 End of changes. 9 change blocks. 
6 lines changed or deleted 47 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)