From 4f1013d0b7c8736753182fcd84df9280f53f8507 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Mon, 20 Jun 2011 06:36:07 +0000 Subject: [PATCH] Small fixes to SRT tag parser. Updates #1301. Originally committed to SVN as r5435. --- aegisub/src/subtitle_format_srt.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aegisub/src/subtitle_format_srt.cpp b/aegisub/src/subtitle_format_srt.cpp index 4b1e477dc..de1679ddd 100644 --- a/aegisub/src/subtitle_format_srt.cpp +++ b/aegisub/src/subtitle_format_srt.cpp @@ -59,7 +59,7 @@ class SrtTagParser { wxString color; }; - enum { + enum TagType { // leave 0 unused so indexing an unknown tag in the map won't clash TAG_BOLD_OPEN = 1, TAG_BOLD_CLOSE, @@ -75,12 +75,12 @@ class SrtTagParser { wxRegEx tag_matcher; wxRegEx attrib_matcher; - std::map tag_name_cases; + std::map tag_name_cases; public: SrtTagParser() : tag_matcher(L"^(.*?)<(/?b|/?i|/?u|/?s|/?font)(.*?)>(.*)$", wxRE_ICASE|wxRE_ADVANCED) - , attrib_matcher(L"^[[:space:]](face|size|color)=('.*?'|\".*?\"|[^[:space:]]+)", wxRE_ICASE|wxRE_ADVANCED) + , attrib_matcher(L"^[[:space:]]+(face|size|color)=('.*?'|\".*?\"|[^[:space:]]+)", wxRE_ICASE|wxRE_ADVANCED) { if (!tag_matcher.IsValid()) throw Aegisub::InternalError(L"Parsing SRT: Failed compiling tag matching regex", 0); @@ -107,7 +107,7 @@ public: int strikeout_level = 0; std::vector font_stack; - wxString ass; // result to be built + wxString ass = L""; // result to be built while (!srt.IsEmpty()) {