[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 1db6add: Library (fits.h): accounts for 3 numb
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 1db6add: Library (fits.h): accounts for 3 number version string for CFITSIO |
Date: |
Tue, 3 Aug 2021 15:17:43 -0400 (EDT) |
branch: master
commit 1db6add7843ebc00a6e8b880107a118fcebfee72
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Library (fits.h): accounts for 3 number version string for CFITSIO
From CFITSIO version '4.0.0', CFITSIO has changed its version
format. Before this, it was a 2 digit number (like '3.49' or '3.48' and
etc), but from this major version, it will have three digits!
Because of the old format, until now, Gnuastro was printing the version as
a floating point number (with two decimal point precision). As a result,
the new versioning format of CFITSIO (which is no longer a floating point
number, and has three '.'s) caused a crash when building Gnuastro. But
fortunately, with the new number in the version, CFITSIO has also
introduced the 'CFITSIO_MICRO' macro to keep it as an integer.
With this commit, a pre-processor check has been added to see if
'CFITSIO_MICRO' is defined or not. If its not defined, then the user has an
older version of CFITSIO and Gnuastro will print the version as a 2-integer
number (separated by a '.'). If it is defined, then a three-digit version
number is printed.
This bug was reported by Vincenzo Testa and Zohreh Ghaffari.
This fixes bug #61007.
---
NEWS | 1 +
THANKS | 2 ++
doc/announce-acknowledge.txt | 2 ++
lib/fits.c | 15 +++++++++++++--
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index e9584c7..4961930 100644
--- a/NEWS
+++ b/NEWS
@@ -127,6 +127,7 @@ See the end of the file for license conditions.
bug #60989: MakeProfiles deletes input fits catalog when no output name
specified.
bug #60999: No content check when plain-text table doesn't have metadata.
+ bug #61007: Crash due to CFITSIO 4.0.0 version format change.
diff --git a/THANKS b/THANKS
index 55a7244..e8c9db5 100644
--- a/THANKS
+++ b/THANKS
@@ -44,6 +44,7 @@ support in Gnuastro. The list is ordered alphabetically (by
family name).
Sepideh Eskandarlou sepideh.eskandarlou@gmail.com
Gaspar Galaz ggalaz@astro.puc.cl
Andrés García-Serra Romero alu0101451923@ull.edu.es
+ Zohreh Ghaffari zoh.ghaffari@gmail.com
Thérèse Godefroy godef.th@free.fr
Madusha Gunawardhana gunawardhana@strw.leidenuniv.nl
Bruno Haible bruno@clisp.org
@@ -100,6 +101,7 @@ support in Gnuastro. The list is ordered alphabetically (by
family name).
Alfred M. Szmidt ams@gnu.org
Michel Tallon mtallon@obs.univ-lyon1.fr
Juan C. Tello jtello@iaa.es
+ Vincenzo Testa vincenzo.testa@inaf.it
Éric Thiébaut eric.thiebaut@univ-lyon1.fr
Ignacio Trujillo trujillo@iac.es
David Valls-Gabaud david.valls-gabaud@obspm.fr
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index aead2c7..ea7fa1b 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -2,12 +2,14 @@ Alphabetically ordered list to acknowledge in the next
release.
Fernando Buitrago
Mark Calabretta
+Zohreh Ghaffari
Leslie Hunt
Raúl Infante-Sainz
Matthias Kluge
Juan Miro
Juan Molina Tobar
Zahra Sharbaf
+Vincenzo Testa
Ignacio Trujillo
Aaron Watkins
diff --git a/lib/fits.c b/lib/fits.c
index ef55975..5fe11bd 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -2138,8 +2138,19 @@ gal_fits_key_write_version_in_ptr(gal_fits_list_key_t
**keylist, char *title,
/* Print 'Versions and date' title. */
gal_fits_key_write_title_in_ptr("Versions and date", fptr);
- /* Set the version of CFITSIO as a string. */
- sprintf(cfitsioversion, "%-.2f", CFITSIO_VERSION);
+ /* Set the version of CFITSIO as a string: before version 4.0.0 of
+ CFITSIO, there were only two numbers in the version (for example
+ '3.49' and '3.48'), but from the 4th major release, there are three
+ numbers in the version string. The third number corresponds to a new
+ 'CFITSIO_MICRO' macro. So if it doesn't exist, we'll just print two
+ numbers, otherwise, we'll print the three. */
+#ifdef CFITSIO_MICRO
+ sprintf(cfitsioversion, "%d.%d.%d", CFITSIO_MAJOR,
+ CFITSIO_MINOR, CFITSIO_MICRO);
+#else
+ sprintf(cfitsioversion, "%d.%d", CFITSIO_MAJOR,
+ CFITSIO_MINOR);
+#endif
/* Write all the information: */
fits_write_date(fptr, &status);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 1db6add: Library (fits.h): accounts for 3 number version string for CFITSIO,
Mohammad Akhlaghi <=