From a915739887477b28d924ecc8417ee107d125bd6c Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 6 Sep 2009 18:48:27 +0000 Subject: Switched to xorg-server-1.6.99.900.tar.gz --- xorg-server/dix/colormap.c | 77 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 39 deletions(-) (limited to 'xorg-server/dix/colormap.c') diff --git a/xorg-server/dix/colormap.c b/xorg-server/dix/colormap.c index 8b1bad8a3..a5a006e60 100644 --- a/xorg-server/dix/colormap.c +++ b/xorg-server/dix/colormap.c @@ -51,7 +51,6 @@ SOFTWARE. #endif #include -#define NEED_EVENTS #include #include #include @@ -253,7 +252,7 @@ typedef struct _colorResource * \param mid resource to use for this colormap * \param alloc 1 iff all entries are allocated writable */ -_X_EXPORT int +int CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, ColormapPtr *ppcmap, int alloc, int client) { @@ -275,7 +274,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, if ((class | DynamicClass) == DirectColor) sizebytes *= 3; sizebytes += sizeof(ColormapRec); - pmap = (ColormapPtr) xalloc(sizebytes); + pmap = xalloc(sizebytes); if (!pmap) return (BadAlloc); #if defined(_XSERVER64) @@ -311,7 +310,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--) pent->refcnt = AllocPrivate; pmap->freeRed = 0; - ppix = (Pixel *)xalloc(size * sizeof(Pixel)); + ppix = xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap); @@ -357,7 +356,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--) pent->refcnt = AllocPrivate; pmap->freeGreen = 0; - ppix = (Pixel *) xalloc(size * sizeof(Pixel)); + ppix = xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap->clientPixelsRed[client]); @@ -373,7 +372,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--) pent->refcnt = AllocPrivate; pmap->freeBlue = 0; - ppix = (Pixel *) xalloc(size * sizeof(Pixel)); + ppix = xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap->clientPixelsGreen[client]); @@ -502,7 +501,7 @@ TellNoMap (WindowPtr pwin, Colormap *pmid) } /* Tell window that pmid got uninstalled */ -_X_EXPORT int +int TellLostMap (WindowPtr pwin, pointer value) { Colormap *pmid = (Colormap *)value; @@ -527,7 +526,7 @@ TellLostMap (WindowPtr pwin, pointer value) } /* Tell window that pmid got installed */ -_X_EXPORT int +int TellGainedMap (WindowPtr pwin, pointer value) { Colormap *pmid = (Colormap *)value; @@ -744,7 +743,7 @@ UpdateColors (ColormapPtr pmap) pVisual = pmap->pVisual; size = pVisual->ColormapEntries; - defs = (xColorItem *)xalloc(size * sizeof(xColorItem)); + defs = xalloc(size * sizeof(xColorItem)); if (!defs) return; n = 0; @@ -800,7 +799,7 @@ UpdateColors (ColormapPtr pmap) /* Get a read-only color from a ColorMap (probably slow for large maps) * Returns by changing the value in pred, pgreen, pblue and pPix */ -_X_EXPORT int +int AllocColor (ColormapPtr pmap, unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, Pixel *pPix, int client) @@ -894,9 +893,9 @@ AllocColor (ColormapPtr pmap, if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { - ColormapPtr prootmap = (ColormapPtr) - SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, DixReadAccess); + ColormapPtr prootmap; + dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap, + RT_COLORMAP, clients[client], DixReadAccess); if (pmap->class == prootmap->class) FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb, @@ -911,9 +910,9 @@ AllocColor (ColormapPtr pmap, if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { - ColormapPtr prootmap = (ColormapPtr) - SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, DixReadAccess); + ColormapPtr prootmap; + dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap, + RT_COLORMAP, clients[client], DixReadAccess); if (pmap->class == prootmap->class) { @@ -963,7 +962,7 @@ AllocColor (ColormapPtr pmap, { colorResource *pcr; - pcr = (colorResource *) xalloc(sizeof(colorResource)); + pcr = xalloc(sizeof(colorResource)); if (!pcr) { (void)FreeColors(pmap, client, 1, pPix, (Pixel)0); @@ -985,7 +984,7 @@ AllocColor (ColormapPtr pmap, * is that this routine will never return failure. */ -_X_EXPORT void +void FakeAllocColor (ColormapPtr pmap, xColorItem *item) { Pixel pixR, pixG, pixB; @@ -1052,7 +1051,7 @@ FakeAllocColor (ColormapPtr pmap, xColorItem *item) } /* free a pixel value obtained from FakeAllocColor */ -_X_EXPORT void +void FakeFreeColor(ColormapPtr pmap, Pixel pixel) { VisualPtr pVisual; @@ -1415,7 +1414,7 @@ BlueComp (EntryPtr pent, xrgb *prgb) /* Read the color value of a cell */ -_X_EXPORT int +int QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList) { Pixel *ppix, pixel; @@ -1551,12 +1550,14 @@ FreePixels(ColormapPtr pmap, int client) int FreeClientPixels (pointer value, XID fakeid) { - ColormapPtr pmap; - colorResource *pcr = (colorResource *)value; - - pmap = (ColormapPtr) LookupIDByType(pcr->mid, RT_COLORMAP); - if (pmap) - FreePixels(pmap, pcr->client); + pointer pmap; + colorResource *pcr = value; + int rc; + + rc = dixLookupResourceByType(&pmap, pcr->mid, RT_COLORMAP, serverClient, + DixRemoveAccess); + if (rc == Success) + FreePixels((ColormapPtr)pmap, pcr->client); xfree(pcr); return Success; } @@ -1579,7 +1580,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes, oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { - pcr = (colorResource *) xalloc(sizeof(colorResource)); + pcr = xalloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } @@ -1654,7 +1655,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors, oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { - pcr = (colorResource *) xalloc(sizeof(colorResource)); + pcr = xalloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } @@ -1746,9 +1747,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont for(p = pixels; p < pixels + c; p++) *p = 0; - ppixRed = (Pixel *)xalloc(npixR * sizeof(Pixel)); - ppixGreen = (Pixel *)xalloc(npixG * sizeof(Pixel)); - ppixBlue = (Pixel *)xalloc(npixB * sizeof(Pixel)); + ppixRed = xalloc(npixR * sizeof(Pixel)); + ppixGreen = xalloc(npixG * sizeof(Pixel)); + ppixBlue = xalloc(npixB * sizeof(Pixel)); if (!ppixRed || !ppixGreen || !ppixBlue) { if (ppixBlue) xfree(ppixBlue); @@ -1853,7 +1854,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, npix = c << r; if ((r >= 32) || (npix > pmap->freeRed) || (npix < c)) return(BadAlloc); - if(!(ppixTemp = (Pixel *)xalloc(npix * sizeof(Pixel)))) + if(!(ppixTemp = xalloc(npix * sizeof(Pixel)))) return(BadAlloc); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); @@ -2083,14 +2084,13 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, npixClientNew = c << (r + g + b); npixShared = (c << r) + (c << g) + (c << b); - psharedList = (SHAREDCOLOR **)xalloc(npixShared * - sizeof(SHAREDCOLOR *)); + psharedList = xalloc(npixShared * sizeof(SHAREDCOLOR *)); if (!psharedList) return FALSE; ppshared = psharedList; for (z = npixShared; --z >= 0; ) { - if (!(ppshared[z] = (SHAREDCOLOR *)xalloc(sizeof(SHAREDCOLOR)))) + if (!(ppshared[z] = xalloc(sizeof(SHAREDCOLOR)))) { for (z++ ; z < npixShared; z++) xfree(ppshared[z]); @@ -2206,7 +2206,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, /** FreeColors * Free colors and/or cells (probably slow for large numbers) */ -_X_EXPORT int +int FreeColors (ColormapPtr pmap, int client, int count, Pixel *pixels, Pixel mask) { int rval, result, class; @@ -2400,7 +2400,7 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe /* Redefine color values */ -_X_EXPORT int +int StoreColors (ColormapPtr pmap, int count, xColorItem *defs) { Pixel pix; @@ -2673,8 +2673,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin) Colormap *pmaps; int imap, nummaps, found; - pmaps = (Colormap *) xalloc( - pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); + pmaps = xalloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap)); if(!pmaps) return(FALSE); nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) -- cgit v1.2.3