Skip to content

Commit

Permalink
nshlib: fix build break if CONFIG_CPP_HAVE_VARARGS if undefined
Browse files Browse the repository at this point in the history
ctc E272: ["nsh_ddcmd.c" 197/7] undeclared identifier "vtbl"

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao authored and xiaoxiang781216 committed Jan 31, 2024
1 parent 32f269a commit 0968264
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions nshlib/nsh_ddcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -194,15 +195,15 @@ 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;
}

dd->eof = 0;
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;
}

Expand All @@ -223,18 +224,18 @@ 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;
}

if (memcmp(dd->buffer, buffer, dd->nbytes) != 0)
{
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;
}
Expand All @@ -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);
Expand Down

0 comments on commit 0968264

Please sign in to comment.