Author: Tzafrir Cohen <tzafrir@debian.org>
Description: fix gcc build warnings. Mostly "set but not used"

--- a/pjlib/src/pjlib-test/activesock.c
+++ b/pjlib/src/pjlib-test/activesock.c
@@ -101,7 +101,6 @@ static pj_status_t udp_echo_srv_create(p
     struct udp_echo_srv *srv;
     pj_sock_t sock_fd = PJ_INVALID_SOCKET;
     pj_sockaddr addr;
-    int addr_len;
     pj_activesock_cb activesock_cb;
     pj_status_t status;
 
@@ -109,7 +108,6 @@ static pj_status_t udp_echo_srv_create(p
     srv->echo_enabled = enable_echo;
 
     pj_sockaddr_in_init(&addr.ipv4, NULL, 0);
-    addr_len = sizeof(addr);
 
     pj_bzero(&activesock_cb, sizeof(activesock_cb));
     activesock_cb.on_data_recvfrom = &udp_echo_srv_on_data_recvfrom;
--- a/pjlib/src/pjlib-test/test.c
+++ b/pjlib/src/pjlib-test/test.c
@@ -215,10 +215,9 @@ on_return:
 
 int test_main(void)
 {
-    int i;
     PJ_USE_EXCEPTION;
 
-    i = pj_AF_INET();
+    pj_AF_INET();
 
     PJ_TRY {
         return test_inner();
--- a/pjlib-util/src/pjlib-util/dns.c
+++ b/pjlib-util/src/pjlib-util/dns.c
@@ -59,7 +59,7 @@ PJ_DEF(pj_status_t) pj_dns_make_query( v
 				       int qtype,
 				       const pj_str_t *name)
 {
-    pj_uint8_t *query, *p = (pj_uint8_t*)packet;
+    pj_uint8_t *p = (pj_uint8_t*)packet;
     const char *startlabel, *endlabel, *endname;
     unsigned d;
 
@@ -80,7 +80,7 @@ PJ_DEF(pj_status_t) pj_dns_make_query( v
     write16(p+4, (pj_uint16_t)1);
 
     /* Initialize query */
-    query = p = ((pj_uint8_t*)packet)+sizeof(pj_dns_hdr);
+    p = ((pj_uint8_t*)packet)+sizeof(pj_dns_hdr);
 
     /* Tokenize name */
     startlabel = endlabel = name->ptr;
--- a/pjnath/src/pjnath/stun_msg.c
+++ b/pjnath/src/pjnath/stun_msg.c
@@ -2300,7 +2300,6 @@ PJ_DEF(pj_status_t) pj_stun_msg_decode(p
 {
     
     pj_stun_msg *msg;
-    unsigned uattr_cnt;
     const pj_uint8_t *start_pdu = pdu;
     pj_bool_t has_msg_int = PJ_FALSE;
     pj_bool_t has_fingerprint = PJ_FALSE;
@@ -2339,7 +2338,6 @@ PJ_DEF(pj_status_t) pj_stun_msg_decode(p
 	p_response = NULL;
 
     /* Parse attributes */
-    uattr_cnt = 0;
     while (pdu_len >= 4) {
 	unsigned attr_type, attr_val_len;
 	const struct attr_desc *adesc;
--- a/pjnath/src/pjnath/stun_sock.c
+++ b/pjnath/src/pjnath/stun_sock.c
@@ -907,9 +907,8 @@ static pj_bool_t on_data_recvfrom(pj_act
 
 process_app_data:
     if (stun_sock->cb.on_rx_data) {
-	pj_bool_t ret;
 
-	ret = (*stun_sock->cb.on_rx_data)(stun_sock, data, size,
+	(*stun_sock->cb.on_rx_data)(stun_sock, data, size,
 					  src_addr, addr_len);
 	status = pj_grp_lock_release(stun_sock->grp_lock);
 	return status!=PJ_EGONE ? PJ_TRUE : PJ_FALSE;
--- a/pjmedia/src/pjmedia/rtcp.c
+++ b/pjmedia/src/pjmedia/rtcp.c
@@ -286,7 +286,6 @@ PJ_DEF(void) pjmedia_rtcp_rx_rtp2(pjmedi
     pj_uint32_t arrival;
     pj_int32_t transit;
     pjmedia_rtp_status seq_st;
-    unsigned last_seq;
 
 #if !defined(PJMEDIA_HAS_RTCP_XR) || (PJMEDIA_HAS_RTCP_XR == 0)
     PJ_UNUSED_ARG(discarded);
@@ -301,7 +300,6 @@ PJ_DEF(void) pjmedia_rtcp_rx_rtp2(pjmedi
     sess->stat.rx.bytes += payload;
 
     /* Process the RTP packet. */
-    last_seq = sess->seq_ctrl.max_seq;
     pjmedia_rtp_seq_update(&sess->seq_ctrl, (pj_uint16_t)seq, &seq_st);
 
     if (seq_st.status.flag.restart) {
@@ -806,7 +804,6 @@ PJ_DEF(void) pjmedia_rtcp_build_rtcp(pjm
 				     void **ret_p_pkt, int *len)
 {
     pj_uint32_t expected, expected_interval, received_interval, lost_interval;
-    pjmedia_rtcp_common *common;
     pjmedia_rtcp_sr *sr;
     pjmedia_rtcp_rr *rr;
     pj_timestamp ts_now;
@@ -827,7 +824,6 @@ PJ_DEF(void) pjmedia_rtcp_build_rtcp(pjm
 	/* So we should send RTCP SR */
 	*ret_p_pkt = (void*) &sess->rtcp_sr_pkt;
 	*len = sizeof(pjmedia_rtcp_sr_pkt);
-	common = &sess->rtcp_sr_pkt.common;
 	rr = &sess->rtcp_sr_pkt.rr;
 	sr = &sess->rtcp_sr_pkt.sr;
 
@@ -858,7 +854,6 @@ PJ_DEF(void) pjmedia_rtcp_build_rtcp(pjm
 	/* We should send RTCP RR then */
 	*ret_p_pkt = (void*) &sess->rtcp_rr_pkt;
 	*len = sizeof(pjmedia_rtcp_rr_pkt);
-	common = &sess->rtcp_rr_pkt.common;
 	rr = &sess->rtcp_rr_pkt.rr;
 	sr = NULL;
     }
--- a/pjmedia/src/pjmedia/sdp_neg.c
+++ b/pjmedia/src/pjmedia/sdp_neg.c
@@ -1033,7 +1033,6 @@ static pj_status_t match_offer(pj_pool_t
 {
     unsigned i;
     pj_bool_t master_has_codec = 0,
-	      master_has_telephone_event = 0,
 	      master_has_other = 0,
 	      found_matching_codec = 0,
 	      found_matching_telephone_event = 0,
@@ -1129,7 +1128,6 @@ static pj_status_t match_offer(pj_pool_t
 		pjmedia_sdp_attr_get_rtpmap(a, &or_);
 
 		if (!pj_stricmp2(&or_.enc_name, "telephone-event")) {
-		    master_has_telephone_event = 1;
 		    if (found_matching_telephone_event)
 			continue;
 		    is_codec = 0;
--- a/pjmedia/src/test/codec_vectors.c
+++ b/pjmedia/src/test/codec_vectors.c
@@ -125,9 +125,7 @@ static int codec_test_encode(pjmedia_cod
 	}
 
 	if (out_frame.size) {
-	    int cnt;
-
-	    cnt = fwrite(out_frame.buf, out_frame.size, 1, output);
+	    fwrite(out_frame.buf, out_frame.size, 1, output);
 
 	    if (encoded_frame_len == 0)
 		encoded_frame_len = out_frame.size;
--- a/pjsip/src/pjsip/sip_transport_udp.c
+++ b/pjsip/src/pjsip/sip_transport_udp.c
@@ -619,11 +619,10 @@ static pj_status_t register_to_ioqueue(s
 /* Start ioqueue asynchronous reading to all rdata */
 static pj_status_t start_async_read(struct udp_transport *tp)
 {
-    pj_ioqueue_t *ioqueue;
     int i;
     pj_status_t status;
 
-    ioqueue = pjsip_endpt_get_ioqueue(tp->base.endpt);
+    pjsip_endpt_get_ioqueue(tp->base.endpt);
 
     /* Start reading the ioqueue. */
     for (i=0; i<tp->rdata_cnt; ++i) {
--- a/pjsip/src/pjsip/sip_transaction.c
+++ b/pjsip/src/pjsip/sip_transaction.c
@@ -270,10 +270,9 @@ static pj_status_t create_tsx_key_2543(
 			                const pjsip_rx_data *rdata )
 {
 #define SEPARATOR   '$'
-    char *key, *p, *end;
+    char *key, *p;
     int len;
     pj_size_t len_required;
-    pjsip_uri *req_uri;
     pj_str_t *host;
 
     PJ_ASSERT_RETURN(pool && str && method && rdata, PJ_EINVAL);
@@ -283,7 +282,7 @@ static pj_status_t create_tsx_key_2543(
     PJ_ASSERT_RETURN(rdata->msg_info.from, PJSIP_EMISSINGHDR);
 
     host = &rdata->msg_info.via->sent_by.host;
-    req_uri = (pjsip_uri*)rdata->msg_info.msg->line.req.uri;
+    (pjsip_uri*)rdata->msg_info.msg->line.req.uri;
 
     /* Calculate length required. */
     len_required = 9 +			    /* CSeq number */
@@ -293,7 +292,6 @@ static pj_status_t create_tsx_key_2543(
 		   9 +			    /* Via port. */
 		   16;			    /* Separator+Allowance. */
     key = p = (char*) pj_pool_alloc(pool, len_required);
-    end = p + len_required;
 
     /* Add role. */
     *p++ = (char)(role==PJSIP_ROLE_UAC ? 'c' : 's');
@@ -1707,7 +1705,6 @@ PJ_DEF(void) pjsip_tsx_recv_msg( pjsip_t
 {
     pjsip_event event;
     struct tsx_lock_data lck;
-    pj_status_t status;
 
     PJ_LOG(5,(tsx->obj_name, "Incoming %s in state %s", 
 	      pjsip_rx_data_get_info(rdata), state_str[tsx->state]));
@@ -1721,7 +1718,7 @@ PJ_DEF(void) pjsip_tsx_recv_msg( pjsip_t
 
     /* Dispatch to transaction. */
     lock_tsx(tsx, &lck);
-    status = (*tsx->state_handler)(tsx, &event);
+    (*tsx->state_handler)(tsx, &event);
     unlock_tsx(tsx, &lck);
 
     pj_log_pop_indent();
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -4461,12 +4461,9 @@ static void pjsua_call_on_tsx_state_chan
 	 * Incoming MESSAGE request!
 	 */
 	pjsip_rx_data *rdata;
-	pjsip_msg *msg;
 	pjsip_accept_hdr *accept_hdr;
-	pj_status_t status;
 
 	rdata = e->body.tsx_state.src.rdata;
-	msg = rdata->msg_info.msg;
 
 	/* Request MUST have message body, with Content-Type equal to
 	 * "text/plain".
@@ -4486,7 +4483,7 @@ static void pjsua_call_on_tsx_state_chan
 	/* Respond with 200 first, so that remote doesn't retransmit in case
 	 * the UI takes too long to process the message. 
 	 */
-	status = pjsip_dlg_respond( inv->dlg, rdata, 200, NULL, NULL, NULL);
+	pjsip_dlg_respond( inv->dlg, rdata, 200, NULL, NULL, NULL);
 
 	/* Process MESSAGE request */
 	pjsua_im_process_pager(call->index, &inv->dlg->remote.info_str,
--- a/pjsip/src/pjsua-lib/pjsua_im.c
+++ b/pjsip/src/pjsua-lib/pjsua_im.c
@@ -274,7 +274,6 @@ static pj_bool_t im_on_rx_request(pjsip_
     pj_str_t from, to;
     pjsip_accept_hdr *accept_hdr;
     pjsip_msg *msg;
-    pj_status_t status;
 
     msg = rdata->msg_info.msg;
 
@@ -306,7 +305,7 @@ static pj_bool_t im_on_rx_request(pjsip_
     /* Respond with 200 first, so that remote doesn't retransmit in case
      * the UI takes too long to process the message. 
      */
-    status = pjsip_endpt_respond( pjsua_var.endpt, NULL, rdata, 200, NULL,
+    pjsip_endpt_respond( pjsua_var.endpt, NULL, rdata, 200, NULL,
 				  NULL, NULL, NULL);
 
     /* For the source URI, we use Contact header if present, since
--- a/pjsip/src/test/msg_err_test.c
+++ b/pjsip/src/test/msg_err_test.c
@@ -81,11 +81,10 @@ int msg_err_test(void)
 
     for (i=0; i<PJ_ARRAY_SIZE(test_entries); ++i) {
 	pjsip_parser_err_report err_list, *e;
-	pjsip_msg *msg;
 
 	PJ_LOG(3,(THIS_FILE, "  Parsing msg %d", i));
 	pj_list_init(&err_list);
-	msg = pjsip_parse_msg(pool, test_entries[i].msg,
+	pjsip_parse_msg(pool, test_entries[i].msg,
 			      strlen(test_entries[i].msg), &err_list);
 
 	e = err_list.next;
--- a/pjsip/src/test/regc_test.c
+++ b/pjsip/src/test/regc_test.c
@@ -542,7 +542,7 @@ static int update_test(const pj_str_t *r
 
     pjsip_regc *regc;
     pjsip_contact_hdr *h1, *h2;
-    pjsip_sip_uri *u1, *u2;
+    pjsip_sip_uri *u1;
     unsigned i;
     pj_status_t status;
     pjsip_tx_data *tdata = NULL;
@@ -599,7 +599,7 @@ static int update_test(const pj_str_t *r
     }
 
     u1 = (pjsip_sip_uri*) pjsip_uri_get_uri(h1->uri);
-    u2 = (pjsip_sip_uri*) pjsip_uri_get_uri(h2->uri);
+    (pjsip_sip_uri*) pjsip_uri_get_uri(h2->uri);
 
     if (*u1->host.ptr == 'a') {
 	if (h1->expires != 0) {
