Commit 0120f3d4 by Daiki Ueno Committed by Tom Tromey

jartool.c (extract_jar): Don't lseek to skip extra fields.

2003-01-31  Daiki Ueno  <ueno@unixuser.org>

	* jartool.c (extract_jar): Don't lseek to skip extra fields.
	(consume): If the stream is seekable, do lseek.

From-SVN: r62208
parent 7c712dcc
2003-01-31 Daiki Ueno <ueno@unixuser.org>
* jartool.c (extract_jar): Don't lseek to skip extra fields.
(consume): If the stream is seekable, do lseek.
2003-01-28 Ranjit Mathew <rmathew@hotmail.com>
* jargrep.c: Include xregex.h from libiberty instead of
......
......@@ -1465,9 +1465,6 @@ int extract_jar(int fd, char **files, int file_num){
}
if(method == 8 || flags & 0x0008){
if(seekable)
lseek(fd, eflen, SEEK_CUR);
else
consume(&pbf, eflen);
inflate_file(&pbf, f_fd, &ze);
......@@ -1502,9 +1499,6 @@ int extract_jar(int fd, char **files, int file_num){
#endif
}
if(seekable)
lseek(fd, eflen, SEEK_CUR);
else
consume(&pbf, eflen);
}
......@@ -1849,6 +1843,14 @@ int consume(pb_file *pbf, int amt){
printf("Consuming %d bytes\n", amt);
#endif
if (seekable){
if (amt <= (int)pbf->buff_amt)
pb_read(pbf, buff, amt);
else {
lseek(pbf->fd, amt - pbf->buff_amt, SEEK_CUR);
pb_read(pbf, buff, pbf->buff_amt); /* clear pbf */
}
} else
while(tc < amt){
rdamt = pb_read(pbf, buff, ((amt - tc) < RDSZ ? (amt - tc) : RDSZ));
#ifdef DEBUG
......@@ -1858,7 +1860,7 @@ int consume(pb_file *pbf, int amt){
}
#ifdef DEBUG
printf("%d bytes consumed\n", tc);
printf("%d bytes consumed\n", amt);
#endif
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment