diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-01-01 22:08:21 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-01-01 22:08:21 +0000 |
commit | e8292035968488eb3a9b61a431afc8c9a39f51d3 (patch) | |
tree | 37b6e83a23282b53ed0ab8a602498798bb56c57d /pjsip-apps | |
parent | 423bd3b19d5611412da90b87f6989dc89339defa (diff) |
Fixed gcc-4.3.2 warnings with the warn_unused_result flag in some APIs
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2408 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r-- | pjsip-apps/src/pjsua/pjsua_app.c | 9 | ||||
-rw-r--r-- | pjsip-apps/src/samples/confsample.c | 12 | ||||
-rw-r--r-- | pjsip-apps/src/samples/mix.c | 3 | ||||
-rw-r--r-- | pjsip-apps/src/samples/pjsip-perf.c | 5 | ||||
-rw-r--r-- | pjsip-apps/src/samples/playfile.c | 4 | ||||
-rw-r--r-- | pjsip-apps/src/samples/playsine.c | 4 | ||||
-rw-r--r-- | pjsip-apps/src/samples/recfile.c | 4 | ||||
-rw-r--r-- | pjsip-apps/src/samples/resampleplay.c | 5 | ||||
-rw-r--r-- | pjsip-apps/src/samples/simple_pjsua.c | 5 | ||||
-rw-r--r-- | pjsip-apps/src/samples/siprtp.c | 11 | ||||
-rw-r--r-- | pjsip-apps/src/samples/sndinfo.c | 5 | ||||
-rw-r--r-- | pjsip-apps/src/samples/stateful_proxy.c | 6 | ||||
-rw-r--r-- | pjsip-apps/src/samples/stateless_proxy.c | 6 | ||||
-rw-r--r-- | pjsip-apps/src/samples/stereotest.c | 5 | ||||
-rw-r--r-- | pjsip-apps/src/samples/streamutil.c | 5 | ||||
-rw-r--r-- | pjsip-apps/src/samples/tonegen.c | 5 |
16 files changed, 66 insertions, 28 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 882a11bc..5414b087 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -2750,7 +2750,8 @@ static pj_bool_t simple_input(const char *title, char *buf, pj_size_t len) char *p; printf("%s (empty to cancel): ", title); fflush(stdout); - fgets(buf, len, stdin); + if (fgets(buf, len, stdin) == NULL) + return PJ_FALSE; /* Remove trailing newlines. */ for (p=buf; ; ++p) { @@ -2794,7 +2795,8 @@ static void ui_input_url(const char *title, char *buf, int len, printf("%s: ", title); fflush(stdout); - fgets(buf, len, stdin); + if (fgets(buf, len, stdin) == NULL) + return; len = strlen(buf); /* Left trim */ @@ -3023,7 +3025,8 @@ static void manage_codec_prio(void) "(e.g. \"speex/16000 200\"), empty to cancel:"); printf("Codec name (\"*\" for all) and priority: "); - fgets(input, sizeof(input), stdin); + if (fgets(input, sizeof(input), stdin) == NULL) + return; if (input[0]=='\r' || input[0]=='\n') { puts("Done"); return; diff --git a/pjsip-apps/src/samples/confsample.c b/pjsip-apps/src/samples/confsample.c index feb6aa11..676f4bb8 100644 --- a/pjsip-apps/src/samples/confsample.c +++ b/pjsip-apps/src/samples/confsample.c @@ -105,7 +105,8 @@ static pj_bool_t input(const char *title, char *buf, pj_size_t len) char *p; printf("%s (empty to cancel): ", title); fflush(stdout); - fgets(buf, len, stdin); + if (fgets(buf, len, stdin) == NULL) + return PJ_FALSE; /* Remove trailing newlines. */ for (p=buf; ; ++p) { @@ -268,7 +269,7 @@ int main(int argc, char *argv[]) char tmp1[10]; char tmp2[10]; char *err; - int src, dst, level; + int src, dst, level, dur; puts(""); conf_list(conf, 0); @@ -285,7 +286,8 @@ int main(int argc, char *argv[]) printf("Enter selection: "); fflush(stdout); - fgets(tmp, sizeof(tmp), stdin); + if (fgets(tmp, sizeof(tmp), stdin) == NULL) + break; switch (tmp[0]) { case 's': @@ -415,13 +417,13 @@ int main(int argc, char *argv[]) if (!input("Duration to monitor (in seconds)", tmp1, sizeof(tmp1)) ) continue; - strtol(tmp1, &err, 10); + dur = strtol(tmp1, &err, 10); if (*err) { puts("Invalid duration number"); continue; } - monitor_level(conf, src, tmp2[0], strtol(tmp1, &err, 10)); + monitor_level(conf, src, tmp2[0], dur); break; case 'q': diff --git a/pjsip-apps/src/samples/mix.c b/pjsip-apps/src/samples/mix.c index 6cf93a0f..f409af2b 100644 --- a/pjsip-apps/src/samples/mix.c +++ b/pjsip-apps/src/samples/mix.c @@ -129,7 +129,8 @@ int main(int argc, char *argv[]) printf("File %s exists, overwrite? [Y/N] ", out_fname); fflush(stdout); - fgets(in, sizeof(in), stdin); + if (fgets(in, sizeof(in), stdin) == NULL) + return 1; if (pj_tolower(in[0]) != 'y') return 1; } diff --git a/pjsip-apps/src/samples/pjsip-perf.c b/pjsip-apps/src/samples/pjsip-perf.c index e2a00183..ac8a5521 100644 --- a/pjsip-apps/src/samples/pjsip-perf.c +++ b/pjsip-apps/src/samples/pjsip-perf.c @@ -1809,7 +1809,7 @@ int main(int argc, char *argv[]) } else { /* Server mode */ - char s[10]; + char s[10], *unused; pj_status_t status; unsigned i; @@ -1844,7 +1844,8 @@ int main(int argc, char *argv[]) puts("\nPress <ENTER> to quit\n"); fflush(stdout); - fgets(s, sizeof(s), stdin); + unused = fgets(s, sizeof(s), stdin); + PJ_UNUSED_ARG(unused); app.thread_quit = PJ_TRUE; for (i=0; i<app.thread_count; ++i) { diff --git a/pjsip-apps/src/samples/playfile.c b/pjsip-apps/src/samples/playfile.c index a71ad41a..8c51271f 100644 --- a/pjsip-apps/src/samples/playfile.c +++ b/pjsip-apps/src/samples/playfile.c @@ -172,7 +172,9 @@ int main(int argc, char *argv[]) puts(""); puts("Press <ENTER> to stop playing and quit"); - fgets(tmp, sizeof(tmp), stdin); + if (fgets(tmp, sizeof(tmp), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + } /* Start deinitialization: */ diff --git a/pjsip-apps/src/samples/playsine.c b/pjsip-apps/src/samples/playsine.c index ebfcde01..e03b0d5d 100644 --- a/pjsip-apps/src/samples/playsine.c +++ b/pjsip-apps/src/samples/playsine.c @@ -277,7 +277,9 @@ int main(int argc, char *argv[]) puts(""); puts("Press <ENTER> to stop playing and quit"); - fgets(tmp, sizeof(tmp), stdin); + if (fgets(tmp, sizeof(tmp), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + } /* Start deinitialization: */ diff --git a/pjsip-apps/src/samples/recfile.c b/pjsip-apps/src/samples/recfile.c index 92491731..e4187a65 100644 --- a/pjsip-apps/src/samples/recfile.c +++ b/pjsip-apps/src/samples/recfile.c @@ -167,7 +167,9 @@ int main(int argc, char *argv[]) puts(""); puts("Press <ENTER> to stop recording and quit"); - fgets(tmp, sizeof(tmp), stdin); + if (fgets(tmp, sizeof(tmp), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + } /* Start deinitialization: */ diff --git a/pjsip-apps/src/samples/resampleplay.c b/pjsip-apps/src/samples/resampleplay.c index d883da9a..7b5d1b14 100644 --- a/pjsip-apps/src/samples/resampleplay.c +++ b/pjsip-apps/src/samples/resampleplay.c @@ -190,8 +190,9 @@ int main(int argc, char *argv[]) puts(""); puts("Press <ENTER> to stop playing and quit"); - fgets(tmp, sizeof(tmp), stdin); - + if (fgets(tmp, sizeof(tmp), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + } /* Start deinitialization: */ diff --git a/pjsip-apps/src/samples/simple_pjsua.c b/pjsip-apps/src/samples/simple_pjsua.c index d606a861..ab2d0174 100644 --- a/pjsip-apps/src/samples/simple_pjsua.c +++ b/pjsip-apps/src/samples/simple_pjsua.c @@ -182,7 +182,10 @@ int main(int argc, char *argv[]) char option[10]; puts("Press 'h' to hangup all calls, 'q' to quit"); - fgets(option, sizeof(option), stdin); + if (fgets(option, sizeof(option), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + break; + } if (option[0] == 'q') break; diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c index e98084bc..b3e3d7d4 100644 --- a/pjsip-apps/src/samples/siprtp.c +++ b/pjsip-apps/src/samples/siprtp.c @@ -1862,7 +1862,8 @@ static pj_bool_t simple_input(const char *title, char *buf, pj_size_t len) char *p; printf("%s (empty to cancel): ", title); fflush(stdout); - fgets(buf, len, stdin); + if (fgets(buf, len, stdin) == NULL) + return PJ_FALSE; /* Remove trailing newlines. */ for (p=buf; ; ++p) { @@ -1898,7 +1899,10 @@ static void console_main() for (;;) { printf(">>> "); fflush(stdout); - fgets(input1, sizeof(input1), stdin); + if (fgets(input1, sizeof(input1), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + break; + } switch (input1[0]) { @@ -2020,7 +2024,8 @@ static void app_log_writer(int level, const char *buffer, int len) pj_log_write(level, buffer, len); if (log_file) { - fwrite(buffer, len, 1, log_file); + int count = fwrite(buffer, len, 1, log_file); + PJ_UNUSED_ARG(count); fflush(log_file); } } diff --git a/pjsip-apps/src/samples/sndinfo.c b/pjsip-apps/src/samples/sndinfo.c index 0658d91c..9f282d1a 100644 --- a/pjsip-apps/src/samples/sndinfo.c +++ b/pjsip-apps/src/samples/sndinfo.c @@ -202,8 +202,9 @@ static int open_device(int dev_id, pjmedia_dir dir, /* Let playback/capture runs for a while */ //pj_thread_sleep(1000); puts("Press <ENTER> to stop"); - fgets(tmp, sizeof(tmp), stdin); - + if (fgets(tmp, sizeof(tmp), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + } pjmedia_snd_stream_close(strm); diff --git a/pjsip-apps/src/samples/stateful_proxy.c b/pjsip-apps/src/samples/stateful_proxy.c index b110a071..a3468ef4 100644 --- a/pjsip-apps/src/samples/stateful_proxy.c +++ b/pjsip-apps/src/samples/stateful_proxy.c @@ -555,7 +555,11 @@ int main(int argc, char *argv[]) " dd dump detailed status\n" ""); - fgets(line, sizeof(line), stdin); + if (fgets(line, sizeof(line), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + global.quit_flag = PJ_TRUE; + break; + } if (line[0] == 'q') { global.quit_flag = PJ_TRUE; diff --git a/pjsip-apps/src/samples/stateless_proxy.c b/pjsip-apps/src/samples/stateless_proxy.c index 30f571d8..de3b5339 100644 --- a/pjsip-apps/src/samples/stateless_proxy.c +++ b/pjsip-apps/src/samples/stateless_proxy.c @@ -221,7 +221,11 @@ int main(int argc, char *argv[]) " dd dump detailed status\n" ""); - fgets(line, sizeof(line), stdin); + if (fgets(line, sizeof(line), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + global.quit_flag = PJ_TRUE; + break; + } if (line[0] == 'q') { global.quit_flag = PJ_TRUE; diff --git a/pjsip-apps/src/samples/stereotest.c b/pjsip-apps/src/samples/stereotest.c index f7e9e6b7..504b2e07 100644 --- a/pjsip-apps/src/samples/stereotest.c +++ b/pjsip-apps/src/samples/stereotest.c @@ -295,8 +295,9 @@ int main(int argc, char *argv[]) puts(""); puts("Press <ENTER> to stop and quit"); - fgets(tmp, sizeof(tmp), stdin); - + if (fgets(tmp, sizeof(tmp), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + } /* Start deinitialization: */ diff --git a/pjsip-apps/src/samples/streamutil.c b/pjsip-apps/src/samples/streamutil.c index ddb66cdf..36809190 100644 --- a/pjsip-apps/src/samples/streamutil.c +++ b/pjsip-apps/src/samples/streamutil.c @@ -616,7 +616,10 @@ int main(int argc, char *argv[]) printf("Command: "); fflush(stdout); - fgets(tmp, sizeof(tmp), stdin); + if (fgets(tmp, sizeof(tmp), stdin) == NULL) { + puts("EOF while reading stdin, will quit now.."); + break; + } if (tmp[0] == 's') print_stream_stat(stream); diff --git a/pjsip-apps/src/samples/tonegen.c b/pjsip-apps/src/samples/tonegen.c index 4bd79e07..f0fc2f3f 100644 --- a/pjsip-apps/src/samples/tonegen.c +++ b/pjsip-apps/src/samples/tonegen.c @@ -127,8 +127,11 @@ int main() f = fopen("tonegen.pcm", "wb"); for (i=0; i<8000/SAMPLES_PER_FRAME; ++i) { + int count; pjmedia_port_get_frame(port, &frm); - fwrite(buf, SAMPLES_PER_FRAME, 2, f); + count = fwrite(buf, SAMPLES_PER_FRAME, 2, f); + if (count != 2) + break; } pj_assert(pjmedia_tonegen_is_busy(port) == 0); |