From df085fc0ea4f1a3f009de5a7a5bf9f241173bcba Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 12 May 2014 00:57:51 +0100 Subject: Remove LocaleGuard and lexical_cast<> in favour of libdcp::raw_convert, which should get things right with both decimal and thousands separators; LocaleGuard fixed decimal separators ok but not, it appears, thousands ones. --- src/lib/config.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/lib/config.cc') diff --git a/src/lib/config.cc b/src/lib/config.cc index eda56416d..d7503b848 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "config.h" #include "server.h" @@ -46,10 +47,10 @@ using std::max; using std::exception; using std::cerr; using boost::shared_ptr; -using boost::lexical_cast; using boost::optional; using boost::algorithm::is_any_of; using boost::algorithm::split; +using libdcp::raw_convert; Config* Config::_instance = 0; @@ -87,8 +88,6 @@ Config::Config () void Config::read () { - LocaleGuard lg; - if (!boost::filesystem::exists (file (false))) { read_old_metadata (); return; @@ -308,15 +307,13 @@ Config::instance () void Config::write () const { - LocaleGuard lg; - xmlpp::Document doc; xmlpp::Element* root = doc.create_root_node ("Config"); root->add_child("Version")->add_child_text ("1"); - root->add_child("NumLocalEncodingThreads")->add_child_text (lexical_cast (_num_local_encoding_threads)); + root->add_child("NumLocalEncodingThreads")->add_child_text (raw_convert (_num_local_encoding_threads)); root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ()); - root->add_child("ServerPortBase")->add_child_text (lexical_cast (_server_port_base)); + root->add_child("ServerPortBase")->add_child_text (raw_convert (_server_port_base)); root->add_child("UseAnyServers")->add_child_text (_use_any_servers ? "1" : "0"); for (vector::const_iterator i = _servers.begin(); i != _servers.end(); ++i) { @@ -344,9 +341,9 @@ Config::write () const _default_dci_metadata.as_xml (root->add_child ("DCIMetadata")); - root->add_child("DefaultStillLength")->add_child_text (lexical_cast (_default_still_length)); - root->add_child("DefaultJ2KBandwidth")->add_child_text (lexical_cast (_default_j2k_bandwidth)); - root->add_child("DefaultAudioDelay")->add_child_text (lexical_cast (_default_audio_delay)); + root->add_child("DefaultStillLength")->add_child_text (raw_convert (_default_still_length)); + root->add_child("DefaultJ2KBandwidth")->add_child_text (raw_convert (_default_j2k_bandwidth)); + root->add_child("DefaultAudioDelay")->add_child_text (raw_convert (_default_audio_delay)); for (vector::const_iterator i = _colour_conversions.begin(); i != _colour_conversions.end(); ++i) { i->as_xml (root->add_child ("ColourConversion")); @@ -365,7 +362,7 @@ Config::write () const root->add_child("CheckForUpdates")->add_child_text (_check_for_updates ? "1" : "0"); root->add_child("CheckForTestUpdates")->add_child_text (_check_for_test_updates ? "1" : "0"); - root->add_child("MaximumJ2KBandwidth")->add_child_text (lexical_cast (_maximum_j2k_bandwidth)); + root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert (_maximum_j2k_bandwidth)); doc.write_to_file_formatted (file(false).string ()); } -- cgit v1.2.3