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

More issues found by static analysis

This commit is contained in:
Maksim Shabunin
2018-07-24 14:14:13 +03:00
parent 8de08e0463
commit cbb1e867e5
27 changed files with 51 additions and 81 deletions
-1
View File
@@ -175,7 +175,6 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
CV_THROW (ExifParsingError());
}
m_stream.read( reinterpret_cast<char*>(&m_data[0]), exifSize - offsetToTiffHeader );
count = m_stream.gcount();
exifFound = true;
break;
+2 -5
View File
@@ -265,7 +265,7 @@ bool BmpDecoder::readData( Mat& img )
for(;;)
{
int code = m_strm.getWord();
int len = code & 255;
const int len = code & 255;
code >>= 8;
if( len != 0 ) // encoded mode
{
@@ -304,16 +304,13 @@ bool BmpDecoder::readData( Mat& img )
else
{
int x_shift3 = (int)(line_end - data);
int y_shift = m_height - y;
if( code == 2 )
{
x_shift3 = m_strm.getByte()*nch;
y_shift = m_strm.getByte();
m_strm.getByte();
}
len = x_shift3 + ((y_shift * width3) & ((code == 0) - 1));
if( color )
data = FillUniColor( data, line_end, step, width3,
y, m_height, x_shift3,
+1 -1
View File
@@ -689,7 +689,7 @@ bool PAMEncoder::write( const Mat& img, const std::vector<int>& params )
tmp += sprintf( buffer + tmp, "MAXVAL %d\n", (1 << img.elemSize1()*8) - 1);
if (fmt)
tmp += sprintf( buffer + tmp, "TUPLTYPE %s\n", fmt->name );
tmp += sprintf( buffer + tmp, "ENDHDR\n" );
sprintf( buffer + tmp, "ENDHDR\n" );
strm.putBytes( buffer, (int)strlen(buffer) );
/* write data */
+4 -5
View File
@@ -255,22 +255,21 @@ bool TiffDecoder::readHeader()
{
case 8:
m_type = CV_MAKETYPE(CV_8U, photometric > 1 ? wanted_channels : 1);
result = true;
break;
case 16:
m_type = CV_MAKETYPE(CV_16U, photometric > 1 ? wanted_channels : 1);
result = true;
break;
case 32:
m_type = CV_MAKETYPE(CV_32F, photometric > 1 ? 3 : 1);
result = true;
break;
case 64:
m_type = CV_MAKETYPE(CV_64F, photometric > 1 ? 3 : 1);
result = true;
break;
default:
result = false;
}
result = true;
}
}