Skip to content

Commit 8b99282

Browse files
authored
Merge pull request drowe67#212 from drowe67/ms-remove-fflush-stdin
Remove fflush(stdin) calls from codebase.
2 parents e2eb477 + 27155ab commit 8b99282

27 files changed

+19
-56
lines changed

misc/speexnoisesup.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ int main(int argc, char *argv[]) {
2525
SpeexPreprocessState *st;
2626

2727
if (argc < 2) {
28-
printf("usage: %s InFile OutFile\n", argv[0]);
29-
exit(0);
28+
printf("usage: %s InFile OutFile\n", argv[0]);
29+
exit(0);
3030
}
3131

3232
if (strcmp(argv[1], "-") == 0) fin = stdin;
@@ -37,16 +37,15 @@ int main(int argc, char *argv[]) {
3737

3838
if (strcmp(argv[2], "-") == 0) fout = stdout;
3939
else if ((fout = fopen(argv[2],"wb")) == NULL) {
40-
fprintf(stderr, "Error opening %s\n", argv[2]);
41-
exit(1);
40+
fprintf(stderr, "Error opening %s\n", argv[2]);
41+
exit(1);
4242
}
4343

4444
st = speex_preprocess_state_init(N, FS);
4545

4646
while(fread(buf, sizeof(short), N, fin) == N) {
47-
speex_preprocess_run(st, buf);
48-
fwrite(buf, sizeof(short), N, fout);
49-
if (fin == stdin) fflush(stdin);
47+
speex_preprocess_run(st, buf);
48+
fwrite(buf, sizeof(short), N, fout);
5049
if (fout == stdout) fflush(stdout);
5150
}
5251

src/c2dec.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,13 @@ int main(int argc, char *argv[])
363363
if (f_ratek != NULL)
364364
ret = fread(user_ratek, sizeof(float), K, f_ratek);
365365

366-
codec2_decode_ber(codec2, buf, bits, ber_est);
367-
fwrite(buf, sizeof(short), nsam, fout);
366+
codec2_decode_ber(codec2, buf, bits, ber_est);
367+
fwrite(buf, sizeof(short), nsam, fout);
368368

369-
//if this is in a pipeline, we probably don't want the usual
369+
//if this is in a pipeline, we probably don't want the usual
370370
//buffering to occur
371371

372372
if (fout == stdout) fflush(stdout);
373-
if (fin == stdin) fflush(stdin);
374373

375374
if (softdec) {
376375
ret = (fread(softdec_bits, sizeof(float), nbit, fin) == (size_t)nbit);

src/c2enc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,10 @@ int main(int argc, char *argv[])
178178
else
179179
fwrite(bits, sizeof(char), nbyte, fout);
180180

181-
// if this is in a pipeline, we probably don't want the usual
181+
// if this is in a pipeline, we probably don't want the usual
182182
// buffering to occur
183183

184184
if (fout == stdout) fflush(stdout);
185-
if (fin == stdin) fflush(stdin);
186185
}
187186

188187
if (report_var) {

src/cohpsk_ch.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ int main(int argc, char *argv[])
390390
buffering to occur */
391391

392392
if (fout == stdout) fflush(stdout);
393-
if (fin == stdin) fflush(stdin);
394393
}
395394

396395
fclose(fin);

src/cohpsk_demod.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,10 @@ int main(int argc, char *argv[])
230230
}
231231
}
232232

233-
/* if this is in a pipeline, we probably don't want the usual
234-
buffering to occur */
233+
/* if this is in a pipeline, we probably don't want the usual
234+
buffering to occur */
235235

236236
if (fout == stdout) fflush(stdout);
237-
if (fin == stdin) fflush(stdin);
238237
}
239238

240239
fclose(fin);

src/cohpsk_mod.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ int main(int argc, char *argv[])
112112
buffering to occur */
113113

114114
if (fout == stdout) fflush(stdout);
115-
if (fin == stdin) fflush(stdin);
116115
}
117116

118117
fclose(fin);

src/cohpsk_put_test_bits.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ int main(int argc, char *argv[])
9292
nerrors += bit_errors;
9393
nbits += COHPSK_BITS_PER_FRAME;
9494
}
95-
96-
if (fin == stdin) fflush(stdin);
9795
}
9896

9997
if (foct != NULL) {

src/fdmdv_channel.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ int main(int argc, char *argv[])
9292
buffering to occur */
9393

9494
if (fout == stdout) fflush(stdout);
95-
if (fin == stdin) fflush(stdin);
9695
}
9796

9897
fclose(fin);

src/fdmdv_demod.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ int main(int argc, char *argv[])
211211
buffering to occur */
212212

213213
if (fout == stdout) fflush(stdout);
214-
if (fin == stdin) fflush(stdin);
215214
}
216215

217216
/* Optional dump to Octave log file */

src/fdmdv_mod.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ int main(int argc, char *argv[])
148148
buffering to occur */
149149

150150
if (fout == stdout) fflush(stdout);
151-
if (fin == stdin) fflush(stdin);
152151
}
153152

154153
//fdmdv_dump_osc_mags(fdmdv);

0 commit comments

Comments
 (0)