mirror of
https://github.com/alsa-project/alsa-utils
synced 2025-01-03 15:59:54 +01:00
alsabat: fix fopen and messages
All files should be opened in either "rb" or "wb" in current usage. Remove incorrect and unneccesary prints. Signed-off-by: Lu, Han <han.lu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
bd6c706606
commit
f2f6583ee6
3 changed files with 9 additions and 11 deletions
11
bat/alsa.c
11
bat/alsa.c
|
@ -303,8 +303,8 @@ static int write_to_pcm_loop(struct pcm_container *sndpcm, struct bat *bat)
|
||||||
fp = fopen(bat->debugplay, "wb");
|
fp = fopen(bat->debugplay, "wb");
|
||||||
err = -errno;
|
err = -errno;
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
fprintf(bat->err, _("Cannot open file for capture: "));
|
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||||
fprintf(bat->err, _("%s %d\n"), bat->debugplay, err);
|
bat->debugplay, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
/* leave space for wav header */
|
/* leave space for wav header */
|
||||||
|
@ -404,8 +404,7 @@ void *playback_alsa(struct bat *bat)
|
||||||
bat->fp = fopen(bat->playback.file, "rb");
|
bat->fp = fopen(bat->playback.file, "rb");
|
||||||
err = -errno;
|
err = -errno;
|
||||||
if (bat->fp == NULL) {
|
if (bat->fp == NULL) {
|
||||||
fprintf(bat->err, _("Cannot open file for capture: "));
|
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||||
fprintf(bat->err, _("%s %d\n"),
|
|
||||||
bat->playback.file, err);
|
bat->playback.file, err);
|
||||||
retval_play = 1;
|
retval_play = 1;
|
||||||
goto exit3;
|
goto exit3;
|
||||||
|
@ -545,10 +544,10 @@ void *record_alsa(struct bat *bat)
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(bat->capture.file);
|
remove(bat->capture.file);
|
||||||
fp = fopen(bat->capture.file, "w+");
|
fp = fopen(bat->capture.file, "wb");
|
||||||
err = -errno;
|
err = -errno;
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
fprintf(bat->err, _("Cannot open file for capture: %s %d\n"),
|
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||||
bat->capture.file, err);
|
bat->capture.file, err);
|
||||||
retval_record = 1;
|
retval_record = 1;
|
||||||
goto exit3;
|
goto exit3;
|
||||||
|
|
|
@ -296,7 +296,7 @@ int analyze_capture(struct bat *bat)
|
||||||
bat->fp = fopen(bat->capture.file, "rb");
|
bat->fp = fopen(bat->capture.file, "rb");
|
||||||
err = -errno;
|
err = -errno;
|
||||||
if (bat->fp == NULL) {
|
if (bat->fp == NULL) {
|
||||||
fprintf(bat->err, _("Cannot open file for capture: %s %d\n"),
|
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||||
bat->capture.file, err);
|
bat->capture.file, err);
|
||||||
goto exit1;
|
goto exit1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,8 +469,8 @@ static int bat_init(struct bat *bat)
|
||||||
bat->log = fopen(bat->logarg, "wb");
|
bat->log = fopen(bat->logarg, "wb");
|
||||||
err = -errno;
|
err = -errno;
|
||||||
if (bat->log == NULL) {
|
if (bat->log == NULL) {
|
||||||
fprintf(bat->err, _("Cannot open file for capture:"));
|
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||||
fprintf(bat->err, _(" %s %d\n"), bat->logarg, err);
|
bat->logarg, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
bat->err = bat->log;
|
bat->err = bat->log;
|
||||||
|
@ -533,8 +533,7 @@ static int bat_init(struct bat *bat)
|
||||||
bat->fp = fopen(bat->playback.file, "rb");
|
bat->fp = fopen(bat->playback.file, "rb");
|
||||||
err = -errno;
|
err = -errno;
|
||||||
if (bat->fp == NULL) {
|
if (bat->fp == NULL) {
|
||||||
fprintf(bat->err, _("Cannot open file for playback:"));
|
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||||
fprintf(bat->err, _(" %s %d\n"),
|
|
||||||
bat->playback.file, err);
|
bat->playback.file, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue