diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/bzip2/lib/huffman.c | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/bzip2/lib/huffman.c')
-rw-r--r-- | src/cmd/bzip2/lib/huffman.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/cmd/bzip2/lib/huffman.c b/src/cmd/bzip2/lib/huffman.c index 9cad0970..9388ef21 100644 --- a/src/cmd/bzip2/lib/huffman.c +++ b/src/cmd/bzip2/lib/huffman.c @@ -17,16 +17,16 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -102,7 +102,7 @@ /*---------------------------------------------------*/ -void BZ2_hbMakeCodeLengths ( UChar *len, +void BZ2_hbMakeCodeLengths ( UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen ) @@ -116,7 +116,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; - Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; + Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; for (i = 0; i < alphaSize; i++) weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; @@ -138,7 +138,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, } AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); - + while (nHeap > 1) { n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); @@ -161,7 +161,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len, len[i-1] = j; if (j > maxLen) tooLong = True; } - + if (! tooLong) break; for (i = 1; i < alphaSize; i++) { |