This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
ecos-patches@redhat.com
- From: Mark Salter <msalter at redhat dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Thu, 12 Sep 2002 17:37:32 -0400
- Subject: ecos-patches@redhat.com
Index: redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.78
diff -u -p -5 -r1.78 ChangeLog
--- redboot/current/ChangeLog 11 Sep 2002 12:14:52 -0000 1.78
+++ redboot/current/ChangeLog 12 Sep 2002 21:16:51 -0000
@@ -1,5 +1,13 @@
+2002-09-12 Mark Salter <msalter@redhat.com>
+
+ * src/decompress.c (gzip_inflate): Fix error return so that upper
+ doesn't quit on Z_STREAM_END.
+ (gzip_close): Move error handling into gzip_inflate.
+
+ * src/load.c (do_load): Fix printing of address range for raw loads.
+
2002-09-11 Mark Salter <msalter@redhat.com>
* src/main.c (do_go): Turn on line flushes before jumping to function.
* src/net/net_io.c (net_io_control): Support flushes at end of lines.
Index: redboot/current/src/decompress.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/decompress.c,v
retrieving revision 1.5
diff -u -p -5 -r1.5 decompress.c
--- redboot/current/src/decompress.c 24 Aug 2002 11:34:50 -0000 1.5
+++ redboot/current/src/decompress.c 12 Sep 2002 21:16:51 -0000
@@ -269,23 +269,41 @@ gzip_init(_pipe_t* p)
// actually cause a buffer to be filled with uncompressed data.
//
static int
gzip_inflate(_pipe_t* p)
{
- int err;
+ int err, bytes_out;
stream.next_in = p->in_buf;
stream.avail_in = p->in_avail;
stream.next_out = p->out_buf;
stream.avail_out = p->out_max;
err = inflate(&stream, Z_SYNC_FLUSH);
- p->out_size += (stream.next_out - p->out_buf);
+ bytes_out = stream.next_out - p->out_buf;
+ p->out_size += bytes_out;
p->out_buf = stream.next_out;
p->msg = stream.msg;
p->in_avail = stream.avail_in;
p->in_buf = stream.next_in;
+ switch (err) {
+ case Z_STREAM_END:
+ p->in_avail = 0;
+ err = 0;
+ break;
+ case Z_OK:
+ if (bytes_out == 0) {
+ // Decompression didn't complete
+ err = -1;
+ p->msg = "premature end of input";
+ } else
+ err = 0;
+ break;
+ default:
+ err = -1;
+ break;
+ }
return err;
}
//
// Called when the input data is completed or an error has
@@ -293,23 +311,10 @@ gzip_inflate(_pipe_t* p)
// information up.
//
static int
gzip_close(_pipe_t* p, int err)
{
- switch (err) {
- case Z_STREAM_END:
- err = 0;
- break;
- case Z_OK:
- // Decompression didn't complete
- p->msg = "premature end of input";
- // fall-through
- default:
- err = -1;
- break;
- }
-
inflateEnd(&stream);
return err;
}
Index: redboot/current/src/load.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/load.c,v
retrieving revision 1.27
diff -u -p -5 -r1.27 load.c
--- redboot/current/src/load.c 8 Aug 2002 10:59:29 -0000 1.27
+++ redboot/current/src/load.c 12 Sep 2002 21:16:52 -0000
@@ -731,11 +731,11 @@ do_load(int argc, char *argv[])
entry_address = base; // best guess
redboot_getc_terminate(false);
if (0 == err)
diag_printf("Raw file loaded %p-%p, assumed entry at %p\n",
- (void *)base, (void *)end, (void*)base);
+ (void *)base, (void *)(end - 1), (void*)base);
} else {
// Read initial header - to determine file [image] type
for (i = 0; i < sizeof(type); i++) {
if ((res = redboot_getc()) < 0) {
err = getc_info.err;