diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index 6f0f7efd5c..ade9c71ebb 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -2236,13 +2236,13 @@ bool findCirclesGrid2(InputArray _image, Size patternSize, void* oldCbkData; ErrorCallback oldCbk = redirectError(quiet_error, 0, &oldCbkData); // FIXIT not thread safe #endif - CV_TRY + try { isFound = boxFinder.findHoles(); } - CV_CATCH(Exception, e) + catch (const cv::Exception &) { - CV_UNUSED(e); + } #if BE_QUIET redirectError(oldCbk, oldCbkData); diff --git a/modules/core/src/command_line_parser.cpp b/modules/core/src/command_line_parser.cpp index 766835fe1d..f324d87c15 100644 --- a/modules/core/src/command_line_parser.cpp +++ b/modules/core/src/command_line_parser.cpp @@ -124,7 +124,7 @@ static void from_str(const String& str, int type, void* dst) void CommandLineParser::getByName(const String& name, bool space_delete, int type, void* dst) const { - CV_TRY + try { for (size_t i = 0; i < impl->data.size(); i++) { @@ -149,19 +149,20 @@ void CommandLineParser::getByName(const String& name, bool space_delete, int typ } } } - CV_CATCH (Exception, e) + catch (Exception& e) { impl->error = true; impl->error_message = impl->error_message + "Parameter '"+ name + "': " + e.err + "\n"; return; } + CV_Error_(Error::StsBadArg, ("undeclared key '%s' requested", name.c_str())); } void CommandLineParser::getByIndex(int index, bool space_delete, int type, void* dst) const { - CV_TRY + try { for (size_t i = 0; i < impl->data.size(); i++) { @@ -181,12 +182,13 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void* } } } - CV_CATCH(Exception, e) + catch(Exception& e) { impl->error = true; impl->error_message = impl->error_message + format("Parameter #%d: ", index) + e.err + "\n"; return; } + CV_Error_(Error::StsBadArg, ("undeclared position %d requested", index)); } @@ -460,13 +462,14 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s std::vector vec; String word = ""; bool begin = false; + while (!str.empty()) { if (str[0] == fs) { if (begin == true) { - CV_THROW (cv::Exception(CV_StsParseError, + throw cv::Exception(CV_StsParseError, String("error in split_range_string(") + str + String(", ") @@ -475,7 +478,7 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s + String(1, ss) + String(")"), "", __FILE__, __LINE__ - )); + ); } begin = true; word = ""; @@ -486,7 +489,7 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s { if (begin == false) { - CV_THROW (cv::Exception(CV_StsParseError, + throw cv::Exception(CV_StsParseError, String("error in split_range_string(") + str + String(", ") @@ -495,7 +498,7 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s + String(1, ss) + String(")"), "", __FILE__, __LINE__ - )); + ); } begin = false; vec.push_back(word); @@ -510,7 +513,7 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s if (begin == true) { - CV_THROW (cv::Exception(CV_StsParseError, + throw cv::Exception(CV_StsParseError, String("error in split_range_string(") + str + String(", ") @@ -519,8 +522,9 @@ std::vector CommandLineParser::Impl::split_range_string(const String& _s + String(1, ss) + String(")"), "", __FILE__, __LINE__ - )); + ); } + return vec; } diff --git a/modules/core/src/glob.cpp b/modules/core/src/glob.cpp index 76f20e2c48..f213bcbc7b 100644 --- a/modules/core/src/glob.cpp +++ b/modules/core/src/glob.cpp @@ -231,7 +231,7 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s if ((dir = opendir (directory.c_str())) != 0) { /* find all the files and directories within directory */ - CV_TRY + try { struct dirent *ent; while ((ent = readdir (dir)) != 0) @@ -255,10 +255,10 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s result.push_back(entry); } } - CV_CATCH_ALL + catch (...) { closedir(dir); - CV_RETHROW(); + throw; } closedir(dir); } diff --git a/modules/core/src/lda.cpp b/modules/core/src/lda.cpp index 30728766e2..abbb43ecd3 100644 --- a/modules/core/src/lda.cpp +++ b/modules/core/src/lda.cpp @@ -866,7 +866,7 @@ private: d = alloc_1d (n); e = alloc_1d (n); ort = alloc_1d (n); - CV_TRY { + try { // Reduce to Hessenberg form. orthes(); // Reduce Hessenberg to real Schur form. @@ -884,10 +884,10 @@ private: // Deallocate the memory by releasing all internal working data. release(); } - CV_CATCH_ALL + catch (...) { release(); - CV_RETHROW(); + throw; } } diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 8433babc64..2cebda432b 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -416,7 +416,7 @@ Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange) } *this = m; - CV_TRY + try { if( _rowRange != Range::all() && _rowRange != Range(0,rows) ) { @@ -436,10 +436,10 @@ Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange) flags |= SUBMATRIX_FLAG; } } - CV_CATCH_ALL + catch(...) { release(); - CV_RETHROW(); + throw; } updateContinuityFlag(); diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 42aaf8da29..6d66e702ff 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -894,11 +894,11 @@ bool useOpenCL() CoreTLSData* data = getCoreTlsData().get(); if( data->useOpenCL < 0 ) { - CV_TRY + try { data->useOpenCL = (int)(haveOpenCL() && Device::getDefault().ptr() && Device::getDefault().available()) ? 1 : 0; } - CV_CATCH_ALL + catch (...) { data->useOpenCL = 0; } diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index ad5a4e3cc0..4ff839ad47 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -1025,7 +1025,7 @@ void error( const Exception& exc ) *p = 0; } - CV_THROW(exc); + throw exc; } void error(int _code, const String& _err, const char* _func, const char* _file, int _line) diff --git a/modules/core/src/umatrix.cpp b/modules/core/src/umatrix.cpp index 27d587b186..c31d9e1bdd 100644 --- a/modules/core/src/umatrix.cpp +++ b/modules/core/src/umatrix.cpp @@ -367,11 +367,11 @@ UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const new_u->originalUMatData = u; } bool allocated = false; - CV_TRY + try { allocated = UMat::getStdAllocator()->allocate(new_u, accessFlags, usageFlags); } - CV_CATCH(cv::Exception, e) + catch (const cv::Exception& e) { fprintf(stderr, "Exception: %s\n", e.what()); } @@ -442,12 +442,12 @@ void UMat::create(int d, const int* _sizes, int _type, UMatUsageFlags _usageFlag a = a0; a0 = Mat::getDefaultAllocator(); } - CV_TRY + try { u = a->allocate(dims, size, _type, 0, step.p, 0, usageFlags); CV_Assert(u != 0); } - CV_CATCH_ALL + catch(...) { if(a != a0) u = a0->allocate(dims, size, _type, 0, step.p, 0, usageFlags); diff --git a/modules/imgcodecs/src/bitstrm.cpp b/modules/imgcodecs/src/bitstrm.cpp index 86d2bc659b..2f5b44dfeb 100644 --- a/modules/imgcodecs/src/bitstrm.cpp +++ b/modules/imgcodecs/src/bitstrm.cpp @@ -99,7 +99,7 @@ void RBaseStream::readBlock() { if( m_block_pos == 0 && m_current < m_end ) return; - CV_THROW (RBS_THROW_EOS); + throw RBS_THROW_EOS; } fseek( m_file, m_block_pos, SEEK_SET ); @@ -107,7 +107,7 @@ void RBaseStream::readBlock() m_end = m_start + readed; if( readed == 0 || m_current >= m_end ) - CV_THROW (RBS_THROW_EOS); + throw RBS_THROW_EOS; } diff --git a/modules/imgcodecs/src/exif.cpp b/modules/imgcodecs/src/exif.cpp index 22b4f224ce..4dbaf43e81 100644 --- a/modules/imgcodecs/src/exif.cpp +++ b/modules/imgcodecs/src/exif.cpp @@ -80,15 +80,14 @@ ExifReader::~ExifReader() */ bool ExifReader::parse() { - CV_TRY { + try { m_exif = getExif(); if( !m_exif.empty() ) { return true; } return false; - } CV_CATCH (ExifParsingError, e) { - CV_UNUSED(e); + } catch (ExifParsingError&) { return false; } } @@ -152,11 +151,11 @@ std::map ExifReader::getExif() case COM: bytesToSkip = getFieldSize(); if (bytesToSkip < markerSize) { - CV_THROW (ExifParsingError()); + throw ExifParsingError(); } m_stream.seekg( static_cast( bytesToSkip - markerSize ), m_stream.cur ); if ( m_stream.fail() ) { - CV_THROW (ExifParsingError()); + throw ExifParsingError(); } break; @@ -167,12 +166,12 @@ std::map ExifReader::getExif() case APP1: //actual Exif Marker exifSize = getFieldSize(); if (exifSize <= offsetToTiffHeader) { - CV_THROW (ExifParsingError()); + throw ExifParsingError(); } m_data.resize( exifSize - offsetToTiffHeader ); m_stream.seekg( static_cast( offsetToTiffHeader ), m_stream.cur ); if ( m_stream.fail() ) { - CV_THROW (ExifParsingError()); + throw ExifParsingError(); } m_stream.read( reinterpret_cast(&m_data[0]), exifSize - offsetToTiffHeader ); exifFound = true; @@ -416,7 +415,7 @@ std::string ExifReader::getString(const size_t offset) const dataOffset = getU32( offset + 8 ); } if (dataOffset > m_data.size() || dataOffset + size > m_data.size()) { - CV_THROW (ExifParsingError()); + throw ExifParsingError(); } std::vector::const_iterator it = m_data.begin() + dataOffset; std::string result( it, it + size ); //copy vector content into result @@ -433,7 +432,7 @@ std::string ExifReader::getString(const size_t offset) const uint16_t ExifReader::getU16(const size_t offset) const { if (offset + 1 >= m_data.size()) - CV_THROW (ExifParsingError()); + throw ExifParsingError(); if( m_format == INTEL ) { @@ -451,7 +450,7 @@ uint16_t ExifReader::getU16(const size_t offset) const uint32_t ExifReader::getU32(const size_t offset) const { if (offset + 3 >= m_data.size()) - CV_THROW (ExifParsingError()); + throw ExifParsingError(); if( m_format == INTEL ) { diff --git a/modules/imgcodecs/src/grfmt_bmp.cpp b/modules/imgcodecs/src/grfmt_bmp.cpp index 798b2d9446..7018f8a16b 100644 --- a/modules/imgcodecs/src/grfmt_bmp.cpp +++ b/modules/imgcodecs/src/grfmt_bmp.cpp @@ -89,7 +89,7 @@ bool BmpDecoder::readHeader() else if( !m_strm.open( m_filename )) return false; - CV_TRY + try { m_strm.skip( 10 ); m_offset = m_strm.getDWord(); @@ -173,9 +173,9 @@ bool BmpDecoder::readHeader() } } } - CV_CATCH_ALL + catch(...) { - CV_RETHROW(); + throw; } // in 32 bit case alpha channel is used - so require CV_8UC4 type m_type = iscolor ? (m_bpp == 32 ? CV_8UC4 : CV_8UC3 ) : CV_8UC1; @@ -225,7 +225,7 @@ bool BmpDecoder::readData( Mat& img ) } uchar *src = _src.data(), *bgr = _bgr.data(); - CV_TRY + try { m_strm.setPos( m_offset ); @@ -490,9 +490,9 @@ decode_rle8_bad: ; CV_Error(cv::Error::StsError, "Invalid/unsupported mode"); } } - CV_CATCH_ALL + catch(...) { - CV_RETHROW(); + throw; } return result; diff --git a/modules/imgcodecs/src/grfmt_pam.cpp b/modules/imgcodecs/src/grfmt_pam.cpp index d1a2161733..c1d59d291a 100644 --- a/modules/imgcodecs/src/grfmt_pam.cpp +++ b/modules/imgcodecs/src/grfmt_pam.cpp @@ -379,25 +379,25 @@ bool PAMDecoder::readHeader() } else if( !m_strm.open( m_filename )) return false; - CV_TRY + try { byte = m_strm.getByte(); if( byte != 'P' ) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; byte = m_strm.getByte(); if (byte != '7') - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; byte = m_strm.getByte(); if (byte != '\n' && byte != '\r') - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; uint i; memset (&flds, 0x00, sizeof (struct parsed_fields)); do { if (!ReadPAMHeaderLine(m_strm, fieldtype, value)) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; switch (fieldtype) { case PAM_HEADER_NONE: case PAM_HEADER_COMMENT: @@ -407,32 +407,32 @@ bool PAMDecoder::readHeader() break; case PAM_HEADER_HEIGHT: if (flds.height) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; if (!ParseNumber (value, &m_height)) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; flds.height = true; break; case PAM_HEADER_WIDTH: if (flds.width) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; if (!ParseNumber (value, &m_width)) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; flds.width = true; break; case PAM_HEADER_DEPTH: if (flds.depth) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; if (!ParseNumber (value, &m_channels)) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; flds.depth = true; break; case PAM_HEADER_MAXVAL: if (flds.maxval) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; if (!ParseNumber (value, &m_maxval)) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; if ( m_maxval > 65535 ) - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; if ( m_maxval > 255 ) { m_sampledepth = CV_16U; } @@ -451,7 +451,7 @@ bool PAMDecoder::readHeader() } break; default: - CV_THROW( RBS_BAD_HEADER ); + throw RBS_BAD_HEADER; } } while (fieldtype != PAM_HEADER_ENDHDR); @@ -469,7 +469,7 @@ bool PAMDecoder::readHeader() return true; } - } CV_CATCH_ALL + } catch(...) { } @@ -512,7 +512,7 @@ bool PAMDecoder::readData( Mat& img ) } } - CV_TRY + try { m_strm.setPos( m_offset ); @@ -610,7 +610,7 @@ bool PAMDecoder::readData( Mat& img ) } res = true; - } CV_CATCH_ALL + } catch(...) { } diff --git a/modules/imgcodecs/src/grfmt_pxm.cpp b/modules/imgcodecs/src/grfmt_pxm.cpp index b41fd95edc..c10f6fc2ac 100644 --- a/modules/imgcodecs/src/grfmt_pxm.cpp +++ b/modules/imgcodecs/src/grfmt_pxm.cpp @@ -150,11 +150,11 @@ bool PxMDecoder::readHeader() else if( !m_strm.open( m_filename )) return false; - CV_TRY + try { int code = m_strm.getByte(); if( code != 'P' ) - CV_THROW (RBS_BAD_HEADER); + throw RBS_BAD_HEADER; code = m_strm.getByte(); switch( code ) @@ -162,7 +162,7 @@ bool PxMDecoder::readHeader() case '1': case '4': m_bpp = 1; break; case '2': case '5': m_bpp = 8; break; case '3': case '6': m_bpp = 24; break; - default: CV_THROW (RBS_BAD_HEADER); + default: throw RBS_BAD_HEADER; } m_binary = code >= '4'; @@ -173,7 +173,7 @@ bool PxMDecoder::readHeader() m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm); if( m_maxval > 65535 ) - CV_THROW (RBS_BAD_HEADER); + throw RBS_BAD_HEADER; //if( m_maxval > 255 ) m_binary = false; nonsense if( m_maxval > 255 ) @@ -185,15 +185,14 @@ bool PxMDecoder::readHeader() result = true; } } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception&) { - CV_UNUSED(e); - CV_RETHROW(); + throw; } - CV_CATCH_ALL + catch (...) { std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush; - CV_RETHROW(); + throw; } if( !result ) @@ -233,7 +232,7 @@ bool PxMDecoder::readData( Mat& img ) FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 ); } - CV_TRY + try { m_strm.setPos( m_offset ); @@ -359,15 +358,14 @@ bool PxMDecoder::readData( Mat& img ) CV_Error(Error::StsError, "m_bpp is not supported"); } } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception&) { - CV_UNUSED(e); - CV_RETHROW(); + throw; } - CV_CATCH_ALL + catch (...) { std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush; - CV_RETHROW(); + throw; } return result; diff --git a/modules/imgcodecs/src/grfmt_sunras.cpp b/modules/imgcodecs/src/grfmt_sunras.cpp index 4865edaa26..069566665a 100644 --- a/modules/imgcodecs/src/grfmt_sunras.cpp +++ b/modules/imgcodecs/src/grfmt_sunras.cpp @@ -84,7 +84,7 @@ bool SunRasterDecoder::readHeader() if( !m_strm.open( m_filename )) return false; - CV_TRY + try { m_strm.skip( 4 ); m_width = m_strm.getDWord(); @@ -144,7 +144,7 @@ bool SunRasterDecoder::readHeader() } } } - CV_CATCH_ALL + catch(...) { } @@ -179,7 +179,7 @@ bool SunRasterDecoder::readData( Mat& img ) if( !color && m_maptype == RMT_EQUAL_RGB ) CvtPaletteToGray( m_palette, gray_palette, 1 << m_bpp ); - CV_TRY + try { m_strm.setPos( m_offset ); @@ -376,7 +376,7 @@ bad_decoding_end: CV_Error(Error::StsInternal, ""); } } - CV_CATCH_ALL + catch( ... ) { } diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp index 690f02dd06..cb7481872e 100644 --- a/modules/imgcodecs/src/loadsave.cpp +++ b/modules/imgcodecs/src/loadsave.cpp @@ -437,18 +437,18 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 ) /// set the filename in the driver decoder->setSource( filename ); - CV_TRY + try { // read the header to make sure it succeeds if( !decoder->readHeader() ) return 0; } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception& e) { std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush; return 0; } - CV_CATCH_ALL + catch (...) { std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush; return 0; @@ -493,16 +493,16 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 ) // read the image data bool success = false; - CV_TRY + try { if (decoder->readData(*data)) success = true; } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception& e) { std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush; } - CV_CATCH_ALL + catch (...) { std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush; } @@ -559,18 +559,18 @@ imreadmulti_(const String& filename, int flags, std::vector& mats) decoder->setSource(filename); // read the header to make sure it succeeds - CV_TRY + try { // read the header to make sure it succeeds if( !decoder->readHeader() ) return 0; } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception& e) { std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush; return 0; } - CV_CATCH_ALL + catch (...) { std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush; return 0; @@ -598,16 +598,16 @@ imreadmulti_(const String& filename, int flags, std::vector& mats) // read the image data Mat mat(size.height, size.width, type); bool success = false; - CV_TRY + try { if (decoder->readData(mat)) success = true; } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception& e) { std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush; } - CV_CATCH_ALL + catch (...) { std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush; } @@ -777,16 +777,16 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 ) } bool success = false; - CV_TRY + try { if (decoder->readHeader()) success = true; } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception& e) { std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush; } - CV_CATCH_ALL + catch (...) { std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush; } @@ -839,16 +839,16 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 ) } success = false; - CV_TRY + try { if (decoder->readData(*data)) success = true; } - CV_CATCH (cv::Exception, e) + catch (const cv::Exception& e) { std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush; } - CV_CATCH_ALL + catch (...) { std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush; } diff --git a/modules/imgproc/src/contours.cpp b/modules/imgproc/src/contours.cpp index f1c3338340..f4d0be59d0 100644 --- a/modules/imgproc/src/contours.cpp +++ b/modules/imgproc/src/contours.cpp @@ -1820,7 +1820,7 @@ cvFindContours_Impl( void* img, CvMemStorage* storage, } else { - CV_TRY + try { scanner = cvStartFindContours_Impl( img, storage, cntHeaderSize, mode, method, offset, needFillBorder); @@ -1832,11 +1832,11 @@ cvFindContours_Impl( void* img, CvMemStorage* storage, } while( contour != 0 ); } - CV_CATCH_ALL + catch(...) { if( scanner ) cvEndFindContours(&scanner); - CV_RETHROW(); + throw; } *firstContour = cvEndFindContours( &scanner ); diff --git a/modules/objdetect/src/detection_based_tracker.cpp b/modules/objdetect/src/detection_based_tracker.cpp index 26c0ed8389..53b439499e 100644 --- a/modules/objdetect/src/detection_based_tracker.cpp +++ b/modules/objdetect/src/detection_based_tracker.cpp @@ -284,23 +284,23 @@ bool cv::DetectionBasedTracker::SeparateDetectionWork::run() } #define CATCH_ALL_AND_LOG(_block) \ - CV_TRY { \ + try { \ _block; \ } \ - CV_CATCH(cv::Exception, e) { \ + catch(cv::Exception& e) { \ LOGE0("\n %s: ERROR: OpenCV Exception caught: \n'%s'\n\n", CV_Func, e.what()); \ - } CV_CATCH(std::exception, e) { \ + } catch(std::exception& e) { \ LOGE0("\n %s: ERROR: Exception caught: \n'%s'\n\n", CV_Func, e.what()); \ - } CV_CATCH_ALL { \ + } catch(...) { \ LOGE0("\n %s: ERROR: UNKNOWN Exception caught\n\n", CV_Func); \ } void* cv::workcycleObjectDetectorFunction(void* p) { CATCH_ALL_AND_LOG({ ((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->workcycleObjectDetector(); }); - CV_TRY{ + try{ ((cv::DetectionBasedTracker::SeparateDetectionWork*)p)->init(); - } CV_CATCH_ALL { + } catch(...) { LOGE0("DetectionBasedTracker: workcycleObjectDetectorFunction: ERROR concerning pointer, received as the function parameter"); } return NULL; diff --git a/modules/objdetect/src/hog.cpp b/modules/objdetect/src/hog.cpp index b7030fdd17..f116580964 100644 --- a/modules/objdetect/src/hog.cpp +++ b/modules/objdetect/src/hog.cpp @@ -3685,7 +3685,7 @@ void HOGDescriptor::readALTModel(String modelfile) String eerr("file not exist"); String efile(__FILE__); String efunc(__FUNCTION__); - CV_THROW (Exception(Error::StsError, eerr, efile, efunc, __LINE__)); + throw Exception(Error::StsError, eerr, efile, efunc, __LINE__); } char version_buffer[10]; if (!fread (&version_buffer,sizeof(char),10,modelfl)) @@ -3695,7 +3695,7 @@ void HOGDescriptor::readALTModel(String modelfile) String efunc(__FUNCTION__); fclose(modelfl); - CV_THROW (Exception(Error::StsError, eerr, efile, efunc, __LINE__)); + throw Exception(Error::StsError, eerr, efile, efunc, __LINE__); } if(strcmp(version_buffer,"V6.01")) { String eerr("version does not match"); @@ -3703,14 +3703,14 @@ void HOGDescriptor::readALTModel(String modelfile) String efunc(__FUNCTION__); fclose(modelfl); - CV_THROW (Exception(Error::StsError, eerr, efile, efunc, __LINE__)); + throw Exception(Error::StsError, eerr, efile, efunc, __LINE__); } /* read version number */ int version = 0; if (!fread (&version,sizeof(int),1,modelfl)) { fclose(modelfl); - CV_THROW (Exception()); + throw Exception(); } if (version < 200) { @@ -3718,7 +3718,7 @@ void HOGDescriptor::readALTModel(String modelfile) String efile(__FILE__); String efunc(__FUNCTION__); fclose(modelfl); - CV_THROW (Exception()); + throw Exception(); } int kernel_type; size_t nread; @@ -3764,7 +3764,7 @@ void HOGDescriptor::readALTModel(String modelfile) if(nread != static_cast(length) + 1) { delete [] linearwt; fclose(modelfl); - CV_THROW (Exception()); + throw Exception(); } for(int i = 0; i < length; i++) @@ -3775,7 +3775,7 @@ void HOGDescriptor::readALTModel(String modelfile) delete [] linearwt; } else { fclose(modelfl); - CV_THROW (Exception()); + throw Exception(); } fclose(modelfl); }