From 0732d4505654fb51daf6302439b467dffcbe7d3d Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 15 Jul 2009 02:41:03 -0400 Subject: [PATCH] To reference one element of a C-string use [] Reported by Marcus Watts Pointer arithmetic is inappropriate when attempting to output one of the elements of an array or C-string. LICENSE IPL10 Reviewed-on: http://gerrit.openafs.org/90 Verified-by: Russ Allbery Reviewed-by: Russ Allbery --- src/gtx/textobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtx/textobject.c b/src/gtx/textobject.c index b589cba50..9604558b9 100644 --- a/src/gtx/textobject.c +++ b/src/gtx/textobject.c @@ -436,7 +436,7 @@ gator_text_Write(struct onode *onp, char *strToWrite, int numChars, "[%s:%s] Writing %d chars to text object at %p (highlight=%d, skip=%d: '", mn, rn, numChars, onp, highlight, skip); for (i = 0; i < numChars; i++) - fprintf(stderr, "%c", strToWrite + i); + fprintf(stderr, "%c", strToWrite[i]); fprintf(stderr, "\n"); } -- 2.39.5