From af846b4b1f1119432a1c926d275542db2c4c408e Mon Sep 17 00:00:00 2001 From: tterribe Date: Thu, 28 Aug 2008 18:04:15 +0000 Subject: [PATCH] It appears Solaris's cc is ignoring the signedness of bitfield types. Add explicit casts as a work-around. git-svn-id: http://svn.xiph.org/trunk@15215 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- theora/lib/dec/fragment.c | 2 +- theora/lib/dec/state.c | 4 ++-- theora/lib/internal.h | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/theora/lib/dec/fragment.c b/theora/lib/dec/fragment.c index e2805b91a..7859819da 100644 --- a/theora/lib/dec/fragment.c +++ b/theora/lib/dec/fragment.c @@ -179,7 +179,7 @@ int oc_frag_pred_dc(const oc_fragment *_frag, pflag=1<coded&& OC_FRAME_FOR_MODE[predfr[i]->mbmode]==pred_frame){ - p[np++]=predfr[i]->dc; + p[np++]=(ogg_int16_t)predfr[i]->dc; pflags|=pflag; } } diff --git a/theora/lib/dec/state.c b/theora/lib/dec/state.c index f6870a5db..807f30925 100644 --- a/theora/lib/dec/state.c +++ b/theora/lib/dec/state.c @@ -831,13 +831,13 @@ void oc_state_frag_recon_c(oc_theora_state *_state,oc_fragment *_frag, ogg_int16_t p; /*Why is the iquant product rounded in this case and no others? Who knows.*/ - p=(ogg_int16_t)((ogg_int32_t)_frag->dc*_dc_iquant+15>>5); + p=(ogg_int16_t)((ogg_int32_t)(ogg_int16_t)_frag->dc*_dc_iquant+15>>5); /*LOOP VECTORIZES.*/ for(ci=0;ci<64;ci++)res_buf[ci]=p; } else{ /*First, dequantize the coefficients.*/ - dct_buf[0]=(ogg_int16_t)((ogg_int32_t)_frag->dc*_dc_iquant); + dct_buf[0]=(ogg_int16_t)((ogg_int32_t)(ogg_int16_t)_frag->dc*_dc_iquant); for(zzi=1;zzi<_ncoefs;zzi++){ int ci; ci=OC_FZIG_ZAG[zzi]; diff --git a/theora/lib/internal.h b/theora/lib/internal.h index 8a1d84489..cb6da53fb 100644 --- a/theora/lib/internal.h +++ b/theora/lib/internal.h @@ -213,7 +213,10 @@ typedef struct{ unsigned qi:6; /*The mode of the macroblock this fragment belongs to.*/ int mbmode:8; - /*The prediction-corrected DC component.*/ + /*The prediction-corrected DC component. + Note that some compilers (e.g., Solaris's) will ignore the signedness of + the type and treat this value as unsigned always, so it will need to be + casted before being used.*/ int dc:16; /*A pointer to the portion of an image covered by this fragment in several images. -- 2.11.4.GIT