提交 260741ed 编写于 作者: S Sean Barrett

vorbis warnings from ronny chevalier

I manually made these changes because they
disabled some substantial amounts of code,
and I wanted to make sure this wasn't due to
original code having bugs or deviating from
the specification
上级 758c165d
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
// Bugfix/warning contributors: // Bugfix/warning contributors:
// Terje Mathisen Niklas Frykholm Andy Hill // Terje Mathisen Niklas Frykholm Andy Hill
// Casey Muratori John Bolton Gargaj // Casey Muratori John Bolton Gargaj
// Laurent Gomila Marc LeBlanc // Laurent Gomila Marc LeBlanc Ronny Chevalier
// Bernhard Wodo Evan Balster // Bernhard Wodo Evan Balster
// Tom Beaumont Ingo Leitgeb // Tom Beaumont Ingo Leitgeb
// (If you reported a bug but do not appear in this list, it is because // (If you reported a bug but do not appear in this list, it is because
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
// list them all because I was lax about updating for a long time, sorry.) // list them all because I was lax about updating for a long time, sorry.)
// //
// Partial history: // Partial history:
// 1.02 - 2014/07/09 - declare qsort comparison as explicitly _cdecl // 1.03 - 2014/08/07 - warning fixes
// 1.02 - 2014/07/09 - declare qsort comparison as explicitly _cdecl in Windows
// 1.01 - 2014/06/18 - fix stb_vorbis_get_samples_float (interleaved was correct) // 1.01 - 2014/06/18 - fix stb_vorbis_get_samples_float (interleaved was correct)
// 1.0 - 2014/05/26 - fix memory leaks; fix warnings; fix bugs in >2-channel; // 1.0 - 2014/05/26 - fix memory leaks; fix warnings; fix bugs in >2-channel;
// (API change) report sample rate for decode-full-file funcs // (API change) report sample rate for decode-full-file funcs
...@@ -2124,7 +2125,6 @@ static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int ...@@ -2124,7 +2125,6 @@ static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int
memset(residue_buffers[i], 0, sizeof(float) * n); memset(residue_buffers[i], 0, sizeof(float) * n);
if (rtype == 2 && ch != 1) { if (rtype == 2 && ch != 1) {
int len = ch * n;
for (j=0; j < ch; ++j) for (j=0; j < ch; ++j)
if (!do_not_decode[j]) if (!do_not_decode[j])
break; break;
...@@ -2674,7 +2674,7 @@ static void imdct_step3_inner_s_loop_ld654(int n, float *e, int i_off, float *A, ...@@ -2674,7 +2674,7 @@ static void imdct_step3_inner_s_loop_ld654(int n, float *e, int i_off, float *A,
static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype) static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
{ {
int n2 = n >> 1, n4 = n >> 2, n8 = n >> 3, l; int n2 = n >> 1, n4 = n >> 2, n8 = n >> 3, l;
int n3_4 = n - n4, ld; int ld;
// @OPTIMIZE: reduce register pressure by using fewer variables? // @OPTIMIZE: reduce register pressure by using fewer variables?
int save_point = temp_alloc_save(f); int save_point = temp_alloc_save(f);
float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2)); float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2));
...@@ -3208,13 +3208,10 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, ...@@ -3208,13 +3208,10 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start,
int i,j,k,n,n2; int i,j,k,n,n2;
int zero_channel[256]; int zero_channel[256];
int really_zero_channel[256]; int really_zero_channel[256];
int window_center;
// WINDOWING // WINDOWING
n = f->blocksize[m->blockflag]; n = f->blocksize[m->blockflag];
window_center = n >> 1;
map = &f->mapping[m->mapping]; map = &f->mapping[m->mapping];
// FLOORS // FLOORS
...@@ -3328,7 +3325,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, ...@@ -3328,7 +3325,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start,
// RESIDUE DECODE // RESIDUE DECODE
for (i=0; i < map->submaps; ++i) { for (i=0; i < map->submaps; ++i) {
float *residue_buffers[STB_VORBIS_MAX_CHANNELS]; float *residue_buffers[STB_VORBIS_MAX_CHANNELS];
int r,t; int r;
uint8 do_not_decode[256]; uint8 do_not_decode[256];
int ch = 0; int ch = 0;
for (j=0; j < f->channels; ++j) { for (j=0; j < f->channels; ++j) {
...@@ -3344,7 +3341,6 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, ...@@ -3344,7 +3341,6 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start,
} }
} }
r = map->submap_residue[i]; r = map->submap_residue[i];
t = f->residue_types[r];
decode_residue(f, residue_buffers, ch, n2, r, do_not_decode); decode_residue(f, residue_buffers, ch, n2, r, do_not_decode);
} }
...@@ -4541,7 +4537,7 @@ static int vorbis_analyze_page(stb_vorbis *f, ProbedPage *z) ...@@ -4541,7 +4537,7 @@ static int vorbis_analyze_page(stb_vorbis *f, ProbedPage *z)
{ {
uint8 header[27], lacing[255]; uint8 header[27], lacing[255];
uint8 packet_type[255]; uint8 packet_type[255];
int num_packet, packet_start, previous =0; int num_packet, packet_start;
int i,len; int i,len;
uint32 samples; uint32 samples;
...@@ -4574,7 +4570,7 @@ static int vorbis_analyze_page(stb_vorbis *f, ProbedPage *z) ...@@ -4574,7 +4570,7 @@ static int vorbis_analyze_page(stb_vorbis *f, ProbedPage *z)
// scan through the frames to determine the sample-count of each one... // scan through the frames to determine the sample-count of each one...
// our goal is the sample # of the first fully-decoded sample on the // our goal is the sample # of the first fully-decoded sample on the
// page, which is the first decoded sample of the 2nd page // page, which is the first decoded sample of the 2nd packet
num_packet=0; num_packet=0;
...@@ -4582,18 +4578,15 @@ static int vorbis_analyze_page(stb_vorbis *f, ProbedPage *z) ...@@ -4582,18 +4578,15 @@ static int vorbis_analyze_page(stb_vorbis *f, ProbedPage *z)
for (i=0; i < header[26]; ++i) { for (i=0; i < header[26]; ++i) {
if (packet_start) { if (packet_start) {
uint8 n,b,m; uint8 n,b;
if (lacing[i] == 0) goto bail; // trying to read from zero-length packet if (lacing[i] == 0) goto bail; // trying to read from zero-length packet
n = get8(f); n = get8(f);
// if bottom bit is non-zero, we've got corruption // if bottom bit is non-zero, we've got corruption
if (n & 1) goto bail; if (n & 1) goto bail;
n >>= 1; n >>= 1;
b = ilog(f->mode_count-1); b = ilog(f->mode_count-1);
m = n >> b;
n &= (1 << b)-1; n &= (1 << b)-1;
if (n >= f->mode_count) goto bail; if (n >= f->mode_count) goto bail;
if (num_packet == 0 && f->mode_config[n].blockflag)
previous = (m & 1);
packet_type[num_packet++] = f->mode_config[n].blockflag; packet_type[num_packet++] = f->mode_config[n].blockflag;
skip(f, lacing[i]-1); skip(f, lacing[i]-1);
} else } else
...@@ -5404,6 +5397,8 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in ...@@ -5404,6 +5397,8 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
#endif // STB_VORBIS_NO_PULLDATA_API #endif // STB_VORBIS_NO_PULLDATA_API
/* Version history /* Version history
1.03 - 2014/08/07 - Warning fixes
1.02 - 2014/07/09 - Declare qsort compare function _cdecl on windows
1.01 - 2014/06/18 - fix stb_vorbis_get_samples_float 1.01 - 2014/06/18 - fix stb_vorbis_get_samples_float
1.0 - 2014/05/26 - fix memory leaks; fix warnings; fix bugs in multichannel 1.0 - 2014/05/26 - fix memory leaks; fix warnings; fix bugs in multichannel
(API change) report sample rate for decode-full-file funcs (API change) report sample rate for decode-full-file funcs
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册