[FFmpeg-cvslog] lavc/vorbisdec: use ptrdiff_t to iterate over intptr_t
Rémi Denis-Courmont
git at videolan.org
Mon Sep 19 19:54:48 EEST 2022
ffmpeg | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Sep 19 19:10:42 2022 +0300| [bbf045aa592f7bec895907c8878fd734a0e8713b] | committer: James Almer
lavc/vorbisdec: use ptrdiff_t to iterate over intptr_t
While this probably never overflows, we are better safe than sorry.
The callback prototype should probably also use ptrdiff_t or size_t,
but I diggress (this would affect the DSP callback prototype).
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bbf045aa592f7bec895907c8878fd734a0e8713b
---
libavcodec/ppc/vorbisdsp_altivec.c | 4 ++--
libavcodec/vorbisdec.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/libavcodec/ppc/vorbisdsp_altivec.c b/libavcodec/ppc/vorbisdsp_altivec.c
index 4dabf2dc7d..c298d8cae3 100644
--- a/libavcodec/ppc/vorbisdsp_altivec.c
+++ b/libavcodec/ppc/vorbisdsp_altivec.c
@@ -31,12 +31,12 @@
static void vorbis_inverse_coupling_altivec(float *mag, float *ang,
intptr_t blocksize)
{
- int i;
vector float m, a;
vector bool int t0, t1;
const vector unsigned int v_31 = //XXX
vec_add(vec_add(vec_splat_u32(15),vec_splat_u32(15)),vec_splat_u32(1));
- for (i = 0; i < blocksize; i += 4) {
+
+ for (ptrdiff_t i = 0; i < blocksize; i += 4) {
m = vec_ld(0, mag+i);
a = vec_ld(0, ang+i);
t0 = vec_cmple(m, (vector float)vec_splat_u32(0));
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 38a5367be3..bfc4be6fc6 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1581,8 +1581,7 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
void ff_vorbis_inverse_coupling(float *mag, float *ang, intptr_t blocksize)
{
- int i;
- for (i = 0; i < blocksize; i++) {
+ for (ptrdiff_t i = 0; i < blocksize; i++) {
if (mag[i] > 0.0) {
if (ang[i] > 0.0) {
ang[i] = mag[i] - ang[i];
More information about the ffmpeg-cvslog
mailing list