diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-02-14 12:32:53 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-02-27 12:58:56 +0100 |
commit | b04a5e3de89c54df0d971a3d5ca8727de994d08c (patch) | |
tree | b28b75663097b3fd6bb43e6a8e0e9415f726f21a /source/pdf/pdf-form.c | |
parent | c2ff52c4821922f9288cc2010e937b2a3a5488f1 (diff) | |
download | mupdf-b04a5e3de89c54df0d971a3d5ca8727de994d08c.tar.xz |
Use text encoding for pdf_choice_widget options and values.
Adds a requirement on the caller to free the returned strings.
Diffstat (limited to 'source/pdf/pdf-form.c')
-rw-r--r-- | source/pdf/pdf-form.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c index d11fb471..bec1799a 100644 --- a/source/pdf/pdf-form.c +++ b/source/pdf/pdf-form.c @@ -1166,11 +1166,11 @@ int pdf_choice_widget_options(fz_context *ctx, pdf_document *doc, pdf_widget *tw /* If it is a two element array, the second item is the one that we want if we want the listing value. */ if (m == 2) if (exportval) - opts[i] = pdf_to_str_buf(ctx, pdf_array_get(ctx, pdf_array_get(ctx, optarr, i), 0)); + opts[i] = pdf_to_utf8(ctx, pdf_array_get(ctx, pdf_array_get(ctx, optarr, i), 0)); else - opts[i] = pdf_to_str_buf(ctx, pdf_array_get(ctx, pdf_array_get(ctx, optarr, i), 1)); + opts[i] = pdf_to_utf8(ctx, pdf_array_get(ctx, pdf_array_get(ctx, optarr, i), 1)); else - opts[i] = pdf_to_str_buf(ctx, pdf_array_get(ctx, optarr, i)); + opts[i] = pdf_to_utf8(ctx, pdf_array_get(ctx, optarr, i)); } } return n; @@ -1206,7 +1206,7 @@ int pdf_choice_widget_value(fz_context *ctx, pdf_document *doc, pdf_widget *tw, if (pdf_is_string(ctx, optarr)) { if (opts) - opts[0] = pdf_to_str_buf(ctx, optarr); + opts[0] = pdf_to_utf8(ctx, optarr); return 1; } @@ -1223,7 +1223,7 @@ int pdf_choice_widget_value(fz_context *ctx, pdf_document *doc, pdf_widget *tw, if (pdf_is_array(ctx, elem)) elem = pdf_array_get(ctx, elem, 1); - opts[i] = pdf_to_str_buf(ctx, elem); + opts[i] = pdf_to_utf8(ctx, elem); } } @@ -1249,7 +1249,7 @@ void pdf_choice_widget_set_value(fz_context *ctx, pdf_document *doc, pdf_widget for (i = 0; i < n; i++) { - opt = pdf_new_string(ctx, doc, opts[i], strlen(opts[i])); + opt = pdf_new_text_string(ctx, doc, opts[i]); pdf_array_push_drop(ctx, optarr, opt); } @@ -1257,7 +1257,7 @@ void pdf_choice_widget_set_value(fz_context *ctx, pdf_document *doc, pdf_widget } else { - opt = pdf_new_string(ctx, doc, opts[0], strlen(opts[0])); + opt = pdf_new_text_string(ctx, doc, opts[0]); pdf_dict_put_drop(ctx, annot->obj, PDF_NAME_V, opt); } |