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:
		
							parent
							
								
									b535db955a
								
							
						
					
					
						commit
						2e05296905
					
				| 
						 | 
				
			
			@ -380,7 +380,6 @@ ProcRRQueryProviderProperty(ClientPtr client)
 | 
			
		|||
    REQUEST(xRRQueryProviderPropertyReq);
 | 
			
		||||
    RRProviderPtr provider;
 | 
			
		||||
    RRPropertyPtr prop;
 | 
			
		||||
    char *extra = NULL;
 | 
			
		||||
 | 
			
		||||
    REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -390,12 +389,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,
 | 
			
		||||
| 
						 | 
				
			
			@ -410,11 +403,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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue