mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-07 10:43:35 +00:00
randr: no need to for local temp buffer in ProcRRQueryProviderProperty()
The code can be much simpler by just using CopySwap32Write(). And we also don't need the callback in WriteSwappedDataToClient(), just call the corresponding write function directly. This also makes some analyzer warnings go away. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -430,7 +430,6 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
||||
REQUEST(xRRQueryProviderPropertyReq);
|
||||
RRProviderPtr provider;
|
||||
RRPropertyPtr prop;
|
||||
char *extra = NULL;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
|
||||
|
||||
@@ -440,12 +439,6 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
||||
if (!prop)
|
||||
return BadName;
|
||||
|
||||
if (prop->num_valid) {
|
||||
extra = xallocarray(prop->num_valid, sizeof(INT32));
|
||||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
xRRQueryProviderPropertyReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
@@ -460,11 +453,10 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
||||
}
|
||||
WriteToClient(client, sizeof(xRRQueryProviderPropertyReply), (char *) &rep);
|
||||
if (prop->num_valid) {
|
||||
memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32));
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
|
||||
extra);
|
||||
free(extra);
|
||||
if (client->swapped)
|
||||
CopySwap32Write(client, prop->num_valid * sizeof(INT32), (CARD32*)prop->valid_values);
|
||||
else
|
||||
WriteToClient(client, prop->num_valid * sizeof(INT32), prop->valid_values);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user