From 451de69e54e5b76d96385a9db0712dc0804ff54f Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 1 Jan 2013 21:00:06 -0800 Subject: [PATCH] Trim whitespace from all of the style fields when parsing. Closes #1565. --- aegisub/src/ass_style.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aegisub/src/ass_style.cpp b/aegisub/src/ass_style.cpp index 5db7da635..085107c48 100644 --- a/aegisub/src/ass_style.cpp +++ b/aegisub/src/ass_style.cpp @@ -79,10 +79,10 @@ class parser { std::vector tkns; size_t tkn_idx; - string_range& next_tok() { + string_range next_tok() { if (tkn_idx >= tkns.size()) throw SubtitleFormatParseError("Malformed style: not enough fields", 0); - return tkns[tkn_idx++]; + return trim_copy(tkns[tkn_idx++]); } public: @@ -102,12 +102,12 @@ public: } std::string next_str() { - auto tkn = trim_copy(next_tok()); + auto tkn = next_tok(); return std::string(begin(tkn), end(tkn)); } agi::Color next_color() { - auto &tkn = next_tok(); + auto tkn = next_tok(); return std::string(begin(tkn), end(tkn)); }