diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2015-09-02 10:10:56 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2015-09-02 10:10:56 +0100 |
commit | 9120347be7e401371e20b142390f48b4727c210b (patch) | |
tree | a7dcb43d816da9da0801971eccae696527abc37b /docview/src/lzwdecompress.pas | |
parent | 0bcbc15b3017f047bd7642aa21a60cac5fc508f4 (diff) | |
download | fpGUI-9120347be7e401371e20b142390f48b4727c210b.tar.xz |
docview: minor code formatting
Diffstat (limited to 'docview/src/lzwdecompress.pas')
-rw-r--r-- | docview/src/lzwdecompress.pas | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/docview/src/lzwdecompress.pas b/docview/src/lzwdecompress.pas index 0ebba38c..5720ba6a 100644 --- a/docview/src/lzwdecompress.pas +++ b/docview/src/lzwdecompress.pas @@ -1,7 +1,8 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + Copyright (C) 2001 - Aaron Lawrence (aaronl@consultant.com) + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -24,9 +25,9 @@ interface uses SysUtils, types; -procedure LZWDecompressBlock( pbInput: pByte; +procedure LZWDecompressBlock( pbInput: PByte; number_bytes: LongWord; - pbOutput: PBYTE; + pbOutput: PByte; Var bytesOut: LongWord; Var FinalCode: byte ); @@ -57,9 +58,9 @@ Implementation * Variables renamed etc to make things clearer. */ *) -// -- Stuff for LZW decompression -- */ +// -- Stuff for LZW decompression -- const INIT_BITS = 9; -const MAX_BITS = 12; //PLF Tue 95-10-03 02:16:56*/ +const MAX_BITS = 12; const HASHING_SHIFT = MAX_BITS - 8; {if MAX_BITS == 15 @@ -153,7 +154,7 @@ begin if bytes_out > bytes_to_read then begin - // flush static vars and quit */ + // flush static vars and quit bytes_out:= 0; input_bit_count:= 0; input_bit_buffer:= 0; @@ -167,11 +168,7 @@ end; // this takes one of the INF bitmap blocks // and decompresses it using LZW algorithms. -procedure LZWDecompressBlock( pbInput: pByte; - number_bytes: LongWord; - pbOutput: PBYTE; - Var bytesOut: LongWord; - Var FinalCode: byte ); +procedure LZWDecompressBlock(pbInput: PByte; number_bytes: LongWord; pbOutput: PByte; var bytesOut: LongWord; var FinalCode: byte); var nextAvailableCode: LongWord; currentCode: LongWord; @@ -196,40 +193,40 @@ begin begin if clear_flag then begin - clear_flag:= false; - lastCode:= currentCode; - character:= currentCode; + clear_flag := false; + lastCode := currentCode; + character := currentCode; - pbOutput^:= currentCode; + pbOutput^ := currentCode; inc( pbOutput ); - FinalCode:= currentCode; + FinalCode := currentCode; inc( BytesOut ); end else if currentCode = CLEAR_TABLE then begin - clear_flag:= true; - nextAvailableCode:= FIRST_CODE; - bitsPerCode:= INIT_BITS; - maxDictionaryCode:= MaxValNBits( bitsPerCode ); + clear_flag := true; + nextAvailableCode := FIRST_CODE; + bitsPerCode := INIT_BITS; + maxDictionaryCode := MaxValNBits( bitsPerCode ); end else begin if currentCode >= nextAvailableCode then begin decode_stack[ 0 ]:= character; - theString:= decode_string( Addr( decode_stack[ 1 ] ), + theString := decode_string( Addr( decode_stack[ 1 ] ), lastCode ); end else - theString:= decode_string( Addr( decode_stack[ 0 ] ), + theString := decode_string( Addr( decode_stack[ 0 ] ), currentCode ); - character:= longword( theString^ ); + character := longword( theString^ ); while theString >= Addr( decode_stack[ 0 ] ) do begin - FinalCode:= theString^; + FinalCode := theString^; - pbOutput^:= theString^; + pbOutput^ := theString^; inc( pbOutput ); dec( TheString ); |