예제 #1
0
파일: gunzip.c 프로젝트: CoryXie/GrubLegacy
/**
* @attention 本注释得到了"核高基"科技重大专项2012年课题“开源操作系统内核分析和安全性评估
*(课题编号:2012ZX01039-004)”的资助。
*
* @copyright 注释添加单位:清华大学——03任务(Linux内核相关通用基础软件包分析)承担单位
*
* @author 注释添加人员:谢文学
*
* @date 注释添加日期:2013年5月10日
*
* @note 注释详细内容:
* 
* 本函数实现gunzip的解压缩数据块的功能。
*/
static void
get_new_block (void)
{
  register ulg b;		/* bit buffer */
  register unsigned k;		/* number of bits in bit buffer */

  hufts = 0;

  /* make local bit buffer */
  b = bb;
  k = bk;

  /* read in last block bit */
  NEEDBITS (1);
  last_block = (int) b & 1;
  DUMPBITS (1);

  /* read in block type */
  NEEDBITS (2);
  block_type = (unsigned) b & 3;
  DUMPBITS (2);

  /* restore the global bit buffer */
  bb = b;
  bk = k;

  if (block_type == INFLATE_STORED)
    init_stored_block ();
  if (block_type == INFLATE_FIXED)
    init_fixed_block ();
  if (block_type == INFLATE_DYNAMIC)
    init_dynamic_block ();
}
예제 #2
0
파일: gzio.c 프로젝트: TemmeR/grub2
static void
get_new_block (grub_file_t file)
{
  register ulg b;		/* bit buffer */
  register unsigned k;		/* number of bits in bit buffer */
  grub_gzio_t gzio = file->data;

  /* make local bit buffer */
  b = gzio->bb;
  k = gzio->bk;

  /* read in last block bit */
  NEEDBITS (1);
  gzio->last_block = (int) b & 1;
  DUMPBITS (1);

  /* read in block type */
  NEEDBITS (2);
  gzio->block_type = (unsigned) b & 3;
  DUMPBITS (2);

  /* restore the global bit buffer */
  gzio->bb = b;
  gzio->bk = k;

  switch (gzio->block_type)
    {
    case INFLATE_STORED:
      init_stored_block (file);
      break;
    case INFLATE_FIXED:
      init_fixed_block (file);
      break;
    case INFLATE_DYNAMIC:
      init_dynamic_block (file);
      break;
    default:
      break;
    }
}