mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-13 00:45:43 +01:00
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>
This commit is contained in:
parent
c0130c8ec2
commit
2d0a124674
1 changed files with 16 additions and 26 deletions
42
bat/bat.c
42
bat/bat.c
|
@ -41,43 +41,33 @@ static int get_duration(struct bat *bat)
|
||||||
char *ptrf, *ptri;
|
char *ptrf, *ptri;
|
||||||
|
|
||||||
duration_f = strtof(bat->narg, &ptrf);
|
duration_f = strtof(bat->narg, &ptrf);
|
||||||
if (duration_f == HUGE_VALF || duration_f == -HUGE_VALF) {
|
if (duration_f == HUGE_VALF || duration_f == -HUGE_VALF
|
||||||
fprintf(bat->err, _("duration float overflow: %f %d\n"),
|
|| (duration_f == 0.0 && errno != 0))
|
||||||
duration_f, -errno);
|
goto err_exit;
|
||||||
return -errno;
|
|
||||||
} else if (duration_f == 0.0 && errno != 0) {
|
|
||||||
fprintf(bat->err, _("duration float underflow: %f %d\n"),
|
|
||||||
duration_f, -errno);
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
duration_i = strtol(bat->narg, &ptri, 10);
|
duration_i = strtol(bat->narg, &ptri, 10);
|
||||||
if (duration_i == LONG_MAX) {
|
if (duration_i == LONG_MAX || duration_i == LONG_MIN)
|
||||||
fprintf(bat->err, _("duration long overflow: %ld %d\n"),
|
goto err_exit;
|
||||||
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 (*ptrf == 's') {
|
if (*ptrf == 's')
|
||||||
bat->frames = duration_f * bat->rate;
|
bat->frames = duration_f * bat->rate;
|
||||||
} else if (*ptri == 0) {
|
else if (*ptri == 0)
|
||||||
bat->frames = duration_i;
|
bat->frames = duration_i;
|
||||||
} else {
|
else
|
||||||
fprintf(bat->err, _("invalid duration: %s\n"), bat->narg);
|
bat->frames = -1;
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bat->frames <= 0 || bat->frames > MAX_FRAMES) {
|
if (bat->frames <= 0 || bat->frames > MAX_FRAMES) {
|
||||||
fprintf(bat->err, _("duration out of range: (0, %d(%ds))\n"),
|
fprintf(bat->err, _("Invalid duration. Range: (0, %d(%fs))\n"),
|
||||||
MAX_FRAMES, (bat->frames / bat->rate));
|
MAX_FRAMES, (double)MAX_FRAMES / bat->rate);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
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)
|
static void get_sine_frequencies(struct bat *bat, char *freq)
|
||||||
|
|
Loading…
Reference in a new issue