From 16927b7f7a7bce25329d1c2be0f31fbd789cb221 Mon Sep 17 00:00:00 2001 From: russell 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: http://svn.digium.com/svn/asterisk/trunk@83433 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_h323.c | 4 +-- channels/chan_iax2.c | 86 ++++++++++++++++++++++++------------------------- channels/chan_mgcp.c | 2 +- channels/chan_misdn.c | 10 +++--- channels/chan_sip.c | 44 ++++++++++++------------- channels/misdn_config.c | 2 +- 6 files changed, 74 insertions(+), 74 deletions(-) (limited to 'channels') diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 7299fbc61..03f05d775 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -311,9 +311,9 @@ static void oh323_destroy_peer(struct oh323_peer *peer) ast_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 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)) diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 1432ba786..3ffbcf83a 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -638,7 +638,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 837a74997..d95441a0d 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -621,7 +621,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; @@ -634,12 +634,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); } @@ -649,14 +649,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 e4f985991..d1b1547e1 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1483,7 +1483,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); @@ -1515,7 +1515,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *e /*--- 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 struct sip_pvt *sip_destroy(struct sip_pvt *p); @@ -1523,7 +1523,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist); 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 *arg); +static int auto_congest(const void *arg); static int update_call_counter(struct sip_pvt *fup, int event); static int hangup_sip2cause(int cause); static const char *hangup_cause2sip(int cause); @@ -1579,7 +1579,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_addrcmp(char *name, struct sockaddr_in *sin); /* Support for peer matching */ @@ -1590,7 +1590,7 @@ static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target /*--- Device monitoring and Device/extension state/event 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); @@ -1667,7 +1667,7 @@ 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 int sip_poke_peer_s(void *data); +static int sip_poke_peer_s(const void *data); static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_request *req); static void reg_source_db(struct sip_peer *peer); static void destroy_association(struct sip_peer *peer); @@ -1688,9 +1688,9 @@ static void ast_sip_ouraddrfor(struct in_addr *them, struct sockaddr_in *us); static void sip_registry_destroy(struct sip_registry *reg); static int sip_register(char *value, int lineno); static const 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 */ @@ -2243,9 +2243,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; @@ -2414,9 +2414,9 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res * and we are called using that reference. So if the event is not * rescheduled, we need to call dialog_unref(). */ -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) { @@ -3473,9 +3473,9 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer) /*! \brief Scheduled congestion on a call. * Only called by the scheduler, must return the reference when done. */ -static int auto_congest(void *arg) +static int auto_congest(const void *arg) { - struct sip_pvt *p = arg; + struct sip_pvt *p = (struct sip_pvt *)arg; sip_pvt_lock(p); p->initid = -1; /* event gone, will not be rescheduled */ @@ -8063,7 +8063,7 @@ static const char *regstate2str(enum sipregistrystate regstate) * We assume the reference so the sip_registry is valid, since it * is stored in the scheduled event anyways. */ -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= registry_addref((struct sip_registry *) data); @@ -8100,7 +8100,7 @@ static int __sip_do_register(struct sip_registry *r) * This is called by the scheduler so the event is not pending anymore when * we are called. */ -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 */ @@ -8537,9 +8537,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; @@ -8569,9 +8569,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); @@ -16668,9 +16668,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 6a68bfb1a..71ed157ca 100644 --- a/channels/misdn_config.c +++ b/channels/misdn_config.c @@ -1007,7 +1007,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)) { -- cgit v1.2.3