summaryrefslogtreecommitdiff
path: root/bat
diff options
context:
space:
mode:
authorLu, Han <han.lu@intel.com>2015-10-20 16:45:45 +0800
committerTakashi Iwai <tiwai@suse.de>2015-10-20 11:06:23 +0200
commit2d0a1246748105b4e97be2b97b5099dcda835bad (patch)
tree9d219b6c3f101fd6df923207440fcc7f216ea0b7 /bat
parentc0130c8ec22a89960d9304297a904a2a14979506 (diff)
downloadalsa-utils-2d0a1246748105b4e97be2b97b5099dcda835bad.tar.gz
BAT: Remove redundant message strings
Cutting down 6 message strings to 2, as translators need to work on each different variant. Signed-off-by: Lu, Han <han.lu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'bat')
-rw-r--r--bat/bat.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/bat/bat.c b/bat/bat.c
index 54fe1ec..1af5c37 100644
--- a/bat/bat.c
+++ b/bat/bat.c
@@ -41,43 +41,33 @@ static int get_duration(struct bat *bat)
char *ptrf, *ptri;
duration_f = strtof(bat->narg, &ptrf);
- if (duration_f == HUGE_VALF || duration_f == -HUGE_VALF) {
- fprintf(bat->err, _("duration float overflow: %f %d\n"),
- duration_f, -errno);
- return -errno;
- } else if (duration_f == 0.0 && errno != 0) {
- fprintf(bat->err, _("duration float underflow: %f %d\n"),
- duration_f, -errno);
- return -errno;
- }
+ if (duration_f == HUGE_VALF || duration_f == -HUGE_VALF
+ || (duration_f == 0.0 && errno != 0))
+ goto err_exit;
duration_i = strtol(bat->narg, &ptri, 10);
- if (duration_i == LONG_MAX) {
- fprintf(bat->err, _("duration long overflow: %ld %d\n"),
- duration_i, -errno);
- return -errno;
- } else if (duration_i == LONG_MIN) {
- fprintf(bat->err, _("duration long underflow: %ld %d\n"),
- duration_i, -errno);
- return -errno;
- }
+ if (duration_i == LONG_MAX || duration_i == LONG_MIN)
+ goto err_exit;
- if (*ptrf == 's') {
+ if (*ptrf == 's')
bat->frames = duration_f * bat->rate;
- } else if (*ptri == 0) {
+ else if (*ptri == 0)
bat->frames = duration_i;
- } else {
- fprintf(bat->err, _("invalid duration: %s\n"), bat->narg);
- return -EINVAL;
- }
+ else
+ bat->frames = -1;
if (bat->frames <= 0 || bat->frames > MAX_FRAMES) {
- fprintf(bat->err, _("duration out of range: (0, %d(%ds))\n"),
- MAX_FRAMES, (bat->frames / bat->rate));
+ fprintf(bat->err, _("Invalid duration. Range: (0, %d(%fs))\n"),
+ MAX_FRAMES, (double)MAX_FRAMES / bat->rate);
return -EINVAL;
}
return 0;
+
+err_exit:
+ fprintf(bat->err, _("Duration overflow/underflow: %d\n"), -errno);
+
+ return -errno;
}
static void get_sine_frequencies(struct bat *bat, char *freq)