summaryrefslogtreecommitdiff
path: root/src/caffe
diff options
context:
space:
mode:
authorJeff Donahue <jeff.donahue@gmail.com>2014-10-16 13:24:39 -0700
committerJeff Donahue <jeff.donahue@gmail.com>2015-01-19 16:48:33 -0800
commit60f26d647ceccea5d0ab0bf85b35b492886bf451 (patch)
tree98288d3d611e70d22d7e10b35c85848df764e27f /src/caffe
parentbf5b77472603ea0d62574661dd61c57f2726a9c9 (diff)
downloadcaffeonacl-60f26d647ceccea5d0ab0bf85b35b492886bf451.tar.gz
caffeonacl-60f26d647ceccea5d0ab0bf85b35b492886bf451.tar.bz2
caffeonacl-60f26d647ceccea5d0ab0bf85b35b492886bf451.zip
SetTotalBytesLimit to the max (2 GB minus 1 byte)
Diffstat (limited to 'src/caffe')
-rw-r--r--src/caffe/util/io.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp
index ffdaeb12..6fa6e680 100644
--- a/src/caffe/util/io.cpp
+++ b/src/caffe/util/io.cpp
@@ -17,6 +17,8 @@
#include "caffe/proto/caffe.pb.h"
#include "caffe/util/io.hpp"
+const int kProtoReadBytesLimit = INT_MAX; // Max size of 2 GB minus 1 byte.
+
namespace caffe {
using google::protobuf::io::FileInputStream;
@@ -50,7 +52,7 @@ bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
CHECK_NE(fd, -1) << "File not found: " << filename;
ZeroCopyInputStream* raw_input = new FileInputStream(fd);
CodedInputStream* coded_input = new CodedInputStream(raw_input);
- coded_input->SetTotalBytesLimit(1073741824, 536870912);
+ coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
bool success = proto->ParseFromCodedStream(coded_input);