/plugins/Archive/tags/release-0-4-2/com/aftexsw/util/bzip/CBZip2InputStream.java

# · Java · 808 lines · 626 code · 102 blank · 80 comment · 154 complexity · 01d001a1c16f2b21a27b2a38a6942726 MD5 · raw file

  1. /*
  2. * This file is a part of bzip2 and/or libbzip2, a program and
  3. * library for lossless, block-sorting data compression.
  4. *
  5. * Copyright (C) 1996-1998 Julian R Seward. All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. *
  14. * 2. The origin of this software must not be misrepresented; you must
  15. * not claim that you wrote the original software. If you use this
  16. * software in a product, an acknowledgment in the product
  17. * documentation would be appreciated but is not required.
  18. *
  19. * 3. Altered source versions must be plainly marked as such, and must
  20. * not be misrepresented as being the original software.
  21. *
  22. * 4. The name of the author may not be used to endorse or promote
  23. * products derived from this software without specific prior written
  24. * permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
  27. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  28. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  30. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  32. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  34. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  35. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  36. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * Java version ported by Keiron Liddle, Aftex Software <keiron@aftexsw.com> 1999-2001
  39. *
  40. */
  41. /**
  42. * An input stream that decompresses from the BZip2 format (without the file
  43. * header chars) to be read as any other stream.
  44. */
  45. package com.aftexsw.util.bzip;
  46. import java.io.*;
  47. public class CBZip2InputStream extends InputStream implements BZip2Constants {
  48. private static void cadvise() {
  49. System.out.println("CRC Error");
  50. //throw new CCoruptionError();
  51. }
  52. private static void badBGLengths() {
  53. cadvise();
  54. }
  55. private static void bitStreamEOF() {
  56. cadvise();
  57. }
  58. private static void compressedStreamEOF() {
  59. cadvise();
  60. }
  61. private void makeMaps() {
  62. int i;
  63. nInUse = 0;
  64. for (i = 0; i < 256; i++)
  65. if (inUse[i]) {
  66. seqToUnseq[nInUse] = (char)i;
  67. unseqToSeq[i] = (char)nInUse;
  68. nInUse++;
  69. }
  70. }
  71. /*--
  72. index of the last char in the block, so
  73. the block size == last + 1.
  74. --*/
  75. private int last;
  76. /*--
  77. index in zptr[] of original string after sorting.
  78. --*/
  79. private int origPtr;
  80. /*--
  81. always: in the range 0 .. 9.
  82. The current block size is 100000 * this number.
  83. --*/
  84. private int blockSize100k;
  85. private boolean blockRandomised;
  86. private int bytesIn;
  87. private int bytesOut;
  88. private int bsBuff;
  89. private int bsLive;
  90. private CRC mCrc = new CRC();
  91. private boolean inUse[] = new boolean[256];
  92. private int nInUse;
  93. private char seqToUnseq[] = new char[256];
  94. private char unseqToSeq[] = new char[256];
  95. private char selector[] = new char[MAX_SELECTORS];
  96. private char selectorMtf[] = new char[MAX_SELECTORS];
  97. private int[] tt;
  98. private char[] ll8;
  99. /*--
  100. freq table collected to save a pass over the data
  101. during decompression.
  102. --*/
  103. private int unzftab[] = new int[256];
  104. private int limit[][] = new int[N_GROUPS][MAX_ALPHA_SIZE];
  105. private int base[][] = new int[N_GROUPS][MAX_ALPHA_SIZE];
  106. private int perm[][] = new int[N_GROUPS][MAX_ALPHA_SIZE];
  107. private int minLens[] = new int[N_GROUPS];
  108. private InputStream bsStream;
  109. private boolean streamEnd = false;
  110. private int currentChar = -1;
  111. private static final int START_BLOCK_STATE = 1;
  112. private static final int RAND_PART_A_STATE = 2;
  113. private static final int RAND_PART_B_STATE = 3;
  114. private static final int RAND_PART_C_STATE = 4;
  115. private static final int NO_RAND_PART_A_STATE = 5;
  116. private static final int NO_RAND_PART_B_STATE = 6;
  117. private static final int NO_RAND_PART_C_STATE = 7;
  118. private int currentState = START_BLOCK_STATE;
  119. private int storedBlockCRC, storedCombinedCRC;
  120. private int computedBlockCRC, computedCombinedCRC;
  121. int i2, count, chPrev, ch2;
  122. int i, tPos;
  123. int rNToGo = 0;
  124. int rTPos = 0;
  125. int j2;
  126. char z;
  127. public CBZip2InputStream(InputStream zStream) {
  128. ll8 = null;
  129. tt = null;
  130. bsSetStream(zStream);
  131. initialize();
  132. initBlock();
  133. setupBlock();
  134. }
  135. public int read() {
  136. if(streamEnd) {
  137. return -1;
  138. } else {
  139. int retChar = currentChar;
  140. switch(currentState) {
  141. case START_BLOCK_STATE:
  142. break;
  143. case RAND_PART_A_STATE:
  144. break;
  145. case RAND_PART_B_STATE:
  146. setupRandPartB();
  147. break;
  148. case RAND_PART_C_STATE:
  149. setupRandPartC();
  150. break;
  151. case NO_RAND_PART_A_STATE:
  152. break;
  153. case NO_RAND_PART_B_STATE:
  154. setupNoRandPartB();
  155. break;
  156. case NO_RAND_PART_C_STATE:
  157. setupNoRandPartC();
  158. break;
  159. default:
  160. break;
  161. }
  162. return retChar;
  163. }
  164. }
  165. private void initialize() {
  166. char magic3, magic4;
  167. magic3 = bsGetUChar();
  168. magic4 = bsGetUChar();
  169. if(magic3 != 'h' || magic4 < '1' || magic4 > '9') {
  170. bsFinishedWithStream();
  171. streamEnd = true;
  172. return;
  173. }
  174. setDecompressStructureSizes(magic4 - '0');
  175. computedCombinedCRC = 0;
  176. }
  177. private void initBlock() {
  178. char magic1, magic2, magic3, magic4;
  179. char magic5, magic6;
  180. magic1 = bsGetUChar();
  181. magic2 = bsGetUChar();
  182. magic3 = bsGetUChar();
  183. magic4 = bsGetUChar();
  184. magic5 = bsGetUChar();
  185. magic6 = bsGetUChar();
  186. if (magic1 == 0x17 && magic2 == 0x72 && magic3 == 0x45 && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90) {
  187. complete();
  188. return;
  189. }
  190. if (magic1 != 0x31 || magic2 != 0x41 || magic3 != 0x59 || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59) {
  191. badBlockHeader();
  192. streamEnd = true;
  193. return;
  194. }
  195. storedBlockCRC = bsGetInt32();
  196. if (bsR(1) == 1)
  197. blockRandomised = true;
  198. else
  199. blockRandomised = false;
  200. // currBlockNo++;
  201. getAndMoveToFrontDecode();
  202. mCrc.initialiseCRC();
  203. currentState = START_BLOCK_STATE;
  204. }
  205. private void endBlock() {
  206. computedBlockCRC = mCrc.getFinalCRC();
  207. /*-- A bad CRC is considered a fatal error. --*/
  208. if (storedBlockCRC != computedBlockCRC)
  209. crcError();
  210. computedCombinedCRC = (computedCombinedCRC << 1) | (computedCombinedCRC >> 31);
  211. computedCombinedCRC ^= computedBlockCRC;
  212. }
  213. private void complete() {
  214. storedCombinedCRC = bsGetInt32();
  215. if (storedCombinedCRC != computedCombinedCRC)
  216. crcError();
  217. bsFinishedWithStream();
  218. streamEnd = true;
  219. }
  220. private static void blockOverrun() {
  221. cadvise();
  222. }
  223. private static void badBlockHeader() {
  224. cadvise();
  225. }
  226. private static void crcError() {
  227. cadvise();
  228. }
  229. private void bsFinishedWithStream() {
  230. bsStream = null;
  231. }
  232. private void bsSetStream(InputStream f) {
  233. bsStream = f;
  234. bsLive = 0;
  235. bsBuff = 0;
  236. bytesOut = 0;
  237. bytesIn = 0;
  238. }
  239. private int bsR(int n) {
  240. int v;
  241. {
  242. while (bsLive < n) {
  243. int zzi;
  244. char thech = 0;
  245. try {
  246. thech = (char)bsStream.read();
  247. } catch(IOException e) {
  248. compressedStreamEOF();
  249. }
  250. if(thech == -1) {
  251. compressedStreamEOF();
  252. }
  253. zzi = thech;
  254. bsBuff = (bsBuff << 8) | (zzi & 0xff);
  255. bsLive += 8;
  256. }
  257. }
  258. v = (bsBuff >> (bsLive-n)) & ((1 << n)-1);
  259. bsLive -= n;
  260. return v;
  261. }
  262. private char bsGetUChar() {
  263. return (char)bsR(8);
  264. }
  265. private int bsGetint() {
  266. int u = 0;
  267. u = (u << 8) | bsR(8);
  268. u = (u << 8) | bsR(8);
  269. u = (u << 8) | bsR(8);
  270. u = (u << 8) | bsR(8);
  271. return u;
  272. }
  273. private int bsGetIntVS(int numBits) {
  274. return (int)bsR(numBits);
  275. }
  276. private int bsGetInt32() {
  277. return (int)bsGetint();
  278. }
  279. private void hbCreateDecodeTables(int[] limit, int[] base, int[] perm, char[] length, int minLen, int maxLen, int alphaSize) {
  280. int pp, i, j, vec;
  281. pp = 0;
  282. for(i = minLen; i <= maxLen; i++)
  283. for(j = 0; j < alphaSize; j++)
  284. if (length[j] == i) {
  285. perm[pp] = j;
  286. pp++;
  287. };
  288. for(i = 0; i < MAX_CODE_LEN; i++)
  289. base[i] = 0;
  290. for(i = 0; i < alphaSize; i++)
  291. base[length[i]+1]++;
  292. for(i = 1; i < MAX_CODE_LEN; i++)
  293. base[i] += base[i-1];
  294. for (i = 0; i < MAX_CODE_LEN; i++)
  295. limit[i] = 0;
  296. vec = 0;
  297. for (i = minLen; i <= maxLen; i++) {
  298. vec += (base[i+1] - base[i]);
  299. limit[i] = vec-1;
  300. vec <<= 1;
  301. }
  302. for (i = minLen + 1; i <= maxLen; i++)
  303. base[i] = ((limit[i-1] + 1) << 1) - base[i];
  304. }
  305. private void recvDecodingTables() {
  306. char len[][] = new char[N_GROUPS][MAX_ALPHA_SIZE];
  307. int i, j, t, nGroups, nSelectors, alphaSize;
  308. int minLen, maxLen;
  309. boolean inUse16[] = new boolean[16];
  310. /*--- Receive the mapping table ---*/
  311. for (i = 0; i < 16; i++)
  312. if (bsR(1) == 1)
  313. inUse16[i] = true;
  314. else
  315. inUse16[i] = false;
  316. for (i = 0; i < 256; i++)
  317. inUse[i] = false;
  318. for (i = 0; i < 16; i++)
  319. if (inUse16[i])
  320. for (j = 0; j < 16; j++)
  321. if (bsR(1) == 1)
  322. inUse[i * 16 + j] = true;
  323. makeMaps();
  324. alphaSize = nInUse+2;
  325. /*--- Now the selectors ---*/
  326. nGroups = bsR(3);
  327. nSelectors = bsR(15);
  328. for (i = 0; i < nSelectors; i++) {
  329. j = 0;
  330. while (bsR(1) == 1)
  331. j++;
  332. selectorMtf[i] = (char)j;
  333. }
  334. /*--- Undo the MTF values for the selectors. ---*/
  335. {
  336. char pos[] = new char[N_GROUPS];
  337. char tmp, v;
  338. for (v = 0; v < nGroups; v++)
  339. pos[v] = v;
  340. for (i = 0; i < nSelectors; i++) {
  341. v = selectorMtf[i];
  342. tmp = pos[v];
  343. while (v > 0) {
  344. pos[v] = pos[v-1];
  345. v--;
  346. }
  347. pos[0] = tmp;
  348. selector[i] = tmp;
  349. }
  350. }
  351. /*--- Now the coding tables ---*/
  352. for (t = 0; t < nGroups; t++) {
  353. int curr = bsR ( 5 );
  354. for (i = 0; i < alphaSize; i++) {
  355. while (bsR(1) == 1) {
  356. if (bsR(1) == 0)
  357. curr++;
  358. else
  359. curr--;
  360. }
  361. len[t][i] = (char)curr;
  362. }
  363. }
  364. /*--- Create the Huffman decoding tables ---*/
  365. for (t = 0; t < nGroups; t++) {
  366. minLen = 32;
  367. maxLen = 0;
  368. for (i = 0; i < alphaSize; i++) {
  369. if (len[t][i] > maxLen)
  370. maxLen = len[t][i];
  371. if (len[t][i] < minLen)
  372. minLen = len[t][i];
  373. }
  374. hbCreateDecodeTables(limit[t], base[t], perm[t], len[t], minLen, maxLen, alphaSize);
  375. minLens[t] = minLen;
  376. }
  377. }
  378. private void getAndMoveToFrontDecode() {
  379. char yy[] = new char[256];
  380. int i, j, nextSym, limitLast;
  381. int EOB, groupNo, groupPos;
  382. limitLast = baseBlockSize * blockSize100k;
  383. origPtr = bsGetIntVS(24);
  384. recvDecodingTables();
  385. EOB = nInUse+1;
  386. groupNo = -1;
  387. groupPos = 0;
  388. /*--
  389. Setting up the unzftab entries here is not strictly
  390. necessary, but it does save having to do it later
  391. in a separate pass, and so saves a block's worth of
  392. cache misses.
  393. --*/
  394. for (i = 0; i <= 255; i++)
  395. unzftab[i] = 0;
  396. for (i = 0; i <= 255; i++)
  397. yy[i] = (char) i;
  398. last = -1;
  399. {
  400. int zt, zn, zvec, zj;
  401. if (groupPos == 0) {
  402. groupNo++;
  403. groupPos = G_SIZE;
  404. }
  405. groupPos--;
  406. zt = selector[groupNo];
  407. zn = minLens[zt];
  408. zvec = bsR(zn);
  409. while (zvec > limit[zt][zn]) {
  410. zn++;
  411. {
  412. {
  413. while (bsLive < 1) {
  414. int zzi;
  415. char thech = 0;
  416. try {
  417. thech = (char)bsStream.read();
  418. } catch(IOException e) {
  419. compressedStreamEOF();
  420. }
  421. if(thech == -1) {
  422. compressedStreamEOF();
  423. }
  424. zzi = thech;
  425. bsBuff = (bsBuff << 8) | (zzi & 0xff);
  426. bsLive += 8;
  427. }
  428. }
  429. zj = (bsBuff >> (bsLive-1)) & 1;
  430. bsLive--;
  431. }
  432. zvec = (zvec << 1) | zj;
  433. }
  434. nextSym = perm[zt][zvec - base[zt][zn]];
  435. }
  436. while(true) {
  437. if (nextSym == EOB)
  438. break;
  439. if (nextSym == RUNA || nextSym == RUNB) {
  440. char ch;
  441. int s = -1;
  442. int N = 1;
  443. do {
  444. if (nextSym == RUNA)
  445. s = s + (0+1) * N;
  446. else if (nextSym == RUNB)
  447. s = s + (1+1) * N;
  448. N = N * 2;
  449. {
  450. int zt, zn, zvec, zj;
  451. if (groupPos == 0) {
  452. groupNo++;
  453. groupPos = G_SIZE;
  454. }
  455. groupPos--;
  456. zt = selector[groupNo];
  457. zn = minLens[zt];
  458. zvec = bsR(zn);
  459. while (zvec > limit[zt][zn]) {
  460. zn++;
  461. {
  462. {
  463. while (bsLive < 1) {
  464. int zzi;
  465. char thech = 0;
  466. try {
  467. thech = (char)bsStream.read();
  468. } catch(IOException e) {
  469. compressedStreamEOF();
  470. }
  471. if(thech == -1) {
  472. compressedStreamEOF();
  473. }
  474. zzi = thech;
  475. bsBuff = (bsBuff << 8) | (zzi & 0xff);
  476. bsLive += 8;
  477. }
  478. }
  479. zj = (bsBuff >> (bsLive-1)) & 1;
  480. bsLive--;
  481. }
  482. zvec = (zvec << 1) | zj;
  483. };
  484. nextSym = perm[zt][zvec - base[zt][zn]];
  485. }
  486. } while (nextSym == RUNA || nextSym == RUNB);
  487. s++;
  488. ch = seqToUnseq[yy[0]];
  489. unzftab[ch] += s;
  490. while (s > 0) {
  491. last++;
  492. ll8[last] = ch;
  493. s--;
  494. };
  495. if (last >= limitLast)
  496. blockOverrun();
  497. continue;
  498. } else {
  499. char tmp;
  500. last++;
  501. if (last >= limitLast)
  502. blockOverrun();
  503. tmp = yy[nextSym-1];
  504. unzftab[seqToUnseq[tmp]]++;
  505. ll8[last] = seqToUnseq[tmp];
  506. /*--
  507. This loop is hammered during decompression,
  508. hence the unrolling.
  509. for (j = nextSym-1; j > 0; j--) yy[j] = yy[j-1];
  510. --*/
  511. j = nextSym-1;
  512. for (; j > 3; j -= 4) {
  513. yy[j] = yy[j-1];
  514. yy[j-1] = yy[j-2];
  515. yy[j-2] = yy[j-3];
  516. yy[j-3] = yy[j-4];
  517. }
  518. for (; j > 0; j--)
  519. yy[j] = yy[j-1];
  520. yy[0] = tmp;
  521. {
  522. int zt, zn, zvec, zj;
  523. if (groupPos == 0) {
  524. groupNo++;
  525. groupPos = G_SIZE;
  526. }
  527. groupPos--;
  528. zt = selector[groupNo];
  529. zn = minLens[zt];
  530. zvec = bsR(zn);
  531. while (zvec > limit[zt][zn]) {
  532. zn++;
  533. {
  534. {
  535. while (bsLive < 1) {
  536. int zzi;
  537. char thech = 0;
  538. try {
  539. thech = (char)bsStream.read();
  540. } catch(IOException e) {
  541. compressedStreamEOF();
  542. }
  543. zzi = thech;
  544. bsBuff = (bsBuff << 8) | (zzi & 0xff);
  545. bsLive += 8;
  546. }
  547. }
  548. zj = (bsBuff >> (bsLive-1)) & 1;
  549. bsLive--;
  550. }
  551. zvec = (zvec << 1) | zj;
  552. };
  553. nextSym = perm[zt][zvec - base[zt][zn]];
  554. }
  555. continue;
  556. }
  557. }
  558. }
  559. private void setupBlock() {
  560. int cftab[] = new int[257];
  561. char ch;
  562. cftab[0] = 0;
  563. for (i = 1; i <= 256; i++)
  564. cftab[i] = unzftab[i-1];
  565. for (i = 1; i <= 256; i++)
  566. cftab[i] += cftab[i-1];
  567. for (i = 0; i <= last; i++) {
  568. ch = (char)ll8[i];
  569. tt[cftab[ch]] = i;
  570. cftab[ch]++;
  571. }
  572. cftab = null;
  573. tPos = tt[origPtr];
  574. count = 0;
  575. i2 = 0;
  576. ch2 = 256; /*-- not a char and not EOF --*/
  577. if (blockRandomised) {
  578. rNToGo = 0;
  579. rTPos = 0;
  580. setupRandPartA();
  581. } else {
  582. setupNoRandPartA();
  583. }
  584. }
  585. private void setupRandPartA() {
  586. if(i2 <= last) {
  587. chPrev = ch2;
  588. ch2 = ll8[tPos];
  589. tPos = tt[tPos];
  590. if (rNToGo == 0) {
  591. rNToGo = rNums[rTPos];
  592. rTPos++;
  593. if(rTPos == 512)
  594. rTPos = 0;
  595. }
  596. rNToGo--;
  597. ch2 ^= (int)((rNToGo == 1) ? 1 : 0);
  598. i2++;
  599. currentChar = ch2;
  600. currentState = RAND_PART_B_STATE;
  601. mCrc.updateCRC(ch2);
  602. } else {
  603. endBlock();
  604. initBlock();
  605. setupBlock();
  606. }
  607. }
  608. private void setupNoRandPartA() {
  609. if(i2 <= last) {
  610. chPrev = ch2;
  611. ch2 = ll8[tPos];
  612. tPos = tt[tPos];
  613. i2++;
  614. currentChar = ch2;
  615. currentState = NO_RAND_PART_B_STATE;
  616. mCrc.updateCRC(ch2);
  617. } else {
  618. endBlock();
  619. initBlock();
  620. setupBlock();
  621. }
  622. }
  623. private void setupRandPartB() {
  624. if (ch2 != chPrev) {
  625. currentState = RAND_PART_A_STATE;
  626. count = 1;
  627. setupRandPartA();
  628. } else {
  629. count++;
  630. if (count >= 4) {
  631. z = ll8[tPos];
  632. tPos = tt[tPos];
  633. if (rNToGo == 0) {
  634. rNToGo = rNums[rTPos];
  635. rTPos++;
  636. if(rTPos == 512)
  637. rTPos = 0;
  638. }
  639. rNToGo--;
  640. z ^= ((rNToGo == 1) ? 1 : 0);
  641. j2 = 0;
  642. currentState = RAND_PART_C_STATE;
  643. setupRandPartC();
  644. } else {
  645. currentState = RAND_PART_A_STATE;
  646. setupRandPartA();
  647. }
  648. }
  649. }
  650. private void setupRandPartC() {
  651. if(j2 < (int)z) {
  652. currentChar = ch2;
  653. mCrc.updateCRC(ch2);
  654. j2++;
  655. } else {
  656. currentState = RAND_PART_A_STATE;
  657. i2++;
  658. count = 0;
  659. setupRandPartA();
  660. }
  661. }
  662. private void setupNoRandPartB() {
  663. if (ch2 != chPrev) {
  664. currentState = NO_RAND_PART_A_STATE;
  665. count = 1;
  666. setupNoRandPartA();
  667. } else {
  668. count++;
  669. if (count >= 4) {
  670. z = ll8[tPos];
  671. tPos = tt[tPos];
  672. currentState = NO_RAND_PART_C_STATE;
  673. j2 = 0;
  674. setupNoRandPartC();
  675. } else {
  676. currentState = NO_RAND_PART_A_STATE;
  677. setupNoRandPartA();
  678. }
  679. }
  680. }
  681. private void setupNoRandPartC() {
  682. if(j2 < (int)z) {
  683. currentChar = ch2;
  684. mCrc.updateCRC(ch2);
  685. j2++;
  686. } else {
  687. currentState = NO_RAND_PART_A_STATE;
  688. i2++;
  689. count = 0;
  690. setupNoRandPartA();
  691. }
  692. }
  693. private void setDecompressStructureSizes(int newSize100k) {
  694. if (! (0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k
  695. && blockSize100k <= 9)) {
  696. // throw new IOException("Invalid block size");
  697. }
  698. blockSize100k = newSize100k;
  699. if(newSize100k == 0)
  700. return;
  701. int n = baseBlockSize * newSize100k;
  702. ll8 = new char[n];
  703. tt = new int[n];
  704. }
  705. }