From 701fb4acced1c89b5828c860482fefd08620569e Mon Sep 17 00:00:00 2001 From: "Brian S. Dean" Date: Thu, 22 May 2003 00:46:59 +0000 Subject: [PATCH] Make the s-record output routine work like the raw and intel hex output routines (don't optimize away 0xff data before and after non 0xff data). Also, fix a bug where the data contents sometimes weren't written out completely. Initial bug reported by Tom Harris . Fixes provided by Alexey V.Levdikov . git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@330 81a1dc3b-b13d-400b-aceb-764788c761c2 --- fileio.c | 72 +++++++++++++------------------------------------------- 1 file changed, 16 insertions(+), 56 deletions(-) diff --git a/fileio.c b/fileio.c index f3806215..19591747 100644 --- a/fileio.c +++ b/fileio.c @@ -360,11 +360,10 @@ int b2srec(unsigned char * inbuf, int bufsize, char * outfile, FILE * outf) { unsigned char * buf; - unsigned int nextaddr, stopaddr; + unsigned int nextaddr; int n, nbytes, addr_width; int i; unsigned char cksum; - unsigned char startf, stopf ,emptyf; char * tmpl=0; @@ -373,39 +372,11 @@ int b2srec(unsigned char * inbuf, int bufsize, progname, recsize); return -1; } - + + nextaddr = startaddr; buf = inbuf; - nextaddr = 0; - stopaddr = 0; - startf = 0; - stopf = 0; + nbytes = 0; - /* search for ranges of 'real' data */ - for (i=startaddr; i0; i--) + cksum += (nextaddr >> (i-1) * 8) & 0xff; + for (i=nextaddr; i0; i--) - cksum += (nextaddr >> (i-1) * 8) & 0xff; - - for (i=nextaddr; i