Update to libXres 1.2.2

This commit is contained in:
matthieu
2023-05-07 15:10:57 +00:00
parent 7b3412d5a6
commit fd56d538ba
9 changed files with 548 additions and 324 deletions

View File

@@ -1,3 +1,109 @@
commit f77165c819b05af27d9878efe8526a157f569b1a
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Dec 4 15:17:26 2022 -0800
libXres 1.2.2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit bed46b55c06a3488971fda8271cf9fc0e3dd84d5
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 20 11:07:30 2022 -0800
Use calloc instead of malloc to allocate arrays
Makes code more consistent with other functions in this library
which already do this and adds extra protection against overflows
or failures to properly fill in values.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit c71236d5ae587f6a673a8bf1b6fd5de64a3ba78c
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 20 11:03:55 2022 -0800
Handle implicit conversion warnings from clang
Clears 6 -Wimplicit-int-conversion, 6 -Wshorten-64-to-32, and
7 -Wsign-conversion warnings.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 9e0db673a7869861eeb6eccbc8270a019f4aacd1
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 20 10:31:39 2022 -0800
Resolve -Wsign-compare warnings from gcc
XRes.c: In function XResQueryClients:
XRes.c:121:31: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
for (int i = 0; i < rep.num_clients; i++) {
^
XRes.c: In function XResQueryClientResources:
XRes.c:176:31: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
for (int i = 0; i < rep.num_types; i++) {
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a43105c0da6613798437afaa531c2a576f8efc99
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 20 10:30:10 2022 -0800
Variable scope reductions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b1fb8150d6adac3b564575dec470a740457f66dc
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 20 10:20:59 2022 -0800
Add .git-blame-ignore-revs to hide whitespace commits from git blame
To use this in your local repo clone, you will need to either run
`git blame --ignore-revs-file .git-blame-ignore-revs`
or set it permanently with
`git config blame.ignoreRevsFile .git-blame-ignore-revs`
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit fa5642244aa4b0882b8604d1e693d31882a7adda
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 20 09:25:13 2022 -0800
Reformat code to X.Org standard style
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7bb6561cb44ce8f38615d2436dae89e7ca9a773b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jul 17 17:44:40 2022 -0700
gitlab CI: add a basic build test
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 090026087de8961a7c49145f347e65afa1bbcb9b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jul 17 17:43:50 2022 -0700
Fix spelling/wording issues
Found by using:
codespell --builtin clear,rare,usage,informal,code,names
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit d5031be051ea7c969e7fdf5885235ae56825b697
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jul 17 17:43:25 2022 -0700
Build xz tarballs instead of bzip2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit c05c6d918b0e2011d4bfa370c321482e34630b17
Author: Keith Packard <keithp@keithp.com>
Date: Tue Mar 30 21:36:16 2021 -0700
@@ -214,7 +320,7 @@ Date: Mon Apr 23 18:57:48 2012 -0700
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 01fc6f81f0a2935741dd1114aa3fa267d8be9095
Author: Erkki Seppälä <erkki.seppala@vincit.fi>
Author: Erkki Seppälä < <erkki.seppala@vincit.fi>
Date: Wed Dec 15 13:48:09 2010 +0200
Implemented second part of XResource extension v1.2: XResQueryResourceBytes
@@ -225,7 +331,7 @@ Date: Wed Dec 15 13:48:09 2010 +0200
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 0f38938a27df1f865dcdda35f4d2ef191092ba42
Author: Erkki Seppälä <erkki.seppala@vincit.fi>
Author: Erkki Seppälä < <erkki.seppala@vincit.fi>
Date: Mon Nov 29 12:43:51 2010 +0200
Implemented first part of XResource extension v1.2: XResQueryClientIds
@@ -731,7 +837,7 @@ Date: Sat Jul 9 06:03:13 2005 +0000
Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
commit c1ed34d39740625d52eca7f2c5bf5c6797f28097
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Date: Wed Jun 22 22:46:38 2005 +0000
Apply these patches from Theo van Klaveren:
@@ -740,13 +846,13 @@ Date: Wed Jun 22 22:46:38 2005 +0000
to make the libraries distcheck.
commit 2dbb8e41c6accaf9d86f3fdadfed5aea330da1fd
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Date: Tue Jun 14 17:31:59 2005 +0000
XRes/src/Makefile.am: Add $(top_srcdir)/include to INCLUDES
commit a30727351e6cdeb7ff2ffa0bddad8c3a1be9eda0
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
Date: Tue Jun 7 18:51:23 2005 +0000
- symlink.sh: Move XRes.h from proto/Resource to

View File

@@ -186,9 +186,9 @@ am__relativize = \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz
GZIP_ENV = --best
DIST_TARGETS = dist-bzip2 dist-gzip
DIST_TARGETS = dist-xz dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@@ -634,6 +634,7 @@ distdir: $(DISTFILES)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
@@ -641,7 +642,6 @@ dist-bzip2: distdir
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)

View File

@@ -5,7 +5,7 @@ Xorg mailing list:
https://lists.x.org/mailman/listinfo/xorg
The master development code repository can be found at:
The primary development code repository can be found at:
https://gitlab.freedesktop.org/xorg/lib/libXRes

View File

@@ -9905,7 +9905,7 @@ AC_SUBST([am__untar])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl
dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
@@ -9942,7 +9942,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.19.2])
m4_define([vers_have], [1.20.0])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@@ -9963,7 +9963,7 @@ AM_MAINTAINER_MODE
# such as man pages and config files
AC_DEFUN([XORG_PROG_RAWCPP],[
AC_REQUIRE([AC_PROG_CPP])
AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
AC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
# Check for flag to avoid builtin definitions - assumes unix is predefined,
@@ -10273,7 +10273,7 @@ AC_SUBST(MAKE_HTML)
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-xmlto option, it allows maximum flexibilty in making decisions
# the --with-xmlto option, it allows maximum flexibility in making decisions
# as whether or not to use the xmlto package. When DEFAULT is not specified,
# --with-xmlto assumes 'auto'.
#
@@ -10487,7 +10487,7 @@ AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-asciidoc option, it allows maximum flexibilty in making decisions
# the --with-asciidoc option, it allows maximum flexibility in making decisions
# as whether or not to use the asciidoc package. When DEFAULT is not specified,
# --with-asciidoc assumes 'auto'.
#
@@ -10557,7 +10557,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-doxygen option, it allows maximum flexibilty in making decisions
# the --with-doxygen option, it allows maximum flexibility in making decisions
# as whether or not to use the doxygen package. When DEFAULT is not specified,
# --with-doxygen assumes 'auto'.
#
@@ -10641,7 +10641,7 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-groff option, it allows maximum flexibilty in making decisions
# the --with-groff option, it allows maximum flexibility in making decisions
# as whether or not to use the groff package. When DEFAULT is not specified,
# --with-groff assumes 'auto'.
#
@@ -10749,7 +10749,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-fop option, it allows maximum flexibilty in making decisions
# the --with-fop option, it allows maximum flexibility in making decisions
# as whether or not to use the fop package. When DEFAULT is not specified,
# --with-fop assumes 'auto'.
#
@@ -10843,7 +10843,7 @@ AC_SUBST([M4], [$ac_cv_path_M4])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
# the --with-ps2pdf option, it allows maximum flexibility in making decisions
# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
# --with-ps2pdf assumes 'auto'.
#
@@ -10898,7 +10898,7 @@ AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
# not at the appropriate level. This macro enables a builder to skip all
# documentation targets except traditional man pages.
# Combined with the specific tool checking macros XORG_WITH_*, it provides
# maximum flexibilty in controlling documentation building.
# maximum flexibility in controlling documentation building.
# Refer to:
# XORG_WITH_XMLTO --with-xmlto
# XORG_WITH_ASCIIDOC --with-asciidoc
@@ -10931,7 +10931,7 @@ AC_MSG_RESULT([$build_docs])
#
# This macro enables a builder to skip all developer documentation.
# Combined with the specific tool checking macros XORG_WITH_*, it provides
# maximum flexibilty in controlling documentation building.
# maximum flexibility in controlling documentation building.
# Refer to:
# XORG_WITH_XMLTO --with-xmlto
# XORG_WITH_ASCIIDOC --with-asciidoc
@@ -10964,7 +10964,7 @@ AC_MSG_RESULT([$build_devel_docs])
#
# This macro enables a builder to skip all functional specification targets.
# Combined with the specific tool checking macros XORG_WITH_*, it provides
# maximum flexibilty in controlling documentation building.
# maximum flexibility in controlling documentation building.
# Refer to:
# XORG_WITH_XMLTO --with-xmlto
# XORG_WITH_ASCIIDOC --with-asciidoc
@@ -11439,7 +11439,11 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
AC_DEFUN([XORG_COMPILER_BRAND], [
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
dnl and complains that AC_PROG_CC_C99 is obsolete
m4_version_prereq([2.70],
[AC_REQUIRE([AC_PROG_CC])],
[AC_REQUIRE([AC_PROG_CC_C99])])
],
[C++], [
AC_REQUIRE([AC_PROG_CXX])
@@ -11455,7 +11459,7 @@ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
# Minimum version: 1.16.0
#
# Test if the compiler works when passed the given flag as a command line argument.
# If it succeeds, the flag is appeneded to the given variable. If not, it tries the
# If it succeeds, the flag is appended to the given variable. If not, it tries the
# next flag in the list until there are no more options.
#
# Note that this does not guarantee that the compiler supports the flag as some
@@ -11471,7 +11475,11 @@ AC_LANG_COMPILER_REQUIRE
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
dnl and complains that AC_PROG_CC_C99 is obsolete
m4_version_prereq([2.70],
[AC_REQUIRE([AC_PROG_CC])],
[AC_REQUIRE([AC_PROG_CC_C99])])
define([PREFIX], [C])
define([CACHE_PREFIX], [cc])
define([COMPILER], [$CC])
@@ -11602,7 +11610,7 @@ XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# These are currently disabled because they are noisy. They will be enabled
@@ -11612,7 +11620,7 @@ XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
# Turn some warnings into errors, so we don't accidently get successful builds
# Turn some warnings into errors, so we don't accidentally get successful builds
# when there are problems that should be fixed.
if test "x$SELECTIVE_WERROR" = "xyes" ; then
@@ -11721,23 +11729,35 @@ AC_SUBST([BASE_]PREFIX[FLAGS])
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
]) # XORG_STRICT_OPTION
# XORG_DEFAULT_OPTIONS
# --------------------
# Minimum version: 1.3.0
# XORG_DEFAULT_NOCODE_OPTIONS
# ---------------------------
# Minimum version: 1.20.0
#
# Defines default options for X.Org modules.
# Defines default options for X.Org modules which don't compile code,
# such as fonts, bitmaps, cursors, and docs.
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL])
XORG_COMPILER_FLAGS
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_RELEASE_VERSION
XORG_CHANGELOG
XORG_INSTALL
XORG_MANPAGE_SECTIONS
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
]) # XORG_DEFAULT_NOCODE_OPTIONS
# XORG_DEFAULT_OPTIONS
# --------------------
# Minimum version: 1.3.0
#
# Defines default options for X.Org modules which compile code.
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL])
XORG_COMPILER_FLAGS
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_DEFAULT_NOCODE_OPTIONS
]) # XORG_DEFAULT_OPTIONS
# XORG_INSTALL()

View File

@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify

156
lib/libXRes/configure vendored
View File

@@ -1,8 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libXres 1.2.1.
# Generated by GNU Autoconf 2.69 for libXres 1.2.2.
#
# Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libXRes/issues>.
# Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libxres/-/issues>.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -275,7 +275,7 @@ fi
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org and
$0: https://gitlab.freedesktop.org/xorg/lib/libXRes/issues
$0: https://gitlab.freedesktop.org/xorg/lib/libxres/-/issues
$0: about your system, including any error possibly output
$0: before this message. Then install a modern shell, or
$0: manually run the script under such a shell if you do
@@ -591,9 +591,9 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libXres'
PACKAGE_TARNAME='libXres'
PACKAGE_VERSION='1.2.1'
PACKAGE_STRING='libXres 1.2.1'
PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/lib/libXRes/issues'
PACKAGE_VERSION='1.2.2'
PACKAGE_STRING='libXres 1.2.2'
PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/lib/libxres/-/issues'
PACKAGE_URL=''
ac_unique_file="Makefile.am"
@@ -1361,7 +1361,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libXres 1.2.1 to adapt to many kinds of systems.
\`configure' configures libXres 1.2.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1432,7 +1432,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libXres 1.2.1:";;
short | recursive ) echo "Configuration of libXres 1.2.2:";;
esac
cat <<\_ACEOF
@@ -1492,7 +1492,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libXRes/issues>.
Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libxres/-/issues>.
_ACEOF
ac_status=$?
fi
@@ -1555,7 +1555,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libXres configure 1.2.1
libXres configure 1.2.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1879,7 +1879,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libXres $as_me 1.2.1, which was
It was created by libXres $as_me 1.2.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2708,7 +2708,7 @@ fi
# Define the identity of the package.
PACKAGE='libXres'
VERSION='1.2.1'
VERSION='1.2.2'
cat >>confdefs.h <<_ACEOF
@@ -13571,7 +13571,124 @@ $as_echo "$supported" >&6; }
fi
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
xorg_testset_save_CFLAGS="$CFLAGS"
if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5
$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; }
if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int i;
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
xorg_cv_cc_flag_unknown_warning_option=yes
else
xorg_cv_cc_flag_unknown_warning_option=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5
$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; }
xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
CFLAGS="$xorg_testset_save_CFLAGS"
fi
if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then
if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
fi
CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5
$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; }
if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int i;
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
xorg_cv_cc_flag_unused_command_line_argument=yes
else
xorg_cv_cc_flag_unused_command_line_argument=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5
$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; }
xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
CFLAGS="$xorg_testset_save_CFLAGS"
fi
found="no"
if test $found = "no" ; then
if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
fi
if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then
CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
fi
CFLAGS="$CFLAGS -Wredundant-decls"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wredundant-decls" >&5
$as_echo_n "checking if $CC supports -Wredundant-decls... " >&6; }
cacheid=xorg_cv_cc_flag__Wredundant_decls
if eval \${$cacheid+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int i;
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval $cacheid=yes
else
eval $cacheid=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
CFLAGS="$xorg_testset_save_CFLAGS"
eval supported=\$$cacheid
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5
$as_echo "$supported" >&6; }
if test "$supported" = "yes" ; then
BASE_CFLAGS="$BASE_CFLAGS -Wredundant-decls"
found="yes"
fi
fi
@@ -13698,7 +13815,7 @@ $as_echo "$supported" >&6; }
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
# Turn some warnings into errors, so we don't accidently get successful builds
# Turn some warnings into errors, so we don't accidentally get successful builds
# when there are problems that should be fixed.
if test "x$SELECTIVE_WERROR" = "xyes" ; then
@@ -17370,6 +17487,8 @@ fi
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION_MAJOR `echo $PACKAGE_VERSION | cut -d . -f 1`
_ACEOF
@@ -17572,6 +17691,7 @@ AM_BACKSLASH='\'
# Check whether --enable-malloc0returnsnull was given.
if test "${enable_malloc0returnsnull+set}" = set; then :
enableval=$enable_malloc0returnsnull; MALLOC_ZERO_RETURNS_NULL=$enableval
@@ -17643,7 +17763,7 @@ fi
# Obtain compiler/linker options for depedencies
# Obtain compiler/linker options for dependencies
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x11 >= 1.6 xext xextproto resourceproto >= 1.2.0" >&5
@@ -18272,7 +18392,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libXres $as_me 1.2.1, which was
This file was extended by libXres $as_me 1.2.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18332,13 +18452,13 @@ $config_headers
Configuration commands:
$config_commands
Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libXRes/issues>."
Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libxres/-/issues>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libXres config.status 1.2.1
libXres config.status 1.2.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -29,13 +29,13 @@ AC_PREREQ([2.60])
# digit in the version number to track changes which don't affect the
# protocol, so XRes version l.n.m corresponds to protocol version l.n
#
AC_INIT([libXres], [1.2.1],
[https://gitlab.freedesktop.org/xorg/lib/libXRes/issues], [libXres])
AC_INIT([libXres], [1.2.2],
[https://gitlab.freedesktop.org/xorg/lib/libxres/-/issues], [libXres])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_INIT_AUTOMAKE([foreign dist-xz])
# Initialize libtool
AC_PROG_LIBTOOL
@@ -47,7 +47,7 @@ XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
XORG_CHECK_MALLOC_ZERO
# Obtain compiler/linker options for depedencies
# Obtain compiler/linker options for dependencies
PKG_CHECK_MODULES(XRES, [x11 >= 1.6] xext xextproto [resourceproto >= 1.2.0])
AC_CONFIG_FILES([Makefile

View File

@@ -10,127 +10,127 @@
/* v1.0 */
typedef struct {
XID resource_base;
XID resource_mask;
XID resource_base;
XID resource_mask;
} XResClient;
typedef struct {
Atom resource_type;
unsigned int count;
Atom resource_type;
unsigned int count;
} XResType;
/* v1.2 */
typedef enum {
XRES_CLIENT_ID_XID,
XRES_CLIENT_ID_PID,
XRES_CLIENT_ID_NR
XRES_CLIENT_ID_XID,
XRES_CLIENT_ID_PID,
XRES_CLIENT_ID_NR
} XResClientIdType;
typedef enum {
XRES_CLIENT_ID_XID_MASK = 1 << XRES_CLIENT_ID_XID,
XRES_CLIENT_ID_PID_MASK = 1 << XRES_CLIENT_ID_PID
XRES_CLIENT_ID_XID_MASK = 1 << XRES_CLIENT_ID_XID,
XRES_CLIENT_ID_PID_MASK = 1 << XRES_CLIENT_ID_PID
} XResClientIdMask;
typedef struct {
XID client;
unsigned int mask;
XID client;
unsigned int mask;
} XResClientIdSpec;
typedef struct {
XResClientIdSpec spec;
long length;
void *value;
XResClientIdSpec spec;
long length;
void *value;
} XResClientIdValue;
typedef struct {
XID resource;
Atom type;
XID resource;
Atom type;
} XResResourceIdSpec;
typedef struct {
XResResourceIdSpec spec;
long bytes;
long ref_count;
long use_count;
XResResourceIdSpec spec;
long bytes;
long ref_count;
long use_count;
} XResResourceSizeSpec;
typedef struct {
XResResourceSizeSpec size;
long num_cross_references;
XResResourceSizeSpec *cross_references;
XResResourceSizeSpec size;
long num_cross_references;
XResResourceSizeSpec *cross_references;
} XResResourceSizeValue;
_XFUNCPROTOBEGIN
/* v1.0 */
Bool XResQueryExtension (
Display *dpy,
int *event_base_return,
int *error_base_return
Bool XResQueryExtension(
Display *dpy,
int *event_base_return,
int *error_base_return
);
Status XResQueryVersion (
Display *dpy,
int *major_version_return,
int *minor_version_return
Status XResQueryVersion(
Display *dpy,
int *major_version_return,
int *minor_version_return
);
Status XResQueryClients (
Display *dpy,
int *num_clients,
XResClient **clients
Status XResQueryClients(
Display *dpy,
int *num_clients,
XResClient **clients
);
Status XResQueryClientResources (
Display *dpy,
XID xid,
int *num_types,
XResType **types
Status XResQueryClientResources(
Display *dpy,
XID xid,
int *num_types,
XResType **types
);
Status XResQueryClientPixmapBytes (
Display *dpy,
XID xid,
unsigned long *bytes
Status XResQueryClientPixmapBytes(
Display *dpy,
XID xid,
unsigned long *bytes
);
/* v1.2 */
/* Returns an array of uint32_t values, not an array of long */
Status XResQueryClientIds (
Display *dpy,
long num_specs,
XResClientIdSpec *client_specs, /* in */
long *num_ids, /* out */
XResClientIdValue **client_ids /* out */
Status XResQueryClientIds(
Display *dpy,
long num_specs,
XResClientIdSpec *client_specs, /* in */
long *num_ids, /* out */
XResClientIdValue **client_ids /* out */
);
XResClientIdType XResGetClientIdType(XResClientIdValue* value);
XResClientIdType XResGetClientIdType(XResClientIdValue *value);
/* return -1 if no pid associated to the value */
pid_t XResGetClientPid(XResClientIdValue* value);
pid_t XResGetClientPid(XResClientIdValue *value);
void XResClientIdsDestroy (
long num_ids,
XResClientIdValue *client_ids
void XResClientIdsDestroy(
long num_ids,
XResClientIdValue *client_ids
);
Status XResQueryResourceBytes (
Display *dpy,
XID client,
long num_specs,
XResResourceIdSpec *resource_specs, /* in */
long *num_sizes, /* out */
XResResourceSizeValue **sizes /* out */
Status XResQueryResourceBytes(
Display *dpy,
XID client,
long num_specs,
XResResourceIdSpec *resource_specs, /* in */
long *num_sizes, /* out */
XResResourceSizeValue **sizes /* out */
);
void XResResourceSizeValuesDestroy (
long num_sizes,
XResResourceSizeValue *sizes
void XResResourceSizeValuesDestroy(
long num_sizes,
XResResourceSizeValue *sizes
);
_XFUNCPROTOEND
#endif /* _XRES_H */
#endif /* _XRES_H */

View File

@@ -22,209 +22,197 @@ static const char *xres_extension_name = XRES_NAME;
#define XResCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, xres_extension_name, val)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xres_ext_info)
static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xres_ext_info)
static XExtensionHooks xres_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, xres_ext_info,
xres_extension_name,
&xres_extension_hooks,
0, NULL)
static
XEXT_GENERATE_FIND_DISPLAY(find_display, xres_ext_info, xres_extension_name,
&xres_extension_hooks, 0, NULL)
Bool XResQueryExtension (
Display *dpy,
int *event_base_return,
int *error_base_return
)
Bool
XResQueryExtension(Display *dpy,
int *event_base_return, int *error_base_return)
{
XExtDisplayInfo *info = find_display (dpy);
XExtDisplayInfo *info = find_display(dpy);
if (XextHasExtension(info)) {
*event_base_return = info->codes->first_event;
*error_base_return = info->codes->first_error;
return True;
} else {
}
else {
return False;
}
}
Status XResQueryVersion(
Display *dpy,
int *major_version_return,
int *minor_version_return
)
Status
XResQueryVersion(Display *dpy,
int *major_version_return, int *minor_version_return)
{
XExtDisplayInfo *info = find_display (dpy);
XExtDisplayInfo *info = find_display(dpy);
xXResQueryVersionReply rep;
xXResQueryVersionReq *req;
XResCheckExtension (dpy, info, 0);
XResCheckExtension(dpy, info, 0);
LockDisplay (dpy);
GetReq (XResQueryVersion, req);
req->reqType = info->codes->major_opcode;
LockDisplay(dpy);
GetReq(XResQueryVersion, req);
req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryVersion;
req->client_major = XRES_MAJOR_VERSION;
req->client_minor = XRES_MINOR_VERSION;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
*major_version_return = rep.server_major;
*minor_version_return = rep.server_minor;
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
Status XResQueryClients (
Display *dpy,
int *num_clients,
XResClient **clients
)
Status
XResQueryClients(Display *dpy, int *num_clients, XResClient **clients)
{
XExtDisplayInfo *info = find_display (dpy);
XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientsReq *req;
xXResQueryClientsReply rep;
XResClient *clnts;
int result = 0;
*num_clients = 0;
*clients = NULL;
XResCheckExtension (dpy, info, 0);
XResCheckExtension(dpy, info, 0);
LockDisplay (dpy);
GetReq (XResQueryClients, req);
req->reqType = info->codes->major_opcode;
LockDisplay(dpy);
GetReq(XResQueryClients, req);
req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClients;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
if(rep.num_clients) {
if (rep.num_clients) {
XResClient *clnts;
if (rep.num_clients < (INT_MAX / sizeof(XResClient)))
clnts = Xmalloc(sizeof(XResClient) * rep.num_clients);
clnts = Xcalloc(rep.num_clients, sizeof(XResClient));
else
clnts = NULL;
if (clnts != NULL) {
xXResClient scratch;
int i;
for (CARD32 i = 0; i < rep.num_clients; i++) {
xXResClient scratch;
for(i = 0; i < rep.num_clients; i++) {
_XRead(dpy, (char*)&scratch, sz_xXResClient);
_XRead(dpy, (char *) &scratch, sz_xXResClient);
clnts[i].resource_base = scratch.resource_base;
clnts[i].resource_mask = scratch.resource_mask;
}
*clients = clnts;
*num_clients = rep.num_clients;
*num_clients = (int) rep.num_clients;
result = 1;
} else {
}
else {
_XEatDataWords(dpy, rep.length);
}
}
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return result;
}
Status XResQueryClientResources (
Display *dpy,
XID xid,
int *num_types,
XResType **types
)
Status
XResQueryClientResources(Display *dpy, XID xid,
int *num_types, XResType **types)
{
XExtDisplayInfo *info = find_display (dpy);
XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientResourcesReq *req;
xXResQueryClientResourcesReply rep;
XResType *typs;
int result = 0;
*num_types = 0;
*types = NULL;
XResCheckExtension (dpy, info, 0);
XResCheckExtension(dpy, info, 0);
LockDisplay (dpy);
GetReq (XResQueryClientResources, req);
req->reqType = info->codes->major_opcode;
LockDisplay(dpy);
GetReq(XResQueryClientResources, req);
req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClientResources;
req->xid = xid;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
req->xid = (CARD32) xid;
if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
if(rep.num_types) {
if (rep.num_types) {
XResType *typs;
if (rep.num_types < (INT_MAX / sizeof(XResType)))
typs = Xmalloc(sizeof(XResType) * rep.num_types);
typs = Xcalloc(rep.num_types, sizeof(XResType));
else
typs = NULL;
if (typs != NULL) {
xXResType scratch;
int i;
for (CARD32 i = 0; i < rep.num_types; i++) {
xXResType scratch;
for(i = 0; i < rep.num_types; i++) {
_XRead(dpy, (char*)&scratch, sz_xXResType);
_XRead(dpy, (char *) &scratch, sz_xXResType);
typs[i].resource_type = scratch.resource_type;
typs[i].count = scratch.count;
}
*types = typs;
*num_types = rep.num_types;
*num_types = (int) rep.num_types;
result = 1;
} else {
}
else {
_XEatDataWords(dpy, rep.length);
}
}
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return result;
}
Status XResQueryClientPixmapBytes (
Display *dpy,
XID xid,
unsigned long *bytes
)
Status
XResQueryClientPixmapBytes(Display *dpy, XID xid, unsigned long *bytes)
{
XExtDisplayInfo *info = find_display (dpy);
XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientPixmapBytesReq *req;
xXResQueryClientPixmapBytesReply rep;
*bytes = 0;
XResCheckExtension (dpy, info, 0);
XResCheckExtension(dpy, info, 0);
LockDisplay (dpy);
GetReq (XResQueryClientPixmapBytes, req);
req->reqType = info->codes->major_opcode;
LockDisplay(dpy);
GetReq(XResQueryClientPixmapBytes, req);
req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClientPixmapBytes;
req->xid = xid;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
req->xid = (CARD32) xid;
if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
@@ -234,65 +222,64 @@ Status XResQueryClientPixmapBytes (
*bytes = rep.bytes_overflow ? 0xffffffff : rep.bytes;
#endif
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
static Bool ReadClientValues(
Display *dpy,
long num_ids,
XResClientIdValue *client_ids /* out */
)
static Bool
ReadClientValues(Display *dpy, long num_ids,
XResClientIdValue *client_ids /* out */)
{
int c;
for (c = 0; c < num_ids; ++c) {
XResClientIdValue* client = client_ids + c;
for (int c = 0; c < num_ids; ++c) {
XResClientIdValue *client = client_ids + c;
long int value;
_XRead32 (dpy, &value, 4);
client->spec.client = value;
_XRead32 (dpy, &value, 4);
client->spec.mask = value;
_XRead32 (dpy, &value, 4);
_XRead32(dpy, &value, 4);
client->spec.client = (XID) value;
_XRead32(dpy, &value, 4);
client->spec.mask = (unsigned int) value;
_XRead32(dpy, &value, 4);
client->length = value;
client->value = malloc(client->length);
_XRead (dpy, client->value, client->length);
client->value = malloc((unsigned long) client->length);
_XRead(dpy, client->value, client->length);
}
return True;
}
/* Returns an array of uint32_t values, not an array of long */
Status XResQueryClientIds (
Display *dpy,
long num_specs,
XResClientIdSpec *client_specs, /* in */
long *num_ids, /* out */
XResClientIdValue **client_ids /* out */
Status
XResQueryClientIds(
Display *dpy,
long num_specs,
XResClientIdSpec *client_specs, /* in */
long *num_ids, /* out */
XResClientIdValue **client_ids /* out */
)
{
XExtDisplayInfo *info = find_display (dpy);
XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientIdsReq *req;
xXResQueryClientIdsReply rep;
int c;
*num_ids = 0;
XResCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (XResQueryClientIds, req);
req->reqType = info->codes->major_opcode;
XResCheckExtension(dpy, info, 0);
LockDisplay(dpy);
GetReq(XResQueryClientIds, req);
req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClientIds;
req->length += num_specs * 2; /* 2 longs per client id spec */
req->numSpecs = num_specs;
req->length += num_specs * 2; /* 2 longs per client id spec */
req->numSpecs = (CARD32) num_specs;
for (c = 0; c < num_specs; ++c) {
for (int c = 0; c < num_specs; ++c) {
Data32(dpy, &client_specs[c].client, 4);
Data32(dpy, &client_specs[c].mask, 4);
}
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
goto error;
}
*client_ids = calloc(rep.numIds, sizeof(**client_ids));
*num_ids = rep.numIds;
@@ -300,39 +287,35 @@ Status XResQueryClientIds (
goto error;
}
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return Success;
error:
XResClientIdsDestroy (*num_ids, *client_ids);
XResClientIdsDestroy(*num_ids, *client_ids);
*client_ids = NULL;
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return !Success;
}
void XResClientIdsDestroy (
long num_ids,
XResClientIdValue *client_ids
)
void
XResClientIdsDestroy(long num_ids, XResClientIdValue *client_ids)
{
int c;
for (c = 0; c < num_ids; ++c) {
for (int c = 0; c < num_ids; ++c) {
free(client_ids[c].value);
}
free(client_ids);
}
XResClientIdType XResGetClientIdType(
XResClientIdValue* value
)
XResClientIdType
XResGetClientIdType(XResClientIdValue *value)
{
int bit;
XResClientIdType idType = 0;
Bool found = False;
for (bit = 0; bit < XRES_CLIENT_ID_NR; ++bit) {
for (unsigned int bit = 0; bit < XRES_CLIENT_ID_NR; ++bit) {
if (value->spec.mask & (1 << bit)) {
assert(!found);
found = True;
@@ -345,27 +328,26 @@ XResClientIdType XResGetClientIdType(
return idType;
}
pid_t XResGetClientPid(
XResClientIdValue* value
)
pid_t
XResGetClientPid(XResClientIdValue *value)
{
if (value->spec.mask & XRES_CLIENT_ID_PID_MASK && value->length >= 4) {
return (pid_t) * (CARD32*) value->value;
} else {
return (pid_t) -1;
return (pid_t) * (CARD32 *) value->value;
}
else {
return (pid_t) - 1;
}
}
static Status ReadResourceSizeSpec(
Display *dpy,
XResResourceSizeSpec *size
)
static Status
ReadResourceSizeSpec(Display *dpy, XResResourceSizeSpec *size)
{
long int value;
_XRead32(dpy, &value, 4);
size->spec.resource = value;
size->spec.resource = (XID) value;
_XRead32(dpy, &value, 4);
size->spec.type = value;
size->spec.type = (Atom) value;
_XRead32(dpy, &value, 4);
size->bytes = value;
_XRead32(dpy, &value, 4);
@@ -375,53 +357,52 @@ static Status ReadResourceSizeSpec(
return 0;
}
static Status ReadResourceSizeValues(
Display *dpy,
long num_sizes,
XResResourceSizeValue *sizes)
static Status
ReadResourceSizeValues(Display *dpy,
long num_sizes, XResResourceSizeValue *sizes)
{
int c;
int d;
for (c = 0; c < num_sizes; ++c) {
for (int c = 0; c < num_sizes; ++c) {
long int num;
ReadResourceSizeSpec(dpy, &sizes[c].size);
_XRead32(dpy, &num, 4);
sizes[c].num_cross_references = num;
sizes[c].cross_references = num ? calloc(num, sizeof(*sizes[c].cross_references)) : NULL;
for (d = 0; d < num; ++d) {
sizes[c].cross_references =
num ? calloc(num, sizeof(*sizes[c].cross_references)) : NULL;
for (int d = 0; d < num; ++d) {
ReadResourceSizeSpec(dpy, &sizes[c].cross_references[d]);
}
}
return Success;
}
Status XResQueryResourceBytes (
Display *dpy,
XID client,
long num_specs,
XResResourceIdSpec *resource_specs, /* in */
long *num_sizes, /* out */
XResResourceSizeValue **sizes /* out */
Status
XResQueryResourceBytes(
Display *dpy,
XID client,
long num_specs,
XResResourceIdSpec *resource_specs, /* in */
long *num_sizes, /* out */
XResResourceSizeValue **sizes /* out */
)
{
XExtDisplayInfo *info = find_display (dpy);
XExtDisplayInfo *info = find_display(dpy);
xXResQueryResourceBytesReq *req;
xXResQueryResourceBytesReply rep;
int c;
*num_sizes = 0;
XResCheckExtension (dpy, info, 0);
XResCheckExtension(dpy, info, 0);
LockDisplay (dpy);
GetReq (XResQueryResourceBytes, req);
req->reqType = info->codes->major_opcode;
LockDisplay(dpy);
GetReq(XResQueryResourceBytes, req);
req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryResourceBytes;
req->length += num_specs * 2; /* 2 longs per client id spec */
req->client = client;
req->numSpecs = num_specs;
req->length += num_specs * 2; /* 2 longs per client id spec */
req->client = (CARD32) client;
req->numSpecs = (CARD32) num_specs;
for (c = 0; c < num_specs; ++c) {
for (int c = 0; c < num_specs; ++c) {
Data32(dpy, &resource_specs[c].resource, 4);
Data32(dpy, &resource_specs[c].type, 4);
}
@@ -429,7 +410,7 @@ Status XResQueryResourceBytes (
*num_sizes = 0;
*sizes = NULL;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
goto error;
}
@@ -440,25 +421,22 @@ Status XResQueryResourceBytes (
goto error;
}
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return Success;
error:
XResResourceSizeValuesDestroy(*num_sizes, *sizes);
UnlockDisplay (dpy);
SyncHandle ();
UnlockDisplay(dpy);
SyncHandle();
return !Success;
}
void XResResourceSizeValuesDestroy (
long num_sizes,
XResResourceSizeValue *sizes
)
void
XResResourceSizeValuesDestroy(long num_sizes, XResResourceSizeValue *sizes)
{
int c;
for (c = 0; c < num_sizes; ++c) {
for (int c = 0; c < num_sizes; ++c) {
free(sizes[c].cross_references);
}
free(sizes);