Skip to content

Commit

Permalink
apps, funcs: Fix compiler warnings, update CI.
Browse files Browse the repository at this point in the history
Fixes compilation issues seen on a
CentOS/Sangoma Linux 7 system running
a 3.1 kernel.

Updates some patches to use newer versions
that address warnings in newer gcc versions.

Also updates CI to build in Debian 12
instead of 11, and also in an Ubuntu VM.
  • Loading branch information
InterLinked1 committed Oct 26, 2023
1 parent 8e309aa commit f022890
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 2,291 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,28 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
vm:
ubuntu-latest:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
- name: Start build
run: echo Beginning build
container:
- name: Run Ubuntu build
run: |
cd /usr/src
sudo apt-get update -y
sudo apt-get install -y wget
sudo wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
sudo chmod +x phreaknet.sh
sudo ./phreaknet.sh make
sudo phreaknet install -d -s -t
sudo phreaknet runtests
debian-stable:
runs-on: ubuntu-latest
container: debian:11
container: debian:12
steps:
- name: Run build
- name: Run Debian build
run: |
cd /usr/src
apt-get update -y
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ PhreakScript installs:
- Adds fax timing and parameter control to `chan_sip`
- Adds prefix capabilities to `include => `
- Fixes ulaw/gsm codec translation bug
- Fixes infinite loop Dial bug

PhreakScript is also useful for:
- automating installation and maintenance of Asterisk, Asterisk Test Suite, Asterisk Test Framework, DAHDI Linux, DAHDI Tools, and related resources
Expand Down
2 changes: 1 addition & 1 deletion apps/app_ccsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ static int offer_ohq(struct ast_channel *chan)
/*! \retval -1 on hangup, 0 on timeout, positive integer on complete input */
static int get_auth_code(struct ast_channel *chan, char *buf, size_t len)
{
int res;
int res = 0;
struct ast_tone_zone_sound *ts = NULL;
int x = 0;

Expand Down
3 changes: 2 additions & 1 deletion apps/app_selective.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,8 @@ static int delete_private_entries(char *family, char *key, int res)
/*! \brief Remove either all or all private entries from a list */
static int selective_clear(struct ast_channel *chan, struct ast_str *strbuf, char *buf, struct selective_proc *f, int flags)
{
int privates, entries = get_number_entries(chan, strbuf, f, ENTRY_ANY);
int privates = 0; /* Can't be used uninitialized since only used if ENTRY_PRIVATE, but whatever */
int entries = get_number_entries(chan, strbuf, f, ENTRY_ANY);

if (!entries) { /* list is empty, there is nothing to clear out from it... */
ast_verb(3, "User requested clearing all%s entries from %s list, but list is empty", flags == ENTRY_PRIVATE ? " private" : "", f->name);
Expand Down
7 changes: 6 additions & 1 deletion apps/app_softmodem.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/opensslv.h>
#endif

/* For TDD stuff */
Expand Down Expand Up @@ -773,7 +774,11 @@ static int softmodem_communicate(modem_session *s, int tls)
if (tls) {
#ifdef HAVE_OPENSSL
int sres;
ctx = SSL_CTX_new(TLS_client_method());
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
ctx = SSL_CTX_new(TLS_method());
#else
ctx = SSL_CTX_new(TLSv1_method()); /* If the system is this old, it probably should use an old TLS version anyways */
#endif
if (!ctx) {
close(sock);
return -1;
Expand Down
11 changes: 7 additions & 4 deletions funcs/func_notchfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,11 @@ complex evaluate(complex topco[], int nz, complex botco[], int np, complex z)
static complex eval(complex coeffs[], int npz, complex z)
{
complex sum;
int i;

sum.re = 0.0;
sum.im = 0.0;
for (int i = npz; i >= 0; i--) {
for (i = npz; i >= 0; i--) {
sum = complexadd2((complexmult2(sum, z)), coeffs[i]);
}
return sum;
Expand Down Expand Up @@ -286,11 +288,11 @@ static void compute_bpres(void)
} else { /* must iterate to find exact pole positions */
complex topcoeffs[MAXPZ+1];
double r, thm = theta, th1 = 0.0, th2 = PI;
int cvg;
int cvg, i;
expand(zplane.zeros, zplane.numzeros, topcoeffs);
r = exp(-theta / (2.0 * qfactor));
cvg = 0;
for (int i=0; i < 50 && !cvg; i++) {
for (i=0; i < 50 && !cvg; i++) {
complex botcoeffs[MAXPZ+1];
complex g;
double phi;
Expand Down Expand Up @@ -366,8 +368,9 @@ static void expand(complex pz[], int npz, complex coeffs[])
/* multiply factor (z-w) into coeffs */
static void multin(complex w, int npz, complex coeffs[])
{
int i;
complex nw = complexnegative(w);
for (int i = npz; i >= 1; i--) {
for (i = npz; i >= 1; i--) {
coeffs[i] = complexadd2((complexmult2(nw, coeffs[i])), coeffs[i-1]);
}
coeffs[0] = complexmult2(nw, coeffs[0]);
Expand Down
Loading

0 comments on commit f022890

Please sign in to comment.