summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Ross-Perry <fred.ross-perry@artifex.com>2017-10-27 09:31:56 -0700
committerTor Andersson <tor.andersson@artifex.com>2017-11-22 23:09:51 +0100
commit00ca49275c5a12d1d192716e8a9725015d26df00 (patch)
treeffa885a916024fe85927697028ec2b1042080611
parentc148ecf6d26b8c79965737632be8e33ae3bdaa6d (diff)
downloadmupdf-00ca49275c5a12d1d192716e8a9725015d26df00.tar.xz
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.
-rw-r--r--platform/java/mupdf_native.c5
1 files changed, 4 insertions, 1 deletions
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;