[FFmpeg-devel] [PATCH/RFC] Constify src in av_fifo_generic_write()
Michael Niedermayer
michaelni
Wed Feb 24 12:45:11 CET 2010
On Wed, Feb 24, 2010 at 08:46:22AM +0100, Tomas H?rdin wrote:
> On Tue, 2010-02-23 at 15:55 +0100, Michael Niedermayer wrote:
> > On Tue, Feb 23, 2010 at 01:41:49PM +0100, Tomas H?rdin wrote:
> > > On Tue, 2010-02-23 at 13:14 +0100, Michael Niedermayer wrote:
> > > > On Tue, Feb 23, 2010 at 10:50:03AM +0100, Tomas H?rdin wrote:
> > > > > Good morning
> > > > >
> > > > > This is a rather simple patch that merely makes av_fifo_generic_write()
> > > > > take const void *src instead of just void *src. It causes no warnings
> > > > > and regression tests pass.
> > > > >
> > > > > The reason is simple: guarantee the user that the function does not
> > > > > modify src.
> > > > >
> > > > > One small issue though: this necessitated changing func to int(*)(const
> > > > > void*,void*,int), which is OK for all code within FFmpeg. However, this
> > > > > seems to count as a minor API change since g++ (and gcc I presume) won't
> > > > > allow implicitly casting int(*)(void*,void*,int) to int(*)(const
> > > > > void*,void*,int). I presume that part requires a bit of discussion,
> > > > > which is why I marked this thread "RFC".
> > > > >
> > > > > Patch attached.
> > > >
> > > > ive added a comment explaining why src cannot be const as you are at
> > > > least the 2nd person trying to introduce this bug
> > >
> > > Ah, ok. Might I suggest that you put a comment in fifo.h? That way users
> > > can see it too (especially if only the headers are installed), and there
> > > is less chance anyone else gets confused about this :o
> >
> > EPATCHWELCOME
>
> Changed to:
>
> @param *src data source; non-const since it may be used as a modifiable
> context in func
>
> Should be sufficient. Patch attached.
>
> /Tomas
>
> fifo.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 196613d7308c1d25f81ca26e39d191c10c5f42d0 fifo_h_const_doc.patch
ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The educated differ from the uneducated as much as the living from the
dead. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100224/eaed808b/attachment.pgp>
More information about the ffmpeg-devel
mailing list