| 1 |
|
| |
| 2 |
|
| /*-------------------------------------------------------------*/ |
| 3 |
|
| /*--- Decompression machinery ---*/ |
| 4 |
|
| /*--- decompress.c ---*/ |
| 5 |
|
| /*-------------------------------------------------------------*/ |
| 6 |
|
| |
| 7 |
|
| /* ------------------------------------------------------------------ |
| 8 |
|
| This file is part of bzip2/libbzip2, a program and library for |
| 9 |
|
| lossless, block-sorting data compression. |
| 10 |
|
| |
| 11 |
|
| bzip2/libbzip2 version 1.0.8 of 13 July 2019 |
| 12 |
|
| Copyright (C) 1996-2019 Julian Seward <jseward@acm.org> |
| 13 |
|
| |
| 14 |
|
| Please read the WARNING, DISCLAIMER and PATENTS sections in the |
| 15 |
|
| README file. |
| 16 |
|
| |
| 17 |
|
| This program is released under the terms of the license contained |
| 18 |
|
| in the file LICENSE. |
| 19 |
|
| ------------------------------------------------------------------ */ |
| 20 |
|
| |
| 21 |
|
| |
| 22 |
|
| #include "bzlib_private.h" |
| 23 |
|
| |
| 24 |
|
| |
| 25 |
|
| /*---------------------------------------------------*/ |
| 26 |
|
| static |
| 27 |
29 |
| void makeMaps_d ( DState* s ) |
| 28 |
|
| { |
| 29 |
|
| Int32 i; |
| 30 |
29 |
| s->nInUse = 0; |
| 31 |
7453 |
▶ | for (i = 0; i < 256; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 256; i++) |
7424 |
29 |
7453 |
|
| 32 |
7424 |
▶ | if (s->inUse[i]) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->inUse[i]) { |
1400 |
6024 |
7424 |
|
| 33 |
1400 |
| s->seqToUnseq[s->nInUse] = i; |
| 34 |
1400 |
| s->nInUse++; |
| 35 |
|
| } |
| 36 |
29 |
| } |
| 37 |
|
| |
| 38 |
|
| |
| 39 |
|
| /*---------------------------------------------------*/ |
| 40 |
|
| #define RETURN(rrr) \ |
| 41 |
|
| { retVal = rrr; goto save_state_and_return; }; |
| 42 |
|
| |
| 43 |
|
| #define GET_BITS(lll,vvv,nnn) \ |
| 44 |
|
| /* FALLTHROUGH */ \ |
| 45 |
|
| case lll: s->state = lll; \ |
| 46 |
|
| while (True) { \ |
| 47 |
|
| if (s->bsLive >= nnn) { \ |
| 48 |
|
| UInt32 v; \ |
| 49 |
|
| v = (s->bsBuff >> \ |
| 50 |
|
| (s->bsLive-nnn)) & ((1 << nnn)-1); \ |
| 51 |
|
| s->bsLive -= nnn; \ |
| 52 |
|
| vvv = v; \ |
| 53 |
|
| break; \ |
| 54 |
|
| } \ |
| 55 |
|
| if (s->strm->avail_in == 0) RETURN(BZ_OK); \ |
| 56 |
|
| s->bsBuff \ |
| 57 |
|
| = (s->bsBuff << 8) | \ |
| 58 |
|
| ((UInt32) \ |
| 59 |
|
| (*((UChar*)(s->strm->next_in)))); \ |
| 60 |
|
| s->bsLive += 8; \ |
| 61 |
|
| s->strm->next_in++; \ |
| 62 |
|
| s->strm->avail_in--; \ |
| 63 |
|
| s->strm->total_in_lo32++; \ |
| 64 |
|
| if (s->strm->total_in_lo32 == 0) \ |
| 65 |
|
| s->strm->total_in_hi32++; \ |
| 66 |
|
| } |
| 67 |
|
| |
| 68 |
|
| #define GET_UCHAR(lll,uuu) \ |
| 69 |
|
| GET_BITS(lll,uuu,8) |
| 70 |
|
| |
| 71 |
|
| #define GET_BIT(lll,uuu) \ |
| 72 |
|
| GET_BITS(lll,uuu,1) |
| 73 |
|
| |
| 74 |
|
| /*---------------------------------------------------*/ |
| 75 |
|
| #define GET_MTF_VAL(label1,label2,lval) \ |
| 76 |
|
| { \ |
| 77 |
|
| if (groupPos == 0) { \ |
| 78 |
|
| groupNo++; \ |
| 79 |
|
| if (groupNo >= nSelectors) \ |
| 80 |
|
| RETURN(BZ_DATA_ERROR); \ |
| 81 |
|
| groupPos = BZ_G_SIZE; \ |
| 82 |
|
| gSel = s->selector[groupNo]; \ |
| 83 |
|
| gMinlen = s->minLens[gSel]; \ |
| 84 |
|
| gLimit = &(s->limit[gSel][0]); \ |
| 85 |
|
| gPerm = &(s->perm[gSel][0]); \ |
| 86 |
|
| gBase = &(s->base[gSel][0]); \ |
| 87 |
|
| } \ |
| 88 |
|
| groupPos--; \ |
| 89 |
|
| zn = gMinlen; \ |
| 90 |
|
| GET_BITS(label1, zvec, zn); \ |
| 91 |
|
| while (1) { \ |
| 92 |
|
| if (zn > 20 /* the longest code */) \ |
| 93 |
|
| RETURN(BZ_DATA_ERROR); \ |
| 94 |
|
| if (zvec <= gLimit[zn]) break; \ |
| 95 |
|
| zn++; \ |
| 96 |
|
| GET_BIT(label2, zj); \ |
| 97 |
|
| zvec = (zvec << 1) | zj; \ |
| 98 |
|
| }; \ |
| 99 |
|
| if (zvec - gBase[zn] < 0 \ |
| 100 |
|
| || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \ |
| 101 |
|
| RETURN(BZ_DATA_ERROR); \ |
| 102 |
|
| lval = gPerm[zvec - gBase[zn]]; \ |
| 103 |
|
| } |
| 104 |
|
| |
| 105 |
|
| |
| 106 |
|
| /*---------------------------------------------------*/ |
| 107 |
51135 |
| Int32 BZ2_decompress ( DState* s ) |
| 108 |
|
| { |
| 109 |
|
| UChar uc; |
| 110 |
|
| Int32 retVal; |
| 111 |
|
| Int32 minLen, maxLen; |
| 112 |
51135 |
| bz_stream* strm = s->strm; |
| 113 |
|
| |
| 114 |
|
| /* stuff that needs to be saved/restored */ |
| 115 |
|
| Int32 i; |
| 116 |
|
| Int32 j; |
| 117 |
|
| Int32 t; |
| 118 |
|
| Int32 alphaSize; |
| 119 |
|
| Int32 nGroups; |
| 120 |
|
| Int32 nSelectors; |
| 121 |
|
| Int32 EOB; |
| 122 |
|
| Int32 groupNo; |
| 123 |
|
| Int32 groupPos; |
| 124 |
|
| Int32 nextSym; |
| 125 |
|
| Int32 nblockMAX; |
| 126 |
|
| Int32 nblock; |
| 127 |
|
| Int32 es; |
| 128 |
|
| Int32 N; |
| 129 |
|
| Int32 curr; |
| 130 |
|
| Int32 zt; |
| 131 |
|
| Int32 zn; |
| 132 |
|
| Int32 zvec; |
| 133 |
|
| Int32 zj; |
| 134 |
|
| Int32 gSel; |
| 135 |
|
| Int32 gMinlen; |
| 136 |
|
| Int32* gLimit; |
| 137 |
|
| Int32* gBase; |
| 138 |
|
| Int32* gPerm; |
| 139 |
|
| |
| 140 |
51135 |
▶ | if (s->state == BZ_X_MAGIC_1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->state == BZ_X_MAGIC_1) { |
29 |
51106 |
51135 |
|
| 141 |
|
| /*initialise the save area*/ |
| 142 |
29 |
| s->save_i = 0; |
| 143 |
29 |
| s->save_j = 0; |
| 144 |
29 |
| s->save_t = 0; |
| 145 |
29 |
| s->save_alphaSize = 0; |
| 146 |
29 |
| s->save_nGroups = 0; |
| 147 |
29 |
| s->save_nSelectors = 0; |
| 148 |
29 |
| s->save_EOB = 0; |
| 149 |
29 |
| s->save_groupNo = 0; |
| 150 |
29 |
| s->save_groupPos = 0; |
| 151 |
29 |
| s->save_nextSym = 0; |
| 152 |
29 |
| s->save_nblockMAX = 0; |
| 153 |
29 |
| s->save_nblock = 0; |
| 154 |
29 |
| s->save_es = 0; |
| 155 |
29 |
| s->save_N = 0; |
| 156 |
29 |
| s->save_curr = 0; |
| 157 |
29 |
| s->save_zt = 0; |
| 158 |
29 |
| s->save_zn = 0; |
| 159 |
29 |
| s->save_zvec = 0; |
| 160 |
29 |
| s->save_zj = 0; |
| 161 |
29 |
| s->save_gSel = 0; |
| 162 |
29 |
| s->save_gMinlen = 0; |
| 163 |
29 |
| s->save_gLimit = NULL; |
| 164 |
29 |
| s->save_gBase = NULL; |
| 165 |
29 |
| s->save_gPerm = NULL; |
| 166 |
|
| } |
| 167 |
|
| |
| 168 |
|
| /*restore from the save area*/ |
| 169 |
51135 |
| i = s->save_i; |
| 170 |
51135 |
| j = s->save_j; |
| 171 |
51135 |
| t = s->save_t; |
| 172 |
51135 |
| alphaSize = s->save_alphaSize; |
| 173 |
51135 |
| nGroups = s->save_nGroups; |
| 174 |
51135 |
| nSelectors = s->save_nSelectors; |
| 175 |
51135 |
| EOB = s->save_EOB; |
| 176 |
51135 |
| groupNo = s->save_groupNo; |
| 177 |
51135 |
| groupPos = s->save_groupPos; |
| 178 |
51135 |
| nextSym = s->save_nextSym; |
| 179 |
51135 |
| nblockMAX = s->save_nblockMAX; |
| 180 |
51135 |
| nblock = s->save_nblock; |
| 181 |
51135 |
| es = s->save_es; |
| 182 |
51135 |
| N = s->save_N; |
| 183 |
51135 |
| curr = s->save_curr; |
| 184 |
51135 |
| zt = s->save_zt; |
| 185 |
51135 |
| zn = s->save_zn; |
| 186 |
51135 |
| zvec = s->save_zvec; |
| 187 |
51135 |
| zj = s->save_zj; |
| 188 |
51135 |
| gSel = s->save_gSel; |
| 189 |
51135 |
| gMinlen = s->save_gMinlen; |
| 190 |
51135 |
| gLimit = s->save_gLimit; |
| 191 |
51135 |
| gBase = s->save_gBase; |
| 192 |
51135 |
| gPerm = s->save_gPerm; |
| 193 |
|
| |
| 194 |
51135 |
| retVal = BZ_OK; |
| 195 |
|
| |
| 196 |
51135 |
| switch (s->state) { |
| 197 |
|
| |
| 198 |
58 |
▶ | GET_UCHAR(BZ_X_MAGIC_1, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_MAGIC_1, uc); |
29 |
29 |
58 |
| GET_UCHAR(BZ_X_MAGIC_1, uc); |
0 |
29 |
29 |
| GET_UCHAR(BZ_X_MAGIC_1, uc); |
0 |
29 |
29 |
|
| 199 |
29 |
▶ | if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC); |
0 |
29 |
29 |
|
| 200 |
|
| |
| 201 |
68 |
▶ | GET_UCHAR(BZ_X_MAGIC_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_MAGIC_2, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_MAGIC_2, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_MAGIC_2, uc); |
0 |
29 |
29 |
|
| 202 |
29 |
▶ | if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC); |
0 |
29 |
29 |
|
| 203 |
|
| |
| 204 |
70 |
▶ | GET_UCHAR(BZ_X_MAGIC_3, uc) |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_MAGIC_3, uc) |
29 |
41 |
70 |
| GET_UCHAR(BZ_X_MAGIC_3, uc) |
12 |
29 |
41 |
| GET_UCHAR(BZ_X_MAGIC_3, uc) |
0 |
29 |
29 |
|
| 205 |
29 |
▶ | if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); |
0 |
29 |
29 |
|
| 206 |
|
| |
| 207 |
68 |
▶ | GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) |
29 |
39 |
68 |
| GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) |
10 |
29 |
39 |
| GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) |
0 |
29 |
29 |
|
| 208 |
29 |
▶ | if (s->blockSize100k < (BZ_HDR_0 + 1) || |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->blockSize100k < (BZ_HDR_0 + 1) || |
29 |
0 |
29 |
|
| 209 |
29 |
▶ | s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); |
Branch: 1 branch
| Branch | True | False | Total |
| s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); |
0 |
29 |
29 |
|
| 210 |
29 |
| s->blockSize100k -= BZ_HDR_0; |
| 211 |
|
| |
| 212 |
29 |
▶ | if (s->smallDecompress) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->smallDecompress) { |
0 |
29 |
29 |
|
| 213 |
0 |
| s->ll16 = (UInt16*) BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); |
| 214 |
0 |
| s->ll4 = (UChar*) BZALLOC( |
| 215 |
|
| ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) |
| 216 |
|
| ); |
| 217 |
0 |
▶ | if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); |
Branch: 2 branches
| Branch | True | False | Total |
| if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); |
0 |
0 |
0 |
| if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); |
0 |
0 |
0 |
|
| 218 |
|
| } else { |
| 219 |
29 |
| s->tt = (UInt32*) BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) ); |
| 220 |
29 |
▶ | if (s->tt == NULL) RETURN(BZ_MEM_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->tt == NULL) RETURN(BZ_MEM_ERROR); |
0 |
29 |
29 |
|
| 221 |
|
| } |
| 222 |
|
| |
| 223 |
136 |
▶ | GET_UCHAR(BZ_X_BLKHDR_1, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BLKHDR_1, uc); |
58 |
78 |
136 |
| GET_UCHAR(BZ_X_BLKHDR_1, uc); |
20 |
58 |
78 |
| GET_UCHAR(BZ_X_BLKHDR_1, uc); |
0 |
58 |
58 |
|
| 224 |
|
| |
| 225 |
58 |
▶ | if (uc == 0x17) goto endhdr_2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc == 0x17) goto endhdr_2; |
29 |
29 |
58 |
|
| 226 |
29 |
▶ | if (uc != 0x31) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x31) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 227 |
68 |
▶ | GET_UCHAR(BZ_X_BLKHDR_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BLKHDR_2, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BLKHDR_2, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BLKHDR_2, uc); |
0 |
29 |
29 |
|
| 228 |
29 |
▶ | if (uc != 0x41) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x41) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 229 |
68 |
▶ | GET_UCHAR(BZ_X_BLKHDR_3, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BLKHDR_3, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BLKHDR_3, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BLKHDR_3, uc); |
0 |
29 |
29 |
|
| 230 |
29 |
▶ | if (uc != 0x59) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x59) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 231 |
68 |
▶ | GET_UCHAR(BZ_X_BLKHDR_4, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BLKHDR_4, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BLKHDR_4, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BLKHDR_4, uc); |
0 |
29 |
29 |
|
| 232 |
29 |
▶ | if (uc != 0x26) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x26) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 233 |
68 |
▶ | GET_UCHAR(BZ_X_BLKHDR_5, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BLKHDR_5, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BLKHDR_5, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BLKHDR_5, uc); |
0 |
29 |
29 |
|
| 234 |
29 |
▶ | if (uc != 0x53) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x53) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 235 |
68 |
▶ | GET_UCHAR(BZ_X_BLKHDR_6, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BLKHDR_6, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BLKHDR_6, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BLKHDR_6, uc); |
0 |
29 |
29 |
|
| 236 |
29 |
▶ | if (uc != 0x59) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x59) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 237 |
|
| |
| 238 |
29 |
| s->currBlockNo++; |
| 239 |
29 |
| if (s->verbosity >= 2) |
| 240 |
|
| VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); |
| 241 |
|
| |
| 242 |
29 |
| s->storedBlockCRC = 0; |
| 243 |
68 |
▶ | GET_UCHAR(BZ_X_BCRC_1, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BCRC_1, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BCRC_1, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BCRC_1, uc); |
0 |
29 |
29 |
|
| 244 |
29 |
| s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); |
| 245 |
68 |
▶ | GET_UCHAR(BZ_X_BCRC_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BCRC_2, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BCRC_2, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BCRC_2, uc); |
0 |
29 |
29 |
|
| 246 |
29 |
| s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); |
| 247 |
68 |
▶ | GET_UCHAR(BZ_X_BCRC_3, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BCRC_3, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BCRC_3, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BCRC_3, uc); |
0 |
29 |
29 |
|
| 248 |
29 |
| s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); |
| 249 |
68 |
▶ | GET_UCHAR(BZ_X_BCRC_4, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_BCRC_4, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_BCRC_4, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_BCRC_4, uc); |
0 |
29 |
29 |
|
| 250 |
29 |
| s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); |
| 251 |
|
| |
| 252 |
68 |
▶ | GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); |
29 |
39 |
68 |
| GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); |
10 |
29 |
39 |
| GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); |
0 |
29 |
29 |
|
| 253 |
|
| |
| 254 |
29 |
| s->origPtr = 0; |
| 255 |
68 |
▶ | GET_UCHAR(BZ_X_ORIGPTR_1, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ORIGPTR_1, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ORIGPTR_1, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ORIGPTR_1, uc); |
0 |
29 |
29 |
|
| 256 |
29 |
| s->origPtr = (s->origPtr << 8) | ((Int32)uc); |
| 257 |
68 |
▶ | GET_UCHAR(BZ_X_ORIGPTR_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ORIGPTR_2, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ORIGPTR_2, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ORIGPTR_2, uc); |
0 |
29 |
29 |
|
| 258 |
29 |
| s->origPtr = (s->origPtr << 8) | ((Int32)uc); |
| 259 |
68 |
▶ | GET_UCHAR(BZ_X_ORIGPTR_3, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ORIGPTR_3, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ORIGPTR_3, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ORIGPTR_3, uc); |
0 |
29 |
29 |
|
| 260 |
29 |
| s->origPtr = (s->origPtr << 8) | ((Int32)uc); |
| 261 |
|
| |
| 262 |
29 |
▶ | if (s->origPtr < 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->origPtr < 0) |
0 |
29 |
29 |
|
| 263 |
0 |
| RETURN(BZ_DATA_ERROR); |
| 264 |
29 |
▶ | if (s->origPtr > 10 + 100000*s->blockSize100k) |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->origPtr > 10 + 100000*s->blockSize100k) |
0 |
29 |
29 |
|
| 265 |
0 |
| RETURN(BZ_DATA_ERROR); |
| 266 |
|
| |
| 267 |
|
| /*--- Receive the mapping table ---*/ |
| 268 |
493 |
▶ | for (i = 0; i < 16; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 16; i++) { |
464 |
29 |
493 |
|
| 269 |
542 |
▶ | GET_BIT(BZ_X_MAPPING_1, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BIT(BZ_X_MAPPING_1, uc); |
464 |
78 |
542 |
| GET_BIT(BZ_X_MAPPING_1, uc); |
20 |
58 |
78 |
| GET_BIT(BZ_X_MAPPING_1, uc); |
0 |
58 |
58 |
|
| 270 |
464 |
▶ | if (uc == 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc == 1) |
180 |
284 |
464 |
|
| 271 |
180 |
| s->inUse16[i] = True; else |
| 272 |
284 |
| s->inUse16[i] = False; |
| 273 |
|
| } |
| 274 |
|
| |
| 275 |
7453 |
▶ | for (i = 0; i < 256; i++) s->inUse[i] = False; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 256; i++) s->inUse[i] = False; |
7424 |
29 |
7453 |
|
| 276 |
|
| |
| 277 |
493 |
▶ | for (i = 0; i < 16; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < 16; i++) |
464 |
29 |
493 |
|
| 278 |
464 |
▶ | if (s->inUse16[i]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->inUse16[i]) |
180 |
284 |
464 |
|
| 279 |
3060 |
▶ | for (j = 0; j < 16; j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j < 16; j++) { |
2880 |
180 |
3060 |
|
| 280 |
3354 |
▶ | GET_BIT(BZ_X_MAPPING_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BIT(BZ_X_MAPPING_2, uc); |
2880 |
474 |
3354 |
| GET_BIT(BZ_X_MAPPING_2, uc); |
114 |
360 |
474 |
| GET_BIT(BZ_X_MAPPING_2, uc); |
0 |
360 |
360 |
|
| 281 |
2880 |
▶ | if (uc == 1) s->inUse[i * 16 + j] = True; |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc == 1) s->inUse[i * 16 + j] = True; |
1400 |
1480 |
2880 |
|
| 282 |
|
| } |
| 283 |
29 |
| makeMaps_d ( s ); |
| 284 |
29 |
▶ | if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 285 |
29 |
| alphaSize = s->nInUse+2; |
| 286 |
|
| |
| 287 |
|
| /*--- Now the selectors ---*/ |
| 288 |
29 |
▶ | GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); |
29 |
0 |
29 |
| GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); |
0 |
0 |
0 |
| GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); |
0 |
0 |
0 |
|
| 289 |
29 |
▶ | if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR); |
Branch: 2 branches
| Branch | True | False | Total |
| if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR); |
29 |
0 |
29 |
| if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 290 |
107 |
▶ | GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); |
29 |
78 |
107 |
| GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); |
20 |
58 |
78 |
| GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); |
0 |
58 |
58 |
|
| 291 |
29 |
▶ | if (nSelectors < 1) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (nSelectors < 1) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 292 |
2289 |
▶ | for (i = 0; i < nSelectors; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < nSelectors; i++) { |
2260 |
29 |
2289 |
|
| 293 |
2260 |
| j = 0; |
| 294 |
|
| while (True) { |
| 295 |
8966 |
▶ | GET_BIT(BZ_X_SELECTOR_3, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BIT(BZ_X_SELECTOR_3, uc); |
7590 |
1376 |
8966 |
| GET_BIT(BZ_X_SELECTOR_3, uc); |
428 |
948 |
1376 |
| GET_BIT(BZ_X_SELECTOR_3, uc); |
0 |
948 |
948 |
|
| 296 |
7590 |
▶ | if (uc == 0) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc == 0) break; |
2260 |
5330 |
7590 |
|
| 297 |
5330 |
| j++; |
| 298 |
5330 |
▶ | if (j >= nGroups) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (j >= nGroups) RETURN(BZ_DATA_ERROR); |
0 |
5330 |
5330 |
|
| 299 |
|
| } |
| 300 |
|
| /* Having more than BZ_MAX_SELECTORS doesn't make much sense |
| 301 |
|
| since they will never be used, but some implementations might |
| 302 |
|
| "round up" the number of selectors, so just ignore those. */ |
| 303 |
2260 |
▶ | if (i < BZ_MAX_SELECTORS) |
Branch: 1 branch
| Branch | True | False | Total |
| if (i < BZ_MAX_SELECTORS) |
2260 |
0 |
2260 |
|
| 304 |
2260 |
| s->selectorMtf[i] = j; |
| 305 |
|
| } |
| 306 |
29 |
▶ | if (nSelectors > BZ_MAX_SELECTORS) |
Branch: 1 branch
| Branch | True | False | Total |
| if (nSelectors > BZ_MAX_SELECTORS) |
0 |
29 |
29 |
|
| 307 |
0 |
| nSelectors = BZ_MAX_SELECTORS; |
| 308 |
|
| |
| 309 |
|
| /*--- Undo the MTF values for the selectors. ---*/ |
| 310 |
|
| { |
| 311 |
|
| UChar pos[BZ_N_GROUPS], tmp, v; |
| 312 |
110 |
▶ | for (v = 0; v < nGroups; v++) pos[v] = v; |
Branch: 1 branch
| Branch | True | False | Total |
| for (v = 0; v < nGroups; v++) pos[v] = v; |
81 |
29 |
110 |
|
| 313 |
|
| |
| 314 |
2289 |
▶ | for (i = 0; i < nSelectors; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < nSelectors; i++) { |
2260 |
29 |
2289 |
|
| 315 |
2260 |
| v = s->selectorMtf[i]; |
| 316 |
2260 |
| tmp = pos[v]; |
| 317 |
7590 |
▶ | while (v > 0) { pos[v] = pos[v-1]; v--; } |
Branch: 1 branch
| Branch | True | False | Total |
| while (v > 0) { pos[v] = pos[v-1]; v--; } |
5330 |
2260 |
7590 |
|
| 318 |
2260 |
| pos[0] = tmp; |
| 319 |
2260 |
| s->selector[i] = tmp; |
| 320 |
|
| } |
| 321 |
|
| } |
| 322 |
|
| |
| 323 |
|
| /*--- Now the coding tables ---*/ |
| 324 |
110 |
▶ | for (t = 0; t < nGroups; t++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (t = 0; t < nGroups; t++) { |
81 |
29 |
110 |
|
| 325 |
136 |
▶ | GET_BITS(BZ_X_CODING_1, curr, 5); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BITS(BZ_X_CODING_1, curr, 5); |
81 |
55 |
136 |
| GET_BITS(BZ_X_CODING_1, curr, 5); |
13 |
42 |
55 |
| GET_BITS(BZ_X_CODING_1, curr, 5); |
0 |
42 |
42 |
|
| 326 |
7235 |
▶ | for (i = 0; i < alphaSize; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < alphaSize; i++) { |
7154 |
81 |
7235 |
|
| 327 |
|
| while (True) { |
| 328 |
11468 |
▶ | if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); |
Branch: 2 branches
| Branch | True | False | Total |
| if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); |
11468 |
0 |
11468 |
| if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); |
0 |
11468 |
11468 |
|
| 329 |
13217 |
▶ | GET_BIT(BZ_X_CODING_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BIT(BZ_X_CODING_2, uc); |
11468 |
1749 |
13217 |
| GET_BIT(BZ_X_CODING_2, uc); |
325 |
1424 |
1749 |
| GET_BIT(BZ_X_CODING_2, uc); |
0 |
1424 |
1424 |
|
| 330 |
11468 |
▶ | if (uc == 0) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc == 0) break; |
7154 |
4314 |
11468 |
|
| 331 |
4974 |
▶ | GET_BIT(BZ_X_CODING_3, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_BIT(BZ_X_CODING_3, uc); |
4314 |
660 |
4974 |
| GET_BIT(BZ_X_CODING_3, uc); |
106 |
554 |
660 |
| GET_BIT(BZ_X_CODING_3, uc); |
0 |
554 |
554 |
|
| 332 |
4314 |
▶ | if (uc == 0) curr++; else curr--; |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc == 0) curr++; else curr--; |
2205 |
2109 |
4314 |
|
| 333 |
|
| } |
| 334 |
7154 |
| s->len[t][i] = curr; |
| 335 |
|
| } |
| 336 |
|
| } |
| 337 |
|
| |
| 338 |
|
| /*--- Create the Huffman decoding tables ---*/ |
| 339 |
110 |
▶ | for (t = 0; t < nGroups; t++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (t = 0; t < nGroups; t++) { |
81 |
29 |
110 |
|
| 340 |
81 |
| minLen = 32; |
| 341 |
81 |
| maxLen = 0; |
| 342 |
7235 |
▶ | for (i = 0; i < alphaSize; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < alphaSize; i++) { |
7154 |
81 |
7235 |
|
| 343 |
7154 |
▶ | if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; |
122 |
7032 |
7154 |
|
| 344 |
7154 |
▶ | if (s->len[t][i] < minLen) minLen = s->len[t][i]; |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->len[t][i] < minLen) minLen = s->len[t][i]; |
186 |
6968 |
7154 |
|
| 345 |
|
| } |
| 346 |
81 |
| BZ2_hbCreateDecodeTables ( |
| 347 |
|
| &(s->limit[t][0]), |
| 348 |
|
| &(s->base[t][0]), |
| 349 |
|
| &(s->perm[t][0]), |
| 350 |
|
| &(s->len[t][0]), |
| 351 |
|
| minLen, maxLen, alphaSize |
| 352 |
|
| ); |
| 353 |
81 |
| s->minLens[t] = minLen; |
| 354 |
|
| } |
| 355 |
|
| |
| 356 |
|
| /*--- Now the MTF values ---*/ |
| 357 |
|
| |
| 358 |
29 |
| EOB = s->nInUse+1; |
| 359 |
29 |
| nblockMAX = 100000 * s->blockSize100k; |
| 360 |
29 |
| groupNo = -1; |
| 361 |
29 |
| groupPos = 0; |
| 362 |
|
| |
| 363 |
7453 |
▶ | for (i = 0; i <= 255; i++) s->unzftab[i] = 0; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= 255; i++) s->unzftab[i] = 0; |
7424 |
29 |
7453 |
|
| 364 |
|
| |
| 365 |
|
| /*-- MTF init --*/ |
| 366 |
|
| { |
| 367 |
|
| Int32 ii, jj, kk; |
| 368 |
29 |
| kk = MTFA_SIZE-1; |
| 369 |
493 |
▶ | for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { |
464 |
29 |
493 |
|
| 370 |
7888 |
▶ | for (jj = MTFL_SIZE-1; jj >= 0; jj--) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (jj = MTFL_SIZE-1; jj >= 0; jj--) { |
7424 |
464 |
7888 |
|
| 371 |
7424 |
| s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj); |
| 372 |
7424 |
| kk--; |
| 373 |
|
| } |
| 374 |
464 |
| s->mtfbase[ii] = kk + 1; |
| 375 |
|
| } |
| 376 |
|
| } |
| 377 |
|
| /*-- end MTF init --*/ |
| 378 |
|
| |
| 379 |
29 |
| nblock = 0; |
| 380 |
80 |
▶ | GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
Branch: 12 branches
| Branch | True | False | Total |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
29 |
0 |
29 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
0 |
29 |
29 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
29 |
12 |
41 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
1 |
11 |
12 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
0 |
11 |
11 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
0 |
67 |
67 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
29 |
38 |
67 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
38 |
1 |
39 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
0 |
1 |
1 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
0 |
1 |
1 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
29 |
0 |
29 |
| GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); |
0 |
29 |
29 |
|
| 381 |
|
| |
| 382 |
|
| while (True) { |
| 383 |
|
| |
| 384 |
110713 |
▶ | if (nextSym == EOB) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if (nextSym == EOB) break; |
29 |
110684 |
110713 |
|
| 385 |
|
| |
| 386 |
110684 |
▶ | if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { |
110231 |
453 |
110684 |
| if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { |
167 |
110064 |
110231 |
|
| 387 |
|
| |
| 388 |
620 |
| es = -1; |
| 389 |
620 |
| N = 1; |
| 390 |
|
| do { |
| 391 |
|
| /* Check that N doesn't get too big, so that es doesn't |
| 392 |
|
| go negative. The maximum value that can be |
| 393 |
|
| RUNA/RUNB encoded is equal to the block size (post |
| 394 |
|
| the initial RLE), viz, 900k, so bounding N at 2 |
| 395 |
|
| million should guard against overflow without |
| 396 |
|
| rejecting any legitimate inputs. */ |
| 397 |
2044 |
▶ | if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); |
0 |
2044 |
2044 |
|
| 398 |
2044 |
▶ | if (nextSym == BZ_RUNA) es = es + (0+1) * N; else |
Branch: 1 branch
| Branch | True | False | Total |
| if (nextSym == BZ_RUNA) es = es + (0+1) * N; else |
1063 |
981 |
2044 |
|
| 399 |
981 |
▶ | if (nextSym == BZ_RUNB) es = es + (1+1) * N; |
Branch: 1 branch
| Branch | True | False | Total |
| if (nextSym == BZ_RUNB) es = es + (1+1) * N; |
981 |
0 |
981 |
|
| 400 |
2044 |
| N = N * 2; |
| 401 |
4890 |
▶ | GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
Branch: 12 branches
| Branch | True | False | Total |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
43 |
2001 |
2044 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
0 |
43 |
43 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
2044 |
732 |
2776 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
170 |
562 |
732 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
0 |
562 |
562 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
0 |
3880 |
3880 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
2044 |
1836 |
3880 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
1836 |
278 |
2114 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
26 |
252 |
278 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
0 |
252 |
252 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
2044 |
0 |
2044 |
| GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); |
0 |
2044 |
2044 |
|
| 402 |
|
| } |
| 403 |
2044 |
▶ | while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); |
Branch: 2 branches
| Branch | True | False | Total |
| while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); |
610 |
1434 |
2044 |
| while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); |
814 |
620 |
1434 |
|
| 404 |
|
| |
| 405 |
620 |
| es++; |
| 406 |
620 |
| uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ]; |
| 407 |
620 |
| s->unzftab[uc] += es; |
| 408 |
|
| |
| 409 |
620 |
▶ | if (s->smallDecompress) |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->smallDecompress) |
0 |
620 |
620 |
|
| 410 |
0 |
▶ | while (es > 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (es > 0) { |
0 |
0 |
0 |
|
| 411 |
0 |
▶ | if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); |
0 |
0 |
0 |
|
| 412 |
0 |
| s->ll16[nblock] = (UInt16)uc; |
| 413 |
0 |
| nblock++; |
| 414 |
0 |
| es--; |
| 415 |
|
| } |
| 416 |
|
| else |
| 417 |
354119 |
▶ | while (es > 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (es > 0) { |
353499 |
620 |
354119 |
|
| 418 |
353499 |
▶ | if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); |
0 |
353499 |
353499 |
|
| 419 |
353499 |
| s->tt[nblock] = (UInt32)uc; |
| 420 |
353499 |
| nblock++; |
| 421 |
353499 |
| es--; |
| 422 |
|
| }; |
| 423 |
|
| |
| 424 |
620 |
| continue; |
| 425 |
|
| |
| 426 |
|
| } else { |
| 427 |
|
| |
| 428 |
110064 |
▶ | if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); |
0 |
110064 |
110064 |
|
| 429 |
|
| |
| 430 |
|
| /*-- uc = MTF ( nextSym-1 ) --*/ |
| 431 |
|
| { |
| 432 |
|
| Int32 ii, jj, kk, pp, lno, off; |
| 433 |
|
| UInt32 nn; |
| 434 |
110064 |
| nn = (UInt32)(nextSym - 1); |
| 435 |
|
| |
| 436 |
110064 |
▶ | if (nn < MTFL_SIZE) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (nn < MTFL_SIZE) { |
7017 |
103047 |
110064 |
|
| 437 |
|
| /* avoid general-case expense */ |
| 438 |
7017 |
| pp = s->mtfbase[0]; |
| 439 |
7017 |
| uc = s->mtfa[pp+nn]; |
| 440 |
18569 |
▶ | while (nn > 3) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (nn > 3) { |
11552 |
7017 |
18569 |
|
| 441 |
11552 |
| Int32 z = pp+nn; |
| 442 |
11552 |
| s->mtfa[(z) ] = s->mtfa[(z)-1]; |
| 443 |
11552 |
| s->mtfa[(z)-1] = s->mtfa[(z)-2]; |
| 444 |
11552 |
| s->mtfa[(z)-2] = s->mtfa[(z)-3]; |
| 445 |
11552 |
| s->mtfa[(z)-3] = s->mtfa[(z)-4]; |
| 446 |
11552 |
| nn -= 4; |
| 447 |
|
| } |
| 448 |
18296 |
▶ | while (nn > 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (nn > 0) { |
11279 |
7017 |
18296 |
|
| 449 |
11279 |
| s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; |
| 450 |
|
| }; |
| 451 |
7017 |
| s->mtfa[pp] = uc; |
| 452 |
|
| } else { |
| 453 |
|
| /* general case */ |
| 454 |
103047 |
| lno = nn / MTFL_SIZE; |
| 455 |
103047 |
| off = nn % MTFL_SIZE; |
| 456 |
103047 |
| pp = s->mtfbase[lno] + off; |
| 457 |
103047 |
| uc = s->mtfa[pp]; |
| 458 |
871798 |
▶ | while (pp > s->mtfbase[lno]) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (pp > s->mtfbase[lno]) { |
768751 |
103047 |
871798 |
|
| 459 |
768751 |
| s->mtfa[pp] = s->mtfa[pp-1]; pp--; |
| 460 |
|
| }; |
| 461 |
103047 |
| s->mtfbase[lno]++; |
| 462 |
920885 |
▶ | while (lno > 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (lno > 0) { |
817838 |
103047 |
920885 |
|
| 463 |
817838 |
| s->mtfbase[lno]--; |
| 464 |
817838 |
| s->mtfa[s->mtfbase[lno]] |
| 465 |
817838 |
| = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; |
| 466 |
817838 |
| lno--; |
| 467 |
|
| } |
| 468 |
103047 |
| s->mtfbase[0]--; |
| 469 |
103047 |
| s->mtfa[s->mtfbase[0]] = uc; |
| 470 |
103047 |
▶ | if (s->mtfbase[0] == 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->mtfbase[0] == 0) { |
26 |
103021 |
103047 |
|
| 471 |
26 |
| kk = MTFA_SIZE-1; |
| 472 |
442 |
▶ | for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { |
416 |
26 |
442 |
|
| 473 |
7072 |
▶ | for (jj = MTFL_SIZE-1; jj >= 0; jj--) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (jj = MTFL_SIZE-1; jj >= 0; jj--) { |
6656 |
416 |
7072 |
|
| 474 |
6656 |
| s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; |
| 475 |
6656 |
| kk--; |
| 476 |
|
| } |
| 477 |
416 |
| s->mtfbase[ii] = kk + 1; |
| 478 |
|
| } |
| 479 |
|
| } |
| 480 |
|
| } |
| 481 |
|
| } |
| 482 |
|
| /*-- end uc = MTF ( nextSym-1 ) --*/ |
| 483 |
|
| |
| 484 |
110064 |
| s->unzftab[s->seqToUnseq[uc]]++; |
| 485 |
110064 |
▶ | if (s->smallDecompress) |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->smallDecompress) |
0 |
110064 |
110064 |
|
| 486 |
0 |
| s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else |
| 487 |
110064 |
| s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]); |
| 488 |
110064 |
| nblock++; |
| 489 |
|
| |
| 490 |
376805 |
▶ | GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
Branch: 12 branches
| Branch | True | False | Total |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
2188 |
107876 |
110064 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
0 |
2188 |
2188 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
110064 |
140133 |
250197 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
44063 |
96070 |
140133 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
0 |
96070 |
96070 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
0 |
218343 |
218343 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
110064 |
108279 |
218343 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
108279 |
18329 |
126608 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
5519 |
12810 |
18329 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
0 |
12810 |
12810 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
110064 |
0 |
110064 |
| GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); |
0 |
110064 |
110064 |
|
| 491 |
110064 |
| continue; |
| 492 |
|
| } |
| 493 |
|
| } |
| 494 |
|
| |
| 495 |
|
| /* Now we know what nblock is, we can do a better sanity |
| 496 |
|
| check on s->origPtr. |
| 497 |
|
| */ |
| 498 |
29 |
▶ | if (s->origPtr < 0 || s->origPtr >= nblock) |
Branch: 2 branches
| Branch | True | False | Total |
| if (s->origPtr < 0 || s->origPtr >= nblock) |
29 |
0 |
29 |
| if (s->origPtr < 0 || s->origPtr >= nblock) |
0 |
29 |
29 |
|
| 499 |
0 |
| RETURN(BZ_DATA_ERROR); |
| 500 |
|
| |
| 501 |
|
| /*-- Set up cftab to facilitate generation of T^(-1) --*/ |
| 502 |
|
| /* Check: unzftab entries in range. */ |
| 503 |
7453 |
▶ | for (i = 0; i <= 255; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= 255; i++) { |
7424 |
29 |
7453 |
|
| 504 |
7424 |
▶ | if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) |
Branch: 2 branches
| Branch | True | False | Total |
| if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) |
7424 |
0 |
7424 |
| if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) |
0 |
7424 |
7424 |
|
| 505 |
0 |
| RETURN(BZ_DATA_ERROR); |
| 506 |
|
| } |
| 507 |
|
| /* Actually generate cftab. */ |
| 508 |
29 |
| s->cftab[0] = 0; |
| 509 |
7453 |
▶ | for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; |
7424 |
29 |
7453 |
|
| 510 |
7453 |
▶ | for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; |
7424 |
29 |
7453 |
|
| 511 |
|
| /* Check: cftab entries in range. */ |
| 512 |
7482 |
▶ | for (i = 0; i <= 256; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= 256; i++) { |
7453 |
29 |
7482 |
|
| 513 |
7453 |
▶ | if (s->cftab[i] < 0 || s->cftab[i] > nblock) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (s->cftab[i] < 0 || s->cftab[i] > nblock) { |
7453 |
0 |
7453 |
| if (s->cftab[i] < 0 || s->cftab[i] > nblock) { |
0 |
7453 |
7453 |
|
| 514 |
|
| /* s->cftab[i] can legitimately be == nblock */ |
| 515 |
0 |
| RETURN(BZ_DATA_ERROR); |
| 516 |
|
| } |
| 517 |
|
| } |
| 518 |
|
| /* Check: cftab entries non-descending. */ |
| 519 |
7453 |
▶ | for (i = 1; i <= 256; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i <= 256; i++) { |
7424 |
29 |
7453 |
|
| 520 |
7424 |
▶ | if (s->cftab[i-1] > s->cftab[i]) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->cftab[i-1] > s->cftab[i]) { |
0 |
7424 |
7424 |
|
| 521 |
0 |
| RETURN(BZ_DATA_ERROR); |
| 522 |
|
| } |
| 523 |
|
| } |
| 524 |
|
| |
| 525 |
29 |
| s->state_out_len = 0; |
| 526 |
29 |
| s->state_out_ch = 0; |
| 527 |
29 |
| BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); |
| 528 |
29 |
| s->state = BZ_X_OUTPUT; |
| 529 |
29 |
| if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); |
| 530 |
|
| |
| 531 |
29 |
▶ | if (s->smallDecompress) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->smallDecompress) { |
0 |
29 |
29 |
|
| 532 |
|
| |
| 533 |
|
| /*-- Make a copy of cftab, used in generation of T --*/ |
| 534 |
0 |
▶ | for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; |
0 |
0 |
0 |
|
| 535 |
|
| |
| 536 |
|
| /*-- compute the T vector --*/ |
| 537 |
0 |
▶ | for (i = 0; i < nblock; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < nblock; i++) { |
0 |
0 |
0 |
|
| 538 |
0 |
| uc = (UChar)(s->ll16[i]); |
| 539 |
0 |
▶ | SET_LL(i, s->cftabCopy[uc]); |
Branch: 1 branch
| Branch | True | False | Total |
| SET_LL(i, s->cftabCopy[uc]); |
0 |
0 |
0 |
|
| 540 |
0 |
| s->cftabCopy[uc]++; |
| 541 |
|
| } |
| 542 |
|
| |
| 543 |
|
| /*-- Compute T^(-1) by pointer reversal on T --*/ |
| 544 |
0 |
| i = s->origPtr; |
| 545 |
0 |
| j = GET_LL(i); |
| 546 |
|
| do { |
| 547 |
0 |
| Int32 tmp = GET_LL(j); |
| 548 |
0 |
▶ | SET_LL(j, i); |
Branch: 1 branch
| Branch | True | False | Total |
| SET_LL(j, i); |
0 |
0 |
0 |
|
| 549 |
0 |
| i = j; |
| 550 |
0 |
| j = tmp; |
| 551 |
|
| } |
| 552 |
0 |
▶ | while (i != s->origPtr); |
Branch: 1 branch
| Branch | True | False | Total |
| while (i != s->origPtr); |
0 |
0 |
0 |
|
| 553 |
|
| |
| 554 |
0 |
| s->tPos = s->origPtr; |
| 555 |
0 |
| s->nblock_used = 0; |
| 556 |
0 |
▶ | if (s->blockRandomised) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->blockRandomised) { |
0 |
0 |
0 |
|
| 557 |
0 |
| BZ_RAND_INIT_MASK; |
| 558 |
0 |
▶ | BZ_GET_SMALL(s->k0); s->nblock_used++; |
Branch: 1 branch
| Branch | True | False | Total |
| BZ_GET_SMALL(s->k0); s->nblock_used++; |
0 |
0 |
0 |
|
| 559 |
0 |
▶ | BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; |
Branch: 2 branches
| Branch | True | False | Total |
| BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; |
0 |
0 |
0 |
| BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; |
0 |
0 |
0 |
|
| 560 |
|
| } else { |
| 561 |
0 |
▶ | BZ_GET_SMALL(s->k0); s->nblock_used++; |
Branch: 1 branch
| Branch | True | False | Total |
| BZ_GET_SMALL(s->k0); s->nblock_used++; |
0 |
0 |
0 |
|
| 562 |
|
| } |
| 563 |
|
| |
| 564 |
|
| } else { |
| 565 |
|
| |
| 566 |
|
| /*-- compute the T^(-1) vector --*/ |
| 567 |
463592 |
▶ | for (i = 0; i < nblock; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < nblock; i++) { |
463563 |
29 |
463592 |
|
| 568 |
463563 |
| uc = (UChar)(s->tt[i] & 0xff); |
| 569 |
463563 |
| s->tt[s->cftab[uc]] |= (i << 8); |
| 570 |
463563 |
| s->cftab[uc]++; |
| 571 |
|
| } |
| 572 |
|
| |
| 573 |
29 |
| s->tPos = s->tt[s->origPtr] >> 8; |
| 574 |
29 |
| s->nblock_used = 0; |
| 575 |
29 |
▶ | if (s->blockRandomised) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->blockRandomised) { |
0 |
29 |
29 |
|
| 576 |
0 |
| BZ_RAND_INIT_MASK; |
| 577 |
0 |
▶ | BZ_GET_FAST(s->k0); s->nblock_used++; |
Branch: 1 branch
| Branch | True | False | Total |
| BZ_GET_FAST(s->k0); s->nblock_used++; |
0 |
0 |
0 |
|
| 578 |
0 |
▶ | BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; |
Branch: 2 branches
| Branch | True | False | Total |
| BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; |
0 |
0 |
0 |
| BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; |
0 |
0 |
0 |
|
| 579 |
|
| } else { |
| 580 |
29 |
▶ | BZ_GET_FAST(s->k0); s->nblock_used++; |
Branch: 1 branch
| Branch | True | False | Total |
| BZ_GET_FAST(s->k0); s->nblock_used++; |
0 |
29 |
29 |
|
| 581 |
|
| } |
| 582 |
|
| |
| 583 |
|
| } |
| 584 |
|
| |
| 585 |
29 |
| RETURN(BZ_OK); |
| 586 |
|
| |
| 587 |
|
| |
| 588 |
|
| |
| 589 |
29 |
| endhdr_2: |
| 590 |
|
| |
| 591 |
68 |
▶ | GET_UCHAR(BZ_X_ENDHDR_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ENDHDR_2, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ENDHDR_2, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ENDHDR_2, uc); |
0 |
29 |
29 |
|
| 592 |
29 |
▶ | if (uc != 0x72) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x72) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 593 |
68 |
▶ | GET_UCHAR(BZ_X_ENDHDR_3, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ENDHDR_3, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ENDHDR_3, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ENDHDR_3, uc); |
0 |
29 |
29 |
|
| 594 |
29 |
▶ | if (uc != 0x45) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x45) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 595 |
68 |
▶ | GET_UCHAR(BZ_X_ENDHDR_4, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ENDHDR_4, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ENDHDR_4, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ENDHDR_4, uc); |
0 |
29 |
29 |
|
| 596 |
29 |
▶ | if (uc != 0x38) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x38) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 597 |
68 |
▶ | GET_UCHAR(BZ_X_ENDHDR_5, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ENDHDR_5, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ENDHDR_5, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ENDHDR_5, uc); |
0 |
29 |
29 |
|
| 598 |
29 |
▶ | if (uc != 0x50) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x50) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 599 |
68 |
▶ | GET_UCHAR(BZ_X_ENDHDR_6, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_ENDHDR_6, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_ENDHDR_6, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_ENDHDR_6, uc); |
0 |
29 |
29 |
|
| 600 |
29 |
▶ | if (uc != 0x90) RETURN(BZ_DATA_ERROR); |
Branch: 1 branch
| Branch | True | False | Total |
| if (uc != 0x90) RETURN(BZ_DATA_ERROR); |
0 |
29 |
29 |
|
| 601 |
|
| |
| 602 |
29 |
| s->storedCombinedCRC = 0; |
| 603 |
68 |
▶ | GET_UCHAR(BZ_X_CCRC_1, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_CCRC_1, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_CCRC_1, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_CCRC_1, uc); |
0 |
29 |
29 |
|
| 604 |
29 |
| s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); |
| 605 |
68 |
▶ | GET_UCHAR(BZ_X_CCRC_2, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_CCRC_2, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_CCRC_2, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_CCRC_2, uc); |
0 |
29 |
29 |
|
| 606 |
29 |
| s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); |
| 607 |
68 |
▶ | GET_UCHAR(BZ_X_CCRC_3, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_CCRC_3, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_CCRC_3, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_CCRC_3, uc); |
0 |
29 |
29 |
|
| 608 |
29 |
| s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); |
| 609 |
68 |
▶ | GET_UCHAR(BZ_X_CCRC_4, uc); |
Branch: 3 branches
| Branch | True | False | Total |
| GET_UCHAR(BZ_X_CCRC_4, uc); |
29 |
39 |
68 |
| GET_UCHAR(BZ_X_CCRC_4, uc); |
10 |
29 |
39 |
| GET_UCHAR(BZ_X_CCRC_4, uc); |
0 |
29 |
29 |
|
| 610 |
29 |
| s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); |
| 611 |
|
| |
| 612 |
29 |
| s->state = BZ_X_IDLE; |
| 613 |
29 |
| RETURN(BZ_STREAM_END); |
| 614 |
|
| |
| 615 |
0 |
| default: AssertH ( False, 4001 ); |
| 616 |
|
| } |
| 617 |
|
| |
| 618 |
0 |
| AssertH ( False, 4002 ); |
| 619 |
|
| |
| 620 |
51135 |
| save_state_and_return: |
| 621 |
|
| |
| 622 |
51135 |
| s->save_i = i; |
| 623 |
51135 |
| s->save_j = j; |
| 624 |
51135 |
| s->save_t = t; |
| 625 |
51135 |
| s->save_alphaSize = alphaSize; |
| 626 |
51135 |
| s->save_nGroups = nGroups; |
| 627 |
51135 |
| s->save_nSelectors = nSelectors; |
| 628 |
51135 |
| s->save_EOB = EOB; |
| 629 |
51135 |
| s->save_groupNo = groupNo; |
| 630 |
51135 |
| s->save_groupPos = groupPos; |
| 631 |
51135 |
| s->save_nextSym = nextSym; |
| 632 |
51135 |
| s->save_nblockMAX = nblockMAX; |
| 633 |
51135 |
| s->save_nblock = nblock; |
| 634 |
51135 |
| s->save_es = es; |
| 635 |
51135 |
| s->save_N = N; |
| 636 |
51135 |
| s->save_curr = curr; |
| 637 |
51135 |
| s->save_zt = zt; |
| 638 |
51135 |
| s->save_zn = zn; |
| 639 |
51135 |
| s->save_zvec = zvec; |
| 640 |
51135 |
| s->save_zj = zj; |
| 641 |
51135 |
| s->save_gSel = gSel; |
| 642 |
51135 |
| s->save_gMinlen = gMinlen; |
| 643 |
51135 |
| s->save_gLimit = gLimit; |
| 644 |
51135 |
| s->save_gBase = gBase; |
| 645 |
51135 |
| s->save_gPerm = gPerm; |
| 646 |
|
| |
| 647 |
51135 |
| return retVal; |
| 648 |
|
| } |
| 649 |
|
| |
| 650 |
|
| |
| 651 |
|
| /*-------------------------------------------------------------*/ |
| 652 |
|
| /*--- end decompress.c ---*/ |
| 653 |
|
| /*-------------------------------------------------------------*/ |