summaryrefslogtreecommitdiff
path: root/src/cpl.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-11 23:59:19 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-11 23:59:19 +0100
commit4de8f0118e1baf31cf4c859881dfbf39014b566f (patch)
tree91be88947914d05ff942cbefff6c71eab187cc3c /src/cpl.cc
parent3390da35584709ea0626ec1fefd3bf5d797bcc00 (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/cpl.cc')
-rw-r--r--src/cpl.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index e333df0d..5079b4f6 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
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
@@ -31,6 +31,7 @@
#include "signer.h"
#include "exceptions.h"
#include "compose.hpp"
+#include "raw_convert.h"
using std::string;
using std::stringstream;
@@ -248,7 +249,7 @@ CPL::write_to_pkl (xmlpp::Node* node, bool interop) const
xmlpp::Node* asset = node->add_child ("Asset");
asset->add_child("Id")->add_child_text ("urn:uuid:" + _id);
asset->add_child("Hash")->add_child_text (_digest);
- asset->add_child("Size")->add_child_text (lexical_cast<string> (_length));
+ asset->add_child("Size")->add_child_text (raw_convert<string> (_length));
if (interop) {
asset->add_child("Type")->add_child_text ("text/xml;asdcpKind=CPL");
} else {
@@ -285,7 +286,7 @@ CPL::write_to_assetmap (xmlpp::Node* node) const
chunk->add_child("Path")->add_child_text (_id + "_cpl.xml");
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> (_length));
+ chunk->add_child("Length")->add_child_text (raw_convert<string> (_length));
}