sr: out: Use uint8_t (not char) for buffers.
This commit is contained in:
parent
69cfcfc8f0
commit
054e670906
4
filter.c
4
filter.c
|
@ -74,8 +74,8 @@
|
|||
* out_unitsize, data_out, and length_out are undefined.
|
||||
*/
|
||||
SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
|
||||
const int *probelist, const unsigned char *data_in,
|
||||
uint64_t length_in, char **data_out,
|
||||
const int *probelist, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
unsigned int in_offset, out_offset;
|
||||
|
|
|
@ -42,7 +42,7 @@ struct context {
|
|||
int line_offset;
|
||||
int linebuf_len;
|
||||
char *probelist[SR_MAX_NUM_PROBES + 1];
|
||||
char *linebuf;
|
||||
uint8_t *linebuf;
|
||||
int spl_cnt;
|
||||
uint8_t *linevalues;
|
||||
char *header;
|
||||
|
@ -51,7 +51,7 @@ struct context {
|
|||
enum outputmode mode;
|
||||
};
|
||||
|
||||
static void flush_linebufs(struct context *ctx, char *outbuf)
|
||||
static void flush_linebufs(struct context *ctx, uint8_t *outbuf)
|
||||
{
|
||||
static int max_probename_len = 0;
|
||||
int len, i;
|
||||
|
@ -168,12 +168,12 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int event(struct sr_output *o, int event_type, char **data_out,
|
||||
static int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
int outsize;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
ctx = o->internal;
|
||||
switch (event_type) {
|
||||
|
@ -210,14 +210,15 @@ static int init_bits(struct sr_output *o)
|
|||
return init(o, DEFAULT_BPL_BITS, MODE_BITS);
|
||||
}
|
||||
|
||||
static int data_bits(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
static int data_bits(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int outsize, offset, p;
|
||||
int max_linelen;
|
||||
struct sr_analog_sample *sample;
|
||||
char *outbuf, c;
|
||||
uint8_t *outbuf, c;
|
||||
|
||||
ctx = o->internal;
|
||||
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
|
||||
|
@ -299,14 +300,15 @@ static int init_hex(struct sr_output *o)
|
|||
return init(o, DEFAULT_BPL_HEX, MODE_HEX);
|
||||
}
|
||||
|
||||
static int data_hex(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
static int data_hex(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int outsize, offset, p;
|
||||
int max_linelen;
|
||||
uint64_t sample;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
ctx = o->internal;
|
||||
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
|
||||
|
@ -366,14 +368,15 @@ static int init_ascii(struct sr_output *o)
|
|||
return init(o, DEFAULT_BPL_ASCII, MODE_ASCII);
|
||||
}
|
||||
|
||||
static int data_ascii(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
static int data_ascii(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int outsize, offset, p;
|
||||
int max_linelen;
|
||||
uint64_t sample;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
ctx = o->internal;
|
||||
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include "sigrok.h"
|
||||
#include "sigrok-internal.h"
|
||||
|
||||
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
||||
char **data_out, uint64_t *length_out)
|
||||
static int data(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out, uint64_t *length_out)
|
||||
{
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
/* Prevent compiler warnings. */
|
||||
(void)o;
|
||||
|
|
|
@ -133,11 +133,11 @@ static int init(struct sr_output *o)
|
|||
return 0; /* TODO: SR_OK? */
|
||||
}
|
||||
|
||||
static int event(struct sr_output *o, int event_type, char **data_out,
|
||||
static int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
if (!o) {
|
||||
sr_warn("la8 out: %s: o was NULL", __func__);
|
||||
|
@ -196,11 +196,11 @@ static int event(struct sr_output *o, int event_type, char **data_out,
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
||||
char **data_out, uint64_t *length_out)
|
||||
static int data(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
if (!o) {
|
||||
sr_warn("la8 out: %s: o was NULL", __func__);
|
||||
|
|
|
@ -122,7 +122,7 @@ static int init(struct sr_output *o)
|
|||
return 0; /* TODO: SR_OK? */
|
||||
}
|
||||
|
||||
static int event(struct sr_output *o, int event_type, char **data_out,
|
||||
static int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
|
@ -168,8 +168,8 @@ static int event(struct sr_output *o, int event_type, char **data_out,
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
||||
char **data_out, uint64_t *length_out)
|
||||
static int data(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
GString *outstr;
|
||||
|
@ -209,7 +209,7 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
|||
g_string_append_printf(outstr, "\n");
|
||||
}
|
||||
|
||||
*data_out = outstr->str;
|
||||
*data_out = (uint8_t *)outstr->str;
|
||||
*length_out = outstr->len;
|
||||
g_string_free(outstr, FALSE);
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ static int init(struct sr_output *o)
|
|||
/* Columns / channels */
|
||||
wbuf[0] = '\0';
|
||||
for (i = 0; i < ctx->num_enabled_probes; i++) {
|
||||
c = (char *)&wbuf + strlen((char *)&wbuf);
|
||||
c = (char *)&wbuf + strlen((const char *)&wbuf);
|
||||
sprintf(c, "# %d\t\t%s\n", i + 1, ctx->probelist[i]);
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ static int init(struct sr_output *o)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int event(struct sr_output *o, int event_type, char **data_out,
|
||||
static int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
if (!o) {
|
||||
|
@ -183,14 +183,14 @@ static int event(struct sr_output *o, int event_type, char **data_out,
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
||||
char **data_out, uint64_t *length_out)
|
||||
static int data(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int max_linelen, outsize, p, curbit, i;
|
||||
uint64_t sample;
|
||||
static uint64_t samplecount = 0, old_sample = 0;
|
||||
char *outbuf, *c;
|
||||
uint8_t *outbuf, *c;
|
||||
|
||||
if (!o) {
|
||||
sr_err("gnuplot out: %s: o was NULL", __func__);
|
||||
|
@ -231,7 +231,7 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
|||
outbuf[0] = '\0';
|
||||
if (ctx->header) {
|
||||
/* The header is still here, this must be the first packet. */
|
||||
strncpy(outbuf, ctx->header, outsize);
|
||||
strncpy((char *)outbuf, ctx->header, outsize);
|
||||
g_free(ctx->header);
|
||||
ctx->header = NULL;
|
||||
}
|
||||
|
@ -251,22 +251,22 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
|||
old_sample = sample;
|
||||
|
||||
/* The first column is a counter (needed for gnuplot). */
|
||||
c = outbuf + strlen(outbuf);
|
||||
sprintf(c, "%" PRIu64 "\t", samplecount++);
|
||||
c = outbuf + strlen((const char *)outbuf);
|
||||
sprintf((char *)c, "%" PRIu64 "\t", samplecount++);
|
||||
|
||||
/* The next columns are the values of all channels. */
|
||||
for (p = 0; p < ctx->num_enabled_probes; p++) {
|
||||
curbit = (sample & ((uint64_t) (1 << p))) >> p;
|
||||
c = outbuf + strlen(outbuf);
|
||||
sprintf(c, "%d ", curbit);
|
||||
c = outbuf + strlen((const char *)outbuf);
|
||||
sprintf((char *)c, "%d ", curbit);
|
||||
}
|
||||
|
||||
c = outbuf + strlen(outbuf);
|
||||
sprintf(c, "\n");
|
||||
c = outbuf + strlen((const char *)outbuf);
|
||||
sprintf((char *)c, "\n");
|
||||
}
|
||||
|
||||
*data_out = outbuf;
|
||||
*length_out = strlen(outbuf);
|
||||
*length_out = strlen((const char *)outbuf);
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
@ -360,14 +360,15 @@ static int analog_init(struct sr_output *o)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int analog_data(struct sr_output *o, char *data_in, uint64_t length_in,
|
||||
char **data_out, uint64_t *length_out)
|
||||
static int analog_data(struct sr_output *o, uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int max_linelen, outsize, p, /* curbit, */ i;
|
||||
// uint64_t sample;
|
||||
static uint64_t samplecount = 0;
|
||||
char *outbuf, *c;
|
||||
uint8_t *outbuf, *c;
|
||||
struct sr_analog_sample *sample;
|
||||
|
||||
ctx = o->internal;
|
||||
|
|
|
@ -76,7 +76,7 @@ static int init(struct sr_output *o)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int event(struct sr_output *o, int event_type, char **data_out,
|
||||
static int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
|
@ -95,8 +95,8 @@ static int event(struct sr_output *o, int event_type, char **data_out,
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
||||
char **data_out, uint64_t *length_out)
|
||||
static int data(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out, uint64_t *length_out)
|
||||
{
|
||||
GString *out;
|
||||
struct context *ctx;
|
||||
|
@ -117,7 +117,7 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
|||
g_string_append_printf(out, "%08x@%"PRIu64"\n",
|
||||
(uint32_t) sample, ctx->num_samples++);
|
||||
}
|
||||
*data_out = out->str;
|
||||
*data_out = (uint8_t *)out->str;
|
||||
*length_out = out->len;
|
||||
g_string_free(out, FALSE);
|
||||
|
||||
|
|
|
@ -30,15 +30,15 @@ SR_PRIV int init_ascii(struct sr_output *o)
|
|||
return init(o, DEFAULT_BPL_ASCII, MODE_ASCII);
|
||||
}
|
||||
|
||||
SR_PRIV int data_ascii(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out,
|
||||
SR_PRIV int data_ascii(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int outsize, offset, p;
|
||||
int max_linelen;
|
||||
uint64_t sample;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
ctx = o->internal;
|
||||
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
|
||||
|
@ -58,7 +58,7 @@ SR_PRIV int data_ascii(struct sr_output *o, const char *data_in,
|
|||
outbuf[0] = '\0';
|
||||
if (ctx->header) {
|
||||
/* The header is still here, this must be the first packet. */
|
||||
strncpy(outbuf, ctx->header, outsize);
|
||||
strncpy((char *)outbuf, ctx->header, outsize);
|
||||
g_free(ctx->header);
|
||||
ctx->header = NULL;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ SR_PRIV int data_ascii(struct sr_output *o, const char *data_in,
|
|||
}
|
||||
|
||||
*data_out = outbuf;
|
||||
*length_out = strlen(outbuf);
|
||||
*length_out = strlen((const char *)outbuf);
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
|
|
@ -30,14 +30,15 @@ SR_PRIV int init_bits(struct sr_output *o)
|
|||
return init(o, DEFAULT_BPL_BITS, MODE_BITS);
|
||||
}
|
||||
|
||||
SR_PRIV int data_bits(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
SR_PRIV int data_bits(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int outsize, offset, p;
|
||||
int max_linelen;
|
||||
uint64_t sample;
|
||||
char *outbuf, c;
|
||||
uint8_t *outbuf, c;
|
||||
|
||||
ctx = o->internal;
|
||||
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
|
||||
|
@ -57,7 +58,7 @@ SR_PRIV int data_bits(struct sr_output *o, const char *data_in,
|
|||
outbuf[0] = '\0';
|
||||
if (ctx->header) {
|
||||
/* The header is still here, this must be the first packet. */
|
||||
strncpy(outbuf, ctx->header, outsize);
|
||||
strncpy((char *)outbuf, ctx->header, outsize);
|
||||
g_free(ctx->header);
|
||||
ctx->header = NULL;
|
||||
|
||||
|
@ -99,7 +100,7 @@ SR_PRIV int data_bits(struct sr_output *o, const char *data_in,
|
|||
}
|
||||
|
||||
*data_out = outbuf;
|
||||
*length_out = strlen(outbuf);
|
||||
*length_out = strlen((const char *)outbuf);
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
|
|
@ -30,14 +30,15 @@ SR_PRIV int init_hex(struct sr_output *o)
|
|||
return init(o, DEFAULT_BPL_HEX, MODE_HEX);
|
||||
}
|
||||
|
||||
SR_PRIV int data_hex(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
SR_PRIV int data_hex(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int outsize, offset, p;
|
||||
int max_linelen;
|
||||
uint64_t sample;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
ctx = o->internal;
|
||||
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
|
||||
|
@ -53,7 +54,7 @@ SR_PRIV int data_hex(struct sr_output *o, const char *data_in,
|
|||
outbuf[0] = '\0';
|
||||
if (ctx->header) {
|
||||
/* The header is still here, this must be the first packet. */
|
||||
strncpy(outbuf, ctx->header, outsize);
|
||||
strncpy((char *)outbuf, ctx->header, outsize);
|
||||
g_free(ctx->header);
|
||||
ctx->header = NULL;
|
||||
}
|
||||
|
@ -66,7 +67,7 @@ SR_PRIV int data_hex(struct sr_output *o, const char *data_in,
|
|||
ctx->linevalues[p] <<= 1;
|
||||
if (sample & ((uint64_t) 1 << p))
|
||||
ctx->linevalues[p] |= 1;
|
||||
sprintf(ctx->linebuf + (p * ctx->linebuf_len) +
|
||||
sprintf((char *)ctx->linebuf + (p * ctx->linebuf_len) +
|
||||
ctx->line_offset, "%.2x", ctx->linevalues[p]);
|
||||
}
|
||||
ctx->spl_cnt++;
|
||||
|
@ -87,7 +88,7 @@ SR_PRIV int data_hex(struct sr_output *o, const char *data_in,
|
|||
}
|
||||
|
||||
*data_out = outbuf;
|
||||
*length_out = strlen(outbuf);
|
||||
*length_out = strlen((const char *)outbuf);
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "sigrok-internal.h"
|
||||
#include "text.h"
|
||||
|
||||
SR_PRIV void flush_linebufs(struct context *ctx, char *outbuf)
|
||||
SR_PRIV void flush_linebufs(struct context *ctx, uint8_t *outbuf)
|
||||
{
|
||||
static int max_probename_len = 0;
|
||||
int len, i;
|
||||
|
@ -45,7 +45,8 @@ SR_PRIV void flush_linebufs(struct context *ctx, char *outbuf)
|
|||
}
|
||||
|
||||
for (i = 0; ctx->probelist[i]; i++) {
|
||||
sprintf(outbuf + strlen(outbuf), "%*s:%s\n", max_probename_len,
|
||||
sprintf((char *)outbuf + strlen((const char *)outbuf),
|
||||
"%*s:%s\n", max_probename_len,
|
||||
ctx->probelist[i], ctx->linebuf + i * ctx->linebuf_len);
|
||||
}
|
||||
|
||||
|
@ -57,8 +58,8 @@ SR_PRIV void flush_linebufs(struct context *ctx, char *outbuf)
|
|||
if (ctx->mode == MODE_ASCII)
|
||||
space_offset = 0;
|
||||
|
||||
sprintf(outbuf + strlen(outbuf), "T:%*s^\n",
|
||||
ctx->mark_trigger + space_offset, "");
|
||||
sprintf((char *)outbuf + strlen((const char *)outbuf),
|
||||
"T:%*s^\n", ctx->mark_trigger + space_offset, "");
|
||||
}
|
||||
|
||||
memset(ctx->linebuf, 0, i * ctx->linebuf_len);
|
||||
|
@ -142,12 +143,12 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int event(struct sr_output *o, int event_type, char **data_out,
|
||||
SR_PRIV int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
int outsize;
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
ctx = o->internal;
|
||||
switch (event_type) {
|
||||
|
@ -165,7 +166,7 @@ SR_PRIV int event(struct sr_output *o, int event_type, char **data_out,
|
|||
}
|
||||
flush_linebufs(ctx, outbuf);
|
||||
*data_out = outbuf;
|
||||
*length_out = strlen(outbuf);
|
||||
*length_out = strlen((const char *)outbuf);
|
||||
g_free(o->internal);
|
||||
o->internal = NULL;
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,7 @@ struct context {
|
|||
int line_offset;
|
||||
int linebuf_len;
|
||||
char *probelist[SR_MAX_NUM_PROBES + 1];
|
||||
char *linebuf;
|
||||
uint8_t *linebuf;
|
||||
int spl_cnt;
|
||||
uint8_t *linevalues;
|
||||
char *header;
|
||||
|
@ -46,23 +46,24 @@ struct context {
|
|||
enum outputmode mode;
|
||||
};
|
||||
|
||||
SR_PRIV void flush_linebufs(struct context *ctx, char *outbuf);
|
||||
SR_PRIV void flush_linebufs(struct context *ctx, uint8_t *outbuf);
|
||||
SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode);
|
||||
SR_PRIV int event(struct sr_output *o, int event_type, char **data_out,
|
||||
SR_PRIV int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out);
|
||||
|
||||
SR_PRIV int init_bits(struct sr_output *o);
|
||||
SR_PRIV int data_bits(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out,
|
||||
SR_PRIV int data_bits(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out);
|
||||
|
||||
SR_PRIV int init_hex(struct sr_output *o);
|
||||
SR_PRIV int data_hex(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out, uint64_t *length_out);
|
||||
SR_PRIV int data_hex(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out);
|
||||
|
||||
SR_PRIV int init_ascii(struct sr_output *o);
|
||||
SR_PRIV int data_ascii(struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out,
|
||||
SR_PRIV int data_ascii(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out);
|
||||
|
||||
#endif
|
||||
|
|
14
output/vcd.c
14
output/vcd.c
|
@ -135,16 +135,16 @@ static int init(struct sr_output *o)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int event(struct sr_output *o, int event_type, char **data_out,
|
||||
static int event(struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out)
|
||||
{
|
||||
char *outbuf;
|
||||
uint8_t *outbuf;
|
||||
|
||||
switch (event_type) {
|
||||
case SR_DF_END:
|
||||
outbuf = g_strdup("$dumpoff\n$end\n");
|
||||
outbuf = (uint8_t *)g_strdup("$dumpoff\n$end\n");
|
||||
*data_out = outbuf;
|
||||
*length_out = strlen(outbuf);
|
||||
*length_out = strlen((const char *)outbuf);
|
||||
g_free(o->internal);
|
||||
o->internal = NULL;
|
||||
break;
|
||||
|
@ -157,8 +157,8 @@ static int event(struct sr_output *o, int event_type, char **data_out,
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
||||
char **data_out, uint64_t *length_out)
|
||||
static int data(struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
unsigned int i;
|
||||
|
@ -207,7 +207,7 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in,
|
|||
ctx->prevsample = sample;
|
||||
}
|
||||
|
||||
*data_out = out->str;
|
||||
*data_out = (uint8_t *)out->str;
|
||||
*length_out = out->len;
|
||||
g_string_free(out, FALSE);
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ SR_API int sr_dev_info_get(const struct sr_dev *dev, int id, const void **data);
|
|||
/*--- filter.c --------------------------------------------------------------*/
|
||||
|
||||
SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
|
||||
const int *probelist, const unsigned char *data_in,
|
||||
uint64_t length_in, char **data_out,
|
||||
const int *probelist, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out);
|
||||
|
||||
/*--- hwdriver.c ------------------------------------------------------------*/
|
||||
|
|
|
@ -186,9 +186,10 @@ struct sr_output_format {
|
|||
char *description;
|
||||
int df_type;
|
||||
int (*init) (struct sr_output *o);
|
||||
int (*data) (struct sr_output *o, const char *data_in,
|
||||
uint64_t length_in, char **data_out, uint64_t *length_out);
|
||||
int (*event) (struct sr_output *o, int event_type, char **data_out,
|
||||
int (*data) (struct sr_output *o, const uint8_t *data_in,
|
||||
uint64_t length_in, uint8_t **data_out,
|
||||
uint64_t *length_out);
|
||||
int (*event) (struct sr_output *o, int event_type, uint8_t **data_out,
|
||||
uint64_t *length_out);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue