summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/subtitle_asset.cc6
-rw-r--r--src/util.cc13
-rw-r--r--src/util.h5
3 files changed, 5 insertions, 19 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index f707c665..4baa7b06 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -324,7 +324,11 @@ SubtitleAsset::parse_subtitles (xmlpp::Element const * node, vector<ParseState>&
void
SubtitleAsset::maybe_add_subtitle (string text, vector<ParseState> const & parse_state, float space_before, Standard standard)
{
- if (empty_or_white_space (text)) {
+ auto wanted = [](ParseState const& ps) {
+ return ps.type && (ps.type.get() == ParseState::Type::TEXT || ps.type.get() == ParseState::Type::IMAGE);
+ };
+
+ if (find_if(parse_state.begin(), parse_state.end(), wanted) == parse_state.end()) {
return;
}
diff --git a/src/util.cc b/src/util.cc
index b58035ea..9cc35ad6 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -158,19 +158,6 @@ dcp::make_digest (boost::filesystem::path filename, function<void (float)> progr
}
-bool
-dcp::empty_or_white_space (string s)
-{
- for (size_t i = 0; i < s.length(); ++i) {
- if (s[i] != ' ' && s[i] != '\n' && s[i] != '\t') {
- return false;
- }
- }
-
- return true;
-}
-
-
void
dcp::init (optional<boost::filesystem::path> given_resources_directory)
{
diff --git a/src/util.h b/src/util.h
index 451957d8..8261a812 100644
--- a/src/util.h
+++ b/src/util.h
@@ -84,11 +84,6 @@ extern std::string make_digest (boost::filesystem::path filename, boost::functio
extern std::string make_digest (ArrayData data);
-/** @param s A string
- * @return true if the string contains only space, newline or tab characters, or is empty
- */
-extern bool empty_or_white_space (std::string s);
-
extern bool ids_equal (std::string a, std::string b);
extern std::string remove_urn_uuid (std::string raw);