summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Tachometer.c18
-rw-r--r--display.c15
-rw-r--r--gpsd.c3
-rw-r--r--libgps.c6
-rw-r--r--xgpsspeed.c13
5 files changed, 17 insertions, 38 deletions
diff --git a/Tachometer.c b/Tachometer.c
index c4d17557..0b030790 100644
--- a/Tachometer.c
+++ b/Tachometer.c
@@ -170,17 +170,9 @@ WidgetClass tachometerWidgetClass = (WidgetClass)&tachometerClassRec;
*
****************************************************************/
-static void DrawTachometer();
-static void FastFillCircle();
-static void GetneedleGC();
-static void GetscaleGC();
-static void GetbackgroundGC();
-static void DrawGauge();
-static void DrawNeedle();
-static void DrawNumbers();
-static void DrawSingleNumber();
-static void DrawLabelString();
-static void MoveNeedle();
+static void DrawTachometer(), FastFillCircle(), GetneedleGC();
+static void GetscaleGC(), GetbackgroundGC(), DrawGauge(), DrawNeedle();
+static void DrawNumbers(), DrawSingleNumber(), DrawLabelString(), MoveNeedle();
static void DrawTachometer(TachometerWidget w)
{
@@ -356,14 +348,12 @@ static void DrawNumbers(
static void DrawSingleNumber(TachometerWidget w, int which, Cardinal x, Cardinal y)
{
XSegment segments[7];
- Cardinal nsegments;
+ Cardinal nsegments, width, height;
unsigned char count;
- Cardinal width, height;
GC gc;
width = (w->core.width / 2) - w->tachometer.internal_border;
height = (w->core.height / 2) - w->tachometer.internal_border;
-
if ((width <= 0) || (height <= 0))
return;
diff --git a/display.c b/display.c
index da174b1a..742ea50f 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,3 @@
-#include "config.h"
#include <Xm/Xm.h>
#include <math.h>
@@ -49,8 +48,6 @@ void register_canvas(Widget w, GC gc)
diameter = min(width, height) - RM;
}
-/* #define PCORRECT */
-
static void pol2cart(double azimuth, double elevation, double *xout, double *yout)
{
double sinelev;
@@ -74,21 +71,17 @@ static void draw_arc(int x, int y, int diam)
XDrawArc(XtDisplay(draww), pixmap, drawGC,
x - diam / 2, y - diam / 2, /* x,y */
diam, diam, /* width, height */
- 0, 360 * 64 /* angle1, angle2 */
- );
+ 0, 360 * 64); /* angle1, angle2 */
}
static int get_status(struct gps_data_t *gpsdata, int satellite)
{
- int i, s;
+ int i;
for (i = 0; i < MAXCHANNELS; i++)
if (satellite == gpsdata->PRN[i]) {
- s = gpsdata->ss[i];
-
- if (s<20) return 1;
- if (s<40) return 2;
-
+ if (gpsdata->ss[i]<20) return 1;
+ if (gpsdata->ss[i]<40) return 2;
return 7;
}
return 0;
diff --git a/gpsd.c b/gpsd.c
index f13514da..4ec1e5f5 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -561,8 +561,7 @@ int main(int argc, char *argv[])
openlog("gpsd", LOG_PID, LOG_USER);
gpsd_report(1, "launching (Version %s)\n", VERSION);
- msock = passivesock(service, "tcp", QLEN);
- if (msock < 0) {
+ if ((msock = passivesock(service, "tcp", QLEN)) < 0) {
gpsd_report(0, "startup failed, netlib error %d\n", msock);
exit(2);
}
diff --git a/libgps.c b/libgps.c
index b78f193b..bc5d18cb 100644
--- a/libgps.c
+++ b/libgps.c
@@ -140,10 +140,8 @@ static int gps_unpack(char *buf, struct gps_data_t *gpsdata)
if (gpsdata->satellites) {
int j, i3, i4, i5;
int PRN[MAXCHANNELS];
- int elevation[MAXCHANNELS];
- int azimuth[MAXCHANNELS];
- int ss[MAXCHANNELS];
- int used[MAXCHANNELS];
+ int elevation[MAXCHANNELS], azimuth[MAXCHANNELS];
+ int ss[MAXCHANNELS], used[MAXCHANNELS];
for (j = 0; j < gpsdata->satellites; j++) {
PRN[j]=elevation[j]=azimuth[j]=ss[j]=used[j]=0;
diff --git a/xgpsspeed.c b/xgpsspeed.c
index df7259a1..ca20a269 100644
--- a/xgpsspeed.c
+++ b/xgpsspeed.c
@@ -25,9 +25,6 @@
extern double rint();
#endif
-static struct gps_data_t *gpsdata;
-static Widget toplevel, base, tacho, label;
-
static XrmOptionDescRec options[] = {
{"-rv", "*reverseVideo", XrmoptionNoArg, "TRUE"},
{"-nc", "*needleColor", XrmoptionSepArg, NULL},
@@ -38,6 +35,9 @@ String fallback_resources[] = {
NULL
};
+static struct gps_data_t *gpsdata;
+static Widget tacho;
+
static void update_display(char *buf)
{
int new = rint(gpsdata->speed * KNOTS_TO_MPH);
@@ -60,6 +60,7 @@ int main(int argc, char **argv)
int option;
char *colon, *server = NULL;
char *port = DEFAULT_GPSD_PORT;
+ Widget toplevel, base, label;
toplevel = XtVaAppInitialize(&app, "xpsspeed.ad",
options, XtNumber(options),
@@ -103,12 +104,10 @@ int main(int argc, char **argv)
/**** Tachometer widget ****/
tacho = XtCreateManagedWidget("meter",
- tachometerWidgetClass,
- base, NULL, 0);
+ tachometerWidgetClass, base, NULL, 0);
XtRealizeWidget(toplevel);
- gpsdata = gps_open(server, DEFAULT_GPSD_PORT);
- if (!gpsdata) {
+ if (!(gpsdata = gps_open(server, DEFAULT_GPSD_PORT))) {
fprintf(stderr, "xgpsspeed: no gpsd running or network error (%d).\n", errno);
exit(2);
}