From b525effb959fda1af1e75a9fe2c1ddfa6e2fb0d7 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 10 Jul 2004 01:21:19 +0000 Subject: [PATCH] Pull out mmssff_to_lba routine and fix bug when in error reporting when frame >= 100. Add msf3_to_lba and use that where possible (win32_ioctl.c for example). --- include/cdio/sector.h | 26 +++- lib/MSWindows/win32_ioctl.c | 10 +- lib/image/bincue.c | 233 +++++++++++++----------------------- lib/image/cdrdao.c | 91 ++------------ lib/sector.c | 115 +++++++++++++++++- 5 files changed, 223 insertions(+), 252 deletions(-) diff --git a/include/cdio/sector.h b/include/cdio/sector.h index 76ead06f..39d06754 100644 --- a/include/cdio/sector.h +++ b/include/cdio/sector.h @@ -1,5 +1,5 @@ /* - $Id: sector.h,v 1.14 2004/06/27 15:29:21 rocky Exp $ + $Id: sector.h,v 1.15 2004/07/10 01:21:19 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003, 2004 Rocky Bernstein @@ -181,6 +181,7 @@ void cdio_lba_to_msf(lba_t lba, msf_t *msf); /*! Convert an LSN into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. */ lba_t cdio_lsn_to_lba (lsn_t lsn); @@ -191,15 +192,30 @@ void cdio_lsn_to_msf (lsn_t lsn, msf_t *msf); /*! Convert a MSF into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. */ -lba_t -cdio_msf_to_lba (const msf_t *msf); +lba_t cdio_msf_to_lba (const msf_t *msf); /*! Convert a MSF into the corresponding LSN. + CDIO_INVALID_LSN is returned if there is an error. */ -lsn_t -cdio_msf_to_lsn (const msf_t *msf); +lsn_t cdio_msf_to_lsn (const msf_t *msf); + +/*! + Convert a MSF - broken out as 3 integer components into the + corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ +lba_t cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds, + unsigned int frames); + +/*! + Convert a string of the form MM:SS:FF into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ +lba_t cdio_mmssff_to_lba (const char *psz_mmssff); + #ifdef __cplusplus } diff --git a/lib/MSWindows/win32_ioctl.c b/lib/MSWindows/win32_ioctl.c index 17a25971..fb75e9c9 100644 --- a/lib/MSWindows/win32_ioctl.c +++ b/lib/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.6 2004/06/28 16:02:07 rocky Exp $ + $Id: win32_ioctl.c,v 1.7 2004/07/10 01:21:20 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.6 2004/06/28 16:02:07 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.7 2004/07/10 01:21:20 rocky Exp $"; #include #include @@ -352,10 +352,6 @@ init_win32ioctl (_img_private_t *env) return false; } -#define MSF_TO_LBA2(min, sec, frame) \ - ((int) frame + CDIO_CD_FRAMES_PER_SEC * (CDIO_CD_SECS_PER_MIN*min + sec) \ - - CDIO_PREGAP_SECTORS ) - /*! Read and cache the CD's Track Table of Contents and track info. Return true if successful or false if an error. @@ -381,7 +377,7 @@ read_toc_win32ioctl (_img_private_t *env) for( i = 0 ; i <= env->total_tracks ; i++ ) { - env->tocent[ i ].start_lsn = MSF_TO_LBA2( + env->tocent[ i ].start_lsn = cdio_msf3_to_lba( cdrom_toc.TrackData[i].Address[1], cdrom_toc.TrackData[i].Address[2], cdrom_toc.TrackData[i].Address[3] ); diff --git a/lib/image/bincue.c b/lib/image/bincue.c index c2e75e02..a19a4327 100644 --- a/lib/image/bincue.c +++ b/lib/image/bincue.c @@ -1,5 +1,5 @@ /* - $Id: bincue.c,v 1.28 2004/07/09 20:48:05 rocky Exp $ + $Id: bincue.c,v 1.29 2004/07/10 01:21:20 rocky Exp $ Copyright (C) 2002, 2003, 2004 Rocky Bernstein Copyright (C) 2001 Herbert Valerio Riedel @@ -26,7 +26,7 @@ (*.cue). */ -static const char _rcsid[] = "$Id: bincue.c,v 1.28 2004/07/09 20:48:05 rocky Exp $"; +static const char _rcsid[] = "$Id: bincue.c,v 1.29 2004/07/10 01:21:20 rocky Exp $"; #include "cdio_assert.h" #include "cdio_private.h" @@ -327,83 +327,6 @@ _stat_size_bincue (void *user_data) return size; } -static lba_t -msf_msf_to_lba (int minutes, int seconds, int frames) -{ - return ( (minutes * CDIO_CD_SECS_PER_MIN + seconds) - * CDIO_CD_FRAMES_PER_SEC + frames ); -} - -static lba_t -mmssff_to_lba (char *s) -{ - int field; - long ret; - char c; - - if (0 == strcmp (s, "0")) - return 0; - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return CDIO_INVALID_LBA; - while(':' != (c = *s++)) { - if(c >= '0' && c <= '9') - field = field * 10 + (c - '0'); - else - return CDIO_INVALID_LBA; - } - - ret = msf_msf_to_lba (field, 0, 0); - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return CDIO_INVALID_LBA; - if(':' != (c = *s++)) { - if(c >= '0' && c <= '9') { - field = field * 10 + (c - '0'); - c = *s++; - if(c != ':') - return CDIO_INVALID_LBA; - } - else - return CDIO_INVALID_LBA; - } - - if(field >= CDIO_CD_SECS_PER_MIN) - return CDIO_INVALID_LBA; - - ret += msf_msf_to_lba (0, field, 0); - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return CDIO_INVALID_LBA; - if('\0' != (c = *s++)) { - if(c >= '0' && c <= '9') { - field = field * 10 + (c - '0'); - c = *s++; - } - else - return CDIO_INVALID_LBA; - } - - if('\0' != c) - return CDIO_INVALID_LBA; - - if(field >= CDIO_CD_FRAMES_PER_SEC) - return CDIO_INVALID_LBA; - - ret += field; - - return ret; -} - #define MAXLINE 4096 /* maximum line length + 1 */ static bool @@ -412,7 +335,6 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name) FILE *fp; char psz_line[MAXLINE]; unsigned int i_line=0; - int min,sec,frame; int start_index; char *psz_keyword, *psz_field; cdio_log_level_t log_level = (NULL == cd) ? CDIO_LOG_INFO : CDIO_LOG_WARN; @@ -505,9 +427,10 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name) if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { if (1!=sscanf(psz_field, "%d", &i_track)) { cdio_log(log_level, - "%s line %d after keyword TRACK - " - "expecting a track number", + "%s line %d after word TRACK:", psz_cue_name, i_line); + cdio_log(log_level, + "Expecting a track number, got %s", psz_field); goto err_exit; } } @@ -604,7 +527,12 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name) this_track->endsize = CDIO_CD_SYNC_SIZE + CDIO_CD_ECC_SIZE; } } else { - goto format_error; + cdio_log(log_level, + "%s line %d after word TRACK:", + psz_cue_name, i_line); + cdio_log(log_level, + "Unknown track mode %s", psz_field); + goto err_exit; } } else { goto format_error; @@ -646,7 +574,17 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name) } else if (0 == strcmp ("PREGAP", psz_keyword)) { if (0 <= i) { if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { - if (cd) cd->tocent[i].pregap = mmssff_to_lba (psz_field); + lba_t lba = cdio_lsn_to_lba(cdio_mmssff_to_lba (psz_field)); + if (CDIO_INVALID_LBA == lba) { + cdio_log(log_level, "%s line %d: after word PREGAP:", + psz_cue_name, i_line); + cdio_log(log_level, "Invalid MSF string %s", + psz_field); + goto err_exit; + } + if (cd) { + cd->tocent[i].pregap = lba; + } } else { goto format_error; } if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { @@ -662,77 +600,68 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name) if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) if (1!=sscanf(psz_field, "%d", &start_index)) { cdio_log(log_level, - "%s line %d after keyword INDEX - " - "expecting an index number", + "%s line %d after word INDEX:", psz_cue_name, i_line); + cdio_log(log_level, + "expecting an index number, got %s", + psz_field); goto err_exit; } if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { -#if FIXED_ME - if (cd) cd->tocent[i].indexes[cd->tocent[i].nindex++] = - mmssff_to_lba (psz_field); -#else - if (3==sscanf(psz_field, "%d:%d:%d", &min, &sec, &frame)) { - if (cd) { - track_info_t *this_track= - &(cd->tocent[cd->i_tracks - cd->i_first_track]); - - /* FIXME! all of this is a big hack. If start_index - == 0, then this is the "last_cue" information. The - +2 below seconds is to adjust for the 150 pregap. - */ - if (start_index != 0) { - if (!b_first_index_for_track) { - this_track->start_index = start_index; - sec += 2; - if (sec >= 60) { - min++; - sec -= 60; - } - b_first_index_for_track = true; - this_track->start_msf.m = to_bcd8 (min); - this_track->start_msf.s = to_bcd8 (sec); - this_track->start_msf.f = to_bcd8 (frame); - this_track->start_lba = cdio_msf_to_lba(&this_track->start_msf); - } - - if (cd->i_tracks > 1) { - /* Figure out number of sectors for previous track */ - track_info_t *prev_track=&(cd->tocent[cd->i_tracks-2]); - if ( this_track->start_lba < prev_track->start_lba ) { - cdio_log (log_level, - "track %d at LBA %lu starts before track %d at LBA %lu", - cd->i_tracks, - (unsigned long int) this_track->start_lba, - cd->i_tracks, - (unsigned long int) prev_track->start_lba); - prev_track->sec_count = 0; - } else if ( this_track->start_lba >= prev_track->start_lba - + CDIO_PREGAP_SECTORS ) { - prev_track->sec_count = this_track->start_lba - - prev_track->start_lba - CDIO_PREGAP_SECTORS ; - } else { - cdio_log (log_level, - "%lu fewer than pregap (%d) sectors in track %d", - (long unsigned int) - this_track->start_lba - prev_track->start_lba, - CDIO_PREGAP_SECTORS, - cd->i_tracks); - /* Include pregap portion in sec_count. Maybe the pregap - was omitted. */ - prev_track->sec_count = this_track->start_lba - - prev_track->start_lba; - } - } - this_track->num_indices++; - } - } - } else { - cdio_log (log_level, - "%s line %d: after keyword: %s - expecting MM:SS::FF", - psz_cue_name, i_line, psz_keyword); + lba_t lba = cdio_mmssff_to_lba (psz_field); + if (CDIO_INVALID_LBA == lba) { + cdio_log(log_level, "%s line %d: after word INDEX:", + psz_cue_name, i_line); + cdio_log(log_level, "Invalid MSF string %s", + psz_field); goto err_exit; } + if (cd) { +#if FIXED_ME + cd->tocent[i].indexes[cd->tocent[i].nindex++] = lba; +#else + track_info_t *this_track= + &(cd->tocent[cd->i_tracks - cd->i_first_track]); + + if (start_index != 0) { + if (!b_first_index_for_track) { + lba += CDIO_PREGAP_SECTORS; + cdio_lba_to_msf(lba, &(this_track->start_msf)); + b_first_index_for_track = true; + this_track->start_lba = lba; + } + + if (cd->i_tracks > 1) { + /* Figure out number of sectors for previous track */ + track_info_t *prev_track=&(cd->tocent[cd->i_tracks-2]); + if ( this_track->start_lba < prev_track->start_lba ) { + cdio_log (log_level, + "track %d at LBA %lu starts before track %d at LBA %lu", + cd->i_tracks, + (unsigned long int) this_track->start_lba, + cd->i_tracks, + (unsigned long int) prev_track->start_lba); + prev_track->sec_count = 0; + } else if ( this_track->start_lba >= prev_track->start_lba + + CDIO_PREGAP_SECTORS ) { + prev_track->sec_count = this_track->start_lba - + prev_track->start_lba - CDIO_PREGAP_SECTORS ; + } else { + cdio_log (log_level, + "%lu fewer than pregap (%d) sectors in track %d", + (long unsigned int) + this_track->start_lba - prev_track->start_lba, + CDIO_PREGAP_SECTORS, + cd->i_tracks); + /* Include pregap portion in sec_count. Maybe the pregap + was omitted. */ + prev_track->sec_count = this_track->start_lba - + prev_track->start_lba; + } + } + this_track->num_indices++; + } + } #endif } else { goto format_error; @@ -771,17 +700,17 @@ parse_cuefile (_img_private_t *cd, const char *psz_cue_name) return true; format_error: - cdio_log(log_level, "%s line %d after keyword %s", + cdio_log(log_level, "%s line %d after word %s", psz_cue_name, i_line, psz_keyword); goto err_exit; in_global_section: - cdio_log(log_level, "%s line %d: keyword %s not allowed in global section", + cdio_log(log_level, "%s line %d: word %s not allowed in global section", psz_cue_name, i_line, psz_keyword); goto err_exit; not_in_global_section: - cdio_log(log_level, "%s line %d: keyword %s only allowed in global section", + cdio_log(log_level, "%s line %d: word %s only allowed in global section", psz_cue_name, i_line, psz_keyword); err_exit: diff --git a/lib/image/cdrdao.c b/lib/image/cdrdao.c index da523328..fd3277d2 100644 --- a/lib/image/cdrdao.c +++ b/lib/image/cdrdao.c @@ -1,5 +1,5 @@ /* - $Id: cdrdao.c,v 1.14 2004/07/09 20:48:05 rocky Exp $ + $Id: cdrdao.c,v 1.15 2004/07/10 01:21:20 rocky Exp $ Copyright (C) 2004 Rocky Bernstein toc reading routine adapted from cuetools @@ -29,7 +29,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: cdrdao.c,v 1.14 2004/07/09 20:48:05 rocky Exp $"; +static const char _rcsid[] = "$Id: cdrdao.c,v 1.15 2004/07/10 01:21:20 rocky Exp $"; #include "cdio_assert.h" #include "cdio_private.h" @@ -124,83 +124,6 @@ static bool parse_tocfile (_img_private_t *cd, const char *toc_name); #include "image_common.h" -static lba_t -msf_to_lba (int minutes, int seconds, int frames) -{ - return ((minutes * CDIO_CD_SECS_PER_MIN + seconds) * CDIO_CD_FRAMES_PER_SEC - + frames); -} - -static lba_t -msf_lba_from_mmssff (char *s) -{ - int field; - lba_t ret; - char c; - - if (0 == strcmp (s, "0")) - return 0; - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return CDIO_INVALID_LBA; - while(':' != (c = *s++)) { - if(c >= '0' && c <= '9') - field = field * 10 + (c - '0'); - else - return CDIO_INVALID_LBA; - } - - ret = msf_to_lba (field, 0, 0); - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return CDIO_INVALID_LBA; - if(':' != (c = *s++)) { - if(c >= '0' && c <= '9') { - field = field * 10 + (c - '0'); - c = *s++; - if(c != ':') - return CDIO_INVALID_LBA; - } - else - return CDIO_INVALID_LBA; - } - - if(field >= CDIO_CD_SECS_PER_MIN) - return CDIO_INVALID_LBA; - - ret += msf_to_lba (0, field, 0); - - c = *s++; - if (isdigit(c)) - field = (c - '0'); - else - return -1; - if('\0' != (c = *s++)) { - if (isdigit(c)) { - field = field * 10 + (c - '0'); - c = *s++; - } - else - return CDIO_INVALID_LBA; - } - - if('\0' != c) - return -1; - - if(field >= CDIO_CD_FRAMES_PER_SEC) - return CDIO_INVALID_LBA; - - ret += field; - - return ret; -} - /*! Initialize image structures. */ @@ -632,7 +555,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_toc_name) } if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { - lba_t lba = cdio_lsn_to_lba(msf_lba_from_mmssff (psz_field)); + lba_t lba = cdio_lsn_to_lba(cdio_mmssff_to_lba (psz_field)); if (CDIO_INVALID_LBA == lba) { cdio_log(log_level, "%s line %d: invalid MSF string %s", psz_toc_name, i_line, psz_field); @@ -646,7 +569,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_toc_name) } if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) if (NULL != cd) - cd->tocent[i].length = msf_lba_from_mmssff (psz_field); + cd->tocent[i].length = cdio_mmssff_to_lba (psz_field); if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { goto format_error; } @@ -668,7 +591,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_toc_name) if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { /* todo: line is too long! */ if (NULL != cd) { - cd->tocent[i].start_lba += msf_lba_from_mmssff (psz_field); + cd->tocent[i].start_lba += cdio_mmssff_to_lba (psz_field); cdio_lba_to_msf(cd->tocent[i].start_lba, &(cd->tocent[i].start_msf)); } @@ -686,7 +609,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_toc_name) if (0 <= i) { if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) { if (NULL != cd) - cd->tocent[i].pregap = msf_lba_from_mmssff (psz_field); + cd->tocent[i].pregap = cdio_mmssff_to_lba (psz_field); } else { goto format_error; } @@ -708,7 +631,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_toc_name) cd->tocent[i].nindex++; } cd->tocent[i].indexes[cd->tocent[i].nindex++] = - msf_lba_from_mmssff (psz_field) + cd->tocent[i].indexes[0]; + cdio_mmssff_to_lba (psz_field) + cd->tocent[i].indexes[0]; #else ; diff --git a/lib/sector.c b/lib/sector.c index 3f11ee49..fd226fb1 100644 --- a/lib/sector.c +++ b/lib/sector.c @@ -1,5 +1,5 @@ /* - $Id: sector.c,v 1.11 2004/06/12 17:32:00 rocky Exp $ + $Id: sector.c,v 1.12 2004/07/10 01:21:19 rocky Exp $ Copyright (C) 2004 Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel @@ -33,8 +33,9 @@ #include #endif +#include -static const char _rcsid[] = "$Id: sector.c,v 1.11 2004/06/12 17:32:00 rocky Exp $"; +static const char _rcsid[] = "$Id: sector.c,v 1.12 2004/07/10 01:21:19 rocky Exp $"; lba_t cdio_lba_to_lsn (lba_t lba) @@ -79,7 +80,9 @@ cdio_lsn_to_msf (lsn_t lsn, msf_t *msf) msf->f = to_bcd8 (f); } -/* warning, returns new allocated string */ +/*! + Convert an LBA into a string representation of the MSF. + \warning cdio_lba_to_msf_str returns new allocated string */ char * cdio_lba_to_msf_str (lba_t lba) { @@ -93,6 +96,10 @@ cdio_lba_to_msf_str (lba_t lba) } } +/*! + Convert an LSN into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ lba_t cdio_lsn_to_lba (lsn_t lsn) { @@ -100,6 +107,9 @@ cdio_lsn_to_lba (lsn_t lsn) return lsn + CDIO_PREGAP_SECTORS; } +/*! + Convert an LBA into the corresponding MSF. +*/ void cdio_lba_to_msf (lba_t lba, msf_t *msf) { @@ -107,6 +117,10 @@ cdio_lba_to_msf (lba_t lba, msf_t *msf) cdio_lsn_to_msf(cdio_lba_to_lsn(lba), msf); } +/*! + Convert a MSF into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ lba_t cdio_msf_to_lba (const msf_t *msf) { @@ -125,13 +139,19 @@ cdio_msf_to_lba (const msf_t *msf) return lba; } +/*! + Convert a MSF into the corresponding LSN. + CDIO_INVALID_LSN is returned if there is an error. +*/ lba_t cdio_msf_to_lsn (const msf_t *msf) { return cdio_lba_to_lsn(cdio_msf_to_lba (msf)); } -/* warning, returns new allocated string */ +/*! + Convert an LBA into a string representation of the MSF. + \warning cdio_lba_to_msf_str returns new allocated string */ char * cdio_msf_to_str (const msf_t *msf) { @@ -141,6 +161,93 @@ cdio_msf_to_str (const msf_t *msf) return strdup (buf); } +/*! + Convert a MSF - broken out as 3 integer components into the + corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ +lba_t +cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds, + unsigned int frames) +{ + return ((minutes * CDIO_CD_SECS_PER_MIN + seconds) * CDIO_CD_FRAMES_PER_SEC + + frames); +} + +/*! + Convert a string of the form MM:SS:FF into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ +lba_t +cdio_mmssff_to_lba (const char *psz_mmssff) +{ + int psz_field; + lba_t ret; + char c; + + if (0 == strcmp (psz_mmssff, "0")) + return 0; + + c = *psz_mmssff++; + if(c >= '0' && c <= '9') + psz_field = (c - '0'); + else + return CDIO_INVALID_LBA; + while(':' != (c = *psz_mmssff++)) { + if(c >= '0' && c <= '9') + psz_field = psz_field * 10 + (c - '0'); + else + return CDIO_INVALID_LBA; + } + + ret = cdio_msf3_to_lba (psz_field, 0, 0); + + c = *psz_mmssff++; + if(c >= '0' && c <= '9') + psz_field = (c - '0'); + else + return CDIO_INVALID_LBA; + if(':' != (c = *psz_mmssff++)) { + if(c >= '0' && c <= '9') { + psz_field = psz_field * 10 + (c - '0'); + c = *psz_mmssff++; + if(c != ':') + return CDIO_INVALID_LBA; + } + else + return CDIO_INVALID_LBA; + } + + if(psz_field >= CDIO_CD_SECS_PER_MIN) + return CDIO_INVALID_LBA; + + ret += cdio_msf3_to_lba (0, psz_field, 0); + + c = *psz_mmssff++; + if (isdigit(c)) + psz_field = (c - '0'); + else + return -1; + if('\0' != (c = *psz_mmssff++)) { + if (isdigit(c)) { + psz_field = psz_field * 10 + (c - '0'); + c = *psz_mmssff++; + } + else + return CDIO_INVALID_LBA; + } + + if('\0' != c) + return CDIO_INVALID_LBA; + + if(psz_field >= CDIO_CD_FRAMES_PER_SEC) + return CDIO_INVALID_LBA; + + ret += psz_field; + + return ret; +} + /* * Local variables: