1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Fixed some issues found by static analysis (4th round)

This commit is contained in:
Maksim Shabunin
2017-06-29 16:40:22 +03:00
parent 64b483c65b
commit e0393f8557
29 changed files with 168 additions and 46 deletions
+10 -2
View File
@@ -557,12 +557,12 @@ icvFetchContour( schar *ptr,
else
{
i3 = i0;
CV_Assert(i3 != NULL);
prev_s = s ^ 4;
/* follow border */
for( ;; )
{
CV_Assert(i3 != NULL);
s_end = s;
s = std::min(s, MAX_SIZE - 1);
@@ -652,7 +652,6 @@ icvTraceContour( schar *ptr, int step, schar *stop_ptr, int is_hole )
while( *i1 == 0 && s != s_end );
i3 = i0;
CV_Assert(i3 != NULL);
/* check single pixel domain */
if( s != s_end )
@@ -660,6 +659,7 @@ icvTraceContour( schar *ptr, int step, schar *stop_ptr, int is_hole )
/* follow border */
for( ;; )
{
CV_Assert(i3 != NULL);
s = std::min(s, MAX_SIZE - 1);
while( s < MAX_SIZE - 1 )
@@ -739,12 +739,14 @@ icvFetchContourEx( schar* ptr,
/* follow border */
for( ;; )
{
CV_Assert(i3 != NULL);
s_end = s;
s = std::min(s, MAX_SIZE - 1);
while( s < MAX_SIZE - 1 )
{
i4 = i3 + deltas[++s];
CV_Assert(i4 != NULL);
if( *i4 != 0 )
break;
}
@@ -815,6 +817,7 @@ icvFetchContourEx( schar* ptr,
static int
icvTraceContour_32s( int *ptr, int step, int *stop_ptr, int is_hole )
{
CV_Assert(ptr != NULL);
int deltas[MAX_SIZE];
int *i0 = ptr, *i1, *i3, *i4 = NULL;
int s, s_end;
@@ -844,12 +847,14 @@ icvTraceContour_32s( int *ptr, int step, int *stop_ptr, int is_hole )
/* follow border */
for( ;; )
{
CV_Assert(i3 != NULL);
s_end = s;
s = std::min(s, MAX_SIZE - 1);
while( s < MAX_SIZE - 1 )
{
i4 = i3 + deltas[++s];
CV_Assert(i4 != NULL);
if( (*i4 & value_mask) == ccomp_val )
break;
}
@@ -873,6 +878,7 @@ icvFetchContourEx_32s( int* ptr,
int _method,
CvRect* _rect )
{
CV_Assert(ptr != NULL);
int deltas[MAX_SIZE];
CvSeqWriter writer;
int *i0 = ptr, *i1, *i3, *i4;
@@ -926,11 +932,13 @@ icvFetchContourEx_32s( int* ptr,
/* follow border */
for( ;; )
{
CV_Assert(i3 != NULL);
s_end = s;
do
{
i4 = i3 + deltas[++s];
CV_Assert(i4 != NULL);
}
while( (*i4 & value_mask) != ccomp_val && ( s < MAX_SIZE - 1 ) );
s &= 7;