From a0cca5f6eb8d721c703e9d52457ebb3811c90e35 Mon Sep 17 00:00:00 2001 From: Mark Collins Date: Mon, 7 Aug 2023 14:17:55 +0000 Subject: [PATCH] freedreno/rnn: Remove %n usage in fprintf fprintf was utilized with %n to count the amount of characters it outputted but this was redundant since it was at the end of the statement and fprintf itself returns the amount of characters it writes out. It should be noted that %n is a compatibility hazard on Android as it isn't supported on Android due to security reasons. Signed-off-by: Mark Collins Part-of: --- src/freedreno/rnn/headergen2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/freedreno/rnn/headergen2.c b/src/freedreno/rnn/headergen2.c index f1deb38..bb14513 100644 --- a/src/freedreno/rnn/headergen2.c +++ b/src/freedreno/rnn/headergen2.c @@ -97,9 +97,9 @@ static void printdef (char *name, char *suf, int type, uint64_t val, char *file) FILE *dst = findfout(file); int len; if (suf) - fprintf (dst, "#define %s__%s%n", name, suf, &len); + len = fprintf (dst, "#define %s__%s", name, suf); else - fprintf (dst, "#define %s%n", name, &len); + len = fprintf (dst, "#define %s", name); if (type == 0 && val > 0xffffffffull) seekcol (dst, len, startcol-8); else @@ -257,7 +257,6 @@ static void printdelem (struct rnndelem *elem, uint64_t offset, const char *str) asprintf(®name, "REG_%s", elem->fullname); } if (elemsnum) { - int len; FILE *dst = findfout(elem->file); int i; @@ -311,7 +310,7 @@ static void printdelem (struct rnndelem *elem, uint64_t offset, const char *str) fprintf(dst, "enum %s ", elems[i]->index->name); else fprintf(dst, "uint32_t "); - fprintf (dst, "i%d%n", i, &len); + fprintf (dst, "i%d", i); } fprintf (dst, ") { return "); fprintf (dst, "0x%08"PRIx64"", offset + elem->offset); -- 2.7.4