diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-01-28 22:52:13 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-01-28 22:52:13 +0000 |
| commit | a112eeb4d052b1212f94e95efd83a215213da691 (patch) | |
| tree | cc023a901e0cbbd14e79a3ce084691fd9445c03a /src/lib | |
| parent | a76f484d1e5c6c44c8d2e4938340e8559b2ef65a (diff) | |
Small fixes and tidy-ups spotted by cppcheck.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cinema.cc | 2 | ||||
| -rw-r--r-- | src/lib/colour_conversion.cc | 3 | ||||
| -rw-r--r-- | src/lib/content_video.h | 1 | ||||
| -rw-r--r-- | src/lib/exceptions.h | 6 | ||||
| -rw-r--r-- | src/lib/font.cc | 5 | ||||
| -rw-r--r-- | src/lib/image_examiner.cc | 2 | ||||
| -rw-r--r-- | src/lib/isdcf_metadata.cc | 52 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 1 | ||||
| -rw-r--r-- | src/lib/update.h | 2 | ||||
| -rw-r--r-- | src/lib/util.cc | 3 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 11 |
11 files changed, 29 insertions, 59 deletions
diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index 282f5427f..f06db3543 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -68,8 +68,8 @@ Cinema::remove_screen (shared_ptr<Screen> s) } Screen::Screen (cxml::ConstNodePtr node) + : name (node->string_child ("name")) { - name = node->string_child ("Name"); if (node->optional_string_child ("Certificate")) { certificate = dcp::Certificate (node->string_child ("Certificate")); } diff --git a/src/lib/colour_conversion.cc b/src/lib/colour_conversion.cc index ad09458f9..028912f2b 100644 --- a/src/lib/colour_conversion.cc +++ b/src/lib/colour_conversion.cc @@ -193,8 +193,9 @@ PresetColourConversion::PresetColourConversion (string n, dcp::ColourConversion PresetColourConversion::PresetColourConversion (cxml::NodePtr node, int version) : conversion (node, version) + , name (node->string_child ("Name")) { - name = node->string_child ("Name"); + } void diff --git a/src/lib/content_video.h b/src/lib/content_video.h index a7f73597c..4c0bdb655 100644 --- a/src/lib/content_video.h +++ b/src/lib/content_video.h @@ -30,6 +30,7 @@ class ContentVideo public: ContentVideo () : eyes (EYES_BOTH) + , part (PART_WHOLE) {} ContentVideo (boost::shared_ptr<const ImageProxy> i, Eyes e, Part p, VideoFrame f) diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 950c2f381..96dc816ec 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -40,9 +40,9 @@ class StringError : public std::exception { public: /** @param w Error message */ - StringError (std::string w) { - _what = w; - } + StringError (std::string w) + : _what (w) + {} virtual ~StringError () throw () {} diff --git a/src/lib/font.cc b/src/lib/font.cc index ecf7aabf0..5cf30a2aa 100644 --- a/src/lib/font.cc +++ b/src/lib/font.cc @@ -21,9 +21,10 @@ #include <libxml++/libxml++.h> Font::Font (cxml::NodePtr node) + : id (node->string_child ("Id")) + , file (node->optional_string_child ("File")) { - id = node->string_child ("Id"); - file = node->optional_string_child ("File"); + } void diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index 6212875b1..299f7f38d 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -47,11 +47,11 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag boost::filesystem::path path = content->path(0).string (); if (valid_j2k_file (path)) { boost::uintmax_t size = boost::filesystem::file_size (path); - uint8_t* buffer = new uint8_t[size]; FILE* f = fopen_boost (path, "r"); if (!f) { throw FileError ("Could not open file for reading", path); } + uint8_t* buffer = new uint8_t[size]; fread (buffer, 1, size, f); fclose (f); try { diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc index 7d960b6ac..9d9d825f5 100644 --- a/src/lib/isdcf_metadata.cc +++ b/src/lib/isdcf_metadata.cc @@ -29,23 +29,23 @@ using boost::shared_ptr; using dcp::raw_convert; ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node) -{ - content_version = node->number_child<int> ("ContentVersion"); - audio_language = node->string_child ("AudioLanguage"); - subtitle_language = node->string_child ("SubtitleLanguage"); - territory = node->string_child ("Territory"); - rating = node->string_child ("Rating"); - studio = node->string_child ("Studio"); - facility = node->string_child ("Facility"); - package_type = node->string_child ("PackageType"); - + : content_version (node->number_child<int> ("ContentVersion")) + , audio_language (node->string_child ("AudioLanguage")) + , subtitle_language (node->string_child ("SubtitleLanguage")) + , territory (node->string_child ("Territory")) + , rating (node->string_child ("Rating")) + , studio (node->string_child ("Studio")) + , facility (node->string_child ("Facility")) + , package_type (node->string_child ("PackageType")) /* This stuff was added later */ - temp_version = node->optional_bool_child ("TempVersion").get_value_or (false); - pre_release = node->optional_bool_child ("PreRelease").get_value_or (false); - red_band = node->optional_bool_child ("RedBand").get_value_or (false); - chain = node->optional_string_child ("Chain").get_value_or (""); - two_d_version_of_three_d = node->optional_bool_child ("TwoDVersionOfThreeD").get_value_or (false); - mastered_luminance = node->optional_string_child ("MasteredLuminance").get_value_or (""); + , temp_version (node->optional_bool_child ("TempVersion").get_value_or (false)) + , pre_release (node->optional_bool_child ("PreRelease").get_value_or (false)) + , red_band (node->optional_bool_child ("RedBand").get_value_or (false)) + , chain (node->optional_string_child ("Chain").get_value_or ("")) + , two_d_version_of_three_d (node->optional_bool_child ("TwoDVersionOfThreeD").get_value_or (false)) + , mastered_luminance (node->optional_string_child ("MasteredLuminance").get_value_or ("")) +{ + } void @@ -66,23 +66,3 @@ ISDCFMetadata::as_xml (xmlpp::Node* root) const root->add_child("TwoDVersionOfThreeD")->add_child_text (two_d_version_of_three_d ? "1" : "0"); root->add_child("MasteredLuminance")->add_child_text (mastered_luminance); } - -void -ISDCFMetadata::read_old_metadata (string k, string v) -{ - if (k == N_("audio_language")) { - audio_language = v; - } else if (k == N_("subtitle_language")) { - subtitle_language = v; - } else if (k == N_("territory")) { - territory = v; - } else if (k == N_("rating")) { - rating = v; - } else if (k == N_("studio")) { - studio = v; - } else if (k == N_("facility")) { - facility = v; - } else if (k == N_("package_type")) { - package_type = v; - } -} diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 1698da99e..1aeed4062 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -84,7 +84,6 @@ Playlist::maybe_sequence_video () _sequencing_video = true; - ContentList cl = _content; DCPTime next_left; DCPTime next_right; for (ContentList::iterator i = _content.begin(); i != _content.end(); ++i) { diff --git a/src/lib/update.h b/src/lib/update.h index c3e2b5613..5bb9e9501 100644 --- a/src/lib/update.h +++ b/src/lib/update.h @@ -30,7 +30,7 @@ struct update_checker_test; /** Class to check for the existance of an update for DCP-o-matic on a remote server */ -class UpdateChecker +class UpdateChecker : public boost::noncopyable { public: UpdateChecker (); diff --git a/src/lib/util.cc b/src/lib/util.cc index 0a6f381db..807883ca0 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -287,9 +287,8 @@ set_backtrace_file (boost::filesystem::path p) void terminate () { - static bool tried_throw = false; - try { + static bool tried_throw = false; // try once to re-throw currently active exception if (!tried_throw) { tried_throw = true; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 5dc9e3d66..823517bfc 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -443,17 +443,6 @@ VideoContent::video_size_after_crop () const return crop().apply (video_size_after_3d_split ()); } -/** @param t A time offset from the start of this piece of content. - * @return Corresponding time with respect to the content. - */ -ContentTime -VideoContent::dcp_time_to_content_time (DCPTime t) const -{ - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); - return ContentTime (t, FrameRateChange (video_frame_rate(), film->video_frame_rate())); -} - void VideoContent::scale_and_crop_to_fit_width () { |
