X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxlex.C;h=afda6e35ebf616a77a9bfe2911950278290a5e4f;hb=69bee02a8901793b34ac5ca6d07e93910cef4005;hp=50e02c027f304c6df28b035e67c231e4ee120b6d;hpb=a5e85854f8a30623a448af5b7d0c6352ea2329c0;p=lyx.git diff --git a/src/lyxlex.C b/src/lyxlex.C index 50e02c027f..afda6e35eb 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -256,15 +256,19 @@ int LyXLex::findToken(char const * str[]) } -LyXLex::operator void *() const +LyXLex::operator void const *() const { - return isOK() ? const_cast(this) : 0; + // This behaviour is NOT the same as the std::streams which would + // use fail() here. However, our implementation of getString() et al. + // can cause the eof() and fail() bits to be set, even though we + // haven't tried to read 'em. + return pimpl_->is.bad() ? 0 : this; } bool LyXLex::operator!() const { - return !isOK(); + return pimpl_->is.bad(); } @@ -317,4 +321,3 @@ LyXLex & LyXLex::operator>>(bool & s) return *this; } -