================ HuffmanDecompressText ================ */
| 506 | ================ |
| 507 | */ |
| 508 | int HuffmanDecompressText( char *text, int textLength, const byte *compressed, int compressedSize ) { |
| 509 | int i, bit; |
| 510 | idBitMsg msg; |
| 511 | huffmanNode_t *node; |
| 512 | |
| 513 | msg.Init( compressed, compressedSize ); |
| 514 | msg.SetSize( compressedSize ); |
| 515 | msg.BeginReading(); |
| 516 | for ( i = 0; i < textLength; i++ ) { |
| 517 | node = huffmanTree; |
| 518 | do { |
| 519 | bit = msg.ReadBits( 1 ); |
| 520 | node = node->children[bit]; |
| 521 | } while( node->symbol == -1 ); |
| 522 | text[i] = node->symbol; |
| 523 | } |
| 524 | text[i] = '\0'; |
| 525 | return msg.GetReadCount(); |
| 526 | } |
| 527 | |
| 528 | /* |
| 529 | ================ |
no test coverage detected