diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-02-14 12:32:38 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-02-27 12:58:56 +0100 |
commit | c2ff52c4821922f9288cc2010e937b2a3a5488f1 (patch) | |
tree | 37c7f22aedfd9332a88edf0cd423edd47cbfd83e /source/pdf/pdf-form.c | |
parent | e4900061bdc4a400bf53dae50d39f4314e3cfe84 (diff) | |
download | mupdf-c2ff52c4821922f9288cc2010e937b2a3a5488f1.tar.xz |
Use proper encoding for pdf_field_value and update_field_value.
Diffstat (limited to 'source/pdf/pdf-form.c')
-rw-r--r-- | source/pdf/pdf-form.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c index 88737ce4..d11fb471 100644 --- a/source/pdf/pdf-form.c +++ b/source/pdf/pdf-form.c @@ -54,7 +54,6 @@ static void pdf_field_mark_dirty(fz_context *ctx, pdf_document *doc, pdf_obj *fi static void update_field_value(fz_context *ctx, pdf_document *doc, pdf_obj *obj, const char *text) { - pdf_obj *sobj; pdf_obj *grp; if (!text) @@ -66,8 +65,7 @@ static void update_field_value(fz_context *ctx, pdf_document *doc, pdf_obj *obj, if (grp) obj = grp; - sobj = pdf_new_string(ctx, doc, text, strlen(text)); - pdf_dict_put_drop(ctx, obj, PDF_NAME_V, sobj); + pdf_dict_put_text_string(ctx, obj, PDF_NAME_V, text); pdf_field_mark_dirty(ctx, doc, obj); } @@ -531,7 +529,7 @@ static void toggle_check_box(fz_context *ctx, pdf_document *doc, pdf_obj *obj) if (val && grp) { - pdf_obj *v = pdf_new_string(ctx, doc, val, strlen(val)); + pdf_obj *v = pdf_new_text_string(ctx, doc, val); pdf_dict_put_drop(ctx, grp, PDF_NAME_V, v); recalculate(ctx, doc); } @@ -870,7 +868,7 @@ void pdf_field_set_button_caption(fz_context *ctx, pdf_document *doc, pdf_obj *f { if (pdf_field_type(ctx, doc, field) == PDF_WIDGET_TYPE_PUSHBUTTON) { - pdf_obj *val = pdf_new_string(ctx, doc, text, strlen(text)); + pdf_obj *val = pdf_new_text_string(ctx, doc, text); pdf_dict_putl_drop(ctx, field, val, PDF_NAME_MK, PDF_NAME_CA, NULL); pdf_field_mark_dirty(ctx, doc, field); } |