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

Revert CV_TRY/CV_CATCH macros

This reverts commit 7349b8f5ce (partially).
This commit is contained in:
Alexander Alekhin
2018-11-08 19:46:25 +03:00
parent e5d7f446d6
commit b74b05d1b3
18 changed files with 119 additions and 118 deletions
+14 -10
View File
@@ -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<String> CommandLineParser::Impl::split_range_string(const String& _s
std::vector<String> 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<String> CommandLineParser::Impl::split_range_string(const String& _s
+ String(1, ss)
+ String(")"),
"", __FILE__, __LINE__
));
);
}
begin = true;
word = "";
@@ -486,7 +489,7 @@ std::vector<String> 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<String> 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<String> 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<String> CommandLineParser::Impl::split_range_string(const String& _s
+ String(1, ss)
+ String(")"),
"", __FILE__, __LINE__
));
);
}
return vec;
}
+3 -3
View File
@@ -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);
}
+3 -3
View File
@@ -866,7 +866,7 @@ private:
d = alloc_1d<double> (n);
e = alloc_1d<double> (n);
ort = alloc_1d<double> (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;
}
}
+3 -3
View File
@@ -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();
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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)
+4 -4
View File
@@ -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);