dix: Use memcpy() instead of memmove() when buffers are known not to overlap
Most of these came from a mass bcopy() -> memmove() substitution in 1993 with a commit comment of "Ansification (changed bfuncs -> mfuncs)" Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
f8cbe96d14
commit
5cc24dbb4c
|
@ -638,11 +638,11 @@ CreateConnectionBlock(void)
|
||||||
if (!ConnectionInfo)
|
if (!ConnectionInfo)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
memmove(ConnectionInfo, (char *) &setup, sizeof(xConnSetup));
|
memcpy(ConnectionInfo, &setup, sizeof(xConnSetup));
|
||||||
sizesofar = sizeof(xConnSetup);
|
sizesofar = sizeof(xConnSetup);
|
||||||
pBuf = ConnectionInfo + sizeof(xConnSetup);
|
pBuf = ConnectionInfo + sizeof(xConnSetup);
|
||||||
|
|
||||||
memmove(pBuf, VendorString, (int) setup.nbytesVendor);
|
memcpy(pBuf, VendorString, (size_t) setup.nbytesVendor);
|
||||||
sizesofar += setup.nbytesVendor;
|
sizesofar += setup.nbytesVendor;
|
||||||
pBuf += setup.nbytesVendor;
|
pBuf += setup.nbytesVendor;
|
||||||
i = padding_for_int32(setup.nbytesVendor);
|
i = padding_for_int32(setup.nbytesVendor);
|
||||||
|
@ -655,7 +655,7 @@ CreateConnectionBlock(void)
|
||||||
format.depth = screenInfo.formats[i].depth;
|
format.depth = screenInfo.formats[i].depth;
|
||||||
format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
|
format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
|
||||||
format.scanLinePad = screenInfo.formats[i].scanlinePad;
|
format.scanLinePad = screenInfo.formats[i].scanlinePad;
|
||||||
memmove(pBuf, (char *) &format, sizeof(xPixmapFormat));
|
memcpy(pBuf, &format, sizeof(xPixmapFormat));
|
||||||
pBuf += sizeof(xPixmapFormat);
|
pBuf += sizeof(xPixmapFormat);
|
||||||
sizesofar += sizeof(xPixmapFormat);
|
sizesofar += sizeof(xPixmapFormat);
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ CreateConnectionBlock(void)
|
||||||
root.saveUnders = FALSE;
|
root.saveUnders = FALSE;
|
||||||
root.rootDepth = pScreen->rootDepth;
|
root.rootDepth = pScreen->rootDepth;
|
||||||
root.nDepths = pScreen->numDepths;
|
root.nDepths = pScreen->numDepths;
|
||||||
memmove(pBuf, (char *) &root, sizeof(xWindowRoot));
|
memcpy(pBuf, &root, sizeof(xWindowRoot));
|
||||||
sizesofar += sizeof(xWindowRoot);
|
sizesofar += sizeof(xWindowRoot);
|
||||||
pBuf += sizeof(xWindowRoot);
|
pBuf += sizeof(xWindowRoot);
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ CreateConnectionBlock(void)
|
||||||
pBuf += sizesofar;
|
pBuf += sizesofar;
|
||||||
depth.depth = pDepth->depth;
|
depth.depth = pDepth->depth;
|
||||||
depth.nVisuals = pDepth->numVids;
|
depth.nVisuals = pDepth->numVids;
|
||||||
memmove(pBuf, (char *) &depth, sizeof(xDepth));
|
memcpy(pBuf, &depth, sizeof(xDepth));
|
||||||
pBuf += sizeof(xDepth);
|
pBuf += sizeof(xDepth);
|
||||||
sizesofar += sizeof(xDepth);
|
sizesofar += sizeof(xDepth);
|
||||||
for (k = 0; k < pDepth->numVids; k++) {
|
for (k = 0; k < pDepth->numVids; k++) {
|
||||||
|
@ -716,7 +716,7 @@ CreateConnectionBlock(void)
|
||||||
visual.redMask = pVisual->redMask;
|
visual.redMask = pVisual->redMask;
|
||||||
visual.greenMask = pVisual->greenMask;
|
visual.greenMask = pVisual->greenMask;
|
||||||
visual.blueMask = pVisual->blueMask;
|
visual.blueMask = pVisual->blueMask;
|
||||||
memmove(pBuf, (char *) &visual, sizeof(xVisualType));
|
memcpy(pBuf, &visual, sizeof(xVisualType));
|
||||||
pBuf += sizeof(xVisualType);
|
pBuf += sizeof(xVisualType);
|
||||||
sizesofar += sizeof(xVisualType);
|
sizesofar += sizeof(xVisualType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
|
||||||
err = AllocError;
|
err = AllocError;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memmove(newname, alias, newlen);
|
memcpy(newname, alias, newlen);
|
||||||
c->fontname = newname;
|
c->fontname = newname;
|
||||||
c->fnamelen = newlen;
|
c->fnamelen = newlen;
|
||||||
c->current_fpe = 0;
|
c->current_fpe = 0;
|
||||||
|
@ -427,7 +427,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
|
||||||
free(c);
|
free(c);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
memmove(c->fontname, pfontname, lenfname);
|
memcpy(c->fontname, pfontname, lenfname);
|
||||||
for (i = 0; i < num_fpes; i++) {
|
for (i = 0; i < num_fpes; i++) {
|
||||||
c->fpe_list[i] = font_path_elements[i];
|
c->fpe_list[i] = font_path_elements[i];
|
||||||
UseFPE(c->fpe_list[i]);
|
UseFPE(c->fpe_list[i]);
|
||||||
|
@ -641,7 +641,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
||||||
free(resolved);
|
free(resolved);
|
||||||
resolved = malloc(resolvedlen + 1);
|
resolved = malloc(resolvedlen + 1);
|
||||||
if (resolved)
|
if (resolved)
|
||||||
memmove(resolved, tmpname, resolvedlen + 1);
|
memcpy(resolved, tmpname, resolvedlen + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
||||||
* is BadFontName, indicating the alias resolution
|
* is BadFontName, indicating the alias resolution
|
||||||
* is complete.
|
* is complete.
|
||||||
*/
|
*/
|
||||||
memmove(tmp_pattern, resolved, resolvedlen);
|
memcpy(tmp_pattern, resolved, resolvedlen);
|
||||||
if (c->haveSaved) {
|
if (c->haveSaved) {
|
||||||
char *tmpname;
|
char *tmpname;
|
||||||
int tmpnamelen;
|
int tmpnamelen;
|
||||||
|
@ -691,11 +691,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
||||||
free(c->savedName);
|
free(c->savedName);
|
||||||
c->savedName = malloc(namelen + 1);
|
c->savedName = malloc(namelen + 1);
|
||||||
if (c->savedName)
|
if (c->savedName)
|
||||||
memmove(c->savedName, name, namelen + 1);
|
memcpy(c->savedName, name, namelen + 1);
|
||||||
c->savedNameLen = namelen;
|
c->savedNameLen = namelen;
|
||||||
aliascount = 20;
|
aliascount = 20;
|
||||||
}
|
}
|
||||||
memmove(c->current.pattern, tmp_pattern, resolvedlen);
|
memcpy(c->current.pattern, tmp_pattern, resolvedlen);
|
||||||
c->current.patlen = resolvedlen;
|
c->current.patlen = resolvedlen;
|
||||||
c->current.max_names = c->names->nnames + 1;
|
c->current.max_names = c->names->nnames + 1;
|
||||||
c->current.current_fpe = -1;
|
c->current.current_fpe = -1;
|
||||||
|
@ -766,7 +766,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
||||||
reply.nFonts--;
|
reply.nFonts--;
|
||||||
else {
|
else {
|
||||||
*bufptr++ = names->length[i];
|
*bufptr++ = names->length[i];
|
||||||
memmove(bufptr, names->names[i], names->length[i]);
|
memcpy(bufptr, names->names[i], names->length[i]);
|
||||||
bufptr += names->length[i];
|
bufptr += names->length[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -931,7 +931,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
|
||||||
free(c->savedName);
|
free(c->savedName);
|
||||||
c->savedName = malloc(namelen + 1);
|
c->savedName = malloc(namelen + 1);
|
||||||
if (c->savedName)
|
if (c->savedName)
|
||||||
memmove(c->savedName, name, namelen + 1);
|
memcpy(c->savedName, name, namelen + 1);
|
||||||
aliascount = 20;
|
aliascount = 20;
|
||||||
}
|
}
|
||||||
memmove(c->current.pattern, name, namelen);
|
memmove(c->current.pattern, name, namelen);
|
||||||
|
@ -1242,7 +1242,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
||||||
err = BadAlloc;
|
err = BadAlloc;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
memmove(new_closure->data, new_closure->pElt, len);
|
memcpy(new_closure->data, new_closure->pElt, len);
|
||||||
new_closure->pElt = new_closure->data;
|
new_closure->pElt = new_closure->data;
|
||||||
new_closure->endReq = new_closure->pElt + len;
|
new_closure->endReq = new_closure->pElt + len;
|
||||||
|
|
||||||
|
@ -1430,7 +1430,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
||||||
err = BadAlloc;
|
err = BadAlloc;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
memmove(data, c->data, c->nChars * itemSize);
|
memcpy(data, c->data, c->nChars * itemSize);
|
||||||
c->data = data;
|
c->data = data;
|
||||||
|
|
||||||
pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
|
pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
|
||||||
|
@ -1784,7 +1784,7 @@ GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result)
|
||||||
fpe = font_path_elements[i];
|
fpe = font_path_elements[i];
|
||||||
*c = fpe->name_length;
|
*c = fpe->name_length;
|
||||||
*length += *c++;
|
*length += *c++;
|
||||||
memmove(c, fpe->name, fpe->name_length);
|
memcpy(c, fpe->name, fpe->name_length);
|
||||||
c += fpe->name_length;
|
c += fpe->name_length;
|
||||||
}
|
}
|
||||||
*count = num_fpes;
|
*count = num_fpes;
|
||||||
|
|
|
@ -293,7 +293,7 @@ ProcListExtensions(ClientPtr client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
*bufptr++ = len = strlen(extensions[i]->name);
|
*bufptr++ = len = strlen(extensions[i]->name);
|
||||||
memmove(bufptr, extensions[i]->name, len);
|
memcpy(bufptr, extensions[i]->name, len);
|
||||||
bufptr += len;
|
bufptr += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue