From 1a572c8e89668d7e7bc6964069f61e0b577a45d6 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 31 May 2012 06:59:06 +0000 Subject: [PATCH] Added test for #1997; fixed build warnings --- modules/core/src/persistence.cpp | 5 +++-- modules/core/test/test_misc.cpp | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 8baa7e2..2c1432b 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -268,7 +268,8 @@ static char* icvGets( CvFileStorage* fs, char* str, int maxCount ) { if( fs->strbuf ) { - size_t i = fs->strbufpos, len = fs->strbufsize, j = 0; + size_t i = fs->strbufpos, len = fs->strbufsize; + int j = 0; const char* instr = fs->strbuf; while( i < len && j < maxCount-1 ) { @@ -2782,7 +2783,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co int xml_buf_size = 1 << 10; char substr[] = ""; int last_occurence = -1; - xml_buf_size = MIN(xml_buf_size, file_size); + xml_buf_size = MIN(xml_buf_size, int(file_size)); fseek( fs->file, -xml_buf_size, SEEK_END ); xml_buf = (char*)cvAlloc( xml_buf_size+2 ); // find the last occurence of diff --git a/modules/core/test/test_misc.cpp b/modules/core/test/test_misc.cpp index 43daf67..8f58f55 100644 --- a/modules/core/test/test_misc.cpp +++ b/modules/core/test/test_misc.cpp @@ -22,4 +22,21 @@ TEST(Core_Drawing, _914) int pixelsDrawn = rows*cols - countNonZero(img); ASSERT_EQ( (3*rows + cols)*3 - 3*9, pixelsDrawn); +} + + +TEST(Core_OutputArraySreate, _1997) +{ + struct local { + static void create(OutputArray arr, Size submatSize, int type) + { + int sizes[] = {submatSize.width, submatSize.height}; + arr.create(sizeof(sizes)/sizeof(sizes[0]), sizes, type); + } + }; + + Mat mat(Size(512, 512), CV_8U); + Size submatSize = Size(256, 256); + + ASSERT_NO_THROW(local::create( mat(Rect(Point(), submatSize)), submatSize, mat.type() )); } \ No newline at end of file -- 2.7.4