Add const's where possible.

Add cdio mode2 read routine.
This commit is contained in:
rocky
2004-06-19 02:27:19 +00:00
parent a3de80d0ae
commit 3109e2935d
3 changed files with 53 additions and 19 deletions

5
NEWS
View File

@@ -1,6 +1,6 @@
0.69
- Add interface returning drive capabilityes (cdio_get_drive_cap).
- Minimal cdrdao image reading (thanks to Svend S. sorensen)
- Minimal cdrdao image reading (thanks to Svend S. Sorensen)
- Some important (I think) bug fixes
- Redo types of lsn and lba to allow negative values. Should model MMC3
specs. Add max/min values for lsn.
@@ -11,6 +11,7 @@
via options --no-hexdump and --hexdump
- better NRG reading (thanks to Michael Kukat via extractnrg.pl)
- better tracking of allocated variables (cd-read, cd-info, FreeBSD)
- Add interface to read PVD and pick out some of the fields in that.
0.68
- More honest about mode1 reading in backends. Remove some of the bogusness.
@@ -119,4 +120,4 @@
0.1
Routines split off from VCDImager.
$Id: NEWS,v 1.44 2004/06/09 11:01:20 rocky Exp $
$Id: NEWS,v 1.45 2004/06/19 02:27:19 rocky Exp $

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660.h,v 1.43 2004/06/19 00:15:44 rocky Exp $
$Id: iso9660.h,v 1.44 2004/06/19 02:27:19 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -290,14 +290,23 @@ typedef struct _iso9660 iso9660_t;
/*!
Seek to a position and then read n bytes. Size read is returned.
*/
long int iso9660_iso_seek_read (iso9660_t *p_iso, void *ptr, lsn_t start,
long int size);
long int iso9660_iso_seek_read (const iso9660_t *p_iso, void *ptr,
lsn_t start, long int size);
/*!
Read the Primary Volume Descriptor for an ISO 9660 image.
True is returned if read, and false if there was an error.
*/
bool iso9660_ifs_read_pvd (iso9660_t *p_iso, iso9660_pvd_t *p_pvd);
bool iso9660_ifs_read_pvd (const iso9660_t *p_iso,
/*out*/ iso9660_pvd_t *p_pvd);
/*!
Read the Primary Volume Descriptor for a CD.
True is returned if read, and false if there was an error.
*/
bool iso9660_fs_read_mode2_pvd (const CdIo *p_cdio,
/*out*/ iso9660_pvd_t *p_pvd,
bool b_form2);
/*====================================================
Time conversion
@@ -436,7 +445,7 @@ iso9660_dir_calc_record_size (unsigned int namelen, unsigned int su_len);
Returns stat_t of entry if we found lsn, or NULL otherwise.
*/
iso9660_stat_t *iso9660_find_fs_lsn(const CdIo *cdio, lsn_t lsn);
iso9660_stat_t *iso9660_find_fs_lsn(const CdIo *p_cdio, lsn_t lsn);
/*!

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660_fs.c,v 1.21 2004/06/19 00:15:44 rocky Exp $
$Id: iso9660_fs.c,v 1.22 2004/06/19 02:27:20 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -40,7 +40,7 @@
#include <stdio.h>
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.21 2004/06/19 00:15:44 rocky Exp $";
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.22 2004/06/19 02:27:20 rocky Exp $";
/* Implementation of iso9660_t type */
struct _iso9660 {
@@ -85,16 +85,9 @@ iso9660_close (iso9660_t *p_iso)
return true;
}
/*!
Read the Primary Volume Descriptor for an ISO 9660 image.
*/
bool iso9660_ifs_read_pvd (iso9660_t *p_iso, iso9660_pvd_t *p_pvd)
static bool
check_pvd (const iso9660_pvd_t *p_pvd)
{
if (0 == iso9660_iso_seek_read (p_iso, p_pvd, ISO_PVD_SECTOR, 1)) {
cdio_warn ("error reading PVD sector (%d)", ISO_PVD_SECTOR);
return false;
}
if (p_pvd->type != ISO_VD_PRIMARY) {
cdio_warn ("unexpected PVD type %d", p_pvd->type);
return false;
@@ -109,11 +102,42 @@ iso9660_close (iso9660_t *p_iso)
return true;
}
/*!
Read the Primary Volume Descriptor for an ISO 9660 image.
*/
bool
iso9660_ifs_read_pvd (const iso9660_t *p_iso, /*out*/ iso9660_pvd_t *p_pvd)
{
if (0 == iso9660_iso_seek_read (p_iso, p_pvd, ISO_PVD_SECTOR, 1)) {
cdio_warn ("error reading PVD sector (%d)", ISO_PVD_SECTOR);
return false;
}
return check_pvd(p_pvd);
}
/*!
Read the Primary Volume Descriptor for of CD.
*/
bool
iso9660_fs_read_mode2_pvd(const CdIo *cdio, /*out*/ iso9660_pvd_t *p_pvd,
bool b_form2)
{
if (cdio_read_mode2_sector (cdio, p_pvd, ISO_PVD_SECTOR, b_form2)) {
cdio_warn ("error reading PVD sector (%d)", ISO_PVD_SECTOR);
return false;
}
return check_pvd(p_pvd);
}
/*!
Seek to a position and then read n blocks. Size read is returned.
*/
long int
iso9660_iso_seek_read (iso9660_t *p_iso, void *ptr, lsn_t start, long int size)
iso9660_iso_seek_read (const iso9660_t *p_iso, void *ptr, lsn_t start,
long int size)
{
long int ret;
if (NULL == p_iso) return 0;