diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-17 14:30:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-17 14:30:21 +0100 |
| commit | 34f2b95c1638a2cfedf21de5a203d6c0b77abf11 (patch) | |
| tree | bd78b7dbca7d975a89ef9628f6d4b2fd783a39f1 /src/asset.cc | |
| parent | 81ed0ebb725a7b5fec00ae209ba8b0d70ebc4ee1 (diff) | |
Use an optional<> where there should be one.
Diffstat (limited to 'src/asset.cc')
| -rw-r--r-- | src/asset.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/asset.cc b/src/asset.cc index 1a3bd363..7d3a9813 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -78,11 +78,11 @@ Asset::Asset (string id, boost::filesystem::path file) void Asset::write_to_pkl (xmlpp::Node* node, boost::filesystem::path root, Standard standard) const { - DCP_ASSERT (!_file.empty ()); + DCP_ASSERT (_file); optional<boost::filesystem::path> path = relative_to_root ( boost::filesystem::canonical (root), - boost::filesystem::canonical (_file) + boost::filesystem::canonical (_file.get()) ); if (!path) { @@ -96,18 +96,18 @@ Asset::write_to_pkl (xmlpp::Node* node, boost::filesystem::path root, Standard s asset->add_child("Id")->add_child_text ("urn:uuid:" + _id); asset->add_child("AnnotationText")->add_child_text (_id); asset->add_child("Hash")->add_child_text (hash ()); - asset->add_child("Size")->add_child_text (raw_convert<string> (boost::filesystem::file_size (_file))); + asset->add_child("Size")->add_child_text (raw_convert<string> (boost::filesystem::file_size (_file.get()))); asset->add_child("Type")->add_child_text (pkl_type (standard)); } void Asset::write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const { - DCP_ASSERT (!_file.empty ()); + DCP_ASSERT (_file); optional<boost::filesystem::path> path = relative_to_root ( boost::filesystem::canonical (root), - boost::filesystem::canonical (_file) + boost::filesystem::canonical (_file.get()) ); if (!path) { @@ -125,16 +125,16 @@ Asset::write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const chunk->add_child("Path")->add_child_text (path.get().generic_string()); chunk->add_child("VolumeIndex")->add_child_text ("1"); chunk->add_child("Offset")->add_child_text ("0"); - chunk->add_child("Length")->add_child_text (raw_convert<string> (boost::filesystem::file_size (_file))); + chunk->add_child("Length")->add_child_text (raw_convert<string> (boost::filesystem::file_size (_file.get()))); } string Asset::hash (function<void (float)> progress) const { - DCP_ASSERT (!_file.empty ()); + DCP_ASSERT (_file); if (!_hash) { - _hash = make_digest (_file, progress); + _hash = make_digest (_file.get(), progress); } return _hash.get(); |
