2
0
mirror of https://github.com/boostorg/wave.git synced 2026-02-01 09:02:12 +00:00

Fixed Wave tool startup crash when compiled with VC8.

[SVN r33901]
This commit is contained in:
Hartmut Kaiser
2006-05-02 02:17:29 +00:00
parent e9c10a7869
commit fae4ff52b1
4 changed files with 21 additions and 9 deletions

View File

@@ -18,6 +18,7 @@
#include <boost/concept_check.hpp>
#include <boost/noncopyable.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/wave/wave_config.hpp>
#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 != "<Unknown>" && filename != "<stdin>") {
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 != "<Unknown>" && filename != "<stdin>") {
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(); }

View File

@@ -116,8 +116,10 @@ lexer<IteratorT, PositionT>::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;