]> git.lyx.org Git - lyx.git/blobdiff - src/lyxlex.C
mathed uglyfication
[lyx.git] / src / lyxlex.C
index 50e02c027f304c6df28b035e67c231e4ee120b6d..afda6e35ebf616a77a9bfe2911950278290a5e4f 100644 (file)
@@ -256,15 +256,19 @@ int LyXLex::findToken(char const * str[])
 }
 
 
-LyXLex::operator void *() const
+LyXLex::operator void const *() const
 {
-       return isOK() ? const_cast<LyXLex *>(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;
 }
 
-