Deprecated File::Eof.
Change-Id: I0cca5e175babcdeeb982f981f97f8dd1b0ae9649
This commit is contained in:
parent
5ce7afeda4
commit
0ff596e75b
|
@ -66,9 +66,6 @@ class File {
|
|||
/// @return true on success, false otherwise.
|
||||
virtual bool Flush() = 0;
|
||||
|
||||
/// @return true if the file reaches eof, false otherwise.
|
||||
virtual bool Eof() = 0;
|
||||
|
||||
/// @return The file name.
|
||||
const std::string& file_name() const { return file_name_; }
|
||||
|
||||
|
|
|
@ -80,16 +80,16 @@ TEST_F(LocalFileTest, Read_And_Eof) {
|
|||
File* file = File::Open(local_file_name_.c_str(), "r");
|
||||
ASSERT_TRUE(file != NULL);
|
||||
|
||||
// Read half of the file and verify that Eof is not true.
|
||||
// Read half of the file.
|
||||
const int kFirstReadBytes = kDataSize / 2;
|
||||
std::string read_data(kFirstReadBytes + kDataSize, 0);
|
||||
EXPECT_EQ(kFirstReadBytes, file->Read(&read_data[0], kFirstReadBytes));
|
||||
EXPECT_FALSE(file->Eof());
|
||||
|
||||
// Read the remaining half of the file and verify Eof is true.
|
||||
// Read the remaining half of the file and verify EOF.
|
||||
EXPECT_EQ(kDataSize - kFirstReadBytes,
|
||||
file->Read(&read_data[kFirstReadBytes], kDataSize));
|
||||
EXPECT_TRUE(file->Eof());
|
||||
uint8_t single_byte;
|
||||
EXPECT_EQ(0, file->Read(&single_byte, sizeof(single_byte)));
|
||||
EXPECT_TRUE(file->Close());
|
||||
|
||||
// Compare data written and read.
|
||||
|
|
|
@ -59,11 +59,6 @@ bool LocalFile::Flush() {
|
|||
return ((fflush(internal_file_) == 0) && !ferror(internal_file_));
|
||||
}
|
||||
|
||||
bool LocalFile::Eof() {
|
||||
DCHECK(internal_file_ != NULL);
|
||||
return static_cast<bool>(feof(internal_file_));
|
||||
}
|
||||
|
||||
LocalFile::~LocalFile() {}
|
||||
|
||||
bool LocalFile::Open() {
|
||||
|
|
|
@ -32,7 +32,6 @@ class LocalFile : public File {
|
|||
virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE;
|
||||
virtual int64_t Size() OVERRIDE;
|
||||
virtual bool Flush() OVERRIDE;
|
||||
virtual bool Eof() OVERRIDE;
|
||||
/// @}
|
||||
|
||||
/// Delete a local file.
|
||||
|
|
|
@ -109,14 +109,6 @@ bool ThreadedIoFile::Flush() {
|
|||
return internal_file_->Flush();
|
||||
}
|
||||
|
||||
bool ThreadedIoFile::Eof() {
|
||||
DCHECK(internal_file_);
|
||||
DCHECK(thread_);
|
||||
DCHECK_EQ(kInputMode, mode_);
|
||||
|
||||
return eof_ && !cache_.BytesCached();
|
||||
}
|
||||
|
||||
void ThreadedIoFile::RunInInputMode() {
|
||||
DCHECK(internal_file_);
|
||||
DCHECK(thread_);
|
||||
|
|
|
@ -38,7 +38,6 @@ class ThreadedIoFile : public File {
|
|||
virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE;
|
||||
virtual int64_t Size() OVERRIDE;
|
||||
virtual bool Flush() OVERRIDE;
|
||||
virtual bool Eof() OVERRIDE;
|
||||
/// @}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -129,10 +129,6 @@ bool UdpFile::Flush() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool UdpFile::Eof() {
|
||||
return socket_ == kInvalidSocket;
|
||||
}
|
||||
|
||||
class ScopedSocket {
|
||||
public:
|
||||
explicit ScopedSocket(int sock_fd)
|
||||
|
|
|
@ -31,7 +31,6 @@ class UdpFile : public File {
|
|||
virtual int64_t Write(const void* buffer, uint64_t length) OVERRIDE;
|
||||
virtual int64_t Size() OVERRIDE;
|
||||
virtual bool Flush() OVERRIDE;
|
||||
virtual bool Eof() OVERRIDE;
|
||||
/// @}
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue