[asterisk-commits] russell: branch 1.4 r83432 - in /branches/1.4: channels/ include/asterisk/ ma...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 21 09:37:20 CDT 2007


Author: russell
Date: Fri Sep 21 09:37:20 2007
New Revision: 83432

URL: http://svn.digium.com/view/asterisk?view=rev&rev=83432
Log:
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)

Modified:
    branches/1.4/channels/chan_h323.c
    branches/1.4/channels/chan_iax2.c
    branches/1.4/channels/chan_mgcp.c
    branches/1.4/channels/chan_misdn.c
    branches/1.4/channels/chan_sip.c
    branches/1.4/channels/misdn_config.c
    branches/1.4/include/asterisk/channel.h
    branches/1.4/include/asterisk/sched.h
    branches/1.4/main/ast_expr2.fl
    branches/1.4/main/ast_expr2f.c
    branches/1.4/main/cdr.c
    branches/1.4/main/channel.c
    branches/1.4/main/db1-ast/hash/hash.c
    branches/1.4/main/dnsmgr.c
    branches/1.4/main/file.c
    branches/1.4/main/rtp.c
    branches/1.4/main/sched.c
    branches/1.4/pbx/ael/ael.tab.c
    branches/1.4/pbx/ael/ael.y
    branches/1.4/pbx/pbx_dundi.c
    branches/1.4/res/res_config_pgsql.c
    branches/1.4/utils/ael_main.c

Modified: branches/1.4/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_h323.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/channels/chan_h323.c (original)
+++ branches/1.4/channels/chan_h323.c Fri Sep 21 09:37:20 2007
@@ -303,9 +303,9 @@
 	free(peer);
 }
 
-static int oh323_simulate_dtmf_end(void *data)
-{
-	struct oh323_pvt *pvt = data;
+static int oh323_simulate_dtmf_end(const void *data)
+{
+	struct oh323_pvt *pvt = (struct oh323_pvt *)data;
 
 	if (pvt) {
 		ast_mutex_lock(&pvt->lock);

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Fri Sep 21 09:37:20 2007
@@ -710,8 +710,8 @@
 	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 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 @@
 }
 
 #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 @@
 #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 @@
 	return res;
 }
 
-static int send_ping(void *data);
-
-static void __send_ping(void *data)
+static int send_ping(const void *data);
+
+static void __send_ping(const void *data)
 {
 	int callno = (long)data;
 	ast_mutex_lock(&iaxsl[callno]);
@@ -986,7 +986,7 @@
 	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 @@
 	return e;
 }
 
-static int send_lagrq(void *data);
-
-static void __send_lagrq(void *data)
+static int send_lagrq(const 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 @@
 	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 @@
 	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 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 @@
 	} 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 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 @@
 	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 @@
 	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 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 @@
 	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 iax2_do_register(struct iax2_registry *reg);
 
-static void __iax2_do_register_s(void *data)
-{
-	struct iax2_registry *reg = data;
+static void __iax2_do_register_s(const void *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 prune_peers(void);
 
-static void __expire_registry(void *data)
-{
-	char *name = data;
+static void __expire_registry(const void *data)
+{
+	const char *name = data;
 	struct iax2_peer *peer = NULL;
 	struct iax2_peer tmp_peer = {
 		.name = name,
@@ -5797,7 +5797,7 @@
 	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 @@
 		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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	AST_LIST_UNLOCK(&iaxq.queue);
 }
 
-static void __iax2_poke_peer_s(void *data)
-{
-	struct iax2_peer *peer = data;
+static void __iax2_poke_peer_s(const void *data)
+{
+	struct iax2_peer *peer = (struct iax2_peer *)data;
 	iax2_poke_peer(peer, 0);
 }
 
-static int iax2_poke_peer_s(void *data)
-{
-	struct iax2_peer *peer = data;
+static int iax2_poke_peer_s(const void *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 @@
 	return RESULT_SUCCESS;
 }
 
-static void __iax2_poke_noanswer(void *data)
-{
-	struct iax2_peer *peer = data;
+static void __iax2_poke_noanswer(const void *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 @@
 	peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_peer_s, peer);
 }
 
-static int iax2_poke_noanswer(void *data)
-{
-	struct iax2_peer *peer = data;
+static int iax2_poke_noanswer(const void *data)
+{
+	struct iax2_peer *peer = (struct iax2_peer *)data;
 	peer->pokeexpire = -1;
 #ifdef SCHED_MULTITHREADED
 	if (schedule_action(__iax2_poke_noanswer, data))

Modified: branches/1.4/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_mgcp.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/channels/chan_mgcp.c (original)
+++ branches/1.4/channels/chan_mgcp.c Fri Sep 21 09:37:20 2007
@@ -604,7 +604,7 @@
 	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;

Modified: branches/1.4/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_misdn.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/channels/chan_misdn.c (original)
+++ branches/1.4/channels/chan_misdn.c Fri Sep 21 09:37:20 2007
@@ -613,7 +613,7 @@
 	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 @@
 	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 @@
 	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;

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Fri Sep 21 09:37:20 2007
@@ -1225,7 +1225,7 @@
 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 @@
 /*--- 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_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 @@
 /*--- 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 @@
 /*--- 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 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 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 @@
 }
 
 /*! \brief Retransmit SIP message if no answer (Called from scheduler) */
-static int retrans_pkt(void *data)
-{
-	struct sip_pkt *pkt = data, *prev, *cur = NULL;
+static int retrans_pkt(const void *data)
+{
+	struct sip_pkt *pkt = (struct sip_pkt *)data, *prev, *cur = NULL;
 	int reschedule = DEFAULT_RETRANS;
 	int xmitres = 0;
 
@@ -2054,9 +2054,9 @@
 }
 
 /*! \brief Kill a SIP dialog (called by scheduler) */
-static int __sip_autodestruct(void *data)
-{
-	struct sip_pvt *p = data;
+static int __sip_autodestruct(const void *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 @@
 }
 
 /*! \brief Scheduled congestion on a call */
-static int auto_congest(void *nothing)
-{
-	struct sip_pvt *p = nothing;
+static int auto_congest(const void *nothing)
+{
+	struct sip_pvt *p = (struct sip_pvt *)nothing;
 
 	ast_mutex_lock(&p->lock);
 	p->initid = -1;
@@ -7279,7 +7279,7 @@
 }
 
 /*! \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 @@
 }
 
 /*! \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 @@
 }
 
 /*! \brief Expire registration of SIP peer */
-static int expire_register(void *data)
-{
-	struct sip_peer *peer = data;
+static int expire_register(const void *data)
+{
+	struct sip_peer *peer = (struct sip_peer *)data;
 	
 	if (!peer)		/* Hmmm. We have no peer. Weird. */
 		return 0;
@@ -7745,9 +7745,9 @@
 }
 
 /*! \brief Poke peer (send qualify to check if peer is alive and well) */
-static int sip_poke_peer_s(void *data)
-{
-	struct sip_peer *peer = data;
+static int sip_poke_peer_s(const void *data)
+{
+	struct sip_peer *peer = (struct sip_peer *)data;
 
 	peer->pokeexpire = -1;
 	sip_poke_peer(peer);
@@ -15442,9 +15442,9 @@
 }
 
 /*! \brief React to lack of answer to Qualify poke */
-static int sip_poke_noanswer(void *data)
-{
-	struct sip_peer *peer = data;
+static int sip_poke_noanswer(const void *data)
+{
+	struct sip_peer *peer = (struct sip_peer *)data;
 	
 	peer->pokeexpire = -1;
 	if (peer->lastms > -1) {

Modified: branches/1.4/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn_config.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/channels/misdn_config.c (original)
+++ branches/1.4/channels/misdn_config.c Fri Sep 21 09:37:20 2007
@@ -1000,7 +1000,7 @@
 
 	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)) {

Modified: branches/1.4/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/channel.h?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/include/asterisk/channel.h (original)
+++ branches/1.4/include/asterisk/channel.h Fri Sep 21 09:37:20 2007
@@ -367,7 +367,7 @@
 	int oldwriteformat;				/*!< Original writer format */
 	
 	int timingfd;					/*!< Timing fd */
-	int (*timingfunc)(void *data);
+	int (*timingfunc)(const void *data);
 	void *timingdata;
 
 	enum ast_channel_state _state;			/*!< State of line -- Don't write directly, use ast_setstate */
@@ -1135,7 +1135,7 @@
 
 /* If built with zaptel optimizations, force a scheduled expiration on the
    timer fd, at which point we call the callback function / data */
-int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data), void *data);
+int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *data), void *data);
 
 /*!	\brief Transfer a channel (if supported).  Returns -1 on error, 0 if not supported
    and 1 if supported and requested 

Modified: branches/1.4/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/sched.h?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/include/asterisk/sched.h (original)
+++ branches/1.4/include/asterisk/sched.h Fri Sep 21 09:37:20 2007
@@ -55,7 +55,7 @@
  * \return returns a 0 if it should not be run again, or non-zero if it should be
  * rescheduled to run again
  */
-typedef int (*ast_sched_cb)(void *data);
+typedef int (*ast_sched_cb)(const void *data);
 #define AST_SCHED_CB(a) ((ast_sched_cb)(a))
 
 /*! \brief Adds a scheduled event
@@ -69,7 +69,7 @@
  * \param data data to pass to the callback
  * \return Returns a schedule item ID on success, -1 on failure
  */
-int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data);
+int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data);
 
 /*!Adds a scheduled event with rescheduling support
  * \param con Scheduler context to add
@@ -84,7 +84,7 @@
  * If callback returns 0, no further events will be re-scheduled
  * \return Returns a schedule item ID on success, -1 on failure
  */
-int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable);
+int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable);
 
 /*! \brief Deletes a scheduled event
  * Remove this event from being run.  A procedure should not remove its

Modified: branches/1.4/main/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/ast_expr2.fl?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/ast_expr2.fl (original)
+++ branches/1.4/main/ast_expr2.fl Fri Sep 21 09:37:20 2007
@@ -89,7 +89,7 @@
 void ast_yyset_column(int column_no, yyscan_t yyscanner);
 int ast_yyget_column(yyscan_t yyscanner);
 static int curlycount = 0;
-static char *expr2_token_subst(char *mess);
+static char *expr2_token_subst(const char *mess);
 %}
 
 %option prefix="ast_yy"
@@ -323,11 +323,11 @@
 };
 
 
-static char *expr2_token_subst(char *mess)
+static char *expr2_token_subst(const char *mess)
 {
 	/* calc a length, malloc, fill, and return; yyerror had better free it! */
 	int len=0,i;
-	char *p;
+	const char *p;
 	char *res, *s,*t;
 	int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*);
 
@@ -372,7 +372,7 @@
 	char spacebuf[8000]; /* best safe than sorry */
 	char spacebuf2[8000]; /* best safe than sorry */
 	int i=0;
-	char *s2 = expr2_token_subst((char *)s);
+	char *s2 = expr2_token_subst(s);
 	spacebuf[0] = 0;
 	
 	for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' ';  /* uh... assuming yyg is defined, then I can use the yycolumn macro,

Modified: branches/1.4/main/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/ast_expr2f.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/ast_expr2f.c (original)
+++ branches/1.4/main/ast_expr2f.c Fri Sep 21 09:37:20 2007
@@ -1409,7 +1409,7 @@
 void ast_yyset_column(int column_no, yyscan_t yyscanner);
 int ast_yyget_column(yyscan_t yyscanner);
 static int curlycount = 0;
-static char *expr2_token_subst(char *mess);
+static char *expr2_token_subst(const char *mess);
 
 #line 1415 "ast_expr2f.c"
 
@@ -3229,11 +3229,11 @@
 };
 
 
-static char *expr2_token_subst(char *mess)
+static char *expr2_token_subst(const char *mess)
 {
 	/* calc a length, malloc, fill, and return; yyerror had better free it! */
 	int len=0,i;
-	char *p;
+	const char *p;
 	char *res, *s,*t;
 	int expr2_token_equivs_entries = sizeof(expr2_token_equivs1)/sizeof(char*);
 
@@ -3278,7 +3278,7 @@
 	char spacebuf[8000]; /* best safe than sorry */
 	char spacebuf2[8000]; /* best safe than sorry */
 	int i=0;
-	char *s2 = expr2_token_subst((char *)s);
+	char *s2 = expr2_token_subst(s);
 	spacebuf[0] = 0;
 	
 	for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' ';  /* uh... assuming yyg is defined, then I can use the yycolumn macro,

Modified: branches/1.4/main/cdr.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/cdr.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/cdr.c (original)
+++ branches/1.4/main/cdr.c Fri Sep 21 09:37:20 2007
@@ -1130,7 +1130,7 @@
 	}
 }
 
-static int submit_scheduled_batch(void *data)
+static int submit_scheduled_batch(const void *data)
 {
 	ast_cdr_submit_batch(0);
 	/* manually reschedule from this point in time */

Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Fri Sep 21 09:37:20 2007
@@ -1833,13 +1833,13 @@
 	ast_channel_unlock(chan);
 }
 
-static int generator_force(void *data)
+static int generator_force(const void *data)
 {
 	/* Called if generator doesn't have data */
 	void *tmp;
 	int res;
 	int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples);
-	struct ast_channel *chan = data;
+	struct ast_channel *chan = (struct ast_channel *)data;
 	tmp = chan->generatordata;
 	chan->generatordata = NULL;
 	generate = chan->generator->generate;
@@ -2057,7 +2057,7 @@
 	return ast_waitfordigit_full(c, ms, -1, -1);
 }
 
-int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data), void *data)
+int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *data), void *data)
 {
 	int res = -1;
 #ifdef HAVE_ZAPTEL
@@ -2253,7 +2253,7 @@
 			ioctl(chan->timingfd, ZT_TIMERACK, &blah);
 			if (chan->timingfunc) {
 				/* save a copy of func/data before unlocking the channel */
-				int (*func)(void *) = chan->timingfunc;
+				int (*func)(const void *) = chan->timingfunc;
 				void *data = chan->timingdata;
 				ast_channel_unlock(chan);
 				func(data);

Modified: branches/1.4/main/db1-ast/hash/hash.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/db1-ast/hash/hash.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/db1-ast/hash/hash.c (original)
+++ branches/1.4/main/db1-ast/hash/hash.c Fri Sep 21 09:37:20 2007
@@ -68,7 +68,7 @@
 static int   hash_seq __P((const DB *, DBT *, DBT *, u_int32_t));
 static int   hash_sync __P((const DB *, u_int32_t));
 static int   hdestroy __P((HTAB *));
-static HTAB *init_hash __P((HTAB *, const char *, HASHINFO *));
+static HTAB *init_hash __P((HTAB *, const char *, const HASHINFO *));
 static int   init_htab __P((HTAB *, int));
 #if BYTE_ORDER == LITTLE_ENDIAN
 static void  swap_header __P((HTAB *));
@@ -133,7 +133,7 @@
 		(void)fcntl(hashp->fp, F_SETFD, 1);
 	}
 	if (new_table) {
-		if (!(hashp = init_hash(hashp, file, (HASHINFO *)info)))
+		if (!(hashp = init_hash(hashp, file, info)))
 			RETURN_ERROR(errno, error1);
 	} else {
 		/* Table already exists */
@@ -280,7 +280,7 @@
 init_hash(hashp, file, info)
 	HTAB *hashp;
 	const char *file;
-	HASHINFO *info;
+	const HASHINFO *info;
 {
 #ifdef _STATBUF_ST_BLKSIZE
 	struct stat statbuf;

Modified: branches/1.4/main/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/dnsmgr.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/dnsmgr.c (original)
+++ branches/1.4/main/dnsmgr.c Fri Sep 21 09:37:20 2007
@@ -220,9 +220,9 @@
 	return NULL;
 }
 
-static int refresh_list(void *data)
-{
-	struct refresh_info *info = data;
+static int refresh_list(const void *data)
+{
+	struct refresh_info *info = (struct refresh_info *)data;
 	struct ast_dnsmgr_entry *entry;
 
 	/* if a refresh or reload is already in progress, exit now */

Modified: branches/1.4/main/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/file.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/file.c (original)
+++ branches/1.4/main/file.c Fri Sep 21 09:37:20 2007
@@ -620,7 +620,7 @@
 	FSREAD_SUCCESS_NOSCHED,
 };
 
-static int ast_fsread_audio(void *data);
+static int ast_fsread_audio(const void *data);
 
 static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
 {
@@ -659,9 +659,9 @@
 	return FSREAD_FAILURE;
 }
 
-static int ast_fsread_audio(void *data)
-{
-	struct ast_filestream *fs = data;
+static int ast_fsread_audio(const void *data)
+{
+	struct ast_filestream *fs = (struct ast_filestream *)data;
 	enum fsread_res res;
 
 	res = ast_readaudio_callback(fs);
@@ -672,7 +672,7 @@
 	return 0;
 }
 
-static int ast_fsread_video(void *data);
+static int ast_fsread_video(const void *data);
 
 static enum fsread_res ast_readvideo_callback(struct ast_filestream *s)
 {
@@ -698,9 +698,9 @@
 	return FSREAD_SUCCESS_SCHED;
 }
 
-static int ast_fsread_video(void *data)
-{
-	struct ast_filestream *fs = data;
+static int ast_fsread_video(const void *data)
+{
+	struct ast_filestream *fs = (struct ast_filestream *)data;
 	enum fsread_res res;
 
 	res = ast_readvideo_callback(fs);

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Fri Sep 21 09:37:20 2007
@@ -175,10 +175,10 @@
 };
 
 /* Forward declarations */
-static int ast_rtcp_write(void *data);
+static int ast_rtcp_write(const void *data);
 static void timeval2ntp(struct timeval tv, unsigned int *msw, unsigned int *lsw);
-static int ast_rtcp_write_sr(void *data);
-static int ast_rtcp_write_rr(void *data);
+static int ast_rtcp_write_sr(const void *data);
+static int ast_rtcp_write_rr(const void *data);
 static unsigned int ast_rtcp_calc_interval(struct ast_rtp *rtp);
 static int ast_rtp_senddigit_continuation(struct ast_rtp *rtp);
 int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit);
@@ -2307,9 +2307,9 @@
 }
 
 /*! \brief Send RTCP sender's report */
-static int ast_rtcp_write_sr(void *data)
-{
-	struct ast_rtp *rtp = data;
+static int ast_rtcp_write_sr(const void *data)
+{
+	struct ast_rtp *rtp = (struct ast_rtp *)data;
 	int res;
 	int len = 0;
 	struct timeval now;
@@ -2421,9 +2421,9 @@
 }
 
 /*! \brief Send RTCP recepient's report */
-static int ast_rtcp_write_rr(void *data)
-{
-	struct ast_rtp *rtp = data;
+static int ast_rtcp_write_rr(const void *data)
+{
+	struct ast_rtp *rtp = (struct ast_rtp *)data;
 	int res;
 	int len = 32;
 	unsigned int lost;
@@ -2520,9 +2520,9 @@
 /*! \brief Write and RTCP packet to the far end
  * \note Decide if we are going to send an SR (with Reception Block) or RR 
  * RR is sent if we have not sent any rtp packets in the previous interval */
-static int ast_rtcp_write(void *data)
-{
-	struct ast_rtp *rtp = data;
+static int ast_rtcp_write(const void *data)
+{
+	struct ast_rtp *rtp = (struct ast_rtp *)data;
 	int res;
 	
 	if (!rtp || !rtp->rtcp)

Modified: branches/1.4/main/sched.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/sched.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/main/sched.c (original)
+++ branches/1.4/main/sched.c Fri Sep 21 09:37:20 2007
@@ -56,7 +56,7 @@
 	struct timeval when;          /*!< Absolute time event should take place */
 	int resched;                  /*!< When to reschedule */
 	int variable;                 /*!< Use return value from callback to reschedule */
-	void *data;                   /*!< Data */
+	const void *data;             /*!< Data */
 	ast_sched_cb callback;        /*!< Callback */
 };
 
@@ -211,7 +211,7 @@
 /*! \brief
  * Schedule callback(data) to happen when ms into the future
  */
-int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable)
+int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable)
 {
 	struct sched *tmp;
 	int res = -1;
@@ -244,7 +244,7 @@
 	return res;
 }
 
-int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data)
+int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data)
 {
 	return ast_sched_add_variable(con, when, callback, data, 0);
 }

Modified: branches/1.4/pbx/ael/ael.tab.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/ael/ael.tab.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/pbx/ael/ael.tab.c (original)
+++ branches/1.4/pbx/ael/ael.tab.c Fri Sep 21 09:37:20 2007
@@ -199,7 +199,7 @@
 #ifdef AAL_ARGCHECK
 int ael_is_funcname(char *name);
 #endif
-static char *ael_token_subst(char *mess);
+static char *ael_token_subst(const char *mess);
 
 
 
@@ -3232,11 +3232,11 @@
 };
 
 
-static char *ael_token_subst(char *mess)
+static char *ael_token_subst(const char *mess)
 {
 	/* calc a length, malloc, fill, and return; yyerror had better free it! */
 	int len=0,i;
-	char *p;
+	const char *p;
 	char *res, *s,*t;
 	int token_equivs_entries = sizeof(token_equivs1)/sizeof(char*);
 
@@ -3277,7 +3277,7 @@
 
 void yyerror(YYLTYPE *locp, struct parse_io *parseio,  char const *s)
 {
-	char *s2 = ael_token_subst((char *)s);
+	char *s2 = ael_token_subst(s);
 	if (locp->first_line == locp->last_line) {
 		ast_log(LOG_ERROR, "==== File: %s, Line %d, Cols: %d-%d: Error: %s\n", my_file, locp->first_line, locp->first_column, locp->last_column, s2);
 	} else {

Modified: branches/1.4/pbx/ael/ael.y
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/ael/ael.y?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/pbx/ael/ael.y (original)
+++ branches/1.4/pbx/ael/ael.y Fri Sep 21 09:37:20 2007
@@ -46,7 +46,7 @@
 #ifdef AAL_ARGCHECK
 int ael_is_funcname(char *name);
 #endif
-static char *ael_token_subst(char *mess);
+static char *ael_token_subst(const char *mess);
 
 %}
 
@@ -705,11 +705,11 @@
 };
 
 
-static char *ael_token_subst(char *mess)
+static char *ael_token_subst(const char *mess)
 {
 	/* calc a length, malloc, fill, and return; yyerror had better free it! */
 	int len=0,i;
-	char *p;
+	const char *p;
 	char *res, *s,*t;
 	int token_equivs_entries = sizeof(token_equivs1)/sizeof(char*);
 
@@ -750,7 +750,7 @@
 
 void yyerror(YYLTYPE *locp, struct parse_io *parseio,  char const *s)
 {
-	char *s2 = ael_token_subst((char *)s);
+	char *s2 = ael_token_subst(s);
 	if (locp->first_line == locp->last_line) {
 		ast_log(LOG_ERROR, "==== File: %s, Line %d, Cols: %d-%d: Error: %s\n", my_file, locp->first_line, locp->first_column, locp->last_column, s2);
 	} else {

Modified: branches/1.4/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/pbx_dundi.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/pbx/pbx_dundi.c (original)
+++ branches/1.4/pbx/pbx_dundi.c Fri Sep 21 09:37:20 2007
@@ -1277,9 +1277,9 @@
 }
 
 /*! \note Called with the peers list already locked */
-static int do_register_expire(void *data)
-{
-	struct dundi_peer *peer = data;
+static int do_register_expire(const void *data)
+{
+	struct dundi_peer *peer = (struct dundi_peer *)data;
 	char eid_str[20];
 	ast_log(LOG_DEBUG, "Register expired for '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid));
 	peer->registerexpire = -1;
@@ -2954,12 +2954,11 @@
 		free(trans);
 }
 
-static int dundi_rexmit(void *data)
-{
-	struct dundi_packet *pack;
+static int dundi_rexmit(const void *data)
+{
+	struct dundi_packet *pack = (struct dundi_packet *)data;
 	int res;
 	AST_LIST_LOCK(&peers);
-	pack = data;
 	if (pack->retrans < 1) {
 		pack->retransid = -1;
 		if (!ast_test_flag(pack->parent, FLAG_ISQUAL))
@@ -3049,9 +3048,9 @@
 	return -1;
 }
 
-static int do_autokill(void *data)
-{
-	struct dundi_transaction *trans = data;
+static int do_autokill(const void *data)
+{
+	struct dundi_transaction *trans = (struct dundi_transaction *)data;
 	char eid_str[20];
 	ast_log(LOG_NOTICE, "Transaction to '%s' took too long to ACK, destroying\n", 
 		dundi_eid_to_str(eid_str, sizeof(eid_str), &trans->them_eid));
@@ -4023,10 +4022,10 @@
 }
 
 /* \note Called with the peers list already locked */
-static int do_register(void *data)
+static int do_register(const void *data)
 {
 	struct dundi_ie_data ied;
-	struct dundi_peer *peer = data;
+	struct dundi_peer *peer = (struct dundi_peer *)data;
 	char eid_str[20];
 	char eid_str2[20];
 	ast_log(LOG_DEBUG, "Register us as '%s' to '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->us_eid), dundi_eid_to_str(eid_str2, sizeof(eid_str2), &peer->eid));
@@ -4049,10 +4048,9 @@
 	return 0;
 }
 
-static int do_qualify(void *data)
-{
-	struct dundi_peer *peer;
-	peer = data;
+static int do_qualify(const void *data)
+{
+	struct dundi_peer *peer = (struct dundi_peer *)data;
 	peer->qualifyid = -1;
 	qualify_peer(peer, 0);
 	return 0;

Modified: branches/1.4/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_config_pgsql.c?view=diff&rev=83432&r1=83431&r2=83432
==============================================================================
--- branches/1.4/res/res_config_pgsql.c (original)
+++ branches/1.4/res/res_config_pgsql.c Fri Sep 21 09:37:20 2007
@@ -667,7 +667,7 @@
 		dbport = atoi(s);
 	}
 
-	if (dbhost && !(s = ast_variable_retrieve(config, "general", "dbsock"))) {
+	if (!ast_strlen_zero(dbhost) && !(s = ast_variable_retrieve(config, "general", "dbsock"))) {
 		ast_log(LOG_WARNING,
 				"Postgresql RealTime: No database socket found, using '/tmp/pgsql.sock' as default.\n");
 		strcpy(dbsock, "/tmp/pgsql.sock");
@@ -676,7 +676,7 @@
 	}
 	ast_config_destroy(config);
 
-	if (dbhost) {
+	if (!ast_strlen_zero(dbhost)) {
 		ast_log(LOG_DEBUG, "Postgresql RealTime Host: %s\n", dbhost);
 		ast_log(LOG_DEBUG, "Postgresql RealTime Port: %i\n", dbport);
 	} else {
@@ -702,7 +702,7 @@
 		pgsqlConn = NULL;
 	}
 

[... 66 lines stripped ...]



More information about the asterisk-commits mailing list