bee312f0141e73f96867bf071406eb518c58b4bb
[platform/upstream/flac.git] / src / metaflac / utils.h
1 /* metaflac - Command-line FLAC metadata editor
2  * Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  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,
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.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 #ifndef metaflac__utils_h
20 #define metaflac__utils_h
21
22 #include "FLAC/metadata.h"
23 #include <stdio.h> /* for FILE */
24
25 void die(const char *message);
26 #ifdef FLAC__VALGRIND_TESTING
27 size_t local_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
28 #else
29 #define local_fwrite fwrite
30 #endif
31 char *local_strdup(const char *source);
32 void local_strcat(char **dest, const char *source);
33 void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const char *indent);
34 void print_error_with_chain_status(FLAC__Metadata_Chain *chain, const char *format, ...);
35
36 FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, unsigned *length, const char **violation);
37
38 void write_vc_field(const char *filename, const FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__bool raw, FILE *f);
39 void write_vc_fields(const char *filename, const char *field_name, const FLAC__StreamMetadata_VorbisComment_Entry entry[], unsigned num_entries, FLAC__bool raw, FILE *f);
40
41 #endif