~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/devpak_plugin/bzip2/huffman.c

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
/*---                                             huffman.c ---*/
5
5
/*-------------------------------------------------------------*/
6
6
 
7
 
/*--
8
 
  This file is a part of bzip2 and/or libbzip2, a program and
9
 
  library for lossless, block-sorting data compression.
10
 
 
11
 
  Copyright (C) 1996-2000 Julian R Seward.  All rights reserved.
12
 
 
13
 
  Redistribution and use in source and binary forms, with or without
14
 
  modification, are permitted provided that the following conditions
15
 
  are met:
16
 
 
17
 
  1. Redistributions of source code must retain the above copyright
18
 
     notice, this list of conditions and the following disclaimer.
19
 
 
20
 
  2. The origin of this software must not be misrepresented; you must 
21
 
     not claim that you wrote the original software.  If you use this 
22
 
     software in a product, an acknowledgment in the product 
23
 
     documentation would be appreciated but is not required.
24
 
 
25
 
  3. Altered source versions must be plainly marked as such, and must
26
 
     not be misrepresented as being the original software.
27
 
 
28
 
  4. The name of the author may not be used to endorse or promote 
29
 
     products derived from this software without specific prior written 
30
 
     permission.
31
 
 
32
 
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33
 
  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34
 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35
 
  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36
 
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37
 
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38
 
  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39
 
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40
 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41
 
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42
 
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
 
 
44
 
  Julian Seward, Cambridge, UK.
45
 
  jseward@acm.org
46
 
  bzip2/libbzip2 version 1.0 of 21 March 2000
47
 
 
48
 
  This program is based on (at least) the work of:
49
 
     Mike Burrows
50
 
     David Wheeler
51
 
     Peter Fenwick
52
 
     Alistair Moffat
53
 
     Radford Neal
54
 
     Ian H. Witten
55
 
     Robert Sedgewick
56
 
     Jon L. Bentley
57
 
 
58
 
  For more information on these sources, see the manual.
59
 
--*/
 
7
/* ------------------------------------------------------------------
 
8
   This file is part of bzip2/libbzip2, a program and library for
 
9
   lossless, block-sorting data compression.
 
10
 
 
11
   bzip2/libbzip2 version 1.0.5 of 10 December 2007
 
12
   Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
 
13
 
 
14
   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
 
15
   README file.
 
16
 
 
17
   This program is released under the terms of the license contained
 
18
   in the file LICENSE.
 
19
   ------------------------------------------------------------------ */
60
20
 
61
21
 
62
22
#include "bzlib_private.h"
162
122
      
163
123
      if (! tooLong) break;
164
124
 
165
 
      for (i = 1; i < alphaSize; i++) {
 
125
      /* 17 Oct 04: keep-going condition for the following loop used
 
126
         to be 'i < alphaSize', which missed the last element,
 
127
         theoretically leading to the possibility of the compressor
 
128
         looping.  However, this count-scaling step is only needed if
 
129
         one of the generated Huffman code words is longer than
 
130
         maxLen, which up to and including version 1.0.2 was 20 bits,
 
131
         which is extremely unlikely.  In version 1.0.3 maxLen was
 
132
         changed to 17 bits, which has minimal effect on compression
 
133
         ratio, but does mean this scaling step is used from time to
 
134
         time, enough to verify that it works.
 
135
 
 
136
         This means that bzip2-1.0.3 and later will only produce
 
137
         Huffman codes with a maximum length of 17 bits.  However, in
 
138
         order to preserve backwards compatibility with bitstreams
 
139
         produced by versions pre-1.0.3, the decompressor must still
 
140
         handle lengths of up to 20. */
 
141
 
 
142
      for (i = 1; i <= alphaSize; i++) {
166
143
         j = weight[i] >> 8;
167
144
         j = 1 + (j / 2);
168
145
         weight[i] = j << 8;