From af3a0db0831d94c159039c937b587a20c383bde5 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 29 Mar 2024 07:02:04 -0400 Subject: [PATCH] onefile fix --- include/decl.h | 3 +++ src/coloratt.c | 3 +-- src/decl.c | 3 +++ src/options.c | 5 +++-- src/report.c | 6 +++--- src/utf8map.c | 3 +-- src/windows.c | 3 ++- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/decl.h b/include/decl.h index c1bc4cd3f..1b60d3ee2 100644 --- a/include/decl.h +++ b/include/decl.h @@ -64,6 +64,9 @@ extern const char *fqn_prefix_names[PREFIX_COUNT]; extern NEARDATA boolean has_strong_rngseed; extern struct engr *head_engr; +/* used by coloratt.c, options.c, utf8map.c, windows.c */ +extern const char hex[33]; + /* material strings */ extern const char *materialnm[]; diff --git a/src/coloratt.c b/src/coloratt.c index 6be07d790..be76df6e0 100644 --- a/src/coloratt.c +++ b/src/coloratt.c @@ -219,8 +219,6 @@ static struct nethack_color colortable[] = { { rgb_color, 154, 138, "white", "#FFFFFF", 255, 255, 255 }, }; -static const char hex[] = "00112233445566778899aAbBcCdDeEfF"; - int32 colortable_to_int32(struct nethack_color *cte) { @@ -784,6 +782,7 @@ wc_color_name(int32 colorindx) return result; } +/* hex[] is defined in decl.c */ boolean onlyhexdigits(const char *buf) { diff --git a/src/decl.c b/src/decl.c index 7d74dbc50..bd76ad31e 100644 --- a/src/decl.c +++ b/src/decl.c @@ -93,6 +93,9 @@ const char *fqn_prefix_names[PREFIX_COUNT] = { }; #endif +/* used by coloratt.c, options.c, utf8map.c, windows.c */ +const char hex[33] = "00112233445566778899aAbBcCdDeEfF"; + /* x/y/z deltas for the 10 movement directions (8 compass pts, 2 down/up) */ const schar xdir[N_DIRS_Z] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 }; const schar ydir[N_DIRS_Z] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 }; diff --git a/src/options.c b/src/options.c index e45f45c2d..19611e996 100644 --- a/src/options.c +++ b/src/options.c @@ -6661,8 +6661,9 @@ staticfn void escapes(const char *cp, /* might be 'tp', updating in place */ char *tp) /* result is never longer than 'cp' */ { - static NEARDATA const char oct[] = "01234567", dec[] = "0123456789", - hex[] = "00112233445566778899aAbBcCdDeEfF"; + static NEARDATA const char oct[] = "01234567", dec[] = "0123456789"; + /* hex[] is defined in decl.c */ + const char *dp; int cval, meta, dcount; diff --git a/src/report.c b/src/report.c index 4b6992216..65c3fcd94 100644 --- a/src/report.c +++ b/src/report.c @@ -146,7 +146,7 @@ crashreport_init(int argc UNUSED, char *argv[] UNUSED) goto skip; close(fd); - static const char hex[] = "0123456789abcdef"; + static const char hexdigits[] = "0123456789abcdef"; char *p = bid; unsigned char *in; HASH_RESULT(ctxp, &in); @@ -158,8 +158,8 @@ crashreport_init(int argc UNUSED, char *argv[] UNUSED) cnt = (uint8) sizeof bid / 2 - 1; while (cnt) { /* sprintf(p, "%02x", *in++), p += 2; */ - *p++ = hex[(*in >> 4) & 0x0f]; - *p++ = hex[*in++ & 0x0f]; + *p++ = hexdigits[(*in >> 4) & 0x0f]; + *p++ = hexdigits[*in++ & 0x0f]; --cnt; } *p = '\0'; diff --git a/src/utf8map.c b/src/utf8map.c index 310b7f549..d90455f4f 100644 --- a/src/utf8map.c +++ b/src/utf8map.c @@ -13,8 +13,7 @@ extern struct enum_dump objdump[]; extern glyph_map glyphmap[MAX_GLYPH]; extern const char *const known_handling[]; /* symbols.c */ -static const char hex[] = "00112233445566778899aAbBcCdDeEfF"; - +/* hex[] is defined in decl.c */ int unicode_val(const char *cp) diff --git a/src/windows.c b/src/windows.c index 0c37ec988..87205acfc 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1432,10 +1432,11 @@ encglyph(int glyph) return encbuf; } +/* hex[] is defined in decl.c */ + int decode_glyph(const char *str, int *glyph_ptr) { - static const char hex[] = "00112233445566778899aAbBcCdDeEfF"; int rndchk = 0, dcount = 0, retval = 0; const char *dp;