From 00ca49275c5a12d1d192716e8a9725015d26df00 Mon Sep 17 00:00:00 2001 From: Fred Ross-Perry Date: Fri, 27 Oct 2017 09:31:56 -0700 Subject: jni: Fix bugs in StructuredText_getBlocks(). When iterating through blocks, make sure to include text blocks. After building the char array for a given line, be sure to add it to the line object. --- platform/java/mupdf_native.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index b4a09a0e..4dc75889 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -5897,7 +5897,7 @@ FUN(StructuredText_getBlocks)(JNIEnv *env, jobject self) for (b=0, block = page->first_block; block; ++b, block = block->next) { // only do text blocks - if (block->type == FZ_STEXT_BLOCK_TEXT) + if (block->type != FZ_STEXT_BLOCK_TEXT) continue; // make a block @@ -5964,6 +5964,9 @@ FUN(StructuredText_getBlocks)(JNIEnv *env, jobject self) (*env)->DeleteLocalRef(env, jchar); } + // set the line's char array + (*env)->SetObjectField(env, jline, fid_TextLine_chars, carr); + // add to the line array (*env)->SetObjectArrayElement(env, larr, l, jline); if ((*env)->ExceptionCheck(env)) return NULL; -- cgit v1.2.3