File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -77,11 +77,12 @@ namespace LV {
7777 }
7878
7979 // TODO: Factor this out into a string utility library
80- std::string to_lower_ascii (std::string const & s)
80+ template <typename CharT>
81+ auto to_lower (std::basic_string<CharT> const & s, std::locale const & locale) -> std::basic_string<CharT>
8182 {
82- std::string result {s};
83+ auto result {s};
8384 std::transform (result.begin (), result.end (), result.begin (),
84- [=] (unsigned char c) { return std::tolower (c ); });
85+ [=] (auto c) { return std::tolower (c, locale ); });
8586 return result;
8687 }
8788
@@ -295,9 +296,10 @@ namespace LV {
295296
296297 bool Video::save_to_file (std::string const & path) const
297298 {
298- std::string extension {to_lower_ascii (fs::path {path}.extension ())};
299+ auto extension {fs::path {path}.extension ()};
300+ auto extension_lower (to_lower (extension.native (), std::locale ()));
299301
300- auto entry {bitmap_format_extension_map.find (extension )};
302+ auto entry {bitmap_format_extension_map.find (extension_lower )};
301303 if (entry == bitmap_format_extension_map.end ()) {
302304 visual_log (VISUAL_LOG_ERROR, " Could not deduce format from filename (%s)" , path.c_str ());
303305 return false ;
You can’t perform that action at this time.
0 commit comments