Fix compile warnings found when adding -Wall and others.

This commit is contained in:
WB2OSZ 2016-12-23 11:28:39 -05:00
parent 40047e91d9
commit 3516de7f6a
38 changed files with 135 additions and 106 deletions

View File

@ -59,8 +59,6 @@
#include <ws2tcpip.h> // _WIN32_WINNT must be set to 0x0501 before including this #include <ws2tcpip.h> // _WIN32_WINNT must be set to 0x0501 before including this
#else #else
//#define __USE_XOPEN2KXSI 1
//#define __USE_XOPEN 1
#include <stdlib.h> #include <stdlib.h>
#include <netdb.h> #include <netdb.h>
#include <sys/types.h> #include <sys/types.h>
@ -466,7 +464,11 @@ static void * client_thread_net (void *arg)
// Try each address until we find one that is successful. // Try each address until we find one that is successful.
for (n=0; n<num_hosts; n++) { for (n=0; n<num_hosts; n++) {
#if __WIN32__
SOCKET is;
#else
int is; int is;
#endif
ai = hosts[n]; ai = hosts[n];
@ -576,7 +578,7 @@ static void * client_thread_net (void *arg)
printf ("client %d received '%c' data, data_len = %d\n", printf ("client %d received '%c' data, data_len = %d\n",
my_index, mon_cmd.kind_lo, mon_cmd.data_len); my_index, mon_cmd.kind_lo, mon_cmd.data_len);
#endif #endif
assert (mon_cmd.data_len >= 0 && mon_cmd.data_len < sizeof(data)); assert (mon_cmd.data_len >= 0 && mon_cmd.data_len < (int)(sizeof(data)));
if (mon_cmd.data_len > 0) { if (mon_cmd.data_len > 0) {
#if __WIN32__ #if __WIN32__

View File

@ -1447,7 +1447,7 @@ static int find_ttloc_match (char *e, char *xstr, char *ystr, char *zstr, char *
len = strlen(tt_config.ttloc_ptr[ipat].pattern); len = strlen(tt_config.ttloc_ptr[ipat].pattern);
if (strlen(e) == len) { if ((int)(strlen(e)) == len) {
match = 1; match = 1;
strlcpy (xstr, "", valstrsize); strlcpy (xstr, "", valstrsize);

View File

@ -375,8 +375,8 @@ int audio_open (struct audio_s *pa)
{ {
struct sockaddr_in si_me; struct sockaddr_in si_me;
int slen=sizeof(si_me); //int slen=sizeof(si_me);
int data_size = 0; //int data_size = 0;
//Create UDP Socket //Create UDP Socket
if ((adev[a].udp_sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) { if ((adev[a].udp_sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) {
@ -1003,7 +1003,7 @@ int audio_get (int a)
case AUDIO_IN_TYPE_SDR_UDP: case AUDIO_IN_TYPE_SDR_UDP:
while (adev[a].inbuf_next >= adev[a].inbuf_len) { while (adev[a].inbuf_next >= adev[a].inbuf_len) {
int ch, res,i; int res;
assert (adev[a].udp_sock > 0); assert (adev[a].udp_sock > 0);
res = recv(adev[a].udp_sock, adev[a].inbuf_ptr, adev[a].inbuf_size_in_bytes, 0); res = recv(adev[a].udp_sock, adev[a].inbuf_ptr, adev[a].inbuf_size_in_bytes, 0);
@ -1038,7 +1038,8 @@ int audio_get (int a)
case AUDIO_IN_TYPE_STDIN: case AUDIO_IN_TYPE_STDIN:
while (adev[a].inbuf_next >= adev[a].inbuf_len) { while (adev[a].inbuf_next >= adev[a].inbuf_len) {
int ch, res,i; //int ch, res,i;
int res;
res = read(STDIN_FILENO, adev[a].inbuf_ptr, (size_t)adev[a].inbuf_size_in_bytes); res = read(STDIN_FILENO, adev[a].inbuf_ptr, (size_t)adev[a].inbuf_size_in_bytes);
if (res <= 0) { if (res <= 0) {

View File

@ -287,7 +287,7 @@ int audio_open (struct audio_s *pa)
A->udp_sock = INVALID_SOCKET; A->udp_sock = INVALID_SOCKET;
in_dev_no[a] = WAVE_MAPPER; /* = -1 */ in_dev_no[a] = WAVE_MAPPER; /* = ((UINT)-1) in mmsystem.h */
out_dev_no[a] = WAVE_MAPPER; out_dev_no[a] = WAVE_MAPPER;
/* /*
@ -320,16 +320,16 @@ int audio_open (struct audio_s *pa)
/* Otherwise, does it have search string? */ /* Otherwise, does it have search string? */
if (in_dev_no[a] == WAVE_MAPPER && strlen(pa->adev[a].adevice_in) >= 1) { if ((UINT)(in_dev_no[a]) == WAVE_MAPPER && strlen(pa->adev[a].adevice_in) >= 1) {
num_devices = waveInGetNumDevs(); num_devices = waveInGetNumDevs();
for (n=0 ; n<num_devices && in_dev_no[a] == WAVE_MAPPER ; n++) { for (n=0 ; n<num_devices && (UINT)(in_dev_no[a]) == WAVE_MAPPER ; n++) {
if ( ! waveInGetDevCaps(n, &wic, sizeof(WAVEINCAPS))) { if ( ! waveInGetDevCaps(n, &wic, sizeof(WAVEINCAPS))) {
if (strstr(wic.szPname, pa->adev[a].adevice_in) != NULL) { if (strstr(wic.szPname, pa->adev[a].adevice_in) != NULL) {
in_dev_no[a] = n; in_dev_no[a] = n;
} }
} }
} }
if (in_dev_no[a] == WAVE_MAPPER) { if ((UINT)(in_dev_no[a]) == WAVE_MAPPER) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("\"%s\" doesn't match any of the input devices.\n", pa->adev[a].adevice_in); dw_printf ("\"%s\" doesn't match any of the input devices.\n", pa->adev[a].adevice_in);
} }
@ -345,16 +345,16 @@ int audio_open (struct audio_s *pa)
out_dev_no[a] = atoi(pa->adev[a].adevice_out); out_dev_no[a] = atoi(pa->adev[a].adevice_out);
} }
if (out_dev_no[a] == WAVE_MAPPER && strlen(pa->adev[a].adevice_out) >= 1) { if ((UINT)(out_dev_no[a]) == WAVE_MAPPER && strlen(pa->adev[a].adevice_out) >= 1) {
num_devices = waveOutGetNumDevs(); num_devices = waveOutGetNumDevs();
for (n=0 ; n<num_devices && out_dev_no[a] == WAVE_MAPPER ; n++) { for (n=0 ; n<num_devices && (UINT)(out_dev_no[a]) == WAVE_MAPPER ; n++) {
if ( ! waveOutGetDevCaps(n, &woc, sizeof(WAVEOUTCAPS))) { if ( ! waveOutGetDevCaps(n, &woc, sizeof(WAVEOUTCAPS))) {
if (strstr(woc.szPname, pa->adev[a].adevice_out) != NULL) { if (strstr(woc.szPname, pa->adev[a].adevice_out) != NULL) {
out_dev_no[a] = n; out_dev_no[a] = n;
} }
} }
} }
if (out_dev_no[a] == WAVE_MAPPER) { if ((UINT)(out_dev_no[a]) == WAVE_MAPPER) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("\"%s\" doesn't match any of the output devices.\n", pa->adev[a].adevice_out); dw_printf ("\"%s\" doesn't match any of the output devices.\n", pa->adev[a].adevice_out);
} }
@ -799,7 +799,7 @@ int audio_get (int a)
p = (WAVEHDR*)(A->in_headp); /* no need to be volatile at this point */ p = (WAVEHDR*)(A->in_headp); /* no need to be volatile at this point */
if (p->dwUser == -1) { if (p->dwUser == (DWORD)(-1)) {
waveInUnprepareHeader(A->audio_in_handle, p, sizeof(WAVEHDR)); waveInUnprepareHeader(A->audio_in_handle, p, sizeof(WAVEHDR));
p->dwUser = 0; /* Index for next byte. */ p->dwUser = 0; /* Index for next byte. */
@ -960,11 +960,11 @@ int audio_put (int a, int c)
/* Should never be full at this point. */ /* Should never be full at this point. */
assert (p->dwBufferLength >= 0); assert (p->dwBufferLength >= 0);
assert (p->dwBufferLength < A->outbuf_size); assert (p->dwBufferLength < (DWORD)(A->outbuf_size));
p->lpData[p->dwBufferLength++] = c; p->lpData[p->dwBufferLength++] = c;
if (p->dwBufferLength == A->outbuf_size) { if (p->dwBufferLength == (DWORD)(A->outbuf_size)) {
return (audio_flush(a)); return (audio_flush(a));
} }

View File

@ -1193,7 +1193,7 @@ void dl_data_request (dlq_item_t *E)
first_segment.original_pid = E->txdata->pid; first_segment.original_pid = E->txdata->pid;
seglen = MIN(S->n1_paclen - 2, remaining_len); seglen = MIN(S->n1_paclen - 2, remaining_len);
if (seglen < 1 || seglen > S->n1_paclen - 2 || seglen > remaining_len || seglen > sizeof (first_segment.segdata)) { if (seglen < 1 || seglen > S->n1_paclen - 2 || seglen > remaining_len || seglen > (int)(sizeof(first_segment.segdata))) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("INTERNAL ERROR, Segmentation line %d, data length = %d, N1 = %d, segment length = %d, number to follow = %d\n", dw_printf ("INTERNAL ERROR, Segmentation line %d, data length = %d, N1 = %d, segment length = %d, number to follow = %d\n",
__LINE__, E->txdata->len, S->n1_paclen, seglen, nseg_to_follow); __LINE__, E->txdata->len, S->n1_paclen, seglen, nseg_to_follow);
@ -1225,7 +1225,7 @@ void dl_data_request (dlq_item_t *E)
subsequent_segment.header = nseg_to_follow; subsequent_segment.header = nseg_to_follow;
seglen = MIN(S->n1_paclen - 1, remaining_len); seglen = MIN(S->n1_paclen - 1, remaining_len);
if (seglen < 1 || seglen > S->n1_paclen - 1 || seglen > remaining_len || seglen > sizeof (subsequent_segment.segdata)) { if (seglen < 1 || seglen > S->n1_paclen - 1 || seglen > remaining_len || seglen > (int)(sizeof(subsequent_segment.segdata))) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("INTERNAL ERROR, Segmentation line %d, data length = %d, N1 = %d, segment length = %d, number to follow = %d\n", dw_printf ("INTERNAL ERROR, Segmentation line %d, data length = %d, N1 = %d, segment length = %d, number to follow = %d\n",
__LINE__, E->txdata->len, S->n1_paclen, seglen, nseg_to_follow); __LINE__, E->txdata->len, S->n1_paclen, seglen, nseg_to_follow);
@ -1928,7 +1928,7 @@ void lm_data_indication (dlq_item_t *E)
// Gather statistics useful for testing. // Gather statistics useful for testing.
if (ftype >= 0 && ftype <= frame_not_AX25) { if (ftype <= frame_not_AX25) {
S->count_recv_frame_type[ftype]++; S->count_recv_frame_type[ftype]++;
} }
@ -6083,7 +6083,7 @@ static void negotiation_response (ax25_dlsm_t *S, struct xid_param_s *param)
// Other end might want 8. // Other end might want 8.
// Seems unlikely. If it implements XID it should have modulo 128. // Seems unlikely. If it implements XID it should have modulo 128.
if (param->modulo == G_UNKNOWN) { if (param->modulo == modulo_unknown) {
param->modulo = 8; // Not specified. Set default. param->modulo = 8; // Not specified. Set default.
} }
else { else {
@ -6094,7 +6094,7 @@ static void negotiation_response (ax25_dlsm_t *S, struct xid_param_s *param)
// Erratum: 2006 version, section, 4.3.3.7 says default selective reject - reject. // Erratum: 2006 version, section, 4.3.3.7 says default selective reject - reject.
// We can't do that. // We can't do that.
if (param->rej == G_UNKNOWN) { if (param->rej == unknown_reject) {
param->rej = (param->modulo == 128) ? selective_reject : implicit_reject; // not specified, set default param->rej = (param->modulo == 128) ? selective_reject : implicit_reject; // not specified, set default
} }
else { else {
@ -6166,11 +6166,11 @@ static void negotiation_response (ax25_dlsm_t *S, struct xid_param_s *param)
static void complete_negotiation (ax25_dlsm_t *S, struct xid_param_s *param) static void complete_negotiation (ax25_dlsm_t *S, struct xid_param_s *param)
{ {
if (param->rej != G_UNKNOWN) { if (param->rej != unknown_reject) {
S->srej_enabled = param->rej >= selective_reject; S->srej_enabled = param->rej >= selective_reject;
} }
if (param->modulo != G_UNKNOWN) { if (param->modulo != modulo_unknown) {
// Disaster if aren't agreeing on this. // Disaster if aren't agreeing on this.
S->modulo = param->modulo; S->modulo = param->modulo;
} }

View File

@ -170,10 +170,6 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 1
#endif
#include "regex.h" #include "regex.h"

View File

@ -283,7 +283,7 @@ static inline int ax25_get_num_info (packet_t this_p)
#endif #endif
typedef enum ax25_modulo_e { modulo_8 = 8, modulo_128 = 128 } ax25_modulo_t; typedef enum ax25_modulo_e { modulo_unknown = 0, modulo_8 = 8, modulo_128 = 128 } ax25_modulo_t;
typedef enum ax25_frame_type_e { typedef enum ax25_frame_type_e {

View File

@ -207,7 +207,7 @@ packet_t ax25_u_frame (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int num_ad
packet_t this_p; packet_t this_p;
unsigned char *p; unsigned char *p;
int ctrl = 0; int ctrl = 0;
int t = -1; // 1 = must be cmd, 0 = must be response, 2 = can be either. unsigned int t = 999; // 1 = must be cmd, 0 = must be response, 2 = can be either.
int i = 0; // Is Info part allowed? int i = 0; // Is Info part allowed?
this_p = ax25_new (); this_p = ax25_new ();

View File

@ -45,9 +45,6 @@
#include <ctype.h> /* for isdigit */ #include <ctype.h> /* for isdigit */
#include <fcntl.h> #include <fcntl.h>
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 1
#endif
#include "regex.h" #include "regex.h"
#include "ax25_pad.h" #include "ax25_pad.h"
@ -640,14 +637,14 @@ void decode_aprs_print (decode_aprs_t *A) {
if ( ! A->g_quiet) { if ( ! A->g_quiet) {
for (j=0; j<n; j++) { for (j=0; j<n; j++) {
if ((unsigned)A->g_comment[j] == (char)0xb0 && (j == 0 || ! (A->g_comment[j-1] & 0x80))) { if ((unsigned char)(A->g_comment[j]) == 0xb0 && (j == 0 || ! (A->g_comment[j-1] & 0x80))) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf("Character code 0xb0 is probably an attempt at a degree symbol.\n"); dw_printf("Character code 0xb0 is probably an attempt at a degree symbol.\n");
dw_printf("The correct encoding is 0xc2 0xb0 in UTF-8.\n"); dw_printf("The correct encoding is 0xc2 0xb0 in UTF-8.\n");
} }
} }
for (j=0; j<n; j++) { for (j=0; j<n; j++) {
if ((unsigned)A->g_comment[j] == (char)0xf8 && (j == n-1 || (A->g_comment[j+1] & 0xc0) != 0xc0)) { if ((unsigned char)(A->g_comment[j]) == 0xf8 && (j == n-1 || (A->g_comment[j+1] & 0xc0) != 0xc0)) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf("Character code 0xf8 is probably an attempt at a degree symbol.\n"); dw_printf("Character code 0xf8 is probably an attempt at a degree symbol.\n");
dw_printf("The correct encoding is 0xc2 0xb0 in UTF-8.\n"); dw_printf("The correct encoding is 0xc2 0xb0 in UTF-8.\n");
@ -4103,7 +4100,7 @@ static void process_comment (decode_aprs_t *A, char *pstart, int clen)
* digipeated, causing the comment to be hundreds of characters long. * digipeated, causing the comment to be hundreds of characters long.
*/ */
if (clen > sizeof(A->g_comment) - 1) { if (clen > (int)(sizeof(A->g_comment) - 1)) {
if ( ! A->g_quiet) { if ( ! A->g_quiet) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf("Comment is extremely long, %d characters.\n", clen); dw_printf("Comment is extremely long, %d characters.\n", clen);

View File

@ -184,7 +184,7 @@ int demod_init (struct audio_s *pa)
} }
} }
assert (num_letters == strlen(just_letters)); assert (num_letters == (int)(strlen(just_letters)));
/* /*
* Pick a good default demodulator if none specified. * Pick a good default demodulator if none specified.
@ -222,7 +222,7 @@ int demod_init (struct audio_s *pa)
} }
assert (num_letters == strlen(just_letters)); assert (num_letters == (int)(strlen(just_letters)));
/* /*
* Put it back together again. * Put it back together again.

View File

@ -261,7 +261,7 @@ void demod_9600_init (int samples_per_sec, int baud, struct demodulator_state_s
* *
*--------------------------------------------------------------------*/ *--------------------------------------------------------------------*/
static void inline nudge_pll (int chan, int subchan, int slice, float demod_out, struct demodulator_state_s *D); inline static void nudge_pll (int chan, int subchan, int slice, float demod_out, struct demodulator_state_s *D);
__attribute__((hot)) __attribute__((hot))
void demod_9600_process_sample (int chan, int sam, struct demodulator_state_s *D) void demod_9600_process_sample (int chan, int sam, struct demodulator_state_s *D)
@ -484,7 +484,7 @@ void demod_9600_process_sample (int chan, int sam, struct demodulator_state_s *D
*--------------------------------------------------------------------*/ *--------------------------------------------------------------------*/
__attribute__((hot)) __attribute__((hot))
static void inline nudge_pll (int chan, int subchan, int slice, float demod_out_f, struct demodulator_state_s *D) inline static void nudge_pll (int chan, int subchan, int slice, float demod_out_f, struct demodulator_state_s *D)
{ {
/* /*

View File

@ -63,7 +63,7 @@
#define MAX(a,b) ((a)>(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b))
#ifndef GEN_FFF
/* Quick approximation to sqrt(x*x+y*y) */ /* Quick approximation to sqrt(x*x+y*y) */
/* No benefit for regular PC. */ /* No benefit for regular PC. */
@ -137,6 +137,8 @@ static inline float agc (float in, float fast_attack, float slow_decay, float *p
return (0.0f); return (0.0f);
} }
#endif // ifndef GEN_FFF
/* /*
* for multi-slicer experiment. * for multi-slicer experiment.
@ -806,7 +808,7 @@ int main (void)
* *
*--------------------------------------------------------------------*/ *--------------------------------------------------------------------*/
static void inline nudge_pll (int chan, int subchan, int slice, int demod_data, struct demodulator_state_s *D); inline static void nudge_pll (int chan, int subchan, int slice, int demod_data, struct demodulator_state_s *D);
__attribute__((hot)) __attribute__((hot))
void demod_afsk_process_sample (int chan, int subchan, int sam, struct demodulator_state_s *D) void demod_afsk_process_sample (int chan, int subchan, int sam, struct demodulator_state_s *D)
@ -1086,7 +1088,7 @@ void demod_afsk_process_sample (int chan, int subchan, int sam, struct demodulat
__attribute__((hot)) __attribute__((hot))
static void inline nudge_pll (int chan, int subchan, int slice, int demod_data, struct demodulator_state_s *D) inline static void nudge_pll (int chan, int subchan, int slice, int demod_data, struct demodulator_state_s *D)
{ {
/* /*

View File

@ -579,7 +579,7 @@ void demod_psk_init (enum modem_t modem_type, int samples_per_sec, int bps, char
static void inline nudge_pll (int chan, int subchan, int slice, int demod_bits, struct demodulator_state_s *D); inline static void nudge_pll (int chan, int subchan, int slice, int demod_bits, struct demodulator_state_s *D);
__attribute__((hot)) __attribute__((hot))
void demod_psk_process_sample (int chan, int subchan, int sam, struct demodulator_state_s *D) void demod_psk_process_sample (int chan, int subchan, int sam, struct demodulator_state_s *D)
@ -758,7 +758,7 @@ static const int phase_to_gray_v27[8] = {1, 0, 2, 3, 7, 6, 4, 5};
__attribute__((hot)) __attribute__((hot))
static void inline nudge_pll (int chan, int subchan, int slice, int demod_bits, struct demodulator_state_s *D) inline static void nudge_pll (int chan, int subchan, int slice, int demod_bits, struct demodulator_state_s *D)
{ {
/* /*

2
dtmf.c
View File

@ -32,6 +32,8 @@
* References: http://eetimes.com/design/embedded/4024443/The-Goertzel-Algorithm * References: http://eetimes.com/design/embedded/4024443/The-Goertzel-Algorithm
* http://www.ti.com/ww/cn/uprogram/share/ppt/c5000/17dtmf_v13.ppt * http://www.ti.com/ww/cn/uprogram/share/ppt/c5000/17dtmf_v13.ppt
* *
* Revisions: 1.4 - Added transmit capability.
*
*---------------------------------------------------------------*/ *---------------------------------------------------------------*/
#include "direwolf.h" #include "direwolf.h"

View File

@ -75,6 +75,7 @@ static struct gps_data_t gpsdata;
#include "dwgpsd.h" #include "dwgpsd.h"
#if ENABLE_GPSD
static int s_debug = 0; /* Enable debug output. */ static int s_debug = 0; /* Enable debug output. */
/* >= 1 show results from dwgps_read. */ /* >= 1 show results from dwgps_read. */
@ -82,6 +83,7 @@ static int s_debug = 0; /* Enable debug output. */
static void * read_gpsd_thread (void *arg); static void * read_gpsd_thread (void *arg);
#endif
@ -157,7 +159,6 @@ int dwgpsd_init (struct misc_config_s *pconfig, int debug)
int err; int err;
int arg = 0; int arg = 0;
char sport[12]; char sport[12];
dwgps_info_t info;
s_debug = debug; s_debug = debug;
@ -179,7 +180,6 @@ int dwgpsd_init (struct misc_config_s *pconfig, int debug)
snprintf (sport, sizeof(sport), "%d", pconfig->gpsd_port); snprintf (sport, sizeof(sport), "%d", pconfig->gpsd_port);
err = gps_open (pconfig->gpsd_host, sport, &gpsdata); err = gps_open (pconfig->gpsd_host, sport, &gpsdata);
if (err != 0) { if (err != 0) {
dwgps_info_t info;
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("Unable to connect to GPSD stream at %s:%s.\n", pconfig->gpsd_host, sport); dw_printf ("Unable to connect to GPSD stream at %s:%s.\n", pconfig->gpsd_host, sport);
@ -335,7 +335,7 @@ static void * read_gpsd_thread (void *arg)
return(0); // Terminate thread on serious error. return(0); // Terminate thread on serious error.
} /* end read_gps_thread */ } /* end read_gpsd_thread */
#endif #endif

View File

@ -108,7 +108,7 @@ int dwgpsnmea_init (struct misc_config_s *pconfig, int debug)
HANDLE read_gps_th; HANDLE read_gps_th;
#else #else
pthread_t read_gps_tid; pthread_t read_gps_tid;
int e; //int e;
#endif #endif
s_debug = debug; s_debug = debug;

View File

@ -599,7 +599,7 @@ int encode_position (int messaging, int compressed, double lat, double lon, int
result_len += strlen(comment); result_len += strlen(comment);
} }
if (result_len >= result_size) { if (result_len >= (int)result_size) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("encode_position result of %d characters won't fit into space provided.\n", result_len); dw_printf ("encode_position result of %d characters won't fit into space provided.\n", result_len);
} }
@ -683,7 +683,7 @@ int encode_object (char *name, int compressed, time_t thyme, double lat, double
memset (p->o.name, ' ', sizeof(p->o.name)); memset (p->o.name, ' ', sizeof(p->o.name));
n = strlen(name); n = strlen(name);
if (n > sizeof(p->o.name)) n = sizeof(p->o.name); if (n > (int)(sizeof(p->o.name))) n = sizeof(p->o.name);
memcpy (p->o.name, name, n); memcpy (p->o.name, name, n);
p->o.live_killed = '*'; p->o.live_killed = '*';
@ -749,7 +749,7 @@ int encode_object (char *name, int compressed, time_t thyme, double lat, double
result_len += strlen(comment); result_len += strlen(comment);
} }
if (result_len >= result_size) { if (result_len >= (int)result_size) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("encode_object result of %d characters won't fit into space provided.\n", result_len); dw_printf ("encode_object result of %d characters won't fit into space provided.\n", result_len);
} }

View File

@ -577,6 +577,9 @@ long UTM_To_USNG (long Zone,
Northing = 0.0; Northing = 0.0;
} }
ltr2_low_value = LETTER_A; // Make compiler shut up about possibly uninitialized value.
// It should be set by the following but compiler doesn't know.
USNG_Get_Grid_Values(Zone, &ltr2_low_value, &ltr2_high_value, &pattern_offset); USNG_Get_Grid_Values(Zone, &ltr2_low_value, &ltr2_high_value, &pattern_offset);
error_code = USNG_Get_Latitude_Letter(Latitude, &letters[0]); error_code = USNG_Get_Latitude_Letter(Latitude, &letters[0]);
@ -960,6 +963,9 @@ long Convert_USNG_To_UTM (char *USNG,
else else
*Hemisphere = 'N'; *Hemisphere = 'N';
ltr2_low_value = LETTER_A; // Make compiler shut up about possibly uninitialized values.
ltr2_high_value = LETTER_Z; // They should be set by the following but compiler doesn't know.
USNG_Get_Grid_Values(*Zone, &ltr2_low_value, &ltr2_high_value, &pattern_offset); USNG_Get_Grid_Values(*Zone, &ltr2_low_value, &ltr2_high_value, &pattern_offset);
/* Check that the second letter of the USNG string is within /* Check that the second letter of the USNG string is within

View File

@ -585,7 +585,7 @@ static int try_decode (rrbb_t block, int chan, int subchan, int slice, alevel_t
struct hdlc_state_s H; struct hdlc_state_s H;
int blen; /* Block length in bits. */ int blen; /* Block length in bits. */
int i; int i;
unsigned int raw; /* From demodulator. */ int raw; /* From demodulator. Should be 0 or 1. */
#if DEBUGx #if DEBUGx
int crc_failed = 1; int crc_failed = 1;
#endif #endif

9
kiss.c
View File

@ -120,9 +120,6 @@
#if __WIN32__ #if __WIN32__
#include <stdlib.h> #include <stdlib.h>
#else #else
#define __USE_XOPEN2KXSI 1
#define __USE_XOPEN 1
//#define __USE_POSIX 1
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
@ -256,7 +253,7 @@ void kiss_init (struct misc_config_s *mc)
HANDLE kiss_nullmodem_listen_th; HANDLE kiss_nullmodem_listen_th;
#else #else
pthread_t kiss_pterm_listen_tid; pthread_t kiss_pterm_listen_tid;
pthread_t kiss_nullmodem_listen_tid; //pthread_t kiss_nullmodem_listen_tid;
int e; int e;
#endif #endif
@ -669,7 +666,7 @@ void kiss_send_rec_packet (int chan, unsigned char *fbuf, int flen)
unsigned char stemp[AX25_MAX_PACKET_LEN + 1]; unsigned char stemp[AX25_MAX_PACKET_LEN + 1];
assert (flen < sizeof(stemp)); assert (flen < (int)(sizeof(stemp)));
stemp[0] = (chan << 4) + 0; stemp[0] = (chan << 4) + 0;
memcpy (stemp+1, fbuf, flen); memcpy (stemp+1, fbuf, flen);
@ -756,7 +753,7 @@ void kiss_send_rec_packet (int chan, unsigned char *fbuf, int flen)
//nullmodem_fd = MYFDERROR; //nullmodem_fd = MYFDERROR;
} }
} }
else if (nwritten != kiss_len) else if ((int)nwritten != kiss_len)
{ {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("\nError sending KISS message to client application thru null modem. Only %d of %d written.\n\n", (int)nwritten, kiss_len); dw_printf ("\nError sending KISS message to client application thru null modem. Only %d of %d written.\n\n", (int)nwritten, kiss_len);

View File

@ -509,7 +509,7 @@ void kissnet_send_rec_packet (int chan, unsigned char *fbuf, int flen)
unsigned char stemp[AX25_MAX_PACKET_LEN + 1]; unsigned char stemp[AX25_MAX_PACKET_LEN + 1];
assert (flen < sizeof(stemp)); assert (flen < (int)(sizeof(stemp)));
stemp[0] = (chan << 4) + 0; stemp[0] = (chan << 4) + 0;
memcpy (stemp+1, fbuf, flen); memcpy (stemp+1, fbuf, flen);

View File

@ -43,8 +43,7 @@
* Find the first occurrence of find in s, ignore case. * Find the first occurrence of find in s, ignore case.
*/ */
char * char *
strcasestr(s, find) strcasestr(const char *s, const char *find)
const char *s, *find;
{ {
char c, sc; char c, sc;
size_t len; size_t len;

View File

@ -122,7 +122,7 @@ static const struct morse_s {
}; };
#define NUM_MORSE (sizeof(morse) / sizeof(struct morse_s)) #define NUM_MORSE ((int)(sizeof(morse) / sizeof(struct morse_s)))
static void morse_tone (int chan, int tu, int wpm); static void morse_tone (int chan, int tu, int wpm);
static void morse_quiet (int chan, int tu, int wpm); static void morse_quiet (int chan, int tu, int wpm);

1
ptt.c
View File

@ -571,6 +571,7 @@ void ptt_init (struct audio_s *audio_config_p)
/* Try to change protection. */ /* Try to change protection. */
err = system ("sudo chmod go+w /sys/class/gpio/export /sys/class/gpio/unexport"); err = system ("sudo chmod go+w /sys/class/gpio/export /sys/class/gpio/unexport");
(void)err;
if (stat("/sys/class/gpio/export", &finfo) < 0) { if (stat("/sys/class/gpio/export", &finfo) < 0) {
/* Unexpected because we could do it before. */ /* Unexpected because we could do it before. */

3
rdq.c
View File

@ -337,9 +337,6 @@ rrbb_t rdq_remove (void)
{ {
rrbb_t result_p; rrbb_t result_p;
#ifndef __WIN32__
int err;
#endif
#if DEBUG #if DEBUG

View File

@ -5,3 +5,7 @@ For the Windows version, we need to include our own version.
The source was obtained from: The source was obtained from:
http://gnuwin32.sourceforge.net/packages/regex.htm http://gnuwin32.sourceforge.net/packages/regex.htm
That is very old with loads of compile warnings. Should we upgrade from here?
https://www.gnu.org/software/libc/sources.html

View File

@ -3036,7 +3036,9 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
while (1) while (1)
{ {
bracket_elem_t start_elem, end_elem; // Got warnings about being used uninitialized.
// bracket_elem_t start_elem, end_elem;
bracket_elem_t start_elem = {.type=0, .opr.name=NULL}, end_elem = {.type=0, .opr.name=NULL};
unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE]; unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE];
unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE]; unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE];
reg_errcode_t ret; reg_errcode_t ret;

View File

@ -675,9 +675,9 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
else else
{ {
/* No, skip all characters until IDX. */ /* No, skip all characters until IDX. */
#ifdef RE_ENABLE_I18N
int prev_valid_len = pstr->valid_len; int prev_valid_len = pstr->valid_len;
#ifdef RE_ENABLE_I18N
if (BE (pstr->offsets_needed, 0)) if (BE (pstr->offsets_needed, 0))
{ {
pstr->len = pstr->raw_len - idx + offset; pstr->len = pstr->raw_len - idx + offset;
@ -1396,7 +1396,9 @@ static int
internal_function internal_function
re_dfa_add_node (re_dfa_t *dfa, re_token_t token) re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
{ {
#ifdef RE_ENABLE_I18N
int type = token.type; int type = token.type;
#endif
if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0)) if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0))
{ {
size_t new_nodes_alloc = dfa->nodes_alloc * 2; size_t new_nodes_alloc = dfa->nodes_alloc * 2;

View File

@ -1,3 +1,9 @@
/* this is very old and has massive numbers of compiler warnings. */
/* Maybe try upgrading to a newer version such as */
/* https://fossies.org/dox/glibc-2.24/regexec_8c_source.html */
/* Extended regular expression matching and search library. /* Extended regular expression matching and search library.
Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -18,6 +24,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */ 02111-1307 USA. */
/* Added 12/2016 to remove warning: */
/* incompatible implicit declaration of built-in function 'alloca' */
#if __WIN32__
#include <malloc.h>
#else
#include <alloca.h>
#endif
static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
int n) internal_function; int n) internal_function;
static void match_ctx_clean (re_match_context_t *mctx) internal_function; static void match_ctx_clean (re_match_context_t *mctx) internal_function;
@ -228,6 +242,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
reg_errcode_t err; reg_errcode_t err;
int start, length; int start, length;
re_dfa_t *dfa = (re_dfa_t *) preg->buffer; re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
(void)dfa;
if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
return REG_BADPAT; return REG_BADPAT;
@ -419,6 +434,7 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
int nregs, rval; int nregs, rval;
int eflags = 0; int eflags = 0;
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
(void)dfa;
/* Check for out-of-range. */ /* Check for out-of-range. */
if (BE (start < 0 || start > length, 0)) if (BE (start < 0 || start > length, 0))
@ -2894,7 +2910,10 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node,
sizeof (re_dfastate_t *) * (path->alloc - old_alloc)); sizeof (re_dfastate_t *) * (path->alloc - old_alloc));
} }
str_idx = path->next_idx ?: top_str; // Original:
// str_idx = path->next_idx ?: top_str;
// Copied following from another version when cleaning up compiler warnings.
str_idx = path->next_idx ? path->next_idx : top_str;
/* Temporary modify MCTX. */ /* Temporary modify MCTX. */
backup_state_log = mctx->state_log; backup_state_log = mctx->state_log;
@ -3032,7 +3051,9 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx,
const re_dfa_t *const dfa = mctx->dfa; const re_dfa_t *const dfa = mctx->dfa;
int result; int result;
int cur_idx; int cur_idx;
#ifdef RE_ENABLE_I18N
reg_errcode_t err = REG_NOERROR; reg_errcode_t err = REG_NOERROR;
#endif
re_node_set union_set; re_node_set union_set;
re_node_set_init_empty (&union_set); re_node_set_init_empty (&union_set);
for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx) for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx)

View File

@ -44,8 +44,6 @@
#else #else
#define __USE_XOPEN2KXSI 1
#define __USE_XOPEN 1
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
@ -305,7 +303,7 @@ int serial_port_write (MYFDTYPE fd, char *str, int len)
dw_printf ("Error writing to serial port. Error %d.\n\n", err); dw_printf ("Error writing to serial port. Error %d.\n\n", err);
} }
} }
else if (nwritten != len) else if ((int)nwritten != len)
{ {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("Error writing to serial port. Only %d of %d written.\n\n", (int)nwritten, len); dw_printf ("Error writing to serial port. Only %d of %d written.\n\n", (int)nwritten, len);

View File

@ -1212,6 +1212,7 @@ static void send_to_client (int client, void *reply_p)
send (client_sock[client], (char*)(ph), len, 0); send (client_sock[client], (char*)(ph), len, 0);
#else #else
err = write (client_sock[client], ph, len); err = write (client_sock[client], ph, len);
(void)err;
#endif #endif
} }
@ -1274,7 +1275,7 @@ static THREAD_F cmd_listen_thread (void *arg)
int data_len = netle2host(cmd.hdr.data_len_NETLE); int data_len = netle2host(cmd.hdr.data_len_NETLE);
if (data_len < 0 || data_len > sizeof(cmd.data) - 1) { if (data_len < 0 || data_len > (int)(sizeof(cmd.data) - 1)) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("\nInvalid message from AGW client application %d.\n", client); dw_printf ("\nInvalid message from AGW client application %d.\n", client);

View File

@ -526,7 +526,7 @@ void symbols_list (void)
* *
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
const static char ssid_to_sym[16] = { static const char ssid_to_sym[16] = {
' ', /* 0 - No icon. */ ' ', /* 0 - No icon. */
'a', /* 1 - Ambulance */ 'a', /* 1 - Ambulance */
'U', /* 2 - Bus */ 'U', /* 2 - Bus */

View File

@ -74,8 +74,8 @@
#define T_STR_LEN 16 /* Max len for labels and units. */ #define T_STR_LEN 16 /* Max len for labels and units. */
#define MAGIC1 0xa51111a5 /* For checking storage allocation problems. */ #define MAGIC1 0x5a1111a5 /* For checking storage allocation problems. */
#define MAGIC2 0xa52222a5 #define MAGIC2 0x5a2222a5
#define C_A 0 /* Scaling coefficient positions. */ #define C_A 0 /* Scaling coefficient positions. */
#define C_B 1 #define C_B 1
@ -354,7 +354,7 @@ void telemetry_data_original (char *station, char *info, int quiet, char *output
strlcpy (comment, next+8, commentsize); strlcpy (comment, next+8, commentsize);
next[8] = '\0'; next[8] = '\0';
} }
for (k = 0; k < strlen(next); k++) { for (k = 0; k < (int)(strlen(next)); k++) {
if (next[k] == '0') { if (next[k] == '0') {
draw[k] = 0; draw[k] = 0;
} }
@ -819,7 +819,7 @@ void telemetry_bit_sense_message (char *station, char *msg, int quiet)
} }
} }
for (n = 0; n < T_NUM_DIGITAL && n < strlen(msg); n++) { for (n = 0; n < T_NUM_DIGITAL && n < (int)(strlen(msg)); n++) {
if (msg[n] == '1') { if (msg[n] == '1') {
pm->sense[n] = 1; pm->sense[n] = 1;

View File

@ -128,10 +128,10 @@ static const char background_white[] = "\e[5;47m";
static const char black[] = "\e[0;30m" "\e[5;47m"; static const char black[] = "\e[0;30m" "\e[5;47m";
static const char red[] = "\e[1;31m" "\e[5;47m"; static const char red[] = "\e[1;31m" "\e[5;47m";
static const char green[] = "\e[1;32m" "\e[5;47m"; static const char green[] = "\e[1;32m" "\e[5;47m";
static const char yellow[] = "\e[1;33m" "\e[5;47m"; //static const char yellow[] = "\e[1;33m" "\e[5;47m";
static const char blue[] = "\e[1;34m" "\e[5;47m"; static const char blue[] = "\e[1;34m" "\e[5;47m";
static const char magenta[] = "\e[1;35m" "\e[5;47m"; static const char magenta[] = "\e[1;35m" "\e[5;47m";
static const char cyan[] = "\e[1;36m" "\e[5;47m"; //static const char cyan[] = "\e[1;36m" "\e[5;47m";
static const char dark_green[] = "\e[0;32m" "\e[5;47m"; static const char dark_green[] = "\e[0;32m" "\e[5;47m";
/* Clear from cursor to end of screen. */ /* Clear from cursor to end of screen. */
@ -153,10 +153,10 @@ static const char background_white[] = "\e[48;2;255;255;255m";
static const char black[] = "\e[0;30m" "\e[48;2;255;255;255m"; static const char black[] = "\e[0;30m" "\e[48;2;255;255;255m";
static const char red[] = "\e[0;31m" "\e[48;2;255;255;255m"; static const char red[] = "\e[0;31m" "\e[48;2;255;255;255m";
static const char green[] = "\e[0;32m" "\e[48;2;255;255;255m"; static const char green[] = "\e[0;32m" "\e[48;2;255;255;255m";
static const char yellow[] = "\e[0;33m" "\e[48;2;255;255;255m"; //static const char yellow[] = "\e[0;33m" "\e[48;2;255;255;255m";
static const char blue[] = "\e[0;34m" "\e[48;2;255;255;255m"; static const char blue[] = "\e[0;34m" "\e[48;2;255;255;255m";
static const char magenta[] = "\e[0;35m" "\e[48;2;255;255;255m"; static const char magenta[] = "\e[0;35m" "\e[48;2;255;255;255m";
static const char cyan[] = "\e[0;36m" "\e[48;2;255;255;255m"; //static const char cyan[] = "\e[0;36m" "\e[48;2;255;255;255m";
static const char dark_green[] = "\e[0;32m" "\e[48;2;255;255;255m"; static const char dark_green[] = "\e[0;32m" "\e[48;2;255;255;255m";
@ -171,10 +171,10 @@ static const char background_white[] = "\e[47;1m";
static const char black[] = "\e[0;30m" "\e[1;47m"; static const char black[] = "\e[0;30m" "\e[1;47m";
static const char red[] = "\e[1;31m" "\e[1;47m"; static const char red[] = "\e[1;31m" "\e[1;47m";
static const char green[] = "\e[1;32m" "\e[1;47m"; static const char green[] = "\e[1;32m" "\e[1;47m";
static const char yellow[] = "\e[1;33m" "\e[1;47m"; //static const char yellow[] = "\e[1;33m" "\e[1;47m";
static const char blue[] = "\e[1;34m" "\e[1;47m"; static const char blue[] = "\e[1;34m" "\e[1;47m";
static const char magenta[] = "\e[1;35m" "\e[1;47m"; static const char magenta[] = "\e[1;35m" "\e[1;47m";
static const char cyan[] = "\e[1;36m" "\e[1;47m"; //static const char cyan[] = "\e[1;36m" "\e[1;47m";
static const char dark_green[] = "\e[0;32m" "\e[1;47m"; static const char dark_green[] = "\e[0;32m" "\e[1;47m";

View File

@ -146,6 +146,7 @@ int main (int argc, char *argv[])
send (server_sock, (char*)(&mon_cmd), sizeof(mon_cmd), 0); send (server_sock, (char*)(&mon_cmd), sizeof(mon_cmd), 0);
#else #else
err = write (server_sock, (char*)(&mon_cmd), sizeof(mon_cmd)); err = write (server_sock, (char*)(&mon_cmd), sizeof(mon_cmd));
(void)err;
#endif #endif
@ -167,7 +168,7 @@ int main (int argc, char *argv[])
exit (1); exit (1);
} }
assert (mon_cmd.data_len >= 0 && mon_cmd.data_len < sizeof(data)); assert (mon_cmd.data_len >= 0 && mon_cmd.data_len < (int)(sizeof(data)));
if (mon_cmd.data_len > 0) { if (mon_cmd.data_len > 0) {
#if __WIN32__ #if __WIN32__
@ -356,7 +357,7 @@ static int connect_to_server (char *hostname, char *port)
#if __WIN32__ #if __WIN32__
#else #else
int e; //int e;
#endif #endif
#define MAX_HOSTS 30 #define MAX_HOSTS 30
@ -426,8 +427,11 @@ static int connect_to_server (char *hostname, char *port)
// Try each address until we find one that is successful. // Try each address until we find one that is successful.
for (n=0; n<num_hosts; n++) { for (n=0; n<num_hosts; n++) {
#if __WIN32__
SOCKET is;
#else
int is; int is;
#endif
ai = hosts[n]; ai = hosts[n];
ia_to_text (ai->ai_family, ai->ai_addr, ipaddr_str, sizeof(ipaddr_str)); ia_to_text (ai->ai_family, ai->ai_addr, ipaddr_str, sizeof(ipaddr_str));

View File

@ -39,9 +39,6 @@
#if __WIN32__ #if __WIN32__
#include <stdlib.h> #include <stdlib.h>
#else #else
#define __USE_XOPEN2KXSI 1
#define __USE_XOPEN 1
//#define __USE_POSIX 1
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <sys/errno.h> #include <sys/errno.h>
@ -614,7 +611,7 @@ static void send_sentence (char *sent)
void waypoint_term () void waypoint_term (void)
{ {
if (s_waypoint_port_fd != MYFDERROR) { if (s_waypoint_port_fd != MYFDERROR) {

16
xid.c
View File

@ -123,12 +123,12 @@ int xid_parse (unsigned char *info, int info_len, struct xid_param_s *result, ch
// The AX.25 v2.2 protocol spec says, for most of these, // The AX.25 v2.2 protocol spec says, for most of these,
// "If this field is not present, the current values are retained." // "If this field is not present, the current values are retained."
// We set the values to our usual G_UNKNOWN to mean undefined and let the caller deal with it. // We set the numeric values to our usual G_UNKNOWN to mean undefined and let the caller deal with it.
// rej and modulo are enum so we can't use G_UNKNOWN there.
result->full_duplex = G_UNKNOWN; result->full_duplex = G_UNKNOWN;
result->rej = G_UNKNOWN; result->rej = unknown_reject;
result->modulo = G_UNKNOWN; result->modulo = modulo_unknown;
result->i_field_length_rx = G_UNKNOWN; result->i_field_length_rx = G_UNKNOWN;
result->window_size_rx = G_UNKNOWN; result->window_size_rx = G_UNKNOWN;
result->ack_timer = G_UNKNOWN; result->ack_timer = G_UNKNOWN;
@ -438,7 +438,7 @@ int xid_encode (struct xid_param_s *param, unsigned char *info)
PV_HDLC_Optional_Functions_16_bit_FCS | PV_HDLC_Optional_Functions_16_bit_FCS |
PV_HDLC_Optional_Functions_Synchronous_Tx; PV_HDLC_Optional_Functions_Synchronous_Tx;
if (param->rej == implicit_reject || param->rej == selective_reject_reject || param->rej == G_UNKNOWN) if (param->rej == implicit_reject || param->rej == selective_reject_reject || param->rej == unknown_reject)
x |= PV_HDLC_Optional_Functions_REJ_cmd_resp; x |= PV_HDLC_Optional_Functions_REJ_cmd_resp;
if (param->rej == selective_reject || param->rej == selective_reject_reject) if (param->rej == selective_reject || param->rej == selective_reject_reject)
@ -446,7 +446,7 @@ int xid_encode (struct xid_param_s *param, unsigned char *info)
if (param->modulo == modulo_128) if (param->modulo == modulo_128)
x |= PV_HDLC_Optional_Functions_Modulo_128; x |= PV_HDLC_Optional_Functions_Modulo_128;
else // includes G_UNKNOWN else // includes modulo_8 and modulo_unknown
x |= PV_HDLC_Optional_Functions_Modulo_8; x |= PV_HDLC_Optional_Functions_Modulo_8;
*p++ = (x >> 16) & 0xff; *p++ = (x >> 16) & 0xff;
@ -689,8 +689,8 @@ int main (int argc, char *argv[]) {
text_color_set (DW_COLOR_ERROR); text_color_set (DW_COLOR_ERROR);
assert (param2.full_duplex == G_UNKNOWN); assert (param2.full_duplex == G_UNKNOWN);
assert (param2.rej == G_UNKNOWN); assert (param2.rej == unknown_reject);
assert (param2.modulo == G_UNKNOWN); assert (param2.modulo == modulo_unknown);
assert (param2.i_field_length_rx == G_UNKNOWN); assert (param2.i_field_length_rx == G_UNKNOWN);
assert (param2.window_size_rx == G_UNKNOWN); assert (param2.window_size_rx == G_UNKNOWN);
assert (param2.ack_timer == G_UNKNOWN); assert (param2.ack_timer == G_UNKNOWN);

2
xid.h
View File

@ -12,7 +12,7 @@ struct xid_param_s {
// Order is important because negotiation keeps the lower value. // Order is important because negotiation keeps the lower value.
// We will support only 1 & 2. // We will support only 1 & 2.
enum rej_e {implicit_reject=1, selective_reject=2, selective_reject_reject=3 } rej; enum rej_e {unknown_reject=0, implicit_reject=1, selective_reject=2, selective_reject_reject=3 } rej;
enum ax25_modulo_e modulo; enum ax25_modulo_e modulo;