xserver: Branch 'master' - 3 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 2 19:09:59 UTC 2024
Xext/xf86bigfont.c | 114 ++++++++++++++++++++++++++---------------------------
1 file changed, 57 insertions(+), 57 deletions(-)
New commits:
commit b5a3ac952712324a328d44bc718fe5961f537994
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Fri Jul 12 19:55:56 2024 +0200
Xext: xf86bigfont: split reply header and payload
Split reply header and payload buffers. Making it more coherent with all the
other request handlers, and allows a lot of further simplification by using
generic macros (coming in subsequent commits).
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1600>
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 0013a3b7d..ef0113793 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -532,60 +532,59 @@ ProcXF86BigfontQueryFont(ClientPtr client)
{
int nfontprops = pFont->info.nprops;
- int rlength = sizeof(xXF86BigfontQueryFontReply)
- + nfontprops * sizeof(xFontProp)
+ int rlength = nfontprops * sizeof(xFontProp)
+ (nCharInfos > 0 && shmid == -1
? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
: 0);
- xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
- char *p;
- if (!reply) {
- if (nCharInfos > 0) {
- if (shmid == -1)
- free(pIndex2UniqIndex);
- if (!pDesc)
- free(pCI);
- }
- return BadAlloc;
- }
- reply->type = X_Reply;
- reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
- reply->sequenceNumber = client->sequence;
- reply->minBounds = pFont->info.ink_minbounds;
- reply->maxBounds = pFont->info.ink_maxbounds;
- reply->minCharOrByte2 = pFont->info.firstCol;
- reply->maxCharOrByte2 = pFont->info.lastCol;
- reply->defaultChar = pFont->info.defaultCh;
- reply->nFontProps = pFont->info.nprops;
- reply->drawDirection = pFont->info.drawDirection;
- reply->minByte1 = pFont->info.firstRow;
- reply->maxByte1 = pFont->info.lastRow;
- reply->allCharsExist = pFont->info.allExist;
- reply->fontAscent = pFont->info.fontAscent;
- reply->fontDescent = pFont->info.fontDescent;
- reply->nCharInfos = nCharInfos;
- reply->nUniqCharInfos = nUniqCharInfos;
- reply->shmid = shmid;
- reply->shmsegoffset = 0;
+ xXF86BigfontQueryFontReply rep = {
+ .type = X_Reply;
+ .length = bytes_to_int32(buflength),
+ .sequenceNumber = client->sequence,
+ .minBounds = pFont->info.ink_minbounds,
+ .maxBounds = pFont->info.ink_maxbounds,
+ .minCharOrByte2 = pFont->info.firstCol,
+ .maxCharOrByte2 = pFont->info.lastCol,
+ .defaultChar = pFont->info.defaultCh,
+ .nFontProps = pFont->info.nprops,
+ .drawDirection = pFont->info.drawDirection,
+ .minByte1 = pFont->info.firstRow,
+ .maxByte1 = pFont->info.lastRow,
+ .allCharsExist = pFont->info.allExist,
+ .fontAscent = pFont->info.fontAscent,
+ .fontDescent = pFont->info.fontDescent,
+ .nCharInfos = nCharInfos,
+ .nUniqCharInfos = nUniqCharInfos,
+ .shmid = shmid,
+ };
+
if (client->swapped) {
- swaps(&reply->sequenceNumber);
- swapl(&reply->length);
- swapCharInfo(&reply->minBounds);
- swapCharInfo(&reply->maxBounds);
- swaps(&reply->minCharOrByte2);
- swaps(&reply->maxCharOrByte2);
- swaps(&reply->defaultChar);
- swaps(&reply->nFontProps);
- swaps(&reply->fontAscent);
- swaps(&reply->fontDescent);
- swapl(&reply->nCharInfos);
- swapl(&reply->nUniqCharInfos);
- swapl(&reply->shmid);
- swapl(&reply->shmsegoffset);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapCharInfo(&rep.minBounds);
+ swapCharInfo(&rep.maxBounds);
+ swaps(&rep.minCharOrByte2);
+ swaps(&rep.maxCharOrByte2);
+ swaps(&rep.defaultChar);
+ swaps(&rep.nFontProps);
+ swaps(&rep.fontAscent);
+ swaps(&rep.fontDescent);
+ swapl(&rep.nCharInfos);
+ swapl(&rep.nUniqCharInfos);
+ swapl(&rep.shmid);
+ swapl(&rep.shmsegoffset);
}
- p = (char *) &reply[1];
+
+ int rc = Success;
+ char *buf = calloc(1, rlength);
+ if (!buf) {
+ rc = BadAlloc;
+ goto out;
+ }
+
+ char *p = buf;
+
{
FontPropPtr pFP;
xFontProp *prFP;
@@ -621,15 +620,18 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
}
}
- WriteToClient(client, rlength, reply);
- free(reply);
+
+ WriteToClient(client, sizeof(xXF86BigfontQueryFontReply), &rep);
+ WriteToClient(client, rlength, buf);
+ free(buf);
+out:
if (nCharInfos > 0) {
if (shmid == -1)
free(pIndex2UniqIndex);
if (!pDesc)
free(pCI);
}
- return Success;
+ return rc;
}
}
commit 866f3261c4767b2dac9cb5a7f442273f989172f0
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Mon Jul 8 15:37:01 2024 +0200
Xext: xf86bigfont: code styling cleanups
* tidy up the includes into logic order.
* beautify function prototype
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1600>
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 7d2bc88d7..0013a3b7d 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -58,6 +58,8 @@
#include <X11/X.h>
#include <X11/Xproto.h>
+#include <X11/extensions/xf86bigfproto.h>
+
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
@@ -67,11 +69,9 @@
#include "extinit.h"
#include "protocol-versions.h"
-#include <X11/extensions/xf86bigfproto.h>
#include "xf86bigfontsrv.h"
-static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
- );
+static void XF86BigfontResetProc(ExtensionEntry *extEntry );
#ifdef MITSHM
commit 7735c4462cb98a400616e207a739a59047b687b2
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Tue Jul 9 16:15:19 2024 +0200
Xext: xf86bigfont: drop some dead code
There's some piece ifdef'ed code that doesn't serve any practical purpose.
Instead add a little comment telling why that funny way of dispatching
(based on request size) is necessary.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1600>
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 44a8e7dd8..7d2bc88d7 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -339,9 +339,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
CARD16 *pUniqIndex2Index;
CARD32 nUniqCharInfos;
-#if 0
- REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
-#else
+ /* protocol version is decided based on request packet size */
switch (client->req_len) {
case 2: /* client with version 1.0 libX11 */
stuff_flags = (client->local &&
@@ -353,7 +351,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
default:
return BadLength;
}
-#endif
+
if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) !=
Success)
return BadFont; /* procotol spec says only error is BadFont */
More information about the xorg-commit
mailing list