summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
diff options
context:
space:
mode:
authorm154k1 <139042094+m154k1@users.noreply.github.com>2023-08-04 21:43:42 +0300
committersfan5 <sfan5@live.de>2023-08-06 13:48:17 +0200
commit8a7cd2048040aed2cf48768c1ff5518c296b1402 (patch)
tree003af13f26ec81409c919b438372702be30d6172 /options/m_option.c
parente8144ac231e47e96a99dd0ab9ec9499c5bd2ddfe (diff)
downloadmpv-8a7cd2048040aed2cf48768c1ff5518c296b1402.tar.bz2
mpv-8a7cd2048040aed2cf48768c1ff5518c296b1402.tar.xz
options: rename variables in parse_timestring
Diffstat (limited to 'options/m_option.c')
-rw-r--r--options/m_option.c19
1 files 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))