Commit a7606846 authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #950 from apavlenko:fix_java_mat_dump

parents 6e119049 c7873dd0
......@@ -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<Formatted> 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());
......
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