From f3e9eb33718f47a6e55fb5c646da9a8935d103c6 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 25 Jun 2019 18:03:04 +0300 Subject: [PATCH] dnn: both protobuf readers have similar behavior - ReadProtoFromTextFile - ReadProtoFromTextBuffer --- modules/dnn/src/caffe/caffe_io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp index 501e49e72f..e3f1113242 100644 --- a/modules/dnn/src/caffe/caffe_io.cpp +++ b/modules/dnn/src/caffe/caffe_io.cpp @@ -1137,7 +1137,12 @@ bool ReadProtoFromBinaryFile(const char* filename, Message* proto) { bool ReadProtoFromTextBuffer(const char* data, size_t len, Message* proto) { ArrayInputStream input(data, len); - return google::protobuf::TextFormat::Parse(&input, proto); +#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF + return google::protobuf::TextFormat::Parser(true).Parse(&input, proto); +#else + return google::protobuf::TextFormat::Parser().Parse(&input, proto); +#endif + }