Fix lot of warnings

This commit is contained in:
Karsten Keil 2008-09-02 02:02:11 +02:00
parent b3974893ba
commit 08aad9a8c5
32 changed files with 135 additions and 134 deletions

View File

@ -988,12 +988,12 @@ void EndpointAppPBX::_action_redial_reply(int in)
{
/* find next entry */
e_select++;
if (e_select >= MAX_REMEMBER)
if (e_select >= MAX_REMEMBER) {
e_select--;
else if (in)
} else if (in) {
if (e_ext.last_in[e_select][0] == '\0')
e_select--;
else
} else
if (e_ext.last_out[e_select][0] == '\0')
e_select--;
@ -2009,7 +2009,8 @@ void EndpointAppPBX::action_hangup_execute(void)
{
struct route_param *rparam;
pid_t pid;
char *command = "", isdn_port[10];
char *command = (char *)"";
char isdn_port[10];
char *argv[11]; /* check also number of args below */
int i = 0;
@ -2022,8 +2023,8 @@ void EndpointAppPBX::action_hangup_execute(void)
end_trace();
return;
}
argv[i++] = "/bin/sh";
argv[i++] = "-c";
argv[i++] = (char *)"/bin/sh";
argv[i++] = (char *)"-c";
argv[i++] = command;
argv[i++] = command;
if ((rparam = routeparam(e_action, PARAM_PARAM)))
@ -2031,7 +2032,7 @@ void EndpointAppPBX::action_hangup_execute(void)
argv[i++] = rparam->string_value;
}
argv[i++] = e_extdialing;
argv[i++] = numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype, options.national, options.international);
argv[i++] = (char *)numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype, options.national, options.international);
argv[i++] = e_callerinfo.extension;
argv[i++] = e_callerinfo.name;
SPRINT(isdn_port, "%d", e_callerinfo.isdn_port);
@ -2060,7 +2061,7 @@ void EndpointAppPBX::action_hangup_execute(void)
void EndpointAppPBX::action_hangup_file(void)
{
struct route_param *rparam;
char *file, *content, *mode;
const char *file, *content, *mode;
FILE *fp;
/* get file / content */

View File

@ -139,7 +139,7 @@ void EndpointAppPBX::efi_message_eof(void)
* set the given vbox-tone with full path (without appending)
* the tone is played and after eof, a message is received
*/
void EndpointAppPBX::set_tone_efi(char *tone)
void EndpointAppPBX::set_tone_efi(const char *tone)
{
struct lcr_msg *message;

View File

@ -44,14 +44,14 @@ VBOX_STATE_CALLINFO_END, /* this value defines the end of callingo */
VBOX_STATE_DELETE_DONE, /* tell that message is delete */
};
char *months_english[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
char *months_german[] = {"Jan","Feb","Maer","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"};
const char *months_english[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
const char *months_german[] = {"Jan","Feb","Maer","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"};
struct vbox_menu {
char digit;
char *english;
char *german;
} vbox_menu[] = {
const char digit;
const char *english;
const char *german;
} vbox_menu[] = {
{'1', "<< previous", "<< zurueck"},
{'2', "-> play", "-> anhoeren"},
{'3', ">> next", ">> vor"},
@ -63,7 +63,7 @@ struct vbox_menu {
{'9', "X delete", "X loeschen"},
{'0', "* call", "* anrufen"},
{'\0', NULL, NULL}
};
};
/*
* initialize the vbox. this is called at process_dialing(), when the VBOX_PLAY
@ -890,7 +890,7 @@ void EndpointAppPBX::vbox_message_eof(void)
* set the given vbox-tone with full path (without appending)
* the tone is played and after eof, a message is received
*/
void EndpointAppPBX::set_tone_vbox(char *tone)
void EndpointAppPBX::set_tone_vbox(const char *tone)
{
struct lcr_msg *message;
@ -902,7 +902,7 @@ void EndpointAppPBX::set_tone_vbox(char *tone)
PERROR("EPOINT(%d) no portlist\n", ea_endpoint->ep_serial);
}
message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_VBOX_TONE);
SCPY(message->param.tone.dir, (char *)((e_ext.vbox_language)?"vbox_german":"vbox_english"));
SCPY(message->param.tone.dir, ((e_ext.vbox_language) ? "vbox_german" : "vbox_english"));
SCPY(message->param.tone.name, tone);
message_put(message);
@ -917,7 +917,7 @@ void EndpointAppPBX::set_tone_vbox(char *tone)
* the current counter value is also received by a message
* set the offset in seconds of the current recording
*/
void EndpointAppPBX::set_play_vbox(char *file, int offset)
void EndpointAppPBX::set_play_vbox(const char *file, int offset)
{
char filename[256];
struct lcr_msg *message;

View File

@ -128,7 +128,7 @@ EndpointAppPBX::~EndpointAppPBX(void)
/*
* trace header for application
*/
void EndpointAppPBX::trace_header(char *name, int direction)
void EndpointAppPBX::trace_header(const char *name, int direction)
{
struct trace _trace;
@ -327,12 +327,12 @@ void apply_callerid_restriction(struct extension *ext, char *id, int *ntype, int
}
/* used display message to display callerid as available */
char *EndpointAppPBX::apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name)
char *EndpointAppPBX::apply_callerid_display(const char *id, int itype, int ntype, int present, int screen, const char *extension, const char *name)
{
static char display[81];
display[0] = '\0';
char *cid = numberrize_callerinfo(id, ntype, options.national, options.international);
const char *cid = numberrize_callerinfo(id, ntype, options.national, options.international);
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) id='%s' itype=%d ntype=%d present=%d screen=%d extension='%s' name='%s'\n", ea_endpoint->ep_serial, (id)?id:"NULL", itype, ntype, present, screen, (extension)?extension:"NULL", (name)?name:"NULL");
@ -528,7 +528,7 @@ void EndpointAppPBX::keypad_function(char digit)
/* set tone pattern for port */
void EndpointAppPBX::set_tone(struct port_list *portlist, char *tone)
void EndpointAppPBX::set_tone(struct port_list *portlist, const char *tone)
{
struct lcr_msg *message;
@ -832,7 +832,7 @@ void EndpointAppPBX::out_setup(void)
struct lcr_msg *message;
int anycall = 0;
int cause = CAUSE_RESSOURCEUNAVAIL;
char *p;
const char *p;
char cfp[64];
struct mISDNport *mISDNport;
char portname[32];
@ -2422,7 +2422,7 @@ void EndpointAppPBX::port_notify(struct port_list *portlist, int message_type, u
logmessage(message_type, param, portlist->port_id, DIRECTION_IN);
struct lcr_msg *message;
char *logtext = "";
const char *logtext = "";
char buffer[64];
/* signal to call tool */
@ -3965,7 +3965,7 @@ void EndpointAppPBX::join_join(void)
/* check if we have an external call
* this is used to check for encryption ability
*/
int EndpointAppPBX::check_external(char **errstr, class Port **port)
int EndpointAppPBX::check_external(const char **errstr, class Port **port)
{
struct join_relation *relation;
class Join *join;
@ -4069,7 +4069,7 @@ int EndpointAppPBX::check_external(char **errstr, class Port **port)
void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsigned int port_id, int dir)
{
char *logtext = "unknown";
const char *logtext = "unknown";
char buffer[64];
switch(message_type)
@ -4408,7 +4408,7 @@ void EndpointAppPBX::logmessage(int message_type, union parameter *param, unsign
}
}
void EndpointAppPBX::message_disconnect_port(struct port_list *portlist, int cause, int location, char *display)
void EndpointAppPBX::message_disconnect_port(struct port_list *portlist, int cause, int location, const char *display)
{
struct lcr_msg *message;

View File

@ -33,7 +33,7 @@ enum { /* states as viewed from io port (state of calls are always connected) */
};
#define EPOINT_STATE_NAMES \
static char *state_name[] = { \
static const char *state_name[] = { \
"EPOINT_STATE_IDLE", \
"EPOINT_STATE_IN_SETUP", \
"EPOINT_STATE_OUT_SETUP", \
@ -224,10 +224,10 @@ class EndpointAppPBX : public EndpointApp
void release(int release, int joinlocation, int joincause, int portlocation, int portcause);
void notify_active(void);
void keypad_function(char digit);
void set_tone(struct port_list *portlist, char *tone);
void set_tone(struct port_list *portlist, const char *tone);
void out_setup(void);
struct mISDNport *hunt_port(char *ifname, int *channel);
char *apply_callerid_display(char *id, int itype, int ntype, int present, int screen, char *extension, char *name);
char *apply_callerid_display(const char *id, int itype, int ntype, int present, int screen, const char *extension, const char *name);
void auth(int job, int bit_num);
/* vbox playback stuff */
@ -237,12 +237,12 @@ class EndpointAppPBX : public EndpointApp
void vbox_handler(void);
void efi_message_eof(void);
void vbox_message_eof(void);
void set_tone_vbox(char *tone);
void set_play_vbox(char *file, int offset);
void set_tone_vbox(const char *tone);
void set_play_vbox(const char *file, int offset);
void set_play_speed(int speed);
/* efi */
void set_tone_efi(char *tone);
void set_tone_efi(const char *tone);
/* routing */
struct route_ruleset *rulesetbyname(char *name);
@ -304,7 +304,7 @@ class EndpointAppPBX : public EndpointApp
void encrypt_keyex(void);
void encrypt_off(void);
void encrypt_result(int message, char *text);
int check_external(char **errstr, class Port **port);
int check_external(const char **errstr, class Port **port);
/* crypt */
void cryptman_keyengine(int job);
@ -340,14 +340,13 @@ class EndpointAppPBX : public EndpointApp
int cryptman_sizeofinf(unsigned char *buf, int element);
unsigned char *cryptman_getinf(unsigned char *buf, int element, unsigned char *to);
void cryptman_msg2peer(unsigned char *buf);
void cryptman_msg2user(int msg, char *text);
void cryptman_msg2user(int msg, const char *text);
void cryptman_msg2crengine(int msg, unsigned char *buf, int len);
void cryptman_state(int state);
void cryptman_timeout(int secs);
void message_disconnect_port(struct port_list *portlist, int cause, int location, char *display);
void message_disconnect_port(struct port_list *portlist, int cause, int location, const char *display);
void logmessage(int message_type, union parameter *param, unsigned int port_id, int dir);
void trace_header(char *name, int direction);
void trace_header(const char *name, int direction);
};

View File

@ -18,7 +18,7 @@
/* create caller id from digits by comparing with national and international
* prefixes.
*/
char *nationalize_callerinfo(char *string, int *ntype, char *national, char *international)
const char *nationalize_callerinfo(const char *string, int *ntype, const char *national, const char *international)
{
if (!strncmp(international, string, strlen(international)))
{
@ -37,7 +37,7 @@ char *nationalize_callerinfo(char *string, int *ntype, char *national, char *int
/* create number (including access codes) from caller id
* prefixes.
*/
char *numberrize_callerinfo(char *string, int ntype, char *national, char *international)
const char *numberrize_callerinfo(const char *string, int ntype, const char *national, const char *international)
{
static char result[256];

View File

@ -9,6 +9,6 @@
** **
\*****************************************************************************/
char *nationalize_callerinfo(char *string, int *type, char *national, char *international);
char *numberrize_callerinfo(char *string, int type, char *national, char *international);
const char *nationalize_callerinfo(const char *string, int *type, const char *national, const char *international);
const char *numberrize_callerinfo(const char *string, int type, const char *national, const char *international);

View File

@ -300,7 +300,7 @@ unsigned int crc32(unsigned char *data, int len)
CM_ST_NAMES
/* give name of state */
static char *statename(int state)
static const char *statename(int state)
{
if (state>=0 && state<cm_st_num)
return(cm_st_name[state]);
@ -1141,7 +1141,7 @@ CM_MSG_NAMES
void EndpointAppPBX::cryptman_message(int message, unsigned char *param, int len)
{
char *msgtext = "<<UNKNOWN MESSAGE>>";
const char *msgtext = "<<UNKNOWN MESSAGE>>";
if (message>=0 && message<cm_msg_num)
msgtext = cm_msg_name[message];
@ -1506,7 +1506,7 @@ void EndpointAppPBX::cryptman_msg2crengine(int msg, unsigned char *buf, int len)
if (options.deb & DEBUG_CRYPT)
{
char *msgtext = "<<UNKNOWN MESSAGE>>";
const char *msgtext = "<<UNKNOWN MESSAGE>>";
if (msg>=0 && msg<cm_msg_num)
msgtext = cm_msg_name[msg];
@ -1516,7 +1516,7 @@ void EndpointAppPBX::cryptman_msg2crengine(int msg, unsigned char *buf, int len)
/* send message to user
*/
void EndpointAppPBX::cryptman_msg2user(int msg, char *text)
void EndpointAppPBX::cryptman_msg2user(int msg, const char *text)
{
struct lcr_msg *message;
/* send message */
@ -1534,7 +1534,7 @@ void EndpointAppPBX::cryptman_msg2user(int msg, char *text)
if (options.deb & DEBUG_CRYPT)
{
char *msgtext = "<<UNKNOWN MESSAGE>>";
const char *msgtext = "<<UNKNOWN MESSAGE>>";
if (msg>=0 && msg<cm_msg_num)
msgtext = cm_msg_name[msg];
@ -1788,7 +1788,7 @@ void PmISDN::cryptman_listen_bch(unsigned char *p, int l)
void EndpointAppPBX::encrypt_shared(void)
{
struct lcr_msg *message;
char *errstr = "";
const char *errstr = "";
class Port *port;
int type, key_len;
unsigned char *key;
@ -1894,7 +1894,7 @@ void EndpointAppPBX::encrypt_shared(void)
void EndpointAppPBX::encrypt_keyex(void)
{
struct lcr_msg *message;
char *errstr = "";
const char *errstr = "";
class Port *port;
/* redisplay current crypt display */

View File

@ -40,7 +40,7 @@ enum { /* crypt manager states */
};
#define CM_ST_NAMES \
static char *cm_st_name[] = { \
static const char *cm_st_name[] = { \
"NULL", \
"IDENT", \
"KEYGEN", \
@ -103,7 +103,7 @@ enum { /* messages */
};
#define CM_MSG_NAMES \
static char *cm_msg_name[] = { \
static const char *cm_msg_name[] = { \
"CP_IDENT", \
"CP_SLAVE", \
"CP_MASTER", \

View File

@ -13,7 +13,7 @@
/* extension */
char *ext_rights[] = {
const char *ext_rights[] = {
"none",
"internal",
"local",
@ -22,7 +22,7 @@ char *ext_rights[] = {
NULL
};
char *ext_yesno[] = {
const char *ext_yesno[] = {
"no",
"yes",
NULL
@ -151,7 +151,7 @@ int read_extension(struct extension *ext, char *num)
SCPY(ext->name, param);
if (param2[0])
{
SCAT(ext->name, " ");
SCAT(ext->name, (char *)" ");
SCAT(ext->name, param2);
}
@ -1329,13 +1329,13 @@ int write_extension(struct extension *ext, char *number)
*/
int write_log(char *number, char *callerid, char *calledid, time_t start, time_t stop, int aoce, int cause, int location)
{
char *mon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
const char *mon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
FILE *fp=NULL;
char filename[256];
struct tm *tm;
if (callerid[0] == '\0')
callerid = "<unknown>";
callerid = (char *)"<unknown>";
SPRINT(filename, "%s/%s/%s/log", INSTALL_DATA, options.extensions_dir, number);

View File

@ -20,8 +20,8 @@ int coredebug=0, carddebug=0, dspdebug=0;
int lawopt=0;
struct cards {
char *name;
char *module;
const char *name;
const char *module;
} cards[] = {
// { "AVM Fritz PCI (PNP)", "avmfritz"},
{ "HFC PCI (Cologne Chip)", "hfcpci"},

View File

@ -119,7 +119,7 @@ void write_law(FILE *fp, char *name, char law)
fprintf(fp, "WAVE");
/* fmt */
fprintf(fp, "fmt %c%c%c%c", sizeof(fmt), 0, 0, 0);
fprintf(fp, "fmt %c%c%c%c", (unsigned int)sizeof(fmt), 0, 0, 0);
fmt.stereo = 1;
fmt.channels = 1;
fmt.sample_rate = 8000;

2
ie.cpp
View File

@ -774,7 +774,7 @@ void Pdss1::dec_ie_channel_id(struct l3_msg *l3m, int *exclusive, int *channel)
return;
}
*channel = p[3] & 0x7f;
if (*channel<1 | *channel==16)
if ((*channel<1) || (*channel==16))
{
add_trace("channel_id", "error", "PRI interface channel out of range (%d)", *channel);
return;

View File

@ -97,11 +97,11 @@ struct interface {
};
struct interface_param {
char *name;
const char *name;
/* return value (pointer of function)(args ...) */
int (*func)(struct interface *, char *, int, char *, char*);
char *usage;
char *help;
const char *usage;
const char *help;
};

View File

@ -112,7 +112,7 @@ static int notify_state_change(int join_id, int epoint_id, int old_state, int ne
/* debug function for join */
void joinpbx_debug(class JoinPBX *joinpbx, char *function)
void joinpbx_debug(class JoinPBX *joinpbx, const char *function)
{
struct join_relation *relation;
struct port_list *portlist;

View File

@ -74,7 +74,7 @@ class JoinPBX : public Join
void play_jingle(int in);
};
void joinpbx_debug(class JoinPBX *joinpbx, char *function);
void joinpbx_debug(class JoinPBX *joinpbx, const char *function);
int joinpbx_countrelations(unsigned int join_id);
int track_notify(int oldstate, int notify);

View File

@ -54,14 +54,14 @@ enum {
MODE_TRACE,
};
char *text_interfaces[] = {
const char *text_interfaces[] = {
"off",
"brief",
"active channels",
"all channels",
};
char *text_calls[] = {
const char *text_calls[] = {
"off",
"brief",
"structured",
@ -450,7 +450,8 @@ int debug_join(struct admin_message *msg, struct admin_message *m, int line, int
return(line);
}
char *admin_state(int sock, char *argv[])
const char *admin_state(int sock, char *argv[])
{
struct admin_message msg,
*m;
@ -1257,7 +1258,7 @@ char *admin_state(int sock, char *argv[])
/*
* Send command and show error message.
*/
char *admin_cmd(int sock, int mode, char *extension, char *number)
const char *admin_cmd(int sock, int mode, char *extension, char *number)
{
static struct admin_message msg;
@ -1345,7 +1346,7 @@ char *admin_cmd(int sock, int mode, char *extension, char *number)
gettimeofday(&now_tv, &now_tz); \
now_d = ((double)(now_tv.tv_usec))/1000000 + now_tv.tv_sec; \
}
char *admin_testcall(int sock, int argc, char *argv[])
const char *admin_testcall(int sock, int argc, char *argv[])
{
static struct admin_message msg;
int ar = 2;
@ -1555,7 +1556,7 @@ next:
/*
* makes a trace
*/
char *admin_trace(int sock, int argc, char *argv[])
const char *admin_trace(int sock, int argc, char *argv[])
{
static struct admin_message msg;
int i;
@ -1633,7 +1634,7 @@ int main(int argc, char *argv[])
int mode;
int sock, conn;
struct sockaddr_un sock_address;
char *ret;
const char *ret;
/* show options */

View File

@ -196,7 +196,7 @@ PmISDN::~PmISDN()
/*
* trace
*/
void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *msgtext, int direction)
void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, const char *msgtext, int direction)
{
/* init trace with given values */
start_trace(mISDNport?mISDNport->portnum:0,
@ -214,7 +214,7 @@ void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *ms
* layer trace header
*/
static struct isdn_message {
char *name;
const char *name;
unsigned int value;
} isdn_message[] = {
{"PH_ACTIVATE", L1_ACTIVATE_REQ},
@ -254,7 +254,7 @@ static struct isdn_message {
{"MT_RELEASE_L3ID", L3_RELEASE_L3ID_REQ},
{NULL, 0},
};
static char *isdn_prim[4] = {
static const char *isdn_prim[4] = {
" REQUEST",
" CONFIRM",
" INDICATION",
@ -263,8 +263,9 @@ static char *isdn_prim[4] = {
void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int msg, int direction)
{
int i;
char msgtext[64] = "<<UNKNOWN MESSAGE>>";
char msgtext[64];
SCPY(msgtext, "<<UNKNOWN MESSAGE>>");
/* select message and primitive text */
i = 0;
while(isdn_message[i].name)
@ -314,7 +315,7 @@ void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsign
/*
* send control information to the channel (dsp-module)
*/
void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, unsigned int c2, char *trace_name, int trace_value)
void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, unsigned int c2, const char *trace_name, int trace_value)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+sizeof(int)];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
@ -339,7 +340,7 @@ void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, u
end_trace();
}
void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value)
void ph_control_block(struct mISDNport *mISDNport, class PmISDN *isdnport, int sock, unsigned int c1, void *c2, int c2_len, const char *trace_name, int trace_value)
{
unsigned char buffer[MISDN_HEADER_LEN+sizeof(int)+c2_len];
struct mISDNhead *ctrl = (struct mISDNhead *)buffer;
@ -438,7 +439,7 @@ static void _bchannel_activate(struct mISDNport *mISDNport, int i, int activate)
PERROR("Failed to send to socket %d\n", mISDNport->b_socket[i]);
/* trace */
chan_trace_header(mISDNport, mISDNport->b_port[i], activate?(char*)"BCHANNEL activate":(char*)"BCHANNEL deactivate", DIRECTION_OUT);
chan_trace_header(mISDNport, mISDNport->b_port[i], activate ? "BCHANNEL activate" : "BCHANNEL deactivate", DIRECTION_OUT);
add_trace("channel", NULL, "%d", i+1+(i>=15));
if (mISDNport->b_timer[i])
add_trace("event", NULL, "timeout recovery");
@ -1531,7 +1532,7 @@ void PmISDN::set_echotest(int echo)
/*
* set tone
*/
void PmISDN::set_tone(char *dir, char *tone)
void PmISDN::set_tone(const char *dir, const char *tone)
{
int id;

View File

@ -86,9 +86,9 @@ void mISDN_port_reorder(void);
int mISDN_handler(void);
void enc_ie_cause_standalone(struct l3_msg *l3m, int location, int cause);
int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned int handle, unsigned int c1, unsigned int c2, char *trace_name, int trace_value);
void ph_control_block(struct mISDNport *mISDNport, unsigned int handle, unsigned int c1, void *c2, int c2_len, char *trace_name, int trace_value);
void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, char *msgtext, int direction);
void ph_control(struct mISDNport *mISDNport, class PmISDN *isdnport, unsigned int handle, unsigned int c1, unsigned int c2, const char *trace_name, int trace_value);
void ph_control_block(struct mISDNport *mISDNport, unsigned int handle, unsigned int c1, void *c2, int c2_len, const char *trace_name, int trace_value);
void chan_trace_header(struct mISDNport *mISDNport, class PmISDN *port, const char *msgtext, int direction);
void l1l2l3_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int prim, int direction);
void bchannel_event(struct mISDNport *mISDNport, int i, int event);
void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsigned int handle);
@ -140,7 +140,7 @@ class PmISDN : public Port
unsigned int p_m_crypt_listen_crc;
void cryptman_listen_bch(unsigned char *p, int l);
void set_tone(char *dir, char *name);
void set_tone(const char *dir, const char *name);
void set_echotest(int echotest);
int p_m_portnum; /* used port number (1...n) */

10
macro.h
View File

@ -14,7 +14,7 @@
/* safe strcpy/strncpy */
#define SCPY(dst, src) scpy(dst, src, sizeof(dst))
static inline void scpy(char *dst, char *src, unsigned int siz)
static inline void scpy(char *dst, const char *src, unsigned int siz)
{
strncpy(dst, src, siz);
dst[siz-1] = '\0';
@ -23,7 +23,7 @@ static inline void scpy(char *dst, char *src, unsigned int siz)
/* safe strcat/strncat */
#define SCAT(dst, src) scat(dst, src, sizeof(dst))
static inline void scat(char *dst, char *src, unsigned int siz)
static inline void scat(char *dst, const char *src, unsigned int siz)
{
strncat(dst, src, siz);
dst[siz-1] = '\0';
@ -44,7 +44,7 @@ static inline void sccat(char *dst, char chr, unsigned int siz)
/* safe sprintf/snprintf */
#define SPRINT(dst, fmt, arg...) sprint(dst, sizeof(dst), fmt, ## arg)
static inline void sprint(char *dst, unsigned int siz, char *fmt, ...)
static inline void sprint(char *dst, unsigned int siz, const char *fmt, ...)
{
va_list args;
@ -65,7 +65,7 @@ static inline void sprint(char *dst, unsigned int siz, char *fmt, ...)
/* fatal error with error message and exit */
#define FATAL(fmt, arg...) fatal(__FUNCTION__, __LINE__, fmt, ##arg)
static inline void fatal(const char *function, int line, char *fmt, ...)
static inline void fatal(const char *function, int line, const char *fmt, ...)
{
va_list args;
char buffer[256];
@ -78,7 +78,7 @@ static inline void fatal(const char *function, int line, char *fmt, ...)
fprintf(stderr, "This error is not recoverable, must exit here.\n");
#ifdef DEBUG_FUNC
debug(function, line, "FATAL ERROR", buffer);
debug(function, line, "FATAL ERROR", "This error is not recoverable, must exit here.\n");
debug(function, line, "FATAL ERROR", (char *)"This error is not recoverable, must exit here.\n");
#endif
exit(EXIT_FAILURE);
}

5
mail.c
View File

@ -11,7 +11,7 @@
#include "main.h"
static char *months[] = {
static const char *months[] = {
"January", "February", "March", "April", "Mai", "June", "July",
"August", "September", "October", "November", "December"
};
@ -102,8 +102,7 @@ static void *mail_child(void *arg)
fprintf(ph, "\n * date: %s %d %d %d:%02d\n\n", months[mon], mday, year+1900, hour, min);
/* attach audio file */
if (filename[0])
if ((fh = open(filename, O_RDONLY)))
if ((filename[0]) && ((fh = open(filename, O_RDONLY))))
{
while(strchr(filename, '/'))
filename = strchr(filename, '/')+1;

12
main.c
View File

@ -49,18 +49,18 @@ int classuse = 0;
int fduse = 0;
int fhuse = 0;
char *debug_prefix = 0;
const char *debug_prefix = NULL;
int debug_count = 0;
int last_debug = 0;
int debug_newline = 1;
int nooutput = 0;
void debug_usleep(int msec, char *file, int line, int hour, int min, int sec)
void debug_usleep(int msec, const char *file, int line, int hour, int min, int sec)
{
usleep(msec);
}
void debug(const char *function, int line, char *prefix, char *buffer)
void debug(const char *function, int line, const char *prefix, char *buffer)
{
/* if we have a new debug count, we add a mark */
if (last_debug != debug_count)
@ -184,7 +184,7 @@ int main(int argc, char *argv[])
int all_idle;
char prefix_string[64];
struct sched_param schedp;
char *debug_prefix = "alloc";
const char *debug_prefix = "alloc";
int created_mutexd = 0,/* created_mutext = 0,*/ created_mutexe = 0,
created_lock = 0, created_signal = 0, created_debug = 0,
created_misdn = 0;
@ -637,7 +637,7 @@ BUDETECT
printf("%s\n", tracetext);
start_trace(0, NULL, NULL, NULL, 0, 0, 0, tracetext);
if (quit)
add_trace("signal", NULL, "%d", quit);
add_trace((char *)"signal", NULL, "%d", quit);
end_trace();
ret=0;
@ -773,7 +773,7 @@ free:
/* special debug function to detect buffer overflow
*/
int budetect_stop = 0;
void budetect(const char *file, int line, char *function)
void budetect(const char *file, int line, const char *function)
{
if (budetect_stop)
return;

4
main.h
View File

@ -58,7 +58,7 @@ extern FILE *debug_fp;
void _printdebug(const char *function, int line, unsigned int mask, const char *fmt, ...);
void _printerror(const char *function, int line, const char *fmt, ...);
#define DEBUG_FUNC
void debug(const char *function, int line, char *prefix, char *buffer);
void debug(const char *function, int line, const char *prefix, char *buffer);
#define DEBUG_CONFIG 0x0001
#define DEBUG_MSG 0x0002
@ -121,7 +121,7 @@ void debug(const char *function, int line, char *prefix, char *buffer);
#ifdef BUDETECT_DEF
#define BUDETECT budetect(__FILE__, __LINE__, __FUNCTION__);
void budetect(const char *file, int line, char *function);
void budetect(const char *file, int line, const char *function);
#else
#define BUDETECT ;
#endif

View File

@ -146,7 +146,7 @@ struct epoint_list *Port::epointlist_new(unsigned int epoint_id)
/*
* port constructor
*/
Port::Port(int type, char *portname, struct port_settings *settings)
Port::Port(int type, const char *portname, struct port_settings *settings)
{
class Port *temp, **tempp;
@ -295,7 +295,7 @@ void Port::set_echotest(int echotest)
/*
* set the file in the tone directory with the given name
*/
void Port::set_tone(char *dir, char *name)
void Port::set_tone(const char *dir, const char *name)
{
int fh;
char filename[128];
@ -395,7 +395,7 @@ void Port::set_tone(char *dir, char *name)
* set the file in the tone directory for vbox playback
* also set the play_eof-flag
*/
void Port::set_vbox_tone(char *dir, char *name)
void Port::set_vbox_tone(const char *dir, const char *name)
{
char filename[256];
@ -448,7 +448,7 @@ void Port::set_vbox_tone(char *dir, char *name)
* also set the eof-flag
* also set the counter-flag
*/
void Port::set_vbox_play(char *name, int offset)
void Port::set_vbox_play(const char *name, int offset)
{
signed int size;
struct lcr_msg *message;
@ -702,7 +702,7 @@ struct fmt {
* written before close, because we do not know the size yet)
* type=1 record annoucement, type=0 record audio stream, type=2 record vbox
*/
int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ignore, char *vbox_email, int vbox_email_file)
int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ignore, const char *vbox_email, int vbox_email_file)
{
/* RIFFxxxxWAVEfmt xxxx(fmt-size)dataxxxx... */
char dummyheader[8+4+8+sizeof(fmt)+8];
@ -802,7 +802,7 @@ void Port::close_record(int beep, int mute)
char number[256], callerid[256];
char *p;
struct caller_info callerinfo;
char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~";
const char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~";
if (!p_record)
return;
@ -904,7 +904,7 @@ void Port::close_record(int beep, int mute)
fprintf(p_record, "WAVE");
/* fmt */
fprintf(p_record, "fmt %c%c%c%c", sizeof(fmt), 0, 0, 0);
fprintf(p_record, "fmt %c%c%c%c", (unsigned int)sizeof(fmt), 0, 0, 0);
switch(p_record_type)
{
case CODEC_MONO:

12
port.h
View File

@ -46,7 +46,7 @@ enum { /* states of call */
};
#define PORT_STATE_NAMES \
static char *state_name[] = { \
static const char *state_name[] = { \
"PORT_STATE_IDLE", \
"PORT_STATE_IN_SETUP", \
"PORT_STATE_OUT_SETUP", \
@ -124,14 +124,14 @@ class Port
{
public:
/* methods */
Port(int type, char *portname, struct port_settings *settings);
Port(int type, const char *portname, struct port_settings *settings);
virtual ~Port();
class Port *next; /* next port in list */
int p_type; /* type of port */
virtual int handler(void);
virtual int message_epoint(unsigned int epoint_id, int message, union parameter *param);
virtual void set_echotest(int echotest);
virtual void set_tone(char *dir, char *name);
virtual void set_tone(const char *dir, const char *name);
virtual int read_audio(unsigned char *buffer, int length);
struct port_settings p_settings;
@ -150,8 +150,8 @@ class Port
// void *p_knock_fetched; /* pointer to fetched data */
// int p_knock_codec;
// signed int p_knock_size, p_knock_left;
void set_vbox_tone(char *dir, char *name);/* tone of answering machine */
void set_vbox_play(char *name, int offset); /* sample of answ. */
void set_vbox_tone(const char *dir, const char *name);/* tone of answering machine */
void set_vbox_play(const char *name, int offset); /* sample of answ. */
void set_vbox_speed(int speed); /* speed of answ. */
/* identification */
@ -172,7 +172,7 @@ class Port
int p_echotest; /* set to echo audio data FROM port back to port's mixer */
/* recording */
int open_record(int type, int mode, int skip, char *terminal, int anon_ignore, char *vbox_email, int vbox_email_file);
int open_record(int type, int mode, int skip, char *terminal, int anon_ignore, const char *vbox_email, int vbox_email_file);
void close_record(int beep, int mute);
void record(unsigned char *data, int length, int dir_fromup);
FILE *p_record; /* recording fp: if not NULL, recording is enabled */

View File

@ -751,7 +751,7 @@ void ruleset_debug(struct route_ruleset *ruleset_start)
/*
* parse ruleset
*/
static char *read_string(char *p, char *key, int key_size, char *special)
static char *read_string(char *p, char *key, int key_size, const char *special)
{
key[0] = 0;
@ -1922,7 +1922,7 @@ struct route_ruleset *ruleset_parse(void)
/*
* return ruleset by name
*/
struct route_ruleset *getrulesetbyname(char *name)
struct route_ruleset *getrulesetbyname(const char *name)
{
struct route_ruleset *ruleset = ruleset_first;

18
route.h
View File

@ -225,29 +225,29 @@ struct route_ruleset { /* the ruleset is a list of rules */
};
struct cond_defs { /* defintion of all conditions */
char *name; /* item's name */
const char *name; /* item's name */
int match; /* what to check */
int type; /* type of value (COND_TYPE) */
char *doc; /* syntax */
char *help; /* short help */
const char *doc; /* syntax */
const char *help; /* short help */
};
struct param_defs { /* definition of all options */
unsigned long long id; /* ID of parameter (just for checking) */
char *name; /* name of parameter */
const char *name; /* name of parameter */
int type; /* type of value (PARAM_TYPE_*) */
char *doc; /* syntax */
char *help; /* quick help */
const char *doc; /* syntax */
const char *help; /* quick help */
};
struct action_defs { /* definition of all actions */
int id; /* ID of parameter (just for checking) */
char *name;
const char *name;
void (EndpointAppPBX::*init_func)(void);
void (EndpointAppPBX::*dialing_func)(void);
void (EndpointAppPBX::*hangup_func)(void);
unsigned long long params;
char *help;
const char *help;
};
@ -273,5 +273,5 @@ void ruleset_free(struct route_ruleset *ruleset_start);
void ruleset_debug(struct route_ruleset *ruleset_start);
extern char ruleset_error[256];
struct route_ruleset *ruleset_parse(void);
struct route_ruleset *getrulesetbyname(char *name);
struct route_ruleset *getrulesetbyname(const char *name);

View File

@ -192,7 +192,7 @@ void admin_cleanup(void)
int admin_interface(struct admin_queue **responsep)
{
struct admin_queue *response; /* response pointer */
char *err_txt = "";
const char *err_txt = "";
int err = 0;
if (read_interfaces())
@ -569,7 +569,7 @@ int admin_call(struct admin_list *admin, struct admin_message *msg)
/*
* this function is called for response whenever a call state changes.
*/
void admin_call_response(int adminid, int message, char *connected, int cause, int location, int notify)
void admin_call_response(int adminid, int message, const char *connected, int cause, int location, int notify)
{
struct admin_list *admin;
struct admin_queue *response, **responsep; /* response pointer */

View File

@ -32,7 +32,7 @@ extern struct admin_list *admin_first;
int admin_init(void);
void admin_cleanup(void);
int admin_handle(void);
void admin_call_response(int adminid, int message, char *connected, int cause, int location, int notify);
void admin_call_response(int adminid, int message, const char *connected, int cause, int location, int notify);
int admin_message_to_join(struct admin_message *msg, int remote_id);
int admin_message_from_join(int remote_id, unsigned int ref, int message_type, union parameter *param);

View File

@ -14,7 +14,7 @@
struct trace trace;
char trace_string[MAX_TRACE_ELEMENTS * 100 + 400];
static char *spaces[11] = {
static const char *spaces[11] = {
" ",
" ",
" ",
@ -32,7 +32,7 @@ static char *spaces[11] = {
* initializes a new trace
* all values will be reset
*/
void _start_trace(const char *__file, int __line, int port, struct interface *interface, char *caller, char *dialing, int direction, int category, int serial, char *name)
void _start_trace(const char *__file, int __line, int port, struct interface *interface, const char *caller, const char *dialing, int direction, int category, int serial, const char *name)
{
if (trace.name[0])
PERROR("trace already started (name=%s) in file %s line %d\n", trace.name, __file, __line);
@ -61,7 +61,7 @@ void _start_trace(const char *__file, int __line, int port, struct interface *in
* if subelement is given, element will also contain a subelement
* if multiple subelements belong to same element, name must be equal for all subelements
*/
void _add_trace(const char *__file, int __line, char *name, char *sub, const char *fmt, ...)
void _add_trace(const char *__file, int __line, const char *name, const char *sub, const char *fmt, ...)
{
va_list args;

View File

@ -136,8 +136,8 @@ struct trace {
#define start_trace(port, interface, caller, dialing, direction, category, serial, name) _start_trace(__FILE__, __LINE__, port, interface, caller, dialing, direction, category, serial, name)
#define add_trace(name, sub, fmt, arg...) _add_trace(__FILE__, __LINE__, name, sub, fmt, ## arg)
#define end_trace() _end_trace(__FILE__, __LINE__)
void _start_trace(const char *__file, int line, int port, struct interface *interface, char *caller, char *dialing, int direction, int category, int serial, char *name);
void _add_trace(const char *__file, int line, char *name, char *sub, const char *fmt, ...);
void _start_trace(const char *__file, int line, int port, struct interface *interface, const char *caller, const char *dialing, int direction, int category, int serial, const char *name);
void _add_trace(const char *__file, int line, const char *name, const char *sub, const char *fmt, ...);
void _end_trace(const char *__file, int line);
//char *print_trace(int port, char *interface, char *caller, char *dialing, int direction, char *category, char *name);

View File

@ -45,7 +45,7 @@ VBoxPort::~VBoxPort()
}
static void vbox_trace_header(class VBoxPort *vbox, char *message, int direction)
static void vbox_trace_header(class VBoxPort *vbox, const char *message, int direction)
{
/* init trace with given values */
start_trace(0,