summaryrefslogtreecommitdiff
path: root/fastjar
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-31 22:48:27 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-31 22:48:27 +0000
commit9d27d2d4edf5003618a22f7638218212ac613bda (patch)
tree3c4eb60ed277f4b006a285bb92ce4e79504a4b1a /fastjar
parenta0d4b29ecef7c5ef6c5434292e7472cdad85b9b1 (diff)
downloadgcc-9d27d2d4edf5003618a22f7638218212ac613bda.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@62208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'fastjar')
-rw-r--r--fastjar/ChangeLog5
-rw-r--r--fastjar/jartool.c16
2 files changed, 14 insertions, 7 deletions
diff --git a/fastjar/ChangeLog b/fastjar/ChangeLog
index 664710efbcb..8cd13466b63 100644
--- a/fastjar/ChangeLog
+++ b/fastjar/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/fastjar/jartool.c b/fastjar/jartool.c
index 3e946ab4f06..aacf765f21d 100644
--- a/fastjar/jartool.c
+++ b/fastjar/jartool.c
@@ -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;