diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-12-22 23:35:43 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-12-22 23:35:43 +0000 |
| commit | 937b96045830a2326daff83b70b892f2d25244ff (patch) | |
| tree | a882ba2e301b61f2f796a0305164155986c2a0e2 /src/lib | |
| parent | 54e6a93b3399dd7dd5f21c2ad3c9951db24b1b2d (diff) | |
Remove some unused code.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/util.cc | 140 | ||||
| -rw-r--r-- | src/lib/util.h | 9 |
2 files changed, 0 insertions, 149 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index 3ab864c2f..c0e32b778 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1,6 +1,5 @@ /* Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> - Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -418,30 +417,6 @@ dcpomatic_setup_gettext_i18n (string lang) #endif } -/** @param s A string. - * @return Parts of the string split at spaces, except when a space is within quotation marks. - */ -vector<string> -split_at_spaces_considering_quotes (string s) -{ - vector<string> out; - bool in_quotes = false; - string c; - for (string::size_type i = 0; i < s.length(); ++i) { - if (s[i] == ' ' && !in_quotes) { - out.push_back (c); - c = N_(""); - } else if (s[i] == '"') { - in_quotes = !in_quotes; - } else { - c += s[i]; - } - } - - out.push_back (c); - return out; -} - /** @param job Optional job for which to report progress */ string md5_digest (vector<boost::filesystem::path> files, shared_ptr<Job> job) @@ -651,103 +626,6 @@ round_to (float n, int r) return int (n + float(r) / 2) &~ (r - 1); } -/** Read a sequence of key / value pairs from a text stream; - * the keys are the first words on the line, and the values are - * the remainder of the line following the key. Lines beginning - * with # are ignored. - * @param s Stream to read. - * @return key/value pairs. - */ -multimap<string, string> -read_key_value (istream &s) -{ - multimap<string, string> kv; - - string line; - while (getline (s, line)) { - if (line.empty ()) { - continue; - } - - if (line[0] == '#') { - continue; - } - - if (line[line.size() - 1] == '\r') { - line = line.substr (0, line.size() - 1); - } - - size_t const s = line.find (' '); - if (s == string::npos) { - continue; - } - - kv.insert (make_pair (line.substr (0, s), line.substr (s + 1))); - } - - return kv; -} - -string -get_required_string (multimap<string, string> const & kv, string k) -{ - if (kv.count (k) > 1) { - throw StringError (N_("unexpected multiple keys in key-value set")); - } - - multimap<string, string>::const_iterator i = kv.find (k); - - if (i == kv.end ()) { - throw StringError (String::compose (_("missing key %1 in key-value set"), k)); - } - - return i->second; -} - -int -get_required_int (multimap<string, string> const & kv, string k) -{ - string const v = get_required_string (kv, k); - return raw_convert<int> (v); -} - -float -get_required_float (multimap<string, string> const & kv, string k) -{ - string const v = get_required_string (kv, k); - return raw_convert<float> (v); -} - -string -get_optional_string (multimap<string, string> const & kv, string k) -{ - if (kv.count (k) > 1) { - throw StringError (N_("unexpected multiple keys in key-value set")); - } - - multimap<string, string>::const_iterator i = kv.find (k); - if (i == kv.end ()) { - return N_(""); - } - - return i->second; -} - -int -get_optional_int (multimap<string, string> const & kv, string k) -{ - if (kv.count (k) > 1) { - throw StringError (N_("unexpected multiple keys in key-value set")); - } - - multimap<string, string>::const_iterator i = kv.find (k); - if (i == kv.end ()) { - return 0; - } - - return raw_convert<int> (i->second); -} - /** Trip an assert if the caller is not in the UI thread */ void ensure_ui_thread () @@ -836,24 +714,6 @@ wrapped_av_malloc (size_t s) return p; } -string -entities_to_text (string e) -{ - boost::algorithm::replace_all (e, "%3A", ":"); - boost::algorithm::replace_all (e, "%2F", "/"); - return e; -} - -int64_t -divide_with_round (int64_t a, int64_t b) -{ - if (a % b >= (b / 2)) { - return (a + b - 1) / b; - } else { - return a / b; - } -} - /** Return a user-readable string summarising the versions of our dependencies */ string dependency_version_summary () diff --git a/src/lib/util.h b/src/lib/util.h index ede53e0d9..9ae149ef4 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -61,7 +61,6 @@ extern std::string dependency_version_summary (); extern double seconds (struct timeval); extern void dcpomatic_setup (); extern void dcpomatic_setup_gettext_i18n (std::string); -extern std::vector<std::string> split_at_spaces_considering_quotes (std::string); extern std::string md5_digest (std::vector<boost::filesystem::path>, boost::shared_ptr<Job>); extern void ensure_ui_thread (); extern std::string audio_channel_name (int); @@ -72,18 +71,10 @@ extern boost::filesystem::path mo_path (); #endif extern std::string tidy_for_filename (std::string); extern dcp::Size fit_ratio_within (float ratio, dcp::Size, int); -extern std::string entities_to_text (std::string e); extern int dcp_audio_frame_rate (int); extern int stride_round_up (int, int const *, int); extern int round_to (float n, int r); -extern std::multimap<std::string, std::string> read_key_value (std::istream& s); -extern int get_required_int (std::multimap<std::string, std::string> const & kv, std::string k); -extern float get_required_float (std::multimap<std::string, std::string> const & kv, std::string k); -extern std::string get_required_string (std::multimap<std::string, std::string> const & kv, std::string k); -extern int get_optional_int (std::multimap<std::string, std::string> const & kv, std::string k); -extern std::string get_optional_string (std::multimap<std::string, std::string> const & kv, std::string k); extern void* wrapped_av_malloc (size_t); -extern int64_t divide_with_round (int64_t a, int64_t b); extern ContentTimePeriod subtitle_period (AVSubtitle const &); extern void set_backtrace_file (boost::filesystem::path); |
