dix/property.c: use memcpy where appropriate.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
This commit is contained in:
		
							parent
							
								
									65d74d9314
								
							
						
					
					
						commit
						da04e8f135
					
				| 
						 | 
					@ -255,7 +255,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 | 
				
			||||||
    PropertyPtr pProp;
 | 
					    PropertyPtr pProp;
 | 
				
			||||||
    PropertyRec savedProp;
 | 
					    PropertyRec savedProp;
 | 
				
			||||||
    int sizeInBytes, totalSize, rc;
 | 
					    int sizeInBytes, totalSize, rc;
 | 
				
			||||||
    pointer data;
 | 
					    unsigned char *data;
 | 
				
			||||||
    Mask access_mode;
 | 
					    Mask access_mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sizeInBytes = format>>3;
 | 
					    sizeInBytes = format>>3;
 | 
				
			||||||
| 
						 | 
					@ -278,12 +278,11 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 | 
				
			||||||
	    xfree(pProp);
 | 
						    xfree(pProp);
 | 
				
			||||||
	    return(BadAlloc);
 | 
						    return(BadAlloc);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					        memcpy(data, value, totalSize);
 | 
				
			||||||
        pProp->propertyName = property;
 | 
					        pProp->propertyName = property;
 | 
				
			||||||
        pProp->type = type;
 | 
					        pProp->type = type;
 | 
				
			||||||
        pProp->format = format;
 | 
					        pProp->format = format;
 | 
				
			||||||
        pProp->data = data;
 | 
					        pProp->data = data;
 | 
				
			||||||
	if (len)
 | 
					 | 
				
			||||||
	    memmove((char *)data, (char *)value, totalSize);
 | 
					 | 
				
			||||||
	pProp->size = len;
 | 
						pProp->size = len;
 | 
				
			||||||
	pProp->devPrivates = NULL;
 | 
						pProp->devPrivates = NULL;
 | 
				
			||||||
	rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
 | 
						rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
 | 
				
			||||||
| 
						 | 
					@ -317,9 +316,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 | 
				
			||||||
	    data = xalloc(totalSize);
 | 
						    data = xalloc(totalSize);
 | 
				
			||||||
	    if (!data && len)
 | 
						    if (!data && len)
 | 
				
			||||||
		return(BadAlloc);
 | 
							return(BadAlloc);
 | 
				
			||||||
 | 
						    memcpy(data, value, totalSize);
 | 
				
			||||||
	    pProp->data = data;
 | 
						    pProp->data = data;
 | 
				
			||||||
	    if (len)
 | 
					 | 
				
			||||||
		memmove((char *)pProp->data, (char *)value, totalSize);
 | 
					 | 
				
			||||||
	    pProp->size = len;
 | 
						    pProp->size = len;
 | 
				
			||||||
    	    pProp->type = type;
 | 
					    	    pProp->type = type;
 | 
				
			||||||
	    pProp->format = format;
 | 
						    pProp->format = format;
 | 
				
			||||||
| 
						 | 
					@ -334,10 +332,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 | 
				
			||||||
	    if (!data)
 | 
						    if (!data)
 | 
				
			||||||
		return(BadAlloc);
 | 
							return(BadAlloc);
 | 
				
			||||||
	    memcpy(data, pProp->data, pProp->size * sizeInBytes);
 | 
						    memcpy(data, pProp->data, pProp->size * sizeInBytes);
 | 
				
			||||||
 | 
						    memcpy(data + pProp->size * sizeInBytes, value, totalSize);
 | 
				
			||||||
            pProp->data = data;
 | 
					            pProp->data = data;
 | 
				
			||||||
	    memmove(&((char *)data)[pProp->size * sizeInBytes], 
 | 
					 | 
				
			||||||
		    (char *)value,
 | 
					 | 
				
			||||||
		  totalSize);
 | 
					 | 
				
			||||||
            pProp->size += len;
 | 
					            pProp->size += len;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
        else if (mode == PropModePrepend)
 | 
					        else if (mode == PropModePrepend)
 | 
				
			||||||
| 
						 | 
					@ -345,9 +341,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 | 
				
			||||||
            data = xalloc(sizeInBytes * (len + pProp->size));
 | 
					            data = xalloc(sizeInBytes * (len + pProp->size));
 | 
				
			||||||
	    if (!data)
 | 
						    if (!data)
 | 
				
			||||||
		return(BadAlloc);
 | 
							return(BadAlloc);
 | 
				
			||||||
	    memmove(&((char *)data)[totalSize], (char *)pProp->data, 
 | 
					            memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes);
 | 
				
			||||||
		  (int)(pProp->size * sizeInBytes));
 | 
					            memcpy(data, value, totalSize);
 | 
				
			||||||
            memmove((char *)data, (char *)value, totalSize);
 | 
					 | 
				
			||||||
            pProp->data = data;
 | 
					            pProp->data = data;
 | 
				
			||||||
            pProp->size += len;
 | 
					            pProp->size += len;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue