build: unreachable code after CV_Error() (part 2)

This commit is contained in:
Alexander Alekhin 2018-04-24 13:48:21 +03:00
parent 576d2dbac0
commit 6b581c4e51
25 changed files with 23 additions and 89 deletions

View File

@ -759,12 +759,8 @@ bool CirclesGridFinder::isDetectionCorrect()
} }
return (vertices.size() == largeHeight * largeWidth + smallHeight * smallWidth); return (vertices.size() == largeHeight * largeWidth + smallHeight * smallWidth);
} }
default:
CV_Error(0, "Unknown pattern type");
} }
CV_Error(Error::StsBadArg, "Unknown pattern type");
return false;
} }
void CirclesGridFinder::findMCS(const std::vector<Point2f> &basis, std::vector<Graph> &basisGraphs) void CirclesGridFinder::findMCS(const std::vector<Point2f> &basis, std::vector<Graph> &basisGraphs)

View File

@ -53,7 +53,6 @@ namespace cv {
static void* OutOfMemoryError(size_t size) static void* OutOfMemoryError(size_t size)
{ {
CV_Error_(CV_StsNoMem, ("Failed to allocate %llu bytes", (unsigned long long)size)); CV_Error_(CV_StsNoMem, ("Failed to allocate %llu bytes", (unsigned long long)size));
return 0;
} }

View File

@ -1,3 +1,6 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "precomp.hpp" #include "precomp.hpp"
#include <sstream> #include <sstream>
@ -364,7 +367,6 @@ bool CommandLineParser::has(const String& name) const
} }
CV_Error_(Error::StsBadArg, ("undeclared key '%s' requested", name.c_str())); CV_Error_(Error::StsBadArg, ("undeclared key '%s' requested", name.c_str()));
return false;
} }
bool CommandLineParser::check() const bool CommandLineParser::check() const

View File

@ -143,6 +143,9 @@
return func; return func;
} }
#else #else
#if defined(_MSC_VER)
#pragma warning(disable : 4702) // unreachable code
#endif
static void* IntGetProcAddress(const char*) static void* IntGetProcAddress(const char*)
{ {
CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support");

View File

@ -912,7 +912,6 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet");
// TBD // TBD
return Mat();
} }
Mat Mat::reshape(int _cn, const std::vector<int>& _newshape) const Mat Mat::reshape(int _cn, const std::vector<int>& _newshape) const

View File

@ -179,7 +179,6 @@ Mat cvarrToMat(const CvArr* arr, bool copyData,
return buf; return buf;
} }
CV_Error(CV_StsBadArg, "Unknown array type"); CV_Error(CV_StsBadArg, "Unknown array type");
return Mat();
} }
void extractImageCOI(const CvArr* arr, OutputArray _ch, int coi) void extractImageCOI(const CvArr* arr, OutputArray _ch, int coi)

View File

@ -110,14 +110,12 @@ Mat _InputArray::getMat_(int i) const
{ {
CV_Assert( i < 0 ); CV_Assert( i < 0 );
CV_Error(cv::Error::StsNotImplemented, "You should explicitly call mapHost/unmapHost methods for ogl::Buffer object"); CV_Error(cv::Error::StsNotImplemented, "You should explicitly call mapHost/unmapHost methods for ogl::Buffer object");
return Mat();
} }
if( k == CUDA_GPU_MAT ) if( k == CUDA_GPU_MAT )
{ {
CV_Assert( i < 0 ); CV_Assert( i < 0 );
CV_Error(cv::Error::StsNotImplemented, "You should explicitly call download method for cuda::GpuMat object"); CV_Error(cv::Error::StsNotImplemented, "You should explicitly call download method for cuda::GpuMat object");
return Mat();
} }
if( k == CUDA_HOST_MEM ) if( k == CUDA_HOST_MEM )
@ -130,7 +128,6 @@ Mat _InputArray::getMat_(int i) const
} }
CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type");
return Mat();
} }
UMat _InputArray::getUMat(int i) const UMat _InputArray::getUMat(int i) const
@ -354,14 +351,12 @@ cuda::GpuMat _InputArray::getGpuMat() const
if (k == OPENGL_BUFFER) if (k == OPENGL_BUFFER)
{ {
CV_Error(cv::Error::StsNotImplemented, "You should explicitly call mapDevice/unmapDevice methods for ogl::Buffer object"); CV_Error(cv::Error::StsNotImplemented, "You should explicitly call mapDevice/unmapDevice methods for ogl::Buffer object");
return cuda::GpuMat();
} }
if (k == NONE) if (k == NONE)
return cuda::GpuMat(); return cuda::GpuMat();
CV_Error(cv::Error::StsNotImplemented, "getGpuMat is available only for cuda::GpuMat and cuda::HostMem"); CV_Error(cv::Error::StsNotImplemented, "getGpuMat is available only for cuda::GpuMat and cuda::HostMem");
return cuda::GpuMat();
} }
void _InputArray::getGpuMatVector(std::vector<cuda::GpuMat>& gpumv) const void _InputArray::getGpuMatVector(std::vector<cuda::GpuMat>& gpumv) const
{ {
@ -516,7 +511,6 @@ Size _InputArray::size(int i) const
} }
CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type");
return Size();
} }
int _InputArray::sizend(int* arrsz, int i) const int _InputArray::sizend(int* arrsz, int i) const
@ -716,7 +710,6 @@ int _InputArray::dims(int i) const
} }
CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type");
return 0;
} }
size_t _InputArray::total(int i) const size_t _InputArray::total(int i) const
@ -845,7 +838,6 @@ int _InputArray::type(int i) const
return ((const cuda::HostMem*)obj)->type(); return ((const cuda::HostMem*)obj)->type();
CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type");
return 0;
} }
int _InputArray::depth(int i) const int _InputArray::depth(int i) const
@ -928,7 +920,6 @@ bool _InputArray::empty() const
return ((const cuda::HostMem*)obj)->empty(); return ((const cuda::HostMem*)obj)->empty();
CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type");
return true;
} }
bool _InputArray::isContinuous(int i) const bool _InputArray::isContinuous(int i) const
@ -970,7 +961,6 @@ bool _InputArray::isContinuous(int i) const
return i < 0 ? ((const cuda::GpuMat*)obj)->isContinuous() : true; return i < 0 ? ((const cuda::GpuMat*)obj)->isContinuous() : true;
CV_Error(CV_StsNotImplemented, "Unknown/unsupported array type"); CV_Error(CV_StsNotImplemented, "Unknown/unsupported array type");
return false;
} }
bool _InputArray::isSubmatrix(int i) const bool _InputArray::isSubmatrix(int i) const
@ -1009,7 +999,6 @@ bool _InputArray::isSubmatrix(int i) const
} }
CV_Error(CV_StsNotImplemented, ""); CV_Error(CV_StsNotImplemented, "");
return false;
} }
size_t _InputArray::offset(int i) const size_t _InputArray::offset(int i) const
@ -1074,7 +1063,6 @@ size_t _InputArray::offset(int i) const
} }
CV_Error(Error::StsNotImplemented, ""); CV_Error(Error::StsNotImplemented, "");
return 0;
} }
size_t _InputArray::step(int i) const size_t _InputArray::step(int i) const
@ -1135,7 +1123,6 @@ size_t _InputArray::step(int i) const
} }
CV_Error(Error::StsNotImplemented, ""); CV_Error(Error::StsNotImplemented, "");
return 0;
} }
void _InputArray::copyTo(const _OutputArray& arr) const void _InputArray::copyTo(const _OutputArray& arr) const
@ -1459,7 +1446,6 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
if( k == NONE ) if( k == NONE )
{ {
CV_Error(CV_StsNullPtr, "create() called for the missing output array" ); CV_Error(CV_StsNullPtr, "create() called for the missing output array" );
return;
} }
if( k == STD_VECTOR_MAT ) if( k == STD_VECTOR_MAT )

View File

@ -1304,10 +1304,15 @@ void cv::ogl::Arrays::release()
void cv::ogl::Arrays::setAutoRelease(bool flag) void cv::ogl::Arrays::setAutoRelease(bool flag)
{ {
#ifndef HAVE_OPENGL
CV_UNUSED(flag);
throw_no_ogl();
#else
vertex_.setAutoRelease(flag); vertex_.setAutoRelease(flag);
color_.setAutoRelease(flag); color_.setAutoRelease(flag);
normal_.setAutoRelease(flag); normal_.setAutoRelease(flag);
texCoord_.setAutoRelease(flag); texCoord_.setAutoRelease(flag);
#endif
} }
void cv::ogl::Arrays::bind() const void cv::ogl::Arrays::bind() const

View File

@ -837,8 +837,6 @@ UMat UMat::reshape(int _cn, int _newndims, const int* _newsz) const
} }
CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet");
// TBD
return UMat();
} }
Mat UMat::getMat(int accessFlags) const Mat UMat::getMat(int accessFlags) const

View File

@ -174,7 +174,6 @@ bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues
std::cout << "Number of rows: " << evalues.rows << " Number of cols: " << evalues.cols << endl; std::cout << "Number of rows: " << evalues.rows << " Number of cols: " << evalues.cols << endl;
std::cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl; std::cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl;
CV_Error(CORE_EIGEN_ERROR_COUNT, MESSAGE_ERROR_COUNT); CV_Error(CORE_EIGEN_ERROR_COUNT, MESSAGE_ERROR_COUNT);
return false;
} }
return true; return true;
} }
@ -190,7 +189,6 @@ bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues
std::cout << "Number of rows: " << evectors.rows << " Number of cols: " << evectors.cols << endl; std::cout << "Number of rows: " << evectors.rows << " Number of cols: " << evectors.cols << endl;
std:: cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl; std:: cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl;
CV_Error (CORE_EIGEN_ERROR_SIZE, MESSAGE_ERROR_SIZE); CV_Error (CORE_EIGEN_ERROR_SIZE, MESSAGE_ERROR_SIZE);
return false;
} }
if (!(evalues.rows == right_eigen_pair_count && evalues.cols == 1)) if (!(evalues.rows == right_eigen_pair_count && evalues.cols == 1))
@ -199,7 +197,6 @@ bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues
std::cout << "Number of rows: " << evalues.rows << " Number of cols: " << evalues.cols << endl; std::cout << "Number of rows: " << evalues.rows << " Number of cols: " << evalues.cols << endl;
std:: cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl; std:: cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl;
CV_Error (CORE_EIGEN_ERROR_COUNT, MESSAGE_ERROR_COUNT); CV_Error (CORE_EIGEN_ERROR_COUNT, MESSAGE_ERROR_COUNT);
return false;
} }
return true; return true;
@ -237,7 +234,6 @@ bool Core_EigenTest::check_orthogonality(const cv::Mat& U)
std::cout << endl; std::cout << "Checking orthogonality of matrix " << U << ": "; std::cout << endl; std::cout << "Checking orthogonality of matrix " << U << ": ";
print_information(i, U, diff, eps_vec); print_information(i, U, diff, eps_vec);
CV_Error(CORE_EIGEN_ERROR_ORTHO, MESSAGE_ERROR_ORTHO); CV_Error(CORE_EIGEN_ERROR_ORTHO, MESSAGE_ERROR_ORTHO);
return false;
} }
} }
@ -257,7 +253,6 @@ bool Core_EigenTest::check_pairs_order(const cv::Mat& eigen_values)
std::cout << "Pair of indexes with non descending of eigen values: (" << i << ", " << i+1 << ")." << endl; std::cout << "Pair of indexes with non descending of eigen values: (" << i << ", " << i+1 << ")." << endl;
std::cout << endl; std::cout << endl;
CV_Error(CORE_EIGEN_ERROR_ORDER, MESSAGE_ERROR_ORDER); CV_Error(CORE_EIGEN_ERROR_ORDER, MESSAGE_ERROR_ORDER);
return false;
} }
break; break;
@ -272,7 +267,6 @@ bool Core_EigenTest::check_pairs_order(const cv::Mat& eigen_values)
std::cout << "Pair of indexes with non descending of eigen values: (" << i << ", " << i+1 << ")." << endl; std::cout << "Pair of indexes with non descending of eigen values: (" << i << ", " << i+1 << ")." << endl;
std::cout << endl; std::cout << endl;
CV_Error(CORE_EIGEN_ERROR_ORDER, "Eigen values are not sorted in descending order."); CV_Error(CORE_EIGEN_ERROR_ORDER, "Eigen values are not sorted in descending order.");
return false;
} }
break; break;
@ -331,7 +325,6 @@ bool Core_EigenTest::test_pairs(const cv::Mat& src)
std::cout << endl; std::cout << "Checking accuracy of eigen vectors computing for matrix " << src << ": "; std::cout << endl; std::cout << "Checking accuracy of eigen vectors computing for matrix " << src << ": ";
print_information(i, src, diff, eps_vec); print_information(i, src, diff, eps_vec);
CV_Error(CORE_EIGEN_ERROR_DIFF, MESSAGE_ERROR_DIFF_2); CV_Error(CORE_EIGEN_ERROR_DIFF, MESSAGE_ERROR_DIFF_2);
return false;
} }
} }
@ -360,7 +353,6 @@ bool Core_EigenTest::test_values(const cv::Mat& src)
std::cout << endl; std::cout << "Checking accuracy of eigen values computing for matrix " << src << ": "; std::cout << endl; std::cout << "Checking accuracy of eigen values computing for matrix " << src << ": ";
print_information(i, src, diff, eps_val); print_information(i, src, diff, eps_val);
CV_Error(CORE_EIGEN_ERROR_DIFF, MESSAGE_ERROR_DIFF_1); CV_Error(CORE_EIGEN_ERROR_DIFF, MESSAGE_ERROR_DIFF_1);
return false;
} }
} }

View File

@ -269,17 +269,16 @@ inline int DictValue::size() const
{ {
case Param::INT: case Param::INT:
return (int)pi->size(); return (int)pi->size();
break;
case Param::STRING: case Param::STRING:
return (int)ps->size(); return (int)ps->size();
break;
case Param::REAL: case Param::REAL:
return (int)pd->size(); return (int)pd->size();
break;
default:
CV_Error(Error::StsInternal, "");
return -1;
} }
#ifdef __OPENCV_BUILD
CV_Error(Error::StsInternal, "");
#else
CV_ErrorNoReturn(Error::StsInternal, "");
#endif
} }
inline std::ostream &operator<<(std::ostream &stream, const DictValue &dictv) inline std::ostream &operator<<(std::ostream &stream, const DictValue &dictv)

View File

@ -1360,11 +1360,13 @@ Ptr<DescriptorMatcher> FlannBasedMatcher::clone( bool emptyTrainData ) const
{ {
CV_Error( Error::StsNotImplemented, "deep clone functionality is not implemented, because " CV_Error( Error::StsNotImplemented, "deep clone functionality is not implemented, because "
"Flann::Index has not copy constructor or clone method "); "Flann::Index has not copy constructor or clone method ");
#if 0
//matcher->flannIndex; //matcher->flannIndex;
matcher->addedDescCount = addedDescCount; matcher->addedDescCount = addedDescCount;
matcher->mergedDescriptors = DescriptorCollection( mergedDescriptors ); matcher->mergedDescriptors = DescriptorCollection( mergedDescriptors );
std::transform( trainDescCollection.begin(), trainDescCollection.end(), std::transform( trainDescCollection.begin(), trainDescCollection.end(),
matcher->trainDescCollection.begin(), clone_op ); matcher->trainDescCollection.begin(), clone_op );
#endif
} }
return matcher; return matcher;
} }

View File

@ -530,7 +530,6 @@ static const char* NO_QT_ERR_MSG = "The library is compiled without QT support";
cv::QtFont cv::fontQt(const String&, int, Scalar, int, int, int) cv::QtFont cv::fontQt(const String&, int, Scalar, int, int, int)
{ {
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
return QtFont();
} }
void cv::addText( const Mat&, const String&, Point, const QtFont&) void cv::addText( const Mat&, const String&, Point, const QtFont&)
@ -556,7 +555,6 @@ void cv::displayOverlay(const String&, const String&, int )
int cv::startLoop(int (*)(int argc, char *argv[]), int , char**) int cv::startLoop(int (*)(int argc, char *argv[]), int , char**)
{ {
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
return 0;
} }
void cv::stopLoop() void cv::stopLoop()
@ -577,7 +575,6 @@ void cv::loadWindowParameters(const String&)
int cv::createButton(const String&, ButtonCallback, void*, int , bool ) int cv::createButton(const String&, ButtonCallback, void*, int , bool )
{ {
CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG);
return 0;
} }
#endif #endif
@ -606,17 +603,16 @@ void cv::setWindowTitle(const String&, const String&)
} }
#define CV_NO_GUI_ERROR(funcname) \ #define CV_NO_GUI_ERROR(funcname) \
cvError( CV_StsError, funcname, \ cv::errorNoReturn(cv::Error::StsError, \
"The function is not implemented. " \ "The function is not implemented. " \
"Rebuild the library with Windows, GTK+ 2.x or Carbon support. "\ "Rebuild the library with Windows, GTK+ 2.x or Carbon support. "\
"If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script", \ "If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script", \
__FILE__, __LINE__ ) funcname, __FILE__, __LINE__)
CV_IMPL int cvNamedWindow( const char*, int ) CV_IMPL int cvNamedWindow( const char*, int )
{ {
CV_NO_GUI_ERROR("cvNamedWindow"); CV_NO_GUI_ERROR("cvNamedWindow");
return -1;
} }
CV_IMPL void cvDestroyWindow( const char* ) CV_IMPL void cvDestroyWindow( const char* )
@ -651,7 +647,6 @@ cvCreateTrackbar( const char*, const char*,
int*, int, CvTrackbarCallback ) int*, int, CvTrackbarCallback )
{ {
CV_NO_GUI_ERROR( "cvCreateTrackbar" ); CV_NO_GUI_ERROR( "cvCreateTrackbar" );
return -1;
} }
CV_IMPL int CV_IMPL int
@ -660,7 +655,6 @@ cvCreateTrackbar2( const char* /*trackbar_name*/, const char* /*window_name*/,
void* /*userdata*/ ) void* /*userdata*/ )
{ {
CV_NO_GUI_ERROR( "cvCreateTrackbar2" ); CV_NO_GUI_ERROR( "cvCreateTrackbar2" );
return -1;
} }
CV_IMPL void CV_IMPL void
@ -672,7 +666,6 @@ cvSetMouseCallback( const char*, CvMouseCallback, void* )
CV_IMPL int cvGetTrackbarPos( const char*, const char* ) CV_IMPL int cvGetTrackbarPos( const char*, const char* )
{ {
CV_NO_GUI_ERROR( "cvGetTrackbarPos" ); CV_NO_GUI_ERROR( "cvGetTrackbarPos" );
return -1;
} }
CV_IMPL void cvSetTrackbarPos( const char*, const char*, int ) CV_IMPL void cvSetTrackbarPos( const char*, const char*, int )
@ -693,33 +686,28 @@ CV_IMPL void cvSetTrackbarMin(const char*, const char*, int)
CV_IMPL void* cvGetWindowHandle( const char* ) CV_IMPL void* cvGetWindowHandle( const char* )
{ {
CV_NO_GUI_ERROR( "cvGetWindowHandle" ); CV_NO_GUI_ERROR( "cvGetWindowHandle" );
return 0;
} }
CV_IMPL const char* cvGetWindowName( void* ) CV_IMPL const char* cvGetWindowName( void* )
{ {
CV_NO_GUI_ERROR( "cvGetWindowName" ); CV_NO_GUI_ERROR( "cvGetWindowName" );
return 0;
} }
CV_IMPL int cvWaitKey( int ) CV_IMPL int cvWaitKey( int )
{ {
CV_NO_GUI_ERROR( "cvWaitKey" ); CV_NO_GUI_ERROR( "cvWaitKey" );
return -1;
} }
CV_IMPL int cvInitSystem( int , char** ) CV_IMPL int cvInitSystem( int , char** )
{ {
CV_NO_GUI_ERROR( "cvInitSystem" ); CV_NO_GUI_ERROR( "cvInitSystem" );
return -1;
} }
CV_IMPL int cvStartWindowThread() CV_IMPL int cvStartWindowThread()
{ {
CV_NO_GUI_ERROR( "cvStartWindowThread" ); CV_NO_GUI_ERROR( "cvStartWindowThread" );
return -1;
} }
//-------- Qt --------- //-------- Qt ---------
@ -742,7 +730,6 @@ CV_IMPL int cvStartLoop(int (*)(int argc, char *argv[]), int , char* argv[])
{ {
(void)argv; (void)argv;
CV_NO_GUI_ERROR("cvStartLoop"); CV_NO_GUI_ERROR("cvStartLoop");
return -1;
} }
CV_IMPL void cvStopLoop() CV_IMPL void cvStopLoop()
@ -763,7 +750,6 @@ CV_IMPL void cvSaveWindowParameters(const char* )
CV_IMPL int cvCreateButton(const char*, void (*)(int, void*), void*, int, int) CV_IMPL int cvCreateButton(const char*, void (*)(int, void*), void*, int, int)
{ {
CV_NO_GUI_ERROR("cvCreateButton"); CV_NO_GUI_ERROR("cvCreateButton");
return -1;
} }

View File

@ -99,7 +99,6 @@ static int rgbe_error(int rgbe_error_code, const char *msg)
CV_Error(cv::Error::StsError, cv::String("RGBE error: \n") + CV_Error(cv::Error::StsError, cv::String("RGBE error: \n") +
cv::String(msg)); cv::String(msg));
} }
return RGBE_RETURN_FAILURE;
} }
/* standard conversion from float pixels to rgbe pixels */ /* standard conversion from float pixels to rgbe pixels */

View File

@ -126,9 +126,8 @@ static Mat interp1(InputArray _x, InputArray _Y, InputArray _xi)
case CV_32SC1: return interp1_<int>(x,Y,xi); break; case CV_32SC1: return interp1_<int>(x,Y,xi); break;
case CV_32FC1: return interp1_<float>(x,Y,xi); break; case CV_32FC1: return interp1_<float>(x,Y,xi); break;
case CV_64FC1: return interp1_<double>(x,Y,xi); break; case CV_64FC1: return interp1_<double>(x,Y,xi); break;
default: CV_Error(Error::StsUnsupportedFormat, ""); break;
} }
return Mat(); CV_Error(Error::StsUnsupportedFormat, "");
} }
namespace colormap namespace colormap

View File

@ -3980,7 +3980,6 @@ namespace cv{
} }
CV_Error(CV_StsUnsupportedFormat, "unsupported label/image type"); CV_Error(CV_StsUnsupportedFormat, "unsupported label/image type");
return -1;
} }
} }
@ -4003,7 +4002,6 @@ int cv::connectedComponents(InputArray img_, OutputArray _labels, int connectivi
} }
else{ else{
CV_Error(CV_StsUnsupportedFormat, "the type of labels must be 16u or 32s"); CV_Error(CV_StsUnsupportedFormat, "the type of labels must be 16u or 32s");
return 0;
} }
} }

View File

@ -3642,8 +3642,6 @@ cv::Ptr<cv::BaseRowFilter> cv::getLinearRowFilter( int srcType, int bufType,
CV_Error_( CV_StsNotImplemented, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)", ("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, bufType)); srcType, bufType));
return Ptr<BaseRowFilter>();
} }
@ -3739,8 +3737,6 @@ cv::Ptr<cv::BaseColumnFilter> cv::getLinearColumnFilter( int bufType, int dstTyp
CV_Error_( CV_StsNotImplemented, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of buffer format (=%d), and destination format (=%d)", ("Unsupported combination of buffer format (=%d), and destination format (=%d)",
bufType, dstType)); bufType, dstType));
return Ptr<BaseColumnFilter>();
} }
@ -4491,8 +4487,6 @@ cv::Ptr<cv::BaseFilter> cv::getLinearFilter(int srcType, int dstType,
CV_Error_( CV_StsNotImplemented, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and destination format (=%d)", ("Unsupported combination of source format (=%d), and destination format (=%d)",
srcType, dstType)); srcType, dstType));
return Ptr<BaseFilter>();
} }

View File

@ -888,7 +888,6 @@ cv::Ptr<cv::BaseRowFilter> cv::getMorphologyRowFilter(int op, int type, int ksiz
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
return Ptr<BaseRowFilter>();
} }
cv::Ptr<cv::BaseColumnFilter> cv::getMorphologyColumnFilter(int op, int type, int ksize, int anchor) cv::Ptr<cv::BaseColumnFilter> cv::getMorphologyColumnFilter(int op, int type, int ksize, int anchor)
@ -935,7 +934,6 @@ cv::Ptr<cv::BaseColumnFilter> cv::getMorphologyColumnFilter(int op, int type, in
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
return Ptr<BaseColumnFilter>();
} }
@ -973,7 +971,6 @@ cv::Ptr<cv::BaseFilter> cv::getMorphologyFilter(int op, int type, InputArray _ke
} }
CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
return Ptr<BaseFilter>();
} }

View File

@ -117,9 +117,7 @@ inline bool isStorageOrMat(void * arr)
return true; return true;
else if (CV_IS_MAT( arr )) else if (CV_IS_MAT( arr ))
return false; return false;
else CV_Error( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" );
CV_Error( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" );
return false;
} }
#endif /*__OPENCV_CV_INTERNAL_H_*/ #endif /*__OPENCV_CV_INTERNAL_H_*/

View File

@ -1332,8 +1332,6 @@ cv::Ptr<cv::BaseRowFilter> cv::getRowSumFilter(int srcType, int sumType, int ksi
CV_Error_( CV_StsNotImplemented, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)", ("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, sumType)); srcType, sumType));
return Ptr<BaseRowFilter>();
} }
@ -1374,8 +1372,6 @@ cv::Ptr<cv::BaseColumnFilter> cv::getColumnSumFilter(int sumType, int dstType, i
CV_Error_( CV_StsNotImplemented, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of sum format (=%d), and destination format (=%d)", ("Unsupported combination of sum format (=%d), and destination format (=%d)",
sumType, dstType)); sumType, dstType));
return Ptr<BaseColumnFilter>();
} }
@ -1656,8 +1652,6 @@ static Ptr<BaseRowFilter> getSqrRowSumFilter(int srcType, int sumType, int ksize
CV_Error_( CV_StsNotImplemented, CV_Error_( CV_StsNotImplemented,
("Unsupported combination of source format (=%d), and buffer format (=%d)", ("Unsupported combination of source format (=%d), and buffer format (=%d)",
srcType, sumType)); srcType, sumType));
return Ptr<BaseRowFilter>();
} }
} }

View File

@ -613,7 +613,6 @@ static Point2f mapPointSpherical(const Point2f& p, float alpha, Vec4d* J, int pr
return Point2f((float)asin(x1), (float)asin(y1)); return Point2f((float)asin(x1), (float)asin(y1));
} }
CV_Error(CV_StsBadArg, "Unknown projection type"); CV_Error(CV_StsBadArg, "Unknown projection type");
return Point2f();
} }

View File

@ -125,7 +125,6 @@ template <typename T> bool CV_BoundingRectTest::checking_function_work(vector <P
cout << "Result rect (x, y, w, h): [" << rect[i].x << ", " << rect[i].y << ", " << rect[i].width << ", " << rect[i].height << "]" << endl; cout << "Result rect (x, y, w, h): [" << rect[i].x << ", " << rect[i].y << ", " << rect[i].width << ", " << rect[i].height << "]" << endl;
cout << endl; cout << endl;
CV_Error(IMGPROC_BOUNDINGRECT_ERROR_DIFF, MESSAGE_ERROR_DIFF); CV_Error(IMGPROC_BOUNDINGRECT_ERROR_DIFF, MESSAGE_ERROR_DIFF);
return false;
} }
} }

View File

@ -58,7 +58,6 @@ int str_to_svm_type(String& str)
if( !str.compare("NU_SVR") ) if( !str.compare("NU_SVR") )
return SVM::NU_SVR; return SVM::NU_SVR;
CV_Error( CV_StsBadArg, "incorrect svm type string" ); CV_Error( CV_StsBadArg, "incorrect svm type string" );
return -1;
} }
int str_to_svm_kernel_type( String& str ) int str_to_svm_kernel_type( String& str )
{ {
@ -71,7 +70,6 @@ int str_to_svm_kernel_type( String& str )
if( !str.compare("SIGMOID") ) if( !str.compare("SIGMOID") )
return SVM::SIGMOID; return SVM::SIGMOID;
CV_Error( CV_StsBadArg, "incorrect svm type string" ); CV_Error( CV_StsBadArg, "incorrect svm type string" );
return -1;
} }
// 4. em // 4. em
@ -85,7 +83,6 @@ int str_to_ann_train_method( String& str )
if (!str.compare("ANNEAL")) if (!str.compare("ANNEAL"))
return ANN_MLP::ANNEAL; return ANN_MLP::ANNEAL;
CV_Error( CV_StsBadArg, "incorrect ann train method string" ); CV_Error( CV_StsBadArg, "incorrect ann train method string" );
return -1;
} }
#if 0 #if 0
@ -102,7 +99,6 @@ int str_to_ann_activation_function(String& str)
if (!str.compare("LEAKYRELU")) if (!str.compare("LEAKYRELU"))
return ANN_MLP::LEAKYRELU; return ANN_MLP::LEAKYRELU;
CV_Error(CV_StsBadArg, "incorrect ann activation function string"); CV_Error(CV_StsBadArg, "incorrect ann activation function string");
return -1;
} }
#endif #endif
@ -374,7 +370,6 @@ int str_to_boost_type( String& str )
if ( !str.compare("GENTLE") ) if ( !str.compare("GENTLE") )
return Boost::GENTLE; return Boost::GENTLE;
CV_Error( CV_StsBadArg, "incorrect boost type string" ); CV_Error( CV_StsBadArg, "incorrect boost type string" );
return -1;
} }
// 8. rtrees // 8. rtrees
@ -387,7 +382,6 @@ int str_to_svmsgd_type( String& str )
if ( !str.compare("ASGD") ) if ( !str.compare("ASGD") )
return SVMSGD::ASGD; return SVMSGD::ASGD;
CV_Error( CV_StsBadArg, "incorrect svmsgd type string" ); CV_Error( CV_StsBadArg, "incorrect svmsgd type string" );
return -1;
} }
int str_to_margin_type( String& str ) int str_to_margin_type( String& str )
@ -397,7 +391,6 @@ int str_to_margin_type( String& str )
if ( !str.compare("HARD_MARGIN") ) if ( !str.compare("HARD_MARGIN") )
return SVMSGD::HARD_MARGIN; return SVMSGD::HARD_MARGIN;
CV_Error( CV_StsBadArg, "incorrect svmsgd margin type string" ); CV_Error( CV_StsBadArg, "incorrect svmsgd margin type string" );
return -1;
} }
} }

View File

@ -54,7 +54,6 @@ Ptr<ExposureCompensator> ExposureCompensator::createDefault(int type)
if (type == GAIN_BLOCKS) if (type == GAIN_BLOCKS)
return makePtr<BlocksGainCompensator>(); return makePtr<BlocksGainCompensator>();
CV_Error(Error::StsBadArg, "unsupported exposure compensation method"); CV_Error(Error::StsBadArg, "unsupported exposure compensation method");
return Ptr<ExposureCompensator>();
} }

View File

@ -96,7 +96,6 @@ static bool createEncodeHuffmanTable( const int* src, unsigned* table, int max_s
if( size > max_size ) if( size > max_size )
{ {
CV_Error(CV_StsOutOfRange, "too big maximum Huffman code size"); CV_Error(CV_StsOutOfRange, "too big maximum Huffman code size");
return false;
} }
memset( table, 0, size*sizeof(table[0])); memset( table, 0, size*sizeof(table[0]));