xserver: Branch 'master' - 2 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 9 17:43:52 UTC 2021
xkb/ddxLoad.c | 27 ++++++++++++++++-----------
xkb/xkb.c | 4 ++--
2 files changed, 18 insertions(+), 13 deletions(-)
New commits:
commit 66ce61983db0a067e48143750c4d5557d5638b1c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu Mar 18 09:59:17 2021 +1000
xkb: silence a compiler warning
xkb.c: In function ‘ProcXkbSetMap’:
xkb.c:2747:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
2747 | DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/xkb/xkb.c b/xkb/xkb.c
index d056c698c..183d6ffa1 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -2716,7 +2716,7 @@ _XkbSetMap(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req, char *values)
int
ProcXkbSetMap(ClientPtr client)
{
- DeviceIntPtr dev;
+ DeviceIntPtr dev, master;
char *tmp;
int rc;
@@ -2744,7 +2744,7 @@ ProcXkbSetMap(ClientPtr client)
if (rc != Success)
return rc;
- DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
+ master = GetMaster(dev, MASTER_KEYBOARD);
if (stuff->deviceSpec == XkbUseCoreKbd) {
DeviceIntPtr other;
commit f6b8f8c071a575e54645aeb0bd3cb37377b0e4d3
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu Mar 18 09:44:53 2021 +1000
xkb: don't require a trailing slash for the XKM output dir
Rework the function to use a single snprintf call instead of a mix of
strcpy/strcats. This now also appends a trailing slash where needed so we
don't rely on the build system to set this for us.
Also, since /tmp/ is the fallback and we never check if everything succeeded,
assert if we can't use /tmp/. This will never be triggered anyway, the only
caller to OutputDirectory() uses sizeof(PATH_MAX-sized array).
Follow-up from 6c51818a0f55282cbe5a870f58ca82ca45ee472d
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index ea7e34700..f9b7b06d9 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -62,22 +62,27 @@ LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn);
static void
OutputDirectory(char *outdir, size_t size)
{
+ const char *directory = NULL;
+ const char *pathsep = "";
+ int r = -1;
+
#ifndef WIN32
/* Can we write an xkm and then open it too? */
- if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0 &&
- (strlen(XKM_OUTPUT_DIR) < size)) {
- (void) strcpy(outdir, XKM_OUTPUT_DIR);
+ if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0) {
+ directory = XKM_OUTPUT_DIR;
+ if (XKM_OUTPUT_DIR[strlen(XKM_OUTPUT_DIR) - 1] != '/')
+ pathsep = "/";
}
- else
#else
- if (strlen(Win32TempDir()) + 1 < size) {
- (void) strcpy(outdir, Win32TempDir());
- (void) strcat(outdir, "\\");
- }
- else
+ directory = Win32TempDir();
+ pathsep = "\\";
#endif
- if (strlen("/tmp/") < size) {
- (void) strcpy(outdir, "/tmp/");
+
+ if (directory)
+ r = snprintf(outdir, size, "%s%s", directory, pathsep);
+ if (r < 0 || r >= size) {
+ assert(strlen("/tmp/") < size);
+ strcpy(outdir, "/tmp/");
}
}
More information about the xorg-commit
mailing list