~ubuntu-branches/ubuntu/precise/flac/precise-updates

« back to all changes in this revision

Viewing changes to src/share/grabbag/cuesheet.c

  • Committer: Bazaar Package Importer
  • Author(s): Joshua Kwan
  • Date: 2007-05-29 22:56:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529225636-ljeff8xxip09qaap
Tags: 1.1.4-1
* New upstream release. closes: #405167, #411311
  - libOggFLAC and libOggFLAC++ have been merged into libFLAC, so
    remove their corresponding packages.
  - Because of the API changes required to effect the above, there has
    been yet another soname bump. libflac7 -> libflac8 and
    libflac++5 -> libflac++6. Emails have been dispatched to the
    maintainers of dependent packages.
* Some notes on patches that were removed:
  - 02_stdin_stdout, 06_manpage_mention_utf8_convert: merged upstream
  - 08_manpage_warnings: Upstream has changed the manpage so it defintely
    can't fit in in 80 cols, so just forget about it. We'll live.
  - 05_eof_warnings_are_errors: Upstream decided to add a -w option to
    flac to treat all warnings as errors. I am going to defer to that
    for now, but if people think it's stupid let me know and I'll port
    the patch forward.
  - 04_stack_smasher: was a backport from 1.1.3, so it's obsolete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* grabbag - Convenience lib for various routines common to several tools
2
 
 * Copyright (C) 2002,2003,2004,2005  Josh Coalson
3
 
 *
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.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
 
2
 * Copyright (C) 2002,2003,2004,2005,2006,2007  Josh Coalson
 
3
 *
 
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.
 
8
 *
 
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.
13
13
 *
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
17
17
 */
18
18
 
 
19
#if HAVE_CONFIG_H
 
20
#  include <config.h>
 
21
#endif
 
22
 
19
23
#include "share/grabbag.h"
20
24
#include "FLAC/assert.h"
21
25
#include <stdio.h>
196
200
 
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)
198
202
{
199
 
#if defined _MSC_VER || defined __MINGW32__
 
203
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
200
204
#define FLAC__STRCASECMP stricmp
201
205
#else
202
206
#define FLAC__STRCASECMP strcasecmp
203
207
#endif
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)++;
216
220
                line = buffer;
217
221
 
218
 
                linelen = strlen(line);
219
 
                if(line[linelen-1] != '\n') {
220
 
                        *error_message = "line too long";
221
 
                        return false;
 
222
                {
 
223
                        size_t linelen = strlen(line);
 
224
                        if((linelen == sizeof(buffer)-1) && line[linelen-1] != '\n') {
 
225
                                *error_message = "line too long";
 
226
                                return false;
 
227
                        }
222
228
                }
223
229
 
224
230
                if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) {
578
584
#ifdef _MSC_VER
579
585
                                fprintf(file, "%I64u\n", track->offset + index->offset);
580
586
#else
581
 
                                fprintf(file, "%llu\n", track->offset + index->offset);
 
587
                                fprintf(file, "%llu\n", (unsigned long long)(track->offset + index->offset));
582
588
#endif
583
589
                }
584
590
        }
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);
589
595
#else
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);
592
598
#endif
593
599
}