On Sat Apr 23, 2011 08:05:42PM +0200, Thomas Krennwallner wrote: > It seems that StringSlice::skip gets called with num=0xFFFFFFFFFFFF on > Debian sid.
libprogram_opts/program_opts/value_parser.h has a problem in StringSlice parseValue(const StringSlice& in, T& v, double extra) The if ( (str>>v) ) statement causes str.eof() being true, which makes str.tellg() return -1, causing a signed/unsigned typecast bonanza. Setting str.clear() before str.tellg() should do the trick, see attached patched. I've checked it on Debian sid and Ubuntu Maverick. Can you check whether this works on your boxes as well? And whether I didn't make things worse ;-) In case that helps, I will upload a new version. Best, TK -- Thomas Krennwallner University assistant . TU Wien - Vienna University of Technology Institute of Information Systems Favoritenstrasse 9-11, 1040 Wien, Austria . T: +43 1 58801 18469 F: +43 1 58801 918469 tkren AT kr DOT tuwien DOT ac DOT at http://www.kr.tuwien.ac.at/staff/tkren/ . DVR: 0005886
Author: Thomas Krennwallner <tk...@kr.tuwien.ac.at> Description: operator>> sets eof bit, which causes tellg() to return -1. diff -Naur clasp-2.0.0.orig//libprogram_opts/program_opts/value_parser.h clasp-2.0.0/libprogram_opts/program_opts/value_parser.h --- clasp-2.0.0.orig//libprogram_opts/program_opts/value_parser.h 2010-11-22 18:04:11.000000000 +0100 +++ clasp-2.0.0/libprogram_opts/program_opts/value_parser.h 2011-04-24 08:47:12.000000000 +0200 @@ -70,9 +70,14 @@ template <class T> StringSlice parseValue(const StringSlice& in, T& v, double extra) { detail::input_stream<char> str(in.data(), in.size()); - if ( (str>>v) ) { - StringSlice ret = in.parsed(true, (size_t)str.tellg()); - return ret.complete() || extra > 0.0 ? ret : in.parsed(false); + str>>v; + if ( str.eof() ) { + str.clear(); // clear eof flag, so we can safely use tellg() + std::istream::streampos p = str.tellg(); + if ( p >= 0 ) { + StringSlice ret = in.parsed(true, (size_t)p); + return ret.complete() || extra > 0.0 ? ret : in.parsed(false); + } } return in.parsed(false); }