Пример #1
0
/***************************************
 * SZDDD_DECOMPRESS
 ***************************************
 * unpacks directly from input to output
 */
static int szddd_decompress(struct msszdd_decompressor *self,
			    char *input, char *output)
{
  struct msszdd_decompressor_p *this = (struct msszdd_decompressor_p *) self;
  struct msszddd_header_p szdd;
  struct mspack_system *sys;
  struct mspack_file *fh;
  int error = MSPACK_ERR_OK;

  if (!this) return MSPACK_ERR_ARGS;
  sys = this->system;

  if ((fh = sys->open(sys, input, MSPACK_SYS_OPEN_READ))) {
    szdd.fh = fh;
    error = szddd_read_headers(sys, fh, (struct msszddd_header *) &szdd);
    if (error == MSPACK_ERR_OK) {
      error = szddd_extract(self, (struct msszddd_header *) &szdd, output);
    }
    sys->close(fh);
  }
  else {
    error = MSPACK_ERR_OPEN;
  }
  return this->error = error;
}
Пример #2
0
/***************************************
 * SZDDD_DECOMPRESS
 ***************************************
 * unpacks directly from input to output
 */
static int szddd_decompress(struct msszdd_decompressor *base,
			    const char *input, const char *output)
{
    struct msszdd_decompressor_p *self = (struct msszdd_decompressor_p *) base;
    struct msszddd_header *hdr;
    int error;

    if (!self) return MSPACK_ERR_ARGS;

    if (!(hdr = szddd_open(base, input))) return self->error;
    error = szddd_extract(base, hdr, output);
    szddd_close(base, hdr);
    return self->error = error;
}