Merge branch 'dev' of http://github.com/wb2osz/direwolf into dev

This commit is contained in:
wb2osz 2023-01-30 03:09:23 +00:00
commit c25629a286
22 changed files with 278 additions and 32 deletions

170
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,170 @@
name: 'build direwolf'
on:
# permit to manually trigger the CI
workflow_dispatch:
inputs:
cmake_flags:
description: 'Custom CMAKE flags'
required: false
push:
paths-ignore:
- '.github/**'
pull_request:
paths-ignore:
- '.github/**'
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: 'Windows Latest MinGW 64bit',
os: windows-latest,
cc: 'x86_64-w64-mingw32-gcc',
cxx: 'x86_64-w64-mingw32-g++',
ar: 'x86_64-w64-mingw32-ar',
windres: 'x86_64-w64-mingw32-windres',
arch: 'x86_64',
build_type: 'Release',
cmake_extra_flags: '-G "MinGW Makefiles"'
}
- {
name: 'Windows 2019 MinGW 32bit',
os: windows-2019,
cc: 'i686-w64-mingw32-gcc',
cxx: 'i686-w64-mingw32-g++',
ar: 'i686-w64-mingw32-ar',
windres: 'i686-w64-mingw32-windres',
arch: 'i686',
build_type: 'Release',
cmake_extra_flags: '-G "MinGW Makefiles"'
}
- {
name: 'macOS latest',
os: macos-latest,
cc: 'clang',
cxx: 'clang++',
arch: 'x86_64',
build_type: 'Release',
cmake_extra_flags: ''
}
- {
name: 'Ubuntu latest Debug',
os: ubuntu-latest,
cc: 'gcc',
cxx: 'g++',
arch: 'x86_64',
build_type: 'Debug',
cmake_extra_flags: ''
}
- {
name: 'Ubuntu 22.04',
os: ubuntu-22.04,
cc: 'gcc',
cxx: 'g++',
arch: 'x86_64',
build_type: 'Release',
cmake_extra_flags: ''
}
- {
name: 'Ubuntu 20.04',
os: ubuntu-20.04,
cc: 'gcc',
cxx: 'g++',
arch: 'x86_64',
build_type: 'Release',
cmake_extra_flags: ''
}
- {
name: 'Ubuntu 18.04',
os: ubuntu-18.04,
cc: 'gcc',
cxx: 'g++',
arch: 'x86_64',
build_type: 'Release',
cmake_extra_flags: ''
}
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 8
- name: dependency
shell: bash
run: |
# this is not perfect but enought for now
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update
sudo apt-get install libasound2-dev libudev-dev libhamlib-dev gpsd
elif [ "$RUNNER_OS" == "macOS" ]; then
# just to simplify I use homebrew but
# we can use macports (latest direwolf is already available as port)
brew install portaudio hamlib gpsd
elif [ "$RUNNER_OS" == "Windows" ]; then
# add the folder to PATH
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
fi
- name: create build environment
run: |
cmake -E make_directory ${{github.workspace}}/build
- name: configure
shell: bash
working-directory: ${{github.workspace}}/build
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
export AR=${{ matrix.config.ar }}
export WINDRES=${{ matrix.config.windres }}
fi
cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-DCMAKE_CXX_FLAGS="-Werror" -DUNITTEST=1 \
${{ matrix.config.cmake_extra_flags }} \
${{ github.event.inputs.cmake_flags }}
- name: build
shell: bash
working-directory: ${{github.workspace}}/build
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
export AR=${{ matrix.config.ar }}
export WINDRES=${{ matrix.config.windres }}
fi
cmake --build . --config ${{ matrix.config.build_type }} \
${{ github.event.inputs.cmake_flags }}
- name: test
continue-on-error: true
shell: bash
working-directory: ${{github.workspace}}/build
run: |
ctest -C ${{ matrix.config.build_type }} \
--parallel 2 --output-on-failure \
${{ github.event.inputs.cmake_flags }}
- name: package
shell: bash
working-directory: ${{github.workspace}}/build
run: |
if [ "$RUNNER_OS" == "Windows" ] || [ "$RUNNER_OS" == "macOS" ]; then
make package
fi
- name: archive binary
uses: actions/upload-artifact@v2
with:
name: direwolf_${{ matrix.config.os }}_${{ matrix.config.arch }}_${{ github.sha }}
path: |
${{github.workspace}}/build/direwolf-*.zip
${{github.workspace}}/build/direwolf.conf
${{github.workspace}}/build/src/*
${{github.workspace}}/build/CMakeCache.txt
!${{github.workspace}}/build/src/cmake_install.cmake
!${{github.workspace}}/build/src/CMakeFiles
!${{github.workspace}}/build/src/Makefile

73
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,73 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ dev ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ dev ]
schedule:
- cron: '25 8 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- run: |
mkdir build
cd build
cmake -DUNITTEST=1 ..
make
make test
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -167,15 +167,16 @@ elseif(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MACOS_DNSSD") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MACOS_DNSSD")
elseif (WIN32) elseif (WIN32)
if(NOT VS2015 AND NOT VS2017) if(C_MSVC)
message(FATAL_ERROR "You must use Microsoft Visual Studio 2015 or 2017 as compiler") if (NOT VS2015 AND NOT VS2017 AND NOT VS2019)
message(FATAL_ERROR "You must use Microsoft Visual Studio 2015, 2017 or 2019 as compiler")
else()
# compile with full multicore
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CUSTOM_SHELL_BIN "")
endif()
endif() endif()
# compile with full multicore
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CUSTOM_SHELL_BIN "")
endif() endif()
if (C_CLANG OR C_GCC) if (C_CLANG OR C_GCC)

View File

@ -5,7 +5,9 @@ elseif(NOT DEFINED C_GCC AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(C_GCC 1) set(C_GCC 1)
elseif(NOT DEFINED C_MSVC AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC") elseif(NOT DEFINED C_MSVC AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(C_MSVC 1) set(C_MSVC 1)
if(MSVC_VERSION GREATER 1910 AND MSVC_VERSION LESS 1919) if(MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS_EQUAL 1929)
set(VS2019 ON)
elseif(MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS_EQUAL 1919)
set(VS2017 ON) set(VS2017 ON)
elseif(MSVC_VERSION GREATER 1899 AND MSVC_VERSION LESS 1910) elseif(MSVC_VERSION GREATER 1899 AND MSVC_VERSION LESS 1910)
set(VS2015 ON) set(VS2015 ON)

View File

@ -365,7 +365,7 @@ static void * tnc_listen_thread (void *arg)
} }
/* /*
* Call to/from fields are 10 bytes but contents must not exceeed 9 characters. * Call to/from fields are 10 bytes but contents must not exceed 9 characters.
* It's not guaranteed that unused bytes will contain 0 so we * It's not guaranteed that unused bytes will contain 0 so we
* don't issue error message in this case. * don't issue error message in this case.
*/ */

View File

@ -1532,7 +1532,7 @@ int audio_flush (int a)
* (3) Call this function, which might or might not wait long enough. * (3) Call this function, which might or might not wait long enough.
* (4) Add (1) and (2) resulting in when PTT should be turned off. * (4) Add (1) and (2) resulting in when PTT should be turned off.
* (5) Take difference between current time and desired PPT off time * (5) Take difference between current time and desired PPT off time
* and wait for additoinal time if required. * and wait for additional time if required.
* *
*----------------------------------------------------------------*/ *----------------------------------------------------------------*/

View File

@ -72,7 +72,7 @@ struct audio_s {
struct adev_param_s { struct adev_param_s {
/* Properites of the sound device. */ /* Properties of the sound device. */
int defined; /* Was device defined? */ int defined; /* Was device defined? */
/* First one defaults to yes. */ /* First one defaults to yes. */
@ -102,7 +102,7 @@ struct audio_s {
/* This is the probability, in per cent, of randomly corrupting it. */ /* This is the probability, in per cent, of randomly corrupting it. */
/* Normally this is 0. 25 would mean corrupt it 25% of the time. */ /* Normally this is 0. 25 would mean corrupt it 25% of the time. */
int recv_error_rate; /* Similar but the % probablity of dropping a received frame. */ int recv_error_rate; /* Similar but the % probability of dropping a received frame. */
float recv_ber; /* Receive Bit Error Rate (BER). */ float recv_ber; /* Receive Bit Error Rate (BER). */
/* Probability of inverting a bit coming out of the modem. */ /* Probability of inverting a bit coming out of the modem. */

View File

@ -1260,7 +1260,7 @@ int audio_flush (int a)
* (3) Call this function, which might or might not wait long enough. * (3) Call this function, which might or might not wait long enough.
* (4) Add (1) and (2) resulting in when PTT should be turned off. * (4) Add (1) and (2) resulting in when PTT should be turned off.
* (5) Take difference between current time and desired PPT off time * (5) Take difference between current time and desired PPT off time
* and wait for additoinal time if required. * and wait for additional time if required.
* *
*----------------------------------------------------------------*/ *----------------------------------------------------------------*/

View File

@ -84,7 +84,7 @@ static struct audio_s *save_audio_config_p;
*/ */
/* /*
* Originally, we had an abitrary buf time of 40 mS. * Originally, we had an arbitrary buf time of 40 mS.
* *
* For mono, the buffer size was rounded up from 3528 to 4k so * For mono, the buffer size was rounded up from 3528 to 4k so
* it was really about 50 mS per buffer or about 20 per second. * it was really about 50 mS per buffer or about 20 per second.
@ -1074,7 +1074,7 @@ int audio_flush (int a)
* (3) Call this function, which might or might not wait long enough. * (3) Call this function, which might or might not wait long enough.
* (4) Add (1) and (2) resulting in when PTT should be turned off. * (4) Add (1) and (2) resulting in when PTT should be turned off.
* (5) Take difference between current time and desired PPT off time * (5) Take difference between current time and desired PPT off time
* and wait for additoinal time if required. * and wait for additional time if required.
* *
*----------------------------------------------------------------*/ *----------------------------------------------------------------*/

View File

@ -347,7 +347,7 @@ typedef struct ax25_dlsm_s {
// Sometimes the flow chart has SAT instead of SRT. // Sometimes the flow chart has SAT instead of SRT.
// I think that is a typographical error. // I think that is a typographical error.
float t1v; // How long to wait for an acknowlegement before resending. float t1v; // How long to wait for an acknowledgement before resending.
// Value used when starting timer T1, in seconds. // Value used when starting timer T1, in seconds.
// "FRACK" parameter in some implementations. // "FRACK" parameter in some implementations.
// Typically it might be 3 seconds after frame has been // Typically it might be 3 seconds after frame has been
@ -6049,7 +6049,7 @@ static void check_need_for_response (ax25_dlsm_t *S, ax25_frame_type_t frame_typ
* *
* Outputs: S->srt New smoothed roundtrip time. * Outputs: S->srt New smoothed roundtrip time.
* *
* S->t1v How long to wait for an acknowlegement before resending. * S->t1v How long to wait for an acknowledgement before resending.
* Value used when starting timer T1, in seconds. * Value used when starting timer T1, in seconds.
* Here it is dynamically adjusted. * Here it is dynamically adjusted.
* *

View File

@ -5832,7 +5832,7 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
/* /*
* Process symbol now that we have any later overlay. * Process symbol now that we have any later overlay.
* *
* FIXME: Someone who used this was surprized to end up with Solar Powser (S-). * FIXME: Someone who used this was surprised to end up with Solar Powser (S-).
* overlay=S symbol="/-" * overlay=S symbol="/-"
* We should complain if overlay used with symtab other than \. * We should complain if overlay used with symtab other than \.
*/ */

View File

@ -1401,7 +1401,7 @@ static void aprs_mic_e (decode_aprs_t *A, packet_t pp, unsigned char *info, int
} }
} }
/* 6th character of destintation indicates east / west. */ /* 6th character of destination indicates east / west. */
/* /*
* Example of apparently invalid encoding. 6th character missing. * Example of apparently invalid encoding. 6th character missing.
@ -1605,7 +1605,7 @@ static void aprs_mic_e (decode_aprs_t *A, packet_t pp, unsigned char *info, int
* Purpose: Decode "Message Format." * Purpose: Decode "Message Format."
* The word message is used loosely all over the place, but it has a very specific meaning here. * The word message is used loosely all over the place, but it has a very specific meaning here.
* *
* Inputs: info - Pointer to Information field. Be carefull not to modify it here! * Inputs: info - Pointer to Information field. Be careful not to modify it here!
* ilen - Information field length. * ilen - Information field length.
* quiet - suppress error messages. * quiet - suppress error messages.
* *

View File

@ -832,7 +832,7 @@ int demod_init (struct audio_s *pa)
* *
* Name: demod_get_sample * Name: demod_get_sample
* *
* Purpose: Get one audio sample fromt the specified sound input source. * Purpose: Get one audio sample from the specified sound input source.
* *
* Inputs: a - Index for audio device. 0 = first. * Inputs: a - Index for audio device. 0 = first.
* *

View File

@ -367,7 +367,7 @@ struct demodulator_state_s
// Add a sample to the total when putting it in our array of recent samples. // Add a sample to the total when putting it in our array of recent samples.
// Subtract it from the total when it gets pushed off the end. // Subtract it from the total when it gets pushed off the end.
// We can also eliminate the need to shift them all down by using a circular buffer. // We can also eliminate the need to shift them all down by using a circular buffer.
// This only works with integers because float would have cummulated round off errors. // This only works with integers because float would have cumulated round off errors.
cic_t cic_center1; cic_t cic_center1;
cic_t cic_above; cic_t cic_above;

View File

@ -328,7 +328,7 @@ static int stats_uplink_packets; /* Number of packets passed along to the IGate
/* server after filtering. */ /* server after filtering. */
static int stats_uplink_bytes; /* Total number of bytes sent to IGate server */ static int stats_uplink_bytes; /* Total number of bytes sent to IGate server */
/* including login, packets, and hearbeats. */ /* including login, packets, and heartbeats. */
static int stats_downlink_bytes; /* Total number of bytes from IGate server including */ static int stats_downlink_bytes; /* Total number of bytes from IGate server including */
/* packets, heartbeats, other messages. */ /* packets, heartbeats, other messages. */
@ -1229,7 +1229,7 @@ static void send_packet_to_server (packet_t pp, int chan)
* Name: send_msg_to_server * Name: send_msg_to_server
* *
* Purpose: Send something to the IGate server. * Purpose: Send something to the IGate server.
* This one function should be used for login, hearbeats, * This one function should be used for login, heartbeats,
* and packets. * and packets.
* *
* Inputs: imsg - Message. We will add CR/LF here. * Inputs: imsg - Message. We will add CR/LF here.

View File

@ -437,7 +437,7 @@ packet_t il2p_decode_header_type_1 (unsigned char *hdr, int num_sym_changed)
// However, I have seen cases, where the error rate is very high, where the RS decoder // However, I have seen cases, where the error rate is very high, where the RS decoder
// thinks it found a valid code block by changing one symbol but it was the wrong one. // thinks it found a valid code block by changing one symbol but it was the wrong one.
// The result is trash. This shows up as address fields like 'R&G4"A' and 'TEW\ !'. // The result is trash. This shows up as address fields like 'R&G4"A' and 'TEW\ !'.
// I added a sanity check here to catch characters other than uppper case letters and digits. // I added a sanity check here to catch characters other than upper case letters and digits.
// The frame should be rejected in this case. The question is whether to discard it // The frame should be rejected in this case. The question is whether to discard it
// silently or print a message so the user can see that something strange is happening? // silently or print a message so the user can see that something strange is happening?
// My current thinking is that it should be silently ignored if the header has been // My current thinking is that it should be silently ignored if the header has been

View File

@ -194,7 +194,7 @@ int il2p_encode_payload (unsigned char *payload, int payload_size, int max_fec,
* Purpose: Extract original data from encoded payload. * Purpose: Extract original data from encoded payload.
* *
* Inputs: received Array of bytes. Size is unknown but in practice it * Inputs: received Array of bytes. Size is unknown but in practice it
* must not exceeed IL2P_MAX_ENCODED_SIZE. * must not exceed IL2P_MAX_ENCODED_SIZE.
* payload_size 0 to 1023. (IL2P_MAX_PAYLOAD_SIZE) * payload_size 0 to 1023. (IL2P_MAX_PAYLOAD_SIZE)
* Expected result size based on header. * Expected result size based on header.
* max_fec true for 16 parity symbols, false for automatic. * max_fec true for 16 parity symbols, false for automatic.

View File

@ -1421,7 +1421,7 @@ static THREAD_F cmd_listen_thread (void *arg)
} }
/* /*
* Call to/from fields are 10 bytes but contents must not exceeed 9 characters. * Call to/from fields are 10 bytes but contents must not exceed 9 characters.
* It's not guaranteed that unused bytes will contain 0 so we * It's not guaranteed that unused bytes will contain 0 so we
* don't issue error message in this case. * don't issue error message in this case.
*/ */

View File

@ -681,7 +681,7 @@ void symbols_from_dest_or_src (char dti, char *src, char *dest, char *symtab, ch
// The position and object formats all contain a proper symbol and table. // The position and object formats all contain a proper symbol and table.
// There doesn't seem to be much reason to have a symbol for something without // There doesn't seem to be much reason to have a symbol for something without
// a postion because it would not show up on a map. // a position because it would not show up on a map.
// This just seems to be a remnant of something used long ago and no longer needed. // This just seems to be a remnant of something used long ago and no longer needed.
// The protocol spec mentions a "MIM tracker" but I can't find any references to it. // The protocol spec mentions a "MIM tracker" but I can't find any references to it.

View File

@ -882,7 +882,7 @@ static void xmit_object_report (int i, int first_time)
* IGate. * IGate.
* *
* When transmitting over the radio, it gets sent multiple times, to help * When transmitting over the radio, it gets sent multiple times, to help
* probablity of being heard, with increasing delays between. * probability of being heard, with increasing delays between.
* *
* The other methods are reliable so we only want to send it once. * The other methods are reliable so we only want to send it once.
*/ */

View File

@ -298,7 +298,7 @@ void waypoint_send_sentence (char *name_in, double dlat, double dlong, char symt
dw_printf ("waypoint_send_sentence (\"%s\", \"%c%c\")\n", name_in, symtab, symbol); dw_printf ("waypoint_send_sentence (\"%s\", \"%c%c\")\n", name_in, symtab, symbol);
#endif #endif
// Don't waste time if no destintations specified. // Don't waste time if no destinations specified.
if (s_waypoint_serial_port_fd == MYFDERROR && if (s_waypoint_serial_port_fd == MYFDERROR &&
s_waypoint_udp_sock_fd == -1) { s_waypoint_udp_sock_fd == -1) {

View File

@ -600,7 +600,7 @@ static void * xmit_thread (void *arg)
// I don't know if this in some official specification // I don't know if this in some official specification
// somewhere, but it is generally agreed that APRS digipeaters // somewhere, but it is generally agreed that APRS digipeaters
// should send only one frame at a time rather than // should send only one frame at a time rather than
// bunding multiple frames into a single transmission. // bundling multiple frames into a single transmission.
// Discussion here: http://lists.tapr.org/pipermail/aprssig_lists.tapr.org/2021-September/049034.html // Discussion here: http://lists.tapr.org/pipermail/aprssig_lists.tapr.org/2021-September/049034.html
break; break;