diff options
author | Gary E. Miller <gem@rellim.com> | 2015-03-09 15:52:37 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2015-03-09 15:52:37 -0700 |
commit | c0cb4456b86779f67a59819dbd797caea6cb0b99 (patch) | |
tree | cbef94125416bfe5d6a2b7ebd4d05cef86bc42ca | |
parent | a2f003b7075dd6a262e1a89ff6fac327c3bef097 (diff) | |
download | gpsd-c0cb4456b86779f67a59819dbd797caea6cb0b99.tar.gz |
Fix cppcheck complaints about not enough parenthesis.
Change this: A & B ? 0 : 1
To this: (A & B) ? 0 : 1
No logic or functional change.
-rw-r--r-- | driver_italk.c | 4 | ||||
-rw-r--r-- | driver_navcom.c | 32 | ||||
-rw-r--r-- | monitor_oncore.c | 20 | ||||
-rw-r--r-- | subframe.c | 2 |
4 files changed, 29 insertions, 29 deletions
diff --git a/driver_italk.c b/driver_italk.c index 60883163..4c42597d 100644 --- a/driver_italk.c +++ b/driver_italk.c @@ -218,8 +218,8 @@ static gps_mask_t decode_itk_subframe(struct gps_device_t *session, gpsd_log(&session->context->errout, LOG_PROG, "iTalk 50B SUBFRAME prn %u sf %u - decode %s %s\n", prn, sf, - flags & SUBFRAME_WORD_FLAG_MASK ? "error" : "ok", - flags & SUBFRAME_GPS_PREAMBLE_INVERTED ? "(inverted)" : ""); + (flags & SUBFRAME_WORD_FLAG_MASK) ? "error" : "ok", + (flags & SUBFRAME_GPS_PREAMBLE_INVERTED) ? "(inverted)" : ""); if (flags & SUBFRAME_WORD_FLAG_MASK) return 0; // don't try decode an erroneous packet diff --git a/driver_navcom.c b/driver_navcom.c index 5554f03b..18f56f3c 100644 --- a/driver_navcom.c +++ b/driver_navcom.c @@ -739,7 +739,7 @@ static gps_mask_t handle_0x86(struct gps_device_t *session) /*@ -predboolothers @*/ gpsd_log(&session->context->errout, LOG_DATA, "Navcom: engine status = 0x%x, almanac = %s, time = 0x%x, pos = 0x%x\n", - eng_status & 0x07, (eng_status & 0x08 ? "valid" : "invalid"), + eng_status & 0x07, ((eng_status & 0x08) ? "valid" : "invalid"), eng_status & 0x30 >> 4, eng_status & 0xc0 >> 6); /*@ +predboolothers @*/ @@ -809,11 +809,11 @@ static gps_mask_t handle_0x86(struct gps_device_t *session) gpsd_log(&session->context->errout, LOG_DATA, "Navcom: sol. valid = %c, clock = %s, pos. = %s, " "height = %s, err. code = 0x%x\n", - (sol_status & 0x01 ? 'Y' : 'N'), - (sol_status & 0x02 ? "stable" : "unstable"), - (sol_status & 0x04 ? "dgps" : "unaided"), - (sol_status & 0x08 ? "solved" : "constrained"), - (sol_status & 0x01 ? 0x00 : sol_status & 0x0f00 >> 8)); + ((sol_status & 0x01) ? 'Y' : 'N'), + ((sol_status & 0x02) ? "stable" : "unstable"), + ((sol_status & 0x04) ? "dgps" : "unaided"), + ((sol_status & 0x08) ? "solved" : "constrained"), + ((sol_status & 0x01) ? 0x00 : sol_status & 0x0f00 >> 8)); /*@ +predboolothers -charint @*/ } @@ -849,8 +849,8 @@ static gps_mask_t handle_0xb0(struct gps_device_t *session) session->context->gps_week, session->context->gps_tow, tm_slew_acc, status, - (status & 0x80 ? "channel time set - " : ""), - (status & 0x40 ? "stable" : "not stable"), status & 0x0f); + ((status & 0x80) ? "channel time set - " : ""), + ((status & 0x40) ? "stable" : "not stable"), status & 0x0f); /*@ +predboolothers @*/ for (n = 11; n < msg_len - 1; n += 16) { uint8_t sv_status = getub(buf, n); @@ -865,28 +865,28 @@ static gps_mask_t handle_0xb0(struct gps_device_t *session) uint8_t l2_slips = (uint8_t) (getles3224(buf, n + 13) & 0x0f); /*@ -predboolothers +charint @*/ double c1 = - (sv_status & 0x80 ? (double)ca_pseudorange / 16.0 * + ((sv_status & 0x80) ? (double)ca_pseudorange / 16.0 * LAMBDA_L1 : NAN); double l1 = - (sv_status & 0x80 ? (double)ca_pseudorange / 16.0 + + ((sv_status & 0x80) ? (double)ca_pseudorange / 16.0 + (double)l1_phase / 256.0 : NAN); double l2 = - (sv_status & 0x20 + ((sv_status & 0x20) ? ((double)ca_pseudorange / 16.0 + (double)p2_ca_pseudorange / 16.0) * (120.0 / 154.0) + (double)l2_phase / 256.0 : NAN); double p1 = - (sv_status & 0x40 ? c1 + + ((sv_status & 0x40) ? c1 + (double)p1_ca_pseudorange / 16.0 * LAMBDA_L1 : NAN); double p2 = - (sv_status & 0x20 ? c1 + + ((sv_status & 0x20) ? c1 + (double)p2_ca_pseudorange / 16.0 * LAMBDA_L1 : NAN); gpsd_log(&session->context->errout, LOG_DATA + 1, "Navcom: >> sv status = 0x%02x (PRN %u - C/A & L1 %s - P1 %s - P2 & L2 %s)\n", sv_status, (sv_status & 0x1f), - (sv_status & 0x80 ? "valid" : "invalid"), - (sv_status & 0x40 ? "valid" : "invalid"), - (sv_status & 0x20 ? "valid" : "invalid")); + ((sv_status & 0x80) ? "valid" : "invalid"), + ((sv_status & 0x40) ? "valid" : "invalid"), + ((sv_status & 0x20) ? "valid" : "invalid")); gpsd_log(&session->context->errout, LOG_DATA + 1, "Navcom: >>> ch status = 0x%02x (Logical channel: %u - CA C/No: %u dBHz) " "sL1: %u, sL2: %u\n", ch_status, ch_status & 0x0f, diff --git a/monitor_oncore.c b/monitor_oncore.c index c763b399..6e08c34b 100644 --- a/monitor_oncore.c +++ b/monitor_oncore.c @@ -229,15 +229,15 @@ static void oncore_update(void) /*@ -predboolothers @*/ (void)snprintf(statusbuf, sizeof(statusbuf), "%s%s%s%s%s%s%s%s%s", - status & 0x80 ? "PProp " : "", - status & 0x40 ? "PoorGeom " : "", - status & 0x20 ? "3D " : "", - status & 0x10 ? "2D " : "", - status & 0x08 ? "Acq/PHold " : "", - status & 0x04 ? "Diff " : "", - status & 0x02 ? "Ins (<3 SV) " : "", - status & 0x01 ? "BadAlm " : "", - dopt & 0x20 ? "survey " : ""); + (status & 0x80) ? "PProp " : "", + (status & 0x40) ? "PoorGeom " : "", + (status & 0x20) ? "3D " : "", + (status & 0x10) ? "2D " : "", + (status & 0x08) ? "Acq/PHold " : "", + (status & 0x04) ? "Diff " : "", + (status & 0x02) ? "Ins (<3 SV) " : "", + (status & 0x01) ? "BadAlm " : "", + (dopt & 0x20) ? "survey " : ""); /*@ +predboolothers @*/ (void)mvwprintw(Ea1win, 3, 24, "%-37s", statusbuf); @@ -246,7 +246,7 @@ static void oncore_update(void) /*@ -predboolothers @*/ (void)mvwprintw(Ea1win, 2, 27, "%s %4.1f", - dopt & 1 ? "hdop" : "pdop", dop); + (dopt & 1) ? "hdop" : "pdop", dop); /*@ +predboolothers @*/ (void)mvwprintw(Ea1win, 3, 10, "%d/%d ", nsat, nvis); @@ -8,7 +8,7 @@ #include "gpsd.h" /* convert unsigned to signed */ -#define uint2int( u, bit) ( u & (1<<(bit-1)) ? u - (1<<bit) : u) +#define uint2int( u, bit) ( (u & (1<<(bit-1))) ? u - (1<<bit) : u) /*@ -usedef @*/ gps_mask_t gpsd_interpret_subframe_raw(struct gps_device_t *session, |