X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Ftest_libs_common%2Ffile_utils_flac.c;h=892e2bd2ff33db6a07a1c15b3cfb53c98b2d7be2;hb=2bce0d60fea330b527ba92af12dc232d41bac7ae;hp=a45f21cba97f7e9a62f8bad4691ccc6e2eda1490;hpb=71d5c256f54042488fa5228833342011e96e15aa;p=platform%2Fupstream%2Fflac.git diff --git a/src/test_libs_common/file_utils_flac.c b/src/test_libs_common/file_utils_flac.c index a45f21c..892e2bd 100644 --- a/src/test_libs_common/file_utils_flac.c +++ b/src/test_libs_common/file_utils_flac.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2013 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #if HAVE_CONFIG_H @@ -26,6 +27,7 @@ #include #include #include /* for stat() */ +#include "share/compat.h" #ifdef min #undef min @@ -50,7 +52,7 @@ typedef struct { FILE *file; } encoder_client_struct; -static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) { encoder_client_struct *ecd = (encoder_client_struct*)client_data; @@ -67,7 +69,7 @@ static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const (void)encoder, (void)metadata, (void)client_data; } -FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata) +FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_filename, FLAC__off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata) { FLAC__int32 samples[1024]; FLAC__StreamEncoder *encoder; @@ -80,7 +82,7 @@ FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_f FLAC__ASSERT(streaminfo->type == FLAC__METADATA_TYPE_STREAMINFO); FLAC__ASSERT((streaminfo->is_last && num_metadata == 0) || (!streaminfo->is_last && num_metadata > 0)); - if(0 == (encoder_client_data.file = fopen(output_filename, "wb"))) + if(0 == (encoder_client_data.file = flac_fopen(output_filename, "wb"))) return false; encoder = FLAC__stream_encoder_new(); @@ -134,16 +136,16 @@ FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_f length -= n; } - FLAC__stream_encoder_finish(encoder); + (void)FLAC__stream_encoder_finish(encoder); fclose(encoder_client_data.file); FLAC__stream_encoder_delete(encoder); if(0 != output_filesize) { - struct stat filestats; + struct flac_stat_s filestats; - if(stat(output_filename, &filestats) != 0) + if(flac_stat(output_filename, &filestats) != 0) return false; else *output_filesize = filestats.st_size;