Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c	(revision 4724)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c	(revision 4729)
@@ -1,4 +1,4 @@
 /* $Id$ */
-/* 
+/*
  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -16,5 +16,5 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -48,8 +48,8 @@
 		continue;
 
-	    printf(" [%2d] <%.*s>  %.*s\n", 
-		    ids[i]+1, 
+	    printf(" [%2d] <%.*s>  %.*s\n",
+		    ids[i]+1,
 		    (int)info.status_text.slen,
-		    info.status_text.ptr, 
+		    info.status_text.ptr,
 		    (int)info.uri.slen,
 		    info.uri.ptr);
@@ -62,5 +62,5 @@
  * Input URL.
  */
-static void ui_input_url(const char *title, char *buf, pj_size_t len, 
+static void ui_input_url(const char *title, char *buf, pj_size_t len,
 			 input_result *result)
 {
@@ -98,7 +98,7 @@
 
     if (pj_isdigit(*buf) || *buf=='-') {
-	
+
 	unsigned i;
-	
+
 	if (*buf=='-')
 	    i = 1;
@@ -115,6 +115,6 @@
 	result->nb_result = my_atoi(buf);
 
-	if (result->nb_result >= 0 && 
-	    result->nb_result <= (int)pjsua_get_buddy_count()) 
+	if (result->nb_result >= 0 &&
+	    result->nb_result <= (int)pjsua_get_buddy_count())
 	{
 	    return;
@@ -155,5 +155,5 @@
     if (!*buf)
 	return PJ_FALSE;
-    
+
     return PJ_TRUE;
 }
@@ -170,5 +170,5 @@
 
     if (!info.has_registration) {
-	pj_ansi_snprintf(buf, sizeof(buf), "%.*s", 
+	pj_ansi_snprintf(buf, sizeof(buf), "%.*s",
 			 (int)info.status_text.slen,
 			 info.status_text.ptr);
@@ -186,5 +186,5 @@
     printf(" %c[%2d] %.*s: %s\n", (acc_id==current_acc?'*':' '),
 	   acc_id,  (int)info.acc_uri.slen, info.acc_uri.ptr, buf);
-    printf("       Online status: %.*s\n", 
+    printf("       Online status: %.*s\n",
 	(int)info.online_status_text.slen,
 	info.online_status_text.ptr);
@@ -209,5 +209,5 @@
 
     print_buddy_list();
-    
+
     //puts("Commands:");
     puts("+=============================================================================+");
@@ -386,5 +386,5 @@
 	                                     PJSUA_CALL_VID_STRM_ADD, NULL);
 	}
-	else if (argc >= 3 && 
+	else if (argc >= 3 &&
 		 (strcmp(argv[2], "disable")==0 || strcmp(argv[2], "enable")==0))
 	{
@@ -514,5 +514,5 @@
 		    vfd = pjmedia_format_get_video_format_detail(&cp.enc_fmt,
 								 PJ_TRUE);
-		    PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d", 
+		    PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d",
 			      (int)ci[i].codec_id.slen, ci[i].codec_id.ptr,
 			      13-(int)ci[i].codec_id.slen, "                ",
@@ -591,5 +591,5 @@
 /** UI Command **/
 static void ui_make_new_call()
-{    
+{
     char buf[128];
     pjsua_msg_data msg_data;
@@ -598,5 +598,5 @@
 
     printf("(You currently have %d calls)\n", pjsua_call_get_count());
-    
+
     ui_input_url("Make call", buf, sizeof(buf), &result);
     if (result.nb_result != PJSUA_APP_NO_NB) {
@@ -620,5 +620,5 @@
     pjsua_msg_data_init(&msg_data);
     TEST_MULTIPART(&msg_data);
-    pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL, 
+    pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL,
 			 &msg_data, &current_call);
 }
@@ -754,5 +754,5 @@
     }
 
-    if (current_call == -1 || 
+    if (current_call == -1 ||
 	call_info.role != PJSIP_ROLE_UAS ||
 	call_info.state >= PJSIP_INV_STATE_CONNECTING)
@@ -779,5 +779,5 @@
 
 	if (st_code/100 == 3) {
-	    if (!simple_input("Enter URL to be put in Contact", 
+	    if (!simple_input("Enter URL to be put in Contact",
 		contact, sizeof(contact)))
 		return;
@@ -790,5 +790,5 @@
 	/*
 	* Must check again!
-	* Call may have been disconnected while we're waiting for 
+	* Call may have been disconnected while we're waiting for
 	* keyboard input.
 	*/
@@ -800,5 +800,5 @@
 
 	pjsua_call_answer2(current_call, &call_opt, st_code, NULL, &msg_data);
-    }    
+    }
 }
 
@@ -832,6 +832,6 @@
 
 	pjsua_call_get_info(current_call, &call_info);
-	PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s", 
-	    (int)call_info.remote_info.slen, 
+	PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s",
+	    (int)call_info.remote_info.slen,
 	    call_info.remote_info.ptr));
 
@@ -912,5 +912,5 @@
     acc_cfg.cred_info[0].data = pj_str(passwd);
 
-    acc_cfg.rtp_cfg = *rtp_cfg;    
+    acc_cfg.rtp_cfg = *rtp_cfg;
     app_config_init_video(&acc_cfg);
 
@@ -959,5 +959,5 @@
 static void ui_call_hold()
 {
-    if (current_call != -1) {		
+    if (current_call != -1) {
 	pjsua_call_set_hold(current_call, NULL);
     } else {
@@ -974,5 +974,5 @@
 static void ui_send_update()
 {
-    if (current_call != -1) {		
+    if (current_call != -1) {
 	pjsua_call_update2(current_call, &call_opt, NULL);
     } else {
@@ -1037,14 +1037,14 @@
 
     new_prio = atoi(prio);
-    if (new_prio < 0) 
+    if (new_prio < 0)
 	new_prio = 0;
-    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST) 
+    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST)
 	new_prio = PJMEDIA_CODEC_PRIO_HIGHEST;
 
-    status = pjsua_codec_set_priority(pj_cstr(&id, codec), 
+    status = pjsua_codec_set_priority(pj_cstr(&id, codec),
 				      (pj_uint8_t)new_prio);
 #if PJSUA_HAS_VIDEO
     if (status != PJ_SUCCESS) {
-	status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec), 
+	status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec),
 					      (pj_uint8_t)new_prio);
     }
@@ -1106,5 +1106,5 @@
 
 static void ui_call_transfer_replaces(pj_bool_t no_refersub)
-{        
+{
     if (current_call == -1) {
 	PJ_LOG(3,(THIS_FILE, "No current call"));
@@ -1179,11 +1179,11 @@
 	if (no_refersub) {
 	    /* Add Refer-Sub: false in outgoing REFER request */
-	    pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB, 
+	    pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
 					   &STR_FALSE);
 	    pj_list_push_back(&msg_data.hdr_list, &refer_sub);
 	}
 
-	pjsua_call_xfer_replaces(call, dst_call, 
-				 PJSUA_XFER_NO_REQUIRE_REPLACES, 
+	pjsua_call_xfer_replaces(call, dst_call,
+				 PJSUA_XFER_NO_REQUIRE_REPLACES,
 				 &msg_data);
     }
@@ -1202,5 +1202,5 @@
 	char buf[128];
 
-	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf, 
+	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,
 	    sizeof(buf)))
 	{
@@ -1235,5 +1235,5 @@
 	char buf[128];
 
-	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf, 
+	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,
 	    sizeof(buf)))
 	{
@@ -1260,5 +1260,5 @@
 	    msg_data.msg_body = pj_str(body);
 
-	    status = pjsua_call_send_request(current_call, &SIP_INFO, 
+	    status = pjsua_call_send_request(current_call, &SIP_INFO,
 		&msg_data);
 	    if (status != PJ_SUCCESS) {
@@ -1302,5 +1302,5 @@
 		return;
 	    }
-	} else {	    
+	} else {
 	    pjsua_buddy_info binfo;
 	    pjsua_buddy_get_info(result.nb_result-1, &binfo);
@@ -1327,5 +1327,5 @@
 	pj_str_t method = pj_str(text);
 	pjsua_call_send_request(current_call, &method, NULL);
-    }	    
+    }
 }
 
@@ -1362,5 +1362,5 @@
 	delay = pj_strtoul(&tmp);
 	if (delay < 0) delay = 0;
-	pj_thread_sleep(delay);		
+	pj_thread_sleep(delay);
     }
 }
@@ -1429,5 +1429,6 @@
     pj_bool_t online_status;
     pjrpid_element elem;
-    int i, choice;
+    int choice;
+    unsigned i;
 
     enum {
@@ -1450,5 +1451,5 @@
     printf("\n"
 	   "Choices:\n");
-    for (i=0; i<PJ_ARRAY_SIZE(opts); ++i) {
+    for (i=0; i<(unsigned)PJ_ARRAY_SIZE(opts); ++i) {
 	printf("  %d  %s\n", opts[i].id+1, opts[i].name);
     }
@@ -1525,10 +1526,10 @@
 	    pj_ansi_strcat(txlist, s);
 	}
-	printf("Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n", 
-	       info.slot_id, 
+	printf("Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n",
+	       info.slot_id,
 	       info.clock_rate/1000,
 	       info.samples_per_frame*1000/info.channel_count/info.clock_rate,
 	       info.channel_count,
-	       (int)info.name.slen, 
+	       (int)info.name.slen,
 	       info.name.ptr,
 	       txlist);
@@ -1609,6 +1610,6 @@
 	PJ_LOG(1,(THIS_FILE, "Error: not enough buffer"));
     else
-	PJ_LOG(3,(THIS_FILE, "Dumping configuration (%d bytes):\n%s\n",	
-		  len, settings));	
+	PJ_LOG(3,(THIS_FILE, "Dumping configuration (%d bytes):\n%s\n",
+		  len, settings));
 }
 
@@ -1655,8 +1656,8 @@
 	    PJ_LOG(1,(THIS_FILE, "Call %d has gone", current_call));
 	} else if (menuin[1] == 'a') {
-	    pjsua_call_process_redirect(current_call, 
+	    pjsua_call_process_redirect(current_call,
 		PJSIP_REDIRECT_ACCEPT_REPLACE);
 	} else if (menuin[1] == 'A') {
-	    pjsua_call_process_redirect(current_call, 
+	    pjsua_call_process_redirect(current_call,
 		PJSIP_REDIRECT_ACCEPT);
 	} else if (menuin[1] == 'r') {
@@ -1674,7 +1675,7 @@
  */
 void legacy_main()
-{    
-    char menuin[80];    
-    char buf[128];    
+{
+    char menuin[80];
+    char buf[128];
 
     keystroke_help();
@@ -1686,5 +1687,5 @@
 
 	if (fgets(menuin, sizeof(menuin), stdin) == NULL) {
-	    /* 
+	    /*
 	     * Be friendly to users who redirect commands into
 	     * program, when file ends, resume with kbd.
@@ -1786,5 +1787,5 @@
 	    break;
 
-	case 'v':	    
+	case 'v':
 #if PJSUA_HAS_VIDEO
 	    if (menuin[1]=='i' && menuin[2]=='d' && menuin[3]==' ') {
@@ -1869,5 +1870,5 @@
 	    ui_register(menuin);
 	    break;
-	    
+
 	case 't':
 	    ui_toggle_state();
@@ -1891,5 +1892,5 @@
 
 	case 'V':
-	    /* Adjust audio volume */	    
+	    /* Adjust audio volume */
 	    ui_adjust_volume();
 	    break;
@@ -1897,8 +1898,8 @@
 	case 'd':
 	    if (menuin[1] == 'c') {
-		ui_dump_configuration();	
+		ui_dump_configuration();
 	    } else if (menuin[1] == 'q') {
 		ui_dump_call_quality();
-	    } else {		
+	    } else {
 		ui_app_dump(menuin[1]=='d');
 	    }
@@ -1907,5 +1908,5 @@
 	case 'f':
 	    if (simple_input("Enter output filename", buf, sizeof(buf))) {
-		ui_write_settings();		
+		ui_write_settings();
 	    }
 	    break;
@@ -1916,5 +1917,5 @@
 	    goto on_exit;
 
-	case 'R':	    
+	case 'R':
 	    ui_call_redirect(menuin);
 	    break;
