forked from nihui/opencv-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opencv-3.4.16-no-rtti.patch
547 lines (519 loc) · 18.2 KB
/
opencv-3.4.16-no-rtti.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
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<String> 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<String> 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<String> 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<typename T>
inline T read(const std::string & k, const T & defaultValue)
{
- try
{
const char * res = envRead(k.c_str());
if (res)
return parseOption<T>(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<cv::String> 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 );
}