From: Bert Vermeulen Date: Thu, 8 Apr 2010 14:42:22 +0000 (+0200) Subject: better buffer size calculation X-Git-Tag: libsigrok-0.1.0~579 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=37aea2d35c981239e630254fe74f0a411bbc34cb;p=libsigrok.git better buffer size calculation --- diff --git a/output/output_text.c b/output/output_text.c index bc761771..c4b9c95d 100644 --- a/output/output_text.c +++ b/output/output_text.c @@ -151,7 +151,7 @@ static int data_binary(struct output *o, char *data_in, uint64_t length_in, char char *outbuf; ctx = o->internal; - outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * 3 + 512; + outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * ctx->samples_per_line + 512; outbuf = calloc(1, outsize+1); if(ctx->header) { /* the header is still in here, we must be on the first data packet */ @@ -213,7 +213,7 @@ static int data_hex(struct output *o, char *data_in, uint64_t length_in, char ** char *outbuf; ctx = o->internal; - outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * 3 + 512; + outsize = length_in / ctx->unitsize * ctx->num_enabled_probes * ctx->samples_per_line + 512; outbuf = calloc(1, outsize+1); if(ctx->header) { /* the header is still in here, we must be on the first data packet */