diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-30 23:24:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-01 02:08:06 +0100 |
| commit | 03ba29cac931e5160e93ed0b7ed3c6bbd50335ea (patch) | |
| tree | 38cad354c3296b08fc1072c71d3529a8a6cf693c | |
| parent | 085943d11efb3916af8f2f50d625d39f7074e526 (diff) | |
Make the allowed list a defaulted parameter of careful_string_filter().
| -rw-r--r-- | src/lib/util.cc | 3 | ||||
| -rw-r--r-- | src/lib/util.h | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index 30a82ee50..fde4ce15e 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -783,7 +783,7 @@ atmos_asset_filename (shared_ptr<dcp::AtmosAsset> asset, int reel_index, int ree string -careful_string_filter (string s) +careful_string_filter(string s, wstring allowed) { /* Filter out `bad' characters which `may' cause problems with some systems (either for DCP name or filename). * I don't know of a list of what really is allowed, so this is a guess. @@ -813,7 +813,6 @@ careful_string_filter (string s) /* Then remove anything that's not in a very limited character set */ wstring out; - wstring const allowed = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.+"; for (int i = 0; i < transliterated_more.length(); ++i) { wchar_t c = transliterated_more[i]; if (allowed.find(c) != string::npos) { diff --git a/src/lib/util.h b/src/lib/util.h index d6ed0bccc..eaa705f5e 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -84,7 +84,7 @@ extern std::string video_asset_filename (std::shared_ptr<dcp::PictureAsset> asse extern std::string audio_asset_filename (std::shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary); extern std::string subtitle_asset_filename (std::shared_ptr<dcp::TextAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary, std::string extension); extern std::string atmos_asset_filename (std::shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary); -extern std::string careful_string_filter (std::string); +extern std::string careful_string_filter(std::string s, std::wstring allowed = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.+"); extern std::pair<int, int> audio_channel_types (std::list<int> mapped, int channels); extern std::shared_ptr<AudioBuffers> remap (std::shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map); extern size_t utf8_strlen (std::string s); |
