Commit 46dd48fa authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Fixed byte-swapping flag issue with -fno-common compilation flag.

parent c09d0c93
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@ author = u'E. Bertin'
# built documents.
#
# The short X.Y version.
version = '2.24.2'
version = '2.25.1'
# The full version, including alpha/beta/rc tags.
release = '2.24.2'
release = '2.25.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -81,7 +81,7 @@ language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
today = 'Fri Dec 29 2017'
today = 'Tue Feb 11 2020'
#
# Else, today_fmt is used as the format for a strftime call.
#
@@ -144,7 +144,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'SExtractor v2.24.2'
# html_title = u'SExtractor v2.25.1'

# A shorter title for the navigation bar.  Default is the same as html_title.
#
+31 −18
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
*
*	This file part of:	AstrOmatic FITS/LDAC library
*
*	Copyright:		(C) 1995-2013 Emmanuel Bertin -- IAP/CNRS/UPMC
*	Copyright:		(C) 1995-2010 IAP/CNRS/SorbonneU
*
*	License:		GNU General Public License
*
@@ -23,7 +23,7 @@
*	along with AstrOmatic software.
*	If not, see <http://www.gnu.org/licenses/>.
*
*	Last modified:		28/03/2013
*	Last modified:		11/02/2020
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@@ -304,7 +304,7 @@ INPUT A pointer to the tab structure,
OUTPUT	-.
NOTES	.
AUTHOR	E. Bertin (IAP)
VERSION	28/03/2013
VERSION	11/02/2020
 ***/
void	read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
  {
@@ -313,18 +313,19 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
  unsigned char		cuval, cublank;
  char			*bufdata,
			cval, cblank;
  unsigned short	suval, sublank;
  unsigned short	suval, sublank, ashort=1;
  short			val16, sval, sblank;
#ifdef HAVE_LONG_LONG_INT
  ULONGLONG		lluval, llublank;
  SLONGLONG		llval, llblank;
#endif
  unsigned int		iuval, iublank;
  int			curval, dval, blankflag, ival, iblank;
  int			curval, dval, blankflag, bswapflag, ival, iblank;
  
  size_t	i, bowl, spoonful, npix;
  PIXTYPE	bs,bz;


/* a NULL cat structure indicates that no data can be read */
  if (!(cat = tab->cat))
    return;
@@ -332,6 +333,7 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
  bs = (PIXTYPE)tab->bscale;
  bz = (PIXTYPE)tab->bzero;
  blankflag = tab->blankflag;
  bswapflag = *((char *)&ashort);	// Byte-swapping flag

  switch(tab->compress_type)
    {
@@ -630,7 +632,7 @@ INPUT A pointer to the tab structure,
OUTPUT	-.
NOTES	.
AUTHOR	E. Bertin (IAP)
VERSION	28/03/2013
VERSION	11/02/2020
 ***/
void	read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
  {
@@ -638,12 +640,15 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
   static int		bufdata0[DATA_BUFSIZE/sizeof(int)];
   char			*bufdata;
   short		val16;
   int		i, bowl, spoonful, npix, curval, dval;
   unsigned short	ashort = 1;
   int			i, bowl, spoonful, npix, curval, dval, bswapflag;

/* a NULL cat structure indicates that no data can be read */
  if (!(cat = tab->cat))
    return;

  bswapflag = *((char *)&ashort);	// Byte-swapping flag

  switch(tab->compress_type)
    {
/*-- Uncompressed image */
@@ -810,7 +815,7 @@ INPUT A pointer to the tab structure,
OUTPUT	-.
NOTES	.
AUTHOR	E. Bertin (IAP)
VERSION	28/03/2013
VERSION	11/02/2020
 ***/
void	write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
  {
@@ -819,6 +824,10 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
   char			*cbufdata0;
   size_t		i, bowl, spoonful;
   PIXTYPE		bs,bz;
   unsigned short	ashort = 1;
   int			bswapflag;

  bswapflag = *((char *)&ashort);	// Byte-swapping flag

  bs = (PIXTYPE)tab->bscale;
  bz = (PIXTYPE)tab->bzero;
@@ -972,7 +981,7 @@ INPUT A pointer to the tab structure,
OUTPUT	-.
NOTES	.
AUTHOR	E. Bertin (IAP)
VERSION	28/03/2013
VERSION	11/02/2020
 ***/
void	write_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
  {
@@ -980,7 +989,11 @@ void write_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
   catstruct		*cat;
   char			*cbufdata0;
   size_t		i, bowl, spoonful;
   unsigned short	ashort = 1;
   double		bs,bz;
   int			bswapflag;

  bswapflag = *((char *)&ashort);	// Byte-swapping flag

  bs = tab->bscale;
  bz = tab->bzero;
+2 −5
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
*
*	This file part of:	AstrOmatic FITS/LDAC library
*
*	Copyright:		(C) 1995-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
*	Copyright:		(C) 1995-2020 IAP/CNRS/SorbonneU
*
*	License:		GNU General Public License
*
@@ -23,7 +23,7 @@
*	along with AstrOmatic software.
*	If not, see <http://www.gnu.org/licenses/>.
*
*	Last modified:		29/08/2012
*	Last modified:		11/02/2020
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@@ -332,7 +332,4 @@ extern void error(int, char *, char *),
		swapbytes(void *ptr, int nb, int n),
		warning(char *msg1, char *msg2);


int		bswapflag;

#endif
+2 −4
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
*
*	This file part of:	AstrOmatic FITS/LDAC library
*
*	Copyright:		(C) 1995-2013 Emmanuel Bertin -- IAP/CNRS/UPMC
*	Copyright:		(C) 1995-2020 IAP/CNRS/SorbonneU
*
*	License:		GNU General Public License
*
@@ -23,7 +23,7 @@
*	along with AstrOmatic software.
*	If not, see <http://www.gnu.org/licenses/>.
*
*	Last modified:		15/02/2013
*	Last modified:		11/02/2020
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@@ -90,8 +90,6 @@ char gstr[MAXCHAR];

/*----------------------------- External constants --------------------------*/

extern int	bswapflag;		/* != 0 if bytes are swapped/IEEE */

/*------------------------------- Other Macros -----------------------------*/

#if _LARGEFILE_SOURCE
+10 −8
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
*
*	This file part of:	AstrOmatic FITS/LDAC library
*
*	Copyright:		(C) 1995-2010 Emmanuel Bertin -- IAP/CNRS/UPMC
*	Copyright:		(C) 1995-2020 IAP/CNRS/SorbonneU
*
*	License:		GNU General Public License
*
@@ -23,7 +23,7 @@
*	along with AstrOmatic software.
*	If not, see <http://www.gnu.org/licenses/>.
*
*	Last modified:		09/10/2010
*	Last modified:		11/02/2020
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

@@ -97,14 +97,15 @@ OUTPUT Checksum.
NOTES	Straightforward copy of  Seaman & Pence 1995
	(ftp://iraf.noao.edu/misc/checksum/).
AUTHOR	E. Bertin (IAP)
VERSION	08/05/2001
VERSION	11/02/2020
 ***/
unsigned int	decode_checksum(char *str)

  {
   char			cbuf[16];
   unsigned short	*sbuf,
			los,his;
			los,his,
			ashort = 1;
   unsigned int		hi,lo, hicarry,locarry;
   int			i;

@@ -113,7 +114,7 @@ unsigned int decode_checksum(char *str)
    cbuf[i] = str[(i+1)%16] - 0x30;
  sbuf = (unsigned short *)cbuf;
  hi = lo = 0;
  if (bswapflag)
  if (*((char *)&ashort))	// Byte-swapping required
    for (i=4; i--;)
      {
      his = *(sbuf++);
@@ -153,19 +154,20 @@ NOTES From Seaman & Pence 1995 (ftp://iraf.noao.edu/misc/checksum/). But
	depends on the endianity of the machine. The routine below adds
	support for ix386-like processors (non-IEEE).
AUTHOR	E. Bertin (IAP)
VERSION	08/05/2001
VERSION	11/02/2020
 ***/
unsigned int	compute_blocksum(char *buf, unsigned int sum)
  {
   unsigned short	*sbuf,
			his,los;
			his,los,
			ashort = 1;
   unsigned int		hi,lo, hicarry,locarry;
   int			i;

  sbuf = (unsigned short *)buf;
  hi = (sum >> 16);
  lo = (sum << 16) >> 16;
  if (bswapflag)
  if (*((char *)&ashort))	// Byte-swapping required
     for (i=FBSIZE/4; i--;)
      {
      his = *(sbuf++);
Loading