From 8a7cd2048040aed2cf48768c1ff5518c296b1402 Mon Sep 17 00:00:00 2001 From: m154k1 <139042094+m154k1@users.noreply.github.com> Date: Fri, 4 Aug 2023 21:43:42 +0300 Subject: [PATCH] options: rename variables in parse_timestring --- options/m_option.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/options/m_option.c b/options/m_option.c index a796707219..1456931c00 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -2648,17 +2648,18 @@ const m_option_type_t m_option_type_channels = { static int parse_timestring(struct bstr str, double *time, char endchar) { - int a, b, len; - double d; + int h, m, len; + double s; *time = 0; /* ensure initialization for error cases */ - if (bstr_sscanf(str, "%d:%d:%lf%n", &a, &b, &d, &len) >= 3) - *time = 3600 * a + 60 * b + d; - else if (bstr_sscanf(str, "%d:%lf%n", &a, &d, &len) >= 2) - *time = 60 * a + d; - else if (bstr_sscanf(str, "%lf%n", &d, &len) >= 1) - *time = d; - else + if (bstr_sscanf(str, "%d:%d:%lf%n", &h, &m, &s, &len) >= 3) { + *time = 3600 * h + 60 * m + s; + } else if (bstr_sscanf(str, "%d:%lf%n", &m, &s, &len) >= 2) { + *time = 60 * m + s; + } else if (bstr_sscanf(str, "%lf%n", &s, &len) >= 1) { + *time = s; + } else { return 0; /* unsupported time format */ + } if (len < str.len && str.start[len] != endchar) return 0; /* invalid extra characters at the end */ if (!isfinite(*time))