diff --git a/configure.ac b/configure.ac index 7b75f65d..3e600bc8 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ define(RELEASE_NUM, 70) define(CDIO_VERSION_STR, 0.$1cvs) AC_PREREQ(2.52) -AC_REVISION([$Id: configure.ac,v 1.88 2004/06/26 19:26:36 rocky Exp $])dnl +AC_REVISION([$Id: configure.ac,v 1.89 2004/06/27 15:29:20 rocky Exp $])dnl AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM)) AC_CONFIG_SRCDIR(src/cd-info.c) AM_INIT_AUTOMAKE @@ -230,7 +230,7 @@ AC_SUBST(LIBCDIO_CFLAGS) AC_SUBST(LIBCDIO_LIBS) AC_SUBST(LIBISO9660_LIBS) -case $host_os in +case $target_os in darwin6*|darwin7*) AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h, [have_iokit_h="yes"]) diff --git a/doc/glossary.texi b/doc/glossary.texi index 53e99eb9..351541f9 100644 --- a/doc/glossary.texi +++ b/doc/glossary.texi @@ -57,6 +57,13 @@ layer. Mode 2 is for audio and video data and has no extra correction layer. CD-ROM/XA An expansion of the CD-ROM Mode 2 format that allows both computer and audio/video to be mixed in the same track. +@item CD Text +CD Text is a technology developed by Sony Corporation and Philips +Electronics in 1996 that allows storing in an audio CD and its tracks +information such as artist name, title, songwriter, composer, or +arranger. Commercially available audio CDs sometimes contain CD Text +information. + @item CD XA CD-ROM EXtended Architecture. A modification to the CD-ROM specification that defines two new types of sectors. CD-ROM XA was diff --git a/include/cdio/cdio.h b/include/cdio/cdio.h index c3470d1b..ad8e1cab 100644 --- a/include/cdio/cdio.h +++ b/include/cdio/cdio.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: cdio.h,v 1.53 2004/06/19 10:39:30 rocky Exp $ + $Id: cdio.h,v 1.54 2004/06/27 15:29:21 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2003, 2004 Rocky Bernstein @@ -232,7 +232,7 @@ extern "C" { string when done with it. */ - char *cdio_get_mcn (const CdIo *obj); + char * cdio_get_mcn (const CdIo *obj); /*! Get a string containing the name of the driver in use. diff --git a/include/cdio/sector.h b/include/cdio/sector.h index e151227e..76ead06f 100644 --- a/include/cdio/sector.h +++ b/include/cdio/sector.h @@ -1,5 +1,5 @@ /* - $Id: sector.h,v 1.13 2004/06/02 00:43:53 rocky Exp $ + $Id: sector.h,v 1.14 2004/06/27 15:29:21 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003, 2004 Rocky Bernstein @@ -119,16 +119,31 @@ #define CDIO_CDROM_CDI_TRACK 0x10 #define CDIO_CDROM_XA_TRACK 0x20 -/*! The leadout track is always 0xAA, regardless of # of tracks on disc */ +/*! The leadout track is always 0xAA, regardless of # of tracks on + disc, or what value may be used internally. For example although + OS X uses a different value for the lead-out track internally than + given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and + not worry about this. + */ #define CDIO_CDROM_LEADOUT_TRACK 0xAA #define M2F2_SECTOR_SIZE 2324 #define M2SUB_SECTOR_SIZE 2332 #define M2RAW_SECTOR_SIZE 2336 +/*! Largest CD track number */ #define CDIO_CD_MAX_TRACKS 99 +/*! Smallest CD track number */ #define CDIO_CD_MIN_TRACK_NO 1 + +/*! Largest CD session number */ +#define CDIO_CD_MAX_SESSIONS 99 +/*! Smallest CD session number */ +#define CDIO_CD_MIN_SESSION_NO 1 + +/*! Largest LSN in a CD */ #define CDIO_CD_MAX_LSN 450150 +/*! Smallest LSN in a CD */ #define CDIO_CD_MIN_LSN -450150 diff --git a/include/cdio/types.h b/include/cdio/types.h index 8541ce4f..c37ceee3 100644 --- a/include/cdio/types.h +++ b/include/cdio/types.h @@ -1,5 +1,5 @@ /* - $Id: types.h,v 1.17 2004/05/26 06:29:15 rocky Exp $ + $Id: types.h,v 1.18 2004/06/27 15:29:21 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -218,7 +218,7 @@ extern "C" { */ typedef int32_t lsn_t; - /*! The type of an track number 0..99. */ + /*! The type of a track number 0..99. */ typedef uint8_t track_t; /*! @@ -226,6 +226,14 @@ extern "C" { */ #define CDIO_INVALID_TRACK 0xFF + /*! The type of a session number 0..99. */ + typedef uint8_t session_t; + + /*! + Constant for invalid session number + */ +#define CDIO_INVALID_SESSION 0xFF + /*! Constant for invalid LBA. It is 151 less than the most negative LBA -45150. This provide slack for the 150-frame offset in @@ -243,18 +251,36 @@ extern "C" { */ #define CDIO_MCN_SIZE 13 -typedef int cdio_fs_anal_t; + /*! + Type to hold ASCII bytes in a media catalog number (MCN). + We include an extra 0 byte so these can be used as C strings. + */ + typedef char cdio_mcn_t[CDIO_MCN_SIZE+1]; + -/*! The type of an drive capability bit mask. See below for values*/ + /*! + Number of ASCII bytes in International Standard Recording Codes (ISRC) + */ +#define CDIO_ISRC_SIZE 12 + + /*! + Type to hold ASCII bytes in a media catalog number (MCN). + We include an extra 0 byte so these can be used as C strings. + */ + typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1]; + + typedef int cdio_fs_anal_t; + + /*! The type of an drive capability bit mask. See below for values*/ typedef uint32_t cdio_drive_cap_t; -/*! - \brief Drive types returned by cdio_get_drive_cap() - - Most are copied from the GNU/Linux the uniform CD-ROM driver header - linux/cdrom.h> NOTE: Setting a bit here means the presence of - a capability. -*/ + /*! + \brief Drive types returned by cdio_get_drive_cap() + + Most are copied from the GNU/Linux the uniform CD-ROM driver header + linux/cdrom.h> NOTE: Setting a bit here means the presence of + a capability. + */ #define CDIO_DRIVE_CAP_CLOSE_TRAY 0x00001 /**< caddy systems can't close... */ @@ -298,20 +324,20 @@ typedef int cdio_fs_anal_t; #define CDIO_DRIVE_CAP_DVD_WRITER \ (CDIO_DRIVE_CAP_DVD_R|CDIO_DRIVE_CAP_DVD_RAM) -/**< Has some sort of DVD writer ability */ + /**< Has some sort of DVD writer ability */ -/*! - track flags - Q Sub-channel Control Field (4.2.3.3) -*/ -typedef enum { - CDIO_TRACK_FLAG_NONE = 0x00, /**< no flags set */ - CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01, /**< audio track recorded with - pre-emphasis */ - CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02, /**< digital copy permitted */ - CDIO_TRACK_FLAG_DATA = 0x04, /**< data track */ - CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08, /**< 4 audio channels */ - CDIO_TRACK_FLAG_SCMS = 0x10 /**< SCMS (5.29.2.7) */ + /*! + track flags + Q Sub-channel Control Field (4.2.3.3) + */ + typedef enum { + CDIO_TRACK_FLAG_NONE = 0x00, /**< no flags set */ + CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01, /**< audio track recorded with + pre-emphasis */ + CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02, /**< digital copy permitted */ + CDIO_TRACK_FLAG_DATA = 0x04, /**< data track */ + CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08, /**< 4 audio channels */ + CDIO_TRACK_FLAG_SCMS = 0x10 /**< SCMS (5.29.2.7) */ } cdio_track_flag; #ifdef __cplusplus diff --git a/lib/FreeBSD/freebsd.h b/lib/FreeBSD/freebsd.h index 2ccee243..86e9fdff 100644 --- a/lib/FreeBSD/freebsd.h +++ b/lib/FreeBSD/freebsd.h @@ -1,5 +1,5 @@ /* - $Id: freebsd.h,v 1.12 2004/06/19 16:34:45 rocky Exp $ + $Id: freebsd.h,v 1.13 2004/06/27 15:29:22 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -140,7 +140,9 @@ typedef struct { /* Track information */ bool toc_init; /* if true, info below is valid. */ struct ioc_toc_header tochdr; - struct ioc_read_toc_single_entry tocent[100]; /* entry info for each track */ + + /* Entry info for each track. Add 1 for leadout. */ + struct ioc_read_toc_single_entry tocent[CDIO_CD_MAX_TRACKS+1; } _img_private_t; diff --git a/lib/MSWindows/aspi32.c b/lib/MSWindows/aspi32.c index f3b81c14..811c6b52 100644 --- a/lib/MSWindows/aspi32.c +++ b/lib/MSWindows/aspi32.c @@ -1,5 +1,5 @@ /* - $Id: aspi32.c,v 1.9 2004/06/25 01:47:06 rocky Exp $ + $Id: aspi32.c,v 1.10 2004/06/27 15:29:22 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: aspi32.c,v 1.9 2004/06/25 01:47:06 rocky Exp $"; +static const char _rcsid[] = "$Id: aspi32.c,v 1.10 2004/06/27 15:29:22 rocky Exp $"; #include #include @@ -53,6 +53,75 @@ static const char _rcsid[] = "$Id: aspi32.c,v 1.9 2004/06/25 01:47:06 rocky Exp #include #include "aspi32.h" +const char *aspierror(int nErrorCode) +{ + switch (nErrorCode) + { + case SS_PENDING: + return "SRB being processed"; + break; + case SS_COMP: + return "SRB completed without error"; + break; + case SS_ABORTED: + return "SRB aborted"; + break; + case SS_ABORT_FAIL: + return "Unable to abort SRB"; + break; + case SS_ERR: + return "SRB completed with error"; + break; + case SS_INVALID_CMD: + return "Invalid ASPI command"; + break; + case SS_INVALID_HA: + return "Invalid host adapter number"; + break; + case SS_NO_DEVICE: + return "SCSI device not installed"; + break; + case SS_INVALID_SRB: + return "Invalid parameter set in SRB"; + break; + case SS_OLD_MANAGER: + return "ASPI manager doesn't support"; + break; + case SS_ILLEGAL_MODE: + return "Unsupported Windows mode"; + break; + case SS_NO_ASPI: + return "No ASPI managers"; + break; + case SS_FAILED_INIT: + return "ASPI for windows failed init"; + break; + case SS_ASPI_IS_BUSY: + return "No resources available to execute command"; + break; + case SS_BUFFER_TOO_BIG: + return "Buffer size too big to handle"; + break; + case SS_MISMATCHED_COMPONENTS: + return "The DLLs/EXEs of ASPI don't version check"; + break; + case SS_NO_ADAPTERS: + return "No host adapters found"; + break; + case SS_INSUFFICIENT_RESOURCES: + return "Couldn't allocate resources needed to init"; + break; + case SS_ASPI_IS_SHUTDOWN: + return "Call came to ASPI after PROCESS_DETACH"; + break; + case SS_BAD_INSTALL: + return "The DLL or other components are installed wrong"; + break; + default: + return "Unknow ASPI error"); + } +} + /* General ioctl() CD-ROM command function */ static bool mciSendCommand_aspi(int id, UINT msg, DWORD flags, void *arg) @@ -111,6 +180,7 @@ is_cdrom_aspi(const char drive_letter) DWORD dwSupportInfo; int i_adapter, i_hostadapters; char c_drive; + int i_rc; if ( !have_aspi(&hASPI, &lpGetSupport, &lpSendCommand) ) return NULL; @@ -118,15 +188,11 @@ is_cdrom_aspi(const char drive_letter) /* ASPI support seems to be there. */ dwSupportInfo = lpGetSupport(); - - if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS ) { - cdio_debug("no host adapters found (ASPI)"); - FreeLibrary( hASPI ); - return NULL; - } - - if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP ) { - cdio_debug("Unable to initalize ASPI layer"); + + i_rc = HIBYTE( LOWORD ( dwSupportInfo ) ); + + if( SS_COMP != rc ) { + cdio_debug("ASPI: %s", aspierror(i_rc)); FreeLibrary( hASPI ); return NULL; } @@ -205,6 +271,7 @@ init_aspi (_img_private_t *env) DWORD dwSupportInfo; int i_adapter, i_hostadapters; char c_drive; + int i_rc; if (2 == strlen(env->gen.source_name) && isalpha(env->gen.source_name[0]) ) { @@ -221,14 +288,10 @@ init_aspi (_img_private_t *env) dwSupportInfo = lpGetSupport(); - if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS ) { - cdio_debug("no host adapters found (ASPI)"); - FreeLibrary( hASPI ); - return false; - } - - if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP ) { - cdio_debug("unable to initalize ASPI layer"); + i_rc = HIBYTE( LOWORD ( dwSupportInfo ) ); + + if( SS_COMP != rc ) { + cdio_info("ASPI: %s", aspierror(i_rc)); FreeLibrary( hASPI ); return false; } @@ -402,6 +465,7 @@ mmc_read_sectors_aspi (const _img_private_t *env, void *data, lsn_t lsn, /* check that the transfer went as planned */ if( ssc.SRB_Status != SS_COMP ) { + cdio_info("ASPI: %s", aspierror(ssc.SRB_Status)); return 1; } @@ -502,6 +566,7 @@ read_toc_aspi (_img_private_t *env) /* check that the transfer went as planned */ if( ssc.SRB_Status != SS_COMP ) { + cdio_info("ASPI: %s", aspierror(ssc.SRB_Status)); CloseHandle( hEvent ); return false; } @@ -540,10 +605,10 @@ read_toc_aspi (_img_private_t *env) WaitForSingleObject( hEvent, INFINITE ); /* check that the transfer went as planned */ -#if 0 - if( ssc.SRB_Status != SS_COMP ) + if( ssc.SRB_Status != SS_COMP ) { + cdio_info("ASPI: %s", aspierror(ssc.SRB_Status)); env->total_tracks = 0; -#endif + } for( i = 0 ; i <= env->total_tracks ; i++ ) { int i_index = 8 + 8 * i; @@ -664,6 +729,7 @@ get_drive_cap_aspi (const _img_private_t *env) /* check that the transfer went as planned */ if( ssc.SRB_Status != SS_COMP ) { + cdio_info("ASPI: %s", aspierror(ssc.SRB_Status)); return i_drivetype; } else { BYTE *p; diff --git a/lib/_cdio_linux.c b/lib/_cdio_linux.c index 5354caf0..d1a751d3 100644 --- a/lib/_cdio_linux.c +++ b/lib/_cdio_linux.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_linux.c,v 1.57 2004/06/26 00:39:00 rocky Exp $ + $Id: _cdio_linux.c,v 1.58 2004/06/27 15:29:21 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.57 2004/06/26 00:39:00 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.58 2004/06/27 15:29:21 rocky Exp $"; #include @@ -819,7 +819,7 @@ _get_first_track_num_linux(void *user_data) string when done with it. */ -static char * +static cdio_mcn_t _get_mcn_linux (const void *env) { struct cdrom_mcn mcn; diff --git a/lib/_cdio_osx.c b/lib/_cdio_osx.c index 9c2de817..cdba7784 100644 --- a/lib/_cdio_osx.c +++ b/lib/_cdio_osx.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_osx.c,v 1.47 2004/06/26 01:20:41 rocky Exp $ + $Id: _cdio_osx.c,v 1.48 2004/06/27 15:29:22 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein from vcdimager code: @@ -34,7 +34,7 @@ #include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.47 2004/06/26 01:20:41 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.48 2004/06/27 15:29:22 rocky Exp $"; #include #include @@ -95,6 +95,8 @@ typedef struct { int i_descriptors; track_t i_last_track; /* highest track number */ track_t i_first_track; /* first track */ + track_t i_last_session; /* highest session number */ + track_t i_first_session; /* first session number */ lsn_t *pp_lba; } _img_private_t; @@ -383,7 +385,6 @@ _cdio_read_toc (_img_private_t *env) int i, i_leadout = -1; CDTOCDescriptor *pTrackDescriptors; - track_t i_track; env->pp_lba = malloc( env->i_descriptors * sizeof(int) ); if( env->pp_lba == NULL ) @@ -395,24 +396,27 @@ _cdio_read_toc (_img_private_t *env) pTrackDescriptors = env->pTOC->descriptors; - env->i_first_track = CDIO_CD_MAX_TRACKS+1; - env->i_last_track = CDIO_CD_MIN_TRACK_NO-1; + env->i_first_track = CDIO_CD_MAX_TRACKS+1; + env->i_last_track = CDIO_CD_MIN_TRACK_NO; + env->i_first_session = CDIO_CD_MAX_TRACKS+1; + env->i_last_session = CDIO_CD_MIN_TRACK_NO; for( i = 0; i <= env->i_descriptors; i++ ) { - i_track = pTrackDescriptors[i].point; + track_t i_track = pTrackDescriptors[i].point; + session_t i_session = pTrackDescriptors[i].session; cdio_debug( "point: %d, tno: %d, session: %d, adr: %d, control:%d, " - "address: %d:%d:%d, p: %d:%d:%d", - pTrackDescriptors[i].point, - pTrackDescriptors[i].tno, pTrackDescriptors[i].session, - pTrackDescriptors[i].adr, pTrackDescriptors[i].control, - pTrackDescriptors[i].address.minute, - pTrackDescriptors[i].address.second, - pTrackDescriptors[i].address.frame, - pTrackDescriptors[i].p.minute, - pTrackDescriptors[i].p.second, - pTrackDescriptors[i].p.frame ); + "address: %d:%d:%d, p: %d:%d:%d", + i_track, + pTrackDescriptors[i].tno, i_session + pTrackDescriptors[i].adr, pTrackDescriptors[i].control, + pTrackDescriptors[i].address.minute, + pTrackDescriptors[i].address.second, + pTrackDescriptors[i].address.frame, + pTrackDescriptors[i].p.minute, + pTrackDescriptors[i].p.second, + pTrackDescriptors[i].p.frame ); /* track information has adr = 1 */ if ( 0x01 != pTrackDescriptors[i].adr ) @@ -430,6 +434,11 @@ _cdio_read_toc (_img_private_t *env) if (env->i_last_track < i_track) env->i_last_track = i_track; + if (env->i_first_session > i_session) + env->i_first_track = i_session; + + if (env->i_last_session < i_session) + env->i_last_track = i_session; } /* Now that we know what the first track number is, we can make sure diff --git a/lib/image/bincue.c b/lib/image/bincue.c index 6cd12df4..9831a26d 100644 --- a/lib/image/bincue.c +++ b/lib/image/bincue.c @@ -1,5 +1,5 @@ /* - $Id: bincue.c,v 1.22 2004/06/19 19:15:15 rocky Exp $ + $Id: bincue.c,v 1.23 2004/06/27 15:29:22 rocky Exp $ Copyright (C) 2002, 2003, 2004 Rocky Bernstein Copyright (C) 2001 Herbert Valerio Riedel @@ -24,7 +24,7 @@ (*.cue). */ -static const char _rcsid[] = "$Id: bincue.c,v 1.22 2004/06/19 19:15:15 rocky Exp $"; +static const char _rcsid[] = "$Id: bincue.c,v 1.23 2004/06/27 15:29:22 rocky Exp $"; #include "cdio_assert.h" #include "cdio_private.h" @@ -94,8 +94,9 @@ typedef struct { bool sector_2336; /* Playstation (PSX) uses 2336-byte sectors */ char *cue_name; - char *mcn; /* Media catalog number. */ - track_info_t tocent[100]; /* entry info for each track */ + char *mcn; /* Media Catalog Number. */ + track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track + add 1 for leadout. */ track_t i_tracks; /* number of tracks in image */ track_t i_first_track; /* track number of first track */ bool have_cue; diff --git a/lib/image/cdrdao.c b/lib/image/cdrdao.c index 2232d855..e7740691 100644 --- a/lib/image/cdrdao.c +++ b/lib/image/cdrdao.c @@ -1,5 +1,5 @@ /* - $Id: cdrdao.c,v 1.9 2004/06/01 11:15:58 rocky Exp $ + $Id: cdrdao.c,v 1.10 2004/06/27 15:29:22 rocky Exp $ Copyright (C) 2004 Rocky Bernstein toc reading routine adapted from cuetools @@ -25,7 +25,7 @@ (*.cue). */ -static const char _rcsid[] = "$Id: cdrdao.c,v 1.9 2004/06/01 11:15:58 rocky Exp $"; +static const char _rcsid[] = "$Id: cdrdao.c,v 1.10 2004/06/27 15:29:22 rocky Exp $"; #include "cdio_assert.h" #include "cdio_private.h" @@ -106,7 +106,8 @@ typedef struct { char *toc_name; char *mcn; /* Media Catalog Number (5.22.3) exactly 13 bytes */ - track_info_t tocent[100]; /* entry info for each track */ + track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track + add 1 for leadout. */ track_t i_tracks; /* number of tracks in image */ track_t i_first_track; /* track number of first track */ track_format_t mode; diff --git a/lib/image/nrg.c b/lib/image/nrg.c index 256ff726..fe4a9aea 100644 --- a/lib/image/nrg.c +++ b/lib/image/nrg.c @@ -1,5 +1,5 @@ /* - $Id: nrg.c,v 1.23 2004/06/18 22:55:24 rocky Exp $ + $Id: nrg.c,v 1.24 2004/06/27 15:29:22 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein Copyright (C) 2001, 2003 Herbert Valerio Riedel @@ -49,7 +49,7 @@ #include "_cdio_stdio.h" #include "nrg.h" -static const char _rcsid[] = "$Id: nrg.c,v 1.23 2004/06/18 22:55:24 rocky Exp $"; +static const char _rcsid[] = "$Id: nrg.c,v 1.24 2004/06/27 15:29:22 rocky Exp $"; /* reader */ @@ -99,8 +99,9 @@ typedef struct { /* This is a hack because I don't really understnad NERO better. */ bool is_cues; - char *mcn; /* Media catalog number. */ - track_info_t tocent[100]; /* entry info for each track */ + char *mcn; /* Media Catalog Number (5.22.3) */ + track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track + add 1 for leadout. */ track_t i_tracks; /* number of tracks in image */ track_t i_first_track; /* track number of first track */ CdioList *mapping; /* List of track information */ @@ -384,18 +385,21 @@ parse_nrg (_img_private_t *env, const char *psz_nrg_name) track_format_t track_format; int form2; - env->mcn = _cdio_malloc (CDIO_MCN_SIZE); + /* We include an extra 0 byte so these can be used as C strings.*/ + env->mcn = _cdio_malloc (CDIO_MCN_SIZE+1); if (DAOX_ID == opcode) { _daox_array_t *_entries = (void *) chunk->data; form2 = _entries->_unknown[1]; env->dtyp = _entries->_unknown[19]; memcpy(env->mcn, &(_entries->mcn), CDIO_MCN_SIZE); + env->mcn[CDIO_MCN_SIZE] = '\0'; } else { _daoi_array_t *_entries = (void *) chunk->data; form2 = _entries->_unknown[1]; env->dtyp = _entries->_unknown[19]; memcpy(env->mcn, &(_entries->mcn), CDIO_MCN_SIZE); + env->mcn[CDIO_MCN_SIZE] = '\0'; } env->is_dao = true;