From 42b2772d78f3c1ecd4a4e9e5f2e49db9b420554f Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 26 Nov 2015 18:39:48 +0100 Subject: [PATCH] Fixed several compiler warnings --- appbridge.cpp | 2 -- apppbx.cpp | 3 --- crypt.cpp | 4 ++-- dss1.cpp | 4 ---- genrc.c | 2 +- mISDN.cpp | 13 +++++++------ main.c | 2 +- port.cpp | 6 +++--- route.c | 4 +--- socket_server.c | 2 -- ss5_decode.c | 11 ++++++++++- ss5_encode.c | 2 +- tones.c | 2 +- trace.c | 2 +- 14 files changed, 28 insertions(+), 31 deletions(-) diff --git a/appbridge.cpp b/appbridge.cpp index bc93a84..cc8d699 100644 --- a/appbridge.cpp +++ b/appbridge.cpp @@ -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); diff --git a/apppbx.cpp b/apppbx.cpp index 806655c..b976393 100644 --- a/apppbx.cpp +++ b/apppbx.cpp @@ -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; } } diff --git a/crypt.cpp b/crypt.cpp index 125b516..e3b562b 100644 --- a/crypt.cpp +++ b/crypt.cpp @@ -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"; diff --git a/dss1.cpp b/dss1.cpp index c4a0aa4..4f3d000 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -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(¤t_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)) diff --git a/genrc.c b/genrc.c index 1d5a076..9cf36c8 100644 --- a/genrc.c +++ b/genrc.c @@ -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"); diff --git a/mISDN.cpp b/mISDN.cpp index 1431642..179646b 100644 --- a/mISDN.cpp +++ b/mISDN.cpp @@ -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) diff --git a/main.c b/main.c index 35b972f..dddc64a 100644 --- a/main.c +++ b/main.c @@ -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; diff --git a/port.cpp b/port.cpp index 4ffa822..3dc5f68 100644 --- a/port.cpp +++ b/port.cpp @@ -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) diff --git a/route.c b/route.c index 7954b6f..ce8dcf6 100644 --- a/route.c +++ b/route.c @@ -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) diff --git a/socket_server.c b/socket_server.c index ac821b0..28dccd9 100644 --- a/socket_server.c +++ b/socket_server.c @@ -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]) diff --git a/ss5_decode.c b/ss5_decode.c index 35e2664..713f818 100644 --- a/ss5_decode.c +++ b/ss5_decode.c @@ -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 */ diff --git a/ss5_encode.c b/ss5_encode.c index 0b2ab54..c119cc8 100644 --- a/ss5_encode.c +++ b/ss5_encode.c @@ -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; } diff --git a/tones.c b/tones.c index ad69011..d562531 100644 --- a/tones.c +++ b/tones.c @@ -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 */ diff --git a/trace.c b/trace.c index fdfa045..caa1e40 100644 --- a/trace.c +++ b/trace.c @@ -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); -- 2.13.6