From 2142d2edf50bba06ba21c4369925b7d9a126f124 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Thu, 15 Jun 2017 18:16:51 +0100 Subject: [PATCH] Whitespace changes only: cleaning up trailing whitespace at EOL --- convert.c | 14 ++++++------- convert.h | 14 ++++++------- convert_benchmark.c | 14 ++++++------- cpr.c | 20 +++++++++--------- cpr.h | 14 ++++++------- cprtests.c | 14 ++++++------- crc.c | 40 ++++++++++++++++++------------------ crc.h | 14 ++++++------- demod_2400.c | 38 +++++++++++++++++----------------- demod_2400.h | 14 ++++++------- dump1090.c | 40 ++++++++++++++++++------------------ dump1090.h | 33 +++++++++++++++--------------- faup1090.c | 26 +++++++++++------------ icao_filter.c | 16 +++++++-------- icao_filter.h | 14 ++++++------- interactive.c | 16 +++++++-------- mode_ac.c | 14 ++++++------- mode_s.c | 50 ++++++++++++++++++++++----------------------- net_io.c | 44 +++++++++++++++++++-------------------- net_io.h | 14 ++++++------- sdr.c | 14 ++++++------- sdr.h | 14 ++++++------- sdr_bladerf.c | 14 ++++++------- sdr_bladerf.h | 14 ++++++------- sdr_ifile.c | 16 +++++++-------- sdr_ifile.h | 14 ++++++------- sdr_rtlsdr.c | 18 ++++++++-------- sdr_rtlsdr.h | 14 ++++++------- stats.c | 20 +++++++++--------- stats.h | 18 ++++++++-------- track.c | 20 +++++++++--------- track.h | 16 +++++++-------- util.c | 16 +++++++-------- util.h | 14 ++++++------- view1090.c | 14 ++++++------- 35 files changed, 350 insertions(+), 349 deletions(-) diff --git a/convert.c b/convert.c index fc2a7ae..3f34a38 100644 --- a/convert.c +++ b/convert.c @@ -4,17 +4,17 @@ // // Copyright (c) 2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "dump1090.h" diff --git a/convert.h b/convert.h index 6412fc0..6b861b1 100644 --- a/convert.h +++ b/convert.h @@ -4,17 +4,17 @@ // // Copyright (c) 2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef DUMP1090_CONVERT_H diff --git a/convert_benchmark.c b/convert_benchmark.c index 24b1bc1..96b691f 100644 --- a/convert_benchmark.c +++ b/convert_benchmark.c @@ -5,17 +5,17 @@ // Copyright (c) 2016-2017 Oliver Jowett // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "dump1090.h" diff --git a/cpr.c b/cpr.c index 3f8187b..f2e35c5 100644 --- a/cpr.c +++ b/cpr.c @@ -4,20 +4,20 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -345,9 +345,9 @@ int decodeCPRrelative(double reflat, double reflon, return (-1); // Time to give up - Latitude error } - // Check to see that answer is reasonable - ie no more than 1/2 cell away + // Check to see that answer is reasonable - ie no more than 1/2 cell away if (fabs(rlat - reflat) > (AirDlat/2)) { - return (-1); // Time to give up - Latitude error + return (-1); // Time to give up - Latitude error } // Compute the Longitude Index "m" diff --git a/cpr.h b/cpr.h index 1cb413b..65f4fa4 100644 --- a/cpr.h +++ b/cpr.h @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef DUMP1090_CPR_H diff --git a/cprtests.c b/cprtests.c index abcdac8..875c959 100644 --- a/cprtests.c +++ b/cprtests.c @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . diff --git a/crc.c b/crc.c index ad7d020..0f366ee 100644 --- a/crc.c +++ b/crc.c @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "dump1090.h" @@ -40,7 +40,7 @@ static void initLookupTables() { int i; uint8_t msg[112/8]; - + for (i = 0; i < 256; ++i) { uint32_t c = i << 16; int j; @@ -141,7 +141,7 @@ static int prepareSubtable(struct errorinfo *table, int n, int maxsize, int offs table[n].syndrome ^= single_bit_syndrome[i + offset]; table[n].errors = error_bit+1; table[n].bit[error_bit] = i; - + ++n; n = prepareSubtable(table, n, maxsize, offset, i + 1, endbit, &table[n-1], error_bit + 1, max_errors); } @@ -200,7 +200,7 @@ static struct errorinfo *prepareErrorTable(int bits, int max_correct, int max_de maxsize += combinations(bits - 5, i); // space needed for all i-bit errors } -#ifdef CRCDEBUG +#ifdef CRCDEBUG fprintf(stderr, "Preparing syndrome table to correct up to %d-bit errors (detecting %d-bit errors) in a %d-bit message (max %d entries)\n", max_correct, max_detect, bits, maxsize); #endif @@ -212,7 +212,7 @@ static struct errorinfo *prepareErrorTable(int bits, int max_correct, int max_de // ignore the first 5 bits (DF type) usedsize = prepareSubtable(table, 0, maxsize, 112 - bits, 5, bits, &base_entry, 0, max_correct); - + #ifdef CRCDEBUG fprintf(stderr, "%d syndromes (expected %d).\n", usedsize, maxsize); fprintf(stderr, "Sorting syndromes..\n"); @@ -220,15 +220,15 @@ static struct errorinfo *prepareErrorTable(int bits, int max_correct, int max_de qsort(table, usedsize, sizeof(struct errorinfo), syndrome_compare); -#ifdef CRCDEBUG +#ifdef CRCDEBUG { // Show the table stats fprintf(stderr, "Undetectable errors:\n"); for (i = 1; i <= max_correct; ++i) { int j, count; - + count = 0; - for (j = 0; j < usedsize; ++j) + for (j = 0; j < usedsize; ++j) if (table[j].errors == i && table[j].syndrome == 0) ++count; @@ -240,7 +240,7 @@ static struct errorinfo *prepareErrorTable(int bits, int max_correct, int max_de // Handle ambiguous cases, where there is more than one possible error pattern // that produces a given syndrome (this happens with >2 bit errors). -#ifdef CRCDEBUG +#ifdef CRCDEBUG fprintf(stderr, "Finding collisions..\n"); #endif for (i = 0, j = 0; i < usedsize; ++i) { @@ -264,7 +264,7 @@ static struct errorinfo *prepareErrorTable(int bits, int max_correct, int max_de #endif usedsize = j; } - + // Flag collisions we want to detect but not correct if (max_detect > max_correct) { int flagged; @@ -302,9 +302,9 @@ static struct errorinfo *prepareErrorTable(int bits, int max_correct, int max_de table = realloc(table, usedsize * sizeof(struct errorinfo)); #endif } - + *size_out = usedsize; - + #ifdef CRCDEBUG { // Check the table. @@ -335,9 +335,9 @@ static struct errorinfo *prepareErrorTable(int bits, int max_correct, int max_de fprintf(stderr, "Syndrome table summary:\n"); for (i = 1; i <= max_correct; ++i) { int j, count, possible; - + count = 0; - for (j = 0; j < usedsize; ++j) + for (j = 0; j < usedsize; ++j) if (table[j].errors == i) ++count; diff --git a/crc.h b/crc.h index 96abe35..c6d2902 100644 --- a/crc.h +++ b/crc.h @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef DUMP1090_CRC_H diff --git a/demod_2400.c b/demod_2400.c index 9d350b0..006cd2e 100644 --- a/demod_2400.c +++ b/demod_2400.c @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "dump1090.h" @@ -98,7 +98,7 @@ void demodulate2400(struct mag_buf *mag) // phase 6: 0/4\2 2/4\0 0 0 0 2/4\0/5\1 0 0 0 0 0 0 X2 // phase 7: 0/3 3\1/5\0 0 0 0 1/5\0/4\2 0 0 0 0 0 0 X3 // - + // quick check: we must have a rising edge 0->1 and a falling edge 12->13 if (! (preamble[0] < preamble[1] && preamble[12] > preamble[13]) ) continue; @@ -174,7 +174,7 @@ void demodulate2400(struct mag_buf *mag) // Decode all the next 112 bits, regardless of the actual message // size. We'll check the actual message type later - + pPtr = &m[j+19] + (try_phase/5); phase = try_phase % 5; @@ -184,7 +184,7 @@ void demodulate2400(struct mag_buf *mag) switch (phase) { case 0: - theByte = + theByte = (slice_phase0(pPtr) > 0 ? 0x80 : 0) | (slice_phase2(pPtr+2) > 0 ? 0x40 : 0) | (slice_phase4(pPtr+4) > 0 ? 0x20 : 0) | @@ -198,7 +198,7 @@ void demodulate2400(struct mag_buf *mag) phase = 1; pPtr += 19; break; - + case 1: theByte = (slice_phase1(pPtr) > 0 ? 0x80 : 0) | @@ -213,7 +213,7 @@ void demodulate2400(struct mag_buf *mag) phase = 2; pPtr += 19; break; - + case 2: theByte = (slice_phase2(pPtr) > 0 ? 0x80 : 0) | @@ -228,9 +228,9 @@ void demodulate2400(struct mag_buf *mag) phase = 3; pPtr += 19; break; - + case 3: - theByte = + theByte = (slice_phase3(pPtr) > 0 ? 0x80 : 0) | (slice_phase0(pPtr+3) > 0 ? 0x40 : 0) | (slice_phase2(pPtr+5) > 0 ? 0x20 : 0) | @@ -243,9 +243,9 @@ void demodulate2400(struct mag_buf *mag) phase = 4; pPtr += 19; break; - + case 4: - theByte = + theByte = (slice_phase4(pPtr) > 0 ? 0x80 : 0) | (slice_phase1(pPtr+3) > 0 ? 0x40 : 0) | (slice_phase3(pPtr+5) > 0 ? 0x20 : 0) | @@ -265,7 +265,7 @@ void demodulate2400(struct mag_buf *mag) switch (msg[0] >> 3) { case 0: case 4: case 5: case 11: bytelen = MODES_SHORT_MSG_BYTES; break; - + case 16: case 17: case 18: case 20: case 21: case 24: break; @@ -283,7 +283,7 @@ void demodulate2400(struct mag_buf *mag) bestmsg = msg; bestscore = score; bestphase = try_phase; - + // swap to using the other buffer so we don't clobber our demodulated data // (if we find a better result then we'll swap back, but that's OK because // we no longer need this copy if we found a better one) @@ -362,7 +362,7 @@ void demodulate2400(struct mag_buf *mag) // few bits of the first message, but the message bits didn't // overlap) j += msglen*12/5; - + // Pass data to the next layer useModesMessage(&mm); } diff --git a/demod_2400.h b/demod_2400.h index 907294f..c514ba4 100644 --- a/demod_2400.h +++ b/demod_2400.h @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef DUMP1090_DEMOD_2400_H diff --git a/dump1090.c b/dump1090.c index 82eda50..314b85a 100644 --- a/dump1090.c +++ b/dump1090.c @@ -4,20 +4,20 @@ // // Copyright (c) 2014-2016 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -158,24 +158,24 @@ void modesInit(void) { // Validate the users Lat/Lon home location inputs if ( (Modes.fUserLat > 90.0) // Latitude must be -90 to +90 - || (Modes.fUserLat < -90.0) // and + || (Modes.fUserLat < -90.0) // and || (Modes.fUserLon > 360.0) // Longitude must be -180 to +360 || (Modes.fUserLon < -180.0) ) { Modes.fUserLat = Modes.fUserLon = 0.0; } else if (Modes.fUserLon > 180.0) { // If Longitude is +180 to +360, make it -180 to 0 Modes.fUserLon -= 360.0; } - // If both Lat and Lon are 0.0 then the users location is either invalid/not-set, or (s)he's in the - // Atlantic ocean off the west coast of Africa. This is unlikely to be correct. - // Set the user LatLon valid flag only if either Lat or Lon are non zero. Note the Greenwich meridian - // is at 0.0 Lon,so we must check for either fLat or fLon being non zero not both. + // If both Lat and Lon are 0.0 then the users location is either invalid/not-set, or (s)he's in the + // Atlantic ocean off the west coast of Africa. This is unlikely to be correct. + // Set the user LatLon valid flag only if either Lat or Lon are non zero. Note the Greenwich meridian + // is at 0.0 Lon,so we must check for either fLat or fLon being non zero not both. // Testing the flag at runtime will be much quicker than ((fLon != 0.0) || (fLat != 0.0)) Modes.bUserFlags &= ~MODES_USER_LATLON_VALID; if ((Modes.fUserLat != 0.0) || (Modes.fUserLon != 0.0)) { Modes.bUserFlags |= MODES_USER_LATLON_VALID; } - // Limit the maximum requested raw output size to less than one Ethernet Block + // Limit the maximum requested raw output size to less than one Ethernet Block if (Modes.net_output_flush_size > (MODES_OUT_FLUSH_SIZE)) {Modes.net_output_flush_size = MODES_OUT_FLUSH_SIZE;} if (Modes.net_output_flush_interval > (MODES_OUT_FLUSH_INTERVAL)) @@ -372,7 +372,7 @@ void backgroundTasks(void) { if (Modes.net) { modesNetPeriodicWork(); - } + } // Refresh screen when in interactive mode @@ -391,21 +391,21 @@ void backgroundTasks(void) { } else { Modes.stats_latest_1min = (Modes.stats_latest_1min + 1) % 15; Modes.stats_1min[Modes.stats_latest_1min] = Modes.stats_current; - + add_stats(&Modes.stats_current, &Modes.stats_alltime, &Modes.stats_alltime); add_stats(&Modes.stats_current, &Modes.stats_periodic, &Modes.stats_periodic); - + reset_stats(&Modes.stats_5min); for (i = 0; i < 5; ++i) add_stats(&Modes.stats_1min[(Modes.stats_latest_1min - i + 15) % 15], &Modes.stats_5min, &Modes.stats_5min); - + reset_stats(&Modes.stats_15min); for (i = 0; i < 15; ++i) add_stats(&Modes.stats_1min[i], &Modes.stats_15min, &Modes.stats_15min); - + reset_stats(&Modes.stats_current); Modes.stats_current.start = Modes.stats_current.end = now; - + if (Modes.json_dir) writeJsonToFile("stats.json", generateStatsJson); diff --git a/dump1090.h b/dump1090.h index d74c547..ffc6c27 100644 --- a/dump1090.h +++ b/dump1090.h @@ -4,20 +4,20 @@ // // Copyright (c) 2014-2016 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -374,10 +374,10 @@ struct modesMessage { // Generic fields unsigned char msg[MODES_LONG_MSG_BYTES]; // Binary message. unsigned char verbatim[MODES_LONG_MSG_BYTES]; // Binary message, as originally received before correction - int msgbits; // Number of bits in message + int msgbits; // Number of bits in message int msgtype; // Downlink format # uint32_t crc; // Message CRC - int correctedbits; // No. of bits corrected + int correctedbits; // No. of bits corrected uint32_t addr; // Address Announced addrtype_t addrtype; // address format / source uint64_t timestampMsg; // Timestamp of the message (12MHz clock) @@ -462,13 +462,14 @@ struct modesMessage { unsigned squawk; // 13 bits identity (Squawk), encoded as 4 hex digits char callsign[9]; // 8 chars flight number, NUL-terminated unsigned category; // A0 - D7 encoded as a single hex byte - // valid if cpr_valid - cpr_type_t cpr_type; // The encoding type used (surface, airborne, coarse TIS-B) - unsigned cpr_lat; // Non decoded latitude. - unsigned cpr_lon; // Non decoded longitude. - unsigned cpr_nucp; // NUCp/NIC value implied by message type - airground_t airground; // air/ground state + // valid if cpr_valid + cpr_type_t cpr_type; // The encoding type used (surface, airborne, coarse TIS-B) + unsigned cpr_lat; // Non decoded latitude. + unsigned cpr_lon; // Non decoded longitude. + unsigned cpr_nucp; // NUCp/NIC value implied by message type + + airground_t airground; // air/ground state // valid if cpr_decoded: double decoded_lat; diff --git a/faup1090.c b/faup1090.c index 31eb0d8..e476a7e 100644 --- a/faup1090.c +++ b/faup1090.c @@ -4,20 +4,20 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -83,17 +83,17 @@ static void faupInitConfig(void) { static void faupInit(void) { // Validate the users Lat/Lon home location inputs if ( (Modes.fUserLat > 90.0) // Latitude must be -90 to +90 - || (Modes.fUserLat < -90.0) // and + || (Modes.fUserLat < -90.0) // and || (Modes.fUserLon > 360.0) // Longitude must be -180 to +360 || (Modes.fUserLon < -180.0) ) { Modes.fUserLat = Modes.fUserLon = 0.0; } else if (Modes.fUserLon > 180.0) { // If Longitude is +180 to +360, make it -180 to 0 Modes.fUserLon -= 360.0; } - // If both Lat and Lon are 0.0 then the users location is either invalid/not-set, or (s)he's in the - // Atlantic ocean off the west coast of Africa. This is unlikely to be correct. - // Set the user LatLon valid flag only if either Lat or Lon are non zero. Note the Greenwich meridian - // is at 0.0 Lon,so we must check for either fLat or fLon being non zero not both. + // If both Lat and Lon are 0.0 then the users location is either invalid/not-set, or (s)he's in the + // Atlantic ocean off the west coast of Africa. This is unlikely to be correct. + // Set the user LatLon valid flag only if either Lat or Lon are non zero. Note the Greenwich meridian + // is at 0.0 Lon,so we must check for either fLat or fLon being non zero not both. // Testing the flag at runtime will be much quicker than ((fLon != 0.0) || (fLat != 0.0)) Modes.bUserFlags &= ~MODES_USER_LATLON_VALID; if ((Modes.fUserLat != 0.0) || (Modes.fUserLon != 0.0)) { diff --git a/icao_filter.c b/icao_filter.c index 0284de1..38f7b5c 100644 --- a/icao_filter.c +++ b/icao_filter.c @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "dump1090.h" @@ -51,7 +51,7 @@ static uint32_t icaoHash(uint32_t a) hash += (a >> 16) & 0xff; hash += (hash << 10); hash ^= (hash >> 6); - + hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); diff --git a/icao_filter.h b/icao_filter.h index 2c30f8d..397f7f3 100644 --- a/icao_filter.h +++ b/icao_filter.h @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef DUMP1090_ICAO_FILTER_H diff --git a/interactive.c b/interactive.c index 09fcd1b..66fdfb9 100644 --- a/interactive.c +++ b/interactive.c @@ -4,20 +4,20 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo diff --git a/mode_ac.c b/mode_ac.c index c482fd7..9af1243 100644 --- a/mode_ac.c +++ b/mode_ac.c @@ -92,10 +92,10 @@ static int internalModeAToModeC(unsigned int ModeA) if (ModeA & 0x0020) {OneHundreds ^= 0x003;} // C2 if (ModeA & 0x0040) {OneHundreds ^= 0x001;} // C4 - // Remove 7s from OneHundreds (Make 7->5, snd 5->7). + // Remove 7s from OneHundreds (Make 7->5, snd 5->7). if ((OneHundreds & 5) == 5) {OneHundreds ^= 2;} - // Check for invalid codes, only 1 to 5 are valid + // Check for invalid codes, only 1 to 5 are valid if (OneHundreds > 5) { return INVALID_ALTITUDE; } @@ -108,14 +108,14 @@ static int internalModeAToModeC(unsigned int ModeA) if (ModeA & 0x2000) {FiveHundreds ^= 0x01F;} // A2 if (ModeA & 0x4000) {FiveHundreds ^= 0x00F;} // A4 - if (ModeA & 0x0100) {FiveHundreds ^= 0x007;} // B1 + if (ModeA & 0x0100) {FiveHundreds ^= 0x007;} // B1 if (ModeA & 0x0200) {FiveHundreds ^= 0x003;} // B2 if (ModeA & 0x0400) {FiveHundreds ^= 0x001;} // B4 - - // Correct order of OneHundreds. - if (FiveHundreds & 1) {OneHundreds = 6 - OneHundreds;} - return ((FiveHundreds * 5) + OneHundreds - 13); + // Correct order of OneHundreds. + if (FiveHundreds & 1) {OneHundreds = 6 - OneHundreds;} + + return ((FiveHundreds * 5) + OneHundreds - 13); } // //========================================================================= diff --git a/mode_s.c b/mode_s.c index f14f0f1..16aec58 100644 --- a/mode_s.c +++ b/mode_s.c @@ -4,20 +4,20 @@ // // Copyright (c) 2014-2016 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -68,8 +68,8 @@ // // Given the Downlink Format (DF) of the message, return the message length in bits. // -// All known DF's 16 or greater are long. All known DF's 15 or less are short. -// There are lots of unused codes in both category, so we can assume ICAO will stick to +// All known DF's 16 or greater are long. All known DF's 15 or less are short. +// There are lots of unused codes in both category, so we can assume ICAO will stick to // these rules, meaning that the most significant bit of the DF indicates the length. // int modesMessageLenByType(int type) { @@ -86,7 +86,7 @@ int modesMessageLenByType(int type) { // // So every group of three bits A, B, C, D represent an integer from 0 to 7. // -// The actual meaning is just 4 octal numbers, but we convert it into a hex +// The actual meaning is just 4 octal numbers, but we convert it into a hex // number tha happens to represent the four octal numbers. // // For more info: http://en.wikipedia.org/wiki/Gillham_code @@ -100,8 +100,8 @@ static int decodeID13Field(int ID13Field) { if (ID13Field & 0x0200) {hexGillham |= 0x2000;} // Bit 9 = A2 if (ID13Field & 0x0100) {hexGillham |= 0x0040;} // Bit 8 = C4 if (ID13Field & 0x0080) {hexGillham |= 0x4000;} // Bit 7 = A4 - //if (ID13Field & 0x0040) {hexGillham |= 0x0800;} // Bit 6 = X or M - if (ID13Field & 0x0020) {hexGillham |= 0x0100;} // Bit 5 = B1 + //if (ID13Field & 0x0040) {hexGillham |= 0x0800;} // Bit 6 = X or M + if (ID13Field & 0x0020) {hexGillham |= 0x0100;} // Bit 5 = B1 if (ID13Field & 0x0010) {hexGillham |= 0x0001;} // Bit 4 = D1 or Q if (ID13Field & 0x0008) {hexGillham |= 0x0200;} // Bit 3 = B2 if (ID13Field & 0x0004) {hexGillham |= 0x0002;} // Bit 2 = D2 @@ -157,13 +157,13 @@ static int decodeAC12Field(int AC12Field, altitude_unit_t *unit) { *unit = UNIT_FEET; if (q_bit) { /// N is the 11 bit integer resulting from the removal of bit Q at bit 4 - int n = ((AC12Field & 0x0FE0) >> 1) | + int n = ((AC12Field & 0x0FE0) >> 1) | (AC12Field & 0x000F); // The final altitude is the resulting number multiplied by 25, minus 1000. return ((n * 25) - 1000); } else { // Make N a 13 bit Gillham coded altitude by inserting M=0 at bit 6 - int n = ((AC12Field & 0x0FC0) << 1) | + int n = ((AC12Field & 0x0FC0) << 1) | (AC12Field & 0x003F); n = modeAToModeC(decodeID13Field(n)); if (n < -12) { @@ -182,7 +182,7 @@ static int decodeAC12Field(int AC12Field, altitude_unit_t *unit) { static unsigned decodeMovementField(unsigned movement) { int gspeed; - // Note : movement codes 0,125,126,127 are all invalid, but they are + // Note : movement codes 0,125,126,127 are all invalid, but they are // trapped for before this function is called. if (movement > 123) gspeed = 199; // > 175kt @@ -200,7 +200,7 @@ static unsigned decodeMovementField(unsigned movement) { // (from bits 8-31) if it is affected by the given error // syndrome. Updates *addr and returns >0 if changed, 0 if // it was unaffected. -static int correct_aa_field(uint32_t *addr, struct errorinfo *ei) +static int correct_aa_field(uint32_t *addr, struct errorinfo *ei) { int i; int addr_errors = 0; @@ -310,7 +310,7 @@ int scoreModesMessage(unsigned char *msg, int validbits) else return -1; } - + case 17: // Extended squitter case 18: // Extended squitter/non-transponder ei = modesChecksumDiagnose(crc, msgbits); @@ -319,7 +319,7 @@ int scoreModesMessage(unsigned char *msg, int validbits) // fix any errors in the address field addr = getbits(msg, 9, 32); - correct_aa_field(&addr, ei); + correct_aa_field(&addr, ei); if (icaoFilterTest(addr)) return 1800 / (ei->errors+1); @@ -349,7 +349,7 @@ int scoreModesMessage(unsigned char *msg, int validbits) // //========================================================================= // -// Decode a raw Mode S message demodulated as a stream of bytes by detectModeS(), +// Decode a raw Mode S message demodulated as a stream of bytes by detectModeS(), // and split it into fields populating a modesMessage structure. // @@ -458,7 +458,7 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg) mm->correctedbits = ei->errors; modesChecksumFix(msg, ei); addr2 = getbits(msg, 9, 32); - + // we are conservative here: only accept corrected messages that // match an existing aircraft. if (addr1 != addr2 && !icaoFilterTest(addr2)) { @@ -492,7 +492,7 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg) default: // All other message types, we don't know how to handle their CRCs, give up return -2; - } + } // decode the bulk of the message @@ -1175,7 +1175,7 @@ static void decodeExtendedSquitter(struct modesMessage *mm) decodeESOperationalStatus(mm, check_imf); break; - default: + default: break; } } @@ -1755,8 +1755,8 @@ void displayModesMessage(struct modesMessage *mm) { // //========================================================================= // -// When a new message is available, because it was decoded from the RTL device, -// file, or received in the TCP input port, or any other way we can receive a +// When a new message is available, because it was decoded from the RTL device, +// file, or received in the TCP input port, or any other way we can receive a // decoded message, we call this function in order to use the message. // // Basically this function passes a raw message to the upper layers for further diff --git a/net_io.c b/net_io.c index 66fce2b..bc7c7fe 100644 --- a/net_io.c +++ b/net_io.c @@ -4,20 +4,20 @@ // // Copyright (c) 2014-2016 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -606,7 +606,7 @@ static void modesSendSBSOutput(struct modesMessage *mm, struct aircraft *a) { if (mm->gs_valid) { p += sprintf(p, ",%d", mm->gs); } else { - p += sprintf(p, ","); + p += sprintf(p, ","); } // Field 14 is the ground Heading (if we have it) @@ -972,13 +972,13 @@ static int hexDigitVal(int c) { // // This function decodes a string representing message in raw hex format // like: *8D4B969699155600E87406F5B69F; The string is null-terminated. -// +// // The message is passed to the higher level layers, so it feeds // the selected screen output, the network output and so forth. -// +// // If the message looks invalid it is silently discarded. // -// The function always returns 0 (success) to the caller as there is no +// The function always returns 0 (success) to the caller as there is no // case where we want broken messages here to close the client connection. // static int decodeHexMessage(struct client *c, char *hex) { @@ -1030,13 +1030,13 @@ static int decodeHexMessage(struct client *c, char *hex) { break;} } - if ( (l != (MODEAC_MSG_BYTES * 2)) - && (l != (MODES_SHORT_MSG_BYTES * 2)) + if ( (l != (MODEAC_MSG_BYTES * 2)) + && (l != (MODES_SHORT_MSG_BYTES * 2)) && (l != (MODES_LONG_MSG_BYTES * 2)) ) {return (0);} // Too short or long message... broken - if ( (0 == Modes.mode_ac) - && (l == (MODEAC_MSG_BYTES * 2)) ) + if ( (0 == Modes.mode_ac) + && (l == (MODEAC_MSG_BYTES * 2)) ) {return (0);} // Right length for ModeA/C, but not enabled for (j = 0; j < l; j += 2) { @@ -1171,11 +1171,11 @@ char *generateAircraftJson(const char *url_path, int *len) { continue; } - if (first) + if (first) first = 0; else *p++ = ','; - + p += snprintf(p, end-p, "\n {\"hex\":\"%s%06x\"", (a->addr & MODES_NON_ICAO_ADDRESS) ? "~" : "", a->addr & 0xFFFFFF); if (a->addrtype != ADDR_ADSB_ICAO) p += snprintf(p, end-p, ",\"type\":\"%s\"", addrtype_short_string(a->addrtype)); @@ -1223,7 +1223,7 @@ char *generateAircraftJson(const char *url_path, int *len) { a->messages, (now - a->seen)/1000.0, 10 * log10((a->signalLevel[0] + a->signalLevel[1] + a->signalLevel[2] + a->signalLevel[3] + a->signalLevel[4] + a->signalLevel[5] + a->signalLevel[6] + a->signalLevel[7] + 1e-5) / 8)); - + // If we're getting near the end of the buffer, expand it. if ((end - p) < 512) { int used = p - buf; @@ -1353,7 +1353,7 @@ static char * appendStatsJson(char *p, return p; } - + char *generateStatsJson(const char *url_path, int *len) { struct stats add; char *buf = (char *) malloc(4096), *p = buf, *end = buf + 4096; @@ -1375,7 +1375,7 @@ char *generateStatsJson(const char *url_path, int *len) { add_stats(&Modes.stats_alltime, &Modes.stats_current, &add); p = appendStatsJson(p, end, &add, "total"); - p += snprintf(p, end-p, "\n}\n"); + p += snprintf(p, end-p, "\n}\n"); assert(p <= end); @@ -1461,7 +1461,7 @@ void writeJsonToFile(const char *file, char * (*generator) (const char *,int*)) fd = mkstemp(tmppath); if (fd < 0) return; - + mask = umask(0); umask(mask); fchmod(fd, 0644 & ~mask); diff --git a/net_io.h b/net_io.h index 194792b..2c39f6f 100644 --- a/net_io.h +++ b/net_io.h @@ -4,17 +4,17 @@ // // Copyright (c) 2014,2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef DUMP1090_NETIO_H diff --git a/sdr.c b/sdr.c index f37d3e8..89fe8f4 100644 --- a/sdr.c +++ b/sdr.c @@ -5,17 +5,17 @@ // Copyright (c) 2016-2017 Oliver Jowett // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "dump1090.h" diff --git a/sdr.h b/sdr.h index 072da66..4bd20a6 100644 --- a/sdr.h +++ b/sdr.h @@ -5,17 +5,17 @@ // Copyright (c) 2016-2017 Oliver Jowett // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef SDR_H diff --git a/sdr_bladerf.c b/sdr_bladerf.c index 068da48..c849b14 100644 --- a/sdr_bladerf.c +++ b/sdr_bladerf.c @@ -4,17 +4,17 @@ // // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "dump1090.h" diff --git a/sdr_bladerf.h b/sdr_bladerf.h index 39de012..9b8bdab 100644 --- a/sdr_bladerf.h +++ b/sdr_bladerf.h @@ -4,17 +4,17 @@ // // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef BLADERF_H diff --git a/sdr_ifile.c b/sdr_ifile.c index 6f7750c..771c36e 100644 --- a/sdr_ifile.c +++ b/sdr_ifile.c @@ -5,20 +5,20 @@ // Copyright (c) 2014-2017 Oliver Jowett // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo diff --git a/sdr_ifile.h b/sdr_ifile.h index 6652426..41b9e4b 100644 --- a/sdr_ifile.h +++ b/sdr_ifile.h @@ -5,17 +5,17 @@ // Copyright (c) 2016-2017 Oliver Jowett // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef SDR_IFILE_H diff --git a/sdr_rtlsdr.c b/sdr_rtlsdr.c index 4f71c17..0feb992 100644 --- a/sdr_rtlsdr.c +++ b/sdr_rtlsdr.c @@ -5,20 +5,20 @@ // Copyright (c) 2014-2017 Oliver Jowett // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -223,7 +223,7 @@ bool rtlsdrOpen(void) { if (closest == -1 || abs(gains[i] - target) < abs(gains[closest] - target)) closest = i; } - + rtlsdr_set_tuner_gain(RTLSDR.dev, gains[closest]); free(gains); diff --git a/sdr_rtlsdr.h b/sdr_rtlsdr.h index 317b2e4..54999e7 100644 --- a/sdr_rtlsdr.h +++ b/sdr_rtlsdr.h @@ -5,17 +5,17 @@ // Copyright (c) 2016-2017 Oliver Jowett // Copyright (c) 2017 FlightAware LLC // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef SDR_RTLSDR_H diff --git a/stats.c b/stats.c index 69cfcf5..62522f7 100644 --- a/stats.c +++ b/stats.c @@ -4,20 +4,20 @@ // // Copyright (c) 2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -261,7 +261,7 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t target->start = st2->start; target->end = st1->end > st2->end ? st1->end : st2->end; - + target->demod_preambles = st1->demod_preambles + st2->demod_preambles; target->demod_rejected_bad = st1->demod_rejected_bad + st2->demod_rejected_bad; target->demod_rejected_unknown_icao = st1->demod_rejected_unknown_icao + st2->demod_rejected_unknown_icao; @@ -275,7 +275,7 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t add_timespecs(&st1->demod_cpu, &st2->demod_cpu, &target->demod_cpu); add_timespecs(&st1->reader_cpu, &st2->reader_cpu, &target->reader_cpu); add_timespecs(&st1->background_cpu, &st2->background_cpu, &target->background_cpu); - + // noise power: target->noise_power_sum = st1->noise_power_sum + st2->noise_power_sum; target->noise_power_count = st1->noise_power_count + st2->noise_power_count; diff --git a/stats.h b/stats.h index 0e65167..36ab59e 100644 --- a/stats.h +++ b/stats.h @@ -4,20 +4,20 @@ // // Copyright (c) 2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -124,7 +124,7 @@ struct stats { // range histogram #define RANGE_BUCKET_COUNT 76 uint32_t range_histogram[RANGE_BUCKET_COUNT]; -}; +}; void add_stats(const struct stats *st1, const struct stats *st2, struct stats *target); void display_stats(struct stats *st); diff --git a/track.c b/track.c index ea98ab1..8fb3f24 100644 --- a/track.c +++ b/track.c @@ -4,20 +4,20 @@ // // Copyright (c) 2014-2016 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo @@ -351,7 +351,7 @@ static int doLocalCPR(struct aircraft *a, struct modesMessage *mm, uint64_t now, } else if (!surface && (Modes.bUserFlags & MODES_USER_LATLON_VALID)) { reflat = Modes.fUserLat; reflon = Modes.fUserLon; - + // The cell size is at least 360NM, giving a nominal // max range of 180NM (half a cell). // @@ -762,7 +762,7 @@ static void trackRemoveStaleAircraft(uint64_t now) { struct aircraft *a = Modes.aircrafts; struct aircraft *prev = NULL; - + while(a) { if ((now - a->seen) > TRACK_AIRCRAFT_TTL || (a->messages == 1 && (now - a->seen) > TRACK_AIRCRAFT_ONEHIT_TTL)) { diff --git a/track.h b/track.h index dc441bd..f79f1cd 100644 --- a/track.h +++ b/track.h @@ -4,20 +4,20 @@ // // Copyright (c) 2014-2016 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo diff --git a/util.c b/util.c index 3711237..d7afc07 100644 --- a/util.c +++ b/util.c @@ -4,20 +4,20 @@ // // Copyright (c) 2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . -// This file incorporates work covered by the following copyright and +// This file incorporates work covered by the following copyright and // permission notice: // // Copyright (C) 2012 by Salvatore Sanfilippo diff --git a/util.h b/util.h index 51405b4..6030c97 100644 --- a/util.h +++ b/util.h @@ -4,17 +4,17 @@ // // Copyright (c) 2015 Oliver Jowett // -// This file is free software: you may copy, redistribute and/or modify it +// This file is free software: you may copy, redistribute and/or modify it // under the terms of the GNU General Public License as published by the -// Free Software Foundation, either version 2 of the License, or (at your -// option) any later version. +// Free Software Foundation, either version 2 of the License, or (at your +// option) any later version. // -// This file is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// This file is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program. If not, see . #ifndef DUMP1090_UTIL_H diff --git a/view1090.c b/view1090.c index c1e81f9..863cc83 100644 --- a/view1090.c +++ b/view1090.c @@ -67,10 +67,10 @@ void view1090Init(void) { pthread_cond_init(&Modes.data_cond,NULL); #ifdef _WIN32 - if ( (!Modes.wsaData.wVersion) + if ( (!Modes.wsaData.wVersion) && (!Modes.wsaData.wHighVersion) ) { // Try to start the windows socket support - if (WSAStartup(MAKEWORD(2,1),&Modes.wsaData) != 0) + if (WSAStartup(MAKEWORD(2,1),&Modes.wsaData) != 0) { fprintf(stderr, "WSAStartup returned Error\n"); } @@ -79,17 +79,17 @@ void view1090Init(void) { // Validate the users Lat/Lon home location inputs if ( (Modes.fUserLat > 90.0) // Latitude must be -90 to +90 - || (Modes.fUserLat < -90.0) // and + || (Modes.fUserLat < -90.0) // and || (Modes.fUserLon > 360.0) // Longitude must be -180 to +360 || (Modes.fUserLon < -180.0) ) { Modes.fUserLat = Modes.fUserLon = 0.0; } else if (Modes.fUserLon > 180.0) { // If Longitude is +180 to +360, make it -180 to 0 Modes.fUserLon -= 360.0; } - // If both Lat and Lon are 0.0 then the users location is either invalid/not-set, or (s)he's in the - // Atlantic ocean off the west coast of Africa. This is unlikely to be correct. - // Set the user LatLon valid flag only if either Lat or Lon are non zero. Note the Greenwich meridian - // is at 0.0 Lon,so we must check for either fLat or fLon being non zero not both. + // If both Lat and Lon are 0.0 then the users location is either invalid/not-set, or (s)he's in the + // Atlantic ocean off the west coast of Africa. This is unlikely to be correct. + // Set the user LatLon valid flag only if either Lat or Lon are non zero. Note the Greenwich meridian + // is at 0.0 Lon,so we must check for either fLat or fLon being non zero not both. // Testing the flag at runtime will be much quicker than ((fLon != 0.0) || (fLat != 0.0)) Modes.bUserFlags &= ~MODES_USER_LATLON_VALID; if ((Modes.fUserLat != 0.0) || (Modes.fUserLon != 0.0)) {