aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-04-09 16:08:58 -0400
committerB. Watson <urchlay@slackware.uk>2024-04-11 16:52:48 -0400
commitec1159ea65243eafe06135f887e39cac76f8834b (patch)
treebc71ffa930fdd9e8b7646efa76fa7c0b4ebee538
parent1056e7e4a02db9aa9e04e3124437785de57576cf (diff)
downloadsoxdial-ec1159ea65243eafe06135f887e39cac76f8834b.tar.gz
soxdial: handle invalid numerics like .5.5 without warnings.
-rwxr-xr-xsoxdial6
1 files changed, 6 insertions, 0 deletions
diff --git a/soxdial b/soxdial
index b5837ea..a2684b2 100755
--- a/soxdial
+++ b/soxdial
@@ -425,18 +425,24 @@ sub make_sox_cmd {
# support either seconds (possibly with decimal point, e.g. 0.5) or
# milliseconds (e.g. 500ms).
sub parse_sec {
+ no warnings "numeric";
$_ = shift || 0;
if(/^(.+)ms$/) {
$_ = $1 / 1000;
+ } else {
+ $_ += 0;
}
return $_;
}
# support either Hz (e.g. 8000) or KHz (e.g. 8k or 8K).
sub parse_rate {
+ no warnings "numeric";
$_ = shift || 0;
if(/^(.+)k$/i) {
$_ = $1 * 1000;
+ } else {
+ $_ += 0;
}
return $_;
}