Fix bug in output of null character with %c format.

(cherry picked from commit 9d0d1938dc)
This commit is contained in:
Martin Whitaker 2018-10-07 18:59:53 +01:00
parent 10e7eb55ce
commit 10448bf94b
1 changed files with 2 additions and 2 deletions

View File

@ -406,13 +406,13 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus,
vpi_printf("WARNING: %s:%d: missing argument for %s%s.\n",
info->filename, info->lineno, info->name, fmtb);
} else {
value.format = vpiStringVal;
value.format = vpiIntVal;
vpi_get_value(info->items[*idx], &value);
if (value.format == vpiSuppressVal) {
vpi_printf("WARNING: %s:%d: incompatible value for %s%s.\n",
info->filename, info->lineno, info->name, fmtb);
} else {
char ch = value.value.str[strlen(value.value.str)-1];
char ch = value.value.integer;
/* If the width is less than one then use a width of one. */
if (width < 1) width = 1;