diff options
Diffstat (limited to 'rbutil/rbutilqt/mspack/cab.h')
-rw-r--r-- | rbutil/rbutilqt/mspack/cab.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/rbutil/rbutilqt/mspack/cab.h b/rbutil/rbutilqt/mspack/cab.h index 78ec8e60db..79d9951252 100644 --- a/rbutil/rbutilqt/mspack/cab.h +++ b/rbutil/rbutilqt/mspack/cab.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* This file is part of libmspack. | 1 | /* This file is part of libmspack. |
2 | * (C) 2003-2004 Stuart Caie. | 2 | * (C) 2003-2018 Stuart Caie. |
3 | * | 3 | * |
4 | * libmspack is free software; you can redistribute it and/or modify it under | 4 | * libmspack is free software; you can redistribute it and/or modify it under |
5 | * the terms of the GNU Lesser General Public License (LGPL) version 2.1 | 5 | * the terms of the GNU Lesser General Public License (LGPL) version 2.1 |
@@ -10,10 +10,6 @@ | |||
10 | #ifndef MSPACK_CAB_H | 10 | #ifndef MSPACK_CAB_H |
11 | #define MSPACK_CAB_H 1 | 11 | #define MSPACK_CAB_H 1 |
12 | 12 | ||
13 | #include "mszip.h" | ||
14 | #include "qtm.h" | ||
15 | #include "lzx.h" | ||
16 | |||
17 | /* generic CAB definitions */ | 13 | /* generic CAB definitions */ |
18 | 14 | ||
19 | /* structure offsets */ | 15 | /* structure offsets */ |
@@ -70,6 +66,22 @@ | |||
70 | #define CAB_BLOCKMAX (32768) | 66 | #define CAB_BLOCKMAX (32768) |
71 | #define CAB_INPUTMAX (CAB_BLOCKMAX+6144) | 67 | #define CAB_INPUTMAX (CAB_BLOCKMAX+6144) |
72 | 68 | ||
69 | /* input buffer needs to be CAB_INPUTMAX + 1 byte to allow for max-sized block | ||
70 | * plus 1 trailer byte added by cabd_sys_read_block() for Quantum alignment. | ||
71 | * | ||
72 | * When MSCABD_PARAM_SALVAGE is set, block size is not checked so can be | ||
73 | * up to 65535 bytes, so max input buffer size needed is 65535 + 1 | ||
74 | */ | ||
75 | #define CAB_INPUTMAX_SALVAGE (65535) | ||
76 | #define CAB_INPUTBUF (CAB_INPUTMAX_SALVAGE + 1) | ||
77 | |||
78 | /* There are no more than 65535 data blocks per folder, so a folder cannot | ||
79 | * be more than 32768*65535 bytes in length. As files cannot span more than | ||
80 | * one folder, this is also their max offset, length and offset+length limit. | ||
81 | */ | ||
82 | #define CAB_FOLDERMAX (65535) | ||
83 | #define CAB_LENGTHMAX (CAB_BLOCKMAX * CAB_FOLDERMAX) | ||
84 | |||
73 | /* CAB compression definitions */ | 85 | /* CAB compression definitions */ |
74 | 86 | ||
75 | struct mscab_compressor_p { | 87 | struct mscab_compressor_p { |
@@ -85,6 +97,7 @@ struct mscabd_decompress_state { | |||
85 | struct mscabd_folder_data *data; /* current folder split we're in */ | 97 | struct mscabd_folder_data *data; /* current folder split we're in */ |
86 | unsigned int offset; /* uncompressed offset within folder */ | 98 | unsigned int offset; /* uncompressed offset within folder */ |
87 | unsigned int block; /* which block are we decompressing? */ | 99 | unsigned int block; /* which block are we decompressing? */ |
100 | off_t outlen; /* cumulative sum of block output sizes */ | ||
88 | struct mspack_system sys; /* special I/O code for decompressor */ | 101 | struct mspack_system sys; /* special I/O code for decompressor */ |
89 | int comp_type; /* type of compression used by folder */ | 102 | int comp_type; /* type of compression used by folder */ |
90 | int (*decompress)(void *, off_t); /* decompressor code */ | 103 | int (*decompress)(void *, off_t); /* decompressor code */ |
@@ -93,14 +106,14 @@ struct mscabd_decompress_state { | |||
93 | struct mspack_file *infh; /* input file handle */ | 106 | struct mspack_file *infh; /* input file handle */ |
94 | struct mspack_file *outfh; /* output file handle */ | 107 | struct mspack_file *outfh; /* output file handle */ |
95 | unsigned char *i_ptr, *i_end; /* input data consumed, end */ | 108 | unsigned char *i_ptr, *i_end; /* input data consumed, end */ |
96 | unsigned char input[CAB_INPUTMAX]; /* one input block of data */ | 109 | unsigned char input[CAB_INPUTBUF]; /* one input block of data */ |
97 | }; | 110 | }; |
98 | 111 | ||
99 | struct mscab_decompressor_p { | 112 | struct mscab_decompressor_p { |
100 | struct mscab_decompressor base; | 113 | struct mscab_decompressor base; |
101 | struct mscabd_decompress_state *d; | 114 | struct mscabd_decompress_state *d; |
102 | struct mspack_system *system; | 115 | struct mspack_system *system; |
103 | int param[3]; /* !!! MATCH THIS TO NUM OF PARAMS IN MSPACK.H !!! */ | 116 | int buf_size, searchbuf_size, fix_mszip, salvage; /* params */ |
104 | int error, read_error; | 117 | int error, read_error; |
105 | }; | 118 | }; |
106 | 119 | ||