aboutsummaryrefslogtreecommitdiffstats
path: root/src/google/protobuf/io/zero_copy_stream_impl.cc
diff options
context:
space:
mode:
authorJeff Davidson <jpd@google.com>2015-01-15 22:48:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-15 22:48:58 +0000
commit77a6b2f4cdd580d57630f079db1d908d7fd90a54 (patch)
tree586f7d5e9a7e05af45d0e821188097c0faa96219 /src/google/protobuf/io/zero_copy_stream_impl.cc
parentc7c25812eb19d080087b71e08bfe35aff9f21433 (diff)
parenta3b2a6da25a76f17c73d31def3952feb0fd2296e (diff)
downloadexternal_protobuf-77a6b2f4cdd580d57630f079db1d908d7fd90a54.zip
external_protobuf-77a6b2f4cdd580d57630f079db1d908d7fd90a54.tar.gz
external_protobuf-77a6b2f4cdd580d57630f079db1d908d7fd90a54.tar.bz2
Merge "Update protobuf library from 2.3 to 2.6."
Diffstat (limited to 'src/google/protobuf/io/zero_copy_stream_impl.cc')
-rw-r--r--src/google/protobuf/io/zero_copy_stream_impl.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc
index 1384c74..7829a29 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.cc
+++ b/src/google/protobuf/io/zero_copy_stream_impl.cc
@@ -46,7 +46,8 @@
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/stl_util-inl.h>
+#include <google/protobuf/stubs/stl_util.h>
+
namespace google {
namespace protobuf {
@@ -412,7 +413,9 @@ int64 ConcatenatingInputStream::ByteCount() const {
LimitingInputStream::LimitingInputStream(ZeroCopyInputStream* input,
int64 limit)
- : input_(input), limit_(limit) {}
+ : input_(input), limit_(limit) {
+ prior_bytes_read_ = input_->ByteCount();
+}
LimitingInputStream::~LimitingInputStream() {
// If we overshot the limit, back up.
@@ -456,9 +459,9 @@ bool LimitingInputStream::Skip(int count) {
int64 LimitingInputStream::ByteCount() const {
if (limit_ < 0) {
- return input_->ByteCount() + limit_;
+ return input_->ByteCount() + limit_ - prior_bytes_read_;
} else {
- return input_->ByteCount();
+ return input_->ByteCount() - prior_bytes_read_;
}
}