Commit 91790ef9 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

Fix compiler warnings from new compiler flags.

parent 05609d5b
......@@ -8,6 +8,7 @@ EXTRA_DIST = \
endswap.h \
getopt.h \
grabbag.h \
macros.h \
replaygain_analysis.h \
replaygain_synthesis.h \
utf8.h
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013 Xiph.org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <errno.h>
/* FLAC_CHECK_RETURN : Check the return value of of the provided function and
* print and error message if it fails (ie returns a value < 0).
*/
#define FLAC_CHECK_RETURN(x) \
{ if ((x) < 0) \
printf ("%s : %s\n", #x, strerror (errno)) ; \
}
......@@ -46,6 +46,7 @@
#include "FLAC/stream_decoder.h"
#include "share/alloc.h"
#include "share/compat.h"
#include "share/macros.h"
#include "private/macros.h"
#include "private/memory.h"
......@@ -3295,8 +3296,8 @@ void set_file_stats_(const char *filename, struct stat *stats)
(void)chmod(filename, stats->st_mode);
(void)utime(filename, &srctime);
#if !defined _MSC_VER && !defined __BORLANDC__ && !defined __MINGW32__
(void)chown(filename, stats->st_uid, -1);
(void)chown(filename, -1, stats->st_gid);
FLAC_CHECK_RETURN(chown(filename, stats->st_uid, -1));
FLAC_CHECK_RETURN(chown(filename, -1, stats->st_gid));
#endif
}
......
......@@ -302,8 +302,7 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con
}
ret = true;
while(ret && !feof(f)) {
fgets(line, sizeof(line), f);
while(ret && !feof(f) && fgets(line, sizeof(line), f) != NULL) {
if(!feof(f)) {
char *p = strchr(line, '\n');
if(0 == p) {
......
......@@ -32,6 +32,7 @@
#include "FLAC++/metadata.h"
#include "share/grabbag.h"
#include "share/compat.h"
#include "share/macros.h"
extern "C" {
#include "test_libs_common/file_utils_flac.h"
}
......@@ -270,8 +271,8 @@ void set_file_stats_(const char *filename, struct stat *stats)
(void)chmod(filename, stats->st_mode);
(void)utime(filename, &srctime);
#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
(void)chown(filename, stats->st_uid, (gid_t)(-1));
(void)chown(filename, (uid_t)(-1), stats->st_gid);
FLAC_CHECK_RETURN(chown(filename, stats->st_uid, (gid_t)(-1)));
FLAC_CHECK_RETURN(chown(filename, (uid_t)(-1), stats->st_gid));
#endif
}
......
......@@ -37,6 +37,7 @@
#include "FLAC/metadata.h"
#include "share/grabbag.h"
#include "share/compat.h"
#include "share/macros.h"
#include "test_libs_common/file_utils_flac.h"
#include "test_libs_common/metadata_utils.h"
#include "metadata.h"
......@@ -260,8 +261,8 @@ static void set_file_stats_(const char *filename, struct stat *stats)
(void)chmod(filename, stats->st_mode);
(void)utime(filename, &srctime);
#if !defined _MSC_VER && !defined __MINGW32__
(void)chown(filename, stats->st_uid, -1);
(void)chown(filename, -1, stats->st_gid);
FLAC_CHECK_RETURN(chown(filename, stats->st_uid, -1));
FLAC_CHECK_RETURN(chown(filename, -1, stats->st_gid));
#endif
}
......
......@@ -167,8 +167,8 @@ static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const c
signed char c;
for(i = 0; i < samples; i++) {
for(j = 0; j < channels; j++) {
fread(&c, 1, 1, f);
pcm[j][i] = c;
if (fread(&c, 1, 1, f) == 1)
pcm[j][i] = c;
}
}
}
......@@ -176,8 +176,8 @@ static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const c
unsigned char c[2];
for(i = 0; i < samples; i++) {
for(j = 0; j < channels; j++) {
fread(&c, 1, 2, f);
pcm[j][i] = ((int)((signed char)c[0])) << 8 | (int)c[1];
if (fread(&c, 1, 2, f) == 2)
pcm[j][i] = ((int)((signed char)c[0])) << 8 | (int)c[1];
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment