diff --git a/libaegisub/common/thesaurus.cpp b/libaegisub/common/thesaurus.cpp index fd006cd28..41cd7085f 100644 --- a/libaegisub/common/thesaurus.cpp +++ b/libaegisub/common/thesaurus.cpp @@ -64,26 +64,26 @@ std::vector Thesaurus::Lookup(std::string const& word) { auto buff_end = buff + len; std::string temp; - auto read_line = [&] () -> std::string const& { + auto read_line = [&] (std::string& temp) -> std::string * { auto start = buff; auto end = std::find(buff, buff_end, '\n'); buff = end < buff_end ? end + 1 : buff_end; if (end > start && end[-1] == '\r') --end; temp.clear(); conv->Convert(start, end - start, temp); - return temp; + return &temp; }; // First line is the word and meaning count std::vector header; - boost::split(header, read_line(), [](char c) { return c == '|'; }); + boost::split(header, *read_line(temp), [](char c) { return c == '|'; }); if (header.size() != 2) return out; int meanings = atoi(header[1].c_str()); out.reserve(meanings); for (int i = 0; i < meanings; ++i) { std::vector line; - boost::split(line, read_line(), [](char c) { return c == '|'; }); + boost::split(line, *read_line(temp), [](char c) { return c == '|'; }); if (line.size() < 2) continue; diff --git a/src/video_controller.cpp b/src/video_controller.cpp index ae78fb2b4..afe3b0865 100644 --- a/src/video_controller.cpp +++ b/src/video_controller.cpp @@ -194,8 +194,8 @@ double VideoController::GetARFromType(AspectRatio type) const { case AspectRatio::Fullscreen: return 4.0/3.0; case AspectRatio::Widescreen: return 16.0/9.0; case AspectRatio::Cinematic: return 2.35; + default: throw agi::InternalError("Bad AR type"); } - throw agi::InternalError("Bad AR type"); } void VideoController::SetAspectRatio(double value) {