1
1
/* grabbag - Convenience lib for various routines common to several tools
2
* Copyright (C) 2002,2003,2004,2005 Josh Coalson
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
2
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
23
#include "share/grabbag.h"
20
24
#include "FLAC/assert.h"
197
201
static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__StreamMetadata *cuesheet, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset)
199
#if defined _MSC_VER || defined __MINGW32__
203
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
200
204
#define FLAC__STRCASECMP stricmp
202
206
#define FLAC__STRCASECMP strcasecmp
204
208
char buffer[4096], *line, *field;
205
unsigned linelen, forced_leadout_track_num = 0;
209
unsigned forced_leadout_track_num = 0;
206
210
FLAC__uint64 forced_leadout_track_offset = 0;
207
211
int in_track_num = -1, in_index_num = -1;
208
212
FLAC__bool disc_has_catalog = false, track_has_flags = false, track_has_isrc = false, has_forced_leadout = false;
215
219
(*last_line_read)++;
218
linelen = strlen(line);
219
if(line[linelen-1] != '\n') {
220
*error_message = "line too long";
223
size_t linelen = strlen(line);
224
if((linelen == sizeof(buffer)-1) && line[linelen-1] != '\n') {
225
*error_message = "line too long";
224
230
if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) {
579
585
fprintf(file, "%I64u\n", track->offset + index->offset);
581
fprintf(file, "%llu\n", track->offset + index->offset);
587
fprintf(file, "%llu\n", (unsigned long long)(track->offset + index->offset));
587
593
fprintf(file, "REM FLAC__lead-in %I64u\n", cs->lead_in);
588
594
fprintf(file, "REM FLAC__lead-out %u %I64u\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset);
590
fprintf(file, "REM FLAC__lead-in %llu\n", cs->lead_in);
591
fprintf(file, "REM FLAC__lead-out %u %llu\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset);
596
fprintf(file, "REM FLAC__lead-in %llu\n", (unsigned long long)cs->lead_in);
597
fprintf(file, "REM FLAC__lead-out %u %llu\n", (unsigned)cs->tracks[track_num].number, (unsigned long long)cs->tracks[track_num].offset);