Fix WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare)

This commit is contained in:
lukem 2009-04-16 05:56:32 +00:00
parent cf205e4612
commit 18f69179c9
27 changed files with 182 additions and 180 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dnload.c,v 1.6 2008/04/28 20:24:16 martin Exp $ */
/* $NetBSD: dnload.c,v 1.7 2009/04/16 05:56:32 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -85,7 +85,7 @@ download(fd, controller, filename)
exit(1);
}
rlen = fread(data, 1, sb.st_size, f);
if (rlen != sb.st_size) {
if ((off_t)rlen != sb.st_size) {
fprintf(stderr, "error reading microcode, read %lu bytes: %s\n",
(unsigned long)rlen, strerror(errno));
exit(1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: xlog.c,v 1.6 2008/04/28 20:24:16 martin Exp $ */
/* $NetBSD: xlog.c,v 1.7 2009/04/16 05:56:32 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
void xlog(int fd, int controller);
static char *ll_name[10] = {
static const char *ll_name[10] = {
"LL_UDATA",
"LL_ESTABLISH",
"LL_RELEASE",
@ -73,7 +73,7 @@ static char *ll_name[10] = {
"LL_BUDATA"
};
static char *ns_name[11] = {
static const char *ns_name[11] = {
"N_MDATA",
"N_CONNECT",
"N_CONNECT ACK",

View File

@ -27,7 +27,7 @@
* i4b daemon - controller state support routines
* ----------------------------------------------
*
* $Id: controller.c,v 1.9 2004/03/28 20:49:22 pooka Exp $
* $Id: controller.c,v 1.10 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -43,7 +43,7 @@
#include "isdnd.h"
static int
init_controller_state(int controller, const char *devname, const char *cardname, int tei, int nbch);
init_controller_state(int controller, const char *devnam, const char *cardname, int tei, int nbch);
/*
* add a single controller
@ -101,7 +101,7 @@ init_controller(void)
* init controller state table entry
*--------------------------------------------------------------------------*/
static int
init_controller_state(int controller, const char *devname, const char *cardname, int tei, int nbch)
init_controller_state(int controller, const char *devnam, const char *cardname, int tei, int nbch)
{
struct isdn_ctrl_state *ctrl;
int i;
@ -116,7 +116,7 @@ init_controller_state(int controller, const char *devname, const char *cardname,
memset(ctrl, 0, sizeof *ctrl);
strncpy(ctrl->device_name,
devname,
devnam,
sizeof(ctrl->device_name)-1);
strncpy(ctrl->controller,
cardname,
@ -133,7 +133,7 @@ init_controller_state(int controller, const char *devname, const char *cardname,
ctrl->l2stat = LAYER_IDLE;
ctrl->firmware = NULL;
DBGL(DL_RCCF, (logit(LL_DBG, "init_controller_state: controller %d (%s) is %s",
controller, devname, cardname)));
controller, devnam, cardname)));
/* add to list */
add_ctrl_state(ctrl);

View File

@ -27,7 +27,7 @@
* i4b daemon - curses fullscreen output
* -------------------------------------
*
* $Id: curses.c,v 1.9 2004/03/28 20:49:22 pooka Exp $
* $Id: curses.c,v 1.10 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -96,7 +96,7 @@ init_screen(void)
snprintf(buffer, sizeof(buffer), "----- isdn controller channel state ------------- isdnd %02d.%02d.%d [pid %d] -", VERSION, REL, STEP, (int)getpid());
while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1)
while((int)strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1)
strlcat(buffer, "-", sizeof(buffer));
move(0, 0);
@ -109,7 +109,7 @@ init_screen(void)
addstr("# tei b remote iface dir outbytes obps inbytes ibps units");
snprintf(buffer, sizeof(buffer), "----- isdn userland interface state ------------------------------------------");
while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1)
while((int)strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1)
strlcat(buffer, "-", sizeof(buffer));
move(uheight+2, 0);
@ -118,7 +118,7 @@ init_screen(void)
standend();
snprintf(buffer, sizeof(buffer), "----- isdnd logfile display --------------------------------------------------");
while(strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1)
while((int)strlen(buffer) < COLS && strlen(buffer) < sizeof(buffer) - 1)
strlcat(buffer, "-", sizeof(buffer));
move(uheight+4, 0);
@ -159,7 +159,7 @@ init_screen(void)
void
do_menu(void)
{
static char *menu[WMITEMS] =
static const char *menu[WMITEMS] =
{
"1 - (D)isplay refresh",
"2 - (H)angup (choose a channel)",
@ -337,7 +337,7 @@ menuexit(WINDOW *menu_w)
addstr("# tei b remote iface dir outbytes obps inbytes ibps units");
snprintf(buffer, sizeof(buffer), "----- isdn userland interface state ------------------------------------------");
while(strlen(buffer) < COLS)
while((int)strlen(buffer) < COLS)
strlcat(buffer, "-", sizeof(buffer));
move(uheight+2, 0);
@ -346,7 +346,7 @@ menuexit(WINDOW *menu_w)
standend();
snprintf(buffer, sizeof(buffer), "----- isdnd logfile display --------------------------------------------------");
while(strlen(buffer) < COLS)
while((int)strlen(buffer) < COLS)
strlcat(buffer, "-", sizeof(buffer));
move(uheight+4, 0);

View File

@ -27,7 +27,7 @@
* exec.h - supplemental program/script execution
* ----------------------------------------------
*
* $Id: exec.c,v 1.9 2006/05/11 07:08:40 mrg Exp $
* $Id: exec.c,v 1.10 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -105,7 +105,7 @@ sigchild_handler(int sig)
* execute prog as a subprocess and pass an argumentlist
*---------------------------------------------------------------------------*/
pid_t
exec_prog(char *prog, char **arglist)
exec_prog(const char *prog, const char **arglist)
{
char tmp[MAXPATHLEN];
char path[MAXPATHLEN+1];
@ -152,7 +152,7 @@ exec_prog(char *prog, char **arglist)
fclose(logfp);
if (execvp(path,arglist) < 0 )
if (execvp(path, __UNCONST(arglist)) < 0 )
_exit(127);
return(-1);
@ -164,14 +164,14 @@ exec_prog(char *prog, char **arglist)
int
exec_connect_prog(struct cfg_entry *cep, const char *prog, int link_down)
{
char *argv[32], **av = argv;
const char *argv[32], **av = argv;
char devicename[MAXPATHLEN], addr[100];
int s;
struct ifreq ifr;
/* the obvious things */
snprintf(devicename, sizeof(devicename), "%s%d", cep->usrdevicename, cep->usrdeviceunit);
*av++ = (char*)prog;
*av++ = prog;
*av++ = "-d";
*av++ = devicename;
*av++ = "-f";
@ -196,7 +196,7 @@ exec_connect_prog(struct cfg_entry *cep, const char *prog, int link_down)
/* terminate argv */
*av++ = NULL;
return exec_prog((char*)prog, argv);
return exec_prog(prog, argv);
}
/*---------------------------------------------------------------------------*
@ -205,7 +205,7 @@ exec_connect_prog(struct cfg_entry *cep, const char *prog, int link_down)
int
exec_answer(struct cfg_entry *cep)
{
char *argv[32];
const char *argv[32];
char devicename[MAXPATHLEN];
int pid;

View File

@ -27,7 +27,7 @@
* FSM for isdnd
* -------------
*
* $Id: fsm.c,v 1.7 2006/03/17 21:10:02 elad Exp $
* $Id: fsm.c,v 1.8 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -39,7 +39,7 @@
/* table of state descriptions */
static char *state_text[N_STATES] = {
static const char *state_text[N_STATES] = {
"idle",
"dialing",
"waitdialretry",
@ -65,7 +65,7 @@ static char *state_text[N_STATES] = {
/* table of event descriptions */
static char *event_text[N_EVENTS] = {
static const char *event_text[N_EVENTS] = {
/* incoming messages */
@ -439,10 +439,10 @@ next_state(struct cfg_entry *cep, int event)
/*---------------------------------------------------------------------------*
* return pointer to current state description
*---------------------------------------------------------------------------*/
char *
const char *
printstate(struct cfg_entry *cep)
{
return((char *) state_text[cep->state]);
return(state_text[cep->state]);
}
/* EOF */

View File

@ -27,7 +27,7 @@
* i4b daemon - main header file
* -----------------------------
*
* $Id: isdnd.h,v 1.15 2007/01/16 12:07:08 hubertf Exp $
* $Id: isdnd.h,v 1.16 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -311,7 +311,7 @@ struct cfg_entry {
#define ULSRC_RATE 3 /* get it dynamic from ratesfile*/
#define ULSRC_DYN 4 /* dynamic calculated from AOCD */
char *answerprog; /* program to use for answering */
const char *answerprog; /* program to use for answering */
char *connectprog; /* program run after negotiation finished */
char *disconnectprog; /* program run after shutdown is complete */
@ -575,7 +575,7 @@ int isdnfd; /* file handle, /dev/isdn */
char mailto[MAXPATHLEN] = ""; /* panic mail address */
char mailer[MAXPATHLEN] = ""; /* panic mail address */
char *configfile = CONFIG_FILE_DEF; /* configuration filename */
const char *configfile = CONFIG_FILE_DEF; /* configuration filename */
int config_error_flag = 0; /* error counter */
#ifdef DEBUG
@ -589,10 +589,10 @@ int do_bell = 0; /* bell on connect/disconnect */
int do_fork = 1; /* run as daemon/foreground */
int do_ttytype = 0; /* got new terminal type */
char *ttype = ""; /* termcap entry name string */
const char *ttype = ""; /* termcap entry name string */
int do_rdev = 0; /* redirect output */
char *rdev = ""; /* new device string */
const char *rdev = ""; /* new device string */
int do_print = 0; /* config file printout */
@ -751,7 +751,7 @@ void cfg_setval ( int keyword );
void check_and_kill ( struct cfg_entry *cep );
void check_pid ( void );
void close_allactive ( void );
void configure ( char *filename, int reread );
void configure ( const char *filename, int reread );
void daemonize ( void );
void dialresponse(struct cfg_entry *cep, int dstat);
void display_acct ( struct cfg_entry *cep );
@ -768,7 +768,7 @@ void do_exit ( int exitval );
void do_menu ( void );
int exec_answer ( struct cfg_entry *cep );
int exec_connect_prog ( struct cfg_entry *cep, const char *prog, int link_down );
pid_t exec_prog ( char *prog, char **arglist );
pid_t exec_prog ( const char *prog, const char **arglist );
struct cfg_entry * find_by_device_for_dialout ( int drivertype, int driverunit );
struct cfg_entry *find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd);
struct cfg_entry * find_matching_entry_incoming ( msg_connect_ind_t *mp, int len );
@ -782,7 +782,7 @@ struct cfg_entry * get_cep_by_cdid ( int cdid );
int get_current_rate ( struct cfg_entry *cep, int logit );
void handle_charge ( struct cfg_entry *cep );
void handle_recovery ( void );
void handle_scrprs(int cdid, int scr, int prs, char *caller);
void handle_scrprs(int cdid, int scr, int prs, const char *caller);
void if_up(struct cfg_entry *cep);
void if_down(struct cfg_entry *cep);
void init_controller ( void );
@ -813,7 +813,7 @@ void msg_packet_ind( msg_packet_ind_t *mp );
void msg_ctrl_ev_ind( msg_ctrl_ev_ind_t *mp );
void next_state ( struct cfg_entry *cep, int event );
char * print_i4b_cause( cause_t code );
char * printstate ( struct cfg_entry *cep );
const char * printstate ( struct cfg_entry *cep );
int readrates ( char *filename );
void reopenfiles ( int dummy );
void rereadconfig ( int dummy );

View File

@ -27,7 +27,7 @@
* i4b daemon - logging routines
* -----------------------------
*
* $Id: log.c,v 1.6 2003/10/06 09:43:27 itojun Exp $
* $Id: log.c,v 1.7 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -46,7 +46,7 @@ extern FILE *logfp;
static void check_reg(char *logstring);
struct logtab {
char *text;
const char *text;
int pri;
};
@ -240,7 +240,7 @@ check_reg(char *logstring)
{
if (rarr[i].re_flg && (!regexec(&(rarr[i].re), logstring, (size_t) 0, NULL, 0)))
{
char* argv[3];
const char* argv[3];
argv[0] = rarr[i].re_prog;
argv[1] = logstring;
argv[2] = NULL;

View File

@ -27,7 +27,7 @@
* i4b daemon - main program entry
* -------------------------------
*
* $Id: main.c,v 1.10 2008/07/15 17:51:38 perry Exp $
* $Id: main.c,v 1.11 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -510,7 +510,7 @@ mloop(
)
{
fd_set set;
struct timeval timeout;
struct timeval timeo;
int ret;
int high_selfd;
@ -557,10 +557,10 @@ mloop(
}
#endif
timeout.tv_sec = 1;
timeout.tv_usec = 0;
timeo.tv_sec = 1;
timeo.tv_usec = 0;
ret = select(high_selfd + 1, &set, NULL, NULL, &timeout);
ret = select(high_selfd + 1, &set, NULL, NULL, &timeo);
if (ret > 0)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: monitor.c,v 1.15 2008/04/28 20:24:16 martin Exp $ */
/* $NetBSD: monitor.c,v 1.16 2009/04/16 05:56:32 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -228,7 +228,7 @@ monitor_start_rights(const char *clientspec)
s ^= ~0U;
l = p - clientspec;
if (l >= sizeof hostname)
if (l >= (int)sizeof hostname)
return I4BMAR_LENGTH;
strncpy(hostname, clientspec, l);
@ -738,7 +738,7 @@ cmd_dump_rights(int fd, int r_mask, u_int8_t *cmd, const char *source)
* rescan config file
*---------------------------------------------------------------------------*/
static void
cmd_reread_cfg(int fd, int rights, u_int8_t *cmd, const char * source)
cmd_reread_cfg(int fd, int _rights, u_int8_t *cmd, const char * source)
{
rereadconfig(42);
}
@ -747,7 +747,7 @@ cmd_reread_cfg(int fd, int rights, u_int8_t *cmd, const char * source)
* drop one connection
*---------------------------------------------------------------------------*/
static void
cmd_hangup(int fd, int rights, u_int8_t *cmd, const char * source)
cmd_hangup(int fd, int _rights, u_int8_t *cmd, const char * source)
{
int channel = I4B_GET_4B(cmd, I4B_MON_HANGUP_CHANNEL);
int ctrl = I4B_GET_4B(cmd, I4B_MON_HANGUP_CTRL);
@ -759,7 +759,7 @@ cmd_hangup(int fd, int rights, u_int8_t *cmd, const char * source)
* dump all active monitor connections
*---------------------------------------------------------------------------*/
static void
cmd_dump_mcons(int fd, int rights, u_int8_t *cmd, const char * source)
cmd_dump_mcons(int fd, int _rights, u_int8_t *cmd, const char * source)
{
int num_connections;
struct monitor_connection *con;
@ -806,7 +806,7 @@ cmd_dump_mcons(int fd, int rights, u_int8_t *cmd, const char * source)
* Return non-zero if connection is closed.
*---------------------------------------------------------------------------*/
static int
monitor_command(struct monitor_connection * con, int fd, int rights)
monitor_command(struct monitor_connection * con, int fd, int mcrights)
{
char cmd[I4B_MAX_MON_CLIENT_CMD];
u_int code;
@ -860,7 +860,7 @@ monitor_command(struct monitor_connection * con, int fd, int rights)
bytes = I4B_GET_2B(cmd, I4B_MON_CMD_LEN);
if (bytes >= sizeof cmd)
if (bytes >= (int)sizeof cmd)
{
close(fd);
logit(LL_MER, "monitor: garbage on connection");
@ -891,11 +891,11 @@ monitor_command(struct monitor_connection * con, int fd, int rights)
*/
int events = I4B_GET_4B(cmd, I4B_MON_ICLIENT_EVENTS);
con->events = events & rights;
con->events = events & mcrights;
return 0;
}
if (code < 0 || code >= NUMCMD)
if (code >= NUMCMD)
{
logit(LL_MER, "illegal command from client, code = %d\n",
code);
@ -905,8 +905,8 @@ monitor_command(struct monitor_connection * con, int fd, int rights)
if (cmd_tab[code].call == NULL)
return 0;
if ((cmd_tab[code].rights & rights) == cmd_tab[code].rights)
cmd_tab[code].call(fd, rights, (u_char *)cmd, con->source);
if ((cmd_tab[code].rights & mcrights) == cmd_tab[code].rights)
cmd_tab[code].call(fd, mcrights, (u_char *)cmd, con->source);
return 0;
}
@ -1043,7 +1043,7 @@ void
monitor_evnt_connect(struct cfg_entry *cep)
{
u_int8_t evnt[I4B_MON_CONNECT_SIZE];
char devname[I4B_MAX_MON_STRING];
char devnam[I4B_MAX_MON_STRING];
int mask;
time_t now;
@ -1054,7 +1054,7 @@ monitor_evnt_connect(struct cfg_entry *cep)
time(&now);
snprintf(devname, sizeof devname, "%s%d", cep->usrdevicename, cep->usrdeviceunit);
snprintf(devnam, sizeof devnam, "%s%d", cep->usrdevicename, cep->usrdeviceunit);
I4B_PREP_EVNT(evnt, I4B_MON_CONNECT_CODE);
I4B_PUT_4B(evnt, I4B_MON_CONNECT_TSTAMP, (long)now);
@ -1062,7 +1062,7 @@ monitor_evnt_connect(struct cfg_entry *cep)
I4B_PUT_4B(evnt, I4B_MON_CONNECT_CTRL, cep->isdncontrollerused);
I4B_PUT_4B(evnt, I4B_MON_CONNECT_CHANNEL, cep->isdnchannelused);
I4B_PUT_STR(evnt, I4B_MON_CONNECT_CFGNAME, cep->name);
I4B_PUT_STR(evnt, I4B_MON_CONNECT_DEVNAME, devname);
I4B_PUT_STR(evnt, I4B_MON_CONNECT_DEVNAME, devnam);
if (cep->direction == DIR_OUT)
{

View File

@ -27,7 +27,7 @@
* i4b daemon - message from kernel handling routines
* --------------------------------------------------
*
* $Id: msghdl.c,v 1.10 2004/03/28 20:49:22 pooka Exp $
* $Id: msghdl.c,v 1.11 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -60,8 +60,8 @@ void
msg_connect_ind(msg_connect_ind_t *mp, int len)
{
struct cfg_entry *cep;
char *src_tela = "ERROR-src_tela";
char *dst_tela = "ERROR-dst_tela";
const char *src_tela = "ERROR-src_tela";
const char *dst_tela = "ERROR-dst_tela";
#define SRC (aliasing == 0 ? mp->src_telno : src_tela)
#define DST (aliasing == 0 ? mp->dst_telno : dst_tela)
@ -926,7 +926,7 @@ msg_accounting(msg_accounting_ind_t *mp)
void
msg_charging_ind(msg_charging_ind_t *mp)
{
static char *cttab[] = {
static const char *cttab[] = {
"invalid",
"AOCD",
"AOCE",
@ -1036,7 +1036,7 @@ msg_packet_ind(msg_packet_ind_t *mp)
u_char *proto_hdr;
char tmp[80];
char *cptr = tmp;
char *name = "???";
const char *name = "???";
for (cep = get_first_cfg_entry(); cep; cep = NEXT_CFE(cep)) {
if (cep->usrdevice == mp->driver &&

View File

@ -27,7 +27,7 @@
* printing cause values
* ---------------------
*
* $Id: pcause.c,v 1.4 2003/10/06 09:43:27 itojun Exp $
* $Id: pcause.c,v 1.5 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -37,7 +37,7 @@
#include "isdnd.h"
static char *cause_i4b_tab[CAUSE_I4B_MAX+1] = {
static const char *cause_i4b_tab[CAUSE_I4B_MAX+1] = {
"normal call clearing",
"user busy",
"channel not available",
@ -50,7 +50,7 @@ static char *cause_i4b_tab[CAUSE_I4B_MAX+1] = {
"ERROR, invalid I4B cause value!"
};
static char *cause_q850_tab[CAUSE_Q850_MAX] = {
static const char *cause_q850_tab[CAUSE_Q850_MAX] = {
"Normal D-channel shutdown",
"Unallocated (unassigned) number",
"No route to specified transit network (national use)",
@ -211,8 +211,7 @@ print_i4b_cause(cause_t code)
break;
case CAUSET_I4B:
if ((GET_CAUSE_VAL(code) < CAUSE_I4B_NORMAL) ||
(GET_CAUSE_VAL(code) >= CAUSE_I4B_MAX))
if ((GET_CAUSE_VAL(code) >= CAUSE_I4B_MAX))
{
SET_CAUSE_VAL(code, CAUSE_I4B_MAX);
}

View File

@ -27,7 +27,7 @@
* i4b daemon - config file processing
* -----------------------------------
*
* $Id: rc_config.c,v 1.24 2006/09/27 21:39:15 christos Exp $
* $Id: rc_config.c,v 1.25 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -74,7 +74,7 @@ struct isdn_ctrl_state * cur_ctrl = NULL;
* called from main to read and process config file
*---------------------------------------------------------------------------*/
void
configure(char *filename, int reread)
configure(const char *filename, int reread)
{
extern void reset_scanner(FILE *inputfile);
@ -1331,11 +1331,11 @@ print_config(void)
#endif
struct cfg_entry *cep = NULL;
int i, j;
time_t clock;
time_t now;
char mytime[64];
time(&clock);
strlcpy(mytime, ctime(&clock), sizeof(mytime));
time(&now);
strlcpy(mytime, ctime(&now), sizeof(mytime));
mytime[strlen(mytime)-1] = '\0';
fprintf(PFILE, "#---------------------------------------------------------------------------\n");
@ -1376,7 +1376,7 @@ print_config(void)
m_rights = monitor_next_rights(NULL);
if (m_rights != NULL)
{
char *s = "error\n";
const char *s = "error\n";
char b[512];
for ( ; m_rights != NULL; m_rights = monitor_next_rights(m_rights))
@ -1617,7 +1617,7 @@ print_config(void)
}
{
char *s;
const char *s;
switch (cep->ppp_expect_auth)
{
case AUTH_NONE:
@ -1677,7 +1677,7 @@ print_config(void)
fprintf(PFILE, "autoupdown = no\n");
{
char *s;
const char *s;
fprintf(PFILE, "idletime-outgoing = %d\t\t# outgoing call idle timeout\n", cep->idle_time_out);
switch ( cep->shorthold_algorithm )

View File

@ -30,7 +30,7 @@
* i4b daemon - runtime configuration parser
* -----------------------------------------
*
* $Id: rc_parse.y,v 1.5 2006/05/27 20:11:14 martin Exp $
* $Id: rc_parse.y,v 1.6 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -249,7 +249,7 @@ sysentry: sysfileentry
sysmonitorstart:
MONITOR '=' STRING '\n'
{
char *err = NULL;
const char *err = NULL;
switch (monitor_start_rights($3)) {
case I4BMAR_OK:
break;

View File

@ -27,7 +27,7 @@
* i4b daemon - misc support routines
* ----------------------------------
*
* $Id: support.c,v 1.14 2005/06/02 05:54:44 lukem Exp $
* $Id: support.c,v 1.15 2009/04/16 05:56:32 lukem Exp $
*
* $FreeBSD$
*
@ -371,7 +371,7 @@ find_matching_entry_incoming(msg_connect_ind_t *mp, int len)
int i;
/* older kernels do not deliver all the information */
if (((u_int8_t*)&mp->type_plan - (u_int8_t*)mp + sizeof(mp->type_plan)) <= len) {
if (((u_int8_t*)&mp->type_plan - (u_int8_t*)mp + (int)sizeof(mp->type_plan)) <= len) {
ntype = numbering_types[(mp->type_plan & 0x70)>>4];
} else {
ntype = no_type;
@ -383,8 +383,8 @@ find_matching_entry_incoming(msg_connect_ind_t *mp, int len)
{
if (aliasing)
{
char *src_tela = "ERROR-src_tela";
char *dst_tela = "ERROR-dst_tela";
const char *src_tela = "ERROR-src_tela";
const char *dst_tela = "ERROR-dst_tela";
src_tela = get_alias(mp->src_telno);
dst_tela = get_alias(mp->dst_telno);
@ -579,8 +579,8 @@ find_matching_entry_incoming(msg_connect_ind_t *mp, int len)
if (aliasing)
{
char *src_tela = "ERROR-src_tela";
char *dst_tela = "ERROR-dst_tela";
const char *src_tela = "ERROR-src_tela";
const char *dst_tela = "ERROR-dst_tela";
src_tela = get_alias(mp->src_telno);
dst_tela = get_alias(mp->dst_telno);
@ -874,7 +874,7 @@ dialresponse(struct cfg_entry *cep, int dstat)
{
msg_dialout_resp_t mdr;
static char *stattab[] = {
static const char *stattab[] = {
"normal condition",
"temporary failure",
"permanent failure",
@ -905,7 +905,7 @@ dialresponse(struct cfg_entry *cep, int dstat)
* screening/presentation indicator
*--------------------------------------------------------------------------*/
void
handle_scrprs(int cdid, int scr, int prs, char *caller)
handle_scrprs(int cdid, int scr, int prs, const char *caller)
{
/* screening indicator */
@ -915,7 +915,7 @@ handle_scrprs(int cdid, int scr, int prs, char *caller)
}
else
{
static char *scrtab[] = {
static const char *scrtab[] = {
"no screening indicator",
"sreening user provided, not screened",
"screening user provided, verified & passed",
@ -940,7 +940,7 @@ handle_scrprs(int cdid, int scr, int prs, char *caller)
}
else
{
static char *prstab[] = {
static const char *prstab[] = {
"no presentation indicator",
"presentation allowed",
"presentation restricted",
@ -1077,12 +1077,12 @@ int count_cfg_entries()
}
struct cfg_entry *
find_cfg_entry(int index)
find_cfg_entry(int idx)
{
struct cfg_entry *cep;
SIMPLEQ_FOREACH(cep, &cfg_entry_list, cfgq)
if (cep->index == index)
if (cep->index == idx)
return cep;
return NULL;
}

View File

@ -27,7 +27,7 @@
* i4b daemon - curses fullscreen output
* -------------------------------------
*
* $Id: curses.c,v 1.6 2003/10/06 09:43:27 itojun Exp $
* $Id: curses.c,v 1.7 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -103,7 +103,7 @@ init_screen(void)
snprintf(buffer, sizeof(buffer), "----- isdn controller channel state ------------- isdnmonitor %02d.%02d.%d -", VERSION, REL, STEP);
while(strlen(buffer) < COLS)
while((int)strlen(buffer) < COLS)
strlcat(buffer, "-", sizeof(buffer));
move(0, 0);
@ -120,7 +120,7 @@ init_screen(void)
else
snprintf(buffer, sizeof(buffer), "----- isdn userland interface state ------------- %s -", sockpath);
while(strlen(buffer) < COLS)
while((int)strlen(buffer) < COLS)
strlcat(buffer, "-", sizeof(buffer));
move(uheight+2, 0);
@ -129,7 +129,7 @@ init_screen(void)
standend();
snprintf(buffer, sizeof(buffer), "----- isdnd logfile display --------------------------------------------------");
while(strlen(buffer) < COLS)
while((int)strlen(buffer) < COLS)
strlcat(buffer, "-", sizeof(buffer));
move(uheight+4, 0);
@ -302,7 +302,7 @@ display_bell(void)
void
do_menu(void)
{
static char *menu[WMITEMS] =
static const char *menu[WMITEMS] =
{
"1 - (D)isplay refresh",
"2 - (H)angup (choose a channel)",

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.10 2008/07/15 17:51:38 perry Exp $ */
/* $NetBSD: main.c,v 1.11 2009/04/16 05:56:33 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -96,7 +96,8 @@ static void dump_event(u_int8_t *msg, int len, int readflag);
static ssize_t sock_read(int fd, void *buf, size_t nbytes);
static ssize_t sock_write(int fd, void *buf, size_t nbytes);
static void mprintf(char *fmt, ...);
static void mprintf(const char *fmt, ...)
__attribute__((__format__(__printf__, 1, 2)));
/*
* Global variables
@ -256,7 +257,7 @@ int main(int argc, char **argv)
* Return socket if successful, -1 on error.
---------------------------------------------------------------------------*/
static int
connect_remote(char *host, int portno)
connect_remote(char *host, int portnum)
{
struct sockaddr_in sa;
struct hostent *h;
@ -284,7 +285,7 @@ connect_remote(char *host, int portno)
sa.sin_len = sizeof(sa);
#endif
sa.sin_family = AF_INET;
sa.sin_port = htons(portno);
sa.sin_port = htons(portnum);
memcpy(&sa.sin_addr.s_addr, h->h_addr_list[0], sizeof(sa.sin_addr.s_addr));
@ -303,16 +304,16 @@ connect_remote(char *host, int portno)
* Return socket on success, -1 on failure.
*---------------------------------------------------------------------------*/
static int
connect_local(char *sockpath)
connect_local(char *clsockpath)
{
int s;
struct sockaddr_un sa;
/* check path length */
if (strlen(sockpath) >= sizeof(sa.sun_path))
if (strlen(clsockpath) >= sizeof(sa.sun_path))
{
fprintf(stderr, "pathname to long for local socket: %s\n",
sockpath);
clsockpath);
exit(1);
}
@ -329,11 +330,11 @@ connect_local(char *sockpath)
sa.sun_len = sizeof(sa);
sa.sun_family = AF_LOCAL;
strlcpy(sa.sun_path, sockpath, sizeof(sa.sun_path));
strlcpy(sa.sun_path, clsockpath, sizeof(sa.sun_path));
if (connect(s, (struct sockaddr *)&sa, sizeof(sa)))
{
fprintf(stderr, "could not connect local monitor socket [%s]: %s\n", sockpath, strerror(errno));
fprintf(stderr, "could not connect local monitor socket [%s]: %s\n", clsockpath, strerror(errno));
}
return s;
@ -429,7 +430,7 @@ mloop()
bytes = I4B_GET_2B(buf, I4B_MON_EVNT_LEN);
if (bytes >= sizeof(buf))
if (bytes >= (int)sizeof(buf))
{
fprintf(stderr, "mloop: socket recv buffer overflow %d!\n", bytes);
break;
@ -467,11 +468,11 @@ mloop()
/*
* Dump a complete event packet.
*/
static void dump_event(u_int8_t *msg, int len, int read)
static void dump_event(u_int8_t *msg, int len, int doread)
{
int i;
if (read)
if (doread)
mprintf("read from socket:");
else
mprintf("write to socket:");
@ -549,7 +550,7 @@ static void print_connect(
int controller, /* controller number */
int channel, /* channel no, used to identify this connection until disconnect */
char * cfgname, /* name of config entry/connection */
char * devname, /* device used (e.g. isp0) */
char * devnam, /* device used (e.g. isp0) */
char * remphone, /* phone no of remote side */
char * locphone) /* local phone no */
{
@ -569,11 +570,11 @@ static void print_connect(
mprintf("%s: incoming call from '%s' [to msn: '%s']",
buf, remphone, locphone);
mprintf(", controller %d, channel %d, config '%s' on device '%s'\n",
controller, channel, cfgname, devname);
controller, channel, cfgname, devnam);
#ifndef WIN32
if (fullscreen)
display_connect(CHPOS(controller, channel), outgoing, cfgname, remphone, devname);
display_connect(CHPOS(controller, channel), outgoing, cfgname, remphone, devnam);
#endif
}
@ -619,16 +620,16 @@ print_updown(time_t tstamp, int controller, int channel, int isup)
* Print l1 / l2 status
*/
static void
print_l12stat(time_t tstamp, int controller, int layer, int state)
print_l12stat(time_t tstamp, int controller, int layer, int status)
{
char buf[256];
strftime(buf, sizeof(buf), I4B_TIME_FORMAT, localtime(&tstamp));
mprintf("%s: layer %d change on controller %d: %s\n",
buf, layer, controller, state ? "up" : "down");
buf, layer, controller, status ? "up" : "down");
#ifndef WIN32
if (fullscreen)
display_l12stat(controller, layer, state);
display_l12stat(controller, layer, status);
#endif
}
@ -1158,7 +1159,7 @@ sock_write(int fd, void *buf, size_t nbytes)
}
static void
mprintf(char *fmt, ...)
mprintf(const char *fmt, ...)
{
#define PRBUFLEN 1024
char buffer[PRBUFLEN];

View File

@ -27,7 +27,7 @@
* isdntel - isdn4bsd telephone answering machine support
* ======================================================
*
* $Id: alias.c,v 1.3 2003/10/06 09:43:27 itojun Exp $
* $Id: alias.c,v 1.4 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -46,7 +46,7 @@ static struct alias *firsta = NULL;
* read in and init aliases
*---------------------------------------------------------------------------*/
void
init_alias(char *filename)
init_alias(const char *filename)
{
FILE *fp;
unsigned char buffer[MAXBUFSZ + 1];

View File

@ -27,7 +27,7 @@
* isdntel - isdn4bsd telephone answering support
* ==============================================
*
* $Id: defs.h,v 1.2 2002/09/20 15:15:50 mycroft Exp $
* $Id: defs.h,v 1.3 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -120,8 +120,8 @@ WINDOW *main_w; /* curses main window pointer */
int nofiles = 0;
int cur_pos = 0;
char *spooldir = SPOOLDIR;
char *playstring = PLAYCMD;
const char *spooldir = SPOOLDIR;
const char *playstring = PLAYCMD;
#else
@ -141,7 +141,7 @@ extern char *playstring;
#endif
extern void init_alias( char *filename );
extern void init_alias( const char *filename );
extern void init_files( int inipos );
extern void init_screen ( void );
extern void do_menu ( void );
@ -149,8 +149,10 @@ extern int fill_list( void );
extern char *get_alias( char *number );
extern int main ( int argc, char **argv );
extern void do_quit ( int exitval );
extern void fatal ( char *fmt, ... );
extern void error ( char *fmt, ... );
extern void fatal ( const char *fmt, ... )
__attribute__((__noreturn__, __format__(__printf__, 1, 2)));
extern void error ( const char *fmt, ... )
__attribute__((__format__(__printf__, 1, 2)));
extern void play ( struct onefile * );
extern void delete ( struct onefile * );
extern void reread( void );

View File

@ -27,7 +27,7 @@
* isdntel - isdn4bsd telephone answering machine support
* ======================================================
*
* $Id: display.c,v 1.3 2003/10/06 09:43:27 itojun Exp $
* $Id: display.c,v 1.4 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -37,7 +37,7 @@
#include "defs.h"
static char *helpstr = "Enter Control-D to exit program or RETURN for command window";
static const char *helpstr = "Enter Control-D to exit program or RETURN for command window";
/*---------------------------------------------------------------------------*
* init curses fullscreen display
@ -98,7 +98,7 @@ init_screen(void)
void
do_menu(void)
{
static char *menu[WMITEMS] =
static const char *menu[WMITEMS] =
{
"Play File",
#define PLAY 0

View File

@ -27,7 +27,7 @@
* isdntel - isdn4bsd telephone answering machine support
* ======================================================
*
* $Id: main.c,v 1.6 2004/10/30 08:31:39 dsl Exp $
* $Id: main.c,v 1.7 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -59,7 +59,7 @@ main(int argc, char **argv)
struct pollfd set[1];
char *ncp;
char *aliasfile = ALIASFILE;
const char *aliasfile = ALIASFILE;
int rrtimeout = REREADTIMEOUT;
extern char *optarg;
@ -179,7 +179,7 @@ main(int argc, char **argv)
* handle horizontal selection bar movement
*---------------------------------------------------------------------------*/
static void
makecurrent(int cur_pos, struct onefile *cur_file, int cold)
makecurrent(int mc_cur_pos, struct onefile *mc_cur_file, int cold)
{
static int lastpos;
static struct onefile *lastfile;
@ -187,7 +187,7 @@ makecurrent(int cur_pos, struct onefile *cur_file, int cold)
/* un-higlight current horizontal bar */
if (!cold && lastfile && cur_file)
if (!cold && lastfile && mc_cur_file)
{
snprintf(buffer, sizeof(buffer),
"%s %s %-16s %-16s %-20s %-6s%*s",
@ -201,16 +201,16 @@ makecurrent(int cur_pos, struct onefile *cur_file, int cold)
wattroff(main_w, A_REVERSE);
}
if (cur_file == NULL)
if (mc_cur_file == NULL)
{
lastpos = cur_pos_scr;
lastfile = cur_file;
lastfile = mc_cur_file;
return;
}
/* have to scroll up or down ? */
if (cur_pos >= bot_dis)
if (mc_cur_pos >= bot_dis)
{
/* scroll up */
@ -220,7 +220,7 @@ makecurrent(int cur_pos, struct onefile *cur_file, int cold)
top_dis++;
cur_pos_scr = LINES-START_O-3;
}
else if (cur_pos < top_dis)
else if (mc_cur_pos < top_dis)
{
/* scroll down */
@ -232,14 +232,14 @@ makecurrent(int cur_pos, struct onefile *cur_file, int cold)
}
else
{
cur_pos_scr = cur_pos - top_dis;
cur_pos_scr = mc_cur_pos - top_dis;
}
snprintf(buffer, sizeof(buffer), "%s %s %-16s %-16s %-20s %-6s%*s",
cur_file->date, cur_file->time,
cur_file->dstnumber, cur_file->srcnumber,
cur_file->alias == NULL ? "-/-" : cur_file->alias,
cur_file->seconds,
mc_cur_file->date, mc_cur_file->time,
mc_cur_file->dstnumber, mc_cur_file->srcnumber,
mc_cur_file->alias == NULL ? "-/-" : mc_cur_file->alias,
mc_cur_file->seconds,
COLS - LAST_POS - 2, "");
wattron(main_w, A_REVERSE);
@ -247,7 +247,7 @@ makecurrent(int cur_pos, struct onefile *cur_file, int cold)
wattroff(main_w, A_REVERSE);
lastpos = cur_pos_scr;
lastfile = cur_file;
lastfile = mc_cur_file;
wrefresh(main_w);
}
@ -286,7 +286,7 @@ usage(void)
* fatal error exit
*---------------------------------------------------------------------------*/
void
fatal(char *fmt, ...)
fatal(const char *fmt, ...)
{
va_list ap;
@ -313,7 +313,7 @@ fatal(char *fmt, ...)
* error printing
*---------------------------------------------------------------------------*/
void
error(char *fmt, ...)
error(const char *fmt, ...)
{
va_list ap;

View File

@ -27,7 +27,7 @@
* printing cause values
* ---------------------
*
* $Id: pcause_1tr6.c,v 1.3 2003/10/06 09:43:28 itojun Exp $
* $Id: pcause_1tr6.c,v 1.4 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -38,11 +38,11 @@
#include "trace.h"
#include "pcause_1tr6.h"
char *
const char *
print_cause_1tr6(unsigned char code)
{
static char error_message[120];
char *e;
const char *e;
switch (code)
{

View File

@ -27,7 +27,7 @@
* pcause1tr6.h - 1TR6 causes definitions
* --------------------------------------
*
* $Id: pcause_1tr6.h,v 1.1.1.1 2001/01/06 13:00:30 martin Exp $
* $Id: pcause_1tr6.h,v 1.2 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -35,7 +35,7 @@
*
*---------------------------------------------------------------------------*/
char *print_cause_1tr6(unsigned char code);
const char *print_cause_1tr6(unsigned char code);
/* 1TR6 protocol causes */

View File

@ -27,7 +27,7 @@
* printing cause values
* ---------------------
*
* $Id: pcause_q850.c,v 1.2 2003/10/06 09:43:28 itojun Exp $
* $Id: pcause_q850.c,v 1.3 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -38,11 +38,11 @@
#include "trace.h"
#include "pcause_q850.h"
char *
const char *
print_cause_q850(unsigned char code)
{
static char error_message[120];
char *e;
const char *e;
switch (code)
{

View File

@ -27,7 +27,7 @@
* pcauseq850.h - Q.850 causes definitions
* ---------------------------------------
*
* $Id: pcause_q850.h,v 1.1.1.1 2001/01/06 13:00:30 martin Exp $
* $Id: pcause_q850.h,v 1.2 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -35,7 +35,7 @@
*
*---------------------------------------------------------------------------*/
char *print_cause_q850(unsigned char code);
const char *print_cause_q850(unsigned char code);
/* Q.850 causes */

View File

@ -27,7 +27,7 @@
* q932_fac.c - decode Q.932 facilities
* ------------------------------------
*
* $Id: q932_fac.c,v 1.3 2006/05/24 23:51:39 christos Exp $
* $Id: q932_fac.c,v 1.4 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -59,9 +59,9 @@
#include "q932_fac.h"
static int do_component(int length, char *pbuf);
static char *uni_str(int code);
static char *opval_str(int val);
static char *bid_str(int val);
static const char *uni_str(int code);
static const char *opval_str(int val);
static const char *bid_str(int val);
static void next_state(char *pbuf, int class, int form, int code, int val);
static void object_id(int comp_length, unsigned char *pbuf);
@ -369,9 +369,9 @@ again:
/*---------------------------------------------------------------------------*
* print universal id type
*---------------------------------------------------------------------------*/
static char *uni_str(int code)
static const char *uni_str(int code)
{
static char *tbl[] = {
static const char *tbl[] = {
"BOOLEAN",
"INTEGER",
"BIT STRING",
@ -401,7 +401,7 @@ static char *uni_str(int code)
"GENERAL STRING"
};
if (code >= 1 && code <= sizeof(tbl) / sizeof(tbl[0]))
if (code >= 1 && code <= (int)(sizeof(tbl) / sizeof(tbl[0])))
return(tbl[code-1]);
else
return("ERROR, Value out of Range!");
@ -410,10 +410,10 @@ static char *uni_str(int code)
/*---------------------------------------------------------------------------*
* print operation value
*---------------------------------------------------------------------------*/
static char *opval_str(int val)
static const char *opval_str(int val)
{
static char buffer[80];
char *r;
const char *r;
switch (val)
{
@ -559,10 +559,10 @@ static char *opval_str(int val)
/*---------------------------------------------------------------------------*
* billing id string
*---------------------------------------------------------------------------*/
static char *bid_str(int val)
static const char *bid_str(int val)
{
static char buffer[80];
char *r;
const char *r;
switch (val)
{

View File

@ -35,7 +35,7 @@
* trace.c - print traces of D (B) channel activity for isdn4bsd
* -------------------------------------------------------------
*
* $Id: trace.c,v 1.9 2007/09/08 15:34:23 pooka Exp $
* $Id: trace.c,v 1.10 2009/04/16 05:56:33 lukem Exp $
*
* $FreeBSD$
*
@ -131,8 +131,8 @@ main(int argc, char *argv[])
int c;
char *b;
char *outfile = TRACE_FILE_NAME;
char *binfile = BIN_FILE_NAME;
const char *outfile = TRACE_FILE_NAME;
const char *binfile = BIN_FILE_NAME;
int outfileset = 0;
int raw = 1;
int noct = -1;
@ -405,7 +405,7 @@ main(int argc, char *argv[])
if (Bopt)
{
if ((fwrite(buf, 1, n, BP)) != n)
if ((int)(fwrite(buf, 1, n, BP)) != n)
{
snprintf(buffer, sizeof(buffer),
"Error writing file [%s]",
@ -548,7 +548,7 @@ fmt_hdr(struct i4b_trace_hdr *hdr, int frm_len)
* decode protocol and output to file(s)
*---------------------------------------------------------------------------*/
static void
dumpbuf(int n, unsigned char *buf, struct i4b_trace_hdr *hdr, int raw)
dumpbuf(int n, unsigned char *dbuf, struct i4b_trace_hdr *hdr, int raw)
{
static char l1buf[128];
static unsigned char l2buf[32000];
@ -572,7 +572,7 @@ dumpbuf(int n, unsigned char *buf, struct i4b_trace_hdr *hdr, int raw)
pbuf = &l1buf[0];
switch (buf[0])
switch (dbuf[0])
{
case INFO0:
sprintf((pbuf+strlen(pbuf)),"I430: INFO0 (No Signal)\n");
@ -603,29 +603,29 @@ dumpbuf(int n, unsigned char *buf, struct i4b_trace_hdr *hdr, int raw)
break;
default:
sprintf((pbuf+strlen(pbuf)),"I430: ERROR, invalid INFO value 0x%x!\n", buf[0]);
sprintf((pbuf+strlen(pbuf)),"I430: ERROR, invalid INFO value 0x%x!\n", dbuf[0]);
break;
}
break;
case TRC_CH_D: /* D-channel data */
cnt = decode_lapd(l2buf, n, buf, hdr->dir, raw, print_q921);
cnt = decode_lapd(l2buf, n, dbuf, hdr->dir, raw, print_q921);
n -= cnt;
buf += cnt;
dbuf += cnt;
if (n)
{
switch (*buf)
switch (*dbuf)
{
case 0x40:
case 0x41:
decode_1tr6(l3buf, n, cnt, buf, raw);
decode_1tr6(l3buf, n, cnt, dbuf, raw);
break;
case 0x08:
decode_q931(l3buf, n, cnt, buf, raw);
decode_q931(l3buf, n, cnt, dbuf, raw);
break;
default:
@ -636,7 +636,7 @@ dumpbuf(int n, unsigned char *buf, struct i4b_trace_hdr *hdr, int raw)
}
else
{
decode_unknownl3(l3buf, n, cnt, buf, raw);
decode_unknownl3(l3buf, n, cnt, dbuf, raw);
}
break;
}
@ -653,15 +653,15 @@ dumpbuf(int n, unsigned char *buf, struct i4b_trace_hdr *hdr, int raw)
for (j = 0; j < 16; j++)
if (i + j < n)
sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]);
sprintf((pbuf+strlen(pbuf)),"%02x ", dbuf[i + j]);
else
sprintf((pbuf+strlen(pbuf))," ");
sprintf((pbuf+strlen(pbuf))," ");
for (j = 0; j < 16 && i + j < n; j++)
if (isprint(buf[i + j]))
sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]);
if (isprint(dbuf[i + j]))
sprintf((pbuf+strlen(pbuf)),"%c", dbuf[i + j]);
else
sprintf((pbuf+strlen(pbuf)),".");