replace boost::trim with faster internal trim - refs #1633

This commit is contained in:
Dane Springmeyer 2013-01-03 18:02:21 -08:00
parent 58d53dbe2f
commit 626e0056fd
2 changed files with 8 additions and 4 deletions

View file

@ -23,6 +23,7 @@
#include <mapnik/global.hpp>
#include <mapnik/utils.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/util/trim.hpp>
#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);

View file

@ -32,6 +32,7 @@
#include <mapnik/util/geometry_to_ds_type.hpp>
#include <mapnik/timer.hpp>
#include <mapnik/wkb.hpp>
#include <mapnik/util/trim.hpp>
// boost
#include <boost/algorithm/string.hpp>
@ -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)