VCD output: Handle disabled probes correctly.

This commit is contained in:
Uwe Hermann 2010-04-06 15:02:14 +02:00
parent e2ad47b5b0
commit bc010c054b
1 changed files with 4 additions and 4 deletions

View File

@ -92,10 +92,10 @@ static int init(struct output *o)
/* Wires / channels */ /* Wires / channels */
wbuf[0] = '\0'; wbuf[0] = '\0';
for (i = 0; i < num_probes; i++) { for (i = 0; i < ctx->num_enabled_probes; i++) {
c = (char *)&wbuf + strlen((char *)&wbuf); c = (char *)&wbuf + strlen((char *)&wbuf);
sprintf(c, "$var wire 1 %c channel%i $end\n", sprintf(c, "$var wire 1 %c channel%s $end\n",
(char)('!' + i), i); (char)('!' + i), ctx->probelist[i]);
} }
/* TODO: date: File or signals? Make y/n configurable. */ /* TODO: date: File or signals? Make y/n configurable. */
@ -127,7 +127,7 @@ static int event(struct output *o, int event_type, char **data_out,
outbuf = malloc(outlen + 1); outbuf = malloc(outlen + 1);
if (outbuf == NULL) if (outbuf == NULL)
return SIGROK_ERR_MALLOC; return SIGROK_ERR_MALLOC;
snprintf(outbuf, outlen, "$dumpoff\n$end\n"); snprintf(outbuf, outlen + 1, "$dumpoff\n$end\n");
*data_out = outbuf; *data_out = outbuf;
*length_out = outlen; *length_out = outlen;
free(o->internal); free(o->internal);