gnuastro/gnuastro-cfitsio-version-format-change.patch
Dirk Stoecker fa131590a1 Accepting request 912799 from home:badshah400:branches:science
Add gnuastro-cfitsio-version-format-change.patch -- accounts for 3 number version string for CFITSIO; patch taken from upstream commit.

OBS-URL: https://build.opensuse.org/request/show/912799
OBS-URL: https://build.opensuse.org/package/show/science/gnuastro?expand=0&rev=17
2021-08-18 08:42:22 +00:00

27 lines
1.1 KiB
Diff

diff --git a/lib/fits.c b/lib/fits.c
index ef559759..5fe11bd6 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);