diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-04-16 09:59:02 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-04-16 09:59:02 -0700 |
commit | cdb536d65f1898ecbd2d9ae13058703063e715f9 (patch) | |
tree | 516be0ee1ef1d859f163e91cb30031919922a1ab | |
parent | 431588f8103a886de68a7ae3fcb8cc36974ed3c5 (diff) |
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 "ANSIfied for R6".
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | difs/dispatch.c | 14 | ||||
-rw-r--r-- | difs/fonts.c | 10 | ||||
-rw-r--r-- | difs/main.c | 4 | ||||
-rw-r--r-- | difs/swaprep.c | 2 | ||||
-rw-r--r-- | os/config.c | 2 | ||||
-rw-r--r-- | os/osglue.c | 6 |
6 files changed, 19 insertions, 19 deletions
diff --git a/difs/dispatch.c b/difs/dispatch.c index 60aa841..56dd2ff 100644 --- a/difs/dispatch.c +++ b/difs/dispatch.c @@ -309,9 +309,9 @@ ProcEstablishConnection(ClientPtr client) DEALLOCATE_LOCAL(client_auth); return FSBadAlloc; } - memmove( authp->authname, client_auth[auth_index - 1].name, + memcpy(authp->authname, client_auth[auth_index - 1].name, client_auth[auth_index - 1].namelen); - memmove( authp->authdata, client_auth[auth_index - 1].data, + memcpy(authp->authdata, client_auth[auth_index - 1].data, client_auth[auth_index - 1].datalen); /* Save it with a zero resource id... subsequent SetAuthorizations of None will find it. And it will be freed @@ -362,7 +362,7 @@ ProcEstablishConnection(ClientPtr client) /* WriteToClient pads, so we have to fake some things */ tmp[0] = altservers[i].subset; tmp[1] = altservers[i].namelen; - memmove( (char *) &tmp[2], altservers[i].name, altservers[i].namelen); + memcpy(&tmp[2], altservers[i].name, altservers[i].namelen); (void) WriteToClient(client, altservers[i].namelen + 2, tmp); } @@ -520,7 +520,7 @@ ProcSetCatalogues(ClientPtr client) new_cat = (char *) fsalloc(len); if (!new_cat) return FSBadAlloc; - memmove( new_cat, (char *)stuff + SIZEOF(fsSetCataloguesReq), len); + memcpy(new_cat, (char *)stuff + SIZEOF(fsSetCataloguesReq), len); } else { SendErrToClient(client, err, (pointer) &num); return err; @@ -657,8 +657,8 @@ ProcCreateAC(ClientPtr client) fsfree((char *) authp); goto alloc_failure; } - memmove( authp->authname, acp[index - 1].name, acp[index - 1].namelen); - memmove( authp->authdata, acp[index - 1].data, acp[index - 1].datalen); + memcpy(authp->authname, acp[index - 1].name, acp[index - 1].namelen); + memcpy(authp->authdata, acp[index - 1].data, acp[index - 1].datalen); } else size = 0; @@ -763,7 +763,7 @@ ProcSetResolution(ClientPtr client) return FSBadAlloc; } fsfree((char *) client->resolutions); - memmove( (char *) new_res, (char *)stuff + SIZEOF(fsSetResolutionReq), + memcpy(new_res, (char *)stuff + SIZEOF(fsSetResolutionReq), (stuff->num_resolutions * SIZEOF(fsResolution))); client->resolutions = new_res; client->num_resolutions = stuff->num_resolutions; diff --git a/difs/fonts.c b/difs/fonts.c index 30f0a65..fe6b719 100644 --- a/difs/fonts.c +++ b/difs/fonts.c @@ -523,7 +523,7 @@ OpenFont( fsfree(c); goto lowmem; } - memmove( c->fontname, name, namelen); + memcpy(c->fontname, name, namelen); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); @@ -764,7 +764,7 @@ SetFontCatalogue( end = str + strlen(str); } *p++ = len = end - str; - memmove( p, str, len); + memcpy(p, str, len); npaths++; str += len; /* skip entry */ if (*str == ',') @@ -902,7 +902,7 @@ do_list_fonts_and_aliases(ClientPtr client, pointer data) * is BadFontName, indicating the alias resolution * is complete. */ - memmove(tmp_pattern, resolved, resolvedlen); + memcpy(tmp_pattern, resolved, resolvedlen); if (cPtr->haveSaved) { char *tmpname; @@ -926,7 +926,7 @@ do_list_fonts_and_aliases(ClientPtr client, pointer data) fsfree(cPtr->savedName); cPtr->savedName = (char *)fsalloc(namelen + 1); if (cPtr->savedName) - memmove(cPtr->savedName, name, namelen + 1); + memcpy(cPtr->savedName, name, namelen + 1); cPtr->savedNameLen = namelen; aliascount = 20; } @@ -1202,7 +1202,7 @@ do_list_fonts_with_info(ClientPtr client, pointer data) fsfree(cPtr->savedName); cPtr->savedName = (char *)fsalloc(namelen + 1); if (cPtr->savedName) - memmove(cPtr->savedName, name, namelen + 1); + memcpy(cPtr->savedName, name, namelen + 1); aliascount = 20; } memmove(cPtr->current.pattern, name, namelen); diff --git a/difs/main.c b/difs/main.c index 4177fcb..ee47b43 100644 --- a/difs/main.c +++ b/difs/main.c @@ -184,9 +184,9 @@ create_connection_block(void) if (!ConnectionInfo) return FALSE; - memmove( ConnectionInfo, (char *) &setup, SIZEOF(fsConnSetupAccept)); + memcpy(ConnectionInfo, &setup, SIZEOF(fsConnSetupAccept)); pBuf = ConnectionInfo + SIZEOF(fsConnSetupAccept); - memmove( pBuf, VENDOR_STRING, (int) setup.vendor_len); + memcpy(pBuf, VENDOR_STRING, (int) setup.vendor_len); return TRUE; } diff --git a/difs/swaprep.c b/difs/swaprep.c index ade80b5..3423881 100644 --- a/difs/swaprep.c +++ b/difs/swaprep.c @@ -441,7 +441,7 @@ WriteSConnectionInfo( pInfo += SIZEOF(fsConnSetup); i = (pConnSetup->vendor_len + 3) & ~3; - memmove( pInfoT, pInfo, i); + memcpy(pInfoT, pInfo, i); (void) WriteToClient(client, (int) size, (char *) pInfoTBase); DEALLOCATE_LOCAL(pInfoTBase); diff --git a/os/config.c b/os/config.c index a81a88c..cd1e228 100644 --- a/os/config.c +++ b/os/config.c @@ -213,7 +213,7 @@ parse_config(char *data) *c = tolower(*c); c++; } - memmove( param_name, p, min(sizeof(param_name), (int) (c - p))); + memcpy(param_name, p, min(sizeof(param_name), (int) (c - p))); param_name[(int) (c - p)] = '\0'; /* check for junk */ diff --git a/os/osglue.c b/os/osglue.c index cc4742c..ab91ded 100644 --- a/os/osglue.c +++ b/os/osglue.c @@ -164,7 +164,7 @@ ListCatalogues(const char *pattern, int patlen, int maxnames, if (!catlist) goto bail; *catlist = size; - memmove( &catlist[1], catalogue_name, size); + memcpy(&catlist[1], catalogue_name, size); size++; /* for length */ count++; } @@ -227,7 +227,7 @@ SetAlternateServers(char *list) if (!a->name) { goto unwind; } - memmove( a->name, st, a->namelen); + memcpy(a->name, st, a->namelen); a->subset = FALSE; /* XXX */ a++; t++; @@ -242,7 +242,7 @@ SetAlternateServers(char *list) if (!a->name) { goto unwind; } - memmove( a->name, st, a->namelen); + memcpy(a->name, st, a->namelen); a->subset = FALSE; /* XXX */ for (i = 0; i < num_alts; i++) { |