-801c458a562d22260ff176c26d65639dd32c8a90
+d00febdab0535546ccbf1ef634be1f23b09c8b77
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
bool
Stream_from_file::do_peek(size_t length, const char** bytes)
{
- if (this->data_.length() <= length)
+ if (this->data_.length() >= length)
{
*bytes = this->data_.data();
return true;
return false;
}
- if (lseek(this->fd_, - got, SEEK_CUR) != 0)
+ if (lseek(this->fd_, - got, SEEK_CUR) < 0)
{
if (!this->saw_error())
go_fatal_error(Linemap::unknown_location(), "lseek failed: %m");
void
Stream_from_file::do_advance(size_t skip)
{
- if (lseek(this->fd_, skip, SEEK_CUR) != 0)
+ if (lseek(this->fd_, skip, SEEK_CUR) < 0)
{
if (!this->saw_error())
go_fatal_error(Linemap::unknown_location(), "lseek failed: %m");
}
if (!this->data_.empty())
{
- if (this->data_.length() < skip)
+ if (this->data_.length() > skip)
this->data_.erase(0, skip);
else
this->data_.clear();