From 7efe006a319f91f5bfa98a72b424a99897e9792f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 7 Mar 2025 22:31:13 +0100 Subject: Fix bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libred.h | 5 ++++- libred.h.0 | 2 +- libred_solar_elevation.3 | 2 +- solar.c | 19 +++++++++++++++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/libred.h b/libred.h index 21920ff..9d59d39 100644 --- a/libred.h +++ b/libred.h @@ -3,6 +3,9 @@ #define LIBRED_H +/* bug fix: */ +#define libred_solar_elevation libred_solar_elevation__int + /** * Approximate apparent size of the Sun in degrees @@ -143,7 +146,7 @@ * @return 0 on success, -1 on failure * @throws Any error specified for clock_gettime(3) on error */ -double libred_solar_elevation(double, double, double *); +int libred_solar_elevation(double, double, double *); /** diff --git a/libred.h.0 b/libred.h.0 index c4f8a93..606e234 100644 --- a/libred.h.0 +++ b/libred.h.0 @@ -126,7 +126,7 @@ This header defines the following functions: .BR libred_get_temperature (3) .TP * -.BR libred_get_temperature (3) +.BR libred_get_temperature_xy (3) .TP * .BR libred_solar_elevation (3) diff --git a/libred_solar_elevation.3 b/libred_solar_elevation.3 index f72f8e5..fa2df7e 100644 --- a/libred_solar_elevation.3 +++ b/libred_solar_elevation.3 @@ -5,7 +5,7 @@ libred_solar_elevation \- Calculate the Sun's apparent elevation .nf #include -int \fBlibred_solar_elevation\fP(double \fIlatitude\fP, double \fIlongitude\fP, double *\felevation\fP); +int \fBlibred_solar_elevation\fP(double \fIlatitude\fP, double \fIlongitude\fP, double *\fIelevation\fP); .fi .PP Link with diff --git a/solar.c b/solar.c index 1b316bb..97c6dd7 100644 --- a/solar.c +++ b/solar.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libred.h" +#undef libred_solar_elevation #include #include #include @@ -21,6 +22,10 @@ #endif +/* old erroneous function declarations: */ +double libred_solar_elevation(double latitude, double longitude, double *elevation); + + /** * Get current Julian Centuries time (100 Julian Days since J2000) * and Julian Day time @@ -297,8 +302,8 @@ solar_elevation_from_time(double tc, double td, double latitude, double longitud * @return 0 on success, -1 on failure * @throws Any error specified for clock_gettime(3) on error */ -double -libred_solar_elevation(double latitude, double longitude, double *elevation) +int +libred_solar_elevation__int(double latitude, double longitude, double *elevation) { double tc, td; if (julian_time(&tc, &td)) @@ -307,6 +312,16 @@ libred_solar_elevation(double latitude, double longitude, double *elevation) return 0; } +/** + * Kept for binary compatibility + */ +double +libred_solar_elevation(double latitude, double longitude, double *elevation) +{ + int r = libred_solar_elevation__int(latitude, longitude, elevation); + return (double)r; +} + /** * This function is obsolete */ -- cgit v1.2.3-70-g09d2