From fae4ff52b17906e5b2baebf3d70b2bee0dd2ea5e Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Tue, 2 May 2006 02:17:29 +0000 Subject: [PATCH] Fixed Wave tool startup crash when compiled with VC8. [SVN r33901] --- ChangeLog | 1 + include/boost/wave/cpp_context.hpp | 22 +++++++++++++------ .../wave/cpplexer/re2clex/cpp_re2c_lexer.hpp | 6 +++-- tool/build/Jamfile.v2 | 1 + 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b1d78b..06febc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -111,6 +111,7 @@ Boost V1.34.0 wave_config.hpp to allow to fine tune the generated Spirit tree code. VC7.1 gives best results when both are defined. - Fixed a memory corruption bug triggered by a possible dangling reference. +- Fixed Wave tools startup crash when compiled with VC8. Sat Feb 18 2005 - Version 1.2.3 diff --git a/include/boost/wave/cpp_context.hpp b/include/boost/wave/cpp_context.hpp index d7b5bf1..32870ec 100644 --- a/include/boost/wave/cpp_context.hpp +++ b/include/boost/wave/cpp_context.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #if BOOST_WAVE_SERIALIZATION != 0 @@ -141,23 +142,30 @@ public: } // iterator interface - iterator_type begin( - target_iterator_type const &first_ = target_iterator_type(), - target_iterator_type const &last_ = target_iterator_type()) + iterator_type begin() { std::string fname(filename); if (filename != "" && filename != "") { using namespace boost::filesystem; path fpath(complete(path(filename))); - fname = fpath.string(); includes.set_current_directory(fname.c_str()); } - if (first_ != target_iterator_type()) - return iterator_type(*this, first_, last_, position_type(fname.c_str())); - return iterator_type(*this, first, last, position_type(fname.c_str())); } + iterator_type begin( + target_iterator_type const &first_, + target_iterator_type const &last_) + { + std::string fname(filename); + if (filename != "" && filename != "") { + using namespace boost::filesystem; + path fpath(complete(path(filename))); + fname = fpath.string(); + includes.set_current_directory(fname.c_str()); + } + return iterator_type(*this, first_, last_, position_type(fname.c_str())); + } iterator_type end() const { return iterator_type(); } diff --git a/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp b/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp index 47e7afa..f003832 100644 --- a/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp +++ b/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp @@ -116,8 +116,10 @@ lexer::lexer(IteratorT const &first, memset(&scanner, '\0', sizeof(Scanner)); scanner.fd = -1; scanner.eol_offsets = aq_create(); - scanner.first = scanner.act = (uchar *)&(*first); - scanner.last = scanner.first + std::distance(first, last); + if (first != last) { + scanner.first = scanner.act = (uchar *)&(*first); + scanner.last = scanner.first + std::distance(first, last); + } scanner.line = pos.get_line(); scanner.column = scanner.curr_column = pos.get_column(); scanner.error_proc = report_error; diff --git a/tool/build/Jamfile.v2 b/tool/build/Jamfile.v2 index 809726c..f3f0b92 100644 --- a/tool/build/Jamfile.v2 +++ b/tool/build/Jamfile.v2 @@ -25,6 +25,7 @@ exe wave /boost/serialization//boost_serialization : msvc-7.1:off # workaround for compiler bug +# on : release ;