diff -Nuarp opencv-3.4.16/modules/core/include/opencv2/core/bindings_utils.hpp opencv-3.4.16.nortti/modules/core/include/opencv2/core/bindings_utils.hpp --- opencv-3.4.16/modules/core/include/opencv2/core/bindings_utils.hpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/include/opencv2/core/bindings_utils.hpp 2021-11-24 11:12:28.954452496 +0800 @@ -170,12 +170,6 @@ void generateVectorOfMat(size_t len, int } CV_WRAP static inline -void testRaiseGeneralException() -{ - throw std::runtime_error("exception text"); -} - -CV_WRAP static inline AsyncArray testAsyncArray(InputArray argument) { AsyncPromise p; @@ -187,14 +181,6 @@ CV_WRAP static inline AsyncArray testAsyncException() { AsyncPromise p; - try - { - CV_Error(Error::StsOk, "Test: Generated async error"); - } - catch (const cv::Exception& e) - { - p.setException(e); - } return p.getArrayResult(); } diff -Nuarp opencv-3.4.16/modules/core/src/async.cpp opencv-3.4.16.nortti/modules/core/src/async.cpp --- opencv-3.4.16/modules/core/src/async.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/async.cpp 2021-11-24 11:12:28.955452496 +0800 @@ -118,7 +118,6 @@ struct AsyncArray::Impl if (has_exception) { result_is_fetched = true; - throw cv_exception; } CV_Error(Error::StsInternal, "AsyncArray: invalid state of 'has_result = true'"); } diff -Nuarp opencv-3.4.16/modules/core/src/bindings_utils.cpp opencv-3.4.16.nortti/modules/core/src/bindings_utils.cpp --- opencv-3.4.16/modules/core/src/bindings_utils.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/bindings_utils.cpp 2021-11-24 11:12:28.955452496 +0800 @@ -15,7 +15,7 @@ String dumpInputArray(InputArray argumen return "InputArray: noArray()"; std::ostringstream ss; ss << "InputArray:"; - try { + { do { ss << (argument.empty() ? " empty()=true" : " empty()=false"); ss << cv::format(" kind=0x%08llx", (long long int)argument.kind()); @@ -49,10 +49,6 @@ String dumpInputArray(InputArray argumen ss << " type(-1)=" << cv::typeToString(argument.type(-1)); } while (0); } - catch (...) - { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds - } return ss.str(); } @@ -62,7 +58,7 @@ CV_EXPORTS_W String dumpInputArrayOfArra return "InputArrayOfArrays: noArray()"; std::ostringstream ss; ss << "InputArrayOfArrays:"; - try { + { do { ss << (argument.empty() ? " empty()=true" : " empty()=false"); ss << cv::format(" kind=0x%08llx", (long long int)argument.kind()); @@ -102,10 +98,6 @@ CV_EXPORTS_W String dumpInputArrayOfArra } } while (0); } - catch (...) - { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds - } return ss.str(); } @@ -115,7 +107,7 @@ CV_EXPORTS_W String dumpInputOutputArray return "InputOutputArray: noArray()"; std::ostringstream ss; ss << "InputOutputArray:"; - try { + { do { ss << (argument.empty() ? " empty()=true" : " empty()=false"); ss << cv::format(" kind=0x%08llx", (long long int)argument.kind()); @@ -149,10 +141,6 @@ CV_EXPORTS_W String dumpInputOutputArray ss << " type(-1)=" << cv::typeToString(argument.type(-1)); } while (0); } - catch (...) - { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds - } return ss.str(); } @@ -162,7 +150,7 @@ CV_EXPORTS_W String dumpInputOutputArray return "InputOutputArrayOfArrays: noArray()"; std::ostringstream ss; ss << "InputOutputArrayOfArrays:"; - try { + { do { ss << (argument.empty() ? " empty()=true" : " empty()=false"); ss << cv::format(" kind=0x%08llx", (long long int)argument.kind()); @@ -202,10 +190,6 @@ CV_EXPORTS_W String dumpInputOutputArray } } while (0); } - catch (...) - { - ss << " ERROR: exception occurred, dump is non-complete"; // need to properly support different kinds - } return ss.str(); } diff -Nuarp opencv-3.4.16/modules/core/src/command_line_parser.cpp opencv-3.4.16.nortti/modules/core/src/command_line_parser.cpp --- opencv-3.4.16/modules/core/src/command_line_parser.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/command_line_parser.cpp 2021-11-24 11:12:28.956452496 +0800 @@ -124,7 +124,6 @@ static void from_str(const String& str, void CommandLineParser::getByName(const String& name, bool space_delete, int type, void* dst) const { - try { for (size_t i = 0; i < impl->data.size(); i++) { @@ -149,12 +148,6 @@ void CommandLineParser::getByName(const } } } - catch (const 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())); } @@ -162,7 +155,6 @@ void CommandLineParser::getByName(const void CommandLineParser::getByIndex(int index, bool space_delete, int type, void* dst) const { - try { for (size_t i = 0; i < impl->data.size(); i++) { @@ -182,12 +174,6 @@ void CommandLineParser::getByIndex(int i } } } - catch (const 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)); } @@ -469,16 +455,7 @@ std::vector CommandLineParser::I { if (begin == true) { - throw cv::Exception(CV_StsParseError, - String("error in split_range_string(") - + str - + String(", ") - + String(1, fs) - + String(", ") - + String(1, ss) - + String(")"), - "", __FILE__, __LINE__ - ); + return vec; } begin = true; word = ""; @@ -489,16 +466,7 @@ std::vector CommandLineParser::I { if (begin == false) { - throw cv::Exception(CV_StsParseError, - String("error in split_range_string(") - + str - + String(", ") - + String(1, fs) - + String(", ") - + String(1, ss) - + String(")"), - "", __FILE__, __LINE__ - ); + return vec; } begin = false; vec.push_back(word); @@ -513,16 +481,7 @@ std::vector CommandLineParser::I if (begin == true) { - throw cv::Exception(CV_StsParseError, - String("error in split_range_string(") - + str - + String(", ") - + String(1, fs) - + String(", ") - + String(1, ss) - + String(")"), - "", __FILE__, __LINE__ - ); + return vec; } return vec; diff -Nuarp opencv-3.4.16/modules/core/src/glob.cpp opencv-3.4.16.nortti/modules/core/src/glob.cpp --- opencv-3.4.16/modules/core/src/glob.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/glob.cpp 2021-11-24 11:12:28.957452496 +0800 @@ -231,7 +231,6 @@ static void glob_rec(const cv::String& d if ((dir = opendir (directory.c_str())) != 0) { /* find all the files and directories within directory */ - try { struct dirent *ent; while ((ent = readdir (dir)) != 0) @@ -255,11 +254,6 @@ static void glob_rec(const cv::String& d result.push_back(entry); } } - catch (...) - { - closedir(dir); - throw; - } closedir(dir); } else diff -Nuarp opencv-3.4.16/modules/core/src/matrix.cpp opencv-3.4.16.nortti/modules/core/src/matrix.cpp --- opencv-3.4.16/modules/core/src/matrix.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/matrix.cpp 2021-11-24 11:12:28.957452496 +0800 @@ -640,18 +640,10 @@ void Mat::create(int d, const int* _size #endif if(!a) a = a0; - try { u = a->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT); CV_Assert(u != 0); } - catch (...) - { - if (a == a0) - throw; - u = a0->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT); - CV_Assert(u != 0); - } CV_Assert( step[dims-1] == (size_t)CV_ELEM_SIZE(flags) ); } @@ -701,7 +693,6 @@ Mat::Mat(const Mat& m, const Range& _row } *this = m; - try { if( _rowRange != Range::all() && _rowRange != Range(0,rows) ) { @@ -721,11 +712,6 @@ Mat::Mat(const Mat& m, const Range& _row flags |= SUBMATRIX_FLAG; } } - catch(...) - { - release(); - throw; - } updateContinuityFlag(); diff -Nuarp opencv-3.4.16/modules/core/src/parallel.cpp opencv-3.4.16.nortti/modules/core/src/parallel.cpp --- opencv-3.4.16/modules/core/src/parallel.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/parallel.cpp 2021-11-24 11:12:28.957452496 +0800 @@ -321,29 +321,9 @@ namespace { CV_TRACE_ARG_VALUE(range_end, "range.end", (int64)r.end); #endif - try { (*ctx.body)(r); } -#if CV__EXCEPTION_PTR - catch (...) - { - ctx.recordException(); - } -#else - catch (const cv::Exception& e) - { - ctx.recordException(e.what()); - } - catch (const std::exception& e) - { - ctx.recordException(e.what()); - } - catch (...) - { - ctx.recordException("Unknown exception"); - } -#endif if (!ctx.is_rng_used && !(cv::theRNG() == ctx.rng)) ctx.is_rng_used = true; @@ -476,16 +456,10 @@ void parallel_for_(const cv::Range& rang isNotNestedRegion = CV_XADD(&flagNestedParallelFor, 1) == 0; if (isNotNestedRegion) { - try { parallel_for_impl(range, body, nstripes); flagNestedParallelFor = 0; } - catch (...) - { - flagNestedParallelFor = 0; - throw; - } } else // nested parallel_for_() calls are not parallelized #endif // CV_PARALLEL_FRAMEWORK diff -Nuarp opencv-3.4.16/modules/core/src/persistence_c.cpp opencv-3.4.16.nortti/modules/core/src/persistence_c.cpp --- opencv-3.4.16/modules/core/src/persistence_c.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/persistence_c.cpp 2021-11-24 11:12:28.958452496 +0800 @@ -456,17 +456,10 @@ cvOpenFileStorage(const char* query, CvM CV_Assert(fs); memset( fs, 0, sizeof(*fs)); - try { cvOpenFileStorage_(fs, query, dststorage, flags, encoding); return fs; } - catch (...) - { - if (fs) - cvReleaseFileStorage(&fs); - throw; - } } /* closes file storage and deallocates buffers */ diff -Nuarp opencv-3.4.16/modules/core/src/persistence_types.cpp opencv-3.4.16.nortti/modules/core/src/persistence_types.cpp --- opencv-3.4.16/modules/core/src/persistence_types.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/persistence_types.cpp 2021-11-24 11:12:28.958452496 +0800 @@ -756,13 +756,9 @@ static void* icvReadSeq( CvFileStorage* flags |= CV_SEQ_FLAG_HOLE; if( !strstr(flags_str, "untyped") ) { - try { flags |= icvDecodeSimpleFormat(dt); } - catch (...) - { - } } } diff -Nuarp opencv-3.4.16/modules/core/src/system.cpp opencv-3.4.16.nortti/modules/core/src/system.cpp --- opencv-3.4.16/modules/core/src/system.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/system.cpp 2021-11-24 11:12:28.958452496 +0800 @@ -1152,8 +1152,6 @@ void error( const Exception& exc ) static volatile int* p = 0; *p = 0; } - - throw exc; } void error(int _code, const String& _err, const char* _func, const char* _file, int _line) @@ -2032,7 +2030,7 @@ inline bool parseOption(const std::strin { return false; } - throw ParseError(value); + return false; } template<> @@ -2057,7 +2055,7 @@ inline size_t parseOption(const std::str return v * 1024 * 1024; else if (suffixStr == "KB" || suffixStr == "Kb" || suffixStr == "kb") return v * 1024; - throw ParseError(value); + return v; } template<> @@ -2100,16 +2098,11 @@ static inline const char * envRead(const template inline T read(const std::string & k, const T & defaultValue) { - try { const char * res = envRead(k.c_str()); if (res) return parseOption(std::string(res)); } - catch (const ParseError &err) - { - CV_Error(cv::Error::StsBadArg, err.toString(k)); - } return defaultValue; } diff -Nuarp opencv-3.4.16/modules/core/src/umatrix.cpp opencv-3.4.16.nortti/modules/core/src/umatrix.cpp --- opencv-3.4.16/modules/core/src/umatrix.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/umatrix.cpp 2021-11-24 11:14:01.073451067 +0800 @@ -516,14 +516,9 @@ UMat Mat::getUMat(int accessFlags, UMatU new_u->originalUMatData = u; } bool allocated = false; - try { allocated = UMat::getStdAllocator()->allocate(new_u, accessFlags, usageFlags); } - catch (const cv::Exception& e) - { - fprintf(stderr, "Exception: %s\n", e.what()); - } if (!allocated) { allocated = getDefaultAllocator()->allocate(new_u, accessFlags, usageFlags); @@ -540,7 +535,6 @@ UMat Mat::getUMat(int accessFlags, UMatU CV_XADD(&(u->refcount), 1); CV_XADD(&(u->urefcount), 1); } - try { hdr.flags = flags; setSize(hdr, dims, size.p, step.p); @@ -550,16 +544,6 @@ UMat Mat::getUMat(int accessFlags, UMatU hdr.addref(); return hdr; } - catch(...) - { - if (u != NULL) - { - CV_XADD(&(u->refcount), -1); - CV_XADD(&(u->urefcount), -1); - } - new_u->currAllocator->deallocate(new_u); - throw; - } } void UMat::create(int d, const int* _sizes, int _type, UMatUsageFlags _usageFlags) @@ -604,17 +588,10 @@ void UMat::create(int d, const int* _siz a = a0; a0 = Mat::getDefaultAllocator(); } - try { u = a->allocate(dims, size, _type, 0, step.p, 0, usageFlags); CV_Assert(u != 0); } - catch(...) - { - if(a != a0) - u = a0->allocate(dims, size, _type, 0, step.p, 0, usageFlags); - CV_Assert(u != 0); - } CV_Assert( step[dims-1] == (size_t)CV_ELEM_SIZE(flags) ); } @@ -981,7 +958,6 @@ Mat UMat::getMat(int accessFlags) const // TODO Support ACCESS_READ (ACCESS_WRITE) without unnecessary data transfers accessFlags |= ACCESS_RW; UMatDataAutoLock autolock(u); - try { if(CV_XADD(&u->refcount, 1) == 0) u->currAllocator->map(u, accessFlags); @@ -996,11 +972,6 @@ Mat UMat::getMat(int accessFlags) const return hdr; } } - catch(...) - { - CV_XADD(&u->refcount, -1); - throw; - } CV_XADD(&u->refcount, -1); CV_Assert(u->data != 0 && "Error mapping of UMat to host memory."); return Mat(); diff -Nuarp opencv-3.4.16/modules/core/src/utils/filesystem.cpp opencv-3.4.16.nortti/modules/core/src/utils/filesystem.cpp --- opencv-3.4.16/modules/core/src/utils/filesystem.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/core/src/utils/filesystem.cpp 2021-11-24 11:12:28.958452496 +0800 @@ -492,14 +492,9 @@ cv::String getCacheDirectory(const char* && !utils::fs::isDirectory(default_cache_path)) { std::vector existedCacheDirs; - try { utils::fs::glob_relative(default_cache_path_base, "*", existedCacheDirs, false, true); } - catch (...) - { - // ignore - } if (!existedCacheDirs.empty()) { CV_LOG_WARNING(NULL, "Creating new OpenCV cache directory: " << default_cache_path); diff -Nuarp opencv-3.4.16/modules/imgproc/src/contours.cpp opencv-3.4.16.nortti/modules/imgproc/src/contours.cpp --- opencv-3.4.16/modules/imgproc/src/contours.cpp 2021-10-08 11:31:56.000000000 +0800 +++ opencv-3.4.16.nortti/modules/imgproc/src/contours.cpp 2021-11-24 11:12:28.959452496 +0800 @@ -1761,7 +1761,6 @@ cvFindContours_Impl( void* img, CvMemS } else { - try { scanner = cvStartFindContours_Impl( img, storage, cntHeaderSize, mode, method, offset, needFillBorder); @@ -1773,12 +1772,6 @@ cvFindContours_Impl( void* img, CvMemS } while( contour != 0 ); } - catch(...) - { - if( scanner ) - cvEndFindContours(&scanner); - throw; - } *firstContour = cvEndFindContours( &scanner ); }