diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-11 23:59:19 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-11 23:59:19 +0100 |
| commit | 4de8f0118e1baf31cf4c859881dfbf39014b566f (patch) | |
| tree | 91be88947914d05ff942cbefff6c71eab187cc3c /src/asset.cc | |
| parent | 3390da35584709ea0626ec1fefd3bf5d797bcc00 (diff) | |
Use raw_convert instead of boost::lexical_cast as it seems
that lexical_cast will sometimes use a thousands separator
(i.e. it will convert 1234 to a string 1,234). It appears
not to be possible safely to turn this off (you have to set
the global locale). Instead, raw_convert uses a stringstream
which you can imbue() with std::locale::classic() to turn off
the locale-specific behaviour.
Diffstat (limited to 'src/asset.cc')
| -rw-r--r-- | src/asset.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/asset.cc b/src/asset.cc index 4ad29dde..00ad67bc 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -23,7 +23,6 @@ #include <iostream> #include <boost/filesystem.hpp> -#include <boost/lexical_cast.hpp> #include <boost/function.hpp> #include <libxml++/nodes/element.h> #include "AS_DCP.h" @@ -32,10 +31,10 @@ #include "util.h" #include "metadata.h" #include "compose.hpp" +#include "raw_convert.h" using std::string; using boost::shared_ptr; -using boost::lexical_cast; using namespace libdcp; Asset::Asset (boost::filesystem::path directory, boost::filesystem::path file_name) @@ -59,7 +58,7 @@ Asset::write_to_pkl (xmlpp::Node* node, bool interop) const asset->add_child("Id")->add_child_text ("urn:uuid:" + _uuid); asset->add_child("AnnotationText")->add_child_text (_file_name.string ()); asset->add_child("Hash")->add_child_text (digest ()); - asset->add_child("Size")->add_child_text (lexical_cast<string> (boost::filesystem::file_size(path()))); + asset->add_child("Size")->add_child_text (raw_convert<string> (boost::filesystem::file_size(path()))); if (interop) { asset->add_child("Type")->add_child_text (String::compose ("application/x-smpte-mxf;asdcpKind=%1", asdcp_kind ())); } else { @@ -77,7 +76,7 @@ Asset::write_to_assetmap (xmlpp::Node* node) const chunk->add_child("Path")->add_child_text (_file_name.string ()); chunk->add_child("VolumeIndex")->add_child_text ("1"); chunk->add_child("Offset")->add_child_text ("0"); - chunk->add_child("Length")->add_child_text (lexical_cast<string> (boost::filesystem::file_size(path()))); + chunk->add_child("Length")->add_child_text (raw_convert<string> (boost::filesystem::file_size(path()))); } boost::filesystem::path |
