projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dfu: factorize transaction cleanup
[oweals/u-boot.git]
/
lib
/
gunzip.c
diff --git
a/lib/gunzip.c
b/lib/gunzip.c
index 4128a1871c998836dde4bded2c6784d2b1826768..832b3064e7614bc7c74159ca04f62b3122420356 100644
(file)
--- a/
lib/gunzip.c
+++ b/
lib/gunzip.c
@@
-8,8
+8,10
@@
#include <common.h>
#include <watchdog.h>
#include <command.h>
#include <common.h>
#include <watchdog.h>
#include <command.h>
+#include <console.h>
#include <image.h>
#include <malloc.h>
#include <image.h>
#include <malloc.h>
+#include <memalign.h>
#include <u-boot/zlib.h>
#include <div64.h>
#include <u-boot/zlib.h>
#include <div64.h>
@@
-69,6
+71,7
@@
int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
return zunzip(dst, dstlen, src, lenp, 1, i);
}
return zunzip(dst, dstlen, src, lenp, 1, i);
}
+#ifdef CONFIG_CMD_UNZIP
__weak
void gzwrite_progress_init(u64 expectedsize)
{
__weak
void gzwrite_progress_init(u64 expectedsize)
{
@@
-103,7
+106,7
@@
void gzwrite_progress_finish(int returnval,
}
int gzwrite(unsigned char *src, int len,
}
int gzwrite(unsigned char *src, int len,
- struct bl
ock_dev
_desc *dev,
+ struct bl
k
_desc *dev,
unsigned long szwritebuf,
u64 startoffs,
u64 szexpected)
unsigned long szwritebuf,
u64 startoffs,
u64 szexpected)
@@
-191,7
+194,7
@@
int gzwrite(unsigned char *src, int len,
s.next_in = src + i;
s.avail_in = payload_size+8;
s.next_in = src + i;
s.avail_in = payload_size+8;
- writebuf = (unsigned char *)malloc(szwritebuf);
+ writebuf = (unsigned char *)malloc
_cache_aligned
(szwritebuf);
/* decompress until deflate stream ends or end of file */
do {
/* decompress until deflate stream ends or end of file */
do {
@@
-230,10
+233,8
@@
int gzwrite(unsigned char *src, int len,
gzwrite_progress(iteration++,
totalfilled,
szexpected);
gzwrite_progress(iteration++,
totalfilled,
szexpected);
- blocks_written = dev->block_write(dev->dev,
- outblock,
- writeblocks,
- writebuf);
+ blocks_written = blk_dwrite(dev, outblock,
+ writeblocks, writebuf);
outblock += blocks_written;
if (ctrlc()) {
puts("abort\n");
outblock += blocks_written;
if (ctrlc()) {
puts("abort\n");
@@
-258,6
+259,7
@@
out:
return r;
}
return r;
}
+#endif
/*
* Uncompress blocks compressed with zlib without headers
/*
* Uncompress blocks compressed with zlib without headers
@@
-284,12
+286,11
@@
int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
do {
r = inflate(&s, Z_FINISH);
if (stoponerr == 1 && r != Z_STREAM_END &&
do {
r = inflate(&s, Z_FINISH);
if (stoponerr == 1 && r != Z_STREAM_END &&
- (s.avail_out == 0 || r != Z_BUF_ERROR)) {
+ (s.avail_
in == 0 || s.avail_
out == 0 || r != Z_BUF_ERROR)) {
printf("Error: inflate() returned %d\n", r);
err = -1;
break;
}
printf("Error: inflate() returned %d\n", r);
err = -1;
break;
}
- s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
} while (r == Z_BUF_ERROR);
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
} while (r == Z_BUF_ERROR);
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);