From 626e0056fd3dae3161c98339ac302be8bf03b7b5 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 3 Jan 2013 18:02:21 -0800 Subject: [PATCH] replace boost::trim with faster internal trim - refs #1633 --- plugins/input/shape/dbfile.cpp | 7 +++++-- plugins/input/sqlite/sqlite_datasource.cpp | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index c4d7695cf..792afd65c 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "dbfile.hpp" @@ -138,7 +139,7 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, Feature & f) { // FIXME - avoid constructing std::string on stack std::string str(record_+fields_[col].offset_,fields_[col].length_); - boost::trim(str); + mapnik::util::trim(str); f.put(name,tr.transcode(str.c_str())); break; } @@ -206,7 +207,9 @@ void dbf_file::read_header() field_descriptor desc; desc.index_=i; file_.read(name,10); - desc.name_=boost::trim_left_copy(std::string(name)); + desc.name_=name; + // TODO - when is this trim needed? + mapnik::util::trim(desc.name_); skip(1); desc.type_=file_.get(); skip(4); diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index 4c3c2e816..e6da0a1e9 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -32,6 +32,7 @@ #include #include #include +#include // boost #include @@ -429,8 +430,8 @@ void sqlite_datasource::parse_attachdb(std::string const& attachdb) const } // Break out the dbname and the filename - std::string dbname = boost::trim_copy(spec.substr(0, atpos)); - std::string filename = boost::trim_copy(spec.substr(atpos + 1)); + std::string dbname = mapnik::util::trim_copy(spec.substr(0, atpos)); + std::string filename = mapnik::util::trim_copy(spec.substr(atpos + 1)); // Normalize the filename and make it relative to dataset_name_ if (filename.compare(":memory:") != 0)