xserver: Branch 'master' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 29 21:21:39 UTC 2022


 dix/dispatch.c  |   12 ++++++------
 dix/dixfonts.c  |   22 +++++++++++-----------
 dix/extension.c |    2 +-
 mi/miarc.c      |    6 +++---
 os/mitauth.c    |    2 +-
 os/rpcauth.c    |    2 +-
 os/utils.c      |    4 ++--
 os/xdmauth.c    |    4 ++--
 os/xdmcp.c      |    2 +-
 9 files changed, 28 insertions(+), 28 deletions(-)

New commits:
commit d23e4465585ec39d39488a5d341ed690c3d93be8
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Aug 13 12:10:34 2022 -0700

    mi: Use memcpy() instead of memmove() when buffers are known not to overlap
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/mi/miarc.c b/mi/miarc.c
index 3936f6c27..3a0ecc446 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -3151,10 +3151,10 @@ realFindSpan(int y)
         else
             newMaxy = finalMaxy + change;
         if (finalSpans) {
-            memmove(((char *) newSpans) +
+            memcpy(((char *) newSpans) +
                     (finalMiny - newMiny) * sizeof(struct finalSpan *),
-                    (char *) finalSpans,
-                    finalSize * sizeof(struct finalSpan *));
+                   finalSpans,
+                   finalSize * sizeof(struct finalSpan *));
             free(finalSpans);
         }
         if ((i = finalMiny - newMiny) > 0)
commit 5cc24dbb4c151023dc0d18e16001e27f87ae8391
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Aug 13 12:01:04 2022 -0700

    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 at oracle.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 460296197..210df75c6 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -638,11 +638,11 @@ CreateConnectionBlock(void)
     if (!ConnectionInfo)
         return FALSE;
 
-    memmove(ConnectionInfo, (char *) &setup, sizeof(xConnSetup));
+    memcpy(ConnectionInfo, &setup, sizeof(xConnSetup));
     sizesofar = sizeof(xConnSetup);
     pBuf = ConnectionInfo + sizeof(xConnSetup);
 
-    memmove(pBuf, VendorString, (int) setup.nbytesVendor);
+    memcpy(pBuf, VendorString, (size_t) setup.nbytesVendor);
     sizesofar += setup.nbytesVendor;
     pBuf += setup.nbytesVendor;
     i = padding_for_int32(setup.nbytesVendor);
@@ -655,7 +655,7 @@ CreateConnectionBlock(void)
         format.depth = screenInfo.formats[i].depth;
         format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
         format.scanLinePad = screenInfo.formats[i].scanlinePad;
-        memmove(pBuf, (char *) &format, sizeof(xPixmapFormat));
+        memcpy(pBuf, &format, sizeof(xPixmapFormat));
         pBuf += sizeof(xPixmapFormat);
         sizesofar += sizeof(xPixmapFormat);
     }
@@ -685,7 +685,7 @@ CreateConnectionBlock(void)
         root.saveUnders = FALSE;
         root.rootDepth = pScreen->rootDepth;
         root.nDepths = pScreen->numDepths;
-        memmove(pBuf, (char *) &root, sizeof(xWindowRoot));
+        memcpy(pBuf, &root, sizeof(xWindowRoot));
         sizesofar += sizeof(xWindowRoot);
         pBuf += sizeof(xWindowRoot);
 
@@ -702,7 +702,7 @@ CreateConnectionBlock(void)
             pBuf += sizesofar;
             depth.depth = pDepth->depth;
             depth.nVisuals = pDepth->numVids;
-            memmove(pBuf, (char *) &depth, sizeof(xDepth));
+            memcpy(pBuf, &depth, sizeof(xDepth));
             pBuf += sizeof(xDepth);
             sizesofar += sizeof(xDepth);
             for (k = 0; k < pDepth->numVids; k++) {
@@ -716,7 +716,7 @@ CreateConnectionBlock(void)
                 visual.redMask = pVisual->redMask;
                 visual.greenMask = pVisual->greenMask;
                 visual.blueMask = pVisual->blueMask;
-                memmove(pBuf, (char *) &visual, sizeof(xVisualType));
+                memcpy(pBuf, &visual, sizeof(xVisualType));
                 pBuf += sizeof(xVisualType);
                 sizesofar += sizeof(xVisualType);
             }
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 58a385f71..9608e4b1f 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -293,7 +293,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
                 err = AllocError;
                 break;
             }
-            memmove(newname, alias, newlen);
+            memcpy(newname, alias, newlen);
             c->fontname = newname;
             c->fnamelen = newlen;
             c->current_fpe = 0;
@@ -427,7 +427,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
         free(c);
         return BadAlloc;
     }
-    memmove(c->fontname, pfontname, lenfname);
+    memcpy(c->fontname, pfontname, lenfname);
     for (i = 0; i < num_fpes; i++) {
         c->fpe_list[i] = font_path_elements[i];
         UseFPE(c->fpe_list[i]);
@@ -641,7 +641,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                     free(resolved);
                     resolved = malloc(resolvedlen + 1);
                     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 complete.
                  */
-                memmove(tmp_pattern, resolved, resolvedlen);
+                memcpy(tmp_pattern, resolved, resolvedlen);
                 if (c->haveSaved) {
                     char *tmpname;
                     int tmpnamelen;
@@ -691,11 +691,11 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
                     free(c->savedName);
                     c->savedName = malloc(namelen + 1);
                     if (c->savedName)
-                        memmove(c->savedName, name, namelen + 1);
+                        memcpy(c->savedName, name, namelen + 1);
                     c->savedNameLen = namelen;
                     aliascount = 20;
                 }
-                memmove(c->current.pattern, tmp_pattern, resolvedlen);
+                memcpy(c->current.pattern, tmp_pattern, resolvedlen);
                 c->current.patlen = resolvedlen;
                 c->current.max_names = c->names->nnames + 1;
                 c->current.current_fpe = -1;
@@ -766,7 +766,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
             reply.nFonts--;
         else {
             *bufptr++ = names->length[i];
-            memmove(bufptr, names->names[i], names->length[i]);
+            memcpy(bufptr, names->names[i], names->length[i]);
             bufptr += names->length[i];
         }
     }
@@ -931,7 +931,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
                 free(c->savedName);
                 c->savedName = malloc(namelen + 1);
                 if (c->savedName)
-                    memmove(c->savedName, name, namelen + 1);
+                    memcpy(c->savedName, name, namelen + 1);
                 aliascount = 20;
             }
             memmove(c->current.pattern, name, namelen);
@@ -1242,7 +1242,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
                         err = BadAlloc;
                         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->endReq = new_closure->pElt + len;
 
@@ -1430,7 +1430,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
                 err = BadAlloc;
                 goto bail;
             }
-            memmove(data, c->data, c->nChars * itemSize);
+            memcpy(data, c->data, c->nChars * itemSize);
             c->data = data;
 
             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];
         *c = fpe->name_length;
         *length += *c++;
-        memmove(c, fpe->name, fpe->name_length);
+        memcpy(c, fpe->name, fpe->name_length);
         c += fpe->name_length;
     }
     *count = num_fpes;
diff --git a/dix/extension.c b/dix/extension.c
index 9c158ba93..dce6a91da 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -293,7 +293,7 @@ ProcListExtensions(ClientPtr client)
                 continue;
 
             *bufptr++ = len = strlen(extensions[i]->name);
-            memmove(bufptr, extensions[i]->name, len);
+            memcpy(bufptr, extensions[i]->name, len);
             bufptr += len;
         }
     }
commit f8cbe96d140c9f8023d93ed6cb5a808f56e2468f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Aug 13 11:38:04 2022 -0700

    os: 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 at oracle.com>

diff --git a/os/mitauth.c b/os/mitauth.c
index a268f62f9..eb5ca3998 100644
--- a/os/mitauth.c
+++ b/os/mitauth.c
@@ -62,7 +62,7 @@ MitAddCookie(unsigned short data_length, const char *data, XID id)
     }
     new->next = mit_auth;
     mit_auth = new;
-    memmove(new->data, data, (int) data_length);
+    memcpy(new->data, data, (size_t) data_length);
     new->len = data_length;
     new->id = id;
     return 1;
diff --git a/os/rpcauth.c b/os/rpcauth.c
index 33260db72..0a752f013 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -70,7 +70,7 @@ authdes_ezdecode(const char *inmsg, int len)
         why = AUTH_FAILED; /* generic error, since there is no AUTH_BADALLOC */
         return NULL;
     }
-    memmove(temp_inmsg, inmsg, len);
+    memcpy(temp_inmsg, inmsg, len);
 
     memset((char *) &msg, 0, sizeof(msg));
     memset((char *) &r, 0, sizeof(r));
diff --git a/os/utils.c b/os/utils.c
index c9a8e7367..fe94912f3 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1108,9 +1108,9 @@ set_font_authorizations(char **authorizations, int *authlen, void *client)
         *p++ = (len) >> 8;
         *p++ = (len & 0xff);
 
-        memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME));
+        memcpy(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME));
         p += sizeof(AUTHORIZATION_NAME);
-        memmove(p, hnameptr, len);
+        memcpy(p, hnameptr, len);
         p += len;
 #if defined(IPv6) && defined(AF_INET6)
         if (ai) {
diff --git a/os/xdmauth.c b/os/xdmauth.c
index c35cade5b..ba446e013 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -356,8 +356,8 @@ XdmAddCookie(unsigned short data_length, const char *data, XID id)
         return 0;
     new->next = xdmAuth;
     xdmAuth = new;
-    memmove(new->key.data, key_bits, (int) 8);
-    memmove(new->rho.data, rho_bits, (int) 8);
+    memcpy(new->key.data, key_bits, 8);
+    memcpy(new->rho.data, rho_bits, 8);
     new->id = id;
     return 1;
 }
diff --git a/os/xdmcp.c b/os/xdmcp.c
index 093e30096..2b7255644 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1409,7 +1409,7 @@ get_addr_by_name(const char *argtype,
         FatalError("Xserver: %s unknown host: %s\n", argtype, namestr);
     }
     if (hep->h_length == sizeof(struct in_addr)) {
-        memmove(&addr->sin_addr, hep->h_addr, hep->h_length);
+        memcpy(&addr->sin_addr, hep->h_addr, hep->h_length);
         *addrlen = sizeof(struct sockaddr_in);
         addr->sin_family = AF_INET;
         addr->sin_port = htons(port);


More information about the xorg-commit mailing list