From: Alexander Alekhin Date: Fri, 20 Apr 2018 09:29:12 +0000 (+0300) Subject: core: disable errors dump X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1^2~633^2~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f9cbc2e572e243fc8f43bf956ba278508ea8a3e;p=platform%2Fupstream%2Fopencv.git core: disable errors dump Error messages are available via exceptions --- diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 6d0f4a8..eddb11f 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -61,6 +61,14 @@ Mutex& getInitializationMutex() // force initialization (single-threaded environment) 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 #ifdef _MSC_VER @@ -922,7 +930,7 @@ void error( const Exception& exc ) if (customErrorCallback != 0) customErrorCallback(exc.code, exc.func.c_str(), exc.err.c_str(), exc.file.c_str(), exc.line, customErrorCallbackData); - else + else if (param_dumpErrors) { const char* errorStr = cvErrorStr(exc.code); char buf[1 << 12]; @@ -932,11 +940,13 @@ void error( const Exception& exc ) CV_VERSION, errorStr, exc.err.c_str(), exc.func.size() > 0 ? exc.func.c_str() : "unknown function", exc.file.c_str(), exc.line); - fprintf( stderr, "%s\n", buf ); - fflush( stderr ); -# ifdef __ANDROID__ +#ifdef __ANDROID__ __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)