Changeset 2408 for pjproject/trunk


Ignore:
Timestamp:
Jan 1, 2009 10:08:21 PM (15 years ago)
Author:
bennylp
Message:

Fixed gcc-4.3.2 warnings with the warn_unused_result flag in some APIs

Location:
pjproject/trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/src/pjlib-util-test/main.c

    r2394 r2408  
    5555 
    5656        puts("Press ENTER to quit"); 
    57         fgets(s, sizeof(s), stdin); 
     57        if (fgets(s, sizeof(s), stdin) == NULL) 
     58            return rc; 
    5859    } 
    5960 
  • pjproject/trunk/pjlib/src/pjlib-test/main.c

    r2394 r2408  
    9999        puts(""); 
    100100        puts("Press <ENTER> to exit"); 
    101         fgets(s, sizeof(s), stdin); 
     101        if (!fgets(s, sizeof(s), stdin)) 
     102            return rc; 
    102103    } 
    103104 
  • pjproject/trunk/pjmedia/src/test/main.c

    r2394 r2408  
    4040    if (argc == 2 && argv[1][0]=='-' && argv[1][1]=='i') { 
    4141        puts("\nPress <ENTER> to quit"); 
    42         fgets(s, sizeof(s), stdin); 
     42        if (fgets(s, sizeof(s), stdin) == NULL) 
     43            return rc; 
    4344    } 
    4445 
  • pjproject/trunk/pjmedia/src/test/rtp_test.c

    r2394 r2408  
    3333    pjmedia_rtp_session_init (&rtp, 4, 0x12345678); 
    3434    pjmedia_rtp_encode_rtp (&rtp, 4, 0, 0, 160, &rtphdr, &hdrlen); 
    35     fwrite (rtphdr, hdrlen, 1, fhnd); 
     35    if (fwrite (rtphdr, hdrlen, 1, fhnd) != 1) { 
     36        fclose(fhnd); 
     37        return -1; 
     38    } 
    3639    fclose(fhnd); 
    3740    return 0; 
  • pjproject/trunk/pjnath/src/pjnath-test/main.c

    r2394 r2408  
    5454 
    5555        puts("Press <ENTER> to exit"); 
    56         fgets(buf, sizeof(buf), stdin); 
     56        if (fgets(buf, sizeof(buf), stdin) == NULL) 
     57            return rc; 
    5758    } 
    5859 
  • pjproject/trunk/pjnath/src/pjturn-client/client_main.c

    r2394 r2408  
    446446        menu(); 
    447447 
    448         fgets(input, sizeof(input), stdin); 
     448        if (fgets(input, sizeof(input), stdin) == NULL) 
     449            break; 
    449450         
    450451        switch (input[0]) { 
  • pjproject/trunk/pjnath/src/pjturn-srv/main.c

    r2394 r2408  
    109109        menu(); 
    110110             
    111         fgets(line, sizeof(line), stdin); 
     111        if (fgets(line, sizeof(line), stdin) == NULL) 
     112            break; 
    112113 
    113114        switch (line[0]) { 
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r2394 r2408  
    27512751 
    27522752    printf("%s (empty to cancel): ", title); fflush(stdout); 
    2753     fgets(buf, len, stdin); 
     2753    if (fgets(buf, len, stdin) == NULL) 
     2754        return PJ_FALSE; 
    27542755 
    27552756    /* Remove trailing newlines. */ 
     
    27952796 
    27962797    fflush(stdout); 
    2797     fgets(buf, len, stdin); 
     2798    if (fgets(buf, len, stdin) == NULL) 
     2799        return; 
    27982800    len = strlen(buf); 
    27992801 
     
    30243026 
    30253027    printf("Codec name (\"*\" for all) and priority: "); 
    3026     fgets(input, sizeof(input), stdin); 
     3028    if (fgets(input, sizeof(input), stdin) == NULL) 
     3029        return; 
    30273030    if (input[0]=='\r' || input[0]=='\n') { 
    30283031        puts("Done"); 
  • pjproject/trunk/pjsip-apps/src/samples/confsample.c

    r2394 r2408  
    106106 
    107107    printf("%s (empty to cancel): ", title); fflush(stdout); 
    108     fgets(buf, len, stdin); 
     108    if (fgets(buf, len, stdin) == NULL) 
     109        return PJ_FALSE; 
    109110 
    110111    /* Remove trailing newlines. */ 
     
    269270        char tmp2[10]; 
    270271        char *err; 
    271         int src, dst, level; 
     272        int src, dst, level, dur; 
    272273 
    273274        puts(""); 
     
    286287        printf("Enter selection: "); fflush(stdout); 
    287288 
    288         fgets(tmp, sizeof(tmp), stdin); 
     289        if (fgets(tmp, sizeof(tmp), stdin) == NULL) 
     290            break; 
    289291 
    290292        switch (tmp[0]) { 
     
    416418            if (!input("Duration to monitor (in seconds)", tmp1, sizeof(tmp1)) ) 
    417419                continue; 
    418             strtol(tmp1, &err, 10); 
     420            dur = strtol(tmp1, &err, 10); 
    419421            if (*err) { 
    420422                puts("Invalid duration number"); 
     
    422424            } 
    423425 
    424             monitor_level(conf, src, tmp2[0], strtol(tmp1, &err, 10)); 
     426            monitor_level(conf, src, tmp2[0], dur); 
    425427            break; 
    426428 
  • pjproject/trunk/pjsip-apps/src/samples/mix.c

    r2394 r2408  
    130130        printf("File %s exists, overwrite? [Y/N] ", out_fname); 
    131131        fflush(stdout); 
    132         fgets(in, sizeof(in), stdin); 
     132        if (fgets(in, sizeof(in), stdin) == NULL) 
     133            return 1; 
    133134        if (pj_tolower(in[0]) != 'y') 
    134135            return 1; 
  • pjproject/trunk/pjsip-apps/src/samples/pjsip-perf.c

    r2394 r2408  
    18101810    } else { 
    18111811        /* Server mode */ 
    1812         char s[10]; 
     1812        char s[10], *unused; 
    18131813        pj_status_t status; 
    18141814        unsigned i; 
     
    18451845        puts("\nPress <ENTER> to quit\n"); 
    18461846        fflush(stdout); 
    1847         fgets(s, sizeof(s), stdin); 
     1847        unused = fgets(s, sizeof(s), stdin); 
     1848        PJ_UNUSED_ARG(unused); 
    18481849 
    18491850        app.thread_quit = PJ_TRUE; 
  • pjproject/trunk/pjsip-apps/src/samples/playfile.c

    r2394 r2408  
    173173    puts("Press <ENTER> to stop playing and quit"); 
    174174 
    175     fgets(tmp, sizeof(tmp), stdin); 
     175    if (fgets(tmp, sizeof(tmp), stdin) == NULL) { 
     176        puts("EOF while reading stdin, will quit now.."); 
     177    } 
    176178 
    177179     
  • pjproject/trunk/pjsip-apps/src/samples/playsine.c

    r2394 r2408  
    278278    puts("Press <ENTER> to stop playing and quit"); 
    279279 
    280     fgets(tmp, sizeof(tmp), stdin); 
     280    if (fgets(tmp, sizeof(tmp), stdin) == NULL) { 
     281        puts("EOF while reading stdin, will quit now.."); 
     282    } 
    281283 
    282284     
  • pjproject/trunk/pjsip-apps/src/samples/recfile.c

    r2394 r2408  
    168168    puts("Press <ENTER> to stop recording and quit"); 
    169169 
    170     fgets(tmp, sizeof(tmp), stdin); 
     170    if (fgets(tmp, sizeof(tmp), stdin) == NULL) { 
     171        puts("EOF while reading stdin, will quit now.."); 
     172    } 
    171173 
    172174     
  • pjproject/trunk/pjsip-apps/src/samples/resampleplay.c

    r2394 r2408  
    191191    puts("Press <ENTER> to stop playing and quit"); 
    192192 
    193     fgets(tmp, sizeof(tmp), stdin); 
    194  
     193    if (fgets(tmp, sizeof(tmp), stdin) == NULL) { 
     194        puts("EOF while reading stdin, will quit now.."); 
     195    } 
    195196     
    196197    /* Start deinitialization: */ 
  • pjproject/trunk/pjsip-apps/src/samples/simple_pjsua.c

    r2394 r2408  
    183183 
    184184        puts("Press 'h' to hangup all calls, 'q' to quit"); 
    185         fgets(option, sizeof(option), stdin); 
     185        if (fgets(option, sizeof(option), stdin) == NULL) { 
     186            puts("EOF while reading stdin, will quit now.."); 
     187            break; 
     188        } 
    186189 
    187190        if (option[0] == 'q') 
  • pjproject/trunk/pjsip-apps/src/samples/siprtp.c

    r2394 r2408  
    18631863 
    18641864    printf("%s (empty to cancel): ", title); fflush(stdout); 
    1865     fgets(buf, len, stdin); 
     1865    if (fgets(buf, len, stdin) == NULL) 
     1866        return PJ_FALSE; 
    18661867 
    18671868    /* Remove trailing newlines. */ 
     
    18991900    for (;;) { 
    19001901        printf(">>> "); fflush(stdout); 
    1901         fgets(input1, sizeof(input1), stdin); 
     1902        if (fgets(input1, sizeof(input1), stdin) == NULL) { 
     1903            puts("EOF while reading stdin, will quit now.."); 
     1904            break; 
     1905        } 
    19021906 
    19031907        switch (input1[0]) { 
     
    20212025 
    20222026    if (log_file) { 
    2023         fwrite(buffer, len, 1, log_file); 
     2027        int count = fwrite(buffer, len, 1, log_file); 
     2028        PJ_UNUSED_ARG(count); 
    20242029        fflush(log_file); 
    20252030    } 
  • pjproject/trunk/pjsip-apps/src/samples/sndinfo.c

    r2394 r2408  
    203203    //pj_thread_sleep(1000); 
    204204    puts("Press <ENTER> to stop"); 
    205     fgets(tmp, sizeof(tmp), stdin); 
    206  
     205    if (fgets(tmp, sizeof(tmp), stdin) == NULL) { 
     206        puts("EOF while reading stdin, will quit now.."); 
     207    } 
    207208 
    208209    pjmedia_snd_stream_close(strm); 
  • pjproject/trunk/pjsip-apps/src/samples/stateful_proxy.c

    r2394 r2408  
    556556             ""); 
    557557 
    558         fgets(line, sizeof(line), stdin); 
     558        if (fgets(line, sizeof(line), stdin) == NULL) { 
     559            puts("EOF while reading stdin, will quit now.."); 
     560            global.quit_flag = PJ_TRUE; 
     561            break; 
     562        } 
    559563 
    560564        if (line[0] == 'q') { 
  • pjproject/trunk/pjsip-apps/src/samples/stateless_proxy.c

    r2394 r2408  
    222222             ""); 
    223223 
    224         fgets(line, sizeof(line), stdin); 
     224        if (fgets(line, sizeof(line), stdin) == NULL) { 
     225            puts("EOF while reading stdin, will quit now.."); 
     226            global.quit_flag = PJ_TRUE; 
     227            break; 
     228        } 
    225229 
    226230        if (line[0] == 'q') { 
  • pjproject/trunk/pjsip-apps/src/samples/stereotest.c

    r2394 r2408  
    296296    puts("Press <ENTER> to stop and quit"); 
    297297 
    298     fgets(tmp, sizeof(tmp), stdin); 
    299  
     298    if (fgets(tmp, sizeof(tmp), stdin) == NULL) { 
     299        puts("EOF while reading stdin, will quit now.."); 
     300    } 
    300301     
    301302    /* Start deinitialization: */ 
  • pjproject/trunk/pjsip-apps/src/samples/streamutil.c

    r2394 r2408  
    617617        printf("Command: "); fflush(stdout); 
    618618 
    619         fgets(tmp, sizeof(tmp), stdin); 
     619        if (fgets(tmp, sizeof(tmp), stdin) == NULL) { 
     620            puts("EOF while reading stdin, will quit now.."); 
     621            break; 
     622        } 
    620623 
    621624        if (tmp[0] == 's') 
  • pjproject/trunk/pjsip-apps/src/samples/tonegen.c

    r2394 r2408  
    128128 
    129129        for (i=0; i<8000/SAMPLES_PER_FRAME; ++i) { 
     130            int count; 
    130131            pjmedia_port_get_frame(port, &frm); 
    131             fwrite(buf, SAMPLES_PER_FRAME, 2, f); 
     132            count = fwrite(buf, SAMPLES_PER_FRAME, 2, f); 
     133            if (count != 2) 
     134                break; 
    132135        } 
    133136 
  • pjproject/trunk/pjsip/src/test-pjsip/main.c

    r2394 r2408  
    8383        char s[10]; 
    8484        printf("<Press ENTER to quit>\n"); fflush(stdout); 
    85         fgets(s, sizeof(s), stdin); 
     85        if (fgets(s, sizeof(s), stdin) == NULL) 
     86            return retval; 
    8687    } 
    8788 
Note: See TracChangeset for help on using the changeset viewer.