Skip to content

Commit

Permalink
fix clang compiler warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Petrosyan <[email protected]>
  • Loading branch information
mahkoh authored and flyingmutant committed Oct 7, 2013
1 parent fbbbc3c commit 8479aa7
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 44 deletions.
2 changes: 1 addition & 1 deletion cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static int read_cache(void)

offset = sizeof(cache_header);
while (offset < size) {
struct cache_entry *e = (struct cache_entry *)(buf + offset);
struct cache_entry *e = (void *)(buf + offset);
struct track_info *ti;

if (!valid_cache_entry(e, size - offset))
Expand Down
2 changes: 1 addition & 1 deletion cdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ static int libcdio_read_comments(struct input_plugin_data *ip_data, struct keyva
#else
cdt = cdio_get_cdtext(priv->cdio, priv->track);
if (cdt) {
track_comments_found = 1;
char * const *field = cdt->field;
track_comments_found = 1;
artist = field[CDTEXT_PERFORMER];
title = field[CDTEXT_TITLE];
genre = field[CDTEXT_GENRE];
Expand Down
4 changes: 2 additions & 2 deletions convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ ssize_t convert(const char *inbuf, ssize_t inbuf_size,
#ifdef HAVE_ICONV
const char *in;
char *out;
size_t outbuf_size, inbytesleft, outbytesleft;
size_t rc, outbuf_size, inbytesleft, outbytesleft;
iconv_t cd;
int rc, finished = 0, err_save;
int finished = 0, err_save;

cd = iconv_open(tocode, fromcode);
if (cd == (iconv_t) -1)
Expand Down
2 changes: 2 additions & 0 deletions ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,11 @@ static int ffmpeg_fill_buffer(AVFormatContext *ic, AVCodecContext *cc, struct ff
int got_frame;
#endif
while (1) {
#if (LIBAVCODEC_VERSION_INT < ((53<<16) + (25<<8) + 0))
/* frame_size specifies the size of output->buffer for
* avcodec_decode_audio2. */
int frame_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
#endif
int len;

if (input->curr_pkt_size <= 0) {
Expand Down
10 changes: 5 additions & 5 deletions flac.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,35 +243,35 @@ static FLAC__StreamDecoderWriteStatus write_cb(const Dec *dec, const FLAC__Frame
b[j++] = buf[ch % nch][i];
}
} else if (depth == 16) {
int16_t *b = (int16_t *)(priv->buf + priv->buf_wpos);
int16_t *b = (void *)(priv->buf + priv->buf_wpos);

for (i = 0; i < frames; i++) {
for (ch = 0; ch < channels; ch++)
b[j++] = LE16(buf[ch % nch][i]);
}
} else if (depth == 32) {
int32_t *b = (int32_t *)(priv->buf + priv->buf_wpos);
int32_t *b = (void *)(priv->buf + priv->buf_wpos);

for (i = 0; i < frames; i++) {
for (ch = 0; ch < channels; ch++)
b[j++] = LE32(buf[ch % nch][i]);
}
} else if (depth == 12) { /* -> 16 */
int16_t *b = (int16_t *)(priv->buf + priv->buf_wpos);
int16_t *b = (void *)(priv->buf + priv->buf_wpos);

for (i = 0; i < frames; i++) {
for (ch = 0; ch < channels; ch++)
b[j++] = LE16(buf[ch % nch][i] << 4);
}
} else if (depth == 20) { /* -> 32 */
int32_t *b = (int32_t *)(priv->buf + priv->buf_wpos);
int32_t *b = (void *)(priv->buf + priv->buf_wpos);

for (i = 0; i < frames; i++) {
for (ch = 0; ch < channels; ch++)
b[j++] = LE32(buf[ch % nch][i] << 12);
}
} else if (depth == 24) { /* -> 32 */
int32_t *b = (int32_t *)(priv->buf + priv->buf_wpos);
int32_t *b = (void *)(priv->buf + priv->buf_wpos);

for (i = 0; i < frames; i++) {
for (ch = 0; ch < channels; ch++)
Expand Down
7 changes: 3 additions & 4 deletions id3.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,17 +585,16 @@ static struct {
{ "TS2", ID3_ALBUMARTISTSORT },
{ "TSA", ID3_ALBUMSORT },
{ "TCP", ID3_COMPILATION },

{ "", -1 }
};

static int frame_tab_index(const char *id)
{
int i;
int i = 0;

for (i = 0; frame_tab[i].key != -1; i++) {
while (i < N_ELEMENTS(frame_tab)) {
if (!strncmp(id, frame_tab[i].name, 4))
return i;
i++;
}
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions input.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ struct input_plugin {
* pcm is converted to 16-bit signed little-endian stereo
* NOTE: no conversion is done if channels > 2 or bits > 16
*/
void (*pcm_convert)(char *, const char *, int);
void (*pcm_convert_in_place)(char *, int);
void (*pcm_convert)(void *, const void *, int);
void (*pcm_convert_in_place)(void *, int);
/*
* 4 if 8-bit mono
* 2 if 8-bit stereo or 16-bit mono
Expand Down
4 changes: 2 additions & 2 deletions nomad.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ static int xing_parse(struct nomad *nomad)
* for this by assuming the tag began two octets prior and the
* high bits of the following flags field are always zero.
*/
if (xing_id != ((XING_MAGIC << 16) & 0xffffffffL) &&
xing_id != ((INFO_MAGIC << 16) & 0xffffffffL))
if (xing_id != (((XING_MAGIC+0UL) << 16) & 0xffffffffL) &&
xing_id != (((INFO_MAGIC+0UL) << 16) & 0xffffffffL))
return -1;
xing_id >>= 16;
ptr = start;
Expand Down
2 changes: 1 addition & 1 deletion opus.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static int opus_read(struct input_plugin_data *ip_data, char *buffer, int count)
priv = ip_data->private;

/* samples = number of samples read per channel */
samples = op_read_stereo(priv->of, (opus_int16*)buffer,
samples = op_read_stereo(priv->of, (void*)buffer,
count / sizeof(opus_int16));
if (samples < 0) {
switch (samples) {
Expand Down
42 changes: 21 additions & 21 deletions pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
* converted to stereo so it's worthwhile to split the conversion to 2 phases.
*/

static void convert_u8_1ch_to_s16_2ch(char *dst, const char *src, int count)
static void convert_u8_1ch_to_s16_2ch(void *dst, const void *src, int count)
{
int16_t *d = (int16_t *)dst;
const uint8_t *s = (const uint8_t *)src;
int16_t *d = dst;
const uint8_t *s = src;
int i, j = 0;

for (i = 0; i < count; i++) {
Expand All @@ -60,10 +60,10 @@ static void convert_u8_1ch_to_s16_2ch(char *dst, const char *src, int count)
}
}

static void convert_s8_1ch_to_s16_2ch(char *dst, const char *src, int count)
static void convert_s8_1ch_to_s16_2ch(void *dst, const void *src, int count)
{
int16_t *d = (int16_t *)dst;
const int8_t *s = (const int8_t *)src;
int16_t *d = dst;
const int8_t *s = src;
int i, j = 0;

for (i = 0; i < count; i++) {
Expand All @@ -73,10 +73,10 @@ static void convert_s8_1ch_to_s16_2ch(char *dst, const char *src, int count)
}
}

static void convert_u8_2ch_to_s16_2ch(char *dst, const char *src, int count)
static void convert_u8_2ch_to_s16_2ch(void *dst, const void *src, int count)
{
int16_t *d = (int16_t *)dst;
const int8_t *s = (const int8_t *)src;
int16_t *d = dst;
const int8_t *s = src;
int i;

for (i = 0; i < count; i++) {
Expand All @@ -86,10 +86,10 @@ static void convert_u8_2ch_to_s16_2ch(char *dst, const char *src, int count)
}
}

static void convert_s8_2ch_to_s16_2ch(char *dst, const char *src, int count)
static void convert_s8_2ch_to_s16_2ch(void *dst, const void *src, int count)
{
int16_t *d = (int16_t *)dst;
const int8_t *s = (const int8_t *)src;
int16_t *d = dst;
const int8_t *s = src;
int i;

for (i = 0; i < count; i++) {
Expand All @@ -98,9 +98,9 @@ static void convert_s8_2ch_to_s16_2ch(char *dst, const char *src, int count)
}
}

static void convert_u16_le_to_s16_le(char *buf, int count)
static void convert_u16_le_to_s16_le(void *buf, int count)
{
int16_t *b = (int16_t *)buf;
int16_t *b = buf;
int i;

for (i = 0; i < count; i++) {
Expand All @@ -110,9 +110,9 @@ static void convert_u16_le_to_s16_le(char *buf, int count)
}
}

static void convert_u16_be_to_s16_le(char *buf, int count)
static void convert_u16_be_to_s16_le(void *buf, int count)
{
int16_t *b = (int16_t *)buf;
int16_t *b = buf;
int i;

for (i = 0; i < count; i++) {
Expand All @@ -125,19 +125,19 @@ static void convert_u16_be_to_s16_le(char *buf, int count)
}
}

static void swap_s16_byte_order(char *buf, int count)
static void swap_s16_byte_order(void *buf, int count)
{
int16_t *b = (int16_t *)buf;
int16_t *b = buf;
int i;

for (i = 0; i < count; i++)
b[i] = swap_uint16(b[i]);
}

static void convert_16_1ch_to_16_2ch(char *dst, const char *src, int count)
static void convert_16_1ch_to_16_2ch(void *dst, const void *src, int count)
{
int16_t *d = (int16_t *)dst;
const int16_t *s = (const int16_t *)src;
int16_t *d = dst;
const int16_t *s = src;
int i, j = 0;

for (i = 0; i < count; i++) {
Expand Down
4 changes: 2 additions & 2 deletions pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#ifndef _PCM_H
#define _PCM_H

typedef void (*pcm_conv_func)(char *dst, const char *src, int count);
typedef void (*pcm_conv_in_place_func)(char *buf, int count);
typedef void (*pcm_conv_func)(void *dst, const void *src, int count);
typedef void (*pcm_conv_in_place_func)(void *buf, int count);

extern pcm_conv_func pcm_conv[8];
extern pcm_conv_in_place_func pcm_conv_in_place[8];
Expand Down
2 changes: 1 addition & 1 deletion player.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static inline int sf_need_swap(sample_format_t sf)
#define SCALE_SAMPLES(TYPE, buffer, count, l, r, swap) \
{ \
const int frames = count / sizeof(TYPE) / 2; \
TYPE *buf = (TYPE *) buffer; \
TYPE *buf = (void *) buffer; \
int i; \
/* avoid underflowing -32768 to 32767 when scale is 65536 */ \
if (l != SOFT_VOL_SCALE && r != SOFT_VOL_SCALE) { \
Expand Down
9 changes: 7 additions & 2 deletions roar.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ static int op_roar_open(sample_format_t sf, const channel_position_t *channel_ma

ROAR_DBG("op_roar_open(*) = ?");

roar_vs_blocking(vss, ROAR_VS_FALSE, &err);
if (roar_vs_blocking(vss, ROAR_VS_FALSE, &err) == -1) {
/* FIXME: handle this error */
}

ROAR_DBG("op_roar_open(*) = 0");

Expand All @@ -208,7 +210,10 @@ static int op_roar_close(void)

static int op_roar_drop(void)
{
roar_vs_reset_buffer(vss, ROAR_VS_TRUE, ROAR_VS_TRUE, &err);
if (roar_vs_reset_buffer(vss, ROAR_VS_TRUE, ROAR_VS_TRUE, &err) == -1) {
/* FIXME: handle this error
* FIXME: I'm deprecated */
}
return 0;
}

Expand Down

0 comments on commit 8479aa7

Please sign in to comment.