diff options
| author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2023-12-20 00:57:05 +0100 |
|---|---|---|
| committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2023-12-20 00:59:40 +0100 |
| commit | 6d3aca7bbd23b8cf53a60709ba76535a064b7f3c (patch) | |
| tree | 624c99b8431ec001d51dc24ebe5f9306e678fd4a | |
| parent | f406f6512e3b0066cc5d42c7e07fbaeb70353126 (diff) | |
| download | gnuastro-6d3aca7b.tar.gz | |
Library (fits.h): Columns of empty FITS tables reversed to fit input
Until now, when an input FITS table contained 0 rows (was empty of data),
the columns (their metadata) was read in reverse! This happened because we
would simply add an empty dataset with the given input's metadata, but
using the 'gal_list_data_add_alloc' function which is first-in-first-out
(hense reversing the order!).
With this commit, after all the columns are read, the allocated table is
reversed to be the same as the input.
This fixes bug #65055.
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | lib/fits.c | 5 |
2 files changed, 6 insertions, 0 deletions
@@ -149,6 +149,7 @@ See the end of the file for license conditions. by Ignacio Ruiz Cejudo. - bug #65050: Use --libtool option in the TEMPLATE usage; found and fixed by Faezeh Bidjarchian. + - bug #65055: Columns of empty FITS tables (with no rows) read in reverse. @@ -3840,6 +3840,11 @@ gal_fits_tab_read(char *filename, char *hdu, size_t numrows, out->dsize[0]=0; free(out->array); } + + /* Reverse the output (because 'gal_list_data_add_alloc' adds each + column in a first-in-first-out order which is the reverse order of + the input). */ + gal_list_data_reverse(&out); } /* Return the output. */ |
