aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/io
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-05-30 10:52:47 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-05-30 10:56:18 -0700
commit7280dafca161eb3413ea120d3dd07c63e5254e72 (patch)
tree7e14a2994ce2fd68ce5e58d0dd0b5960cf1f93d9 /tensorflow/core/lib/io
parent6c3b15915d7475aed4484e47361e7cd0871678f4 (diff)
Use "empty" member function to test for emptiness
PiperOrigin-RevId: 157483181
Diffstat (limited to 'tensorflow/core/lib/io')
-rw-r--r--tensorflow/core/lib/io/record_reader.cc4
-rw-r--r--tensorflow/core/lib/io/snappy/snappy_inputbuffer.cc2
-rw-r--r--tensorflow/core/lib/io/table_test.cc2
-rw-r--r--tensorflow/core/lib/io/zlib_inputstream.cc2
4 files changed, 5 insertions, 5 deletions
diff --git a/tensorflow/core/lib/io/record_reader.cc b/tensorflow/core/lib/io/record_reader.cc
index 450f10d299..ff2fd48de9 100644
--- a/tensorflow/core/lib/io/record_reader.cc
+++ b/tensorflow/core/lib/io/record_reader.cc
@@ -102,7 +102,7 @@ Status RecordReader::ReadChecksummed(uint64 offset, size_t n,
TF_RETURN_IF_ERROR(zlib_input_stream_->ReadNBytes(expected, storage));
if (storage->size() != expected) {
- if (storage->size() == 0) {
+ if (storage->empty()) {
return errors::OutOfRange("eof");
} else {
return errors::DataLoss("truncated record at ", offset);
@@ -121,7 +121,7 @@ Status RecordReader::ReadChecksummed(uint64 offset, size_t n,
StringPiece data;
TF_RETURN_IF_ERROR(src_->Read(offset, expected, &data, &(*storage)[0]));
if (data.size() != expected) {
- if (data.size() == 0) {
+ if (data.empty()) {
return errors::OutOfRange("eof");
} else {
return errors::DataLoss("truncated record at ", offset);
diff --git a/tensorflow/core/lib/io/snappy/snappy_inputbuffer.cc b/tensorflow/core/lib/io/snappy/snappy_inputbuffer.cc
index 39202e9237..3088d4d4b9 100644
--- a/tensorflow/core/lib/io/snappy/snappy_inputbuffer.cc
+++ b/tensorflow/core/lib/io/snappy/snappy_inputbuffer.cc
@@ -183,7 +183,7 @@ Status SnappyInputBuffer::ReadFromFile() {
// possible that on the last read there isn't enough data in the file to
// fill up the buffer in which case file_->ReadNBytes would return an
// OutOfRange error.
- if (data.size() == 0) {
+ if (data.empty()) {
return errors::OutOfRange("EOF reached");
}
if (errors::IsOutOfRange(s)) {
diff --git a/tensorflow/core/lib/io/table_test.cc b/tensorflow/core/lib/io/table_test.cc
index d479c2d533..aed3ef9c07 100644
--- a/tensorflow/core/lib/io/table_test.cc
+++ b/tensorflow/core/lib/io/table_test.cc
@@ -396,7 +396,7 @@ class Harness : public ::testing::Test {
break;
case 1: {
// Attempt to return something smaller than an existing key
- if (result.size() > 0 && result[result.size() - 1] > '\0') {
+ if (!result.empty() && result[result.size() - 1] > '\0') {
result[result.size() - 1]--;
}
break;
diff --git a/tensorflow/core/lib/io/zlib_inputstream.cc b/tensorflow/core/lib/io/zlib_inputstream.cc
index d019b65510..85a1fc032f 100644
--- a/tensorflow/core/lib/io/zlib_inputstream.cc
+++ b/tensorflow/core/lib/io/zlib_inputstream.cc
@@ -110,7 +110,7 @@ Status ZlibInputStream::ReadFromStream() {
// possible that on the last read there isn't enough data in the stream to
// fill up the buffer in which case input_stream_->ReadNBytes would return an
// OutOfRange error.
- if (data.size() == 0) {
+ if (data.empty()) {
return errors::OutOfRange("EOF reached");
}
if (errors::IsOutOfRange(s)) {