[FFmpeg-devel] [PATCH] fix check in dyn_buf_write that gcc 4.3 optimizes away

Reimar Döffinger Reimar.Doeffinger
Sat Oct 4 22:02:35 CEST 2008


Hello,
On Sat, Oct 04, 2008 at 08:39:55PM +0200, Michael Niedermayer wrote:
> On Sat, Oct 04, 2008 at 06:17:09PM +0200, Reimar D?ffinger wrote:
> > newest gcc when optimizing comparisons assumes that no overflows happen,
> > breaking this way of checking.
> > Attached patch fixes it - I hope it to be uncontroversial since we
> > already avoided relying on this kind of check in several other
> > places.
> 
> id just make te var unsigned ...

Ok, like this? Btw. with function also has a weird "return -1234;" that
looks a lot like nonsense to me...
-------------- next part --------------
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 34029a5..c0d4937 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -711,7 +711,7 @@ typedef struct DynBuffer {
 static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
 {
     DynBuffer *d = opaque;
-    int new_size, new_allocated_size;
+    unsigned new_size, new_allocated_size;
 
     /* reallocate buffer if needed */
     new_size = d->pos + buf_size;



More information about the ffmpeg-devel mailing list