From c7873dd03d45dee87fbab9d044233e5ab3fe9341 Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Wed, 5 Jun 2013 11:46:06 +0400 Subject: [PATCH] fixing broken Mat::dump() in Java --- modules/java/generator/src/cpp/Mat.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/modules/java/generator/src/cpp/Mat.cpp b/modules/java/generator/src/cpp/Mat.cpp index 4dd7ef085..a07f0671b 100644 --- a/modules/java/generator/src/cpp/Mat.cpp +++ b/modules/java/generator/src/cpp/Mat.cpp @@ -2545,32 +2545,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL try { LOGD("Mat::nDump()"); - - const int BUFSZ = 4096 - 32; - char buf[BUFSZ + 32]; String s; - Ptr fmtd = Formatter::get()->format(*me); - char* pos = buf; - for(const char* str = fmtd->next(); str; str = fmtd->next()) { - pos = strcpy(pos, str); - if(pos > buf + BUFSZ) - { - s = s + String(buf, pos - buf); - pos = buf; - } + s = s + String(str); } - - if (pos > buf) - { - if (s.empty()) - return env->NewStringUTF(buf); - - s = s + String(buf, pos - buf); - } - return env->NewStringUTF(s.c_str()); } catch(cv::Exception e) { LOGE("Mat::nDump() catched cv::Exception: %s", e.what());