diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-06-30 17:52:42 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-06-30 17:54:25 -0400 |
commit | da04e8f1354fa9d253443489dc002b16f94d6fab (patch) | |
tree | 323143f33f6276f5bb5dc950f05cfb49e7aaac05 /dix/property.c | |
parent | 65d74d93145d22b68bad5728a7ebe38dc662cb21 (diff) |
dix/property.c: use memcpy where appropriate.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Diffstat (limited to 'dix/property.c')
-rw-r--r-- | dix/property.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/dix/property.c b/dix/property.c index 9aaf248d3..d63b8f4e0 100644 --- a/dix/property.c +++ b/dix/property.c @@ -255,7 +255,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, PropertyPtr pProp; PropertyRec savedProp; int sizeInBytes, totalSize, rc; - pointer data; + unsigned char *data; Mask access_mode; sizeInBytes = format>>3; @@ -278,12 +278,11 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, xfree(pProp); return(BadAlloc); } + memcpy(data, value, totalSize); pProp->propertyName = property; pProp->type = type; pProp->format = format; pProp->data = data; - if (len) - memmove((char *)data, (char *)value, totalSize); pProp->size = len; pProp->devPrivates = NULL; rc = XaceHookPropertyAccess(pClient, pWin, &pProp, @@ -317,9 +316,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, data = xalloc(totalSize); if (!data && len) return(BadAlloc); + memcpy(data, value, totalSize); pProp->data = data; - if (len) - memmove((char *)pProp->data, (char *)value, totalSize); pProp->size = len; pProp->type = type; pProp->format = format; @@ -334,10 +332,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, if (!data) return(BadAlloc); memcpy(data, pProp->data, pProp->size * sizeInBytes); + memcpy(data + pProp->size * sizeInBytes, value, totalSize); pProp->data = data; - memmove(&((char *)data)[pProp->size * sizeInBytes], - (char *)value, - totalSize); pProp->size += len; } else if (mode == PropModePrepend) @@ -345,9 +341,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, data = xalloc(sizeInBytes * (len + pProp->size)); if (!data) return(BadAlloc); - memmove(&((char *)data)[totalSize], (char *)pProp->data, - (int)(pProp->size * sizeInBytes)); - memmove((char *)data, (char *)value, totalSize); + memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes); + memcpy(data, value, totalSize); pProp->data = data; pProp->size += len; } |