diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-04-15 23:07:24 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-04-15 23:07:24 +0200 |
| commit | 0466bf2201175e55d036f0510fd9a0b08b1d5d2f (patch) | |
| tree | b0419fb4a91830c1c9077f35e210c8aab0c4c65c /src | |
| parent | 6b8e08be8000824e2af0f24dbc86199dd427fcf6 (diff) | |
Move utf8_strlen() out to libdcp.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/hints.cc | 2 | ||||
| -rw-r--r-- | src/lib/util.cc | 20 | ||||
| -rw-r--r-- | src/lib/util.h | 1 |
3 files changed, 1 insertions, 22 deletions
diff --git a/src/lib/hints.cc b/src/lib/hints.cc index ac41b61b8..90b88a6ef 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -607,7 +607,7 @@ Hints::closed_caption(PlayerText text, DCPTimePeriod period) line.second.end(), 0, [](int acc, StringText const& text) { - return acc + utf8_strlen(text.text()); + return acc + dcp::utf8_strlen(text.text()); }); if (length > MAX_CLOSED_CAPTION_LENGTH && !_long_ccap) { diff --git a/src/lib/util.cc b/src/lib/util.cc index adc347ab1..1f5bec22c 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -842,26 +842,6 @@ remap(shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping ma } -size_t -utf8_strlen(string s) -{ - size_t const len = s.length(); - int N = 0; - for (size_t i = 0; i < len; ++i) { - unsigned char c = s[i]; - if ((c & 0xe0) == 0xc0) { - ++i; - } else if ((c & 0xf0) == 0xe0) { - i += 2; - } else if ((c & 0xf8) == 0xf0) { - i += 3; - } - ++N; - } - return N; -} - - /** @param size Size of picture that the subtitle will be overlaid onto */ void emit_subtitle_image(ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder) diff --git a/src/lib/util.h b/src/lib/util.h index aa003ff00..9863e5d94 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -84,7 +84,6 @@ extern std::string atmos_asset_filename(std::shared_ptr<dcp::AtmosAsset> asset, 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); extern void emit_subtitle_image(dcpomatic::ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder); extern void copy_in_bits(boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>); extern dcp::Size scale_for_display(dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta); |
