From e92feeebb129361c9489f700e0580d70ef582cff Mon Sep 17 00:00:00 2001 From: Martin Cracauer Date: Sat, 4 Dec 1999 17:12:47 +0000 Subject: [PATCH] Fix "subscript has type `char'" warnings by casting to int, as discussed on -arch. --- bin/sh/expand.c | 9 +++++---- bin/sh/parser.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/sh/expand.c b/bin/sh/expand.c index c6102aaeaa3..5a1b57d8739 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -315,7 +315,7 @@ done: goto lose; *p = c; while ((c = *home++) != '\0') { - if (quotes && SQSYNTAX[c] == CCTL) + if (quotes && SQSYNTAX[(int)c] == CCTL) STPUTC(CTLESC, expdest); STPUTC(c, expdest); } @@ -478,7 +478,7 @@ expbackq(cmd, quoted, flag) } lastc = *p++; if (lastc != '\0') { - if (quotes && syntax[lastc] == CCTL) + if (quotes && syntax[(int)lastc] == CCTL) STPUTC(CTLESC, dest); STPUTC(lastc, dest); } @@ -694,7 +694,8 @@ again: /* jump here after setting a variable with ${var=text} */ } else { while (*val) { - if (quotes && syntax[*val] == CCTL) + if (quotes && + syntax[(int)*val] == CCTL) STPUTC(CTLESC, expdest); STPUTC(*val++, expdest); } @@ -865,7 +866,7 @@ varvalue(name, quoted, allow_split) if (allow_split) { \ syntax = quoted? DQSYNTAX : BASESYNTAX; \ while (*p) { \ - if (syntax[*p] == CCTL) \ + if (syntax[(int)*p] == CCTL) \ STPUTC(CTLESC, expdest); \ STPUTC(*p++, expdest); \ } \ diff --git a/bin/sh/parser.c b/bin/sh/parser.c index c73dbc289a6..505cf169793 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1457,7 +1457,7 @@ noexpand(text) continue; if (c == CTLESC) p++; - else if (BASESYNTAX[c] == CCTL) + else if (BASESYNTAX[(int)c] == CCTL) return 0; } return 1;