Logo Search packages:      
Sourcecode: tardy version File versions  Download package

void tar_output_filter_gzip::write_data ( const void *  ,
int   
) [virtual]

The write_data method is used to write file data to the output stream. The file header must be written first. Must be called zero or more times for each file.

Reimplemented from tar_output_filter.

Definition at line 169 of file gzip.cc.

References crc, drop_dead(), tar_output::nfatal(), outbuf, pass_through, stream, temp_filename, temp_fp, rcstring::to_c_string(), and tar_output_filter::write_data().

{
    if (pass_through)
    {
      tar_output_filter::write_data(data, len);
      return;
    }

    FILE *fp = (FILE *)temp_fp;
    stream.next_in = (Bytef *)data;
    stream.avail_in = len;
    while (stream.avail_in != 0)
    {
      if (stream.avail_out == 0)
      {
          fwrite(outbuf, Z_BUFSIZE, 1, fp);
          if (ferror(fp))
            nfatal("write %s", temp_filename.to_c_string());
          stream.next_out = outbuf;
          stream.avail_out = Z_BUFSIZE;
      }
      int err = deflate(&stream, Z_NO_FLUSH);
      if (err != Z_OK)
          drop_dead(err);
    }
    crc = crc32(crc, (Bytef *)data, len);
}


Generated by  Doxygen 1.6.0   Back to index