From 17d9509e3161132bcd70cb7816c90bdc082c1167 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Wed, 30 May 2012 13:02:45 +0000 Subject: [PATCH] changed "void FileStorage::release(string&)" to "string FileStorage::releaseAndGetString()" --- modules/core/include/opencv2/core/core.hpp | 2 +- modules/core/src/persistence.cpp | 6 +++--- modules/core/test/test_io.cpp | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp index 41e6b72..1e005c3 100644 --- a/modules/core/include/opencv2/core/core.hpp +++ b/modules/core/include/opencv2/core/core.hpp @@ -3978,7 +3978,7 @@ public: //! closes the file and releases all the memory buffers CV_WRAP virtual void release(); //! closes the file, releases all the memory buffers and returns the text string - CV_WRAP_AS(releaseAndGetString) virtual void release(CV_OUT string& buf); + CV_WRAP virtual string releaseAndGetString(); //! returns the first element of the top-level mapping CV_WRAP FileNode getFirstTopLevelNode() const; diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 7d1d586..8baa7e2 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -5161,16 +5161,16 @@ void FileStorage::release() state = UNDEFINED; } -void FileStorage::release(string& buf) +string FileStorage::releaseAndGetString() { + string buf; if( fs.obj && fs.obj->outbuf ) icvClose(fs.obj, &buf); - else - buf.clear(); fs.release(); structs.clear(); state = UNDEFINED; + return buf; } FileNode FileStorage::root(int streamidx) const diff --git a/modules/core/test/test_io.cpp b/modules/core/test/test_io.cpp index 150bdd1..f290bab 100644 --- a/modules/core/test/test_io.cpp +++ b/modules/core/test/test_io.cpp @@ -180,8 +180,7 @@ protected: fs.writeObj("test_graph",graph); CvGraph* graph2 = (CvGraph*)cvClone(graph); - string content; - fs.release(content); + string content = fs.releaseAndGetString(); if(!fs.open(mem ? content : filename, FileStorage::READ + (mem ? FileStorage::MEMORY : 0))) { -- 2.7.4