1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-18 02:17:06 +00:00

library: use "filemem" for TXT dump_plot() -> txt_hex_plot()

filemem: remove NOLINTS (clang-tidy-20 bug fixed)
QRCODE: eliminate NOLINTs using some more asserts (clang-tidy-20);
  some "de-branching" of loops
general: various code fiddlings, in particular lessen no. of
  redundant parenthesized expressions, especially in conditionals,
  which reduce rather than aid readibility IMNSHO
manual: mention "--dump" option
This commit is contained in:
gitlost
2025-08-28 20:34:56 +01:00
parent 36364b4912
commit 44e2099a65
35 changed files with 507 additions and 588 deletions

View File

@@ -261,11 +261,10 @@ static int fm_vprintf(struct filemem *restrict const fmp, const char *fmt, va_li
#endif
va_copy(cpy, ap);
/* The clang-tidy warning is a bug https://github.com/llvm/llvm-project/issues/40656 */
#ifdef FM_NO_VSNPRINTF
size = vfprintf(fmp->fp_null, fmt, cpy); /* NOLINT(clang-analyzer-valist.Uninitialized) */
size = vfprintf(fmp->fp_null, fmt, cpy);
#else
size = vsnprintf(NULL, 0, fmt, cpy); /* NOLINT(clang-analyzer-valist.Uninitialized) */
size = vsnprintf(NULL, 0, fmt, cpy);
#endif
va_end(cpy);
@@ -278,10 +277,8 @@ static int fm_vprintf(struct filemem *restrict const fmp, const char *fmt, va_li
}
#ifdef FM_NO_VSNPRINTF
/* NOLINTNEXTLINE(clang-analyzer-valist.Uninitialized) - see above */
check = vsprintf((char *) fmp->mem + fmp->mempos, fmt, ap);
#else
/* NOLINTNEXTLINE(clang-analyzer-valist.Uninitialized) - see above */
check = vsnprintf((char *) fmp->mem + fmp->mempos, size + 1, fmt, ap);
#endif
@@ -309,7 +306,7 @@ INTERNAL int zint_fm_printf(struct filemem *restrict const fmp, const char *fmt,
return ret;
}
va_start(ap, fmt);
ret = vfprintf(fmp->fp, fmt, ap) >= 0; /* NOLINT(clang-analyzer-valist.Uninitialized) - see above */
ret = vfprintf(fmp->fp, fmt, ap) >= 0;
va_end(ap);
return ret ? 1 : fm_seterr(fmp, errno);
}