From 5af0e95c9436d9279f5b55d59e94bad939ac45b2 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 25 Mar 2013 11:19:51 -0700 Subject: [PATCH 01/11] scons: add HOST option, which if set will skip configure checks - in the future it might do more --- SConstruct | 70 +++++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/SConstruct b/SConstruct index 058e121a5..a49fcdca5 100644 --- a/SConstruct +++ b/SConstruct @@ -274,6 +274,7 @@ opts.AddVariables( ('WARNING_CXXFLAGS', 'Compiler flags you can set to reduce warning levels which are placed after -Wall.', ''), # SCons build behavior options + ('HOST', 'Set the target host for cross compiling"', ''), ('CONFIG', "The path to the python file in which to save user configuration options. Currently : '%s'" % SCONS_LOCAL_CONFIG,SCONS_LOCAL_CONFIG), BoolVariable('USE_CONFIG', "Use SCons user '%s' file (will also write variables after successful configuration)", 'True'), # http://www.scons.org/wiki/GoFastButton @@ -1187,19 +1188,21 @@ if not preconfigured: if env['PRIORITIZE_LINKING']: conf.prioritize_paths(silent=False) - for libname, headers, required, lang in LIBSHEADERS: - if not conf.CheckLibWithHeader(libname, headers, lang): - if required: - color_print(1, 'Could not find required header or shared library for %s' % libname) - env['MISSING_DEPS'].append(libname) - else: - color_print(4, 'Could not find optional header or shared library for %s' % libname) - env['SKIPPED_DEPS'].append(libname) + if not env['HOST']: + for libname, headers, required, lang in LIBSHEADERS: + if not conf.CheckLibWithHeader(libname, headers, lang): + if required: + color_print(1, 'Could not find required header or shared library for %s' % libname) + env['MISSING_DEPS'].append(libname) + else: + color_print(4, 'Could not find optional header or shared library for %s' % libname) + env['SKIPPED_DEPS'].append(libname) - if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: - if not conf.icu_at_least_four_two(): - # expression_string.cpp and map.cpp use fromUTF* function only available in >= ICU 4.2 - env['MISSING_DEPS'].append(env['ICU_LIB_NAME']) + if not env['HOST']: + if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: + if not conf.icu_at_least_four_two(): + # expression_string.cpp and map.cpp use fromUTF* function only available in >= ICU 4.2 + env['MISSING_DEPS'].append(env['ICU_LIB_NAME']) if env['BIGINT']: env.Append(CPPDEFINES = '-DBIGINT') @@ -1234,24 +1237,26 @@ if not preconfigured: if env['PRIORITIZE_LINKING']: conf.prioritize_paths() - # if the user is not setting custom boost configuration - # enforce boost version greater than or equal to BOOST_MIN_VERSION - if not conf.CheckBoost(BOOST_MIN_VERSION): - color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) - color_print(1,'Boost version %s or greater is required' % BOOST_MIN_VERSION) - if not env['BOOST_VERSION']: - env['MISSING_DEPS'].append('boost version >=%s' % BOOST_MIN_VERSION) - else: - color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) + if not env['HOST']: + # if the user is not setting custom boost configuration + # enforce boost version greater than or equal to BOOST_MIN_VERSION + if not conf.CheckBoost(BOOST_MIN_VERSION): + color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) + color_print(1,'Boost version %s or greater is required' % BOOST_MIN_VERSION) + if not env['BOOST_VERSION']: + env['MISSING_DEPS'].append('boost version >=%s' % BOOST_MIN_VERSION) + else: + color_print(4,'Found boost lib version... %s' % env.get('BOOST_LIB_VERSION_FROM_HEADER') ) - for count, libinfo in enumerate(BOOST_LIBSHEADERS): - if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++'): - if libinfo[2]: - color_print(1,'Could not find required header or shared library for boost %s' % libinfo[0]) - env['MISSING_DEPS'].append('boost ' + libinfo[0]) - else: - color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0]) - env['SKIPPED_DEPS'].append('boost ' + libinfo[0]) + if not env['HOST']: + for count, libinfo in enumerate(BOOST_LIBSHEADERS): + if not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0],env['BOOST_APPEND']), libinfo[1], 'C++'): + if libinfo[2]: + color_print(1,'Could not find required header or shared library for boost %s' % libinfo[0]) + env['MISSING_DEPS'].append('boost ' + libinfo[0]) + else: + color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0]) + env['SKIPPED_DEPS'].append('boost ' + libinfo[0]) if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: # http://lists.boost.org/Archives/boost/2009/03/150076.php @@ -1479,9 +1484,10 @@ if not preconfigured: env['BOOST_PYTHON_LIB'] = 'boost_python3%s' % env['BOOST_APPEND'] elif env['BOOST_PYTHON_LIB'] == 'boost_python': env['BOOST_PYTHON_LIB'] = 'boost_python%s' % env['BOOST_APPEND'] - if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'): - color_print(1,'Could not find required header files for boost python') - env['MISSING_DEPS'].append('boost python') + if not env['HOST']: + if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'): + color_print(1,'Could not find required header files for boost python') + env['MISSING_DEPS'].append('boost python') if env['CAIRO']: if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'): From ab5f5afdd59b8492310974aac4f64eba6565a75c Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 25 Mar 2013 13:38:14 -0700 Subject: [PATCH 02/11] fix expected point symbolizer rendering tests after fe526fd3d6dbf --- .../simple-400-100-2.0-agg-reference.png | Bin 3780 -> 3769 bytes .../simple-800-100-2.0-agg-reference.png | Bin 5217 -> 5224 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/visual_tests/images/simple-400-100-2.0-agg-reference.png b/tests/visual_tests/images/simple-400-100-2.0-agg-reference.png index 9d412144ffe625a4e4be4009653624464b40deb6..b9efaa379e1b9d3041a256265bd0fe40bcb096a2 100644 GIT binary patch delta 3427 zcmY+Adpy&R_s4f}pSwinGRifVkLyC15p$Q^R-!aSG%195yEajpTe*Z#sI5dHF-k5& zGS`^ghvb@TbN$ul@%ui$kMH^Wd7kHWUdltBG&4|PDh1!r<9yYEQH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|H-xa%aj)GH-^Pkrd%snYuor{ROBF5c|0$@f z=4IZT@OQCqJJP!R>bvNh(uXg_JZ5@D$PT{sTr*X}YC9x^K9P=R3RLNwrDsiCw_f7s zntuc_bWxAm0GNh$oJn@#gY@<4#Mhf{_E@UP-H*`50Gqi=oIW?nU7wh$1L~QkM&<-s zjhVb)8GdMwa&$R%qE}U+uq?u}oxb8Jxp-vK^>oZViTQP_s9>G?eEHO|rU>(40|=?~ z&vn)TBgp?`*g#fYdLz5=LpJ}Qx=J#?KmP)B%o(uMP;m-MJi;+j9imsjD`6xguZ{4U zIP#fVFayzbRq%V&m$_N(H6cWQ3E609zZ!I(Xf^4YZb&VuRWY4Mb)|xc2v*NbL*TH2 z?We4Jdo-}{_Y#9^X{YZ%esksj?q*)BVg diff --git a/tests/visual_tests/images/simple-800-100-2.0-agg-reference.png b/tests/visual_tests/images/simple-800-100-2.0-agg-reference.png index cde42dbf6a6f154ed7e585d179bfd420f74ef41c..d1f9fcdf9d8cefc96bf47b0baf026e489b261ff5 100644 GIT binary patch delta 4983 zcmbW3X*|?l*#FHmgF!Xcu{TA?PC|)UERj8A-wDZ9gfSUo9ZM0}%2JkWW#5vqlx2{F zY$?l7XvofBaI4?{^?!6fy1x(4_jNw!eJ$sFu351~v7`muJsk~{X;9XRZS3ve*Em$c zAPyr96zZkeg*f?v+T&we8Rr*63R2uN`?q(jcCF5cF8$F7>>3I?;A5fNK=qB8$fdVZ z-e6%aB+ga)mcYgF7I09l92Z(7e57jS?A;$P6E9<^UX!|*T8xyv8*^R7=2Oa~B9fP{ zwU9;aUPw1C(d&KRp7eKp*wuP=)_@@c1rWzUH2ZGGs$5!by{Xogm@DSckB*DR6(y?G7oX~N);%+I>r;iS3hbTr z09De}2x#%ZK8$}azHfhlDP)B0OUF1nVYqhO*4h3lJ{(64)T7ELHZ>W{5t`+Wn%2|ri%++?^)kwtG*N?tH1>MF?rQ6p;%I} z`~X{tG`iwGYwUB@Apjh3r+vb}=;P<^kE;j7R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%rQ)eG4f2MoY+p1**hm|iQ= z@^g;=tHZ;?Pg{#1rZVmQsct^P@HBstXVgMjr~vQy?uoIQI0PTw5eaV)OxXY4a@jCF14N@&=&%gAgT37}L_on|urI67=M6 z|IPjwG4a;0WJ-BfxBK*Bt`nCYke&`aDOV}t(?iFtUi&ka=1r?_B-K37BKw%f0?Cxu zSo?|>Y}(TM9-8X^4$R=rmmwIuZ}n%KbVHs4_c Date: Mon, 25 Mar 2013 18:27:41 -0700 Subject: [PATCH 03/11] add image io tests for proper error behavior on invalid images - refs #1775 --- tests/cpp_tests/data/blank.jpg | 0 tests/cpp_tests/data/blank.png | 0 tests/cpp_tests/data/blank.tiff | 0 tests/cpp_tests/image_io_test.cpp | 75 +++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 tests/cpp_tests/data/blank.jpg create mode 100644 tests/cpp_tests/data/blank.png create mode 100644 tests/cpp_tests/data/blank.tiff create mode 100644 tests/cpp_tests/image_io_test.cpp diff --git a/tests/cpp_tests/data/blank.jpg b/tests/cpp_tests/data/blank.jpg new file mode 100644 index 000000000..e69de29bb diff --git a/tests/cpp_tests/data/blank.png b/tests/cpp_tests/data/blank.png new file mode 100644 index 000000000..e69de29bb diff --git a/tests/cpp_tests/data/blank.tiff b/tests/cpp_tests/data/blank.tiff new file mode 100644 index 000000000..e69de29bb diff --git a/tests/cpp_tests/image_io_test.cpp b/tests/cpp_tests/image_io_test.cpp new file mode 100644 index 000000000..f42718d85 --- /dev/null +++ b/tests/cpp_tests/image_io_test.cpp @@ -0,0 +1,75 @@ +#include +#include +namespace fs = boost::filesystem; +using fs::path; +namespace sys = boost::system; + +#include +#include +#include +#include + + +int main( int, char*[] ) +{ + std::string blank; + boost::optional type; + try + { + blank = "./tests/cpp_tests/data/blank.jpg"; + BOOST_TEST( fs::exists( blank ) ); + type = mapnik::type_from_filename(blank); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(blank,*type)); + BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } + + blank = "./tests/cpp_tests/data/blank.png"; + BOOST_TEST( fs::exists( blank ) ); + type = mapnik::type_from_filename(blank); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(blank,*type)); + BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } + + blank = "./tests/cpp_tests/data/blank.tiff"; + BOOST_TEST( fs::exists( blank ) ); + type = mapnik::type_from_filename(blank); + BOOST_TEST( type ); + try + { + std::auto_ptr reader(mapnik::get_image_reader(blank,*type)); + BOOST_TEST( false ); + } + catch (std::exception const&) + { + BOOST_TEST( true ); + } + } + catch (std::exception const & ex) + { + std::clog << "C++ image i/o problem: " << ex.what() << "\n"; + BOOST_TEST(false); + } + + if (!::boost::detail::test_errors()) { + std::clog << "C++ image i/o: \x1b[1;32m✓ \x1b[0m\n"; +#if BOOST_VERSION >= 104600 + ::boost::detail::report_errors_remind().called_report_errors_function = true; +#endif + } else { + return ::boost::report_errors(); + } +} From 412aa510a121c2fa39b0c7ba0d3e4e7ae87eb89c Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 25 Mar 2013 18:29:29 -0700 Subject: [PATCH 04/11] fix jpeg/tiff error handling on failed reads - closes #1775 --- src/jpeg_reader.cpp | 44 ++++++++++++++++++++++++++++++-------------- src/tiff_reader.cpp | 8 ++++++++ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index 1b3eab6c1..05dbd66fe 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -45,6 +45,9 @@ private: std::string fileName_; unsigned width_; unsigned height_; + jpeg_decompress_struct cinfo; + jpeg_error_mgr jerr; + FILE *fp; public: explicit JpegReader(std::string const& fileName); ~JpegReader(); @@ -54,6 +57,8 @@ public: void read(unsigned x,unsigned y,image_data_32& image); private: void init(); + static void on_error(j_common_ptr cinfo); + static void on_error_message(j_common_ptr cinfo); }; namespace @@ -68,27 +73,43 @@ const bool registered = register_image_reader("jpeg",createJpegReader); JpegReader::JpegReader(std::string const& fileName) : fileName_(fileName), width_(0), - height_(0) + height_(0), + fp(NULL) { init(); } -JpegReader::~JpegReader() {} +JpegReader::~JpegReader() { + if (fp) + { + fclose(fp); + } + jpeg_destroy_decompress(&cinfo); +} + +void JpegReader::on_error(j_common_ptr cinfo) +{ + (*cinfo->err->output_message)(cinfo); + jpeg_destroy(cinfo); + throw image_reader_exception("JPEG Reader: libjpeg could not read image"); +} + +void JpegReader::on_error_message(j_common_ptr cinfo) +{ + // used to supress jpeg from printing to stderr +} void JpegReader::init() { - FILE *fp = fopen(fileName_.c_str(),"rb"); + fp = fopen(fileName_.c_str(),"rb"); if (!fp) throw image_reader_exception("JPEG Reader: cannot open image file " + fileName_); - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - cinfo.err = jpeg_std_error(&jerr); - + jerr.error_exit = on_error; + jerr.output_message = on_error_message; jpeg_create_decompress(&cinfo); jpeg_stdio_src(&cinfo, fp); jpeg_read_header(&cinfo, TRUE); - jpeg_start_decompress(&cinfo); width_ = cinfo.output_width; height_ = cinfo.output_height; @@ -110,12 +131,9 @@ unsigned JpegReader::height() const void JpegReader::read(unsigned x0, unsigned y0, image_data_32& image) { - struct jpeg_decompress_struct cinfo; - - FILE *fp = fopen(fileName_.c_str(),"rb"); + fp = fopen(fileName_.c_str(),"rb"); if (!fp) throw image_reader_exception("JPEG Reader: cannot open image file " + fileName_); - struct jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); @@ -129,7 +147,6 @@ void JpegReader::read(unsigned x0, unsigned y0, image_data_32& image) if (cinfo.output_width == 0) { jpeg_destroy_decompress (&cinfo); - fclose(fp); throw image_reader_exception("JPEG Reader: failed to read image size of " + fileName_); } @@ -168,6 +185,5 @@ void JpegReader::read(unsigned x0, unsigned y0, image_data_32& image) } jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); - fclose(fp); } } diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 43a3beac1..9c1897b68 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -82,6 +82,7 @@ private: void read_stripped(unsigned x,unsigned y,image_data_32& image); void read_tiled(unsigned x,unsigned y,image_data_32& image); TIFF* load_if_exists(std::string const& filename); + static void on_error(const char* /*module*/, const char* fmt, va_list argptr); }; namespace @@ -107,11 +108,18 @@ tiff_reader::tiff_reader(std::string const& file_name) init(); } +void tiff_reader::on_error(const char* /*module*/, const char* fmt, va_list argptr) +{ + char msg[10240]; + vsprintf(msg, fmt, argptr); + throw image_reader_exception(msg); +} void tiff_reader::init() { // TODO: error handling TIFFSetWarningHandler(0); + TIFFSetErrorHandler(on_error); TIFF* tif = load_if_exists(file_name_); if (!tif) throw image_reader_exception( std::string("Can't load tiff file: '") + file_name_ + "'"); From 350ff279ee23156385f124ea7ce757913245ccd2 Mon Sep 17 00:00:00 2001 From: kunitoki Date: Tue, 26 Mar 2013 11:05:02 +0100 Subject: [PATCH 05/11] - avoid treating all CPPDEFINES as a whole in scons --- SConstruct | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index a49fcdca5..a9b59da2f 100644 --- a/SConstruct +++ b/SConstruct @@ -1559,9 +1559,9 @@ if not preconfigured: # Common debugging flags. # http://lists.fedoraproject.org/pipermail/devel/2010-November/144952.html - debug_flags = '-g -fno-omit-frame-pointer' - debug_defines = '-DDEBUG -DMAPNIK_DEBUG' - ndebug_defines = '-DNDEBUG' + debug_flags = ['-g', '-fno-omit-frame-pointer'] + debug_defines = ['-DDEBUG', '-DMAPNIK_DEBUG'] + ndebug_defines = ['-DNDEBUG'] # Enable logging in debug mode (always) and release mode (when specified) if env['DEFAULT_LOG_SEVERITY']: @@ -1576,7 +1576,7 @@ if not preconfigured: color_print(1,"No logger severity specified, available options are %s." % severities_list) Exit(1) - log_enabled = ' -DMAPNIK_LOG -DMAPNIK_DEFAULT_LOG_SEVERITY=%d' % log_severity + log_enabled = ['-DMAPNIK_LOG', '-DMAPNIK_DEFAULT_LOG_SEVERITY=%d' % log_severity] if env['DEBUG']: debug_defines += log_enabled @@ -1586,8 +1586,8 @@ if not preconfigured: # Enable statistics reporting if env['ENABLE_STATS']: - debug_defines += ' -DMAPNIK_STATS' - ndebug_defines += ' -DMAPNIK_STATS' + debug_defines.append('-DMAPNIK_STATS') + ndebug_defines.append('-DMAPNIK_STATS') # Add rdynamic to allow using statics between application and plugins # http://stackoverflow.com/questions/8623657/multiple-instances-of-singleton-across-shared-libraries-on-linux From 3c56ac656abae2404150ae7262e970fdfc7502a5 Mon Sep 17 00:00:00 2001 From: kunitoki Date: Wed, 27 Mar 2013 09:01:03 +0100 Subject: [PATCH 06/11] - scons help cosmetics --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index a9b59da2f..1bd4f5e94 100644 --- a/SConstruct +++ b/SConstruct @@ -351,7 +351,7 @@ PathVariable.PathAccept), # Variables for logging and statistics BoolVariable('ENABLE_LOG', 'Enable logging, which is enabled by default when building in *debug*', 'False'), BoolVariable('ENABLE_STATS', 'Enable global statistics during map processing', 'False'), - ('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. ' + ', '.join(severities), 'error'), + ('DEFAULT_LOG_SEVERITY', 'The default severity of the logger (eg. ' + ', '.join(severities) + ')', 'error'), # Other variables BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'), From af2bb2be1ee1e25d71838db36afd0775ad9d528a Mon Sep 17 00:00:00 2001 From: kunitoki Date: Wed, 27 Mar 2013 09:02:03 +0100 Subject: [PATCH 07/11] - avoid using double quotes when already escaping as string --- src/debug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.cpp b/src/debug.cpp index f0f4d4540..bebacb4b3 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -27,7 +27,7 @@ #include #ifndef MAPNIK_LOG_FORMAT -#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:" + #define MAPNIK_LOG_FORMAT Mapnik LOG> %Y-%m-%d %H:%M:%S: #endif #ifndef MAPNIK_DEFAULT_LOG_SEVERITY From 26ba946cb0439f5594fe0b6490035a97e77faa22 Mon Sep 17 00:00:00 2001 From: kunitoki Date: Wed, 27 Mar 2013 09:02:40 +0100 Subject: [PATCH 08/11] - avoid using clog/cerr in sqlite plugin (use mapnik::logging facilities instead) --- plugins/input/sqlite/sqlite_prepared.hpp | 7 +++++-- plugins/input/sqlite/sqlite_resultset.hpp | 1 + plugins/input/sqlite/sqlite_utils.hpp | 25 ++++++++++++----------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/plugins/input/sqlite/sqlite_prepared.hpp b/plugins/input/sqlite/sqlite_prepared.hpp index 477759f5d..f10ad7288 100644 --- a/plugins/input/sqlite/sqlite_prepared.hpp +++ b/plugins/input/sqlite/sqlite_prepared.hpp @@ -24,6 +24,7 @@ #define MAPNIK_SQLITE_PREPARED_HPP // mapnik +#include #include #include #include @@ -77,11 +78,13 @@ public: { if (*(*ds_)) { - std::cerr << "ERR:" << sqlite3_errmsg(*(*ds_)) << "\n"; + MAPNIK_LOG_ERROR(sqlite) << "~prepared_index_statement:" + << sqlite3_errmsg(*(*ds_)); } else { - std::cerr << "SQLite Plugin: " << res << "\n"; + MAPNIK_LOG_ERROR(sqlite) << "~prepared_index_statement:" + << res; } } } diff --git a/plugins/input/sqlite/sqlite_resultset.hpp b/plugins/input/sqlite/sqlite_resultset.hpp index 9c10eb0f3..909a4dac4 100644 --- a/plugins/input/sqlite/sqlite_resultset.hpp +++ b/plugins/input/sqlite/sqlite_resultset.hpp @@ -24,6 +24,7 @@ #define MAPNIK_SQLITE_RESULTSET_HPP // mapnik +#include #include #include diff --git a/plugins/input/sqlite/sqlite_utils.hpp b/plugins/input/sqlite/sqlite_utils.hpp index 6caee666c..90f0446a1 100644 --- a/plugins/input/sqlite/sqlite_utils.hpp +++ b/plugins/input/sqlite/sqlite_utils.hpp @@ -29,6 +29,7 @@ #include // mapnik +#include #include #include #include @@ -556,7 +557,7 @@ public: } catch (std::exception const& ex) { - //std::clog << "no: " << ex.what() << "\n"; + MAPNIK_LOG_DEBUG(sqlite) << "has_rtree returned:" << ex.what(); return false; } return false; @@ -609,9 +610,7 @@ public: break; default: -#ifdef MAPNIK_DEBUG - std::clog << "Sqlite Plugin: unknown type_oid=" << type_oid << std::endl; -#endif + MAPNIK_LOG_DEBUG(sqlite) << "detect_types_from_subquery: unknown type_oid=" << type_oid; break; } } @@ -691,20 +690,22 @@ public: desc.add_descriptor(mapnik::attribute_descriptor(fld_name, mapnik::String)); } } -#ifdef MAPNIK_DEBUG else { // "Column Affinity" says default to "Numeric" but for now we pass.. //desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double)); - // TODO - this should not fail when we specify geometry_field in XML file - - std::clog << "Sqlite Plugin: column '" - << std::string(fld_name) - << "' unhandled due to unknown type: " - << fld_type << std::endl; - } +#ifdef MAPNIK_LOG + // Do not fail when we specify geometry_field in XML file + if (field.empty()) + { + MAPNIK_LOG_DEBUG(sqlite) << "Column '" + << std::string(fld_name) + << "' unhandled due to unknown type: " + << fld_type; + } #endif + } } } From 682635e975ec90249a7b8966b7ac53066ffa4a06 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 27 Mar 2013 10:38:20 +0000 Subject: [PATCH 09/11] + mapnik::projection add operator<< --- include/mapnik/projection.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/mapnik/projection.hpp b/include/mapnik/projection.hpp index e7c846bee..238280a7b 100644 --- a/include/mapnik/projection.hpp +++ b/include/mapnik/projection.hpp @@ -76,6 +76,15 @@ private: mutable void * proj_ctx_; }; +template +std::basic_ostream & +operator << ( std::basic_ostream & s, mapnik::projection const& p ) +{ + s << "projection(\"" << p.params() << "\")"; + return s; +} + + } #endif // MAPNIK_PROJECTION_HPP From 9b138728d074f90f24b42d53c8949fa5e54e5512 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 27 Mar 2013 10:39:02 +0000 Subject: [PATCH 10/11] + fix assignment operator #1776 --- src/projection.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/projection.cpp b/src/projection.cpp index abe871c9c..53ffce126 100644 --- a/src/projection.cpp +++ b/src/projection.cpp @@ -68,13 +68,16 @@ projection::projection(projection const& rhs) proj_(NULL), proj_ctx_(NULL) { - if (!rhs.defer_proj_init_) init_proj4(); + if (!defer_proj_init_) init_proj4(); } projection& projection::operator=(projection const& rhs) { projection tmp(rhs); swap(tmp); + proj_ctx_ = 0; + proj_ = 0; + if (!defer_proj_init_) init_proj4(); return *this; } @@ -210,6 +213,8 @@ std::string projection::expanded() const void projection::swap(projection& rhs) { std::swap(params_,rhs.params_); + std::swap(defer_proj_init_,rhs.defer_proj_init_); + std::swap(is_geographic_,rhs.is_geographic_); } } From 6153c737e6280cf114ebc8dfb9dc7cdbb4eeb1c1 Mon Sep 17 00:00:00 2001 From: Hermann Kraus Date: Thu, 28 Mar 2013 10:55:10 +0100 Subject: [PATCH 11/11] Fix checks in Map::resize(). --- src/map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index f8fddbd77..0e840b030 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -264,8 +264,8 @@ void Map::set_height(unsigned height) void Map::resize(unsigned width,unsigned height) { - if (width != width_ && - height != height_ && + if ((width != width_ || + height != height_) && width >= MIN_MAPSIZE && width <= MAX_MAPSIZE && height >= MIN_MAPSIZE &&