MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / HuffmanDecompressText

Function HuffmanDecompressText

neo/framework/DeclManager.cpp:508–526  ·  view source on GitHub ↗

================ HuffmanDecompressText ================ */

Source from the content-addressed store, hash-verified

506================
507*/
508int 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================

Callers 1

GetTextMethod · 0.85

Calls 5

BeginReadingMethod · 0.80
InitMethod · 0.45
SetSizeMethod · 0.45
ReadBitsMethod · 0.45
GetReadCountMethod · 0.45

Tested by

no test coverage detected