git-svn: trunk@3776
Török Edvin authored on 2008/04/09 05:06:59... | ... |
@@ -124,11 +124,11 @@ static const unsigned short mszip_bit_mask_tab[17] = { |
124 | 124 |
} while (0) |
125 | 125 |
|
126 | 126 |
static int mszip_read_input(struct mszip_stream *zip) { |
127 |
- int read = zip->read ? zip->read(zip->file, zip->inbuf, (int)zip->inbuf_size) : cli_readn(zip->fd, zip->inbuf, (int)zip->inbuf_size); |
|
128 |
- if (read < 0) return zip->error = CL_EIO; |
|
127 |
+ int nread = zip->read_cb ? zip->read_cb(zip->file, zip->inbuf, (int)zip->inbuf_size) : cli_readn(zip->fd, zip->inbuf, (int)zip->inbuf_size); |
|
128 |
+ if (nread < 0) return zip->error = CL_EIO; |
|
129 | 129 |
|
130 | 130 |
zip->i_ptr = &zip->inbuf[0]; |
131 |
- zip->i_end = &zip->inbuf[read]; |
|
131 |
+ zip->i_end = &zip->inbuf[nread]; |
|
132 | 132 |
|
133 | 133 |
return CL_SUCCESS; |
134 | 134 |
} |
... | ... |
@@ -563,7 +563,7 @@ struct mszip_stream *mszip_init(int fd, |
563 | 563 |
int input_buffer_size, |
564 | 564 |
int repair_mode, |
565 | 565 |
struct cab_file *file, |
566 |
- int (*read)(struct cab_file *, unsigned char *, int)) |
|
566 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int)) |
|
567 | 567 |
{ |
568 | 568 |
struct mszip_stream *zip; |
569 | 569 |
|
... | ... |
@@ -597,7 +597,7 @@ struct mszip_stream *mszip_init(int fd, |
597 | 597 |
zip->bit_buffer = 0; zip->bits_left = 0; |
598 | 598 |
|
599 | 599 |
zip->file = file; |
600 |
- zip->read = read; |
|
600 |
+ zip->read_cb = read_cb; |
|
601 | 601 |
|
602 | 602 |
return zip; |
603 | 603 |
} |
... | ... |
@@ -748,7 +748,7 @@ void mszip_free(struct mszip_stream *zip) { |
748 | 748 |
} while (0) |
749 | 749 |
|
750 | 750 |
static int lzx_read_input(struct lzx_stream *lzx) { |
751 |
- int bread = lzx->read ? lzx->read(lzx->file, &lzx->inbuf[0], (int)lzx->inbuf_size) : cli_readn(lzx->fd, &lzx->inbuf[0], (int)lzx->inbuf_size); |
|
751 |
+ int bread = lzx->read_cb ? lzx->read_cb(lzx->file, &lzx->inbuf[0], (int)lzx->inbuf_size) : cli_readn(lzx->fd, &lzx->inbuf[0], (int)lzx->inbuf_size); |
|
752 | 752 |
if (bread < 0) return lzx->error = CL_EIO; |
753 | 753 |
|
754 | 754 |
/* huff decode's ENSURE_BYTES(16) might overrun the input stream, even |
... | ... |
@@ -985,7 +985,7 @@ struct lzx_stream *lzx_init(int fd, |
985 | 985 |
int input_buffer_size, |
986 | 986 |
off_t output_length, |
987 | 987 |
struct cab_file *file, |
988 |
- int (*read)(struct cab_file *, unsigned char *, int)) |
|
988 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int)) |
|
989 | 989 |
{ |
990 | 990 |
unsigned int window_size = 1 << window_bits; |
991 | 991 |
struct lzx_stream *lzx; |
... | ... |
@@ -1035,7 +1035,7 @@ struct lzx_stream *lzx_init(int fd, |
1035 | 1035 |
lzx->offset = 0; |
1036 | 1036 |
lzx->length = output_length; |
1037 | 1037 |
lzx->file = file; |
1038 |
- lzx->read = read; |
|
1038 |
+ lzx->read_cb = read_cb; |
|
1039 | 1039 |
|
1040 | 1040 |
lzx->inbuf_size = input_buffer_size; |
1041 | 1041 |
lzx->window_size = 1 << window_bits; |
... | ... |
@@ -1576,11 +1576,11 @@ void lzx_free(struct lzx_stream *lzx) { |
1576 | 1576 |
} while (0) |
1577 | 1577 |
|
1578 | 1578 |
static int qtm_read_input(struct qtm_stream *qtm) { |
1579 |
- int read = qtm->read ? qtm->read(qtm->file, &qtm->inbuf[0], (int)qtm->inbuf_size) : cli_readn(qtm->fd, &qtm->inbuf[0], (int)qtm->inbuf_size); |
|
1580 |
- if (read < 0) return qtm->error = CL_EIO; |
|
1579 |
+ int nread = qtm->read_cb ? qtm->read_cb(qtm->file, &qtm->inbuf[0], (int)qtm->inbuf_size) : cli_readn(qtm->fd, &qtm->inbuf[0], (int)qtm->inbuf_size); |
|
1580 |
+ if (nread < 0) return qtm->error = CL_EIO; |
|
1581 | 1581 |
|
1582 | 1582 |
qtm->i_ptr = &qtm->inbuf[0]; |
1583 |
- qtm->i_end = &qtm->inbuf[read]; |
|
1583 |
+ qtm->i_end = &qtm->inbuf[nread]; |
|
1584 | 1584 |
return CL_SUCCESS; |
1585 | 1585 |
} |
1586 | 1586 |
|
... | ... |
@@ -1688,7 +1688,7 @@ static void qtm_init_model(struct qtm_model *model, |
1688 | 1688 |
struct qtm_stream *qtm_init(int fd, int ofd, |
1689 | 1689 |
int window_bits, int input_buffer_size, |
1690 | 1690 |
struct cab_file *file, |
1691 |
- int (*read)(struct cab_file *, unsigned char *, int)) |
|
1691 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int)) |
|
1692 | 1692 |
{ |
1693 | 1693 |
unsigned int window_size = 1 << window_bits; |
1694 | 1694 |
struct qtm_stream *qtm; |
... | ... |
@@ -1768,7 +1768,7 @@ struct qtm_stream *qtm_init(int fd, int ofd, |
1768 | 1768 |
qtm_init_model(&qtm->model7, &qtm->m7sym[0], 0, 7); |
1769 | 1769 |
|
1770 | 1770 |
qtm->file = file; |
1771 |
- qtm->read = read; |
|
1771 |
+ qtm->read_cb = read_cb; |
|
1772 | 1772 |
|
1773 | 1773 |
/* all ok */ |
1774 | 1774 |
return qtm; |
... | ... |
@@ -82,7 +82,7 @@ struct mszip_stream { |
82 | 82 |
|
83 | 83 |
/* cabinet related stuff */ |
84 | 84 |
struct cab_file *file; |
85 |
- int (*read)(struct cab_file *, unsigned char *, int); |
|
85 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int); |
|
86 | 86 |
|
87 | 87 |
unsigned char wflag; /* write flag */ |
88 | 88 |
|
... | ... |
@@ -93,7 +93,7 @@ struct mszip_stream *mszip_init(int fd, |
93 | 93 |
int input_buffer_size, |
94 | 94 |
int repair_mode, |
95 | 95 |
struct cab_file *file, |
96 |
- int (*read)(struct cab_file *, unsigned char *, int)); |
|
96 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int)); |
|
97 | 97 |
|
98 | 98 |
extern int mszip_decompress(struct mszip_stream *zip, off_t out_bytes); |
99 | 99 |
|
... | ... |
@@ -167,7 +167,7 @@ struct qtm_stream { |
167 | 167 |
|
168 | 168 |
/* cabinet related stuff */ |
169 | 169 |
struct cab_file *file; |
170 |
- int (*read)(struct cab_file *, unsigned char *, int); |
|
170 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int); |
|
171 | 171 |
|
172 | 172 |
/* I/O buffers - 2*/ |
173 | 173 |
unsigned char *inbuf, *i_ptr, *i_end, *o_ptr, *o_end; |
... | ... |
@@ -181,7 +181,7 @@ extern struct qtm_stream *qtm_init(int fd, |
181 | 181 |
int window_bits, |
182 | 182 |
int input_buffer_size, |
183 | 183 |
struct cab_file *file, |
184 |
- int (*read)(struct cab_file *, unsigned char *, int)); |
|
184 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int)); |
|
185 | 185 |
|
186 | 186 |
extern int qtm_decompress(struct qtm_stream *qtm, off_t out_bytes); |
187 | 187 |
|
... | ... |
@@ -274,7 +274,7 @@ struct lzx_stream { |
274 | 274 |
|
275 | 275 |
/* cabinet related stuff */ |
276 | 276 |
struct cab_file *file; |
277 |
- int (*read)(struct cab_file *, unsigned char *, int); |
|
277 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int); |
|
278 | 278 |
|
279 | 279 |
unsigned char extra_bits[51]; |
280 | 280 |
|
... | ... |
@@ -287,7 +287,7 @@ struct lzx_stream *lzx_init(int fd, |
287 | 287 |
int input_buffer_size, |
288 | 288 |
off_t output_length, |
289 | 289 |
struct cab_file *file, |
290 |
- int (*read)(struct cab_file *, unsigned char *, int)); |
|
290 |
+ int (*read_cb)(struct cab_file *, unsigned char *, int)); |
|
291 | 291 |
|
292 | 292 |
extern void lzx_set_output_length(struct lzx_stream *lzx, |
293 | 293 |
off_t output_length); |