diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-12 00:57:51 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-12 00:57:51 +0100 |
| commit | df085fc0ea4f1a3f009de5a7a5bf9f241173bcba (patch) | |
| tree | 597ff1fe90446aa684e5fede3a72217b0b5c3d1a /src/lib/config.cc | |
| parent | 1b576d63f5b5babda35c3995dd375e39baa16947 (diff) | |
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.
Diffstat (limited to 'src/lib/config.cc')
| -rw-r--r-- | src/lib/config.cc | 19 |
1 files changed, 8 insertions, 11 deletions
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 <boost/filesystem.hpp> #include <boost/algorithm/string.hpp> #include <libdcp/colour_matrix.h> +#include <libdcp/raw_convert.h> #include <libcxml/cxml.h> #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<string> (_num_local_encoding_threads)); + root->add_child("NumLocalEncodingThreads")->add_child_text (raw_convert<string> (_num_local_encoding_threads)); root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ()); - root->add_child("ServerPortBase")->add_child_text (lexical_cast<string> (_server_port_base)); + root->add_child("ServerPortBase")->add_child_text (raw_convert<string> (_server_port_base)); root->add_child("UseAnyServers")->add_child_text (_use_any_servers ? "1" : "0"); for (vector<string>::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<string> (_default_still_length)); - root->add_child("DefaultJ2KBandwidth")->add_child_text (lexical_cast<string> (_default_j2k_bandwidth)); - root->add_child("DefaultAudioDelay")->add_child_text (lexical_cast<string> (_default_audio_delay)); + root->add_child("DefaultStillLength")->add_child_text (raw_convert<string> (_default_still_length)); + root->add_child("DefaultJ2KBandwidth")->add_child_text (raw_convert<string> (_default_j2k_bandwidth)); + root->add_child("DefaultAudioDelay")->add_child_text (raw_convert<string> (_default_audio_delay)); for (vector<PresetColourConversion>::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<string> (_maximum_j2k_bandwidth)); + root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert<string> (_maximum_j2k_bandwidth)); doc.write_to_file_formatted (file(false).string ()); } |
