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

« back to all changes in this revision

Viewing changes to src/plugins/contrib/devpak_plugin/bzip2/decompress.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
/*---                                          decompress.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"
235
195
   switch (s->state) {
236
196
 
237
197
      GET_UCHAR(BZ_X_MAGIC_1, uc);
238
 
      if (uc != 'B') RETURN(BZ_DATA_ERROR_MAGIC);
 
198
      if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC);
239
199
 
240
200
      GET_UCHAR(BZ_X_MAGIC_2, uc);
241
 
      if (uc != 'Z') RETURN(BZ_DATA_ERROR_MAGIC);
 
201
      if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC);
242
202
 
243
203
      GET_UCHAR(BZ_X_MAGIC_3, uc)
244
 
      if (uc != 'h') RETURN(BZ_DATA_ERROR_MAGIC);
 
204
      if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC);
245
205
 
246
206
      GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8)
247
 
      if (s->blockSize100k < '1' || 
248
 
          s->blockSize100k > '9') RETURN(BZ_DATA_ERROR_MAGIC);
249
 
      s->blockSize100k -= '0';
 
207
      if (s->blockSize100k < (BZ_HDR_0 + 1) || 
 
208
          s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC);
 
209
      s->blockSize100k -= BZ_HDR_0;
250
210
 
251
211
      if (s->smallDecompress) {
252
212
         s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
524
484
      if (s->origPtr < 0 || s->origPtr >= nblock)
525
485
         RETURN(BZ_DATA_ERROR);
526
486
 
 
487
      /*-- Set up cftab to facilitate generation of T^(-1) --*/
 
488
      s->cftab[0] = 0;
 
489
      for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
 
490
      for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
 
491
      for (i = 0; i <= 256; i++) {
 
492
         if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
 
493
            /* s->cftab[i] can legitimately be == nblock */
 
494
            RETURN(BZ_DATA_ERROR);
 
495
         }
 
496
      }
 
497
 
527
498
      s->state_out_len = 0;
528
499
      s->state_out_ch  = 0;
529
500
      BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
530
501
      s->state = BZ_X_OUTPUT;
531
502
      if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
532
503
 
533
 
      /*-- Set up cftab to facilitate generation of T^(-1) --*/
534
 
      s->cftab[0] = 0;
535
 
      for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
536
 
      for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
537
 
 
538
504
      if (s->smallDecompress) {
539
505
 
540
506
         /*-- Make a copy of cftab, used in generation of T --*/