From 3b23a92b3c3674c671dff49c03de47e80ecf04b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sat, 10 Oct 2026 20:05:25 -0400 Subject: [PATCH] PDF shim: fz_var for locals set inside fz_try (gcc -Wclobbered on Linux) Co-Authored-By: Claude Opus 5.5 --- crates/ely-pdf-engine/shim/ely_alt.c | 1 + crates/ely-pdf-engine/shim/ely_clean.c | 3 +++ crates/ely-pdf-engine/shim/ely_form.c | 1 + crates/ely-pdf-engine/shim/ely_insert.c | 1 + crates/ely-pdf-engine/shim/ely_mupdf.c | 2 ++ crates/ely-pdf-engine/shim/ely_output.c | 1 + crates/ely-pdf-engine/shim/ely_redact.c | 5 +++++ crates/ely-pdf-engine/shim/ely_secure.c | 1 + crates/ely-pdf-engine/shim/ely_sign.c | 3 +++ crates/ely-pdf-engine/shim/ely_text.c | 2 ++ 10 files changed, 20 insertions(+) diff --git a/crates/ely-pdf-engine/shim/ely_alt.c b/crates/ely-pdf-engine/shim/ely_alt.c index 4ce0954..80ddc67 100644 --- a/crates/ely-pdf-engine/shim/ely_alt.c +++ b/crates/ely-pdf-engine/shim/ely_alt.c @@ -41,6 +41,7 @@ static int quiet_elem(fz_context *ctx, pdf_obj *elem, int page, int inherited) int pg, i, on = 0; if (!pdf_is_dict(ctx, elem) || pdf_mark_obj(ctx, elem)) return 0; + fz_var(on); fz_try(ctx) { pg = pdf_dict_gets(ctx, elem, "Pg") ? pdf_to_num(ctx, pdf_dict_gets(ctx, elem, "Pg")) : inherited; diff --git a/crates/ely-pdf-engine/shim/ely_clean.c b/crates/ely-pdf-engine/shim/ely_clean.c index ea47cdb..fe0c279 100644 --- a/crates/ely-pdf-engine/shim/ely_clean.c +++ b/crates/ely-pdf-engine/shim/ely_clean.c @@ -86,6 +86,7 @@ static pdf_obj *spliced(fz_context *ctx, pdf_document *pdf, pdf_obj *action, int if (pdf_mark_obj(ctx, action)) return NULL; (*n)++; + fz_var(out); fz_try(ctx) out = spliced(ctx, pdf, pdf_dict_get(ctx, action, PDF_NAME(Next)), n); fz_always(ctx) @@ -212,6 +213,8 @@ restart: if (unseen(ctx, pdf_annot_obj(ctx, widget))) { pdf_obj *field = pdf_keep_obj(ctx, pdf_annot_obj(ctx, widget)); + fz_var(widget); + fz_var(n); fz_try(ctx) { pdf_delete_annot(ctx, page, widget); diff --git a/crates/ely-pdf-engine/shim/ely_form.c b/crates/ely-pdf-engine/shim/ely_form.c index 8bdd09c..6adeafb 100644 --- a/crates/ely-pdf-engine/shim/ely_form.c +++ b/crates/ely-pdf-engine/shim/ely_form.c @@ -189,6 +189,7 @@ static pdf_obj *check_name(fz_context *ctx, pdf_obj *fields, const char *prefix, if (!name[0] || strchr(name, '.')) fz_throw(ctx, FZ_ERROR_ARGUMENT, "a bad field name"); fz_var(full); + fz_var(found); fz_try(ctx) { full = fz_asprintf(ctx, "%s%s", prefix, name); diff --git a/crates/ely-pdf-engine/shim/ely_insert.c b/crates/ely-pdf-engine/shim/ely_insert.c index e1bd6af..0f9b221 100644 --- a/crates/ely-pdf-engine/shim/ely_insert.c +++ b/crates/ely-pdf-engine/shim/ely_insert.c @@ -327,6 +327,7 @@ int ely_insert_file(fz_context *ctx, fz_document *doc, int at, const char *path, fz_var(links); fz_var(n); fz_var(begun); + fz_var(room); fz_try(ctx) { pdf = ely_pdf_of(ctx, doc); diff --git a/crates/ely-pdf-engine/shim/ely_mupdf.c b/crates/ely-pdf-engine/shim/ely_mupdf.c index cccbfa9..b84cc1c 100644 --- a/crates/ely-pdf-engine/shim/ely_mupdf.c +++ b/crates/ely-pdf-engine/shim/ely_mupdf.c @@ -155,6 +155,7 @@ void ely_close(fz_context *ctx, fz_document *doc) int ely_needs_password(fz_context *ctx, fz_document *doc) { int locked = 0; + fz_var(locked); fz_try(ctx) locked = fz_needs_password(ctx, doc); fz_catch(ctx) @@ -166,6 +167,7 @@ int ely_needs_password(fz_context *ctx, fz_document *doc) int ely_authenticate(fz_context *ctx, fz_document *doc, const char *password) { int access = 0; + fz_var(access); fz_try(ctx) access = fz_authenticate_password(ctx, doc, password); fz_catch(ctx) diff --git a/crates/ely-pdf-engine/shim/ely_output.c b/crates/ely-pdf-engine/shim/ely_output.c index aa51fdb..1c216e7 100644 --- a/crates/ely-pdf-engine/shim/ely_output.c +++ b/crates/ely-pdf-engine/shim/ely_output.c @@ -121,6 +121,7 @@ int ely_optimize(fz_context *ctx, fz_document *doc, const char *raw, const char int ely_repaired(fz_context *ctx, fz_document *doc) { int repaired = 0; + fz_var(repaired); fz_try(ctx) repaired = pdf_was_repaired(ctx, ely_pdf_of(ctx, doc)); fz_catch(ctx) diff --git a/crates/ely-pdf-engine/shim/ely_redact.c b/crates/ely-pdf-engine/shim/ely_redact.c index e04bcd7..a7e1842 100644 --- a/crates/ely-pdf-engine/shim/ely_redact.c +++ b/crates/ely-pdf-engine/shim/ely_redact.c @@ -59,6 +59,8 @@ restart: if (touches(pdf_bound_annot(ctx, annot), area)) { pdf_obj *field = pdf_keep_obj(ctx, pdf_annot_obj(ctx, annot)); + fz_var(annot); + fz_var(widgets); fz_try(ctx) { pdf_delete_annot(ctx, page, annot); @@ -129,6 +131,7 @@ static int chars_in(fz_context *ctx, fz_document *doc, int number, fz_rect area) fz_stext_page *text = NULL; int n = 0; fz_var(text); + fz_var(n); fz_try(ctx) { fz_stext_block *block; @@ -154,6 +157,7 @@ static int light_in(fz_context *ctx, fz_document *doc, int number, fz_rect area) fz_pixmap *pix = NULL; int n = 0; fz_var(pix); + fz_var(n); fz_try(ctx) { fz_page *page = fz_load_page(ctx, doc, number); @@ -283,6 +287,7 @@ static int image_light(fz_context *ctx, fz_image *image, fz_matrix ctm, fz_rect return 0; fz_var(pix); fz_var(draw); + fz_var(box); fz_try(ctx) { unsigned char *s; diff --git a/crates/ely-pdf-engine/shim/ely_secure.c b/crates/ely-pdf-engine/shim/ely_secure.c index bd134f2..2c4687b 100644 --- a/crates/ely-pdf-engine/shim/ely_secure.c +++ b/crates/ely-pdf-engine/shim/ely_secure.c @@ -10,6 +10,7 @@ enum { MAY_PRINT = 1, MAY_COPY = 2, MAY_EDIT = 4, MAY_ANNOTATE = 8, MAY_FILL = 1 int ely_permissions(fz_context *ctx, fz_document *doc) { int may = 0; + fz_var(may); fz_try(ctx) { pdf_document *pdf = ely_pdf_of(ctx, doc); diff --git a/crates/ely-pdf-engine/shim/ely_sign.c b/crates/ely-pdf-engine/shim/ely_sign.c index 44b4961..b9f64cd 100644 --- a/crates/ely-pdf-engine/shim/ely_sign.c +++ b/crates/ely-pdf-engine/shim/ely_sign.c @@ -189,6 +189,8 @@ static void put_field(fz_context *ctx, fz_output *out, pdf_document *pdf, pdf_ob fz_rect r; int number = placed(ctx, pdf, field, &r), signd = pdf_signature_is_signed(ctx, pdf, field); char *name = pdf_load_field_name(ctx, field); + fz_var(number); + fz_var(r); fz_try(ctx) { fz_write_printf(ctx, out, "%s{\"page\":%d,\"object\":%d,\"rect\":[%g,%g,%g,%g],\"signed\":%s,\"name\":", @@ -401,6 +403,7 @@ void ely_unsign(fz_context *ctx, pdf_document *pdf) int ely_signed(fz_context *ctx, fz_document *doc) { int n = 0; + fz_var(n); fz_try(ctx) n = signed_fields(ctx, ely_pdf_of(ctx, doc), 0); fz_catch(ctx) diff --git a/crates/ely-pdf-engine/shim/ely_text.c b/crates/ely-pdf-engine/shim/ely_text.c index 6356b09..fac08d3 100644 --- a/crates/ely-pdf-engine/shim/ely_text.c +++ b/crates/ely-pdf-engine/shim/ely_text.c @@ -169,6 +169,7 @@ static int reachable(fz_context *ctx, pdf_document *pdf, pdf_page *page, fz_stex fz_var(t.at); fz_var(t.c); pdf_begin_operation(ctx, pdf, "Look at text"); + fz_var(ok); fz_try(ctx) { block_targets(ctx, block, ely_to_user(ctx, page), &t); @@ -203,6 +204,7 @@ static void reachable_all(fz_context *ctx, pdf_document *pdf, pdf_page *page, fz fz_var(t.seen); fz_var(count); pdf_begin_operation(ctx, pdf, "Look at text"); + fz_var(all); fz_try(ctx) { for (block = text->first_block; block; block = block->next)