Fixed several compiler warnings

This commit is contained in:
Andreas Eversberg 2015-11-26 18:39:48 +01:00
parent 825ad6f887
commit 42b2772d78
14 changed files with 28 additions and 31 deletions

View File

@ -174,7 +174,6 @@ fail:
#ifdef WITH_MISDN
struct mISDNport *mISDNport;
int channel = 0;
int earlyb;
int mode = B_MODE_TRANSPARENT;
/* hunt for mISDNport and create Port */
@ -193,7 +192,6 @@ fail:
port = ss5_hunt_line(mISDNport);
else
#endif
earlyb = mISDNport->earlyb;
#ifdef ISDN_P_FXS_POTS
if (mISDNport->pots)
port = new Pfxs(PORT_TYPE_POTS_FXS_OUT, mISDNport, portname, &port_settings, mISDNport->ifport->interface, mode);

View File

@ -3391,10 +3391,8 @@ void EndpointAppPBX::pick_join(char *extensions)
class Join *join;
class JoinPBX *joinpbx;
struct join_relation *relation;
int vbox;
/* find an endpoint that is ringing internally or vbox with higher priority */
vbox = 0;
found = NULL;
eapp = apppbx_first;
while(eapp) {
@ -3405,7 +3403,6 @@ void EndpointAppPBX::pick_join(char *extensions)
if (port->p_type == PORT_TYPE_VBOX_OUT) {
if (match_list(extensions, eapp->e_ext.number)) {
found = eapp;
vbox = 1;
break;
}
}

View File

@ -1722,7 +1722,7 @@ void EndpointAppPBX::encrypt_shared(void)
struct lcr_msg *message;
const char *errstr = "";
class Port *port;
int type, key_len;
int key_len;
unsigned char *key;
char *auth_pointer, *crypt_pointer, *key_pointer;
int ret;
@ -1779,7 +1779,7 @@ void EndpointAppPBX::encrypt_shared(void)
goto reject;
}
if (!strcasecmp(crypt_pointer, "blowfish")) {
type = CC_ACTBF_REQ;
// type = CC_ACTBF_REQ;
if (key_len < 4) {
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) Key too short.\n", ea_endpoint->ep_serial);
errstr = "Key Too Short";

View File

@ -2533,7 +2533,6 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame
{
l3_msg *l3m;
int type, plan, present, screen;
class Endpoint *epoint;
time_t current_time;
/* NT-MODE in setup state we must send PROCEEDING first */
@ -2628,7 +2627,6 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame
// enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0);
/* date & time */
if (p_m_d_ntmode || p_m_d_tespecial) {
epoint = find_epoint_id(epoint_id);
time(&current_time);
enc_ie_date(l3m, current_time, p_settings.no_seconds);
}
@ -2716,7 +2714,6 @@ if (/* ||*/ p_state==PORT_STATE_OUT_SETUP) {
void Pdss1::message_release(unsigned int epoint_id, int message_id, union parameter *param)
{
l3_msg *l3m;
class Endpoint *epoint;
char *p = NULL;
/*
@ -2796,7 +2793,6 @@ wirklich erst proceeding?:
/* send cause */
enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
/* send display */
epoint = find_epoint_id(epoint_id);
if (param->disconnectinfo.display[0])
p = param->disconnectinfo.display;
if (p) if (*p && (p_m_d_ntmode || p_m_d_tespecial))

View File

@ -39,7 +39,7 @@ int main(void)
FILE *fp;
int i = 0, j, jj, n;
char input[256], file[256];
int ret;
int __attribute__((__unused__)) ret;
printf("\n\nThis program generates a script, which is used to start/stop/restart mISDN\n");
printf("driver. Please select card only once. Mode and options are given by LCR.\n");

View File

@ -63,7 +63,6 @@ static struct mi_ext_fn_s myfn;
int mISDN_initialize(void)
{
char filename[256];
int ver;
/* try to open raw socket to check kernel */
mISDNsocket = socket(PF_ISDN, SOCK_RAW, ISDN_P_BASE);
@ -76,7 +75,7 @@ int mISDN_initialize(void)
// set debug printout function
myfn.prt_debug = my_mISDNlib_debug;
ver = init_layer3(4, &myfn); // buffer of 4
init_layer3(4, &myfn); // buffer of 4
/* open debug, if enabled and not only stack debugging */
if (options.deb) {
@ -604,6 +603,7 @@ void bchannel_event(struct mISDNport *mISDNport, int i, int event)
class PmISDN *b_port = mISDNport->b_port[i];
int state = mISDNport->b_state[i];
int timer = -1; // no change
#if 0
int p_m_tx_gain = 0;
int p_m_rx_gain = 0;
char *p_m_pipeline = NULL;
@ -619,6 +619,7 @@ void bchannel_event(struct mISDNport *mISDNport, int i, int event)
p_m_crypt_key_len = b_port->p_m_crypt_key_len;
p_m_crypt_key_type = /*b_port->p_m_crypt_key_type*/1;
}
#endif
switch(event) {
case B_EVENT_USE:
@ -1533,7 +1534,7 @@ static int mISDN_upqueue(struct lcr_fd *fd, unsigned int what, void *instance, i
struct mbuffer *mb;
struct l3_msg *l3m;
char byte;
int ret;
int __attribute__((__unused__)) ret;
/* unset global semaphore */
upqueue_avail = 0;
@ -1769,7 +1770,7 @@ int do_layer3(struct mlayer3 *ml3, unsigned int cmd, unsigned int pid, struct l3
// this is no problem.
upqueue_avail = 1;
char byte = 0;
int ret;
int __attribute__((__unused__)) ret;
ret = write(upqueue_pipe[1], &byte, 1);
}
return 0;
@ -1796,6 +1797,7 @@ int mISDN_getportbyname(int sock, int cnt, char *portname)
return (port);
}
#ifdef ISDN_P_FXS_POTS
/* handle frames from pots */
static int pots_sock_callback(struct lcr_fd *fd, unsigned int what, void *instance, int i)
{
@ -1818,12 +1820,10 @@ static int pots_sock_callback(struct lcr_fd *fd, unsigned int what, void *instan
case PH_CONTROL_IND:
cont = *((unsigned int *)(buffer + MISDN_HEADER_LEN));
/* l1-control is sent to LCR */
#ifdef ISDN_P_FXS_POTS
if (mISDNport->ntmode)
stack2manager_fxs(mISDNport, cont);
else
PERROR("FXO not supported!\n");
#endif
break;
case PH_ACTIVATE_REQ:
break;
@ -1834,6 +1834,7 @@ static int pots_sock_callback(struct lcr_fd *fd, unsigned int what, void *instan
return 0;
}
#endif
/*
* global function to add a new card (port)

2
main.c
View File

@ -257,7 +257,7 @@ int main(int argc, char *argv[])
/* query available isdn ports */
if (!(strcasecmp(argv[1],"query"))) {
int rc;
int __attribute__((__unused__)) rc;
fprintf(stderr, "-> Using 'misdn_info'\n");
rc = system("misdn_info");
ret = 0;

View File

@ -666,7 +666,7 @@ int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ig
char filename[256];
time_t now;
struct tm *now_tm;
int ret;
int __attribute__((__unused__)) ret;
if (!extension) {
PERROR("Port(%d) not an extension\n", p_serial);
@ -759,7 +759,7 @@ void Port::close_record(int beep, int mute)
char *p;
struct caller_info callerinfo;
const char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~";
int ret;
int __attribute__((__unused__)) ret;
if (!p_record)
return;
@ -960,7 +960,7 @@ void Port::record(unsigned char *data, int length, int dir_fromup)
signed short *s;
int free, i, ii;
signed int sample;
int ret;
int __attribute__((__unused__)) ret;
/* no recording */
if (!p_record || !length)

View File

@ -1955,8 +1955,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
struct timeval current_time;
#ifdef WITH_MISDN
struct mISDNport *mISDNport;
int avail,
any;
int avail;
int jj;
class Port *port;
class Pfxs *ourfxs, *fxs;
@ -2250,7 +2249,6 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset)
case MATCH_BUSY:
case MATCH_IDLE:
#ifdef WITH_MISDN
any = 0;
mISDNport = mISDNport_first;
while(mISDNport) {
if (mISDNport->ifport)

View File

@ -752,7 +752,6 @@ int admin_state(struct admin_queue **responsep)
class Pdss1 *pdss1;
struct mISDNport *mISDNport;
struct select_channel *selchannel;
int anybusy;
#endif
struct interface *interface;
struct interface_port *ifport;
@ -937,7 +936,6 @@ int admin_state(struct admin_queue **responsep)
}
/* channel state */
i = 0;
anybusy = 0;
while(i < mISDNport->b_num) {
response->am[num].u.i.busy[i] = mISDNport->b_state[i];
if (mISDNport->b_port[i])

View File

@ -58,7 +58,10 @@ char ss5_decode(unsigned char *data, int len)
signed long sk, sk1, sk2, low, high;
int k, n, i;
int f1 = 0, f2 = 0;
double result[NCOEFF], power, noise, snr;
double result[NCOEFF], power, noise;
#ifdef DEBUG_LEVELS
double snr;
#endif
signed long long cos2pik_;
char digit = ' ';
@ -121,21 +124,27 @@ char ss5_decode(unsigned char *data, int len)
}
}
#ifdef DEBUG_LEVELS
snr = 0;
#endif
/* check one frequency */
if (result[f1] > TONE_MIN_DB /* must be at least -17 db */
&& result[f1]*SNR > noise) { /* */
digit = decode_one[f1];
#ifdef DEBUG_LEVELS
if (digit != ' ')
snr = result[f1] / noise;
#endif
}
/* check two frequencies */
if (result[f1] > TONE_MIN_DB && result[f2] > TONE_MIN_DB /* must be at lease -17 db */
&& result[f1]*TONE_DIFF_DB <= result[f2] /* f2 must be not less than 5 db below f1 */
&& (result[f1]+result[f2])*SNR > noise) { /* */
digit = decode_two[f1][f2];
#ifdef DEBUG_LEVELS
if (digit != ' ')
snr = (result[f1]+result[f2]) / noise;
#endif
}
/* debug powers */

View File

@ -88,7 +88,7 @@ unsigned char *ss5_encode(unsigned char *buffer, int len, char digit, int sample
}
if (!ss5_digits[i][0]) {
PERROR("Digit '%c' does not exist.\n", digit);
memset(buffer, audio_s16_to_law[0], sizeof(buffer));
memset(buffer, audio_s16_to_law[0], len);
return buffer;
}

View File

@ -48,7 +48,7 @@ int open_tone(char *file, int *codec, signed int *length, signed int *left)
int linksize;
int l;
char *p;
int ret;
int __attribute__((__unused__)) ret;
/* try to open the law file */

View File

@ -268,7 +268,7 @@ void _end_trace(const char *__file, int __line)
FILE *fp;
struct admin_list *admin;
struct admin_queue *response, **responsep; /* response pointer */
int ret;
int __attribute__((__unused__)) ret;
if (!trace.name[0])
PERROR("trace not started in file %s line %d\n", __file, __line);