Skip to content
Snippets Groups Projects
Commit 0d1edad2 authored by Petter Reinholdtsen's avatar Petter Reinholdtsen
Browse files

Dropped self assignment when initialising variables in tokenize.c.

The 'int x=x' style statement do not make sense and cause problems with
some compilers.  Replace it with 'int x=0' to ensure the value
have a well known starting point.

Added -Werror=uninitialized -Winit-self to default GCC build to ensure
this style of statement do not sneak into the code again.

Fixes #2317
parent a768e356
No related branches found
No related tags found
No related merge requests found
Pipeline #6185 passed
...@@ -179,9 +179,9 @@ else ...@@ -179,9 +179,9 @@ else
case $host in case $host in
*) *)
DEBUG="-g -Wall -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES" DEBUG="-g -Wall -Werror=uninitialized -Winit-self -Wno-parentheses -DDEBUG -D__NO_MATH_INLINES"
CFLAGS="-Wall -Wno-parentheses -O3 -fomit-frame-pointer -finline-functions -funroll-loops" CFLAGS="-Wall -Werror=uninitialized -Winit-self -Wno-parentheses -O3 -fomit-frame-pointer -finline-functions -funroll-loops"
PROFILE="-Wall -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";; PROFILE="-Wall -Werror=uninitialized -Winit-self -Wno-parentheses -pg -g -O3 -fno-inline-functions -DDEBUG";;
esac esac
fi fi
CFLAGS="$CFLAGS $cflags_save" CFLAGS="$CFLAGS $cflags_save"
......
...@@ -487,11 +487,11 @@ int oc_enc_tokenize_ac(oc_enc_ctx *_enc,int _pli,ptrdiff_t _fragi, ...@@ -487,11 +487,11 @@ int oc_enc_tokenize_ac(oc_enc_ctx *_enc,int _pli,ptrdiff_t _fragi,
zzj=64; zzj=64;
for(zzi=OC_MINI(_zzi,63);zzi>0;zzi--){ for(zzi=OC_MINI(_zzi,63);zzi>0;zzi--){
ogg_uint32_t best_cost; ogg_uint32_t best_cost;
int best_bits=best_bits; int best_bits=0;
int best_next=best_next; int best_next=0;
int best_token=best_token; int best_token=0;
int best_eb=best_eb; int best_eb=0;
int best_qc=best_qc; int best_qc=0;
ogg_uint32_t d2; ogg_uint32_t d2;
int dq; int dq;
int qc_m; int qc_m;
...@@ -1091,8 +1091,8 @@ void oc_enc_tokenize_dc_frag_list(oc_enc_ctx *_enc,int _pli, ...@@ -1091,8 +1091,8 @@ void oc_enc_tokenize_dc_frag_list(oc_enc_ctx *_enc,int _pli,
int neobs1; int neobs1;
int token; int token;
int eb; int eb;
int token1=token1; int token1=0;
int eb1=eb1; int eb1;
/*Return immediately if there are no coded fragments; otherwise we'd flush /*Return immediately if there are no coded fragments; otherwise we'd flush
any trailing EOB run into the AC 1 list and never read it back out.*/ any trailing EOB run into the AC 1 list and never read it back out.*/
if(_ncoded_fragis<=0)return; if(_ncoded_fragis<=0)return;
...@@ -1328,7 +1328,7 @@ void oc_enc_tokenize_finish(oc_enc_ctx *_enc){ ...@@ -1328,7 +1328,7 @@ void oc_enc_tokenize_finish(oc_enc_ctx *_enc){
int new_eb; int new_eb;
int zzj; int zzj;
int plj; int plj;
ptrdiff_t ti=ti; ptrdiff_t ti=0;
int run_count; int run_count;
/*Make sure this coefficient has tokens at all.*/ /*Make sure this coefficient has tokens at all.*/
if(_enc->ndct_tokens[pli][zzi]<=0)continue; if(_enc->ndct_tokens[pli][zzi]<=0)continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment