summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am10
-rw-r--r--cgps.c2
-rw-r--r--driver_evermore.c2
-rw-r--r--driver_italk.c16
-rw-r--r--driver_navcom.c2
-rw-r--r--driver_nmea.c18
-rw-r--r--driver_oncore.c2
-rw-r--r--driver_proto.c2
-rw-r--r--driver_rtcm2.c16
-rw-r--r--driver_sirf.c4
-rw-r--r--driver_superstar2.c4
-rw-r--r--driver_tsip.c2
-rw-r--r--driver_ubx.c8
-rw-r--r--drivers.c4
-rw-r--r--gpsd.c4
-rw-r--r--gpsdecode.c2
-rw-r--r--gpxlogger.c6
-rw-r--r--hex.c2
-rw-r--r--isgps.c2
-rw-r--r--libgpsd_core.c2
-rw-r--r--monitor_italk.c8
-rw-r--r--monitor_sirf.c2
-rw-r--r--monitor_ubx.c4
-rw-r--r--netlib.c2
-rw-r--r--packet.c6
-rw-r--r--serial.c2
-rw-r--r--srecord.c18
-rw-r--r--subframe.c2
-rw-r--r--test_float.c54
29 files changed, 109 insertions, 99 deletions
diff --git a/Makefile.am b/Makefile.am
index 48a98333..8f9775d1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -478,6 +478,16 @@ splint: gpsd.h packet_names.h
@echo "Running splint on test_json test harness..."
-splint $(SPLINTOPTS) $(test_json_SOURCES)
+# Re-indenting to a uniform style would be nice, and we leave this hear
+# as a rough guide to the project style, but it turns out that indent is
+# an excessively blunt instrument. As of 2.2.10 it doesn't honor -nfca
+# and produces loads of spurious changes to splint directives.
+indent:
+ chmod u+w maskdump.c
+ indent -i4 -br -cbi0 -bli0 -ncs -npcs -nfca $(gpsd_c_sources) $(libgpsd_c_sources)
+ chmod u-w maskdump.c
+ @echo "Diff lines:" `svn diff | wc -l`
+
# Bogon-checking the Python tools
pychecker:
for f in gps.py gpsfake.py leapsecond.py; do pychecker $$f; done
diff --git a/cgps.c b/cgps.c
index e856208c..b7bfbdb0 100644
--- a/cgps.c
+++ b/cgps.c
@@ -229,7 +229,7 @@ static void die(int sig UNUSED)
static enum deg_str_type deg_type = deg_dd;
/*@ -globstate @*/
-static void windowsetup(void){
+static void windowsetup(void) {
/* Set the window sizes per the following criteria:
1. Set the window size to display the maximum number of
diff --git a/driver_evermore.c b/driver_evermore.c
index e5aac8bd..e072dc9a 100644
--- a/driver_evermore.c
+++ b/driver_evermore.c
@@ -351,7 +351,7 @@ static gps_mask_t evermore_parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == EVERMORE_PACKET){
+ if (session->packet.type == EVERMORE_PACKET) {
st = evermore_parse(session, session->packet.outbuffer, session->packet.outbuflen);
return st;
#ifdef NMEA_ENABLE
diff --git a/driver_italk.c b/driver_italk.c
index 4792db64..5efc05dc 100644
--- a/driver_italk.c
+++ b/driver_italk.c
@@ -35,7 +35,7 @@ static gps_mask_t decode_itk_navfix(struct gps_device_t *session, unsigned char
double epx, epy, epz, evx, evy, evz, eph;
double t;
- if (len != 296){
+ if (len != 296) {
gpsd_report(LOG_PROG, "ITALK: bad NAV_FIX (len %zu, should be 296)\n",
len);
return -1;
@@ -77,7 +77,7 @@ static gps_mask_t decode_itk_navfix(struct gps_device_t *session, unsigned char
(int)MAX(getleuw(buf, 7 + 12), getleuw(buf, 7 + 14));
mask |= USED_SET ;
- if (flags & FIX_CONV_DOP_VALID){
+ if (flags & FIX_CONV_DOP_VALID) {
clear_dop(&session->gpsdata.dop);
session->gpsdata.dop.hdop = (double)(getleuw(buf, 7 + 56)/100.0);
session->gpsdata.dop.gdop = (double)(getleuw(buf, 7 + 58)/100.0);
@@ -87,7 +87,7 @@ static gps_mask_t decode_itk_navfix(struct gps_device_t *session, unsigned char
mask |= DOP_SET;
}
- if ((pflags & FIX_FLAG_MASK_INVALID) == 0 && (flags & FIXINFO_FLAG_VALID) != 0){
+ if ((pflags & FIX_FLAG_MASK_INVALID) == 0 && (flags & FIXINFO_FLAG_VALID) != 0) {
if (pflags & FIX_FLAG_3DFIX)
session->gpsdata.fix.mode = MODE_3D;
else
@@ -125,7 +125,7 @@ static gps_mask_t decode_itk_prnstatus(struct gps_device_t *session, unsigned ch
double t;
gps_mask_t mask;
- if (len < 62){
+ if (len < 62) {
gpsd_report(LOG_PROG, "ITALK: runt PRN_STATUS (len=%zu)\n", len);
mask = ERROR_SET;
}
@@ -150,7 +150,7 @@ static gps_mask_t decode_itk_prnstatus(struct gps_device_t *session, unsigned ch
session->gpsdata.PRN[i] = (int)getleuw(buf, off+4)&0xff;
session->gpsdata.elevation[i] = (int)getlesw(buf, off+6)&0xff;
session->gpsdata.azimuth[i] = (int)getlesw(buf, off+8)&0xff;
- if (session->gpsdata.PRN[i]){
+ if (session->gpsdata.PRN[i]) {
st++;
if (flags & PRN_FLAG_USE_IN_NAV)
session->gpsdata.used[nsv++] = session->gpsdata.PRN[i];
@@ -177,7 +177,7 @@ static gps_mask_t decode_itk_utcionomodel(struct gps_device_t *session, unsigned
unsigned short gps_week, flags;
double t;
- if (len != 64){
+ if (len != 64) {
gpsd_report(LOG_PROG,
"ITALK: bad UTC_IONO_MODEL (len %zu, should be 64)\n", len);
return ERROR_SET;
@@ -207,7 +207,7 @@ static gps_mask_t decode_itk_subframe(struct gps_device_t *session, unsigned cha
unsigned short flags, prn, sf;
unsigned int words[10];
- if (len != 64){
+ if (len != 64) {
gpsd_report(LOG_PROG,
"ITALK: bad SUBFRAME (len %zu, should be 64)\n", len);
return ERROR_SET;
@@ -350,7 +350,7 @@ static gps_mask_t italk_parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == ITALK_PACKET){
+ if (session->packet.type == ITALK_PACKET) {
st = italk_parse(session, session->packet.outbuffer, session->packet.outbuflen);
session->gpsdata.dev.driver_mode = MODE_BINARY; /* binary */
return st;
diff --git a/driver_navcom.c b/driver_navcom.c
index 4298d2eb..e7026eca 100644
--- a/driver_navcom.c
+++ b/driver_navcom.c
@@ -1153,7 +1153,7 @@ static gps_mask_t navcom_parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == NAVCOM_PACKET){
+ if (session->packet.type == NAVCOM_PACKET) {
st = navcom_parse(session, session->packet.outbuffer, session->packet.outbuflen);
session->gpsdata.dev.driver_mode = MODE_BINARY; /* binary */
return st;
diff --git a/driver_nmea.c b/driver_nmea.c
index acb5c173..cf403e86 100644
--- a/driver_nmea.c
+++ b/driver_nmea.c
@@ -451,7 +451,7 @@ static gps_mask_t processGPGSV(int count, char *field[], struct gps_device_t *se
session->gpsdata.satellites_visible = 0;
return ERROR_SET;
}
- if (count % 4 != 0){
+ if (count % 4 != 0) {
gpsd_report(LOG_WARN, "malformed GPGSV - fieldcount %d %% 4 != 0\n", count);
gpsd_zero_satellites(&session->gpsdata);
session->gpsdata.satellites_visible = 0;
@@ -538,7 +538,7 @@ static gps_mask_t processPGRME(int c UNUSED, char *field[], struct gps_device_t
gps_mask_t mask;
if ((strcmp(field[2], "M")!=0) ||
(strcmp(field[4], "M")!=0) ||
- (strcmp(field[6], "M")!=0)){
+ (strcmp(field[6], "M")!=0)) {
session->gpsdata.fix.epx =
session->gpsdata.fix.epy =
session->gpsdata.fix.epv =
@@ -760,15 +760,15 @@ static gps_mask_t processPASHR(int c UNUSED, char *field[], struct gps_device_t
gps_mask_t mask;
mask = 0;
- if (0 == strcmp("RID", field[1])){ /* Receiver ID */
+ if (0 == strcmp("RID", field[1])) { /* Receiver ID */
(void)snprintf(session->subtype, sizeof(session->subtype)-1,
"%s ver %s", field[2], field[3]);
gpsd_report(LOG_DATA, "PASHR,RID: subtype=%s mask={}\n",
session->subtype);
return mask;
- } else if (0 == strcmp("POS", field[1])){ /* 3D Position */
+ } else if (0 == strcmp("POS", field[1])) { /* 3D Position */
mask |= MODE_SET | STATUS_SET | CLEAR_SET;
- if (0 == strlen(field[2])){
+ if (0 == strlen(field[2])) {
/* empty first field means no 3D fix is available */
session->gpsdata.status = STATUS_NO_FIX;
session->gpsdata.fix.mode = MODE_NO_FIX;
@@ -812,11 +812,11 @@ static gps_mask_t processPASHR(int c UNUSED, char *field[], struct gps_device_t
session->gpsdata.dop.tdop,
gpsd_maskdump(mask));
}
- } else if (0 == strcmp("SAT", field[1])){ /* Satellite Status */
+ } else if (0 == strcmp("SAT", field[1])) { /* Satellite Status */
int i, n, p, u;
n = session->gpsdata.satellites_visible = atoi(field[2]);
u = 0;
- for (i = 0; i < n; i++){
+ for (i = 0; i < n; i++) {
session->gpsdata.PRN[i] = p = atoi(field[3+i*5+0]);
session->gpsdata.azimuth[i] = atoi(field[3+i*5+1]);
session->gpsdata.elevation[i] = atoi(field[3+i*5+2]);
@@ -941,10 +941,10 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t *session)
t = p; /* end of sentence */
p = (char *)session->driver.nmea.fieldcopy + 1; /* beginning of tag, 'G' not '$' */
/* while there is a search string and we haven't run off the buffer... */
- while((p != NULL) && (p <= t)){
+ while((p != NULL) && (p <= t)) {
session->driver.nmea.field[count] = p; /* we have a field. record it */
/*@ -compdef @*/
- if ((p = strchr(p, ',')) != NULL){ /* search for the next delimiter */
+ if ((p = strchr(p, ',')) != NULL) { /* search for the next delimiter */
*p = '\0'; /* replace it with a NUL */
count++; /* bump the counters and continue */
p++;
diff --git a/driver_oncore.c b/driver_oncore.c
index a3496f9f..bf783a73 100644
--- a/driver_oncore.c
+++ b/driver_oncore.c
@@ -443,7 +443,7 @@ static gps_mask_t oncore_parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == ONCORE_PACKET){
+ if (session->packet.type == ONCORE_PACKET) {
st = oncore_dispatch(session, session->packet.outbuffer, session->packet.outbuflen);
session->gpsdata.dev.driver_mode = MODE_BINARY;
return st;
diff --git a/driver_proto.c b/driver_proto.c
index 14fd40af..607226ca 100644
--- a/driver_proto.c
+++ b/driver_proto.c
@@ -380,7 +380,7 @@ static gps_mask_t _proto__parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == _PROTO__PACKET){
+ if (session->packet.type == _PROTO__PACKET) {
st = _proto__dispatch(session, session->packet.outbuffer, session->packet.outbuflen);
session->gpsdata.driver_mode = MODE_BINARY;
return st;
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index 4ea6da90..3c10ae3f 100644
--- a/driver_rtcm2.c
+++ b/driver_rtcm2.c
@@ -145,26 +145,26 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
}
break;
case 4:
- if ((tp->reference.valid = len >= 2)){
+ if ((tp->reference.valid = len >= 2)) {
struct rtcm2_msg4 *m = &msg->msg_type.type4;
tp->reference.system =
(m->w3.dgnss==0) ? NAVSYSTEM_GPS :
((m->w3.dgnss==1) ? NAVSYSTEM_GLONASS : NAVSYSTEM_UNKNOWN);
tp->reference.sense = (m->w3.dat != 0) ? SENSE_GLOBAL : SENSE_LOCAL;
- if (m->w3.datum_alpha_char1){
+ if (m->w3.datum_alpha_char1) {
tp->reference.datum[n++] = (char)(m->w3.datum_alpha_char1);
}
- if (m->w3.datum_alpha_char2){
+ if (m->w3.datum_alpha_char2) {
tp->reference.datum[n++] = (char)(m->w3.datum_alpha_char2);
}
- if (m->w4.datum_sub_div_char1){
+ if (m->w4.datum_sub_div_char1) {
tp->reference.datum[n++] = (char)(m->w4.datum_sub_div_char1);
}
- if (m->w4.datum_sub_div_char2){
+ if (m->w4.datum_sub_div_char2) {
tp->reference.datum[n++] = (char)(m->w4.datum_sub_div_char2);
}
- if (m->w4.datum_sub_div_char3){
+ if (m->w4.datum_sub_div_char3) {
tp->reference.datum[n++] = (char)(m->w4.datum_sub_div_char3);
}
tp->reference.datum[n++] = '\0';
@@ -210,7 +210,7 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
break;
case 16:
/*@ -boolops @*/
- for (w = 0; w < (unsigned)len; w++){
+ for (w = 0; w < (unsigned)len; w++) {
if (!msg->msg_type.type16.txt[w].byte1) {
break;
}
@@ -404,7 +404,7 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
break;
case 16: /* T */
/*@ -boolops @*/
- for (w = 0; w < RTCM2_WORDS_MAX - 2; w++){
+ for (w = 0; w < RTCM2_WORDS_MAX - 2; w++) {
if (!tp->message[n]) {
break;
}
diff --git a/driver_sirf.c b/driver_sirf.c
index 6935138d..3c85d289 100644
--- a/driver_sirf.c
+++ b/driver_sirf.c
@@ -355,7 +355,7 @@ static gps_mask_t sirf_msg_navdata(struct gps_device_t *session, unsigned char *
gpsd_interpret_subframe(session, words);
#ifdef ALLOW_RECONFIGURE
- if (session->gpsdata.dev.baudrate < 38400){
+ if (session->gpsdata.dev.baudrate < 38400) {
gpsd_report(LOG_PROG, "Disabling subframe transmission...\n");
(void)sirf_write(session->gpsdata.gps_fd, disablesubframe);
}
@@ -1005,7 +1005,7 @@ static gps_mask_t sirfbin_parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == SIRF_PACKET){
+ if (session->packet.type == SIRF_PACKET) {
st = sirf_parse(session, session->packet.outbuffer,
session->packet.outbuflen);
session->gpsdata.dev.driver_mode = MODE_BINARY;
diff --git a/driver_superstar2.c b/driver_superstar2.c
index b2fa4365..5bbdfe6b 100644
--- a/driver_superstar2.c
+++ b/driver_superstar2.c
@@ -393,7 +393,7 @@ superstar2_msg_measurement(struct gps_device_t *session, unsigned char *buf, siz
n = (int)getub(buf, 6); /* number of measurements */
t = getled(buf, 7); /* measurement time */
- for(i = 0; i < n; i++){
+ for(i = 0; i < n; i++) {
session->gpsdata.raw.mtime[i] = t;
session->gpsdata.PRN[i] = (int)getub(buf, 11*i + 15) & 0x1f;
session->gpsdata.ss[i] = (double)getub(buf, 11*i * 15 +1 )/4.0;
@@ -582,7 +582,7 @@ static gps_mask_t superstar2_parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == SUPERSTAR2_PACKET){
+ if (session->packet.type == SUPERSTAR2_PACKET) {
st = superstar2_dispatch(session, session->packet.outbuffer,
session->packet.length);
session->gpsdata.dev.driver_mode = MODE_BINARY;
diff --git a/driver_tsip.c b/driver_tsip.c
index 9aa5ad6d..8db91e42 100644
--- a/driver_tsip.c
+++ b/driver_tsip.c
@@ -883,7 +883,7 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == TSIP_PACKET){
+ if (session->packet.type == TSIP_PACKET) {
st = tsip_analyze(session);
session->gpsdata.dev.driver_mode = MODE_BINARY;
return st;
diff --git a/driver_ubx.c b/driver_ubx.c
index 780122d2..1dceec1f 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -67,7 +67,7 @@ ubx_msg_nav_sol(struct gps_device_t *session, unsigned char *buf, size_t data_le
flags = (unsigned int)getub(buf, 11);
mask = 0;
- if ((flags & (UBX_SOL_VALID_WEEK |UBX_SOL_VALID_TIME)) != 0){
+ if ((flags & (UBX_SOL_VALID_WEEK |UBX_SOL_VALID_TIME)) != 0) {
tow = (unsigned int)getleul(buf, 0);
gw = (unsigned short)getlesw(buf, 8);
session->driver.ubx.gps_week = gw;
@@ -97,7 +97,7 @@ ubx_msg_nav_sol(struct gps_device_t *session, unsigned char *buf, size_t data_le
session->gpsdata.satellites_used = (int)getub(buf, 47);
navmode = (unsigned char)getub(buf, 10);
- switch (navmode){
+ switch (navmode) {
case UBX_MODE_TMONLY:
case UBX_MODE_3D:
session->gpsdata.fix.mode = MODE_3D;
@@ -207,7 +207,7 @@ ubx_msg_nav_svinfo(struct gps_device_t *session, unsigned char *buf, size_t data
#endif
/*@ +charint @*/
nchan = (unsigned int)getub(buf, 4);
- if (nchan > MAXCHANNELS){
+ if (nchan > MAXCHANNELS) {
gpsd_report(LOG_WARN, "Invalid NAV SVINFO message, >%d reported visible",MAXCHANNELS);
return 0;
}
@@ -499,7 +499,7 @@ static gps_mask_t parse_input(struct gps_device_t *session)
{
gps_mask_t st;
- if (session->packet.type == UBX_PACKET){
+ if (session->packet.type == UBX_PACKET) {
st = ubx_parse(session, session->packet.outbuffer, session->packet.outbuflen);
session->gpsdata.dev.driver_mode = MODE_BINARY;
return st;
diff --git a/drivers.c b/drivers.c
index bdfeb2c3..c64b139d 100644
--- a/drivers.c
+++ b/drivers.c
@@ -776,7 +776,7 @@ static int oceanserver_send(int fd, const char *fmt, ... )
#ifdef ALLOW_RECONFIGURE
static void oceanserver_configure(struct gps_device_t *session, event_t event)
{
- if (event == event_configure && session->packet.counter == 0){
+ if (event == event_configure && session->packet.counter == 0) {
/* report in NMEA format */
(void)oceanserver_send(session->gpsdata.gps_fd, "2\n");
/* ship all fields */
@@ -1029,7 +1029,7 @@ const struct gps_type_t mtk3301 = {
#ifdef AIVDM_ENABLE
static gps_mask_t aivdm_analyze(struct gps_device_t *session)
{
- if (session->packet.type == AIVDM_PACKET){
+ if (session->packet.type == AIVDM_PACKET) {
if (aivdm_decode((char *)session->packet.outbuffer, session->packet.outbuflen, &session->aivdm, &session->gpsdata.ais)) {
return ONLINE_SET | AIS_SET;
}else
diff --git a/gpsd.c b/gpsd.c
index 5760414c..768b93f3 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -632,7 +632,7 @@ static bool open_device(char *device_name)
/* normal case: set up GPS/RTCM/AIS service */
for (devp = devices; devp < devices + MAXDEVICES; devp++)
- if (!allocated_device(devp) || (strcmp(devp->gpsdata.dev.path, device_name)==0 && !initialized_device(devp))){
+ if (!allocated_device(devp) || (strcmp(devp->gpsdata.dev.path, device_name)==0 && !initialized_device(devp))) {
goto found;
}
return false;
@@ -2114,7 +2114,7 @@ int main(int argc, char *argv[])
if (context.dsock >= 0 && FD_ISSET(context.dsock, &rfds)) {
/* be ready for DGPS reports */
- if (netgnss_poll(&context) == -1){
+ if (netgnss_poll(&context) == -1) {
FD_CLR(context.dsock, &all_fds);
FD_CLR(context.dsock, &rfds);
context.dsock = -1;
diff --git a/gpsdecode.c b/gpsdecode.c
index 406f651c..77123400 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -367,7 +367,7 @@ static void decode(FILE *fpin, FILE *fpout)
}
else if (lexer.type == AIVDM_PACKET) {
/*@ -uniondef */
- if (aivdm_decode((char *)lexer.outbuffer, lexer.outbuflen, &aivdm, &ais)){
+ if (aivdm_decode((char *)lexer.outbuffer, lexer.outbuflen, &aivdm, &ais)) {
if (!json)
aivdm_csv_dump(&ais, buf, sizeof(buf));
else
diff --git a/gpxlogger.c b/gpxlogger.c
index 9dd10adc..87d45de7 100644
--- a/gpxlogger.c
+++ b/gpxlogger.c
@@ -89,7 +89,7 @@ static void print_fix(struct gps_fix_t *fix, struct tm *time)
* we don't necessarily have access to some of the stuff in gsdata.
* Might mean some of this stuff should be promoted.
*/
- if ((gpsdata->status >= 2) && (gpsdata->fix.mode >= MODE_3D)){
+ if ((gpsdata->status >= 2) && (gpsdata->fix.mode >= MODE_3D)) {
/* dgps or pps */
if (gpsdata->fix.mode == 4) { /* military pps */
(void)printf(" <fix>pps</fix>\n");
@@ -291,7 +291,7 @@ static int socket_mainloop(void)
gps_set_raw_hook(gpsdata, process);
gps_stream(gpsdata, WATCH_ENABLE|WATCH_NEWSTYLE, NULL);
- for(;;){
+ for(;;) {
int data;
struct timeval tv;
@@ -334,7 +334,7 @@ int main (int argc, char** argv)
int ch;
progname = argv[0];
- while ((ch = getopt(argc, argv, "hi:V")) != -1){
+ while ((ch = getopt(argc, argv, "hi:V")) != -1) {
switch (ch) {
case 'i': /* set polling interfal */
timeout = (unsigned int)atoi(optarg);
diff --git a/hex.c b/hex.c
index 35a2f4b2..abdc1541 100644
--- a/hex.c
+++ b/hex.c
@@ -54,7 +54,7 @@ char /*@ observer @*/ *gpsd_hexdump(const void *binbuf, size_t binbuflen)
return hexbuf;
}
-int gpsd_hexpack(/*@in@*/const char *src, /*@out@*/char *dst, size_t len){
+int gpsd_hexpack(/*@in@*/const char *src, /*@out@*/char *dst, size_t len) {
/* hex2bin source string to destination - destination can be same as source */
int i, k, l;
diff --git a/isgps.c b/isgps.c
index 5e87d742..28c76293 100644
--- a/isgps.c
+++ b/isgps.c
@@ -262,7 +262,7 @@ enum isgpsstat_t isgps_decode(struct gps_packet_t *session,
* Guard against a buffer overflow attack. Just wait for
* the next preamble match and go on from there.
*/
- if (session->isgps.bufindex >= (unsigned)maxlen){
+ if (session->isgps.bufindex >= (unsigned)maxlen) {
session->isgps.bufindex = 0;
gpsd_report(ISGPS_ERRLEVEL_BASE+1,
"ISGPS buffer overflowing -- resetting\n");
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 6364df16..5fcd6b84 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -575,7 +575,7 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
session->gpsdata.online = 0;
return 0;
} else if (newlen == 0) { /* no new data */
- if (session->device_type != NULL && timestamp()>session->gpsdata.online+session->gpsdata.dev.cycle+1){
+ if (session->device_type != NULL && timestamp()>session->gpsdata.online+session->gpsdata.dev.cycle+1) {
gpsd_report(LOG_INF, "GPS on %s is offline (%lf sec since data)\n",
session->gpsdata.dev.path,
timestamp() - session->gpsdata.online);
diff --git a/monitor_italk.c b/monitor_italk.c
index 9d4a1f39..f2c3dd63 100644
--- a/monitor_italk.c
+++ b/monitor_italk.c
@@ -77,7 +77,7 @@ static bool italk_initialize(void)
/*@ +onlytrans @*/
}
-static void display_itk_navfix(unsigned char *buf, size_t len){
+static void display_itk_navfix(unsigned char *buf, size_t len) {
unsigned int tow, tod, nsec, d, svlist;
unsigned short gps_week, flags, cflags, pflags, nsv;
@@ -172,8 +172,8 @@ static void display_itk_navfix(unsigned char *buf, size_t len){
char prn[4], satlist[38];
unsigned int i;
satlist[0] = '\0';
- for(i = 0; i<32; i++){
- if (svlist & (1<<i)){
+ for(i = 0; i<32; i++) {
+ if (svlist & (1<<i)) {
(void)snprintf(prn, 4, "%u ", i+1);
(void)strlcat(satlist, prn, 38);
}
@@ -208,7 +208,7 @@ static void display_itk_prnstatus(unsigned char *buf, size_t len)
prn, az, el, ss, fl,
(fl & PRN_FLAG_USE_IN_NAV)? 'Y' : ' ');
}
- for ( ; i < MAX_NR_VISIBLE_PRNS; i++){
+ for ( ; i < MAX_NR_VISIBLE_PRNS; i++) {
(void)wmove(satwin, (int)i+2, 4);
(void)wprintw(satwin, " ");
}
diff --git a/monitor_sirf.c b/monitor_sirf.c
index e08423c0..4357f4ee 100644
--- a/monitor_sirf.c
+++ b/monitor_sirf.c
@@ -622,7 +622,7 @@ static void sirf_update(void)
#ifdef ALLOW_CONTROLSEND
/* elicit navigation parameters */
- if (dispmode && (time(NULL) % 10 == 0)){
+ if (dispmode && (time(NULL) % 10 == 0)) {
(void)monitor_control_send((unsigned char *)"\x98\x00", 2);
}
#endif /* ALLOW_CONTROLSEND */
diff --git a/monitor_ubx.c b/monitor_ubx.c
index 11fa7745..98419c5f 100644
--- a/monitor_ubx.c
+++ b/monitor_ubx.c
@@ -135,7 +135,7 @@ static void display_nav_sol(unsigned char *buf, size_t data_len)
navmode = (unsigned char)getub(buf, 10);
flags = (unsigned int)getub(buf, 11);
- if ((flags & (UBX_SOL_VALID_WEEK |UBX_SOL_VALID_TIME)) != 0){
+ if ((flags & (UBX_SOL_VALID_WEEK |UBX_SOL_VALID_TIME)) != 0) {
tow = (unsigned int)getleul(buf, 0);
gw = (unsigned short)getlesw(buf, 8);
t = gpstime_to_unix((int)gw, tow/1000.0);
@@ -174,7 +174,7 @@ static void display_nav_sol(unsigned char *buf, size_t data_len)
(void)wprintw(navsolwin, "%s", ctime(&tt));
/*@ +compdef @*/
(void)wmove(navsolwin, 8, 11);
- if ((flags & (UBX_SOL_VALID_WEEK |UBX_SOL_VALID_TIME)) != 0){
+ if ((flags & (UBX_SOL_VALID_WEEK |UBX_SOL_VALID_TIME)) != 0) {
(void)wprintw(navsolwin, "%d+%10.3lf", gw, (double)(tow/1000.0));
(void)wmove(navsolwin, 8, 36);
(void)wprintw(navsolwin, "%d", (tow/86400000) );
diff --git a/netlib.c b/netlib.c
index 69c51038..573d609f 100644
--- a/netlib.c
+++ b/netlib.c
@@ -113,7 +113,7 @@ char *sock2ip(int fd)
r = getpeername(fd, (struct sockaddr *) &fsin, &alen);
/*@ -branchstate @*/
- if (r == 0){
+ if (r == 0) {
ip = inet_ntoa(((struct sockaddr_in *)(&fsin))->sin_addr);
} else {
gpsd_report(LOG_INF, "getpeername() = %d, error = %s (%d)\n", r, strerror(errno), errno);
diff --git a/packet.c b/packet.c
index 79ed60ff..8895aef6 100644
--- a/packet.c
+++ b/packet.c
@@ -274,7 +274,7 @@ static void nextstate(struct gps_packet_t *lexer,
break;
#if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) || defined(ONCORE_ENABLE)
case AT1_LEADER:
- switch (c){
+ switch (c) {
#ifdef ONCORE_ENABLE
case '@':
lexer->state = ONCORE_AT2;
@@ -872,7 +872,7 @@ static void nextstate(struct gps_packet_t *lexer,
case ITALK_PAYLOAD:
/* lookahead for "<!" because sometimes packets are short but valid */
if ((c == '>') && (lexer->inbufptr[0] == '<') &&
- (lexer->inbufptr[1] == '!')){
+ (lexer->inbufptr[1] == '!')) {
lexer->state = ITALK_RECOGNIZED;
gpsd_report(LOG_IO, "ITALK: trying to process runt packet\n");
break;
@@ -1463,7 +1463,7 @@ void packet_parse(struct gps_packet_t *lexer)
/* expected checksum */
xsum = getiw(7+2*len);
- for (n = 0; n < len; n++){
+ for (n = 0; n < len; n++) {
tmpw = getiw(7 + 2*n);
tmpdw = (csum + 1) * (tmpw + n);
csum ^= (tmpdw & 0xffff) ^ ((tmpdw >>16) & 0xffff);
diff --git a/serial.c b/serial.c
index a0f327e2..b7529c6a 100644
--- a/serial.c
+++ b/serial.c
@@ -233,7 +233,7 @@ int gpsd_open(struct gps_device_t *session)
mode_t mode = (mode_t)O_RDWR;
/*@ -boolops -type @*/
- if (session->context->readonly || ((stat(session->gpsdata.dev.path, &sb) != -1) && ((sb.st_mode & S_IFCHR) != S_IFCHR))){
+ if (session->context->readonly || ((stat(session->gpsdata.dev.path, &sb) != -1) && ((sb.st_mode & S_IFCHR) != S_IFCHR))) {
mode = (mode_t)O_RDONLY;
gpsd_report(LOG_INF, "opening read-only GPS data source at '%s'\n", session->gpsdata.dev.path);
} else {
diff --git a/srecord.c b/srecord.c
index 8557aa54..4c80c712 100644
--- a/srecord.c
+++ b/srecord.c
@@ -38,7 +38,7 @@
* bytes are read from bbuf and a ready-to-go srecord is placed in sbuf
*/
int
-bin2srec(unsigned int type, unsigned int offset, unsigned int num, unsigned char *bbuf, unsigned char *sbuf){
+bin2srec(unsigned int type, unsigned int offset, unsigned int num, unsigned char *bbuf, unsigned char *sbuf) {
unsigned char abuf[MAX_BYTES_PER_RECORD*2 + 2], sum;
size_t len;
@@ -56,12 +56,12 @@ bin2srec(unsigned int type, unsigned int offset, unsigned int num, unsigned char
}
int
-srec_hdr(unsigned int num, unsigned char *bbuf, unsigned char *sbuf){
+srec_hdr(unsigned int num, unsigned char *bbuf, unsigned char *sbuf) {
return bin2srec(0, 0, num, bbuf, sbuf);
}
int
-srec_fin(unsigned int num, unsigned char *sbuf){
+srec_fin(unsigned int num, unsigned char *sbuf) {
unsigned char bbuf[4], sum;
memset(bbuf, 0, 4);
@@ -75,14 +75,14 @@ srec_fin(unsigned int num, unsigned char *sbuf){
void
-hexdump(size_t len, unsigned char *bbuf, unsigned char *abuf){
+hexdump(size_t len, unsigned char *bbuf, unsigned char *abuf) {
size_t i;
memset(abuf, 0, MAX_BYTES_PER_RECORD*2 + 2);
if (len > MAX_BYTES_PER_RECORD*2)
len = MAX_BYTES_PER_RECORD*2;
- for(i = 0; i < len; i++){
+ for(i = 0; i < len; i++) {
abuf[i*2] = hc((bbuf[i] &0xf0) >> 4);
abuf[i*2+1] = hc(bbuf[i] &0x0f);
}
@@ -90,8 +90,8 @@ hexdump(size_t len, unsigned char *bbuf, unsigned char *abuf){
/*@ -type @*/
unsigned char
-hc(unsigned char x){
- switch(x){
+hc(unsigned char x) {
+ switch(x) {
case 15:
case 14:
case 13:
@@ -118,7 +118,7 @@ hc(unsigned char x){
/*@ -type @*/
unsigned char
-sr_sum(unsigned int count, unsigned int addr, unsigned char *bbuf){
+sr_sum(unsigned int count, unsigned int addr, unsigned char *bbuf) {
int i, j;
unsigned char k, sum = 0;
@@ -128,7 +128,7 @@ sr_sum(unsigned int count, unsigned int addr, unsigned char *bbuf){
sum += ((addr & 0x00ff0000) >> 16);
sum += ((addr & 0xff000000) >> 24);
j = count - 5;
- for(i = 0; i < j; i++){
+ for(i = 0; i < j; i++) {
k = bbuf[i];
sum += k;
}
diff --git a/subframe.c b/subframe.c
index 8a01542a..03fd900a 100644
--- a/subframe.c
+++ b/subframe.c
@@ -55,7 +55,7 @@ void gpsd_interpret_subframe(struct gps_device_t *session,unsigned int words[])
gpsd_report(LOG_PROG, "50B: %06x %06x %06x %06x %06x %06x %06x %06x\n",
words[2], words[3], words[4], words[5],
words[6], words[7], words[8], words[9]);
- switch(pageid){
+ switch(pageid) {
case 55:
/*
* "The requisite 176 bits shall occupy bits 9 through 24 of word
diff --git a/test_float.c b/test_float.c
index 6a5265ce..37f27ae6 100644
--- a/test_float.c
+++ b/test_float.c
@@ -31,7 +31,7 @@ int main( void );
int test_single( void );
int test_double( void );
-int main(){
+int main() {
int i, j;
if ((i = test_single()))
@@ -48,7 +48,7 @@ int main(){
return i;
}
-int test_single(){
+int test_single() {
static float f;
static int i;
static int e = 0;
@@ -57,7 +57,7 @@ int test_single(){
f = 1.0;
for(i = 0; i < 10; i++)
f += (1<<i);
- if (f != 1024.0){
+ if (f != 1024.0) {
printf("s1 ");
e++;
}
@@ -66,7 +66,7 @@ int test_single(){
f = 1024.0;
for(i = 0; i < 10; i++)
f -= (1<<i);
- if (f != 1.0){
+ if (f != 1.0) {
printf("s2 ");
e++;
}
@@ -75,7 +75,7 @@ int test_single(){
f = 1.0;
for(i = 1; i < 10; i++)
f *= i;
- if (f != 362880.0){
+ if (f != 362880.0) {
printf("s3 ");
e++;
}
@@ -84,29 +84,29 @@ int test_single(){
f = 362880.0;
for(i = 1; i < 10; i++)
f /= i;
- if (f != 1.0){
+ if (f != 1.0) {
printf("s4 ");
e++;
}
/* multiply-accumulate test */
f = 0.5;
- for(i = 1; i < 1000000; i++){
+ for(i = 1; i < 1000000; i++) {
f += 2.0;
f *= 0.5;
}
- if (f != 2.0){
+ if (f != 2.0) {
printf("s5 ");
e++;
}
/* divide-subtract test */
f = 2.0;
- for(i = 1; i < 1000000; i++){
+ for(i = 1; i < 1000000; i++) {
f /= 0.5;
f -= 2.0;
}
- if (f != 2.0){
+ if (f != 2.0) {
printf("s6 ");
e++;
}
@@ -115,7 +115,7 @@ int test_single(){
f = 1000000.0;
for(i = 1; i < 1000000; i++)
f = ((((f + 1.5) * 0.5) - 1.25) / 0.5);
- if (f != 1.0){
+ if (f != 1.0) {
printf("s7 ");
e++;
}
@@ -131,7 +131,7 @@ int test_single(){
f = 8.0;
for(i = 1; i < 1000000; i++)
f = ((((f - 5.0) / 2.0) + 2.5) * 2.0);
- if (f != 8.0){
+ if (f != 8.0) {
printf("s9 ");
e++;
}
@@ -140,11 +140,11 @@ int test_single(){
f = 42.0;
for(i = 1; i < 1000000; i++)
f = ((((f / 6.0) - 5.0) * 19.75 ) + 2.5);
- if (f != 42.0){
+ if (f != 42.0) {
printf("s10 ");
e++;
}
- if (e){
+ if (e) {
printf("\n");
return 1;
}
@@ -152,7 +152,7 @@ int test_single(){
}
-int test_double(){
+int test_double() {
static double f;
static int i;
static int e = 0;
@@ -161,7 +161,7 @@ int test_double(){
f = 1.0;
for(i = 0; i < 10; i++)
f += (1<<i);
- if (f != 1024.0){
+ if (f != 1024.0) {
printf("d1 ");
e++;
}
@@ -170,7 +170,7 @@ int test_double(){
f = 1024.0;
for(i = 0; i < 10; i++)
f -= (1<<i);
- if (f != 1.0){
+ if (f != 1.0) {
printf("d2 ");
e++;
}
@@ -179,7 +179,7 @@ int test_double(){
f = 1.0;
for(i = 1; i < 10; i++)
f *= i;
- if (f != 362880.0){
+ if (f != 362880.0) {
printf("d3 ");
e++;
}
@@ -188,29 +188,29 @@ int test_double(){
f = 362880.0;
for(i = 1; i < 10; i++)
f /= i;
- if (f != 1.0){
+ if (f != 1.0) {
printf("d4 ");
e++;
}
/* multiply-accumulate test */
f = 0.5;
- for(i = 1; i < 1000000; i++){
+ for(i = 1; i < 1000000; i++) {
f += 2.0;
f *= 0.5;
}
- if (f != 2.0){
+ if (f != 2.0) {
printf("d5 ");
e++;
}
/* divide-subtract test */
f = 2.0;
- for(i = 1; i < 1000000; i++){
+ for(i = 1; i < 1000000; i++) {
f /= 0.5;
f -= 2.0;
}
- if (f != 2.0){
+ if (f != 2.0) {
printf("d6 ");
e++;
}
@@ -219,7 +219,7 @@ int test_double(){
f = 1000000.0;
for(i = 1; i < 1000000; i++)
f = ((((f + 1.5) * 0.5) - 1.25) / 0.5);
- if (f != 1.0){
+ if (f != 1.0) {
printf("d7 ");
e++;
}
@@ -235,7 +235,7 @@ int test_double(){
f = 8.0;
for(i = 1; i < 1000000; i++)
f = ((((f - 5.0) / 2.0) + 2.5) * 2.0);
- if (f != 8.0){
+ if (f != 8.0) {
printf("d9 ");
e++;
}
@@ -244,11 +244,11 @@ int test_double(){
f = 42.0;
for(i = 1; i < 1000000; i++)
f = ((((f / 6.0) - 5.0) * 19.75 ) + 2.5);
- if (f != 42.0){
+ if (f != 42.0) {
printf("d10 ");
e++;
}
- if (e){
+ if (e) {
printf("\n");
return 1;
}