aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c')
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
index 718d40fbd..aecaf94ff 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -48,11 +48,13 @@ from Kaleb S. KEITHLEY
#include "swaprep.h"
#include "xf86.h"
#include "vidmodeproc.h"
+#include "globals.h"
#define DEFAULT_XF86VIDMODE_VERBOSITY 3
static int VidModeErrorBase;
-static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKey;
+static int VidModeClientPrivateKeyIndex;
+static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKeyIndex;
/* This holds the client's version information */
typedef struct {
@@ -65,10 +67,6 @@ typedef struct {
#define VM_SETPRIV(c,p) \
dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p)
-static void XF86VidModeResetProc(
- ExtensionEntry* /* extEntry */
-);
-
static DISPATCH_PROC(ProcXF86VidModeDispatch);
static DISPATCH_PROC(ProcXF86VidModeGetAllModeLines);
static DISPATCH_PROC(ProcXF86VidModeGetModeLine);
@@ -126,8 +124,6 @@ static void SXF86VidModeNotifyEvent();
xXF86VidModeNotifyEvent * /* to */
);
-extern WindowPtr *WindowTable;
-
static RESTYPE EventType; /* resource type for event masks */
typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
@@ -146,8 +142,9 @@ typedef struct _XF86VidModeScreenPrivate {
XF86VidModeEventPtr events;
Bool hasWindow;
} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
-
-static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey;
+
+static int ScreenPrivateKeyIndex;
+static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
@@ -199,7 +196,7 @@ XFree86VidModeExtensionInit(void)
XF86VidModeNumberErrors,
ProcXF86VidModeDispatch,
SProcXF86VidModeDispatch,
- XF86VidModeResetProc,
+ NULL,
StandardMinorOpcode))) {
#if 0
XF86VidModeReqCode = (unsigned char)extEntry->base;
@@ -212,13 +209,6 @@ XFree86VidModeExtensionInit(void)
}
}
-/*ARGSUSED*/
-static void
-XF86VidModeResetProc (extEntry)
- ExtensionEntry* extEntry;
-{
-}
-
static int
ClientMajorVersion(ClientPtr client)
{
@@ -1553,6 +1543,7 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
{
CARD16 *ramp = NULL;
int n, length, i;
+ size_t ramplen;
xXF86VidModeGetGammaRampReply rep;
REQUEST(xXF86VidModeGetGammaRampReq);
@@ -1567,7 +1558,8 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
length = (stuff->size + 1) & ~1;
if(stuff->size) {
- if(!(ramp = xalloc(length * 3 * sizeof(CARD16))))
+ ramplen = length * 3 * sizeof(CARD16);
+ if (!(ramp = xalloc(ramplen)))
return BadAlloc;
if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
@@ -1585,13 +1577,12 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.size, n);
- for(i = 0; i < length * 3; i++)
- swaps(&ramp[i],n);
+ SwapShorts(ramp, length * 3);
}
WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
if(stuff->size) {
- WriteToClient(client, rep.length << 2, (char*)ramp);
+ WriteToClient(client, ramplen, (char*)ramp);
xfree(ramp);
}
@@ -2072,7 +2063,6 @@ SProcXF86VidModeGetGamma(ClientPtr client)
static int
SProcXF86VidModeSetGammaRamp(ClientPtr client)
{
- CARD16 *ramp;
int length, n;
REQUEST(xXF86VidModeSetGammaRampReq);
swaps(&stuff->length, n);
@@ -2081,11 +2071,7 @@ SProcXF86VidModeSetGammaRamp(ClientPtr client)
swaps(&stuff->screen, n);
length = ((stuff->size + 1) & ~1) * 6;
REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
- ramp = (CARD16*)&stuff[1];
- while(length--) {
- swaps(ramp, n);
- ramp++;
- }
+ SwapRestS(stuff);
return ProcXF86VidModeSetGammaRamp(client);
}