diff --git a/configure.ac b/configure.ac index 4b42131f..55a39072 100644 --- a/configure.ac +++ b/configure.ac @@ -161,7 +161,7 @@ AC_SUBST(SYMBOL_VISIBILITY) fi if test $ac_cv_c_compiler_gnu = yes ; then - CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare" + CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-unused-parameter" fi AC_CHECK_FUNCS([lrintf]) diff --git a/libcelt/bands.c b/libcelt/bands.c index 77ac1704..eaba12ec 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -758,7 +758,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c split = 1; LM -= 1; if (B==1) - fill = fill&1|fill<<1; + fill = (fill&1)|(fill<<1); B = (B+1)>>1; } } @@ -1020,13 +1020,13 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c folding will be done to the side. */ cm |= quant_band(encode, m, i, Y, NULL, N, sbits, spread, B, intensity, tf_change, next_lowband2, ec, remaining_bits, LM, NULL, - NULL, next_level, seed, MULT16_16_P15(gain,side), NULL, fill>>B)<<(B0>>1&stereo-1); + NULL, next_level, seed, MULT16_16_P15(gain,side), NULL, fill>>B)<<((B0>>1)&(stereo-1)); } else { /* For a stereo split, the high bits of fill are always zero, so no folding will be done to the side. */ cm = quant_band(encode, m, i, Y, NULL, N, sbits, spread, B, intensity, tf_change, next_lowband2, ec, remaining_bits, LM, NULL, - NULL, next_level, seed, MULT16_16_P15(gain,side), NULL, fill>>B)<<(B0>>1&stereo-1); + NULL, next_level, seed, MULT16_16_P15(gain,side), NULL, fill>>B)<<((B0>>1)&(stereo-1)); rebalance = sbits - (rebalance-*remaining_bits); if (rebalance > 3<>l-16), but guaranteed to round up, even if adding a bias before the shift would cause overflow (e.g., for 0xFFFFxxxx).*/ - if(l>16)val=(val>>l-16)+((val&(1<>l-16); + if(l>16)val=(val>>(l-16))+(((val&((1<<(l-16))-1))+(1<<(l-16))-1)>>(l-16)); else val<<=16-l; - l=l-1<>16); l+=b<>b; - val=val*val+0x7FFF>>15; + val=(val+b)>>b; + val=(val*val+0x7FFF)>>15; } while(frac-->0); /*If val is not exactly 0x8000, then we have to round up the remainder.*/ return l+(val>0x8000); } /*Exact powers of two require no rounding.*/ - else return l-1<0); celt_assert(_d<=54); - shift=EC_ILOG(_d^_d-1); + shift=EC_ILOG(_d^(_d-1)); inv=INV_TABLE[(_d-1)>>shift]; shift--; one=1<_i)p=_u[--_k]; _i-=p; yj-=_k; - _y[j]=yj+s^s; + _y[j]=(yj+s)^s; uprev(_u,_k+2,0); } while(++j<_n); diff --git a/libcelt/ecintrin.h b/libcelt/ecintrin.h index e6a68a57..be229470 100644 --- a/libcelt/ecintrin.h +++ b/libcelt/ecintrin.h @@ -57,7 +57,7 @@ are just as fast, and do not require any special target architecture. Earlier gcc versions (3.x) compiled both code to the same assembly instructions, because of the way they represented ((_b)>(_a)) internally.*/ -# define EC_MINI(_a,_b) ((_a)+((_b)-(_a)&-((_b)<(_a)))) +# define EC_MINI(_a,_b) ((_a)+(((_b)-(_a))&-((_b)<(_a)))) /*Count leading zeros. This macro should only be used for implementing ec_ilog(), if it is defined. diff --git a/libcelt/entdec.c b/libcelt/entdec.c index 90a1b949..ba224e24 100644 --- a/libcelt/entdec.c +++ b/libcelt/entdec.c @@ -116,7 +116,7 @@ static void ec_dec_normalize(ec_dec *_this){ /*Take the rest of the bits we need from this new symbol.*/ sym=(sym<rem)>>(EC_SYM_BITS-EC_CODE_EXTRA); /*And subtract them from val, capped to be less than EC_CODE_TOP.*/ - _this->val=(_this->val<val=((_this->val<>=_bits; available-=_bits; _this->end_window=window; diff --git a/libcelt/entenc.c b/libcelt/entenc.c index feae35a4..0b4b229f 100644 --- a/libcelt/entenc.c +++ b/libcelt/entenc.c @@ -89,7 +89,7 @@ static void ec_enc_carry_out(ec_enc *_this,int _c){ if(_this->rem>=0)_this->error|=ec_write_byte(_this,_this->rem+carry); if(_this->ext>0){ unsigned sym; - sym=EC_SYM_MAX+carry&EC_SYM_MAX; + sym=(EC_SYM_MAX+carry)&EC_SYM_MAX; do _this->error|=ec_write_byte(_this,sym); while(--(_this->ext)>0); } @@ -103,7 +103,7 @@ static void ec_enc_normalize(ec_enc *_this){ while(_this->rng<=EC_CODE_BOT){ ec_enc_carry_out(_this,(int)(_this->val>>EC_CODE_SHIFT)); /*Move the next-to-high-order symbol into the high-order position.*/ - _this->val=(_this->val<val=(_this->val<rng<<=EC_SYM_BITS; _this->nbits_total+=EC_SYM_BITS; } @@ -185,7 +185,7 @@ void ec_enc_uint(ec_enc *_this,opus_uint32 _fl,opus_uint32 _ft){ ft=(_ft>>ftb)+1; fl=(unsigned)(_fl>>ftb); ec_encode(_this,fl,fl+1,ft); - ec_enc_bits(_this,_fl&((opus_uint32)1<offs>0){ /*The first byte has been finalized.*/ - _this->buf[0]=(unsigned char)(_this->buf[0]&~mask|_val<buf[0]=(unsigned char)((_this->buf[0]&~mask)|_val<rem>=0){ /*The first byte is still awaiting carry propagation.*/ - _this->rem=_this->rem&~mask|_val<rem=(_this->rem&~mask)|_val<rng<=(EC_CODE_TOP>>shift)){ /*The renormalization loop has never been run.*/ - _this->val=_this->val&~((opus_uint32)mask<val=(_this->val&~((opus_uint32)mask<rng); msk=(EC_CODE_TOP-1)>>l; - end=_this->val+msk&~msk; + end=(_this->val+msk)&~msk; if((end|msk)>=_this->val+_this->rng){ l++; msk>>=1; - end=_this->val+msk&~msk; + end=(_this->val+msk)&~msk; } while(l>0){ ec_enc_carry_out(_this,(int)(end>>EC_CODE_SHIFT)); - end=(end<logN[j]+(LM0+k<>1)-QTHETA_OFFSET; + offset = ((m->logN[j]+((LM0+k)<>1)-QTHETA_OFFSET; /* The number of qtheta bits we'll allocate if the remainder is to be max_bits. The average measured cost for theta is 0.89701 times qb, @@ -205,7 +205,7 @@ void compute_pulse_cache(CELTMode *m, int LM) if (C==2) { max_bits <<= 1; - offset = (m->logN[j]+(i<>1)-(N==2?QTHETA_OFFSET_TWOPHASE:QTHETA_OFFSET); + offset = ((m->logN[j]+(i<>1)-(N==2?QTHETA_OFFSET_TWOPHASE:QTHETA_OFFSET); ndof = 2*N-1-(N==2); /* The average measured cost for theta with the step PDF is 0.95164 times qb, approximated here as 487/512. */ @@ -220,19 +220,19 @@ void compute_pulse_cache(CELTMode *m, int LM) ndof = C*N + ((C==2 && N>2) ? 1 : 0); /* Offset the number of fine bits by log2(N)/2 + FINE_OFFSET compared to their "fair share" of total/N */ - offset = (m->logN[j] + (i<>1)-FINE_OFFSET; + offset = ((m->logN[j] + (i<>1)-FINE_OFFSET; /* N=2 is the only point that doesn't match the curve */ if (N==2) offset += 1<>2; /* The number of fine bits we'll allocate if the remainder is to be max_bits. */ num = max_bits+ndof*offset; - den = ndof-1<>1))/den, MAX_FINE_BITS); celt_assert(qb >= 0); max_bits += C*qb<eBands[j+1]-m->eBands[j]<eBands[j+1]-m->eBands[j])<= 0); celt_assert(max_bits < 256); *cap++ = (unsigned char)max_bits; diff --git a/libcelt/tests/ectest.c b/libcelt/tests/ectest.c index 7ebcf276..fb8fe5ee 100644 --- a/libcelt/tests/ectest.c +++ b/libcelt/tests/ectest.c @@ -29,10 +29,10 @@ int main(int _argc,char **_argv){ double entropy; int ft; int ftb; - int sym; int sz; int i; int ret; + unsigned int sym; unsigned int seed; unsigned char *ptr; ret=0; @@ -78,7 +78,7 @@ int main(int _argc,char **_argv){ for(ft=2;ft<1024;ft++){ for(i=0;i>(rand()%11))+1)+10; sz=rand()/((RAND_MAX>>(rand()%9))+1); @@ -128,7 +128,7 @@ int main(int _argc,char **_argv){ ec_enc_uint(&enc, rand()%2, 2); tell_bits = ec_tell(&enc); ec_enc_done(&enc); - if(tell_bits!=ec_tell(&enc)){ + if(tell_bits!=(unsigned)ec_tell(&enc)){ fprintf(stderr,"ec_tell() changed after ec_enc_done(): %i instead of %i (Random seed: %u)\n", ec_tell(&enc),tell_bits,seed); ret=-1; @@ -203,7 +203,7 @@ int main(int _argc,char **_argv){ tell[j+1]=ec_tell_frac(&enc); } ec_enc_done(&enc); - if((ec_tell(&enc)+7)/8toc = data[0]; rp->framesize = opus_packet_get_samples_per_frame(data, 48000); - } else if (rp->toc&0xFC != data[0]&0xFC) + } else if ((rp->toc&0xFC) != (data[0]&0xFC)) { /*fprintf(stderr, "toc mismatch: 0x%x vs 0x%x\n", rp->toc, data[0]);*/ return OPUS_CORRUPTED_DATA; diff --git a/win32/config.h b/win32/config.h index 330f917c..528ff8e3 100644 --- a/win32/config.h +++ b/win32/config.h @@ -15,12 +15,6 @@ /* Get rid of the CELT VS compile warnings */ #if 1 -#pragma warning(disable : 4018)/* signed/unsigned mismatch */ -#pragma warning(disable : 4244)/* conversion from 'double' to 'opus_val16', possible loss of data */ -#pragma warning(disable : 4267)/* conversion from 'size_t' to 'int', possible loss of data */ -#pragma warning(disable : 4305)/* truncation from 'double' to 'const float' */ -#pragma warning(disable : 4311)/* pointer truncation from 'char *' to 'long' */ -#pragma warning(disable : 4554)/* check operator precedence for possible error; use parentheses to clarify precedence */ #pragma warning(disable : 4996)/* This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. */ #endif