13
0

avoid all potential charset conversion when displaying an error relating to filename errors

This commit is contained in:
Paul Davis 2024-05-22 15:57:59 -06:00
parent f227839247
commit ac004eee70

View File

@ -21,6 +21,7 @@
*/ */
#include <algorithm> #include <algorithm>
#include <climits>
#include <vector> #include <vector>
#include <glib.h> #include <glib.h>
@ -138,18 +139,14 @@ run_functor_for_paths (vector<string>& result,
} }
} }
catch (Glib::FileError const& err) { catch (Glib::FileError const& err) {
#ifndef NDEBUG char errstr[PATH_MAX*2];
warning << string_compose (_("Cannot access file: %1"), err.what()) << endmsg; snprintf (errstr, sizeof (errstr), "Cannot access file: %s", err.what().c_str());
#endif warning << errstr << endmsg;
} }
catch (Glib::ConvertError const& err) { catch (Glib::ConvertError const& err) {
#ifndef NDEBUG char errstr[PATH_MAX*2];
warning << string_compose (_("Could not convert filename: %1"), err.what()) << endmsg; snprintf (errstr, sizeof (errstr), "Cannot convert filename: %s", err.what().c_str());
#endif warning << errstr << endmsg;
} catch (...) {
#ifndef NDEBUG
warning << string_compose (_("Could not convert filename: '%1'"), *i) << endmsg;
#endif
} }
} }
} }