mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-09 02:39:00 +00:00
Upgrade to xorg-server 1.9.2.
Tested by ajacoutot@, krw@, shadchin@ and jasper@ on various configurations including multihead with both zaphod and xrandr.
This commit is contained in:
@@ -215,8 +215,8 @@ ReadRequestFromClient(ClientPtr client)
|
||||
register ConnectionInputPtr aci = AvailableInput->input;
|
||||
if (aci->size > BUFWATERMARK)
|
||||
{
|
||||
xfree(aci->buffer);
|
||||
xfree(aci);
|
||||
free(aci->buffer);
|
||||
free(aci);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -251,7 +251,14 @@ ReadRequestFromClient(ClientPtr client)
|
||||
need_header = FALSE;
|
||||
move_header = FALSE;
|
||||
gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
|
||||
if (gotnow < sizeof(xReq))
|
||||
|
||||
if (oci->ignoreBytes > 0) {
|
||||
if (oci->ignoreBytes > oci->size)
|
||||
needed = oci->size;
|
||||
else
|
||||
needed = oci->ignoreBytes;
|
||||
}
|
||||
else if (gotnow < sizeof(xReq))
|
||||
{
|
||||
/* We don't have an entire xReq yet. Can't tell how big
|
||||
* the request will be until we get the whole xReq.
|
||||
@@ -294,8 +301,13 @@ ReadRequestFromClient(ClientPtr client)
|
||||
if (needed > maxBigRequestSize << 2)
|
||||
{
|
||||
/* request is too big for us to handle */
|
||||
YieldControlDeath();
|
||||
return -1;
|
||||
/*
|
||||
* Mark the rest of it as needing to be ignored, and then return
|
||||
* the full size. Dispatch() will turn it into a BadLength error.
|
||||
*/
|
||||
oci->ignoreBytes = needed - gotnow;
|
||||
oci->lenLastReq = gotnow;
|
||||
return needed;
|
||||
}
|
||||
if ((gotnow == 0) ||
|
||||
((oci->bufptr - oci->buffer + needed) > oci->size))
|
||||
@@ -310,7 +322,7 @@ ReadRequestFromClient(ClientPtr client)
|
||||
/* make buffer bigger to accomodate request */
|
||||
char *ibuf;
|
||||
|
||||
ibuf = (char *)xrealloc(oci->buffer, needed);
|
||||
ibuf = (char *)realloc(oci->buffer, needed);
|
||||
if (!ibuf)
|
||||
{
|
||||
YieldControlDeath();
|
||||
@@ -360,7 +372,7 @@ ReadRequestFromClient(ClientPtr client)
|
||||
{
|
||||
char *ibuf;
|
||||
|
||||
ibuf = (char *)xrealloc(oci->buffer, BUFSIZE);
|
||||
ibuf = (char *)realloc(oci->buffer, BUFSIZE);
|
||||
if (ibuf)
|
||||
{
|
||||
oci->size = BUFSIZE;
|
||||
@@ -400,6 +412,14 @@ ReadRequestFromClient(ClientPtr client)
|
||||
}
|
||||
oci->lenLastReq = needed;
|
||||
|
||||
/* If there are bytes to ignore, ignore them now. */
|
||||
|
||||
if (oci->ignoreBytes > 0) {
|
||||
assert(needed == oci->ignoreBytes || needed == oci->size);
|
||||
oci->ignoreBytes -= gotnow;
|
||||
needed = gotnow = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if client has at least one whole request in the
|
||||
* buffer beyond the request we're returning to the caller.
|
||||
@@ -479,8 +499,8 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
|
||||
ConnectionInputPtr aci = AvailableInput->input;
|
||||
if (aci->size > BUFWATERMARK)
|
||||
{
|
||||
xfree(aci->buffer);
|
||||
xfree(aci);
|
||||
free(aci->buffer);
|
||||
free(aci);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -506,9 +526,9 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
|
||||
{
|
||||
char *ibuf;
|
||||
|
||||
ibuf = (char *)xrealloc(oci->buffer, gotnow + count);
|
||||
ibuf = (char *)realloc(oci->buffer, gotnow + count);
|
||||
if (!ibuf)
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
oci->size = gotnow + count;
|
||||
oci->buffer = ibuf;
|
||||
oci->bufptr = ibuf + oci->bufcnt - gotnow;
|
||||
@@ -529,7 +549,7 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
|
||||
FD_SET(fd, &ClientsWithInput);
|
||||
else
|
||||
YieldControlNoInput(fd);
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
@@ -698,15 +718,17 @@ SetCriticalOutputPending(void)
|
||||
int
|
||||
WriteToClient (ClientPtr who, int count, const void *__buf)
|
||||
{
|
||||
OsCommPtr oc = (OsCommPtr)who->osPrivate;
|
||||
ConnectionOutputPtr oco = oc->output;
|
||||
OsCommPtr oc;
|
||||
ConnectionOutputPtr oco;
|
||||
int padBytes;
|
||||
const char *buf = __buf;
|
||||
#ifdef DEBUG_COMMUNICATION
|
||||
Bool multicount = FALSE;
|
||||
#endif
|
||||
if (!count)
|
||||
return(0);
|
||||
if (!count || !who || who == serverClient || who->clientGone)
|
||||
return 0;
|
||||
oc = who->osPrivate;
|
||||
oco = oc->output;
|
||||
#ifdef DEBUG_COMMUNICATION
|
||||
{
|
||||
char info[128];
|
||||
@@ -817,6 +839,10 @@ WriteToClient (ClientPtr who, int count, const void *__buf)
|
||||
CriticalOutputPending = FALSE;
|
||||
NewOutputPending = FALSE;
|
||||
}
|
||||
|
||||
if (FlushCallback)
|
||||
CallCallbacks(&FlushCallback, NULL);
|
||||
|
||||
return FlushClient(who, oc, buf, count);
|
||||
}
|
||||
|
||||
@@ -824,7 +850,7 @@ WriteToClient (ClientPtr who, int count, const void *__buf)
|
||||
FD_SET(oc->fd, &OutputPending);
|
||||
memmove((char *)oco->buf + oco->count, buf, count);
|
||||
oco->count += count + padBytes;
|
||||
return(count);
|
||||
return count;
|
||||
}
|
||||
|
||||
/********************
|
||||
@@ -937,7 +963,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
|
||||
{
|
||||
unsigned char *obuf;
|
||||
|
||||
obuf = (unsigned char *)xrealloc(oco->buf,
|
||||
obuf = (unsigned char *)realloc(oco->buf,
|
||||
notWritten + BUFSIZE);
|
||||
if (!obuf)
|
||||
{
|
||||
@@ -946,7 +972,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
|
||||
oc->trans_conn = NULL;
|
||||
MarkClientException(who);
|
||||
oco->count = 0;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
oco->size = notWritten + BUFSIZE;
|
||||
oco->buf = obuf;
|
||||
@@ -979,7 +1005,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
|
||||
}
|
||||
MarkClientException(who);
|
||||
oco->count = 0;
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -994,8 +1020,8 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
|
||||
}
|
||||
if (oco->size > BUFWATERMARK)
|
||||
{
|
||||
xfree(oco->buf);
|
||||
xfree(oco);
|
||||
free(oco->buf);
|
||||
free(oco);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1011,19 +1037,20 @@ AllocateInputBuffer(void)
|
||||
{
|
||||
ConnectionInputPtr oci;
|
||||
|
||||
oci = xalloc(sizeof(ConnectionInput));
|
||||
oci = malloc(sizeof(ConnectionInput));
|
||||
if (!oci)
|
||||
return NULL;
|
||||
oci->buffer = xalloc(BUFSIZE);
|
||||
oci->buffer = malloc(BUFSIZE);
|
||||
if (!oci->buffer)
|
||||
{
|
||||
xfree(oci);
|
||||
free(oci);
|
||||
return NULL;
|
||||
}
|
||||
oci->size = BUFSIZE;
|
||||
oci->bufptr = oci->buffer;
|
||||
oci->bufcnt = 0;
|
||||
oci->lenLastReq = 0;
|
||||
oci->ignoreBytes = 0;
|
||||
return oci;
|
||||
}
|
||||
|
||||
@@ -1032,13 +1059,13 @@ AllocateOutputBuffer(void)
|
||||
{
|
||||
ConnectionOutputPtr oco;
|
||||
|
||||
oco = xalloc(sizeof(ConnectionOutput));
|
||||
oco = malloc(sizeof(ConnectionOutput));
|
||||
if (!oco)
|
||||
return NULL;
|
||||
oco->buf = xcalloc(1, BUFSIZE);
|
||||
oco->buf = calloc(1, BUFSIZE);
|
||||
if (!oco->buf)
|
||||
{
|
||||
xfree(oco);
|
||||
free(oco);
|
||||
return NULL;
|
||||
}
|
||||
oco->size = BUFSIZE;
|
||||
@@ -1058,8 +1085,8 @@ FreeOsBuffers(OsCommPtr oc)
|
||||
{
|
||||
if (FreeInputs)
|
||||
{
|
||||
xfree(oci->buffer);
|
||||
xfree(oci);
|
||||
free(oci->buffer);
|
||||
free(oci);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1074,8 +1101,8 @@ FreeOsBuffers(OsCommPtr oc)
|
||||
{
|
||||
if (FreeOutputs)
|
||||
{
|
||||
xfree(oco->buf);
|
||||
xfree(oco);
|
||||
free(oco->buf);
|
||||
free(oco);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1095,13 +1122,13 @@ ResetOsBuffers(void)
|
||||
while ((oci = FreeInputs))
|
||||
{
|
||||
FreeInputs = oci->next;
|
||||
xfree(oci->buffer);
|
||||
xfree(oci);
|
||||
free(oci->buffer);
|
||||
free(oci);
|
||||
}
|
||||
while ((oco = FreeOutputs))
|
||||
{
|
||||
FreeOutputs = oco->next;
|
||||
xfree(oco->buf);
|
||||
xfree(oco);
|
||||
free(oco->buf);
|
||||
free(oco);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user