From 9f64905d4e2fe7372cc574338e50579455c11602 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 21 Sep 2007 14:40:10 +0000 Subject: Merged revisions 83432 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r83432 | russell | 2007-09-21 09:37:20 -0500 (Fri, 21 Sep 2007) | 4 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@83433 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 86 ++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'channels/chan_iax2.c') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 4bd1ace8a..882340586 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -738,8 +738,8 @@ struct iax2_thread { enum iax2_thread_type type; enum iax2_thread_iostate iostate; #ifdef SCHED_MULTITHREADED - void (*schedfunc)(void *); - void *scheddata; + void (*schedfunc)(const void *); + const void *scheddata; #endif #ifdef DEBUG_SCHED_MULTITHREAD char curfunc[80]; @@ -873,7 +873,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); @@ -1075,7 +1075,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; @@ -1103,7 +1103,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_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, void *data) +static int iax2_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data) { int res; @@ -1113,7 +1113,7 @@ static int iax2_sched_replace(int old_id, struct sched_context *con, int when, a return res; } -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; @@ -1123,9 +1123,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]); @@ -1136,7 +1136,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)) @@ -1157,9 +1157,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 */ @@ -1171,7 +1171,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)) @@ -2178,12 +2178,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 */ @@ -2259,7 +2259,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)) @@ -2280,7 +2280,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]); @@ -2589,7 +2589,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) { @@ -2608,7 +2608,7 @@ static void update_jbsched(struct chan_iax2_pvt *pvt) 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; @@ -2684,7 +2684,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)) @@ -2906,7 +2906,7 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in ast_copy_flags(peer, &globalflags, IAX_RTAUTOCLEAR|IAX_RTCACHEFRIENDS); if (ast_test_flag(peer, IAX_RTAUTOCLEAR)) { peer->expire = iax2_sched_replace(peer->expire, sched, - (global_rtautoclear) * 1000, expire_registry, (void *) peer->name); + (global_rtautoclear) * 1000, expire_registry, (const void *)peer->name); } ao2_link(peers, peer_ref(peer)); if (ast_test_flag(peer, IAX_DYNAMIC)) @@ -3080,7 +3080,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 }; @@ -3093,7 +3093,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)) @@ -5780,14 +5780,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)) @@ -6065,9 +6065,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, @@ -6100,7 +6100,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)) @@ -6136,7 +6136,7 @@ static void reg_source_db(struct iax2_peer *p) p->addr.sin_port = htons(atoi(c)); ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */ p->expire = iax2_sched_replace(p->expire, sched, - (p->expiry + 10) * 1000, expire_registry, (void *) p->name); + (p->expiry + 10) * 1000, expire_registry, (const void *)p->name); if (iax2_regfunk) iax2_regfunk(p->name, 1); register_peer_exten(p, 1); @@ -6240,7 +6240,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) { @@ -6385,7 +6385,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); @@ -6405,7 +6405,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]); @@ -6434,7 +6434,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); @@ -6449,7 +6449,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]); @@ -6497,15 +6497,15 @@ static void vnak_retransmit(int callno, int last) AST_LIST_UNLOCK(&frame_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)) @@ -8961,9 +8961,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); @@ -8980,9 +8980,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)) -- cgit v1.2.3