From 04adf8f0acd6c2ad0e58d94573d6430735070607 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 30 Jan 2009 00:02:58 +0100 Subject: Fix SBC to compile cleanly with -Wsign-compare --- sbc/Makefile.am | 4 ++-- sbc/sbc.c | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'sbc') diff --git a/sbc/Makefile.am b/sbc/Makefile.am index 1f8e7f95..f8701641 100644 --- a/sbc/Makefile.am +++ b/sbc/Makefile.am @@ -12,8 +12,8 @@ libsbc_la_SOURCES = sbc.h sbc.c sbc_math.h sbc_tables.h \ sbc_primitives.h sbc_primitives_mmx.h sbc_primitives_neon.h \ sbc_primitives.c sbc_primitives_mmx.c sbc_primitives_neon.c -libsbc_la_CFLAGS = -finline-functions -funswitch-loops \ - -fgcse-after-reload -funroll-loops -Wno-sign-compare +libsbc_la_CFLAGS = -finline-functions -fgcse-after-reload \ + -funswitch-loops -funroll-loops noinst_PROGRAMS = sbcinfo sbcdec sbcenc $(sndfile_programs) diff --git a/sbc/sbc.c b/sbc/sbc.c index 29f1d14c..29258d05 100644 --- a/sbc/sbc.c +++ b/sbc/sbc.c @@ -362,7 +362,7 @@ static void sbc_calculate_bits(const struct sbc_frame *frame, int (*bits)[8]) static int sbc_unpack_frame(const uint8_t *data, struct sbc_frame *frame, size_t len) { - int consumed; + unsigned int consumed; /* Will copy the parts of the header that are relevant to crc * calculation here */ uint8_t crc_header[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -794,7 +794,7 @@ static SBC_ALWAYS_INLINE int sbc_pack_frame_internal( /* like frame->sb_sample but joint stereo */ int32_t sb_sample_j[16][2]; /* scalefactor and scale_factor in joint case */ - u_int32_t scalefactor_j[2]; + uint32_t scalefactor_j[2]; uint8_t scale_factor_j[2]; uint8_t joint = 0; @@ -807,6 +807,7 @@ static SBC_ALWAYS_INLINE int sbc_pack_frame_internal( scalefactor_j[1] = 2 << SCALE_OUT_BITS; for (blk = 0; blk < frame->blocks; blk++) { + uint32_t tmp; /* Calculate joint stereo signal */ sb_sample_j[blk][0] = ASR(frame->sb_sample_f[blk][0][sb], 1) + @@ -816,11 +817,13 @@ static SBC_ALWAYS_INLINE int sbc_pack_frame_internal( ASR(frame->sb_sample_f[blk][1][sb], 1); /* calculate scale_factor_j and scalefactor_j for joint case */ - while (scalefactor_j[0] < fabs(sb_sample_j[blk][0])) { + tmp = fabs(sb_sample_j[blk][0]); + while (scalefactor_j[0] < tmp) { scale_factor_j[0]++; scalefactor_j[0] *= 2; } - while (scalefactor_j[1] < fabs(sb_sample_j[blk][1])) { + tmp = fabs(sb_sample_j[blk][1]); + while (scalefactor_j[1] < tmp) { scale_factor_j[1]++; scalefactor_j[1] *= 2; } -- cgit