fixed http://code.opencv.org/issues/2899
authorVadim Pisarevsky <vadim.pisarevsky@gmail.com>
Fri, 22 Mar 2013 11:10:54 +0000 (15:10 +0400)
committerVadim Pisarevsky <vadim.pisarevsky@gmail.com>
Fri, 22 Mar 2013 11:10:54 +0000 (15:10 +0400)
modules/core/include/opencv2/core/operations.hpp
modules/core/test/test_io.cpp

index 1ee96bb..1170fc4 100644 (file)
@@ -2917,6 +2917,9 @@ CV_EXPORTS FileStorage& operator << (FileStorage& fs, const string& str);
 static inline FileStorage& operator << (FileStorage& fs, const char* str)
 { return (fs << string(str)); }
 
+static inline FileStorage& operator << (FileStorage& fs, char* value)
+{ return (fs << string(value)); }
+
 inline FileNode::FileNode() : fs(0), node(0) {}
 inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node)
     : fs(_fs), node(_node) {}
index 6b55eb2..33eb78d 100644 (file)
@@ -447,10 +447,21 @@ protected:
         catch(...)
         {
             ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
-        }
+        } 
     }
 };
 
 TEST(Core_InputOutput, huge) { CV_BigMatrixIOTest test; test.safe_run(); }
 */
 
+TEST(Core_InputOutput, FileStorage)
+{
+    std::string file = cv::tempfile(".xml");
+    cv::FileStorage f(file, cv::FileStorage::WRITE);
+
+    char arr[66];
+    sprintf(arr, "sprintf is hell %d", 666);
+    EXPECT_NO_THROW(f << arr);
+}
+
+