Fixed #72 - resolved build warnings in gcc 9.3.0.

Version 9.3.0 of gcc has extra warnings that detect snprintf
truncations and use of possibly uninitialized variables.
Fixed some warnings of both types.
This commit is contained in:
Don Cross
2020-07-21 23:30:44 +00:00
parent bccffc0055
commit e19d50c68c
2 changed files with 6 additions and 2 deletions

View File

@@ -507,7 +507,7 @@ static int CVsop_Formula(cg_context_t *context, const vsop_formula_t *formula, c
int error = 0;
int s;
char varprefix[100];
char sname[100];
char sname[120];
snprintf(varprefix, sizeof(varprefix), "vsop_%s_%s", coord_name, body_name);
@@ -588,7 +588,7 @@ static int CsharpVsop_Formula(cg_context_t *context, const vsop_formula_t *formu
int error = 0;
int s;
char varprefix[100];
char sname[100];
char sname[120];
snprintf(varprefix, sizeof(varprefix), "vsop_%s_%s", coord_name, body_name);

View File

@@ -111,6 +111,8 @@ short int app_star (double jd_tt, cat_entry *star, short int accuracy,
sky_pos output;
*ra = *dec = 0.0; /* [Don Cross]: fix warnings */
/*
Set 'obj_name' equal to 'starname' in the 'star' structure. Length
will be checked in 'make_object'.
@@ -3362,6 +3364,8 @@ short int ter2cel (double jd_ut_high, double jd_ut_low, double delta_t,
double jd_ut1, jd_tt, dummy, secdiff, jd_tdb, gast, r_cio, theta,
v1[3], v2[3], v3[3], v4[3], x[3], y[3], z[3];
vec2[0] = vec2[1] = vec2[2] = 0.0; /* [Don Cross]: fix build warning. */
/*
Invalid value of 'accuracy'.
*/