aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-21 14:37:20 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-21 14:37:20 +0000
commit02c2b2e2c1f00151ac2099ff68efda2ac89271a0 (patch)
treeb76c4146efd5357b7e89db353ccebf4bdefa8e7b /channels
parentec43deabe7d576aca83ebbda30dfc0290e38ef3c (diff)
gcc 4.2 has a new set of warnings dealing with cosnt pointers. This set of
changes gets all of Asterisk (minus chan_alsa for now) to compile with gcc 4.2. (closes issue #10774, patch from qwell) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@83432 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_h323.c4
-rw-r--r--channels/chan_iax2.c80
-rw-r--r--channels/chan_mgcp.c2
-rw-r--r--channels/chan_misdn.c10
-rw-r--r--channels/chan_sip.c46
-rw-r--r--channels/misdn_config.c2
6 files changed, 72 insertions, 72 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index d519664ed..2ae04f08d 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -303,9 +303,9 @@ static void oh323_destroy_peer(struct oh323_peer *peer)
free(peer);
}
-static int oh323_simulate_dtmf_end(void *data)
+static int oh323_simulate_dtmf_end(const void *data)
{
- struct oh323_pvt *pvt = data;
+ struct oh323_pvt *pvt = (struct oh323_pvt *)data;
if (pvt) {
ast_mutex_lock(&pvt->lock);
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 8fcf40139..b9ab341e7 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -710,8 +710,8 @@ struct iax2_thread {
int type;
int iostate;
#ifdef SCHED_MULTITHREADED
- void (*schedfunc)(void *);
- void *scheddata;
+ void (*schedfunc)(const void *);
+ const void *scheddata;
#endif
#ifdef DEBUG_SCHED_MULTITHREAD
char curfunc[80];
@@ -812,7 +812,7 @@ static ast_mutex_t iaxsl[IAX_MAX_CALLS];
static struct timeval lastused[IAX_MAX_CALLS];
static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-static int expire_registry(void *data);
+static int expire_registry(const void *data);
static int iax2_answer(struct ast_channel *c);
static int iax2_call(struct ast_channel *c, char *dest, int timeout);
static int iax2_devicestate(void *data);
@@ -935,7 +935,7 @@ static struct iax2_thread *find_idle_thread(void)
}
#ifdef SCHED_MULTITHREADED
-static int __schedule_action(void (*func)(void *data), void *data, const char *funcname)
+static int __schedule_action(void (*func)(const void *data), const void *data, const char *funcname)
{
struct iax2_thread *thread = NULL;
static time_t lasterror;
@@ -963,7 +963,7 @@ static int __schedule_action(void (*func)(void *data), void *data, const char *f
#define schedule_action(func, data) __schedule_action(func, data, __PRETTY_FUNCTION__)
#endif
-static int iax2_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data)
+static int iax2_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data)
{
int res;
@@ -973,9 +973,9 @@ static int iax2_sched_add(struct sched_context *con, int when, ast_sched_cb call
return res;
}
-static int send_ping(void *data);
+static int send_ping(const void *data);
-static void __send_ping(void *data)
+static void __send_ping(const void *data)
{
int callno = (long)data;
ast_mutex_lock(&iaxsl[callno]);
@@ -986,7 +986,7 @@ static void __send_ping(void *data)
ast_mutex_unlock(&iaxsl[callno]);
}
-static int send_ping(void *data)
+static int send_ping(const void *data)
{
#ifdef SCHED_MULTITHREADED
if (schedule_action(__send_ping, data))
@@ -1007,9 +1007,9 @@ static int get_encrypt_methods(const char *s)
return e;
}
-static int send_lagrq(void *data);
+static int send_lagrq(const void *data);
-static void __send_lagrq(void *data)
+static void __send_lagrq(const void *data)
{
int callno = (long)data;
/* Ping only if it's real not if it's bridged */
@@ -1021,7 +1021,7 @@ static void __send_lagrq(void *data)
ast_mutex_unlock(&iaxsl[callno]);
}
-static int send_lagrq(void *data)
+static int send_lagrq(const void *data)
{
#ifdef SCHED_MULTITHREADED
if (schedule_action(__send_lagrq, data))
@@ -2033,12 +2033,12 @@ static int update_packet(struct iax_frame *f)
return 0;
}
-static int attempt_transmit(void *data);
-static void __attempt_transmit(void *data)
+static int attempt_transmit(const void *data);
+static void __attempt_transmit(const void *data)
{
/* Attempt to transmit the frame to the remote peer...
Called without iaxsl held. */
- struct iax_frame *f = data;
+ struct iax_frame *f = (struct iax_frame *)data;
int freeme=0;
int callno = f->callno;
/* Make sure this call is still active */
@@ -2115,7 +2115,7 @@ static void __attempt_transmit(void *data)
}
}
-static int attempt_transmit(void *data)
+static int attempt_transmit(const void *data)
{
#ifdef SCHED_MULTITHREADED
if (schedule_action(__attempt_transmit, data))
@@ -2136,7 +2136,7 @@ static int iax2_prune_realtime(int fd, int argc, char *argv[])
} else if ((peer = find_peer(argv[3], 0))) {
if(ast_test_flag(peer, IAX_RTCACHEFRIENDS)) {
ast_set_flag(peer, IAX_RTAUTOCLEAR);
- expire_registry((void *)peer->name);
+ expire_registry((const void *)peer->name);
ast_cli(fd, "OK peer %s was removed from the cache.\n", argv[3]);
} else {
ast_cli(fd, "SORRY peer %s is not eligible for this operation.\n", argv[3]);
@@ -2411,7 +2411,7 @@ static void unwrap_timestamp(struct iax_frame *fr)
}
}
-static int get_from_jb(void *p);
+static int get_from_jb(const void *p);
static void update_jbsched(struct chan_iax2_pvt *pvt)
{
@@ -2431,7 +2431,7 @@ static void update_jbsched(struct chan_iax2_pvt *pvt)
pvt->jbid = iax2_sched_add(sched, when, get_from_jb, CALLNO_TO_PTR(pvt->callno));
}
-static void __get_from_jb(void *p)
+static void __get_from_jb(const void *p)
{
int callno = PTR_TO_CALLNO(p);
struct chan_iax2_pvt *pvt = NULL;
@@ -2508,7 +2508,7 @@ static void __get_from_jb(void *p)
ast_mutex_unlock(&iaxsl[callno]);
}
-static int get_from_jb(void *data)
+static int get_from_jb(const void *data)
{
#ifdef SCHED_MULTITHREADED
if (schedule_action(__get_from_jb, data))
@@ -2914,7 +2914,7 @@ return_unref:
return res;
}
-static void __auto_congest(void *nothing)
+static void __auto_congest(const void *nothing)
{
int callno = PTR_TO_CALLNO(nothing);
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_CONGESTION };
@@ -2927,7 +2927,7 @@ static void __auto_congest(void *nothing)
ast_mutex_unlock(&iaxsl[callno]);
}
-static int auto_congest(void *data)
+static int auto_congest(const void *data)
{
#ifdef SCHED_MULTITHREADED
if (schedule_action(__auto_congest, data))
@@ -5479,14 +5479,14 @@ static int authenticate_reply(struct chan_iax2_pvt *p, struct sockaddr_in *sin,
static int iax2_do_register(struct iax2_registry *reg);
-static void __iax2_do_register_s(void *data)
+static void __iax2_do_register_s(const void *data)
{
- struct iax2_registry *reg = data;
+ struct iax2_registry *reg = (struct iax2_registry *)data;
reg->expire = -1;
iax2_do_register(reg);
}
-static int iax2_do_register_s(void *data)
+static int iax2_do_register_s(const void *data)
{
#ifdef SCHED_MULTITHREADED
if (schedule_action(__iax2_do_register_s, data))
@@ -5762,9 +5762,9 @@ static void register_peer_exten(struct iax2_peer *peer, int onoff)
}
static void prune_peers(void);
-static void __expire_registry(void *data)
+static void __expire_registry(const void *data)
{
- char *name = data;
+ const char *name = data;
struct iax2_peer *peer = NULL;
struct iax2_peer tmp_peer = {
.name = name,
@@ -5797,7 +5797,7 @@ static void __expire_registry(void *data)
peer_unref(peer);
}
-static int expire_registry(void *data)
+static int expire_registry(const void *data)
{
#ifdef SCHED_MULTITHREADED
if (schedule_action(__expire_registry, data))
@@ -5941,7 +5941,7 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
p->expiry = refresh;
}
if (p->expiry && sin->sin_addr.s_addr)
- p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, (void *)p->name);
+ p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, (const void *)p->name);
iax_ie_append_str(&ied, IAX_IE_USERNAME, p->name);
iax_ie_append_int(&ied, IAX_IE_DATETIME, iax2_datetime(p->zonetag));
if (sin->sin_addr.s_addr) {
@@ -6065,7 +6065,7 @@ static void stop_stuff(int callno)
iax2_destroy_helper(iaxs[callno]);
}
-static void __auth_reject(void *nothing)
+static void __auth_reject(const void *nothing)
{
/* Called from IAX thread only, without iaxs lock */
int callno = (int)(long)(nothing);
@@ -6085,7 +6085,7 @@ static void __auth_reject(void *nothing)
ast_mutex_unlock(&iaxsl[callno]);
}
-static int auth_reject(void *data)
+static int auth_reject(const void *data)
{
int callno = (int)(long)(data);
ast_mutex_lock(&iaxsl[callno]);
@@ -6115,7 +6115,7 @@ static int auth_fail(int callno, int failcode)
return 0;
}
-static void __auto_hangup(void *nothing)
+static void __auto_hangup(const void *nothing)
{
/* Called from IAX thread only, without iaxs lock */
int callno = (int)(long)(nothing);
@@ -6130,7 +6130,7 @@ static void __auto_hangup(void *nothing)
ast_mutex_unlock(&iaxsl[callno]);
}
-static int auto_hangup(void *data)
+static int auto_hangup(const void *data)
{
int callno = (int)(long)(data);
ast_mutex_lock(&iaxsl[callno]);
@@ -6179,15 +6179,15 @@ static void vnak_retransmit(int callno, int last)
AST_LIST_UNLOCK(&iaxq.queue);
}
-static void __iax2_poke_peer_s(void *data)
+static void __iax2_poke_peer_s(const void *data)
{
- struct iax2_peer *peer = data;
+ struct iax2_peer *peer = (struct iax2_peer *)data;
iax2_poke_peer(peer, 0);
}
-static int iax2_poke_peer_s(void *data)
+static int iax2_poke_peer_s(const void *data)
{
- struct iax2_peer *peer = data;
+ struct iax2_peer *peer = (struct iax2_peer *)data;
peer->pokeexpire = -1;
#ifdef SCHED_MULTITHREADED
if (schedule_action(__iax2_poke_peer_s, data))
@@ -8460,9 +8460,9 @@ static int iax2_prov_cmd(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static void __iax2_poke_noanswer(void *data)
+static void __iax2_poke_noanswer(const void *data)
{
- struct iax2_peer *peer = data;
+ struct iax2_peer *peer = (struct iax2_peer *)data;
if (peer->lastms > -1) {
ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE! Time: %d\n", peer->name, peer->lastms);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, peer->lastms);
@@ -8479,9 +8479,9 @@ static void __iax2_poke_noanswer(void *data)
peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_peer_s, peer);
}
-static int iax2_poke_noanswer(void *data)
+static int iax2_poke_noanswer(const void *data)
{
- struct iax2_peer *peer = data;
+ struct iax2_peer *peer = (struct iax2_peer *)data;
peer->pokeexpire = -1;
#ifdef SCHED_MULTITHREADED
if (schedule_action(__iax2_poke_noanswer, data))
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index d504e3679..3fa2bcf03 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -604,7 +604,7 @@ static void mgcp_queue_control(struct mgcp_subchannel *sub, int control)
return mgcp_queue_frame(sub, &f);
}
-static int retrans_pkt(void *data)
+static int retrans_pkt(const void *data)
{
struct mgcp_gateway *gw = (struct mgcp_gateway *)data;
struct mgcp_message *cur, *exq = NULL, *w, *prev;
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 41a0eada7..e99464d9d 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -613,7 +613,7 @@ static inline void misdn_tasks_wakeup (void)
pthread_kill(misdn_tasks_thread, SIGUSR1);
}
-static inline int _misdn_tasks_add_variable (int timeout, ast_sched_cb callback, void *data, int variable)
+static inline int _misdn_tasks_add_variable (int timeout, ast_sched_cb callback, const void *data, int variable)
{
int task_id;
@@ -626,12 +626,12 @@ static inline int _misdn_tasks_add_variable (int timeout, ast_sched_cb callback,
return task_id;
}
-static int misdn_tasks_add (int timeout, ast_sched_cb callback, void *data)
+static int misdn_tasks_add (int timeout, ast_sched_cb callback, const void *data)
{
return _misdn_tasks_add_variable(timeout, callback, data, 0);
}
-static int misdn_tasks_add_variable (int timeout, ast_sched_cb callback, void *data)
+static int misdn_tasks_add_variable (int timeout, ast_sched_cb callback, const void *data)
{
return _misdn_tasks_add_variable(timeout, callback, data, 1);
}
@@ -641,14 +641,14 @@ static void misdn_tasks_remove (int task_id)
ast_sched_del(misdn_tasks, task_id);
}
-static int misdn_l1_task (void *data)
+static int misdn_l1_task (const void *data)
{
misdn_lib_isdn_l1watcher(*(int *)data);
chan_misdn_log(5, *(int *)data, "L1watcher timeout\n");
return 1;
}
-static int misdn_overlap_dial_task (void *data)
+static int misdn_overlap_dial_task (const void *data)
{
struct timeval tv_end, tv_now;
int diff;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index c365c00c7..ec06ca649 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1225,7 +1225,7 @@ static int sipsock_read(int *id, int fd, short events, void *ignore);
static int __sip_xmit(struct sip_pvt *p, char *data, int len);
static int __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, int fatal, int sipmethod);
static int __transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable);
-static int retrans_pkt(void *data);
+static int retrans_pkt(const void *data);
static int transmit_sip_request(struct sip_pvt *p, struct sip_request *req);
static int transmit_response_using_temp(ast_string_field callid, struct sockaddr_in *sin, int useglobal_nat, const int intended_method, const struct sip_request *req, const char *msg);
static int transmit_response(struct sip_pvt *p, const char *msg, const struct sip_request *req);
@@ -1258,7 +1258,7 @@ static int does_peer_need_mwi(struct sip_peer *peer);
/*--- Dialog management */
static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *sin,
int useglobal_nat, const int intended_method);
-static int __sip_autodestruct(void *data);
+static int __sip_autodestruct(const void *data);
static void sip_scheddestroy(struct sip_pvt *p, int ms);
static void sip_cancel_destroy(struct sip_pvt *p);
static void sip_destroy(struct sip_pvt *p);
@@ -1266,7 +1266,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner);
static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
static void __sip_pretend_ack(struct sip_pvt *p);
static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
-static int auto_congest(void *nothing);
+static int auto_congest(const void *nothing);
static int update_call_counter(struct sip_pvt *fup, int event);
static int hangup_sip2cause(int cause);
static const char *hangup_cause2sip(int cause);
@@ -1321,7 +1321,7 @@ static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, con
/*--- Misc functions */
static int sip_do_reload(enum channelreloadreason reason);
static int reload_config(enum channelreloadreason reason);
-static int expire_register(void *data);
+static int expire_register(const void *data);
static void *do_monitor(void *data);
static int restart_monitor(void);
static int sip_send_mwi_to_peer(struct sip_peer *peer);
@@ -1334,7 +1334,7 @@ static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target
/*--- Device monitoring and Device/extension state handling */
static int cb_extensionstate(char *context, char* exten, int state, void *data);
static int sip_devicestate(void *data);
-static int sip_poke_noanswer(void *data);
+static int sip_poke_noanswer(const void *data);
static int sip_poke_peer(struct sip_peer *peer);
static void sip_poke_all_peers(void);
static void sip_peer_hold(struct sip_pvt *p, int hold);
@@ -1413,14 +1413,14 @@ static int update_call_counter(struct sip_pvt *fup, int event);
static void sip_destroy_peer(struct sip_peer *peer);
static void sip_destroy_user(struct sip_user *user);
static int sip_poke_peer(struct sip_peer *peer);
-static int sip_poke_peer_s(void *data);
+static int sip_poke_peer_s(const void *data);
static void set_peer_defaults(struct sip_peer *peer);
static struct sip_peer *temp_peer(const char *name);
static void register_peer_exten(struct sip_peer *peer, int onoff);
static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int realtime);
static struct sip_user *find_user(const char *name, int realtime);
static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_request *req);
-static int expire_register(void *data);
+static int expire_register(const void *data);
static void reg_source_db(struct sip_peer *peer);
static void destroy_association(struct sip_peer *peer);
static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v);
@@ -1437,9 +1437,9 @@ static int ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us);
static void sip_registry_destroy(struct sip_registry *reg);
static int sip_register(char *value, int lineno);
static char *regstate2str(enum sipregistrystate regstate) attribute_const;
-static int sip_reregister(void *data);
+static int sip_reregister(const void *data);
static int __sip_do_register(struct sip_registry *r);
-static int sip_reg_timeout(void *data);
+static int sip_reg_timeout(const void *data);
static void sip_send_all_registers(void);
/*--- Parsing SIP requests and responses */
@@ -1881,9 +1881,9 @@ static void append_history_full(struct sip_pvt *p, const char *fmt, ...)
}
/*! \brief Retransmit SIP message if no answer (Called from scheduler) */
-static int retrans_pkt(void *data)
+static int retrans_pkt(const void *data)
{
- struct sip_pkt *pkt = data, *prev, *cur = NULL;
+ struct sip_pkt *pkt = (struct sip_pkt *)data, *prev, *cur = NULL;
int reschedule = DEFAULT_RETRANS;
int xmitres = 0;
@@ -2054,9 +2054,9 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res
}
/*! \brief Kill a SIP dialog (called by scheduler) */
-static int __sip_autodestruct(void *data)
+static int __sip_autodestruct(const void *data)
{
- struct sip_pvt *p = data;
+ struct sip_pvt *p = (struct sip_pvt *)data;
/* If this is a subscription, tell the phone that we got a timeout */
if (p->subscribed) {
@@ -2868,9 +2868,9 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer)
}
/*! \brief Scheduled congestion on a call */
-static int auto_congest(void *nothing)
+static int auto_congest(const void *nothing)
{
- struct sip_pvt *p = nothing;
+ struct sip_pvt *p = (struct sip_pvt *)nothing;
ast_mutex_lock(&p->lock);
p->initid = -1;
@@ -7279,7 +7279,7 @@ static char *regstate2str(enum sipregistrystate regstate)
}
/*! \brief Update registration with SIP Proxy */
-static int sip_reregister(void *data)
+static int sip_reregister(const void *data)
{
/* if we are here, we know that we need to reregister. */
struct sip_registry *r= ASTOBJ_REF((struct sip_registry *) data);
@@ -7311,7 +7311,7 @@ static int __sip_do_register(struct sip_registry *r)
}
/*! \brief Registration timeout, register again */
-static int sip_reg_timeout(void *data)
+static int sip_reg_timeout(const void *data)
{
/* if we are here, our registration timed out, so we'll just do it over */
@@ -7716,9 +7716,9 @@ static void destroy_association(struct sip_peer *peer)
}
/*! \brief Expire registration of SIP peer */
-static int expire_register(void *data)
+static int expire_register(const void *data)
{
- struct sip_peer *peer = data;
+ struct sip_peer *peer = (struct sip_peer *)data;
if (!peer) /* Hmmm. We have no peer. Weird. */
return 0;
@@ -7745,9 +7745,9 @@ static int expire_register(void *data)
}
/*! \brief Poke peer (send qualify to check if peer is alive and well) */
-static int sip_poke_peer_s(void *data)
+static int sip_poke_peer_s(const void *data)
{
- struct sip_peer *peer = data;
+ struct sip_peer *peer = (struct sip_peer *)data;
peer->pokeexpire = -1;
sip_poke_peer(peer);
@@ -15442,9 +15442,9 @@ static int restart_monitor(void)
}
/*! \brief React to lack of answer to Qualify poke */
-static int sip_poke_noanswer(void *data)
+static int sip_poke_noanswer(const void *data)
{
- struct sip_peer *peer = data;
+ struct sip_peer *peer = (struct sip_peer *)data;
peer->pokeexpire = -1;
if (peer->lastms > -1) {
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index 6755a5e73..d30b4589b 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -1000,7 +1000,7 @@ void misdn_cfg_update_ptp (void)
misdn_cfg_get(0, MISDN_GEN_MISDN_INIT, &misdn_init, sizeof(misdn_init));
- if (misdn_init) {
+ if (!ast_strlen_zero(misdn_init)) {
fp = fopen(misdn_init, "r");
if (fp) {
while(fgets(line, sizeof(line), fp)) {