fix anonymous memory mapping for NetBSD

mmap() with MAP_ANONYMOUS requires the file descriptor to be -1 in NetBSD.
Linux just ignores this parameter.

Patch by Grant Carver <grantc at cat dot co dot za>

Originally committed as revision 31984 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
Grant Carver 2010-08-19 23:48:19 +00:00 committed by Ramiro Polla
parent 364cacc7c7
commit 53bc0dc2bd
1 changed files with 2 additions and 2 deletions

View File

@ -897,8 +897,8 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4);
#ifdef MAP_ANONYMOUS
c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#elif HAVE_VIRTUALALLOC
c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);