From e28328ba135603b3b8be60e786bb5414c44255d5 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Sun, 16 Nov 2008 22:13:40 +0000 Subject: [PATCH] + applied patch to loosen the type checking when reading float strings from a dbf file (jonb) --- plugins/input/shape/dbffile.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/plugins/input/shape/dbffile.cpp b/plugins/input/shape/dbffile.cpp index dbaa4080b..327f50f75 100644 --- a/plugins/input/shape/dbffile.cpp +++ b/plugins/input/shape/dbffile.cpp @@ -136,27 +136,15 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, Feature cons } if ( fields_[col].dec_>0 ) { - try - { - double d = boost::lexical_cast(str); - boost::put(f,name,d); - } - catch (boost::bad_lexical_cast &) - { - boost::put(f,name,0.0); - } + double d = 0.0; + std::istringstream(str) >> d; + boost::put(f,name,d); } else { - try - { - int i = boost::lexical_cast(str); - boost::put(f,name,i); - } - catch (boost::bad_lexical_cast &) - { - boost::put(f,name,0); - } + int i = 0; + std::istringstream(str) >> i; + boost::put(f,name,i); } break; }