Removed mixed declarations and code

Fixes compatibility with ANSI C (-Wdeclaration-after-statement)
This commit is contained in:
robxnano 2023-04-08 13:23:08 +01:00 committed by 89391914+robxnano@users.noreply.github.com
parent b8c9897cf1
commit d05065efb9
No known key found for this signature in database
GPG Key ID: 9FB6B03B782D1E42
4 changed files with 29 additions and 19 deletions

View File

@ -2100,6 +2100,8 @@ m_sky()
double mlat, mlng; /* moon's ecliptic coords */
double cmlat; /* cos mlat*/
double maxr; /* max dst from center we want to draw, rads */
double hfov, vfov;
int w, h;
DBScan dbs;
Obj *moonop;
Obj *op;
@ -2120,10 +2122,10 @@ m_sky()
scale = (degrad(moonop->s_size/3600.0)/2.0) / moonrad;
maxr = 2*(sqrt((double)mnrows*mnrows + mncols*mncols) + BORD)*scale;
int w = mncols + 2 * BORD;
int h = mnrows + 2 * BORD;
double hfov = w * scale;
double vfov = h * scale;
w = mncols + 2 * BORD;
h = mnrows + 2 * BORD;
hfov = w * scale;
vfov = h * scale;
/* load field stars */
m_loadfs (np, mra, mdec);

View File

@ -2249,7 +2249,8 @@ XtPointer call;
if (setdef || XmToggleButtonGetState (fappto_w)) {
char *xlfd;
XFontStruct *fsp;
XmFontListEntry entry;
XmFontList fl;
XmFontListEntry entry;
Arg args[1];
/* get name of font */
@ -2260,7 +2261,7 @@ XtPointer call;
if (fsp) {
entry = XmFontListEntryCreate(XmSTRING_DEFAULT_CHARSET,
XmFONT_IS_FONT, (XtPointer)fsp);
XmFontList fl = XmFontListAppendEntry(NULL,entry);
fl = XmFontListAppendEntry(NULL, entry);
/* distribute to existing widgets */
XtSetArg (args[0], XmNfontList, fl);

View File

@ -2017,22 +2017,27 @@ sv_draw_obj_x (Display *dsp, Drawable win, GC gc, Obj *op, int x, int y,
int diam, int dotsonly, int flip_tb_x, int flip_lr_x, int aa_mode_x, int cyl_proj_x,
double altdec_x, double azra_x, double vfov_x, double hfov_x, int w_x, int h_x)
{
int flip_tb_i, flip_lr_i;
int aa_mode_i, cyl_proj_i;
double altdec_i, azra_i;
double vfov_i, hfov_i;
int w_i, h_i;
/* might be called to draw on other screens before us */
if (!svshell_w)
sv_create_svshell();
int flip_tb_i = flip_tb;
int flip_lr_i = flip_lr;
int aa_mode_i = aa_mode;
int cyl_proj_i = cyl_proj;
double altdec_i = sv_altdec;
double azra_i = sv_azra;
double vfov_i = sv_vfov;
double hfov_i = sv_hfov;
int w_i = sv_w;
int h_i = sv_h;
flip_tb_i = flip_tb;
flip_lr_i = flip_lr;
aa_mode_i = aa_mode;
cyl_proj_i = cyl_proj;
altdec_i = sv_altdec;
azra_i = sv_azra;
vfov_i = sv_vfov;
hfov_i = sv_hfov;
w_i = sv_w;
h_i = sv_h;
flip_tb = flip_tb_x;
flip_lr = flip_lr_x;
aa_mode = aa_mode_x;
@ -8162,6 +8167,7 @@ GC gc;
short top;
int nprofile;
int npts;
int xshift;
int i;
/* get n entries in profile, skip if none */
@ -8227,7 +8233,7 @@ GC gc;
memcpy(&xpts[3*npts], xpts, nprofile * sizeof(XPoint));
memcpy(&xpts[4*npts], xpts, nprofile * sizeof(XPoint));
int xshift = wx - (sv_w - wx);
xshift = wx - (sv_w - wx);
if (flip_lr) {
for (i = 0; i < nprofile; i++) {
xpts[i].x = xpts[i].x + 2 * xshift;

View File

@ -594,6 +594,7 @@ readu4hpm (int rnm, int *pmra, int *pmdec)
char fn[1024];
char line[128];
FILE*fp;
U4HPM *up;
sprintf (fn, "%s/u4i/u4hpm.dat", basedir);
fp = fopen (fn, "r");
@ -603,7 +604,7 @@ readu4hpm (int rnm, int *pmra, int *pmdec)
}
while (fgets (line, sizeof(line), fp)) {
u4hpm = (U4HPM *) realloc (u4hpm, (nu4hpm+1)*sizeof(U4HPM));
U4HPM *up = &u4hpm[nu4hpm++];
up = &u4hpm[nu4hpm++];
sscanf (line, "%d %d %d %d %d %d %d %d", &up->rnm, &up->zn, &up->rnz,
&up->pmrc, &up->pmd, &up->ra, &up->spd, &up->maga);
}