~ubuntu-branches/ubuntu/saucy/flac/saucy-proposed

« back to all changes in this revision

Viewing changes to src/flac/vorbiscomment.c

  • Committer: Package Import Robot
  • Author(s): Fabian Greffrath
  • Date: 2013-06-07 10:24:30 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20130607102430-x7e7zt462c0tuetp
Tags: 1.3.0-1
* Imported Upstream version 1.3.0 (Closes: #527542, #705601).
* Update debian/watch file, thanks Ulrich Klauer (Closes: #710062).
* Revert "Remove manpages from master branch."
* Imported Upstream version 1.3.0
* Convert package to "3.0 (quilt)" source format.
* Remove all patches, they have either been merged upstream or do not
  apply anymore (tested).
* Explicitly enable static libraries.
* Simplify debian/libflac-doc.install.
* Bump shlibs for added symbols.
* Remove needless Build-Depends: libid3-3.8.3-dev.
* Update Homepage field.
* Repair upstream manpage regeneration rule.
* Bump Build-Depends: debhelper (>= 9).
* Fix vcs-field-not-canonical.
* Import two patches from upstream GIT:
  + Add missing config.h includes.
  + Fix local_strcat() to terminate string correctly.
* Disable 3DNow! optimizations, enable SSE only on amd64, enable Altivec
  only on ppc64, disable ASM optimizations elsewhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* flac - Command-line FLAC encoder/decoder
2
 
 * Copyright (C) 2002,2003,2004,2005,2006,2007  Josh Coalson
 
2
 * Copyright (C) 2002-2009  Josh Coalson
 
3
 * Copyright (C) 2011-2013  Xiph.Org Foundation
3
4
 *
4
5
 * This program is free software; you can redistribute it and/or
5
6
 * modify it under the terms of the GNU General Public License
11
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
13
 * GNU General Public License for more details.
13
14
 *
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.
 
15
 * You should have received a copy of the GNU General Public License along
 
16
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
17
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
 */
18
19
 
19
20
#if HAVE_CONFIG_H
29
30
#include <stdio.h>
30
31
#include <stdlib.h>
31
32
#include <string.h>
 
33
#include "share/compat.h"
32
34
 
33
35
 
34
36
/*
113
115
                /* read the file into 'data' */
114
116
                FILE *f = 0;
115
117
                char *data = 0;
116
 
                const off_t size = grabbag__file_get_filesize(field->field_value);
 
118
                const FLAC__off_t size = grabbag__file_get_filesize(field->field_value);
117
119
                if(size < 0) {
118
120
                        *violation = "can't open file for tag value";
119
121
                        return false;
125
127
                if(0 == (data = malloc(size+1)))
126
128
                        die("out of memory allocating tag value");
127
129
                data[size] = '\0';
128
 
                if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
 
130
                if(0 == (f = flac_fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
129
131
                        free(data);
130
132
                        if(f)
131
133
                                fclose(f);
169
171
        }
170
172
        else {
171
173
                FLAC__bool needs_free = false;
 
174
#ifdef _WIN32 /* everything in UTF-8 already. Must not alter */
 
175
                entry.entry = (FLAC__byte *)field->field;
 
176
#else
172
177
                if(raw) {
173
178
                        entry.entry = (FLAC__byte *)field->field;
174
179
                }
180
185
                        *violation = "error converting comment to UTF-8";
181
186
                        return false;
182
187
                }
 
188
#endif
183
189
                entry.length = strlen((const char *)entry.entry);
184
190
                if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) {
185
191
                        if(needs_free)