Commit 2f9cbc2e authored by Alexander Alekhin's avatar Alexander Alekhin

core: disable errors dump

Error messages are available via exceptions
parent 7ea5029a
...@@ -61,6 +61,14 @@ Mutex& getInitializationMutex() ...@@ -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 ) ...@@ -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 ) ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment