diff --git a/Xext/dpms.c b/Xext/dpms.c index a0df33f3d..bbc7890eb 100644 --- a/Xext/dpms.c +++ b/Xext/dpms.c @@ -163,7 +163,7 @@ ProcDPMSSelectInput(register ClientPtr client) pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr)); if (!pHead || !AddResource(eventResource, DPMSEventType, (void *)pHead)) { - FreeResource(clientResource, RT_NONE); + FreeResource(clientResource, X11_RESTYPE_NONE); return BadAlloc; } *pHead = 0; diff --git a/Xext/saver.c b/Xext/saver.c index d9f0c9a64..17d74772e 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -475,7 +475,7 @@ CreateSaverWindow(ScreenPtr pScreen) pSaver = &pScreen->screensaver; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; - FreeResource(pSaver->wid, RT_NONE); + FreeResource(pSaver->wid, X11_RESTYPE_NONE); if (pPriv) { UninstallSaverColormap(pScreen); pPriv->hasWindow = FALSE; @@ -519,7 +519,7 @@ CreateSaverWindow(ScreenPtr pScreen) CursorPtr cursor; if (!pWin->optional) if (!MakeWindowOptional(pWin)) { - FreeResource(pWin->drawable.id, RT_NONE); + FreeResource(pWin->drawable.id, X11_RESTYPE_NONE); return FALSE; } cursor = RefCursor(pAttr->pCursor); @@ -571,7 +571,7 @@ DestroySaverWindow(ScreenPtr pScreen) pSaver = &pScreen->screensaver; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; - FreeResource(pSaver->wid, RT_NONE); + FreeResource(pSaver->wid, X11_RESTYPE_NONE); } pPriv->hasWindow = FALSE; CheckScreenPrivate(pScreen); @@ -1035,7 +1035,7 @@ ScreenSaverSetAttributes(ClientPtr client) } else { ret = dixLookupResourceByType((void **) &pCursor, cursorID, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (ret != Success) { client->errorValue = cursorID; goto PatchUp; @@ -1232,7 +1232,7 @@ ProcScreenSaverSuspend(ClientPtr client) if (suspend == TRUE) this->count++; else if (--this->count == 0) - FreeResource(this->clientResource, RT_NONE); + FreeResource(this->clientResource, X11_RESTYPE_NONE); return Success; } diff --git a/Xext/security.c b/Xext/security.c index 6a9c3d509..49e97a0ca 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -202,7 +202,7 @@ SecurityDeleteAuthorization(void *value, XID id) .authId = pAuth->id }; WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are); - FreeResource(pEventClient->resource, RT_NONE); + FreeResource(pEventClient->resource, X11_RESTYPE_NONE); } /* kill all clients using this auth */ @@ -308,7 +308,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval) pAuth->secondsRemaining); } else { - FreeResource(pAuth->id, RT_NONE); + FreeResource(pAuth->id, X11_RESTYPE_NONE); return 0; } } /* SecurityAuthorizationExpired */ @@ -372,7 +372,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth, pEventClient; pEventClient = pEventClient->next) { if (SameClient(pEventClient, client)) { if (mask == 0) - FreeResource(pEventClient->resource, RT_NONE); + FreeResource(pEventClient->resource, X11_RESTYPE_NONE); else pEventClient->mask = mask; return Success; @@ -584,7 +584,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client) if (rc != Success) return rc; - FreeResource(stuff->authId, RT_NONE); + FreeResource(stuff->authId, X11_RESTYPE_NONE); return Success; } /* ProcSecurityRevokeAuthorization */ diff --git a/Xext/shape.c b/Xext/shape.c index 9d46cd3d6..0e86b8f83 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -786,7 +786,7 @@ ProcShapeSelectInput(ClientPtr client) if (!pHead || !AddResource(pWin->drawable.id, ShapeEventType, (void *) pHead)) { - FreeResource(clientResource, RT_NONE); + FreeResource(clientResource, X11_RESTYPE_NONE); return BadAlloc; } *pHead = 0; diff --git a/Xext/shm.c b/Xext/shm.c index e8a8dd460..b418f53a5 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -464,7 +464,7 @@ ProcShmDetach(ClientPtr client) REQUEST_SIZE_MATCH(xShmDetachReq); VERIFY_SHMSEG(stuff->shmseg, shmdesc, client); - FreeResource(stuff->shmseg, RT_NONE); + FreeResource(stuff->shmseg, X11_RESTYPE_NONE); return Success; } @@ -1002,7 +1002,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client) if (pMap) { result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, - RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess); + RT_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (result != Success) { pDraw->pScreen->DestroyPixmap(pMap); break; @@ -1024,7 +1024,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client) if (result != Success) { while (j--) - FreeResource(newPix->info[j].id, RT_NONE); + FreeResource(newPix->info[j].id, X11_RESTYPE_NONE); free(newPix); } else @@ -1117,7 +1117,7 @@ ProcShmCreatePixmap(ClientPtr client) stuff->offset); if (pMap) { rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP, - pMap, RT_NONE, NULL, DixCreateAccess); + pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { pDraw->pScreen->DestroyPixmap(pMap); return rc; @@ -1144,7 +1144,7 @@ ShmBusfaultNotify(void *context) (unsigned int) shmdesc->resource); busfault_unregister(shmdesc->busfault); shmdesc->busfault = NULL; - FreeResource (shmdesc->resource, RT_NONE); + FreeResource (shmdesc->resource, X11_RESTYPE_NONE); } static int @@ -1326,7 +1326,7 @@ ProcShmCreateSegment(ClientPtr client) } if (WriteFdToClient(client, fd, TRUE) < 0) { - FreeResource(stuff->shmseg, RT_NONE); + FreeResource(stuff->shmseg, X11_RESTYPE_NONE); close(fd); return BadAlloc; } diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c index 334c2784a..3ff7a1d04 100644 --- a/Xext/sleepuntil.c +++ b/Xext/sleepuntil.c @@ -166,7 +166,7 @@ SertafiedBlockHandler(void *data, void *wt) pNext = pReq->next; if (CompareTimeStamps(pReq->revive, now) == LATER) break; - FreeResource(pReq->id, RT_NONE); + FreeResource(pReq->id, X11_RESTYPE_NONE); /* AttendClient() may have been called via the resource delete * function so a client may have input to be processed and so @@ -195,7 +195,7 @@ SertafiedWakeupHandler(void *data, int i) pNext = pReq->next; if (CompareTimeStamps(pReq->revive, now) == LATER) break; - FreeResource(pReq->id, RT_NONE); + FreeResource(pReq->id, X11_RESTYPE_NONE); } if (!pPending) { RemoveBlockAndWakeupHandlers(SertafiedBlockHandler, diff --git a/Xext/sync.c b/Xext/sync.c index 7a814a479..950951e74 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -696,7 +696,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger) /* unblock the client */ AttendClient(pAwaitUnion->header.client); /* delete the await */ - FreeResource(pAwaitUnion->header.delete_id, RT_NONE); + FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE); } static int64_t @@ -751,7 +751,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents) * nothing, since it's already got them. */ if (!wantevents) { - FreeResource(pClients->delete_id, RT_NONE); + FreeResource(pClients->delete_id, X11_RESTYPE_NONE); } return Success; } @@ -934,7 +934,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered); if (status != Success) { - FreeResource(pFence->sync.id, RT_NONE); + FreeResource(pFence->sync.id, X11_RESTYPE_NONE); return status; } @@ -992,7 +992,7 @@ SyncCreateSystemCounter(const char *name, psci = malloc(sizeof(SysCounterInfo)); if (!psci) { - FreeResource(pCounter->sync.id, RT_NONE); + FreeResource(pCounter->sync.id, X11_RESTYPE_NONE); return pCounter; } pCounter->pSysCounterInfo = psci; @@ -1015,7 +1015,7 @@ SyncDestroySystemCounter(void *pSysCounter) { SyncCounter *pCounter = (SyncCounter *) pSysCounter; - FreeResource(pCounter->sync.id, RT_NONE); + FreeResource(pCounter->sync.id, X11_RESTYPE_NONE); } static void @@ -1128,7 +1128,7 @@ FreeAlarm(void *addr, XID id) /* delete event selections */ while (pAlarm->pEventClients) - FreeResource(pAlarm->pEventClients->delete_id, RT_NONE); + FreeResource(pAlarm->pEventClients->delete_id, X11_RESTYPE_NONE); SyncDeleteTriggerFromSyncObject(&pAlarm->trigger); @@ -1493,7 +1493,7 @@ ProcSyncDestroyCounter(ClientPtr client) client->errorValue = stuff->counter; return BadAccess; } - FreeResource(pCounter->sync.id, RT_NONE); + FreeResource(pCounter->sync.id, X11_RESTYPE_NONE); return Success; } @@ -1594,7 +1594,7 @@ ProcSyncAwait(ClientPtr client) /* this should take care of removing any triggers created by * this request that have already been registered on sync objects */ - FreeResource(pAwaitUnion->header.delete_id, RT_NONE); + FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE); client->errorValue = pProtocolWaitConds->counter; return SyncErrorBase + XSyncBadCounter; } @@ -1614,7 +1614,7 @@ ProcSyncAwait(ClientPtr client) /* this should take care of removing any triggers created by * this request that have already been registered on sync objects */ - FreeResource(pAwaitUnion->header.delete_id, RT_NONE); + FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE); return status; } /* this is not a mistake -- same function works for both cases */ @@ -1745,7 +1745,7 @@ ProcSyncCreateAlarm(ClientPtr client) if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_ALARM)) { - FreeResource(stuff->id, RT_NONE); + FreeResource(stuff->id, X11_RESTYPE_NONE); return BadAlloc; } @@ -1876,7 +1876,7 @@ ProcSyncDestroyAlarm(ClientPtr client) if (rc != Success) return rc; - FreeResource(stuff->alarm, RT_NONE); + FreeResource(stuff->alarm, X11_RESTYPE_NONE); return Success; } @@ -1981,7 +1981,7 @@ ProcSyncDestroyFence(ClientPtr client) if (rc != Success) return rc; - FreeResource(stuff->fid, RT_NONE); + FreeResource(stuff->fid, X11_RESTYPE_NONE); return Success; } @@ -2059,7 +2059,7 @@ ProcSyncAwaitFence(ClientPtr client) /* this should take care of removing any triggers created by * this request that have already been registered on sync objects */ - FreeResource(pAwaitUnion->header.delete_id, RT_NONE); + FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE); client->errorValue = *pProtocolFences; return SyncErrorBase + XSyncBadFence; } @@ -2078,7 +2078,7 @@ ProcSyncAwaitFence(ClientPtr client) /* this should take care of removing any triggers created by * this request that have already been registered on sync objects */ - FreeResource(pAwaitUnion->header.delete_id, RT_NONE); + FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE); return status; } /* this is not a mistake -- same function works for both cases */ diff --git a/Xext/xselinux_label.c b/Xext/xselinux_label.c index dd14617b1..3bb597ee2 100644 --- a/Xext/xselinux_label.c +++ b/Xext/xselinux_label.c @@ -325,9 +325,9 @@ SELinuxTypeToClass(RESTYPE type) class = SECCLASS_X_DRAWABLE; else if (type == RT_GC) class = SECCLASS_X_GC; - else if (type == RT_FONT) + else if (type == X11_RESTYPE_FONT) class = SECCLASS_X_FONT; - else if (type == RT_CURSOR) + else if (type == X11_RESTYPE_CURSOR) class = SECCLASS_X_CURSOR; else if (type == RT_COLORMAP) class = SECCLASS_X_COLORMAP; diff --git a/Xext/xtest.c b/Xext/xtest.c index a938d813a..fe2847bb1 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -131,7 +131,7 @@ ProcXTestCompareCursor(ClientPtr client) pCursor = GetSpriteCursor(ptr); else { rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, - RT_CURSOR, client, DixReadAccess); + X11_RESTYPE_CURSOR, client, DixReadAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; diff --git a/Xext/xvmc.c b/Xext/xvmc.c index c7338b766..a1fb6238b 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -290,7 +290,7 @@ ProcXvMCDestroyContext(ClientPtr client) if (rc != Success) return rc; - FreeResource(stuff->context_id, RT_NONE); + FreeResource(stuff->context_id, X11_RESTYPE_NONE); return Success; } @@ -368,7 +368,7 @@ ProcXvMCDestroySurface(ClientPtr client) if (rc != Success) return rc; - FreeResource(stuff->surface_id, RT_NONE); + FreeResource(stuff->surface_id, X11_RESTYPE_NONE); return Success; } @@ -496,7 +496,7 @@ ProcXvMCDestroySubpicture(ClientPtr client) if (rc != Success) return rc; - FreeResource(stuff->subpicture_id, RT_NONE); + FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE); return Success; } diff --git a/Xi/closedev.c b/Xi/closedev.c index f68b5231a..af60d7e99 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -102,7 +102,7 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) next = grab->next; if ((grab->device == dev) && (client->clientAsMask == CLIENT_BITS(grab->resource))) - FreeResource(grab->resource, RT_NONE); + FreeResource(grab->resource, X11_RESTYPE_NONE); } } diff --git a/Xi/exevents.c b/Xi/exevents.c index e8267d3ea..7ef0f2df6 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1538,7 +1538,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, l = &ti->listeners[ti->num_listeners - 1]; l->listener = g->resource; l->grab = g; - //l->resource_type = RT_NONE; + //l->resource_type = X11_RESTYPE_NONE; if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin) l->type = TOUCH_LISTENER_POINTER_GRAB; @@ -2504,7 +2504,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, cursor = NullCursor; else { rc = dixLookupResourceByType((void **) &cursor, param->cursor, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = param->cursor; return rc; @@ -2603,7 +2603,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type, cursor = NullCursor; else { rc = dixLookupResourceByType((void **) &cursor, param->cursor, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = param->cursor; return rc; @@ -2691,7 +2691,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client, if (i == EMASKSIZE) { RecalculateDeviceDeliverableEvents(pWin); if (ShouldFreeInputMasks(pWin, FALSE)) - FreeResource(others->resource, RT_NONE); + FreeResource(others->resource, X11_RESTYPE_NONE); return Success; } } @@ -3118,7 +3118,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) ic = inputMasks->inputClients; for (i = 0; i < EMASKSIZE; i++) inputMasks->dontPropagateMask[i] = 0; - FreeResource(ic->resource, RT_NONE); + FreeResource(ic->resource, X11_RESTYPE_NONE); } } @@ -3241,7 +3241,7 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, } RecalculateDeviceDeliverableEvents(pWin); if (ShouldFreeInputMasks(pWin, FALSE)) - FreeResource(inputMasks->inputClients->resource, RT_NONE); + FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE); return Success; } diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c index 809a81a0a..da6964453 100644 --- a/Xi/xibarriers.c +++ b/Xi/xibarriers.c @@ -831,7 +831,7 @@ XIDestroyPointerBarrier(ClientPtr client, if (CLIENT_ID(stuff->barrier) != client->index) return BadAccess; - FreeResource(stuff->barrier, RT_NONE); + FreeResource(stuff->barrier, X11_RESTYPE_NONE); return Success; } diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c index bfa2e777c..9f2a616d9 100644 --- a/Xi/xichangecursor.c +++ b/Xi/xichangecursor.c @@ -99,7 +99,7 @@ ProcXIChangeCursor(ClientPtr client) } else { rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (rc != Success) return rc; } diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index 6f1eca2a1..900a3e113 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -175,7 +175,7 @@ ProcXIPassiveGrabDevice(ClientPtr client) if (stuff->cursor != None) { ret = dixLookupResourceByType(&tmp, stuff->cursor, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (ret != Success) { client->errorValue = stuff->cursor; goto out; diff --git a/composite/compalloc.c b/composite/compalloc.c index acd215002..f97b6c688 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -217,7 +217,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update) } if (!compCheckRedirect(pWin)) { - FreeResource(ccw->id, RT_NONE); + FreeResource(ccw->id, X11_RESTYPE_NONE); return BadAlloc; } @@ -329,7 +329,7 @@ compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update) for (ccw = cw->clients; ccw; ccw = ccw->next) if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) { - FreeResource(ccw->id, RT_NONE); + FreeResource(ccw->id, X11_RESTYPE_NONE); return Success; } return BadValue; @@ -477,7 +477,7 @@ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update) return BadValue; for (ccw = csw->clients; ccw; ccw = ccw->next) if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) { - FreeResource(ccw->id, RT_NONE); + FreeResource(ccw->id, X11_RESTYPE_NONE); return Success; } return BadValue; diff --git a/composite/compext.c b/composite/compext.c index 31ebbbf67..1f8194f80 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -265,7 +265,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client) if (pScreen->NameWindowPixmap) { rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap); if (rc != Success) { - FreeResource(stuff->pixmap, RT_NONE); + FreeResource(stuff->pixmap, X11_RESTYPE_NONE); return rc; } } @@ -302,14 +302,14 @@ ProcCompositeGetOverlayWindow(ClientPtr client) cs = GetCompScreen(pScreen); if (cs->pOverlayWin == NULL) if (!compCreateOverlayWindow(pScreen)) { - FreeResource(pOc->resource, RT_NONE); + FreeResource(pOc->resource, X11_RESTYPE_NONE); return BadAlloc; } rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, - RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess); + RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, DixGetAttrAccess); if (rc != Success) { - FreeResource(pOc->resource, RT_NONE); + FreeResource(pOc->resource, X11_RESTYPE_NONE); return rc; } @@ -349,7 +349,7 @@ ProcCompositeReleaseOverlayWindow(ClientPtr client) return BadMatch; /* The delete function will free the client structure */ - FreeResource(pOc->resource, RT_NONE); + FreeResource(pOc->resource, X11_RESTYPE_NONE); return Success; } @@ -820,17 +820,17 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client) cs = GetCompScreen(pScreen); if (cs->pOverlayWin == NULL) if (!compCreateOverlayWindow(pScreen)) { - FreeResource(pOc->resource, RT_NONE); + FreeResource(pOc->resource, X11_RESTYPE_NONE); free(overlayWin); return BadAlloc; } rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, - RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, + RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, DixGetAttrAccess); if (rc != Success) { - FreeResource(pOc->resource, RT_NONE); + FreeResource(pOc->resource, X11_RESTYPE_NONE); free(overlayWin); return rc; } @@ -898,7 +898,7 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client) return BadMatch; /* The delete function will free the client structure */ - FreeResource(pOc->resource, RT_NONE); + FreeResource(pOc->resource, X11_RESTYPE_NONE); } return Success; diff --git a/composite/compoverlay.c b/composite/compoverlay.c index eb2d86e0d..1e077b892 100644 --- a/composite/compoverlay.c +++ b/composite/compoverlay.c @@ -169,5 +169,5 @@ compDestroyOverlayWindow(ScreenPtr pScreen) CompScreenPtr cs = GetCompScreen(pScreen); cs->pOverlayWin = NullWindow; - FreeResource(cs->overlayWid, RT_NONE); + FreeResource(cs->overlayWid, X11_RESTYPE_NONE); } diff --git a/composite/compwindow.c b/composite/compwindow.c index c71a1fa7d..54afbdda0 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -610,9 +610,9 @@ compDestroyWindow(WindowPtr pWin) pScreen->DestroyWindow = cs->DestroyWindow; while ((cw = GetCompWindow(pWin))) - FreeResource(cw->clients->id, RT_NONE); + FreeResource(cw->clients->id, X11_RESTYPE_NONE); while ((csw = GetCompSubwindows(pWin))) - FreeResource(csw->clients->id, RT_NONE); + FreeResource(csw->clients->id, X11_RESTYPE_NONE); if (pWin->redirectDraw != RedirectDrawNone) { PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); diff --git a/damageext/damageext.c b/damageext/damageext.c index 099278a36..fd6fcc87e 100644 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -163,7 +163,7 @@ DamageExtDestroy(DamagePtr pDamage, void *closure) pDamageExt->pDamage = 0; if (pDamageExt->id) - FreeResource(pDamageExt->id, RT_NONE); + FreeResource(pDamageExt->id, X11_RESTYPE_NONE); } void @@ -316,7 +316,7 @@ ProcDamageDestroy(ClientPtr client) REQUEST_SIZE_MATCH(xDamageDestroyReq); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); - FreeResource(stuff->damage, RT_NONE); + FreeResource(stuff->damage, X11_RESTYPE_NONE); return Success; } @@ -685,7 +685,7 @@ PanoramiXDamageCreate(ClientPtr client) } if (rc != Success) - FreeResource(stuff->damage, RT_NONE); + FreeResource(stuff->damage, X11_RESTYPE_NONE); return rc; } diff --git a/dbe/dbe.c b/dbe/dbe.c index 237dd0fa9..3cf0a3ef9 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -413,7 +413,7 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) return dbeErrorBase + DbeBadBuffer; } - FreeResource(stuff->buffer, RT_NONE); + FreeResource(stuff->buffer, X11_RESTYPE_NONE); return Success; @@ -1314,7 +1314,7 @@ DbeDestroyWindow(WindowPtr pWin) * NULL if there are no more buffer IDs associated with this * window. */ - FreeResource(pDbeWindowPriv->IDs[0], RT_NONE); + FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE); pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); } } diff --git a/dbe/midbe.c b/dbe/midbe.c index 9684d45bd..c646bc0c7 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -177,7 +177,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) if (rc != Success || !AddResource(bufId, dbeDrawableResType, pDbeWindowPriv->pBackBuffer)) { /* free the buffer and the drawable resource */ - FreeResource(bufId, RT_NONE); + FreeResource(bufId, X11_RESTYPE_NONE); return (rc == Success) ? BadAlloc : rc; } @@ -599,7 +599,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) /* DbeWindowPrivDelete() will free the window private if there no * more buffer IDs associated with this window. */ - FreeResource(pDbeWindowPriv->IDs[0], RT_NONE); + FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE); pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); } diff --git a/dix/colormap.c b/dix/colormap.c index 7a00d14d6..1a46d01ab 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -377,9 +377,9 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, * Security creation/labeling check */ i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP, - pmap, RT_NONE, NULL, DixCreateAccess); + pmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (i != Success) { - FreeResource(mid, RT_NONE); + FreeResource(mid, X11_RESTYPE_NONE); return i; } @@ -387,7 +387,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, * this is it. In specific, if this is a Static colormap, this is the * time to fill in the colormap's values */ if (!(*pScreen->CreateColormap) (pmap)) { - FreeResource(mid, RT_NONE); + FreeResource(mid, X11_RESTYPE_NONE); return BadAlloc; } pmap->flags &= ~BeingCreated; diff --git a/dix/cursor.c b/dix/cursor.c index 0d252b0f0..dcbcaaa77 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -276,8 +276,8 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, pCurs->id = cid; /* security creation/labeling check */ - rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, - pCurs, RT_NONE, NULL, DixCreateAccess); + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR, + pCurs, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) goto error; @@ -334,13 +334,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, CursorPtr pCurs; GlyphSharePtr pShare; - rc = dixLookupResourceByType((void **) &sourcefont, source, RT_FONT, + rc = dixLookupResourceByType((void **) &sourcefont, source, X11_RESTYPE_FONT, client, DixUseAccess); if (rc != Success) { client->errorValue = source; return rc; } - rc = dixLookupResourceByType((void **) &maskfont, mask, RT_FONT, client, + rc = dixLookupResourceByType((void **) &maskfont, mask, X11_RESTYPE_FONT, client, DixUseAccess); if (rc != Success && mask != None) { client->errorValue = mask; @@ -456,8 +456,8 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, pCurs->id = cid; /* security creation/labeling check */ - rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, - pCurs, RT_NONE, NULL, DixCreateAccess); + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR, + pCurs, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) goto error; @@ -500,7 +500,7 @@ CreateRootCursor(char *unused1, unsigned int unused2) if (err != Success) return NullCursor; - err = dixLookupResourceByType((void **) &cursorfont, fontID, RT_FONT, + err = dixLookupResourceByType((void **) &cursorfont, fontID, X11_RESTYPE_FONT, serverClient, DixReadAccess); if (err != Success) return NullCursor; @@ -508,7 +508,7 @@ CreateRootCursor(char *unused1, unsigned int unused2) &curs, serverClient, (XID) 0) != Success) return NullCursor; - if (!AddResource(FakeClientID(0), RT_CURSOR, (void *) curs)) + if (!AddResource(FakeClientID(0), X11_RESTYPE_CURSOR, (void *) curs)) return NullCursor; return curs; diff --git a/dix/dispatch.c b/dix/dispatch.c index fb301ea0b..04a50259d 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -831,7 +831,7 @@ ProcDestroyWindow(ClientPtr client) DixRemoveAccess); if (rc != Success) return rc; - FreeResource(stuff->id, RT_NONE); + FreeResource(stuff->id, X11_RESTYPE_NONE); } return Success; } @@ -1324,10 +1324,10 @@ ProcCloseFont(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((void **) &pFont, stuff->id, RT_FONT, + rc = dixLookupResourceByType((void **) &pFont, stuff->id, X11_RESTYPE_FONT, client, DixDestroyAccess); if (rc == Success) { - FreeResource(stuff->id, RT_NONE); + FreeResource(stuff->id, X11_RESTYPE_NONE); return Success; } else { @@ -1513,7 +1513,7 @@ ProcCreatePixmap(ClientPtr client) pMap->drawable.id = stuff->pid; /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP, - pMap, RT_NONE, NULL, DixCreateAccess); + pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { (*pDraw->pScreen->DestroyPixmap) (pMap); return rc; @@ -1536,7 +1536,7 @@ ProcFreePixmap(ClientPtr client) rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP, client, DixDestroyAccess); if (rc == Success) { - FreeResource(stuff->id, RT_NONE); + FreeResource(stuff->id, X11_RESTYPE_NONE); return Success; } else { @@ -1685,7 +1685,7 @@ ProcFreeGC(ClientPtr client) if (rc != Success) return rc; - FreeResource(stuff->id, RT_NONE); + FreeResource(stuff->id, X11_RESTYPE_NONE); return Success; } @@ -2473,7 +2473,7 @@ ProcFreeColormap(ClientPtr client) if (rc == Success) { /* Freeing a default colormap is a no-op */ if (!(pmap->flags & IsDefault)) - FreeResource(stuff->id, RT_NONE); + FreeResource(stuff->id, X11_RESTYPE_NONE); return Success; } else { @@ -3068,7 +3068,7 @@ ProcCreateCursor(ClientPtr client) if (rc != Success) goto bail; - if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) { + if (!AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) { rc = BadAlloc; goto bail; } @@ -3098,7 +3098,7 @@ ProcCreateGlyphCursor(ClientPtr client) &pCursor, client, stuff->cid); if (res != Success) return res; - if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) + if (AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) return Success; return BadAlloc; } @@ -3112,10 +3112,10 @@ ProcFreeCursor(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR, + rc = dixLookupResourceByType((void **) &pCursor, stuff->id, X11_RESTYPE_CURSOR, client, DixDestroyAccess); if (rc == Success) { - FreeResource(stuff->id, RT_NONE); + FreeResource(stuff->id, X11_RESTYPE_NONE); return Success; } else { diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 6d3c8e127..914ceb7a3 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -133,7 +133,7 @@ GetGlyphs(FontPtr font, unsigned long count, unsigned char *chars, } /* - * adding RT_FONT prevents conflict with default cursor font + * adding RT_FONT / X11_RESTYPE_FONT prevents conflict with default cursor font */ Bool SetDefaultFont(const char *defaultfontname) @@ -147,7 +147,7 @@ SetDefaultFont(const char *defaultfontname) (unsigned) strlen(defaultfontname), defaultfontname); if (err != Success) return FALSE; - err = dixLookupResourceByType((void **) &pf, fid, RT_FONT, serverClient, + err = dixLookupResourceByType((void **) &pf, fid, X11_RESTYPE_FONT, serverClient, DixReadAccess); if (err != Success) return FALSE; @@ -355,7 +355,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) } } } - if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) { + if (!AddResource(c->fontid, X11_RESTYPE_FONT, (void *) pfont)) { err = AllocError; goto bail; } @@ -408,7 +408,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, cached = xfont2_find_cached_font_pattern(patternCache, pfontname, lenfname); if (cached && cached->info.cachable) { - if (!AddResource(fid, RT_FONT, (void *) cached)) + if (!AddResource(fid, X11_RESTYPE_FONT, (void *) cached)) return BadAlloc; cached->refcnt++; return Success; @@ -1157,7 +1157,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) fid = ((Font) *(c->pElt + 4)) /* big-endian */ |((Font) *(c->pElt + 3)) << 8 | ((Font) *(c->pElt + 2)) << 16 | ((Font) *(c->pElt + 1)) << 24; - err = dixLookupResourceByType((void **) &pFont, fid, RT_FONT, + err = dixLookupResourceByType((void **) &pFont, fid, X11_RESTYPE_FONT, client, DixUseAccess); if (err != Success) { /* restore pFont for step 4 (described below) */ @@ -1894,7 +1894,7 @@ find_old_font(XID id) { void *pFont; - dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess); + dixLookupResourceByType(&pFont, id, X11_RESTYPE_NONE, serverClient, DixReadAccess); return (FontPtr) pFont; } @@ -1907,13 +1907,13 @@ get_new_font_client_id(void) static int store_font_Client_font(FontPtr pfont, Font id) { - return AddResource(id, RT_NONE, (void *) pfont); + return AddResource(id, X11_RESTYPE_NONE, (void *) pfont); } static void delete_font_client_id(Font id) { - FreeResource(id, RT_NONE); + FreeResource(id, X11_RESTYPE_NONE); } static int diff --git a/dix/dixutils.c b/dix/dixutils.c index 28f017fc2..2672d3e9d 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -207,7 +207,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) GC *pGC; client->errorValue = id; /* EITHER font or gc */ - rc = dixLookupResourceByType((void **) pFont, id, RT_FONT, client, + rc = dixLookupResourceByType((void **) pFont, id, X11_RESTYPE_FONT, client, access); if (rc != BadFont) return rc; diff --git a/dix/events.c b/dix/events.c index 05bb98f02..2f42268cc 100644 --- a/dix/events.c +++ b/dix/events.c @@ -4534,7 +4534,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) check = (mask & ManagerMask); if (check) { rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, - RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess); + RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixManageAccess); if (rc != Success) return rc; } @@ -4559,7 +4559,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) if (SameClient(others, client)) { check = others->mask; if (mask == 0) { - FreeResource(others->resource, RT_NONE); + FreeResource(others->resource, X11_RESTYPE_NONE); return Success; } else @@ -5065,7 +5065,7 @@ ProcChangeActivePointerGrab(ClientPtr client) newCursor = NullCursor; else { int rc = dixLookupResourceByType((void **) &newCursor, stuff->cursor, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = stuff->cursor; @@ -5182,7 +5182,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, if (curs == None) cursor = NullCursor; else { - rc = dixLookupResourceByType((void **) &cursor, curs, RT_CURSOR, + rc = dixLookupResourceByType((void **) &cursor, curs, X11_RESTYPE_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = curs; @@ -5719,7 +5719,7 @@ ProcGrabButton(ClientPtr client) cursor = NullCursor; else { rc = dixLookupResourceByType((void **) &cursor, stuff->cursor, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; @@ -5906,9 +5906,9 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]--; while ((oc = wOtherClients(pWin))) - FreeResource(oc->resource, RT_NONE); + FreeResource(oc->resource, X11_RESTYPE_NONE); while ((passive = wPassiveGrabs(pWin))) - FreeResource(passive->resource, RT_NONE); + FreeResource(passive->resource, X11_RESTYPE_NONE); } DeleteWindowFromAnyExtEvents(pWin, freeResources); @@ -5973,7 +5973,7 @@ ProcRecolorCursor(ClientPtr client) REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); - rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR, + rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, X11_RESTYPE_CURSOR, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->cursor; diff --git a/dix/gc.c b/dix/gc.c index f2369591b..3d41a5407 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -425,7 +425,7 @@ static const struct { } xidfields[] = { {GCTile, RT_PIXMAP, DixReadAccess}, {GCStipple, RT_PIXMAP, DixReadAccess}, - {GCFont, RT_FONT, DixUseAccess}, + {GCFont, X11_RESTYPE_FONT, DixUseAccess}, {GCClipMask, RT_PIXMAP, DixReadAccess}, }; @@ -550,7 +550,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus, /* security creation/labeling check */ *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC, - RT_NONE, NULL, DixCreateAccess | DixSetAttrAccess); + X11_RESTYPE_NONE, NULL, DixCreateAccess | DixSetAttrAccess); if (*pStatus != Success) goto out; diff --git a/dix/gestures.c b/dix/gestures.c index c6c96675d..18f7b0f0d 100644 --- a/dix/gestures.c +++ b/dix/gestures.c @@ -201,8 +201,8 @@ GestureAddGrabListener(DeviceIntPtr dev, GestureInfoPtr gi, GrabPtr grab) BUG_RETURN_MSG(1, "Unsupported grab type\n"); } - /* grab listeners are always RT_NONE since we keep the grab pointer */ - GestureAddListener(gi, grab->resource, RT_NONE, type, grab->window, grab); + /* grab listeners are always X11_RESTYPE_NONE since we keep the grab pointer */ + GestureAddListener(gi, grab->resource, X11_RESTYPE_NONE, type, grab->window, grab); } /** diff --git a/dix/grabs.c b/dix/grabs.c index 96231a12c..199445fac 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -681,13 +681,13 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) if (!ok) { for (i = 0; i < nadds; i++) - FreeResource(adds[i]->resource, RT_NONE); + FreeResource(adds[i]->resource, X11_RESTYPE_NONE); for (i = 0; i < nups; i++) free(details[i]); } else { for (i = 0; i < ndels; i++) - FreeResource(deletes[i]->resource, RT_NONE); + FreeResource(deletes[i]->resource, X11_RESTYPE_NONE); for (i = 0; i < nadds; i++) { grab = adds[i]; grab->next = grab->window->optional->passiveGrabs; diff --git a/dix/privates.c b/dix/privates.c index 3df845531..91244edbc 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -564,12 +564,12 @@ dixPrivatesSize(DevPrivateType type) /* Table of devPrivates offsets */ static const int offsets[] = { - -1, /* RT_NONE */ + -1, /* RT_NONE / X11_RESTYPE_NONE */ offsetof(WindowRec, devPrivates), /* RT_WINDOW */ offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */ offsetof(GC, devPrivates), /* RT_GC */ - -1, /* RT_FONT */ - offsetof(CursorRec, devPrivates), /* RT_CURSOR */ + -1, /* RT_FONT / X11_RESTYPE_FONT */ + offsetof(CursorRec, devPrivates), /* RT_CURSOR / X11_RESTYPE_CURSOR */ offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */ }; diff --git a/dix/registry.c b/dix/registry.c index a599d8c31..f770359ef 100644 --- a/dix/registry.c +++ b/dix/registry.c @@ -363,12 +363,12 @@ dixResetRegistry(void) #ifdef X_REGISTRY_RESOURCE /* Add built-in resources */ - RegisterResourceName(RT_NONE, "NONE"); + RegisterResourceName(X11_RESTYPE_NONE, "NONE"); RegisterResourceName(RT_WINDOW, "WINDOW"); RegisterResourceName(RT_PIXMAP, "PIXMAP"); RegisterResourceName(RT_GC, "GC"); - RegisterResourceName(RT_FONT, "FONT"); - RegisterResourceName(RT_CURSOR, "CURSOR"); + RegisterResourceName(X11_RESTYPE_FONT, "FONT"); + RegisterResourceName(X11_RESTYPE_CURSOR, "CURSOR"); RegisterResourceName(RT_COLORMAP, "COLORMAP"); RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); diff --git a/dix/resource.c b/dix/resource.c index 35015ca33..57e066290 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -432,7 +432,7 @@ FindGCSubRes(void *value, FindAllRes func, void *cdata) static struct ResourceType *resourceTypes; static const struct ResourceType predefTypes[] = { - [RT_NONE & (RC_LASTPREDEF - 1)] = { + [X11_RESTYPE_NONE & (RC_LASTPREDEF - 1)] = { .deleteFunc = (DeleteType) NoopDDA, .sizeFunc = GetDefaultBytes, .findSubResFunc = DefaultFindSubRes, @@ -456,13 +456,13 @@ static const struct ResourceType predefTypes[] = { .findSubResFunc = FindGCSubRes, .errorValue = BadGC, }, - [RT_FONT & (RC_LASTPREDEF - 1)] = { + [X11_RESTYPE_FONT & (RC_LASTPREDEF - 1)] = { .deleteFunc = CloseFont, .sizeFunc = GetDefaultBytes, .findSubResFunc = DefaultFindSubRes, .errorValue = BadFont, }, - [RT_CURSOR & (RC_LASTPREDEF - 1)] = { + [X11_RESTYPE_CURSOR & (RC_LASTPREDEF - 1)] = { .deleteFunc = FreeCursor, .sizeFunc = GetDefaultBytes, .findSubResFunc = DefaultFindSubRes, @@ -1224,7 +1224,7 @@ dixLookupResourceByType(void **result, XID id, RESTYPE rtype, if (client) { cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, - res->value, RT_NONE, NULL, mode); + res->value, X11_RESTYPE_NONE, NULL, mode); if (cid == BadValue) return resourceTypes[rtype & TypeMask].errorValue; if (cid != Success) @@ -1259,7 +1259,7 @@ dixLookupResourceByClass(void **result, XID id, RESTYPE rclass, if (client) { cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, - res->value, RT_NONE, NULL, mode); + res->value, X11_RESTYPE_NONE, NULL, mode); if (cid != Success) return cid; } diff --git a/dix/touch.c b/dix/touch.c index ee581418a..441e36d0d 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -712,8 +712,8 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti, type = TOUCH_LISTENER_POINTER_GRAB; } - /* grab listeners are always RT_NONE since we keep the grab pointer */ - TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype, + /* grab listeners are always X11_RESTYPE_NONE since we keep the grab pointer */ + TouchAddListener(ti, grab->resource, X11_RESTYPE_NONE, grab->grabtype, type, TOUCH_LISTENER_AWAITING_BEGIN, grab->window, grab); } diff --git a/dix/window.c b/dix/window.c index 27929de14..96af1253d 100644 --- a/dix/window.c +++ b/dix/window.c @@ -640,7 +640,7 @@ CreateRootWindow(ScreenPtr pScreen) /* security creation/labeling check */ if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id, - RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess)) + RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixCreateAccess)) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin)) @@ -1118,11 +1118,11 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client) while (pWin->lastChild) { int rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->lastChild->drawable.id, RT_WINDOW, - pWin->lastChild, RT_NONE, NULL, DixDestroyAccess); + pWin->lastChild, X11_RESTYPE_NONE, NULL, DixDestroyAccess); if (rc != Success) return rc; - FreeResource(pWin->lastChild->drawable.id, RT_NONE); + FreeResource(pWin->lastChild->drawable.id, X11_RESTYPE_NONE); } return Success; } @@ -1399,7 +1399,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } if (val == xTrue) { rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, - RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess); + RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixGrabAccess); if (rc != Success) { error = rc; client->errorValue = pWin->drawable.id; @@ -1495,7 +1495,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { rc = dixLookupResourceByType((void **) &pCursor, cursorID, - RT_CURSOR, client, DixUseAccess); + X11_RESTYPE_CURSOR, client, DixUseAccess); if (rc != Success) { error = rc; client->errorValue = cursorID; @@ -2666,7 +2666,7 @@ MapWindow(WindowPtr pWin, ClientPtr client) /* general check for permission to map window */ if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW, - pWin, RT_NONE, NULL, DixShowAccess) != Success) + pWin, X11_RESTYPE_NONE, NULL, DixShowAccess) != Success) return Success; pScreen = pWin->drawable.pScreen; @@ -3138,7 +3138,7 @@ dixSaveScreens(ClientPtr client, int on, int mode) } else if (HasSaverWindow(pScreen)) { pScreen->screensaver.pWindow = NullWindow; - FreeResource(pScreen->screensaver.wid, RT_NONE); + FreeResource(pScreen->screensaver.wid, X11_RESTYPE_NONE); } break; case SCREEN_SAVER_CYCLE: @@ -3266,7 +3266,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind) &cursor, serverClient, (XID) 0); if (cursor) { cursorID = FakeClientID(0); - if (AddResource(cursorID, RT_CURSOR, (void *) cursor)) { + if (AddResource(cursorID, X11_RESTYPE_CURSOR, (void *) cursor)) { attributes[attri] = cursorID; mask |= CWCursor; } @@ -3289,7 +3289,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind) wVisual(pScreen->root), &result); if (cursor) - FreeResource(cursorID, RT_NONE); + FreeResource(cursorID, X11_RESTYPE_NONE); if (!pWin) return FALSE; diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml index f33d90475..8c3c0fce4 100644 --- a/doc/Xserver-spec.xml +++ b/doc/Xserver-spec.xml @@ -440,7 +440,7 @@ To free a resource, use one of the following. FreeResource frees all resources matching the given id, regardless of type; the type's deleteFunc will be called on each matching resource, except that skipDeleteFuncType can be set to a single type for which -the deleteFunc should not be called (otherwise pass RT_NONE). +the deleteFunc should not be called (otherwise pass RT_NONE / X11_RESTYPE_NONE). FreeResourceByType frees a specific resource matching a given id and type; if skipFree is true, then the deleteFunc is not called. diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c index 7e728b0af..e45e3d9bb 100644 --- a/dri3/dri3_request.c +++ b/dri3/dri3_request.c @@ -239,7 +239,7 @@ proc_dri3_pixmap_from_buffer(ClientPtr client) /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, - pixmap, RT_NONE, NULL, DixCreateAccess); + pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { (*drawable->pScreen->DestroyPixmap) (pixmap); @@ -503,7 +503,7 @@ proc_dri3_pixmap_from_buffers(ClientPtr client) /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, - pixmap, RT_NONE, NULL, DixCreateAccess); + pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { (*screen->DestroyPixmap) (pixmap); diff --git a/glx/glxcmds.c b/glx/glxcmds.c index a5069eb10..9ad99da8e 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -1396,7 +1396,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, return BadAlloc; err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, RT_PIXMAP, - pPixmap, RT_NONE, NULL, DixCreateAccess); + pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (err != Success) { (*pGlxScreen->pScreen->DestroyPixmap) (pPixmap); return err; diff --git a/glx/vndext.c b/glx/vndext.c index 770aff6bb..21ba29269 100644 --- a/glx/vndext.c +++ b/glx/vndext.c @@ -114,7 +114,7 @@ GlxMappingInit(void) idResource = CreateNewResourceType(idResourceDeleteCallback, "GLXServerIDRes"); - if (idResource == RT_NONE) + if (idResource == X11_RESTYPE_NONE) { GlxMappingReset(); return FALSE; diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 7de31cb61..7fa6b98c1 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -369,7 +369,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix) { if (oldPix->drawable.id) - FreeResource(oldPix->drawable.id, RT_NONE); + FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else (*pScreen->DestroyPixmap) (oldPix); } @@ -431,7 +431,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix) { if (oldPix->drawable.id) - FreeResource(oldPix->drawable.id, RT_NONE); + FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else (*pScreen->DestroyPixmap) (oldPix); } diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 8cd92f296..e0c7c505d 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -271,7 +271,7 @@ ProcAppleWMSelectInput(register ClientPtr client) pHead = (WMEventPtr *)malloc(sizeof(WMEventPtr)); if (!pHead || !AddResource(eventResource, EventType, (void *)pHead)) { - FreeResource(clientResource, RT_NONE); + FreeResource(clientResource, X11_RESTYPE_NONE); return BadAlloc; } *pHead = 0; diff --git a/include/resource.h b/include/resource.h index 6caf846c4..4e3980153 100644 --- a/include/resource.h +++ b/include/resource.h @@ -71,19 +71,25 @@ typedef uint32_t RESTYPE; /* types for Resource routines */ +// prevent namespace clash with Windows +#define X11_RESTYPE_NONE ((RESTYPE)0) +#define X11_RESTYPE_FONT ((RESTYPE)4) +#define X11_RESTYPE_CURSOR ((RESTYPE)5) + #define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE) #define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE) #define RT_GC ((RESTYPE)3) #undef RT_FONT #undef RT_CURSOR -#define RT_FONT ((RESTYPE)4) -#define RT_CURSOR ((RESTYPE)5) +#define RT_FONT X11_RESTYPE_FONT +#define RT_CURSOR X11_RESTYPE_CURSOR #define RT_COLORMAP ((RESTYPE)6) #define RT_CMAPENTRY ((RESTYPE)7) #define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN) #define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN) #define RT_LASTPREDEF ((RESTYPE)9) -#define RT_NONE ((RESTYPE)0) +#define RT_NONE X11_RESTYPE_NONE + extern _X_EXPORT unsigned int ResourceClientBits(void); /* bits and fields within a resource id */ diff --git a/present/present_event.c b/present/present_event.c index 849732dc8..b35609b23 100644 --- a/present/present_event.c +++ b/present/present_event.c @@ -52,7 +52,7 @@ present_free_events(WindowPtr window) return; while ((event = window_priv->events)) - FreeResource(event->id, RT_NONE); + FreeResource(event->id, X11_RESTYPE_NONE); } static void @@ -224,7 +224,7 @@ present_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask) if (mask) event->mask = mask; else - FreeResource(eid, RT_NONE); + FreeResource(eid, X11_RESTYPE_NONE); return Success; } if (ret != BadValue) diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index 5d6914c62..8cb79b199 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -138,7 +138,7 @@ ProcRRSelectInput(ClientPtr client) if (!pHead || !AddResource(pWin->drawable.id, RREventType, (void *) pHead)) { - FreeResource(clientResource, RT_NONE); + FreeResource(clientResource, X11_RESTYPE_NONE); return BadAlloc; } *pHead = 0; diff --git a/randr/rrlease.c b/randr/rrlease.c index 48f02c5b8..4d92b4af9 100644 --- a/randr/rrlease.c +++ b/randr/rrlease.c @@ -151,7 +151,7 @@ RRLeaseTerminated(RRLeasePtr lease) RRLeaseChangeState(lease, RRLeaseTerminating, RRLeaseTerminating); if (lease->id != None) - FreeResource(lease->id, RT_NONE); + FreeResource(lease->id, X11_RESTYPE_NONE); xorg_list_del(&lease->list); } @@ -368,7 +368,7 @@ ProcRRFreeLease(ClientPtr client) RRTerminateLease(lease); else /* Get rid of the resource database entry */ - FreeResource(stuff->lid, RT_NONE); + FreeResource(stuff->lid, X11_RESTYPE_NONE); return Success; } diff --git a/record/record.c b/record/record.c index ca9254ce1..88fbf9c85 100644 --- a/record/record.c +++ b/record/record.c @@ -2457,7 +2457,7 @@ ProcRecordFreeContext(ClientPtr client) REQUEST_SIZE_MATCH(xRecordFreeContextReq); VERIFY_CONTEXT(pContext, stuff->context, client); - FreeResource(stuff->context, RT_NONE); + FreeResource(stuff->context, X11_RESTYPE_NONE); return Success; } /* ProcRecordFreeContext */ diff --git a/render/animcur.c b/render/animcur.c index eb8b817e2..e736e4c24 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -336,8 +336,8 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor, /* security creation/labeling check */ if (ac->timer) - rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor, - RT_NONE, NULL, DixCreateAccess); + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR, pCursor, + X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) { TimerFree(ac->timer); diff --git a/render/picture.c b/render/picture.c index 495cc2955..6f139b520 100644 --- a/render/picture.c +++ b/render/picture.c @@ -640,7 +640,7 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) (formats[n].id, PictFormatType, (void *) (formats + n))) { int i; for (i = 0; i < n; i++) - FreeResource(formats[i].id, RT_NONE); + FreeResource(formats[i].id, X11_RESTYPE_NONE); free(formats); return FALSE; } diff --git a/render/render.c b/render/render.c index 8652efb34..af84a0345 100644 --- a/render/render.c +++ b/render/render.c @@ -649,7 +649,7 @@ ProcRenderFreePicture(ClientPtr client) REQUEST_SIZE_MATCH(xRenderFreePictureReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess); - FreeResource(stuff->picture, RT_NONE); + FreeResource(stuff->picture, X11_RESTYPE_NONE); return Success; } @@ -930,7 +930,7 @@ ProcRenderCreateGlyphSet(ClientPtr client) return BadAlloc; /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType, - glyphSet, RT_NONE, NULL, DixCreateAccess); + glyphSet, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (rc != Success) return rc; if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet)) @@ -980,7 +980,7 @@ ProcRenderFreeGlyphSet(ClientPtr client) client->errorValue = stuff->glyphset; return rc; } - FreeResource(stuff->glyphset, RT_NONE); + FreeResource(stuff->glyphset, X11_RESTYPE_NONE); return Success; } @@ -1635,7 +1635,7 @@ ProcRenderCreateCursor(ClientPtr client) &pCursor, client, stuff->cid); if (rc != Success) goto bail; - if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) { + if (!AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) { rc = BadAlloc; goto bail; } @@ -1805,7 +1805,7 @@ ProcRenderCreateAnimCursor(ClientPtr client) elt = (xAnimCursorElt *) (stuff + 1); for (i = 0; i < ncursor; i++) { ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor, - RT_CURSOR, client, DixReadAccess); + X11_RESTYPE_CURSOR, client, DixReadAccess); if (ret != Success) { free(cursors); return ret; @@ -1819,7 +1819,7 @@ ProcRenderCreateAnimCursor(ClientPtr client) if (ret != Success) return ret; - if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) + if (AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) return Success; return BadAlloc; } @@ -1863,7 +1863,7 @@ ProcRenderCreateSolidFill(ClientPtr client) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, - pPicture, RT_NONE, NULL, DixCreateAccess); + pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) @@ -1902,7 +1902,7 @@ ProcRenderCreateLinearGradient(ClientPtr client) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, - pPicture, RT_NONE, NULL, DixCreateAccess); + pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) @@ -1942,7 +1942,7 @@ ProcRenderCreateRadialGradient(ClientPtr client) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, - pPicture, RT_NONE, NULL, DixCreateAccess); + pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) @@ -1981,7 +1981,7 @@ ProcRenderCreateConicalGradient(ClientPtr client) return error; /* security creation/labeling check */ error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, - pPicture, RT_NONE, NULL, DixCreateAccess); + pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (error != Success) return error; if (!AddResource(stuff->pid, PictureType, (void *) pPicture)) diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 1c8d7b26d..7d5d70ad8 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -74,7 +74,7 @@ static void deleteCursorHideCountsForScreen(ScreenPtr pScreen); do { \ int err; \ err = dixLookupResourceByType((void **) &pCursor, cursor, \ - RT_CURSOR, client, access); \ + X11_RESTYPE_CURSOR, client, access); \ if (err != Success) { \ client->errorValue = cursor; \ return err; \ @@ -373,8 +373,8 @@ ProcXFixesGetCursorImage(ClientPtr client) pCursor = CursorForClient(client); if (!pCursor) return BadCursor; - rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, - pCursor, RT_NONE, NULL, DixReadAccess); + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, X11_RESTYPE_CURSOR, + pCursor, X11_RESTYPE_NONE, NULL, DixReadAccess); if (rc != Success) return rc; GetSpritePosition(PickPointer(client), &x, &y); @@ -522,8 +522,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) pCursor = CursorForClient(client); if (!pCursor) return BadCursor; - rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, - pCursor, RT_NONE, NULL, DixReadAccess | DixGetAttrAccess); + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, X11_RESTYPE_CURSOR, + pCursor, X11_RESTYPE_NONE, NULL, DixReadAccess | DixGetAttrAccess); if (rc != Success) return rc; GetSpritePosition(PickPointer(client), &x, &y); @@ -597,7 +597,7 @@ typedef struct { } ReplaceCursorLookupRec, *ReplaceCursorLookupPtr; static const RESTYPE CursorRestypes[] = { - RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR + RT_WINDOW, RT_PASSIVEGRAB, X11_RESTYPE_CURSOR }; static Bool @@ -622,7 +622,7 @@ ReplaceCursorLookup(void *value, XID id, void *closure) pCursorRef = &pGrab->cursor; pCursor = *pCursorRef; break; - case RT_CURSOR: + case X11_RESTYPE_CURSOR: pCursorRef = 0; pCursor = (CursorPtr) value; cursor = id; @@ -635,7 +635,7 @@ ReplaceCursorLookup(void *value, XID id, void *closure) if (pCursorRef) *pCursorRef = curs; else - ChangeResourceValue(id, RT_CURSOR, curs); + ChangeResourceValue(id, X11_RESTYPE_CURSOR, curs); FreeCursor(pCursor, cursor); } } diff --git a/xfixes/region.c b/xfixes/region.c index 19a8930b6..81a0dfcd0 100644 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -301,7 +301,7 @@ ProcXFixesDestroyRegion(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); - FreeResource(stuff->region, RT_NONE); + FreeResource(stuff->region, X11_RESTYPE_NONE); return Success; }