wdvi

network DVI viewer
Log | Files | Refs

commit 6601804250c2d0d65e8cf9803fa0bbce48887a1d
parent 1e23d619dff47a421032ff1d08356b9ae3a5486f
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Sat, 11 Mar 2023 23:44:53 +0000

move preamble comment storage to local scope

Use variables similar to what is described in the dvitype manual.

Diffstat:
Mdvi-init.c | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dvi-init.c b/dvi-init.c @@ -57,7 +57,6 @@ static Boolean dvi_is_valid = False; /* if not initializing */ /* * DVI preamble and postamble information. */ -static char job_id[300]; static long numerator, denominator; static unsigned int dvi_unshrunk_page_w, dvi_unshrunk_page_h; @@ -478,7 +477,8 @@ dvi_magic_ok(FILE *dvi) static Boolean process_preamble(void) { - unsigned char k; + char comment[256 + 1]; + size_t k; if (dvi_magic_ok(dvi_file) == False) return False; @@ -490,8 +490,11 @@ process_preamble(void) dimconv = dimconv * (((long) pixels_per_inch)<<16) / 254000; tpic_conv = pixels_per_inch * magnification / 1000000.0; k = one(dvi_file); - fread(job_id, sizeof(char), (int) k, dvi_file); - job_id[k] = '\0'; + fread(comment, sizeof(char), k, dvi_file); + comment[k] = '\0'; + + if (debug & DBG_DVI) + printf("Preamble comment '%s'\n", comment); return True; }