Ignore:
Timestamp:
Feb 4, 2014 1:13:02 PM (10 years ago)
Author:
bennylp
Message:

Misc (re #1630): fix gcc warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c

    r4724 r4729  
    11/* $Id$ */ 
    2 /*  
     2/* 
    33 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) 
    44 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> 
     
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1919 */ 
    2020 
     
    4848                continue; 
    4949 
    50             printf(" [%2d] <%.*s>  %.*s\n",  
    51                     ids[i]+1,  
     50            printf(" [%2d] <%.*s>  %.*s\n", 
     51                    ids[i]+1, 
    5252                    (int)info.status_text.slen, 
    53                     info.status_text.ptr,  
     53                    info.status_text.ptr, 
    5454                    (int)info.uri.slen, 
    5555                    info.uri.ptr); 
     
    6262 * Input URL. 
    6363 */ 
    64 static void ui_input_url(const char *title, char *buf, pj_size_t len,  
     64static void ui_input_url(const char *title, char *buf, pj_size_t len, 
    6565                         input_result *result) 
    6666{ 
     
    9898 
    9999    if (pj_isdigit(*buf) || *buf=='-') { 
    100          
     100 
    101101        unsigned i; 
    102          
     102 
    103103        if (*buf=='-') 
    104104            i = 1; 
     
    115115        result->nb_result = my_atoi(buf); 
    116116 
    117         if (result->nb_result >= 0 &&  
    118             result->nb_result <= (int)pjsua_get_buddy_count())  
     117        if (result->nb_result >= 0 && 
     118            result->nb_result <= (int)pjsua_get_buddy_count()) 
    119119        { 
    120120            return; 
     
    155155    if (!*buf) 
    156156        return PJ_FALSE; 
    157      
     157 
    158158    return PJ_TRUE; 
    159159} 
     
    170170 
    171171    if (!info.has_registration) { 
    172         pj_ansi_snprintf(buf, sizeof(buf), "%.*s",  
     172        pj_ansi_snprintf(buf, sizeof(buf), "%.*s", 
    173173                         (int)info.status_text.slen, 
    174174                         info.status_text.ptr); 
     
    186186    printf(" %c[%2d] %.*s: %s\n", (acc_id==current_acc?'*':' '), 
    187187           acc_id,  (int)info.acc_uri.slen, info.acc_uri.ptr, buf); 
    188     printf("       Online status: %.*s\n",  
     188    printf("       Online status: %.*s\n", 
    189189        (int)info.online_status_text.slen, 
    190190        info.online_status_text.ptr); 
     
    209209 
    210210    print_buddy_list(); 
    211      
     211 
    212212    //puts("Commands:"); 
    213213    puts("+=============================================================================+"); 
     
    386386                                             PJSUA_CALL_VID_STRM_ADD, NULL); 
    387387        } 
    388         else if (argc >= 3 &&  
     388        else if (argc >= 3 && 
    389389                 (strcmp(argv[2], "disable")==0 || strcmp(argv[2], "enable")==0)) 
    390390        { 
     
    514514                    vfd = pjmedia_format_get_video_format_detail(&cp.enc_fmt, 
    515515                                                                 PJ_TRUE); 
    516                     PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d",  
     516                    PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d", 
    517517                              (int)ci[i].codec_id.slen, ci[i].codec_id.ptr, 
    518518                              13-(int)ci[i].codec_id.slen, "                ", 
     
    591591/** UI Command **/ 
    592592static void ui_make_new_call() 
    593 {     
     593{ 
    594594    char buf[128]; 
    595595    pjsua_msg_data msg_data; 
     
    598598 
    599599    printf("(You currently have %d calls)\n", pjsua_call_get_count()); 
    600      
     600 
    601601    ui_input_url("Make call", buf, sizeof(buf), &result); 
    602602    if (result.nb_result != PJSUA_APP_NO_NB) { 
     
    620620    pjsua_msg_data_init(&msg_data); 
    621621    TEST_MULTIPART(&msg_data); 
    622     pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL,  
     622    pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL, 
    623623                         &msg_data, &current_call); 
    624624} 
     
    754754    } 
    755755 
    756     if (current_call == -1 ||  
     756    if (current_call == -1 || 
    757757        call_info.role != PJSIP_ROLE_UAS || 
    758758        call_info.state >= PJSIP_INV_STATE_CONNECTING) 
     
    779779 
    780780        if (st_code/100 == 3) { 
    781             if (!simple_input("Enter URL to be put in Contact",  
     781            if (!simple_input("Enter URL to be put in Contact", 
    782782                contact, sizeof(contact))) 
    783783                return; 
     
    790790        /* 
    791791        * Must check again! 
    792         * Call may have been disconnected while we're waiting for  
     792        * Call may have been disconnected while we're waiting for 
    793793        * keyboard input. 
    794794        */ 
     
    800800 
    801801        pjsua_call_answer2(current_call, &call_opt, st_code, NULL, &msg_data); 
    802     }     
     802    } 
    803803} 
    804804 
     
    832832 
    833833        pjsua_call_get_info(current_call, &call_info); 
    834         PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s",  
    835             (int)call_info.remote_info.slen,  
     834        PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s", 
     835            (int)call_info.remote_info.slen, 
    836836            call_info.remote_info.ptr)); 
    837837 
     
    912912    acc_cfg.cred_info[0].data = pj_str(passwd); 
    913913 
    914     acc_cfg.rtp_cfg = *rtp_cfg;     
     914    acc_cfg.rtp_cfg = *rtp_cfg; 
    915915    app_config_init_video(&acc_cfg); 
    916916 
     
    959959static void ui_call_hold() 
    960960{ 
    961     if (current_call != -1) {            
     961    if (current_call != -1) { 
    962962        pjsua_call_set_hold(current_call, NULL); 
    963963    } else { 
     
    974974static void ui_send_update() 
    975975{ 
    976     if (current_call != -1) {            
     976    if (current_call != -1) { 
    977977        pjsua_call_update2(current_call, &call_opt, NULL); 
    978978    } else { 
     
    10371037 
    10381038    new_prio = atoi(prio); 
    1039     if (new_prio < 0)  
     1039    if (new_prio < 0) 
    10401040        new_prio = 0; 
    1041     else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST)  
     1041    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST) 
    10421042        new_prio = PJMEDIA_CODEC_PRIO_HIGHEST; 
    10431043 
    1044     status = pjsua_codec_set_priority(pj_cstr(&id, codec),  
     1044    status = pjsua_codec_set_priority(pj_cstr(&id, codec), 
    10451045                                      (pj_uint8_t)new_prio); 
    10461046#if PJSUA_HAS_VIDEO 
    10471047    if (status != PJ_SUCCESS) { 
    1048         status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec),  
     1048        status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec), 
    10491049                                              (pj_uint8_t)new_prio); 
    10501050    } 
     
    11061106 
    11071107static void ui_call_transfer_replaces(pj_bool_t no_refersub) 
    1108 {         
     1108{ 
    11091109    if (current_call == -1) { 
    11101110        PJ_LOG(3,(THIS_FILE, "No current call")); 
     
    11791179        if (no_refersub) { 
    11801180            /* Add Refer-Sub: false in outgoing REFER request */ 
    1181             pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,  
     1181            pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB, 
    11821182                                           &STR_FALSE); 
    11831183            pj_list_push_back(&msg_data.hdr_list, &refer_sub); 
    11841184        } 
    11851185 
    1186         pjsua_call_xfer_replaces(call, dst_call,  
    1187                                  PJSUA_XFER_NO_REQUIRE_REPLACES,  
     1186        pjsua_call_xfer_replaces(call, dst_call, 
     1187                                 PJSUA_XFER_NO_REQUIRE_REPLACES, 
    11881188                                 &msg_data); 
    11891189    } 
     
    12021202        char buf[128]; 
    12031203 
    1204         if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,  
     1204        if (!simple_input("DTMF strings to send (0-9*#A-B)", buf, 
    12051205            sizeof(buf))) 
    12061206        { 
     
    12351235        char buf[128]; 
    12361236 
    1237         if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,  
     1237        if (!simple_input("DTMF strings to send (0-9*#A-B)", buf, 
    12381238            sizeof(buf))) 
    12391239        { 
     
    12601260            msg_data.msg_body = pj_str(body); 
    12611261 
    1262             status = pjsua_call_send_request(current_call, &SIP_INFO,  
     1262            status = pjsua_call_send_request(current_call, &SIP_INFO, 
    12631263                &msg_data); 
    12641264            if (status != PJ_SUCCESS) { 
     
    13021302                return; 
    13031303            } 
    1304         } else {             
     1304        } else { 
    13051305            pjsua_buddy_info binfo; 
    13061306            pjsua_buddy_get_info(result.nb_result-1, &binfo); 
     
    13271327        pj_str_t method = pj_str(text); 
    13281328        pjsua_call_send_request(current_call, &method, NULL); 
    1329     }        
     1329    } 
    13301330} 
    13311331 
     
    13621362        delay = pj_strtoul(&tmp); 
    13631363        if (delay < 0) delay = 0; 
    1364         pj_thread_sleep(delay);          
     1364        pj_thread_sleep(delay); 
    13651365    } 
    13661366} 
     
    14291429    pj_bool_t online_status; 
    14301430    pjrpid_element elem; 
    1431     int i, choice; 
     1431    int choice; 
     1432    unsigned i; 
    14321433 
    14331434    enum { 
     
    14501451    printf("\n" 
    14511452           "Choices:\n"); 
    1452     for (i=0; i<PJ_ARRAY_SIZE(opts); ++i) { 
     1453    for (i=0; i<(unsigned)PJ_ARRAY_SIZE(opts); ++i) { 
    14531454        printf("  %d  %s\n", opts[i].id+1, opts[i].name); 
    14541455    } 
     
    15251526            pj_ansi_strcat(txlist, s); 
    15261527        } 
    1527         printf("Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n",  
    1528                info.slot_id,  
     1528        printf("Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n", 
     1529               info.slot_id, 
    15291530               info.clock_rate/1000, 
    15301531               info.samples_per_frame*1000/info.channel_count/info.clock_rate, 
    15311532               info.channel_count, 
    1532                (int)info.name.slen,  
     1533               (int)info.name.slen, 
    15331534               info.name.ptr, 
    15341535               txlist); 
     
    16091610        PJ_LOG(1,(THIS_FILE, "Error: not enough buffer")); 
    16101611    else 
    1611         PJ_LOG(3,(THIS_FILE, "Dumping configuration (%d bytes):\n%s\n",  
    1612                   len, settings));       
     1612        PJ_LOG(3,(THIS_FILE, "Dumping configuration (%d bytes):\n%s\n", 
     1613                  len, settings)); 
    16131614} 
    16141615 
     
    16551656            PJ_LOG(1,(THIS_FILE, "Call %d has gone", current_call)); 
    16561657        } else if (menuin[1] == 'a') { 
    1657             pjsua_call_process_redirect(current_call,  
     1658            pjsua_call_process_redirect(current_call, 
    16581659                PJSIP_REDIRECT_ACCEPT_REPLACE); 
    16591660        } else if (menuin[1] == 'A') { 
    1660             pjsua_call_process_redirect(current_call,  
     1661            pjsua_call_process_redirect(current_call, 
    16611662                PJSIP_REDIRECT_ACCEPT); 
    16621663        } else if (menuin[1] == 'r') { 
     
    16741675 */ 
    16751676void legacy_main() 
    1676 {     
    1677     char menuin[80];     
    1678     char buf[128];     
     1677{ 
     1678    char menuin[80]; 
     1679    char buf[128]; 
    16791680 
    16801681    keystroke_help(); 
     
    16861687 
    16871688        if (fgets(menuin, sizeof(menuin), stdin) == NULL) { 
    1688             /*  
     1689            /* 
    16891690             * Be friendly to users who redirect commands into 
    16901691             * program, when file ends, resume with kbd. 
     
    17861787            break; 
    17871788 
    1788         case 'v':            
     1789        case 'v': 
    17891790#if PJSUA_HAS_VIDEO 
    17901791            if (menuin[1]=='i' && menuin[2]=='d' && menuin[3]==' ') { 
     
    18691870            ui_register(menuin); 
    18701871            break; 
    1871              
     1872 
    18721873        case 't': 
    18731874            ui_toggle_state(); 
     
    18911892 
    18921893        case 'V': 
    1893             /* Adjust audio volume */        
     1894            /* Adjust audio volume */ 
    18941895            ui_adjust_volume(); 
    18951896            break; 
     
    18971898        case 'd': 
    18981899            if (menuin[1] == 'c') { 
    1899                 ui_dump_configuration();         
     1900                ui_dump_configuration(); 
    19001901            } else if (menuin[1] == 'q') { 
    19011902                ui_dump_call_quality(); 
    1902             } else {             
     1903            } else { 
    19031904                ui_app_dump(menuin[1]=='d'); 
    19041905            } 
     
    19071908        case 'f': 
    19081909            if (simple_input("Enter output filename", buf, sizeof(buf))) { 
    1909                 ui_write_settings();             
     1910                ui_write_settings(); 
    19101911            } 
    19111912            break; 
     
    19161917            goto on_exit; 
    19171918 
    1918         case 'R':            
     1919        case 'R': 
    19191920            ui_call_redirect(menuin); 
    19201921            break; 
Note: See TracChangeset for help on using the changeset viewer.