fix build error

This commit is contained in:
yangcheng1203 2022-01-08 14:14:55 +08:00
parent ba761473a5
commit 79a7eec1c3
2 changed files with 105 additions and 1 deletions

View File

@ -0,0 +1,100 @@
From 4b083ede3c4a827a84295ff223e34ee3c2e581b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
<zboszor@gmail.com>
Date: Sat, 28 Aug 2021 15:38:40 +0200
Subject: [PATCH] Fix a build error with Xorg master
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use xf86ReturnOptValBool() in get_bool_option() instead of
options[option_index].value.bool to fix a compiler error with
current Xorg xserver master branch.
Also use xf86GetOptValInteger() in get_int_option() and
xf86GetOptValString() in get_str_option() for consistency.
The change causes a slight performance drop during option parsing
because the passed-in index_value is no longer used as an index
into the options array.
Instead, it's used as a token now for the standard option getter
functions which works since the index_value to the get_*_option()
functions are identical to the value of options[n].token in the
passed-in OptionInfoRec array.
Also rename "int option_index" to "int token" for clarity in all
three functions.
Signed-off-by: Zolt谩n B枚sz枚rm茅nyi <zboszor@gmail.com>
---
src/qxl_option_helpers.c | 13 +++++++------
src/qxl_option_helpers.h | 6 +++---
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/qxl_option_helpers.c b/src/qxl_option_helpers.c
index 2aba677..7707b7c 100644
--- a/src/qxl_option_helpers.c
+++ b/src/qxl_option_helpers.c
@@ -10,31 +10,32 @@
#include "qxl_option_helpers.h"
-int get_int_option(OptionInfoPtr options, int option_index,
+int get_int_option(OptionInfoPtr options, int token,
const char *env_name)
{
+ int value;
if (env_name && getenv(env_name)) {
return atoi(getenv(env_name));
}
- return options[option_index].value.num;
+ return xf86GetOptValInteger(options, token, &value) ? value : 0;
}
-const char *get_str_option(OptionInfoPtr options, int option_index,
+const char *get_str_option(OptionInfoPtr options, int token,
const char *env_name)
{
if (getenv(env_name)) {
return getenv(env_name);
}
- return options[option_index].value.str;
+ return xf86GetOptValString(options, token);
}
-int get_bool_option(OptionInfoPtr options, int option_index,
+int get_bool_option(OptionInfoPtr options, int token,
const char *env_name)
{
const char* value = getenv(env_name);
if (!value) {
- return options[option_index].value.bool;
+ return xf86ReturnOptValBool(options, token, FALSE);
}
if (strcmp(value, "0") == 0 ||
strcasecmp(value, "off") == 0 ||
diff --git a/src/qxl_option_helpers.h b/src/qxl_option_helpers.h
index 7c54c72..66d0a17 100644
--- a/src/qxl_option_helpers.h
+++ b/src/qxl_option_helpers.h
@@ -4,13 +4,13 @@
#include <xf86Crtc.h>
#include <xf86Opt.h>
-int get_int_option(OptionInfoPtr options, int option_index,
+int get_int_option(OptionInfoPtr options, int token,
const char *env_name);
-const char *get_str_option(OptionInfoPtr options, int option_index,
+const char *get_str_option(OptionInfoPtr options, int token,
const char *env_name);
-int get_bool_option(OptionInfoPtr options, int option_index,
+int get_bool_option(OptionInfoPtr options, int token,
const char *env_name);
#endif // OPTION_HELPERS_H
--
GitLab

View File

@ -2,7 +2,7 @@
Name: xorg-x11-drv-qxl
Version: 0.1.5
Release: 13
Release: 14
Summary: Qxl video driver for the X Window System
License: MIT
URL: http://www.x.org
@ -12,6 +12,7 @@ Patch0002: 0002-Xspice-Use-print-instead-of-print.patch
Patch0003: 0004-Xspice-Fix-Python3-str-vs-bytes-confusion.patch
Patch0004: 0005-Xspice-Adjust-shebang-to-explicitly-mention-python3.patch
Patch0005: 0006-qxl-call-provider-init.patch
Patch6000: backport-fix-build-error-with-xserver.patch
BuildRequires: pkgconfig git-core xorg-x11-server-devel >= 1.1.0-1 spice-protocol >= 0.12.1
BuildRequires: libdrm-devel >= 2.4.46-1 spice-server-devel >= 0.8.0 glib2-devel
BuildRequires: libtool libudev-devel libXfont2-devel libXext-devel
@ -53,6 +54,9 @@ install -Dp -m644 examples/spiceqxl.xorg.conf.example $RPM_BUILD_ROOT%{_sysconfd
%(pkg-config xorg-server --variable=moduledir)/drivers/spiceqxl_drv.so
%changelog
* Sat Jan 8 2022 yangcheng <yangcheng87@huawei.com> - 0.1.5-14
- fix build error with xserver
* Thu Aug 6 2020 xiaoweiwei <xiaoweiwei5@huawei.com> - 0.1.5-13
- Add compilation dependency to solve compilation failture