[FFmpeg-cvslog] file: Fix mmap error check.

Michael Niedermayer michaelni at gmx.at
Fri May 6 12:35:35 CEST 2011


On Thu, May 05, 2011 at 07:31:38AM +0200, Reimar Döffinger wrote:
> On Thu, May 05, 2011 at 02:29:57AM +0200, Michael Niedermayer wrote:
> > ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu May  5 00:52:03 2011 +0200| [10ff2967ea8d17f7e46599497214280a21ca409a] | committer: Michael Niedermayer
> > 
> > file: Fix mmap error check.
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > 
> > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10ff2967ea8d17f7e46599497214280a21ca409a
> > ---
> > 
> >  libavutil/file.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/libavutil/file.c b/libavutil/file.c
> > index b2d380d..1fb7a2b 100644
> > --- a/libavutil/file.c
> > +++ b/libavutil/file.c
> > @@ -75,7 +75,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
> >  
> >  #if HAVE_MMAP
> >      ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
> > -    if ((int)(ptr) == -1) {
> > +    if (ptr == (void*)-1) {
> 
> IMO MAP_FAILED is nicer.

Feel free to change it

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20110506/3db1b2f2/attachment.asc>


More information about the ffmpeg-cvslog mailing list