Add generic_stream_free and remove out of disk-image routines.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_generic.c,v 1.4 2003/04/06 18:12:37 rocky Exp $
|
$Id: _cdio_generic.c,v 1.5 2003/04/07 11:24:04 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -27,12 +27,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.4 2003/04/06 18:12:37 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.5 2003/04/07 11:24:04 rocky Exp $";
|
||||||
|
|
||||||
#include "cdio_assert.h"
|
|
||||||
#include "cdio_private.h"
|
|
||||||
#include "sector.h"
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -45,6 +40,12 @@ static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.4 2003/04/06 18:12:37 roc
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#include "cdio_assert.h"
|
||||||
|
#include "cdio_private.h"
|
||||||
|
#include "sector.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "_cdio_stdio.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Eject media -- there's nothing to do here. We always return 2.
|
Eject media -- there's nothing to do here. We always return 2.
|
||||||
Should we also free resources?
|
Should we also free resources?
|
||||||
@@ -122,24 +123,20 @@ cdio_generic_read (void *user_data, void *buf, size_t size)
|
|||||||
return read(_obj->fd, buf, size);
|
return read(_obj->fd, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
int
|
Release and free resources associated with stream or disk image.
|
||||||
cdio_generic_read_mode2_sectors (CdIo *obj, void *buf, lsn_t lsn,
|
*/
|
||||||
bool mode2raw, unsigned num_sectors)
|
void
|
||||||
|
cdio_generic_stream_free (void *user_data)
|
||||||
{
|
{
|
||||||
char *_buf = buf;
|
generic_img_private_t *_obj = user_data;
|
||||||
const int blocksize = mode2raw ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE;
|
|
||||||
int n, rc;
|
|
||||||
|
|
||||||
cdio_assert (obj != NULL);
|
if (NULL == _obj) return;
|
||||||
cdio_assert (buf != NULL);
|
free (_obj->source_name);
|
||||||
cdio_assert (obj->op.read_mode2_sector != NULL);
|
|
||||||
|
|
||||||
for (n = 0; n < num_sectors; n++)
|
if (_obj->data_source)
|
||||||
if ((rc = cdio_read_mode2_sector (obj, &_buf[n * blocksize],
|
cdio_stream_destroy (_obj->data_source);
|
||||||
lsn + n, mode2raw)))
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
return 0;
|
free (_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user