From c0d41f05d65babd4f48bb51f669710f2ea7e4f7a Mon Sep 17 00:00:00 2001 From: JoeHowse Date: Sat, 2 Mar 2019 12:00:32 -0400 Subject: [PATCH] Merge pull request #13947 from JoeHowse:4.0.1-patches * core, stitching: revise syntax to support Visual C++ 2013 * stitching: revise syntax again to support Visual C++ 2013 and other compilers * stitching: minor update to clarify changes --- modules/core/src/persistence_json.cpp | 6 +++--- modules/stitching/include/opencv2/stitching.hpp | 7 ++++++- modules/stitching/src/stitcher.cpp | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/core/src/persistence_json.cpp b/modules/core/src/persistence_json.cpp index ace739405c..ae678e1b8b 100644 --- a/modules/core/src/persistence_json.cpp +++ b/modules/core/src/persistence_json.cpp @@ -72,7 +72,7 @@ public: } char* ptr = fs->bufferPtr(); - if( ptr > fs->bufferStart() + current_struct.indent && !FileNode::FileNode::isEmptyCollection(struct_flags) ) + if( ptr > fs->bufferStart() + current_struct.indent && !FileNode::isEmptyCollection(struct_flags) ) *ptr++ = ' '; *ptr++ = FileNode::isMap(struct_flags) ? '}' : ']'; fs->setBufferPtr(ptr); @@ -171,7 +171,7 @@ public: { int new_offset; ptr = fs->bufferPtr(); - if( !FileNode::FileNode::isEmptyCollection(struct_flags) ) + if( !FileNode::isEmptyCollection(struct_flags) ) *ptr++ = ','; new_offset = static_cast(ptr - fs->bufferStart() + key_len + data_len); if( new_offset > fs->wrapMargin() && new_offset - current_struct.indent > 10 ) @@ -184,7 +184,7 @@ public: } else { - if ( !FileNode::FileNode::isEmptyCollection(struct_flags) ) + if ( !FileNode::isEmptyCollection(struct_flags) ) { ptr = fs->bufferPtr(); *ptr++ = ','; diff --git a/modules/stitching/include/opencv2/stitching.hpp b/modules/stitching/include/opencv2/stitching.hpp index 42f63df1e0..016e7d8023 100644 --- a/modules/stitching/include/opencv2/stitching.hpp +++ b/modules/stitching/include/opencv2/stitching.hpp @@ -142,7 +142,12 @@ public: * When setting a resolution for stitching, this values is a placeholder * for preserving the original resolution. */ - static constexpr const double ORIG_RESOL = -1.0; +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/) + static constexpr double ORIG_RESOL = -1.0; +#else + // support MSVS 2013 + static const double ORIG_RESOL; // Initialized in stitcher.cpp +#endif enum Status { diff --git a/modules/stitching/src/stitcher.cpp b/modules/stitching/src/stitcher.cpp index 3229a87546..58aa1882f6 100644 --- a/modules/stitching/src/stitcher.cpp +++ b/modules/stitching/src/stitcher.cpp @@ -44,6 +44,12 @@ namespace cv { +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/) +// Stitcher::ORIG_RESOL is initialized in stitching.hpp. +#else +const double Stitcher::ORIG_RESOL = -1.0; +#endif + Ptr Stitcher::create(Mode mode) { Ptr stitcher = makePtr();