From 0968264ac0997f7cf868d91244052ce50efe7d92 Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 31 Jan 2024 10:06:12 +0800 Subject: [PATCH] nshlib: fix build break if CONFIG_CPP_HAVE_VARARGS if undefined ctc E272: ["nsh_ddcmd.c" 197/7] undeclared identifier "vtbl" Signed-off-by: chao an --- nshlib/nsh_ddcmd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c index c6f30b098..9f6bfd01a 100644 --- a/nshlib/nsh_ddcmd.c +++ b/nshlib/nsh_ddcmd.c @@ -184,6 +184,7 @@ static inline int dd_outfopen(FAR const char *name, FAR struct dd_s *dd) static int dd_verify(FAR const char *infile, FAR const char *outfile, FAR struct dd_s *dd) { + FAR struct nsh_vtbl_s *vtbl = dd->vtbl; FAR uint8_t *buffer; unsigned sector = 0; int ret = OK; @@ -194,7 +195,7 @@ static int dd_verify(FAR const char *infile, FAR const char *outfile, ret = lseek(dd->infd, dd->skip ? dd->skip * dd->sectsize : 0, SEEK_SET); if (ret < 0) { - nsh_error(dd->vtbl, g_fmtcmdfailed, g_dd, "lseek", NSH_ERRNO); + nsh_error(vtbl, g_fmtcmdfailed, g_dd, "lseek", NSH_ERRNO); return ret; } @@ -202,7 +203,7 @@ static int dd_verify(FAR const char *infile, FAR const char *outfile, ret = lseek(dd->outfd, 0, SEEK_SET); if (ret < 0) { - nsh_error(dd->vtbl, g_fmtcmdfailed, g_dd, "lseek", NSH_ERRNO); + nsh_error(vtbl, g_fmtcmdfailed, g_dd, "lseek", NSH_ERRNO); return ret; } @@ -223,7 +224,7 @@ static int dd_verify(FAR const char *infile, FAR const char *outfile, ret = read(dd->outfd, buffer, dd->nbytes); if (ret != dd->nbytes) { - nsh_error(dd->vtbl, g_fmtcmdfailed, g_dd, "read", NSH_ERRNO); + nsh_error(vtbl, g_fmtcmdfailed, g_dd, "read", NSH_ERRNO); break; } @@ -231,10 +232,10 @@ static int dd_verify(FAR const char *infile, FAR const char *outfile, { char msg[32]; snprintf(msg, sizeof(msg), "infile sector %d", sector); - nsh_dumpbuffer(dd->vtbl, msg, dd->buffer, dd->nbytes); + nsh_dumpbuffer(vtbl, msg, dd->buffer, dd->nbytes); snprintf(msg, sizeof(msg), "\noutfile sector %d", sector); - nsh_dumpbuffer(dd->vtbl, msg, buffer, dd->nbytes); - nsh_output(dd->vtbl, "\n"); + nsh_dumpbuffer(vtbl, msg, buffer, dd->nbytes); + nsh_output(vtbl, "\n"); ret = ERROR; break; } @@ -244,7 +245,7 @@ static int dd_verify(FAR const char *infile, FAR const char *outfile, if (ret < 0) { - nsh_error(dd->vtbl, g_fmtcmdfailed, g_dd, "dd_verify", ret); + nsh_error(vtbl, g_fmtcmdfailed, g_dd, "dd_verify", ret); } free(buffer);