From 4c7a283e55b635417b71d4de2a34c8528a207967 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 30 May 2013 12:53:53 -0400 Subject: base: Avoid size limitation on protobuf coded streams This patch changes how the streams are created to avoid the size limitation on the coded streams. As we only read/write a single message at a time, there is never any message larger than a few bytes. However, the coded stream eventually complains that its internal counter reaches 64+ MByte if the total file size exceeds this value. Based on suggestions in the protobuf discussion forums, the coded stream is now created for every message that is read/written. The result is that the internal byte count never goes about tens of bytes, and we can read/write any size file that the underlying file I/O can handle. --- src/proto/protoio.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/proto/protoio.hh') diff --git a/src/proto/protoio.hh b/src/proto/protoio.hh index d5c6a4bac..27bb336c4 100644 --- a/src/proto/protoio.hh +++ b/src/proto/protoio.hh @@ -122,13 +122,13 @@ class ProtoOutputStream : public ProtoStream std::ofstream fileStream; /// Zero Copy stream wrapping the STL output stream - google::protobuf::io::OstreamOutputStream* zeroCopyStream; + google::protobuf::io::OstreamOutputStream* wrappedFileStream; /// Optional Gzip stream to wrap the Zero Copy stream google::protobuf::io::GzipOutputStream* gzipStream; - /// Top-level coded stream that messages are written to - google::protobuf::io::CodedOutputStream* codedStream; + /// Top-level zero-copy stream, either with compression or not + google::protobuf::io::ZeroCopyOutputStream* zeroCopyStream; }; @@ -193,13 +193,13 @@ class ProtoInputStream : public ProtoStream bool useGzip; /// Zero Copy stream wrapping the STL input stream - google::protobuf::io::IstreamInputStream* zeroCopyStream; + google::protobuf::io::IstreamInputStream* wrappedFileStream; /// Optional Gzip stream to wrap the Zero Copy stream google::protobuf::io::GzipInputStream* gzipStream; - /// Top-level coded stream that messages are read from - google::protobuf::io::CodedInputStream* codedStream; + /// Top-level zero-copy stream, either with compression or not + google::protobuf::io::ZeroCopyInputStream* zeroCopyStream; }; -- cgit v1.2.3