Changeset d912ea38 in rtems


Ignore:
Timestamp:
Apr 4, 2010, 6:23:58 PM (9 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, master
Children:
add4a2ea
Parents:
b1b07f1a
Message:

Import from zlib-1.2.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/zlib/contrib/puff/puff.c

    rb1b07f1a rd912ea38  
    11/*
    22 * puff.c
    3  * Copyright (C) 2002-2008 Mark Adler
     3 * Copyright (C) 2002-2010 Mark Adler
    44 * For conditions of distribution and use, see copyright notice in puff.h
    5  * version 2.0, 25 Jul 2008
     5 * version 2.1, 4 Apr 2010
    66 *
    77 * puff.c is a simple inflate written to be an unambiguous way to specify the
     
    6868 *                      - Add option in TEST code to skip input bytes
    6969 *                      - Allow TEST code to read from piped stdin
     70 * 2.1   4 Apr 2010     - Avoid variable initialization for happier compilers
     71 *                      - Avoid unsigned comparisons for even happier compilers
    7072 */
    7173
     
    517519    static short lencnt[MAXBITS+1], lensym[FIXLCODES];
    518520    static short distcnt[MAXBITS+1], distsym[MAXDCODES];
    519     static struct huffman lencode = {lencnt, lensym};
    520     static struct huffman distcode = {distcnt, distsym};
     521    static struct huffman lencode, distcode;
    521522
    522523    /* build fixed huffman tables if first call (may not be thread safe) */
     
    541542        construct(&distcode, lengths, MAXDCODES);
    542543
     544        /* construct lencode and distcode */
     545        lencode.count = lencnt;
     546        lencode.symbol = lensym;
     547        distcode.count = distcnt;
     548        distcode.symbol = distsym;
     549
    543550        /* do this just once */
    544551        virgin = 0;
     
    644651    short lencnt[MAXBITS+1], lensym[MAXLCODES];         /* lencode memory */
    645652    short distcnt[MAXBITS+1], distsym[MAXDCODES];       /* distcode memory */
    646     struct huffman lencode = {lencnt, lensym};          /* length code */
    647     struct huffman distcode = {distcnt, distsym};       /* distance code */
     653    struct huffman lencode, distcode;   /* length and distance codes */
    648654    static const short order[19] =      /* permutation of code length codes */
    649655        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
     656
     657    /* construct lencode and distcode */
     658    lencode.count = lencnt;
     659    lencode.symbol = lensym;
     660    distcode.count = distcnt;
     661    distcode.symbol = distsym;
    650662
    651663    /* get number of lengths in each table, check lengths */
     
    870882int main(int argc, char **argv)
    871883{
    872     int ret, skip = 0, put = 0;
     884    int ret, put = 0;
     885    unsigned skip = 0;
    873886    char *arg, *name = NULL;
    874887    unsigned char *source = NULL, *dest;
     
    882895                put = 1;
    883896            else if (arg[1] >= '0' && arg[1] <= '9')
    884                 skip = atoi(arg + 1);
     897                skip = (unsigned)atoi(arg + 1);
    885898            else {
    886899                fprintf(stderr, "invalid option %s\n", arg);
Note: See TracChangeset for help on using the changeset viewer.