diff options
Diffstat (limited to 'boost/wave/util/cpp_iterator.hpp')
-rw-r--r-- | boost/wave/util/cpp_iterator.hpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/boost/wave/util/cpp_iterator.hpp b/boost/wave/util/cpp_iterator.hpp index a162bc9065..d219bd6307 100644 --- a/boost/wave/util/cpp_iterator.hpp +++ b/boost/wave/util/cpp_iterator.hpp @@ -23,6 +23,7 @@ #include <boost/shared_ptr.hpp> #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> +#include <boost/lexical_cast.hpp> #include <boost/spirit/include/classic_multi_pass.hpp> #include <boost/spirit/include/classic_parse_tree_utils.hpp> @@ -795,7 +796,7 @@ typename ContextT::position_type pos = act_token.get_position(); if (!ctx.get_hooks().emit_line_directive(ctx, pending, act_token)) { - unsigned int column = 6; + unsigned int column = 6; // the hook did not generate anything, emit default #line pos.set_column(1); @@ -804,22 +805,20 @@ typename ContextT::position_type pos = act_token.get_position(); pos.set_column(column); // account for '#line' pending.push_back(result_type(T_SPACE, " ", pos)); - // 21 is the max required size for a 64 bit integer represented as a - // string - char buffer[22]; + // 21 is the max required size for a 64 bit integer represented as a + // string - using namespace std; // for some systems sprintf is in namespace std - sprintf (buffer, "%zd", pos.get_line()); + std::string buffer = lexical_cast<std::string>(pos.get_line()); pos.set_column(++column); // account for ' ' - pending.push_back(result_type(T_INTLIT, buffer, pos)); - pos.set_column(column += (unsigned int)strlen(buffer)); // account for <number> + pending.push_back(result_type(T_INTLIT, buffer.c_str(), pos)); + pos.set_column(column += buffer.size()); // account for <number> pending.push_back(result_type(T_SPACE, " ", pos)); pos.set_column(++column); // account for ' ' - std::string file("\""); - boost::filesystem::path filename( - wave::util::create_path(act_pos.get_file().c_str())); + std::string file("\""); + boost::filesystem::path filename( + wave::util::create_path(act_pos.get_file().c_str())); using wave::util::impl::escape_lit; file += escape_lit(wave::util::native_file_string(filename)) + "\""; |