From 84a91f5ebfbf0601912fc56d56ea1bfb3f02214d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 22 Oct 2003 22:22:55 +0000 Subject: [PATCH] Use correct types when working with stream::pos_type. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7958 a592a061-630c-0410-9148-cb99ea01b6c8 --- boost/ChangeLog | 5 +++++ boost/libs/regex/src/cpp_regex_traits.cpp | 14 ++++++-------- src/ChangeLog | 9 +++++++-- src/lyxlex_pimpl.C | 6 +++--- src/paragraph_pimpl.C | 6 +++--- 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/boost/ChangeLog b/boost/ChangeLog index 5cdc6555d8..624bd12ec6 100644 --- a/boost/ChangeLog +++ b/boost/ChangeLog @@ -1,3 +1,8 @@ +2003-10-23 Lars Gullik Bjønnes + + * libs/regex/src/cpp_regex_traits.cpp (seekpos): use correct + types. same patch sent to boost list and accepted there. + 2003-10-07 Angus Leeming * boost/any.hpp: change the throw to boost::throw_exception. diff --git a/boost/libs/regex/src/cpp_regex_traits.cpp b/boost/libs/regex/src/cpp_regex_traits.cpp index 00b8c4a49e..8e4908c4dd 100644 --- a/boost/libs/regex/src/cpp_regex_traits.cpp +++ b/boost/libs/regex/src/cpp_regex_traits.cpp @@ -8,11 +8,11 @@ * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Dr John Maddock makes no representations - * about the suitability of this software for any purpose. + * about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * */ - + /* * LOCATION: see http://www.boost.org for most recent version. * FILE: c_regex_traits.cpp @@ -161,9 +161,9 @@ parser_buf::seekpos(pos_type sp, ::std::ios_base::openmode which) return pos_type(off_type(-1)); std::ptrdiff_t size = this->egptr() - this->eback(); charT* g = this->eback(); - if(sp <= size) + if(off_type(sp) <= size) { - this->setg(g, g + ::std::streamsize(sp), g + size); + this->setg(g, g + off_type(sp), g + size); } return pos_type(off_type(-1)); } @@ -218,7 +218,7 @@ message_data::message_data(const std::locale& l, const std::string& regex_ #else BOOST_REGEX_NOEH_ASSERT(cat >= 0); #endif - } + } #endif std::memset(syntax_map, cpp_regex_traits::syntax_char, 256); unsigned i; @@ -691,7 +691,7 @@ message_data::message_data(const std::locale& l, const std::string& reg if((int)cat >= 0) msgs.close(cat); -#endif +#endif } } // namespace re_detail @@ -876,5 +876,3 @@ std::size_t BOOST_REGEX_CALL cpp_regex_traits::strwiden(wchar_t *s1, st } // namespace boost #endif - - diff --git a/src/ChangeLog b/src/ChangeLog index c438cc39c1..0f1f11aa1b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2003-10-23 Lars Gullik Bjønnes + + * lyxlex_pimpl.C (setFile,setStream): be sure to use correct types + when woring with stream::pos_type + * paragraph_pimpl.C (simpleTeXSpecialChars): ditto 2003-10-22 André Pönitz @@ -24,7 +29,7 @@ 2003-10-22 Martin Vermeer - * text.C: fixed an "oops" in the "is a bit silly" + * text.C: fixed an "oops" in the "is a bit silly" bug fix 2003-10-21 André Pönitz @@ -52,7 +57,7 @@ 2003-10-20 Martin Vermeer * text.C: re-introduce display() for insets, fixing the - various bugs (stretch of line above, math inset + various bugs (stretch of line above, math inset positioning, ...) 2003-10-20 Jean-Marc Lasgouttes diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index 7b8c580e85..4d582a54f3 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -138,7 +138,7 @@ bool LyXLex::Pimpl::setFile(string const & filename) // The check only outputs a debug message, because it triggers // a bug in compaq cxx 6.2, where is_open() returns 'true' for // a fresh new filebuf. (JMarc) - if (gz__.is_open() || is.tellg() > 0) + if (gz__.is_open() || istream::off_type(is.tellg()) > -1) lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: " "file or stream already set." << endl; gz__.open(filename.c_str(), ios::in); @@ -152,7 +152,7 @@ bool LyXLex::Pimpl::setFile(string const & filename) // The check only outputs a debug message, because it triggers // a bug in compaq cxx 6.2, where is_open() returns 'true' for // a fresh new filebuf. (JMarc) - if (fb__.is_open() || is.tellg() > 0) + if (fb__.is_open() || istream::off_type(is.tellg()) > 0) lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: " "file or stream already set." << endl; fb__.open(filename.c_str(), ios::in); @@ -166,7 +166,7 @@ bool LyXLex::Pimpl::setFile(string const & filename) void LyXLex::Pimpl::setStream(istream & i) { - if (fb__.is_open() || is.tellg() > 0) + if (fb__.is_open() || istream::off_type(is.tellg()) > 0) lyxerr[Debug::LYXLEX] << "Error in LyXLex::setStream: " "file or stream already set." << endl; is.rdbuf(i.rdbuf()); diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 700c2420dd..ab6c0080d7 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -523,8 +523,8 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf, } bool close = false; - int const len = os.tellp(); - //ostream::pos_type const len = os.tellp(); + ostream::pos_type const len = os.tellp(); + if ((inset->lyxCode() == InsetOld::GRAPHICS_CODE || inset->lyxCode() == InsetOld::MATH_CODE || inset->lyxCode() == InsetOld::URL_CODE) @@ -562,7 +562,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf, texrow.start(owner_->id(), i + 1); column = 0; } else { - column += int(os.tellp()) - len; + column += os.tellp() - len; } } break;