mirror of
https://github.com/opencv/opencv.git
synced 2025-07-25 22:57:53 +08:00
Merge pull request #11357 from alalek:disable_errors_dump
This commit is contained in:
commit
a312380367
@ -61,6 +61,14 @@ Mutex& getInitializationMutex()
|
|||||||
// force initialization (single-threaded environment)
|
// force initialization (single-threaded environment)
|
||||||
Mutex* __initialization_mutex_initializer = &getInitializationMutex();
|
Mutex* __initialization_mutex_initializer = &getInitializationMutex();
|
||||||
|
|
||||||
|
static bool param_dumpErrors = utils::getConfigurationParameterBool("OPENCV_DUMP_ERRORS",
|
||||||
|
#if defined(_DEBUG) || defined(__ANDROID__) || (defined(__GNUC__) && !defined(__EXCEPTIONS))
|
||||||
|
true
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
} // namespace cv
|
} // namespace cv
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -922,7 +930,7 @@ void error( const Exception& exc )
|
|||||||
if (customErrorCallback != 0)
|
if (customErrorCallback != 0)
|
||||||
customErrorCallback(exc.code, exc.func.c_str(), exc.err.c_str(),
|
customErrorCallback(exc.code, exc.func.c_str(), exc.err.c_str(),
|
||||||
exc.file.c_str(), exc.line, customErrorCallbackData);
|
exc.file.c_str(), exc.line, customErrorCallbackData);
|
||||||
else
|
else if (param_dumpErrors)
|
||||||
{
|
{
|
||||||
const char* errorStr = cvErrorStr(exc.code);
|
const char* errorStr = cvErrorStr(exc.code);
|
||||||
char buf[1 << 12];
|
char buf[1 << 12];
|
||||||
@ -932,11 +940,13 @@ void error( const Exception& exc )
|
|||||||
CV_VERSION,
|
CV_VERSION,
|
||||||
errorStr, exc.err.c_str(), exc.func.size() > 0 ?
|
errorStr, exc.err.c_str(), exc.func.size() > 0 ?
|
||||||
exc.func.c_str() : "unknown function", exc.file.c_str(), exc.line);
|
exc.func.c_str() : "unknown function", exc.file.c_str(), exc.line);
|
||||||
fprintf( stderr, "%s\n", buf );
|
#ifdef __ANDROID__
|
||||||
fflush( stderr );
|
|
||||||
# ifdef __ANDROID__
|
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "cv::error()", "%s", buf);
|
__android_log_print(ANDROID_LOG_ERROR, "cv::error()", "%s", buf);
|
||||||
# endif
|
#else
|
||||||
|
fflush(stdout); fflush(stderr);
|
||||||
|
fprintf(stderr, "%s\n", buf);
|
||||||
|
fflush(stderr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(breakOnError)
|
if(breakOnError)
|
||||||
|
Loading…
Reference in New Issue
Block a user