diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-06-19 13:15:31 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2018-06-22 16:48:50 +0100 |
commit | f7ace61076d0ab3c71e1d2bd70967ddb0b86f220 (patch) | |
tree | 8bd8b4fe4d7414685d162f66911e9951ea3dce16 /platform/gl | |
parent | 148b0934370336fc8b260e8c3aef83daf4d80ba4 (diff) | |
download | mupdf-f7ace61076d0ab3c71e1d2bd70967ddb0b86f220.tar.xz |
Keep copy of decoded utf8 text string in pdf_obj.
Removes the need to alloc/free text strings in the API, allowing
for simple functions like pdf_dict_get_text_string.
Diffstat (limited to 'platform/gl')
-rw-r--r-- | platform/gl/gl-annotate.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/platform/gl/gl-annotate.c b/platform/gl/gl-annotate.c index 304f0f10..9d88dabc 100644 --- a/platform/gl/gl-annotate.c +++ b/platform/gl/gl-annotate.c @@ -314,10 +314,9 @@ static void do_annotate_author(void) { if (pdf_annot_has_author(ctx, selected_annot)) { - char *author = pdf_copy_annot_author(ctx, selected_annot); - if (author && strlen(author) > 0) + const char *author = pdf_get_annot_author(ctx, selected_annot); + if (strlen(author) > 0) ui_label("Author: %s", author); - fz_free(ctx, author); } } @@ -344,14 +343,13 @@ static void do_annotate_contents(void) { static pdf_annot *last_annot = NULL; static struct input input; - char *contents; + const char *contents; if (selected_annot != last_annot) { last_annot = selected_annot; - contents = pdf_copy_annot_contents(ctx, selected_annot); + contents = pdf_get_annot_contents(ctx, selected_annot); ui_input_init(&input, contents); - fz_free(ctx, contents); } ui_label("Contents:"); @@ -387,7 +385,7 @@ static void do_widget_value() } else if (type == PDF_WIDGET_TYPE_COMBOBOX || type == PDF_WIDGET_TYPE_LISTBOX) { - char **options; + const char **options; int n, choice; ui_label("Value:"); n = pdf_choice_widget_options(ctx, selected_annot->page->doc, selected_annot, 0, NULL); |