~ubuntu-branches/ubuntu/karmic/flac/karmic

« back to all changes in this revision

Viewing changes to src/metaflac/utils.c

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2005-01-08 15:08:22 UTC
  • mto: (8.1.1 lenny)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050108150822-yvinilrafylazcyv
Tags: upstream-1.1.1
ImportĀ upstreamĀ versionĀ 1.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* metaflac - Command-line FLAC metadata editor
2
 
 * Copyright (C) 2001,2002,2003  Josh Coalson
 
2
 * Copyright (C) 2001,2002,2003,2004  Josh Coalson
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU General Public License
20
20
#include "FLAC/assert.h"
21
21
#include "share/utf8.h"
22
22
#include <ctype.h>
 
23
#include <stdarg.h>
23
24
#include <stdio.h>
24
25
#include <stdlib.h>
25
26
#include <string.h>
119
120
   }
120
121
}
121
122
 
 
123
void print_error_with_chain_status(FLAC__Metadata_Chain *chain, const char *format, ...)
 
124
{
 
125
        const FLAC__Metadata_ChainStatus status = FLAC__metadata_chain_status(chain);
 
126
        va_list args;
 
127
 
 
128
        FLAC__ASSERT(0 != format);
 
129
 
 
130
        va_start(args, format);
 
131
 
 
132
        (void) vfprintf(stderr, format, args);
 
133
 
 
134
        va_end(args);
 
135
 
 
136
        fprintf(stderr, ", status = \"%s\"\n", FLAC__Metadata_ChainStatusString[status]);
 
137
 
 
138
        if(status == FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE) {
 
139
                fprintf(stderr, "\n"
 
140
                        "The FLAC file could not be opened.  Most likely the file does not exist\n"
 
141
                        "or is not readable.\n"
 
142
                );
 
143
        }
 
144
        else if(status == FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE) {
 
145
                fprintf(stderr, "\n"
 
146
                        "The file does not appear to be a FLAC file.\n"
 
147
                );
 
148
        }
 
149
        else if(status == FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE) {
 
150
                fprintf(stderr, "\n"
 
151
                        "The FLAC file does not have write permissions.\n"
 
152
                );
 
153
        }
 
154
        else if(status == FLAC__METADATA_CHAIN_STATUS_BAD_METADATA) {
 
155
                fprintf(stderr, "\n"
 
156
                        "The metadata to be writted does not conform to the FLAC metadata\n"
 
157
                        "specifications.\n"
 
158
                );
 
159
        }
 
160
        else if(status == FLAC__METADATA_CHAIN_STATUS_READ_ERROR) {
 
161
                fprintf(stderr, "\n"
 
162
                        "There was an error while reading the FLAC file.\n"
 
163
                );
 
164
        }
 
165
        else if(status == FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR) {
 
166
                fprintf(stderr, "\n"
 
167
                        "There was an error while writing FLAC file; most probably the disk is\n"
 
168
                        "full.\n"
 
169
                );
 
170
        }
 
171
        else if(status == FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR) {
 
172
                fprintf(stderr, "\n"
 
173
                        "There was an error removing the temporary FLAC file.\n"
 
174
                );
 
175
        }
 
176
}
 
177
 
122
178
FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, unsigned *length, const char **violation)
123
179
{
124
180
        static const char * const violations[] = {