From: han.lu@intel.com
To: tiwai@suse.de, liam.r.girdwood@linux.intel.com,
alsa-devel@alsa-project.org
Cc: "Lu, Han" <han.lu@intel.com>
Subject: [PATCH 2/3] alsabat: fix fopen and messages
Date: Mon, 21 Mar 2016 19:05:48 +0800 [thread overview]
Message-ID: <efdc70d84df47da467f5b653fc8425eb8c18ab9d.1458558001.git.han.lu@intel.com> (raw)
In-Reply-To: <cover.1458558001.git.han.lu@intel.com>
In-Reply-To: <cover.1458558001.git.han.lu@intel.com>
From: "Lu, Han" <han.lu@intel.com>
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>
diff --git a/bat/alsa.c b/bat/alsa.c
index 638012a..2540ab8 100644
--- a/bat/alsa.c
+++ b/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");
err = -errno;
if (fp == NULL) {
- fprintf(bat->err, _("Cannot open file for capture: "));
- fprintf(bat->err, _("%s %d\n"), bat->debugplay, err);
+ fprintf(bat->err, _("Cannot open file: %s %d\n"),
+ bat->debugplay, err);
return err;
}
/* leave space for wav header */
@@ -404,8 +404,7 @@ void *playback_alsa(struct bat *bat)
bat->fp = fopen(bat->playback.file, "rb");
err = -errno;
if (bat->fp == NULL) {
- fprintf(bat->err, _("Cannot open file for capture: "));
- fprintf(bat->err, _("%s %d\n"),
+ fprintf(bat->err, _("Cannot open file: %s %d\n"),
bat->playback.file, err);
retval_play = 1;
goto exit3;
@@ -545,10 +544,10 @@ void *record_alsa(struct bat *bat)
}
remove(bat->capture.file);
- fp = fopen(bat->capture.file, "w+");
+ fp = fopen(bat->capture.file, "wb");
err = -errno;
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);
retval_record = 1;
goto exit3;
diff --git a/bat/analyze.c b/bat/analyze.c
index 63481fb..58781d6 100644
--- a/bat/analyze.c
+++ b/bat/analyze.c
@@ -296,7 +296,7 @@ int analyze_capture(struct bat *bat)
bat->fp = fopen(bat->capture.file, "rb");
err = -errno;
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);
goto exit1;
}
diff --git a/bat/bat.c b/bat/bat.c
index 4821532..85a7282 100644
--- a/bat/bat.c
+++ b/bat/bat.c
@@ -469,8 +469,8 @@ static int bat_init(struct bat *bat)
bat->log = fopen(bat->logarg, "wb");
err = -errno;
if (bat->log == NULL) {
- fprintf(bat->err, _("Cannot open file for capture:"));
- fprintf(bat->err, _(" %s %d\n"), bat->logarg, err);
+ fprintf(bat->err, _("Cannot open file: %s %d\n"),
+ bat->logarg, err);
return err;
}
bat->err = bat->log;
@@ -533,8 +533,7 @@ static int bat_init(struct bat *bat)
bat->fp = fopen(bat->playback.file, "rb");
err = -errno;
if (bat->fp == NULL) {
- fprintf(bat->err, _("Cannot open file for playback:"));
- fprintf(bat->err, _(" %s %d\n"),
+ fprintf(bat->err, _("Cannot open file: %s %d\n"),
bat->playback.file, err);
return err;
}
--
2.5.0
next prev parent reply other threads:[~2016-03-21 11:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 11:05 [PATCH 0/3] *** Some trival fixes on alsabat *** han.lu
2016-03-21 11:05 ` [PATCH 1/3] alsabat: fix misusing of errno han.lu
2016-03-21 11:05 ` han.lu [this message]
2016-03-21 11:05 ` [PATCH 3/3] alsabat: use variable for thread return value han.lu
2016-03-21 17:06 ` [PATCH 0/3] *** Some trival fixes on alsabat *** Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=efdc70d84df47da467f5b653fc8425eb8c18ab9d.1458558001.git.han.lu@intel.com \
--to=han.lu@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).