[BACK]Return to unpack.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / gzip

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.bin/gzip/unpack.c between version 1.1.4.2 and 1.2

version 1.1.4.2, 2010/04/21 05:27:11 version 1.2, 2010/11/06 21:42:32
Line 41 
Line 41 
  * tree levels, each level would consume 1 byte (See [1]).   * tree levels, each level would consume 1 byte (See [1]).
  *   *
  * After the symbol count table, there is the symbol table, storing   * After the symbol count table, there is the symbol table, storing
  * symbols represented by coresponding leaf node.  EOB is not being   * symbols represented by corresponding leaf node.  EOB is not being
  * explicitly transmitted (not necessary anyway) in the symbol table.   * explicitly transmitted (not necessary anyway) in the symbol table.
  *   *
  * Compressed data goes after the symbol table.   * Compressed data goes after the symbol table.
Line 62 
Line 62 
 /*  /*
  * unpack descriptor   * unpack descriptor
  *   *
  * Represent the huffman tree in a similiar way that pack(1) would   * Represent the huffman tree in a similar way that pack(1) would
  * store in a packed file.  We store all symbols in a linear table,   * store in a packed file.  We store all symbols in a linear table,
  * and store pointers to each level's first symbol.  In addition to   * and store pointers to each level's first symbol.  In addition to
  * that, maintain two counts for each level: inner nodes count and   * that, maintain two counts for each level: inner nodes count and
Line 93  typedef struct {
Line 93  typedef struct {
  * Caller is responsible to make sure that all of these pointers are   * Caller is responsible to make sure that all of these pointers are
  * initialized (in our case, they all point to valid memory block).   * initialized (in our case, they all point to valid memory block).
  * We don't zero out pointers here because nobody else would ever   * We don't zero out pointers here because nobody else would ever
  * reference the memory block without scrubing them.   * reference the memory block without scrubbing them.
  */   */
 static void  static void
 unpack_descriptor_fini(unpack_descriptor_t *unpackd)  unpack_descriptor_fini(unpack_descriptor_t *unpackd)
Line 118  unpackd_fill_inodesin(const unpack_descr
Line 118  unpackd_fill_inodesin(const unpack_descr
         /*          /*
          * The internal nodes would be 1/2 of total internal nodes and           * The internal nodes would be 1/2 of total internal nodes and
          * leaf nodes in the next level.  For the last level there           * leaf nodes in the next level.  For the last level there
          * would be no internal node by defination.           * would be no internal node by definition.
          */           */
         if (level < unpackd->treelevels) {          if (level < unpackd->treelevels) {
                 unpackd_fill_inodesin(unpackd, level + 1);                  unpackd_fill_inodesin(unpackd, level + 1);
Line 141  accepted_bytes(off_t *bytes_in, off_t ne
Line 141  accepted_bytes(off_t *bytes_in, off_t ne
   
 /*  /*
  * Read file header and construct the tree.  Also, prepare the buffered I/O   * Read file header and construct the tree.  Also, prepare the buffered I/O
  * for decode rountine.   * for decode routine.
  *   *
  * Return value is uncompressed size.   * Return value is uncompressed size.
  */   */
Line 196  unpack_parse_header(int in, int out, cha
Line 196  unpack_parse_header(int in, int out, cha
         /* We count from 0 so adjust to match array upper bound */          /* We count from 0 so adjust to match array upper bound */
         unpackd->treelevels--;          unpackd->treelevels--;
   
         /* Read the levels symbol count table and caculate total */          /* Read the levels symbol count table and calculate total */
         unpackd->symbol_size = 1;               /* EOB */          unpackd->symbol_size = 1;               /* EOB */
         for (i = 0; i <= unpackd->treelevels; i++) {          for (i = 0; i <= unpackd->treelevels; i++) {
                 if ((thisbyte = fgetc(unpackd->fpIn)) == EOF)                  if ((thisbyte = fgetc(unpackd->fpIn)) == EOF)
Line 238  unpack_parse_header(int in, int out, cha
Line 238  unpack_parse_header(int in, int out, cha
   
         /*          /*
          * The symbolsin table has been constructed now.           * The symbolsin table has been constructed now.
          * Caculate the internal nodes count table based on it.           * Calculate the internal nodes count table based on it.
          */           */
         unpackd_fill_inodesin(unpackd, 0);          unpackd_fill_inodesin(unpackd, 0);
 }  }

Legend:
Removed from v.1.1.4.2  
changed lines
  Added in v.1.2

CVSweb <webmaster@jp.NetBSD.org>