Projects
openEuler:Mainline
libxkbcommon
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:libxkbcommon.spec
Changed
@@ -1,6 +1,6 @@ Name: libxkbcommon -Version: 1.3.1 -Release: 2 +Version: 1.5.0 +Release: 1 Summary: X.Org X11 XKB parsing library License: MIT URL: https://www.x.org @@ -11,7 +11,7 @@ BuildRequires: xorg-x11-proto-devel libX11-devel BuildRequires: xkeyboard-config-devel BuildRequires: pkgconfig(xcb-xkb) >= 1.10 -BuildRequires: libxml2-devel chrpath +BuildRequires: libxml2-devel Requires: xkeyboard-config %description @@ -62,16 +62,7 @@ %delete_la -# remove rpath -chrpath -d %{buildroot}%{_libdir}/libxkbcommon-x11.so.0.0.0 -mkdir -p %{buildroot}/etc/ld.so.conf.d -echo "/usr/lib64" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf - -%post x11 -/sbin/ldconfig - -%postun x11 -/sbin/ldconfig +%ldconfig_scriptlets %check %meson_test @@ -101,7 +92,6 @@ %files x11 %{_libdir}/libxkbcommon-x11.so.0.0.0 %{_libdir}/libxkbcommon-x11.so.0 -%config(noreplace) /etc/ld.so.conf.d/* %files x11-devel %{_libdir}/libxkbcommon-x11.so @@ -123,6 +113,16 @@ %{_mandir}/man1/xkbcli.1.gz %changelog +* Sat Feb 04 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 1.5.0-1 +- CVE:NA +- SUG:NA +- DESC:update to 1.5.0 + +* Wed Aug 03 2022 wangkerong <wangkerong@h-partners.com> - 1.3.1-4 +- CVE:NA +- SUG:NA +- DESC:revert remove rpath,this is redundant code + * Sat Jun 11 2022 wangkerong <wangkerong@h-partners.com> - 1.3.1-3 - CVE:NA - SUG:NA
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/libxkbcommon.git</param> - <param name="revision">9e9cd082fc8f4c17d03f0046f0d1785491c07979</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/.github/workflows/main.yml
Deleted
@@ -1,108 +0,0 @@ -name: CI - -on: - push: - branches: master - pull_request: - branches: master - -# Set permissions at the job level. -permissions: {} - -jobs: - linux: - runs-on: ubuntu-20.04 - permissions: - contents: read - strategy: - matrix: - compiler: clang, gcc - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade meson - sudo apt install -y \ - doxygen libxcb-xkb-dev valgrind ninja-build \ - libwayland-dev wayland-protocols bison graphviz - - name: Setup - run: | - meson setup build - env: - CC: ${{ matrix.compiler }} - - name: Build - run: | - meson compile -C build - - name: Test - run: - meson test -C build --print-errorlogs --setup=valgrind --no-suite python-tests - - macos: - runs-on: macos-10.15 - permissions: - contents: read - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade meson - brew install libxml2 doxygen bison ninja - brew link bison --force - env: - HOMEBREW_NO_AUTO_UPDATE: 1 - HOMEBREW_NO_INSTALL_CLEANUP: 1 - - name: Setup - run: | - PATH="/usr/local/opt/bison/bin:${PATH}" meson setup -Denable-wayland=false -Denable-x11=false build - - name: Build - run: | - PATH="/usr/local/opt/bison/bin:${PATH}" meson compile -C build - - name: Test - run: - meson test -C build --print-errorlogs - - windows: - runs-on: windows-2019 - permissions: - contents: read - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install dependencies - shell: powershell - run: | - python -m pip install --upgrade meson - Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile ninja.zip - Invoke-WebRequest -Uri https://github.com/lexxmark/winflexbison/releases/download/v2.5.23/win_flex_bison-2.5.23.zip -OutFile win_flex_bison.zip - Expand-Archive -Path win_flex_bison.zip -DestinationPath bin - Expand-Archive -Path ninja.zip -DestinationPath bin - Write-Output ((Get-Location).ToString() + "./bin") | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - name: Setup - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - meson setup -Denable-wayland=false -Denable-x11=false -Denable-docs=false -Denable-xkbregistry=false build - env: - CC: cl - - name: Build - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - meson compile -C build - - name: Test - run: - meson test -C build --print-errorlogs
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/.github/workflows/github-release.yml -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/.github/workflows/github-release.yml
Changed
@@ -15,7 +15,7 @@ permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 persist-credentials: false
View file
_service:tar_scm:libxkbcommon-1.5.0.tar.xz/.github/workflows/linux.yml
Added
@@ -0,0 +1,54 @@ +name: linux + +on: + push: + branches: master + pull_request: + branches: master + +# Set permissions at the job level. +permissions: {} + +jobs: + linux: + runs-on: ubuntu-20.04 + permissions: + contents: read + strategy: + matrix: + compiler: clang, gcc + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade meson + sudo apt update + sudo apt install -y \ + doxygen libxcb-xkb-dev valgrind ninja-build \ + libwayland-dev wayland-protocols bison graphviz + - name: Setup + run: | + meson setup build + env: + CC: ${{ matrix.compiler }} + - name: Build + run: | + meson compile -C build + - name: Test + run: + meson test -C build --print-errorlogs --no-suite python-tests + - name: Test with valgrind + run: + meson test -C build --print-errorlogs --setup=valgrind --no-suite python-tests + - name: Upload test logs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: test logs + path: | + build/meson-logs/
View file
_service:tar_scm:libxkbcommon-1.5.0.tar.xz/.github/workflows/macos.yml
Added
@@ -0,0 +1,40 @@ +name: macos + +on: + push: + branches: master + pull_request: + branches: master + +# Set permissions at the job level. +permissions: {} + +jobs: + macos: + runs-on: macos-10.15 + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade meson + brew install libxml2 doxygen bison ninja + brew link bison --force + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + - name: Setup + run: | + PATH="/usr/local/opt/bison/bin:${PATH}" meson setup -Denable-wayland=false -Denable-x11=false build + - name: Build + run: | + PATH="/usr/local/opt/bison/bin:${PATH}" meson compile -C build + - name: Test + run: + meson test -C build --print-errorlogs
View file
_service:tar_scm:libxkbcommon-1.5.0.tar.xz/.github/workflows/windows.yml
Added
@@ -0,0 +1,47 @@ +name: windows + +on: + push: + branches: master + pull_request: + branches: master + +# Set permissions at the job level. +permissions: {} + +jobs: + windows: + runs-on: windows-2019 + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Install dependencies + shell: powershell + run: | + python -m pip install --upgrade meson + Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile ninja.zip + Invoke-WebRequest -Uri https://github.com/lexxmark/winflexbison/releases/download/v2.5.23/win_flex_bison-2.5.23.zip -OutFile win_flex_bison.zip + Expand-Archive -Path win_flex_bison.zip -DestinationPath bin + Expand-Archive -Path ninja.zip -DestinationPath bin + Write-Output ((Get-Location).ToString() + "./bin") | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + - name: Setup + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + meson setup -Denable-wayland=false -Denable-x11=false -Denable-docs=false -Denable-xkbregistry=false build + env: + CC: cl + - name: Build + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + meson compile -C build + - name: Test + run: + meson test -C build --print-errorlogs
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/NEWS -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/NEWS
Changed
@@ -1,3 +1,70 @@ +libxkbcommon 1.5.0 - 2023-01-02 +================== + +- Add `xkb_context` flag `XKB_CONTEXT_NO_SECURE_GETENV` and `rxkb_context` flag + `RXKB_CONTEXT_NO_SECURE_GETENV`. + + xkbcommon uses `getenv_secure()` to obtain environment variables. This flag + makes xkbcommon use `getenv()` instead. + + This is useful for some clients that have relatively benign capabilities set, + like CAP_SYS_NICE, that also want to use e.g. the XKB configuration from the + environment and user configs in XDG_CONFIG_HOME. + + Contributed by Ronan Pigott. + +- Fix crash in `xkbcli interactive-wayland` under a compositor which supports + new versions of the xdg-shell protocol. + + Contributed by Jan Alexander Steffens (heftig). + +- Fix some MSVC build issues. + +- Fix some issues when including xkbcommon as a meson subproject. + +- meson>=0.51 is now required. + + +libxkbcommon 1.4.1 - 2022-05-21 +================== + +- Fix compose sequence overriding (common prefix) not working correctly. + Regressed in 1.2.0. + + Contributed by Weng Xuetian. + +- Remove various bogus currency sign (particulary Euro and Korean Won) entries + from the keysym <-> Unicode mappings. They prevented the real + keysyms/codepoints for these from mapping correctly. + + Contributed by Sam Lantinga and Simon Ser. + +libxkbcommon 1.4.0 - 2022-02-04 +================== + +- Add `enable-tools` option to Meson build (on by default) to allow disabling + the `xkbcli` tools. + + Contributed by Alex Xu (Hello71). + +- In `xkbcli list`, fix "YAML Norway problem" in output. + + Contributed by Peter Hutterer. + +- In libxkbregistry, variants now inherit iso639, iso3166 and brief from parent + layout if omitted. + + Contributed by M Hickford. + +- In libxkbregistry, don't call `xmlCleanupParser()` - it's not supposed to + be called by libraries. + + Contributed by Peter Hutterer. + +- In libxkbregistry, skip over invalid ISO-639 or ISO-3166 entries. + + Contributed by Peter Hutterer. + libxkbcommon 1.3.1 - 2021-09-10 ==================
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/README.md -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/README.md
Changed
@@ -15,6 +15,7 @@ meson setup build ninja -C build + ninja -C build test # Run the tests. To build for use with Wayland, you can disable X11 support while still using the X11 keyboard configuration resource files thusly:
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/include/xkbcommon/xkbcommon.h -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/include/xkbcommon/xkbcommon.h
Changed
@@ -580,9 +580,17 @@ XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0), /** * Don't take RMLVO names from the environment. + * * @since 0.3.0 */ - XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1) + XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1), + /** + * Disable the use of secure_getenv for this context, so that privileged + * processes can use environment variables. Client uses at their own risk. + * + * @since 1.5.0 + */ + XKB_CONTEXT_NO_SECURE_GETENV = (1 << 2) }; /** @@ -1201,7 +1209,8 @@ * @code xkb_keymap_num_levels_for_key(keymap, key) @endcode * @paramout masks_out A buffer in which the requested masks should be * stored. - * @paramout masks_size The size of the buffer pointed to by masks_out. + * @paramout masks_size The number of elements in the buffer pointed to by + * masks_out. * * If @c layout is out of range for this key (that is, larger or equal to * the value returned by xkb_keymap_num_layouts_for_key()), it is brought @@ -1333,6 +1342,33 @@ struct xkb_keymap * xkb_state_get_keymap(struct xkb_state *state); +/** + * @page server-client-state Server State and Client State + * @parblock + * + * The xkb_state API is used by two distinct actors in most window-system + * architectures: + * + * 1. A *server* - for example, a Wayland compositor, an X11 server, an evdev + * listener. + * + * Servers maintain the XKB state for a device according to input events from + * the device, such as key presses and releases, and out-of-band events from + * the user, like UI layout switchers. + * + * 2. A *client* - for example, a Wayland client, an X11 client. + * + * Clients do not listen to input from the device; instead, whenever the + * server state changes, the server serializes the state and notifies the + * clients that the state has changed; the clients then update the state + * from the serialization. + * + * Some entry points in the xkb_state API are only meant for servers and some + * are only meant for clients, and the two should generally not be mixed. + * + * @endparblock + */ + /** Specifies the direction of the key (press / release). */ enum xkb_key_direction { XKB_KEY_UP, /**< The key was released. */ @@ -1379,11 +1415,8 @@ * Update the keyboard state to reflect a given key being pressed or * released. * - * This entry point is intended for programs which track the keyboard state - * explicitly (like an evdev client). If the state is serialized to you by - * a master process (like a Wayland compositor) using functions like - * xkb_state_serialize_mods(), you should use xkb_state_update_mask() instead. - * The two functions should not generally be used together. + * This entry point is intended for *server* applications and should not be used + * by *client* applications; see @ref server-client-state for details. * * A series of calls to this function should be consistent; that is, a call * with XKB_KEY_DOWN for a key should be matched by an XKB_KEY_UP; if a key @@ -1411,21 +1444,16 @@ /** * Update a keyboard state from a set of explicit masks. * - * This entry point is intended for window systems and the like, where a - * master process holds an xkb_state, then serializes it over a wire - * protocol, and clients then use the serialization to feed in to their own - * xkb_state. + * This entry point is intended for *client* applications; see @ref + * server-client-state for details. *Server* applications should use + * xkb_state_update_key() instead. * * All parameters must always be passed, or the resulting state may be * incoherent. * * The serialization is lossy and will not survive round trips; it must only - * be used to feed slave state objects, and must not be used to update the - * master state. - * - * If you do not fit the description above, you should use - * xkb_state_update_key() instead. The two functions should not generally be - * used together. + * be used to feed client state objects, and must not be used to update the + * server state. * * @returns A mask of state components that have changed as a result of * the update. If nothing in the state has changed, returns 0. @@ -1603,6 +1631,10 @@ * The counterpart to xkb_state_update_mask for modifiers, to be used on * the server side of serialization. * + * This entry point is intended for *server* applications; see @ref + * server-client-state for details. *Client* applications should use the + * xkb_state_mod_*_is_active API. + * * @param state The keyboard state. * @param components A mask of the modifier state components to serialize. * State components other than XKB_STATE_MODS_* are ignored. @@ -1612,9 +1644,6 @@ * @returns A xkb_mod_mask_t representing the given components of the * modifier state. * - * This function should not be used in regular clients; please use the - * xkb_state_mod_*_is_active API instead. - * * @memberof xkb_state */ xkb_mod_mask_t @@ -1625,6 +1654,10 @@ * The counterpart to xkb_state_update_mask for layouts, to be used on * the server side of serialization. * + * This entry point is intended for *server* applications; see @ref + * server-client-state for details. *Client* applications should use the + * xkb_state_layout_*_is_active API. + * * @param state The keyboard state. * @param components A mask of the layout state components to serialize. * State components other than XKB_STATE_LAYOUT_* are ignored. @@ -1634,9 +1667,6 @@ * @returns A layout index representing the given components of the * layout state. * - * This function should not be used in regular clients; please use the - * xkb_state_layout_*_is_active API instead. - * * @memberof xkb_state */ xkb_layout_index_t
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/include/xkbcommon/xkbregistry.h -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/include/xkbcommon/xkbregistry.h
Changed
@@ -163,6 +163,13 @@ * on the lookup behavior. */ RXKB_CONTEXT_LOAD_EXOTIC_RULES = (1 << 1), + /** + * Disable the use of secure_getenv for this context, so that privileged + * processes can use environment variables. Client uses at their own risk. + * + * @since 1.5.0 + */ + RXKB_CONTEXT_NO_SECURE_GETENV = (1 << 2) }; /**
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/meson.build -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/meson.build
Changed
@@ -1,13 +1,13 @@ project( 'libxkbcommon', 'c', - version: '1.3.1', + version: '1.5.0', default_options: 'c_std=c11', 'warning_level=2', 'b_lundef=true', , - meson_version : '>= 0.49.0', + meson_version : '>= 0.51.0', ) pkgconfig = import('pkgconfig') cc = meson.get_compiler('c') @@ -17,7 +17,6 @@ # Compiler flags. cflags = '-fno-strict-aliasing', - '-fsanitize-undefined-trap-on-error', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wpointer-arith', @@ -41,7 +40,7 @@ if XKBCONFIGROOT == '' xkeyboard_config_dep = dependency('xkeyboard-config', required: false) if xkeyboard_config_dep.found() - XKBCONFIGROOT = xkeyboard_config_dep.get_pkgconfig_variable('xkb_base') + XKBCONFIGROOT = xkeyboard_config_dep.get_variable(pkgconfig: 'xkb_base') else XKBCONFIGROOT = get_option('prefix')/get_option('datadir')/'X11'/'xkb' endif @@ -125,8 +124,6 @@ else message('C library does not support secure_getenv, using getenv instead') endif -have_getopt_long = cc.has_header_symbol('getopt.h', 'getopt_long', - prefix: '#define _GNU_SOURCE') if not cc.has_header_symbol('limits.h', 'PATH_MAX', prefix: system_ext_define) if host_machine.system() == 'windows' # see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation @@ -148,7 +145,7 @@ # Supports -Wl,--version-script? have_version_script = cc.links( 'int main(){}', - args: '-Wl,--version-script=' + meson.source_root()/'xkbcommon.map', + args: '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map', name: '-Wl,--version-script', ) @@ -234,7 +231,7 @@ libxkbcommon_link_args = libxkbcommon_link_deps = if have_version_script - libxkbcommon_link_args += '-Wl,--version-script=' + meson.source_root()/'xkbcommon.map' + libxkbcommon_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map' libxkbcommon_link_deps += 'xkbcommon.map' elif cc.get_argument_syntax() == 'msvc' libxkbcommon_def = custom_target('xkbcommon.def', @@ -302,7 +299,7 @@ libxkbcommon_x11_link_args = libxkbcommon_x11_link_deps = if have_version_script - libxkbcommon_x11_link_args += '-Wl,--version-script=' + meson.source_root()/'xkbcommon-x11.map' + libxkbcommon_x11_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon-x11.map' libxkbcommon_x11_link_deps += 'xkbcommon-x11.map' elif cc.get_argument_syntax() == 'msvc' libxkbcommon_x11_def = custom_target('xkbcommon-x11.def', @@ -362,7 +359,7 @@ libxkbregistry_link_args = libxkbregistry_link_deps = if have_version_script - libxkbregistry_link_args += '-Wl,--version-script=' + meson.source_root()/'xkbregistry.map' + libxkbregistry_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbregistry.map' libxkbregistry_link_deps += 'xkbregistry.map' elif cc.get_argument_syntax() == 'msvc' libxkbregistry_def = custom_target('xkbregistry.def', @@ -406,7 +403,7 @@ man_pages = # Tools -build_tools = have_getopt_long +build_tools = get_option('enable-tools') and cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE') if build_tools libxkbcommon_tools_internal = static_library( 'tools-internal', @@ -485,18 +482,18 @@ You can disable the Wayland xkbcli programs with -Denable-wayland=false.''') endif - wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner')) + wayland_scanner = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner')) wayland_scanner_code_gen = generator( wayland_scanner, output: '@BASENAME@-protocol.c', - arguments: 'code', '@INPUT@', '@OUTPUT@', + arguments: 'private-code', '@INPUT@', '@OUTPUT@', ) wayland_scanner_client_header_gen = generator( wayland_scanner, output: '@BASENAME@-client-protocol.h', arguments: 'client-header', '@INPUT@', '@OUTPUT@', ) - wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir') + wayland_protocols_datadir = wayland_protocols_dep.get_variable(pkgconfig: 'pkgdatadir') xdg_shell_xml = wayland_protocols_datadir/'stable/xdg-shell/xdg-shell.xml' xdg_shell_sources = wayland_scanner_code_gen.process(xdg_shell_xml), @@ -526,7 +523,7 @@ # xkeyboard-config "verifier" xkct_config = configuration_data() -xkct_config.set('MESON_BUILD_ROOT', meson.build_root()) +xkct_config.set('MESON_BUILD_ROOT', meson.current_build_dir()) xkct_config.set('XKB_CONFIG_ROOT', XKBCONFIGROOT) configure_file(input: 'test/xkeyboard-config-test.py.in', output: 'xkeyboard-config-test', @@ -536,15 +533,15 @@ test_env = environment() test_env.set('XKB_LOG_LEVEL', 'debug') test_env.set('XKB_LOG_VERBOSITY', '10') -test_env.set('top_srcdir', meson.source_root()) -test_env.set('top_builddir', meson.build_root()) +test_env.set('top_srcdir', meson.current_source_dir()) +test_env.set('top_builddir', meson.current_build_dir()) test_env.set('HAVE_XKBCLI_INTERACTIVE_EVDEV', configh_data.get('HAVE_XKBCLI_INTERACTIVE_EVDEV', 0).to_string()) test_env.set('HAVE_XKBCLI_INTERACTIVE_WAYLAND', configh_data.get('HAVE_XKBCLI_INTERACTIVE_WAYLAND', 0).to_string()) test_env.set('HAVE_XKBCLI_INTERACTIVE_X11', configh_data.get('HAVE_XKBCLI_INTERACTIVE_X11', 0).to_string()) test_env.set('HAVE_XKBCLI_LIST', configh_data.get('HAVE_XKBCLI_LIST', 0).to_string()) test_configh_data = configuration_data() -test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', meson.source_root()/'test'/'data') +test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data') configure_file(output: 'test-config.h', configuration: test_configh_data) # Some tests need to use unexported symbols, so we link them against @@ -598,14 +595,11 @@ executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep), env: test_env, ) -# TODO: This test currently uses some functions that don't exist on Windows. -if cc.get_id() != 'msvc' - test( - 'context', - executable('test-context', 'test/context.c', dependencies: test_dep), - env: test_env, - ) -endif +test( + 'context', + executable('test-context', 'test/context.c', dependencies: test_dep), + env: test_env, +) test( 'rules-file', executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep), @@ -687,7 +681,7 @@ 'registry', executable('test-registry', 'test/registry.c', include_directories: include_directories('src'), - dependencies: dep_libxkbregistry), + dependencies: dep_libxkbregistry, test_dep), env: test_env, ) endif @@ -704,7 +698,7 @@ env = environment() - env.set('XKB_CONFIG_ROOT', meson.source_root()/'test'/'data') + env.set('XKB_CONFIG_ROOT', meson.current_source_dir()/'test'/'data') foreach keysym: keysyms_to_test test('keysym-test-@0@'.format(keysym), find_program('test/test-keysym.py'), @@ -735,7 +729,7 @@ # Benchmarks. bench_env = environment() -bench_env.set('top_srcdir', meson.source_root()) +bench_env.set('top_srcdir', meson.current_source_dir()) benchmark( 'key-proc', executable('bench-key-proc', 'bench/key-proc.c', dependencies: test_dep), @@ -797,7 +791,7 @@ doxygen_data.set('PACKAGE_NAME', meson.project_name()) doxygen_data.set('PACKAGE_VERSION', meson.project_version()) doxygen_data.set('INPUT', ' '.join(doxygen_input)) - doxygen_data.set('OUTPUT_DIRECTORY', meson.build_root()) + doxygen_data.set('OUTPUT_DIRECTORY', meson.current_build_dir()) doxyfile = configure_file( input: 'doc/Doxyfile.in', output: 'Doxyfile', @@ -809,7 +803,7 @@ 'doc', input: doxyfile + doxygen_input, output: 'html', - command: doxygen_wrapper, doxygen.path(), meson.build_root()/'Doxyfile', meson.source_root(), + command: doxygen_wrapper, doxygen, meson.current_build_dir()/'Doxyfile', meson.current_source_dir(), install: true,
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/meson_options.txt -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/meson_options.txt
Changed
@@ -44,6 +44,12 @@ description: 'Default XKB options', ) option( + 'enable-tools', + type: 'boolean', + value: true, + description: 'Enable building tools', +) +option( 'enable-x11', type: 'boolean', value: true, @@ -59,7 +65,7 @@ 'enable-wayland', type: 'boolean', value: true, - description: 'Enable support for Wayland utility programs', + description: 'Enable support for Wayland utility programs (requires enable-tools)', ) option( 'enable-xkbregistry',
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/compose/parser.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/compose/parser.c
Changed
@@ -126,18 +126,18 @@ { skip_more_whitespace_and_comments: /* Skip spaces. */ - while (is_space(peek(s))) - if (next(s) == '\n') + while (is_space(scanner_peek(s))) + if (scanner_next(s) == '\n') return TOK_END_OF_LINE; /* Skip comments. */ - if (chr(s, '#')) { - skip_to_eol(s); + if (scanner_chr(s, '#')) { + scanner_skip_to_eol(s); goto skip_more_whitespace_and_comments; } /* See if we're done. */ - if (eof(s)) return TOK_END_OF_FILE; + if (scanner_eof(s)) return TOK_END_OF_FILE; /* New token. */ s->token_line = s->line; @@ -145,14 +145,14 @@ s->buf_pos = 0; /* LHS Keysym. */ - if (chr(s, '<')) { - while (peek(s) != '>' && !eol(s) && !eof(s)) - buf_append(s, next(s)); - if (!chr(s, '>')) { + if (scanner_chr(s, '<')) { + while (scanner_peek(s) != '>' && !scanner_eol(s) && !scanner_eof(s)) + scanner_buf_append(s, scanner_next(s)); + if (!scanner_chr(s, '>')) { scanner_err(s, "unterminated keysym literal"); return TOK_ERROR; } - if (!buf_append(s, '\0')) { + if (!scanner_buf_append(s, '\0')) { scanner_err(s, "keysym literal is too long"); return TOK_ERROR; } @@ -162,46 +162,46 @@ } /* Colon. */ - if (chr(s, ':')) + if (scanner_chr(s, ':')) return TOK_COLON; - if (chr(s, '!')) + if (scanner_chr(s, '!')) return TOK_BANG; - if (chr(s, '~')) + if (scanner_chr(s, '~')) return TOK_TILDE; /* String literal. */ - if (chr(s, '\"')) { - while (!eof(s) && !eol(s) && peek(s) != '\"') { - if (chr(s, '\\')) { + if (scanner_chr(s, '\"')) { + while (!scanner_eof(s) && !scanner_eol(s) && scanner_peek(s) != '\"') { + if (scanner_chr(s, '\\')) { uint8_t o; - if (chr(s, '\\')) { - buf_append(s, '\\'); + if (scanner_chr(s, '\\')) { + scanner_buf_append(s, '\\'); } - else if (chr(s, '"')) { - buf_append(s, '"'); + else if (scanner_chr(s, '"')) { + scanner_buf_append(s, '"'); } - else if (chr(s, 'x') || chr(s, 'X')) { - if (hex(s, &o)) - buf_append(s, (char) o); + else if (scanner_chr(s, 'x') || scanner_chr(s, 'X')) { + if (scanner_hex(s, &o)) + scanner_buf_append(s, (char) o); else scanner_warn(s, "illegal hexadecimal escape sequence in string literal"); } - else if (oct(s, &o)) { - buf_append(s, (char) o); + else if (scanner_oct(s, &o)) { + scanner_buf_append(s, (char) o); } else { - scanner_warn(s, "unknown escape sequence (%c) in string literal", peek(s)); + scanner_warn(s, "unknown escape sequence (%c) in string literal", scanner_peek(s)); /* Ignore. */ } } else { - buf_append(s, next(s)); + scanner_buf_append(s, scanner_next(s)); } } - if (!chr(s, '\"')) { + if (!scanner_chr(s, '\"')) { scanner_err(s, "unterminated string literal"); return TOK_ERROR; } - if (!buf_append(s, '\0')) { + if (!scanner_buf_append(s, '\0')) { scanner_err(s, "string literal is too long"); return TOK_ERROR; } @@ -215,11 +215,11 @@ } /* Identifier or include. */ - if (is_alpha(peek(s)) || peek(s) == '_') { + if (is_alpha(scanner_peek(s)) || scanner_peek(s) == '_') { s->buf_pos = 0; - while (is_alnum(peek(s)) || peek(s) == '_') - buf_append(s, next(s)); - if (!buf_append(s, '\0')) { + while (is_alnum(scanner_peek(s)) || scanner_peek(s) == '_') + scanner_buf_append(s, scanner_next(s)); + if (!scanner_buf_append(s, '\0')) { scanner_err(s, "identifier is too long"); return TOK_ERROR; } @@ -233,7 +233,7 @@ } /* Discard rest of line. */ - skip_to_eol(s); + scanner_skip_to_eol(s); scanner_err(s, "unrecognized token"); return TOK_ERROR; @@ -243,68 +243,68 @@ lex_include_string(struct scanner *s, struct xkb_compose_table *table, union lvalue *val_out) { - while (is_space(peek(s))) - if (next(s) == '\n') + while (is_space(scanner_peek(s))) + if (scanner_next(s) == '\n') return TOK_END_OF_LINE; s->token_line = s->line; s->token_column = s->column; s->buf_pos = 0; - if (!chr(s, '\"')) { + if (!scanner_chr(s, '\"')) { scanner_err(s, "include statement must be followed by a path"); return TOK_ERROR; } - while (!eof(s) && !eol(s) && peek(s) != '\"') { - if (chr(s, '%')) { - if (chr(s, '%')) { - buf_append(s, '%'); + while (!scanner_eof(s) && !scanner_eol(s) && scanner_peek(s) != '\"') { + if (scanner_chr(s, '%')) { + if (scanner_chr(s, '%')) { + scanner_buf_append(s, '%'); } - else if (chr(s, 'H')) { - const char *home = secure_getenv("HOME"); + else if (scanner_chr(s, 'H')) { + const char *home = xkb_context_getenv(table->ctx, "HOME"); if (!home) { scanner_err(s, "%%H was used in an include statement, but the HOME environment variable is not set"); return TOK_ERROR; } - if (!buf_appends(s, home)) { + if (!scanner_buf_appends(s, home)) { scanner_err(s, "include path after expanding %%H is too long"); return TOK_ERROR; } } - else if (chr(s, 'L')) { - char *path = get_locale_compose_file_path(table->locale); + else if (scanner_chr(s, 'L')) { + char *path = get_locale_compose_file_path(table->ctx, table->locale); if (!path) { scanner_err(s, "failed to expand %%L to the locale Compose file"); return TOK_ERROR; } - if (!buf_appends(s, path)) { + if (!scanner_buf_appends(s, path)) { free(path); scanner_err(s, "include path after expanding %%L is too long"); return TOK_ERROR; } free(path); } - else if (chr(s, 'S')) { - const char *xlocaledir = get_xlocaledir_path(); - if (!buf_appends(s, xlocaledir)) { + else if (scanner_chr(s, 'S')) { + const char *xlocaledir = get_xlocaledir_path(table->ctx); + if (!scanner_buf_appends(s, xlocaledir)) {
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/compose/paths.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/compose/paths.c
Changed
@@ -23,9 +23,10 @@ #include "config.h" +#include "xkbcommon/xkbcommon.h" #include "utils.h" +#include "context.h" #include "paths.h" -#include "utils.h" enum resolve_name_direction { LEFT_TO_RIGHT, @@ -33,9 +34,9 @@ }; const char * -get_xlocaledir_path(void) +get_xlocaledir_path(struct xkb_context *ctx) { - const char *dir = secure_getenv("XLOCALEDIR"); + const char *dir = xkb_context_getenv(ctx, "XLOCALEDIR"); if (!dir) dir = XLOCALEDIR; return dir; @@ -47,8 +48,8 @@ * @filename is relative to the xlocaledir. */ static char * -resolve_name(const char *filename, enum resolve_name_direction direction, - const char *name) +resolve_name(struct xkb_context *ctx, const char *filename, + enum resolve_name_direction direction, const char *name) { int ret; bool ok; @@ -62,7 +63,7 @@ char *match; size_t left_len, right_len, name_len; - xlocaledir = get_xlocaledir_path(); + xlocaledir = get_xlocaledir_path(ctx); ret = snprintf(path, sizeof(path), "%s/%s", xlocaledir, filename); if (ret < 0 || (size_t) ret >= sizeof(path)) @@ -137,27 +138,27 @@ } char * -resolve_locale(const char *locale) +resolve_locale(struct xkb_context *ctx, const char *locale) { - char *alias = resolve_name("locale.alias", LEFT_TO_RIGHT, locale); + char *alias = resolve_name(ctx, "locale.alias", LEFT_TO_RIGHT, locale); return alias ? alias : strdup(locale); } char * -get_xcomposefile_path(void) +get_xcomposefile_path(struct xkb_context *ctx) { - return strdup_safe(secure_getenv("XCOMPOSEFILE")); + return strdup_safe(xkb_context_getenv(ctx, "XCOMPOSEFILE")); } char * -get_xdg_xcompose_file_path(void) +get_xdg_xcompose_file_path(struct xkb_context *ctx) { const char *xdg_config_home; const char *home; - xdg_config_home = secure_getenv("XDG_CONFIG_HOME"); + xdg_config_home = xkb_context_getenv(ctx, "XDG_CONFIG_HOME"); if (!xdg_config_home || xdg_config_home0 != '/') { - home = secure_getenv("HOME"); + home = xkb_context_getenv(ctx, "HOME"); if (!home) return NULL; return asprintf_safe("%s/.config/XCompose", home); @@ -167,11 +168,11 @@ } char * -get_home_xcompose_file_path(void) +get_home_xcompose_file_path(struct xkb_context *ctx) { const char *home; - home = secure_getenv("HOME"); + home = xkb_context_getenv(ctx, "HOME"); if (!home) return NULL; @@ -179,7 +180,7 @@ } char * -get_locale_compose_file_path(const char *locale) +get_locale_compose_file_path(struct xkb_context *ctx, const char *locale) { char *resolved; char *path; @@ -198,7 +199,7 @@ if (streq(locale, "C")) locale = "en_US.UTF-8"; - resolved = resolve_name("compose.dir", RIGHT_TO_LEFT, locale); + resolved = resolve_name(ctx, "compose.dir", RIGHT_TO_LEFT, locale); if (!resolved) return NULL; @@ -206,7 +207,7 @@ path = resolved; } else { - const char *xlocaledir = get_xlocaledir_path(); + const char *xlocaledir = get_xlocaledir_path(ctx); path = asprintf_safe("%s/%s", xlocaledir, resolved); free(resolved); }
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/compose/paths.h -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/compose/paths.h
Changed
@@ -25,21 +25,21 @@ #define COMPOSE_RESOLVE_H char * -resolve_locale(const char *locale); +resolve_locale(struct xkb_context *ctx, const char *locale); const char * -get_xlocaledir_path(void); +get_xlocaledir_path(struct xkb_context *ctx); char * -get_xcomposefile_path(void); +get_xcomposefile_path(struct xkb_context *ctx); char * -get_xdg_xcompose_file_path(void); +get_xdg_xcompose_file_path(struct xkb_context *ctx); char * -get_home_xcompose_file_path(void); +get_home_xcompose_file_path(struct xkb_context *ctx); char * -get_locale_compose_file_path(const char *locale); +get_locale_compose_file_path(struct xkb_context *ctx, const char *locale); #endif
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/compose/table.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/compose/table.c
Changed
@@ -38,7 +38,7 @@ struct xkb_compose_table *table; struct compose_node dummy; - resolved_locale = resolve_locale(locale); + resolved_locale = resolve_locale(ctx, locale); if (!resolved_locale) return NULL; @@ -174,7 +174,7 @@ if (!table) return NULL; - path = get_xcomposefile_path(); + path = get_xcomposefile_path(ctx); if (path) { file = fopen(path, "rb"); if (file) @@ -182,7 +182,7 @@ } free(path); - path = get_xdg_xcompose_file_path(); + path = get_xdg_xcompose_file_path(ctx); if (path) { file = fopen(path, "rb"); if (file) @@ -190,7 +190,7 @@ } free(path); - path = get_home_xcompose_file_path(); + path = get_home_xcompose_file_path(ctx); if (path) { file = fopen(path, "rb"); if (file) @@ -198,7 +198,7 @@ } free(path); - path = get_locale_compose_file_path(table->locale); + path = get_locale_compose_file_path(ctx, table->locale); if (path) { file = fopen(path, "rb"); if (file)
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/context-priv.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/context-priv.c
Changed
@@ -34,6 +34,16 @@ #include "utils.h" #include "context.h" +char * +xkb_context_getenv(struct xkb_context *ctx, const char *name) +{ + if (ctx->use_secure_getenv) { + return secure_getenv(name); + } else { + return getenv(name); + } +} + unsigned int xkb_context_num_failed_include_paths(struct xkb_context *ctx) { @@ -105,7 +115,7 @@ const char *env = NULL; if (ctx->use_environment_names) - env = secure_getenv("XKB_DEFAULT_RULES"); + env = xkb_context_getenv(ctx, "XKB_DEFAULT_RULES"); return env ? env : DEFAULT_XKB_RULES; } @@ -116,7 +126,7 @@ const char *env = NULL; if (ctx->use_environment_names) - env = secure_getenv("XKB_DEFAULT_MODEL"); + env = xkb_context_getenv(ctx, "XKB_DEFAULT_MODEL"); return env ? env : DEFAULT_XKB_MODEL; } @@ -127,7 +137,7 @@ const char *env = NULL; if (ctx->use_environment_names) - env = secure_getenv("XKB_DEFAULT_LAYOUT"); + env = xkb_context_getenv(ctx, "XKB_DEFAULT_LAYOUT"); return env ? env : DEFAULT_XKB_LAYOUT; } @@ -136,12 +146,12 @@ xkb_context_get_default_variant(struct xkb_context *ctx) { const char *env = NULL; - const char *layout = secure_getenv("XKB_DEFAULT_LAYOUT"); + const char *layout = xkb_context_getenv(ctx, "XKB_DEFAULT_LAYOUT"); /* We don't want to inherit the variant if they haven't also set a * layout, since they're so closely paired. */ if (layout && ctx->use_environment_names) - env = secure_getenv("XKB_DEFAULT_VARIANT"); + env = xkb_context_getenv(ctx, "XKB_DEFAULT_VARIANT"); return env ? env : DEFAULT_XKB_VARIANT; } @@ -152,7 +162,7 @@ const char *env = NULL; if (ctx->use_environment_names) - env = secure_getenv("XKB_DEFAULT_OPTIONS"); + env = xkb_context_getenv(ctx, "XKB_DEFAULT_OPTIONS"); return env ? env : DEFAULT_XKB_OPTIONS; }
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/context.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/context.c
Changed
@@ -29,20 +29,12 @@ #include <sys/types.h> #include <sys/stat.h> #include <errno.h> -#ifdef _MSC_VER -# include <direct.h> -# include <io.h> -# ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# endif -#else -# include <unistd.h> -#endif #include "xkbcommon/xkbcommon.h" #include "utils.h" #include "context.h" + /** * Append one directory to the context's include path. */ @@ -86,14 +78,14 @@ const char * xkb_context_include_path_get_extra_path(struct xkb_context *ctx) { - const char *extra = secure_getenv("XKB_CONFIG_EXTRA_PATH"); + const char *extra = xkb_context_getenv(ctx, "XKB_CONFIG_EXTRA_PATH"); return extra ? extra : DFLT_XKB_CONFIG_EXTRA_PATH; } const char * xkb_context_include_path_get_system_path(struct xkb_context *ctx) { - const char *root = secure_getenv("XKB_CONFIG_ROOT"); + const char *root = xkb_context_getenv(ctx, "XKB_CONFIG_ROOT"); return root ? root : DFLT_XKB_CONFIG_ROOT; } @@ -107,9 +99,9 @@ char *user_path; int ret = 0; - home = secure_getenv("HOME"); + home = xkb_context_getenv(ctx, "HOME"); - xdg = secure_getenv("XDG_CONFIG_HOME"); + xdg = xkb_context_getenv(ctx, "XDG_CONFIG_HOME"); if (xdg != NULL) { user_path = asprintf_safe("%s/xkb", xdg); if (user_path) { @@ -298,13 +290,15 @@ ctx->log_fn = default_log_fn; ctx->log_level = XKB_LOG_LEVEL_ERROR; ctx->log_verbosity = 0; + ctx->use_environment_names = !(flags & XKB_CONTEXT_NO_ENVIRONMENT_NAMES); + ctx->use_secure_getenv = !(flags & XKB_CONTEXT_NO_SECURE_GETENV); /* Environment overwrites defaults. */ - env = secure_getenv("XKB_LOG_LEVEL"); + env = xkb_context_getenv(ctx, "XKB_LOG_LEVEL"); if (env) xkb_context_set_log_level(ctx, log_level(env)); - env = secure_getenv("XKB_LOG_VERBOSITY"); + env = xkb_context_getenv(ctx, "XKB_LOG_VERBOSITY"); if (env) xkb_context_set_log_verbosity(ctx, log_verbosity(env)); @@ -316,8 +310,6 @@ return NULL; } - ctx->use_environment_names = !(flags & XKB_CONTEXT_NO_ENVIRONMENT_NAMES); - ctx->atom_table = atom_table_new(); if (!ctx->atom_table) { xkb_context_unref(ctx);
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/context.h -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/context.h
Changed
@@ -53,8 +53,12 @@ size_t text_next; unsigned int use_environment_names : 1; + unsigned int use_secure_getenv : 1; }; +char * +xkb_context_getenv(struct xkb_context *ctx, const char *name); + unsigned int xkb_context_num_failed_include_paths(struct xkb_context *ctx);
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/keysym-utf.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/keysym-utf.c
Changed
@@ -819,22 +819,9 @@ { 0x0ef9, 0x11f0 }, /* Hangul_J_KkogjiDalrinIeung ᇰ HANGUL JONGSEONG YESIEUNG */ { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */ { 0x0eff, 0x20a9 }, /* Korean_Won ₩ WON SIGN */ - { 0x13a4, 0x20ac }, /* Euro € EURO SIGN */ { 0x13bc, 0x0152 }, /* OE Œ LATIN CAPITAL LIGATURE OE */ { 0x13bd, 0x0153 }, /* oe œ LATIN SMALL LIGATURE OE */ { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */ - { 0x20a0, 0x20a0 }, /* EcuSign ₠ EURO-CURRENCY SIGN */ - { 0x20a1, 0x20a1 }, /* ColonSign ₡ COLON SIGN */ - { 0x20a2, 0x20a2 }, /* CruzeiroSign ₢ CRUZEIRO SIGN */ - { 0x20a3, 0x20a3 }, /* FFrancSign ₣ FRENCH FRANC SIGN */ - { 0x20a4, 0x20a4 }, /* LiraSign ₤ LIRA SIGN */ - { 0x20a5, 0x20a5 }, /* MillSign ₥ MILL SIGN */ - { 0x20a6, 0x20a6 }, /* NairaSign ₦ NAIRA SIGN */ - { 0x20a7, 0x20a7 }, /* PesetaSign ₧ PESETA SIGN */ - { 0x20a8, 0x20a8 }, /* RupeeSign ₨ RUPEE SIGN */ - { 0x20a9, 0x20a9 }, /* WonSign ₩ WON SIGN */ - { 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */ - { 0x20ab, 0x20ab }, /* DongSign ₫ DONG SIGN */ { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */ };
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/registry.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/registry.c
Changed
@@ -72,6 +72,7 @@ enum context_state context_state; bool load_extra_rules_files; + bool use_secure_getenv; struct list models; /* list of struct rxkb_models */ struct list layouts; /* list of struct rxkb_layouts */ @@ -437,6 +438,17 @@ DECLARE_CREATE_FOR_TYPE(rxkb_context); DECLARE_TYPED_GETTER_FOR_TYPE(rxkb_context, log_level, enum rxkb_log_level); +static char * +rxkb_context_getenv(struct rxkb_context *ctx, const char *name) +{ + if (ctx->use_secure_getenv) { + return secure_getenv(name); + } else { + return getenv(name); + } +} + + XKB_EXPORT void rxkb_context_set_log_level(struct rxkb_context *ctx, enum rxkb_log_level level) @@ -508,11 +520,12 @@ ctx->context_state = CONTEXT_NEW; ctx->load_extra_rules_files = flags & RXKB_CONTEXT_LOAD_EXOTIC_RULES; + ctx->use_secure_getenv = !(flags & RXKB_CONTEXT_NO_SECURE_GETENV); ctx->log_fn = default_log_fn; ctx->log_level = RXKB_LOG_LEVEL_ERROR; /* Environment overwrites defaults. */ - env = secure_getenv("RXKB_LOG_LEVEL"); + env = rxkb_context_getenv(ctx, "RXKB_LOG_LEVEL"); if (env) rxkb_context_set_log_level(ctx, log_level(env)); @@ -593,9 +606,9 @@ return false; } - home = secure_getenv("HOME"); + home = rxkb_context_getenv(ctx, "HOME"); - xdg = secure_getenv("XDG_CONFIG_HOME"); + xdg = rxkb_context_getenv(ctx, "XDG_CONFIG_HOME"); if (xdg != NULL) { user_path = asprintf_safe("%s/xkb", xdg); if (user_path) { @@ -619,13 +632,13 @@ } } - extra = secure_getenv("XKB_CONFIG_EXTRA_PATH"); + extra = rxkb_context_getenv(ctx, "XKB_CONFIG_EXTRA_PATH"); if (extra != NULL) ret |= rxkb_context_include_path_append(ctx, extra); else ret |= rxkb_context_include_path_append(ctx, DFLT_XKB_CONFIG_EXTRA_PATH); - root = secure_getenv("XKB_CONFIG_ROOT"); + root = rxkb_context_getenv(ctx, "XKB_CONFIG_ROOT"); if (root != NULL) ret |= rxkb_context_include_path_append(ctx, root); else @@ -808,6 +821,11 @@ char *str = extract_text(node); struct rxkb_object *parent; + if (!str || strlen(str) != 3) { + free(str); + continue; + } + parent = &layout->base; code = rxkb_iso639_code_create(parent); code->code = str; @@ -827,6 +845,11 @@ char *str = extract_text(node); struct rxkb_object *parent; + if (!str || strlen(str) != 2) { + free(str); + continue; + } + parent = &layout->base; code = rxkb_iso3166_code_create(parent); code->code = str; @@ -860,7 +883,8 @@ v->name = strdup(l->name); v->variant = name; v->description = description; - v->brief = brief; + // if variant omits brief, inherit from parent layout. + v->brief = brief == NULL ? strdup_safe(l->brief) : brief; v->popularity = popularity; list_append(&ctx->layouts, &v->base.link); @@ -870,11 +894,35 @@ if (!is_node(ci, "configItem")) continue; + bool found_language_list = false; + bool found_country_list = false; for (node = ci->children; node; node = node->next) { - if (is_node(node, "languageList")) + if (is_node(node, "languageList")) { parse_language_list(node, v); - if (is_node(node, "countryList")) + found_language_list = true; + } + if (is_node(node, "countryList")) { parse_country_list(node, v); + found_country_list = true; + } + } + if (!found_language_list) { + // inherit from parent layout + struct rxkb_iso639_code* x; + list_for_each(x, &l->iso639s, base.link) { + struct rxkb_iso639_code* code = rxkb_iso639_code_create(&v->base); + code->code = strdup(x->code); + list_append(&v->iso639s, &code->base.link); + } + } + if (!found_country_list) { + // inherit from parent layout + struct rxkb_iso3166_code* x; + list_for_each(x, &l->iso3166s, base.link) { + struct rxkb_iso3166_code* code = rxkb_iso3166_code_create(&v->base); + code->code = strdup(x->code); + list_append(&v->iso3166s, &code->base.link); + } } } } else { @@ -1197,7 +1245,6 @@ success = true; error: xmlFreeDoc(doc); - xmlCleanupParser(); return success; }
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/scanner-utils.h -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/scanner-utils.h
Changed
@@ -85,7 +85,7 @@ } static inline char -peek(struct scanner *s) +scanner_peek(struct scanner *s) { if (unlikely(s->pos >= s->len)) return '\0'; @@ -93,19 +93,19 @@ } static inline bool -eof(struct scanner *s) +scanner_eof(struct scanner *s) { return s->pos >= s->len; } static inline bool -eol(struct scanner *s) +scanner_eol(struct scanner *s) { - return peek(s) == '\n'; + return scanner_peek(s) == '\n'; } static inline void -skip_to_eol(struct scanner *s) +scanner_skip_to_eol(struct scanner *s) { const char *nl = memchr(s->s + s->pos, '\n', s->len - s->pos); const size_t new_pos = nl ? (size_t) (nl - s->s) : s->len; @@ -114,11 +114,11 @@ } static inline char -next(struct scanner *s) +scanner_next(struct scanner *s) { - if (unlikely(eof(s))) + if (unlikely(scanner_eof(s))) return '\0'; - if (unlikely(eol(s))) { + if (unlikely(scanner_eol(s))) { s->line++; s->column = 1; } @@ -129,16 +129,16 @@ } static inline bool -chr(struct scanner *s, char ch) +scanner_chr(struct scanner *s, char ch) { - if (likely(peek(s) != ch)) + if (likely(scanner_peek(s) != ch)) return false; s->pos++; s->column++; return true; } static inline bool -str(struct scanner *s, const char *string, size_t len) +scanner_str(struct scanner *s, const char *string, size_t len) { if (s->len - s->pos < len) return false; @@ -148,10 +148,10 @@ return true; } -#define lit(s, literal) str(s, literal, sizeof(literal) - 1) +#define scanner_lit(s, literal) scanner_str(s, literal, sizeof(literal) - 1) static inline bool -buf_append(struct scanner *s, char ch) +scanner_buf_append(struct scanner *s, char ch) { if (s->buf_pos + 1 >= sizeof(s->buf)) return false; @@ -160,7 +160,7 @@ } static inline bool -buf_appends(struct scanner *s, const char *str) +scanner_buf_appends(struct scanner *s, const char *str) { int ret; ret = snprintf(s->buf + s->buf_pos, sizeof(s->buf) - s->buf_pos, "%s", str); @@ -171,20 +171,20 @@ } static inline bool -oct(struct scanner *s, uint8_t *out) +scanner_oct(struct scanner *s, uint8_t *out) { int i; - for (i = 0, *out = 0; peek(s) >= '0' && peek(s) <= '7' && i < 3; i++) - *out = *out * 8 + next(s) - '0'; + for (i = 0, *out = 0; scanner_peek(s) >= '0' && scanner_peek(s) <= '7' && i < 3; i++) + *out = *out * 8 + scanner_next(s) - '0'; return i > 0; } static inline bool -hex(struct scanner *s, uint8_t *out) +scanner_hex(struct scanner *s, uint8_t *out) { int i; - for (i = 0, *out = 0; is_xdigit(peek(s)) && i < 2; i++) { - const char c = next(s); + for (i = 0, *out = 0; is_xdigit(scanner_peek(s)) && i < 2; i++) { + const char c = scanner_next(s); const char offset = (c >= '0' && c <= '9' ? '0' : c >= 'a' && c <= 'f' ? 'a' - 10 : 'A' - 10); *out = *out * 16 + c - offset;
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/utils.h -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/utils.h
Changed
@@ -31,13 +31,21 @@ #include <stdio.h> #include <string.h> #if HAVE_UNISTD_H -#include <unistd.h> +# include <unistd.h> #else /* Required on Windows where unistd.h doesn't exist */ -#define R_OK 4 /* Test for read permission. */ -#define W_OK 2 /* Test for write permission. */ -#define X_OK 1 /* Test for execute permission. */ -#define F_OK 0 /* Test for existence. */ +# define R_OK 4 /* Test for read permission. */ +# define W_OK 2 /* Test for write permission. */ +# define X_OK 1 /* Test for execute permission. */ +# define F_OK 0 /* Test for existence. */ +#endif + +#ifdef _MSC_VER +# include <direct.h> +# include <io.h> +# ifndef S_ISDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# endif #endif #include "darray.h"
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/xkbcomp/rules.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/xkbcomp/rules.c
Changed
@@ -86,49 +86,49 @@ { skip_more_whitespace_and_comments: /* Skip spaces. */ - while (chr(s, ' ') || chr(s, '\t') || chr(s, '\r')); + while (scanner_chr(s, ' ') || scanner_chr(s, '\t') || scanner_chr(s, '\r')); /* Skip comments. */ - if (lit(s, "//")) { - skip_to_eol(s); + if (scanner_lit(s, "//")) { + scanner_skip_to_eol(s); } /* New line. */ - if (eol(s)) { - while (eol(s)) next(s); + if (scanner_eol(s)) { + while (scanner_eol(s)) scanner_next(s); return TOK_END_OF_LINE; } /* Escaped line continuation. */ - if (chr(s, '\\')) { + if (scanner_chr(s, '\\')) { /* Optional \r. */ - chr(s, '\r'); - if (!eol(s)) { + scanner_chr(s, '\r'); + if (!scanner_eol(s)) { scanner_err(s, "illegal new line escape; must appear at end of line"); return TOK_ERROR; } - next(s); + scanner_next(s); goto skip_more_whitespace_and_comments; } /* See if we're done. */ - if (eof(s)) return TOK_END_OF_FILE; + if (scanner_eof(s)) return TOK_END_OF_FILE; /* New token. */ s->token_line = s->line; s->token_column = s->column; /* Operators and punctuation. */ - if (chr(s, '!')) return TOK_BANG; - if (chr(s, '=')) return TOK_EQUALS; - if (chr(s, '*')) return TOK_STAR; + if (scanner_chr(s, '!')) return TOK_BANG; + if (scanner_chr(s, '=')) return TOK_EQUALS; + if (scanner_chr(s, '*')) return TOK_STAR; /* Group name. */ - if (chr(s, '$')) { + if (scanner_chr(s, '$')) { val->string.start = s->s + s->pos; val->string.len = 0; - while (is_ident(peek(s))) { - next(s); + while (is_ident(scanner_peek(s))) { + scanner_next(s); val->string.len++; } if (val->string.len == 0) { @@ -139,15 +139,15 @@ } /* Include statement. */ - if (lit(s, "include")) + if (scanner_lit(s, "include")) return TOK_INCLUDE; /* Identifier. */ - if (is_ident(peek(s))) { + if (is_ident(scanner_peek(s))) { val->string.start = s->s + s->pos; val->string.len = 0; - while (is_ident(peek(s))) { - next(s); + while (is_ident(scanner_peek(s))) { + scanner_next(s); val->string.len++; } return TOK_IDENTIFIER; @@ -376,46 +376,46 @@ return; } - while (!eof(&s) && !eol(&s)) { - if (chr(&s, '%')) { - if (chr(&s, '%')) { - buf_append(&s, '%'); + while (!scanner_eof(&s) && !scanner_eol(&s)) { + if (scanner_chr(&s, '%')) { + if (scanner_chr(&s, '%')) { + scanner_buf_append(&s, '%'); } - else if (chr(&s, 'H')) { - const char *home = secure_getenv("HOME"); + else if (scanner_chr(&s, 'H')) { + const char *home = xkb_context_getenv(m->ctx, "HOME"); if (!home) { scanner_err(&s, "%%H was used in an include statement, but the HOME environment variable is not set"); return; } - if (!buf_appends(&s, home)) { + if (!scanner_buf_appends(&s, home)) { scanner_err(&s, "include path after expanding %%H is too long"); return; } } - else if (chr(&s, 'S')) { + else if (scanner_chr(&s, 'S')) { const char *default_root = xkb_context_include_path_get_system_path(m->ctx); - if (!buf_appends(&s, default_root) || !buf_appends(&s, "/rules")) { + if (!scanner_buf_appends(&s, default_root) || !scanner_buf_appends(&s, "/rules")) { scanner_err(&s, "include path after expanding %%S is too long"); return; } } - else if (chr(&s, 'E')) { + else if (scanner_chr(&s, 'E')) { const char *default_root = xkb_context_include_path_get_extra_path(m->ctx); - if (!buf_appends(&s, default_root) || !buf_appends(&s, "/rules")) { + if (!scanner_buf_appends(&s, default_root) || !scanner_buf_appends(&s, "/rules")) { scanner_err(&s, "include path after expanding %%E is too long"); return; } } else { - scanner_err(&s, "unknown %% format (%c) in include statement", peek(&s)); + scanner_err(&s, "unknown %% format (%c) in include statement", scanner_peek(&s)); return; } } else { - buf_append(&s, next(&s)); + scanner_buf_append(&s, scanner_next(&s)); } } - if (!buf_append(&s, '\0')) { + if (!scanner_buf_append(&s, '\0')) { scanner_err(&s, "include path is too long"); return; }
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/src/xkbcomp/scanner.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/src/xkbcomp/scanner.c
Changed
@@ -34,14 +34,14 @@ const char *start = s->s + s->pos; char *end; - if (lit(s, "0x")) { - while (is_xdigit(peek(s))) next(s); + if (scanner_lit(s, "0x")) { + while (is_xdigit(scanner_peek(s))) scanner_next(s); is_hex = true; } else { - while (is_digit(peek(s))) next(s); - is_float = chr(s, '.'); - while (is_digit(peek(s))) next(s); + while (is_digit(scanner_peek(s))) scanner_next(s); + is_float = scanner_chr(s, '.'); + while (is_digit(scanner_peek(s))) scanner_next(s); } if (s->s + s->pos == start) return false; @@ -69,16 +69,16 @@ skip_more_whitespace_and_comments: /* Skip spaces. */ - while (is_space(peek(s))) next(s); + while (is_space(scanner_peek(s))) scanner_next(s); /* Skip comments. */ - if (lit(s, "//") || chr(s, '#')) { - skip_to_eol(s); + if (scanner_lit(s, "//") || scanner_chr(s, '#')) { + scanner_skip_to_eol(s); goto skip_more_whitespace_and_comments; } /* See if we're done. */ - if (eof(s)) return END_OF_FILE; + if (scanner_eof(s)) return END_OF_FILE; /* New token. */ s->token_line = s->line; @@ -86,28 +86,28 @@ s->buf_pos = 0; /* String literal. */ - if (chr(s, '\"')) { - while (!eof(s) && !eol(s) && peek(s) != '\"') { - if (chr(s, '\\')) { + if (scanner_chr(s, '\"')) { + while (!scanner_eof(s) && !scanner_eol(s) && scanner_peek(s) != '\"') { + if (scanner_chr(s, '\\')) { uint8_t o; - if (chr(s, '\\')) buf_append(s, '\\'); - else if (chr(s, 'n')) buf_append(s, '\n'); - else if (chr(s, 't')) buf_append(s, '\t'); - else if (chr(s, 'r')) buf_append(s, '\r'); - else if (chr(s, 'b')) buf_append(s, '\b'); - else if (chr(s, 'f')) buf_append(s, '\f'); - else if (chr(s, 'v')) buf_append(s, '\v'); - else if (chr(s, 'e')) buf_append(s, '\033'); - else if (oct(s, &o)) buf_append(s, (char) o); + if (scanner_chr(s, '\\')) scanner_buf_append(s, '\\'); + else if (scanner_chr(s, 'n')) scanner_buf_append(s, '\n'); + else if (scanner_chr(s, 't')) scanner_buf_append(s, '\t'); + else if (scanner_chr(s, 'r')) scanner_buf_append(s, '\r'); + else if (scanner_chr(s, 'b')) scanner_buf_append(s, '\b'); + else if (scanner_chr(s, 'f')) scanner_buf_append(s, '\f'); + else if (scanner_chr(s, 'v')) scanner_buf_append(s, '\v'); + else if (scanner_chr(s, 'e')) scanner_buf_append(s, '\033'); + else if (scanner_oct(s, &o)) scanner_buf_append(s, (char) o); else { scanner_warn(s, "unknown escape sequence in string literal"); /* Ignore. */ } } else { - buf_append(s, next(s)); + scanner_buf_append(s, scanner_next(s)); } } - if (!buf_append(s, '\0') || !chr(s, '\"')) { + if (!scanner_buf_append(s, '\0') || !scanner_chr(s, '\"')) { scanner_err(s, "unterminated string literal"); return ERROR_TOK; } @@ -118,10 +118,10 @@ } /* Key name literal. */ - if (chr(s, '<')) { - while (is_graph(peek(s)) && peek(s) != '>') - buf_append(s, next(s)); - if (!buf_append(s, '\0') || !chr(s, '>')) { + if (scanner_chr(s, '<')) { + while (is_graph(scanner_peek(s)) && scanner_peek(s) != '>') + scanner_buf_append(s, scanner_next(s)); + if (!scanner_buf_append(s, '\0') || !scanner_chr(s, '>')) { scanner_err(s, "unterminated key name literal"); return ERROR_TOK; } @@ -131,29 +131,29 @@ } /* Operators and punctuation. */ - if (chr(s, ';')) return SEMI; - if (chr(s, '{')) return OBRACE; - if (chr(s, '}')) return CBRACE; - if (chr(s, '=')) return EQUALS; - if (chr(s, '')) return OBRACKET; - if (chr(s, '')) return CBRACKET; - if (chr(s, '(')) return OPAREN; - if (chr(s, ')')) return CPAREN; - if (chr(s, '.')) return DOT; - if (chr(s, ',')) return COMMA; - if (chr(s, '+')) return PLUS; - if (chr(s, '-')) return MINUS; - if (chr(s, '*')) return TIMES; - if (chr(s, '/')) return DIVIDE; - if (chr(s, '!')) return EXCLAM; - if (chr(s, '~')) return INVERT; + if (scanner_chr(s, ';')) return SEMI; + if (scanner_chr(s, '{')) return OBRACE; + if (scanner_chr(s, '}')) return CBRACE; + if (scanner_chr(s, '=')) return EQUALS; + if (scanner_chr(s, '')) return OBRACKET; + if (scanner_chr(s, '')) return CBRACKET; + if (scanner_chr(s, '(')) return OPAREN; + if (scanner_chr(s, ')')) return CPAREN; + if (scanner_chr(s, '.')) return DOT; + if (scanner_chr(s, ',')) return COMMA; + if (scanner_chr(s, '+')) return PLUS; + if (scanner_chr(s, '-')) return MINUS; + if (scanner_chr(s, '*')) return TIMES; + if (scanner_chr(s, '/')) return DIVIDE; + if (scanner_chr(s, '!')) return EXCLAM; + if (scanner_chr(s, '~')) return INVERT; /* Identifier. */ - if (is_alpha(peek(s)) || peek(s) == '_') { + if (is_alpha(scanner_peek(s)) || scanner_peek(s) == '_') { s->buf_pos = 0; - while (is_alnum(peek(s)) || peek(s) == '_') - buf_append(s, next(s)); - if (!buf_append(s, '\0')) { + while (is_alnum(scanner_peek(s)) || scanner_peek(s) == '_') + scanner_buf_append(s, scanner_next(s)); + if (!scanner_buf_append(s, '\0')) { scanner_err(s, "identifier too long"); return ERROR_TOK; }
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/test/common.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/test/common.c
Changed
@@ -34,6 +34,7 @@ #include <limits.h> #include <fcntl.h> +#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #ifdef _MSC_VER @@ -163,6 +164,52 @@ } char * +test_makedir(const char *parent, const char *path) +{ + char *dirname; + int err; + + dirname = asprintf_safe("%s/%s", parent, path); + assert(dirname); +#ifdef _MSC_VER + err = _mkdir(dirname); +#else + err = mkdir(dirname, 0777); +#endif + assert(err == 0); + + return dirname; +} + +char * +test_maketempdir(const char *template) +{ +#ifdef _MSC_VER + const char *basetmp = getenv("TMP"); + if (basetmp == NULL) { + basetmp = getenv("TEMP"); + } + if (basetmp == NULL) { + basetmp = getenv("top_builddir"); + } + assert(basetmp != NULL); + char *tmpdir = asprintf_safe("%s/%s", basetmp, template); + assert(tmpdir != NULL); + char *tmp = _mktemp(tmpdir); + assert(tmp == tmpdir); + int ret = _mkdir(tmp); + assert(ret == 0); + return tmpdir; +#else + char *tmpdir = asprintf_safe("/tmp/%s", template); + assert(tmpdir != NULL); + char *tmp = mkdtemp(tmpdir); + assert(tmp == tmpdir); + return tmpdir; +#endif +} + +char * test_get_path(const char *path_rel) { char *path;
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/test/compose.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/test/compose.c
Changed
@@ -560,6 +560,26 @@ free(table_string); } +static void +test_override(struct xkb_context *ctx) +{ + const char *table_string = "<dead_circumflex> <dead_circumflex> : \"foo\" X\n" + "<dead_circumflex> <e> : \"bar\" Y\n" + "<dead_circumflex> <dead_circumflex> <e> : \"baz\" Z\n"; + + assert(test_compose_seq_buffer(ctx, table_string, + /* Comes after - does override. */ + XKB_KEY_dead_circumflex, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSING, "", XKB_KEY_NoSymbol, + XKB_KEY_dead_circumflex, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSING, "", XKB_KEY_NoSymbol, + XKB_KEY_e, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSED, "baz", XKB_KEY_Z, + + /* Override does not affect sibling nodes */ + XKB_KEY_dead_circumflex, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSING, "", XKB_KEY_NoSymbol, + XKB_KEY_e, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSED, "bar", XKB_KEY_Y, + + XKB_KEY_NoSymbol)); +} + int main(int argc, char *argv) { @@ -575,6 +595,7 @@ test_state(ctx); test_modifier_syntax(ctx); test_include(ctx); + test_override(ctx); xkb_context_unref(ctx); return 0;
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/test/context.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/test/context.c
Changed
@@ -30,15 +30,6 @@ #include <sys/stat.h> #include <sys/types.h> -#ifdef _MSC_VER -# include <io.h> -# include <direct.h> -# ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# endif -#else -# include <unistd.h> -#endif /* keeps a cache of all makedir/maketmpdir directories so we can free and * rmdir them in one go, see unmakedirs() */ @@ -82,29 +73,15 @@ static const char *makedir(const char *parent, const char *path) { - char *dirname; - int err; - - dirname = asprintf_safe("%s/%s", parent, path); - assert(dirname); - err = mkdir(dirname, 0777); - assert(err == 0); - + char *dirname = test_makedir(parent, path); dirnamesndirs++ = dirname; - return dirname; } static const char *maketmpdir(void) { - const char *template = "/tmp/xkbcommon-test.XXXXXX"; - char *tmpdir = strdup(template); - - tmpdir = mkdtemp(tmpdir); - assert(tmpdir != NULL); - + char *tmpdir = test_maketempdir("xkbcommon-test.XXXXXX"); dirnamesndirs++ = tmpdir; - return tmpdir; }
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/test/keysym.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/test/keysym.c
Changed
@@ -252,6 +252,7 @@ assert(test_utf32_to_keysym(0xd7, XKB_KEY_multiply)); assert(test_utf32_to_keysym('-', XKB_KEY_minus)); assert(test_utf32_to_keysym(0x10fffd, 0x110fffd)); + assert(test_utf32_to_keysym(0x20ac, XKB_KEY_EuroSign)); // Unicode non-characters assert(test_utf32_to_keysym(0xfdd0, XKB_KEY_NoSymbol));
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/test/registry.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/test/registry.c
Changed
@@ -35,6 +35,7 @@ #include "xkbcommon/xkbregistry.h" #include "utils.h" +#include "test.h" #define NO_VARIANT NULL @@ -56,6 +57,8 @@ const char *variant; const char *brief; const char *description; + const char *iso6393; /* language list (iso639 three letter codes), 3 is enough for our test */ + const char *iso31663; /* country list (iso3166 two letter codes), 3 is enough for our tests */ }; struct test_option { @@ -76,7 +79,9 @@ const char *name, const char *vendor, const char *brief, - const char *description) + const char *description, + const char * const iso6393, + const char * const iso31663) { fprintf(fp, " <configItem>\n" " <name>%s</name>\n", name); @@ -86,6 +91,27 @@ fprintf(fp, " <description>%s</description>\n", description); if (vendor) fprintf(fp, " <vendor>%s</vendor>\n", vendor); + if (iso3166 && iso31660) { + fprintf(fp, " <countryList>\n"); + for (int i = 0; i < 3; i++) { + const char *iso = iso3166i; + if (!iso) + break; + fprintf(fp, " <iso3166Id>%s</iso3166Id>\n", iso); + } + fprintf(fp, " </countryList>\n"); + } + if (iso639 && iso6390) { + fprintf(fp, " <languageList>\n"); + for (int i = 0; i < 3; i++) { + const char *iso = iso639i; + if (!iso) + break; + fprintf(fp, " <iso639Id>%s</iso639Id>\n", iso); + } + fprintf(fp, " </languageList>\n"); + } + fprintf(fp, " </configItem>\n"); } @@ -107,14 +133,13 @@ int rc; FILE *fp; - tmpdir = asprintf_safe("/tmp/%s.%d.XXXXXX", ruleset, iteration++); - assert(tmpdir); - assert(mkdtemp(tmpdir) == tmpdir); + char *template = asprintf_safe("%s.%d.XXXXXX", ruleset, iteration++); + assert(template != NULL); + tmpdir = test_maketempdir(template); + free(template); + + free(test_makedir(tmpdir, "rules")); - rc = snprintf_safe(buf, sizeof(buf), "%s/rules", tmpdir); - assert(rc); - rc = mkdir(buf, 0777); - assert(rc == 0); rc = snprintf_safe(buf, sizeof(buf), "%s/rules/%s.xml", tmpdir, ruleset); assert(rc); @@ -131,7 +156,7 @@ for (const struct test_model *m = test_models; m->name; m++) { fprintf(fp, "<model>\n"); - fprint_config_item(fp, m->name, m->vendor, NULL, m->description); + fprint_config_item(fp, m->name, m->vendor, NULL, m->description, NULL, NULL); fprintf(fp, "</model>\n"); } fprintf(fp, "</modelList>\n"); @@ -149,14 +174,13 @@ while (l->name) { fprintf(fp, "<layout>\n"); - fprint_config_item(fp, l->name, NULL, l->brief, l->description); + fprint_config_item(fp, l->name, NULL, l->brief, l->description, l->iso639, l->iso3166); if (next->name && streq(next->name, l->name)) { fprintf(fp, "<variantList>\n"); do { fprintf(fp, "<variant>\n"); - fprint_config_item(fp, next->variant, NULL, next->brief, - next->description); + fprint_config_item(fp, next->variant, NULL, next->brief, next->description, next->iso639, next->iso3166); fprintf(fp, "</variant>\n"); l = next; next++; @@ -175,10 +199,10 @@ for (const struct test_option_group *g = test_groups; g->name; g++) { fprintf(fp, "<group allowMultipleSelection=\"%s\">\n", g->allow_multiple_selection ? "true" : "false"); - fprint_config_item(fp, g->name, NULL, NULL, g->description); + fprint_config_item(fp, g->name, NULL, NULL, g->description, NULL, NULL); for (const struct test_option *o = g->options; o->name; o++) { fprintf(fp, " <option>\n"); - fprint_config_item(fp, o->name, NULL, NULL, o->description); + fprint_config_item(fp, o->name, NULL, NULL, o->description, NULL, NULL); fprintf(fp, "</option>\n"); } fprintf(fp, "</group>\n"); @@ -443,6 +467,9 @@ static bool cmp_layouts(struct test_layout *tl, struct rxkb_layout *l) { + struct rxkb_iso3166_code *iso3166 = NULL; + struct rxkb_iso639_code *iso639 = NULL; + if (!tl || !l) return false; @@ -458,6 +485,36 @@ if (!streq_null(tl->description, rxkb_layout_get_description(l))) return false; + iso3166 = rxkb_layout_get_iso3166_first(l); + for (size_t i = 0; i < sizeof(tl->iso3166); i++) { + const char *iso = tl->iso3166i; + if (iso == NULL && iso3166 == NULL) + break; + + if (!streq_null(iso, rxkb_iso3166_code_get_code(iso3166))) + return false; + + iso3166 = rxkb_iso3166_code_next(iso3166); + } + + if (iso3166 != NULL) + return false; + + iso639 = rxkb_layout_get_iso639_first(l); + for (size_t i = 0; i < sizeof(tl->iso639); i++) { + const char *iso = tl->iso639i; + if (iso == NULL && iso639 == NULL) + break; + + if (!streq_null(iso, rxkb_iso639_code_get_code(iso639))) + return false; + + iso639 = rxkb_iso639_code_next(iso639); + } + + if (iso639 != NULL) + return false; + return true; } @@ -563,6 +620,7 @@ struct test_layout system_layouts = { {"l1", NO_VARIANT, "lbrief1", "ldesc1"}, {"l1", "v1", "vbrief1", "vdesc1"}, + {"l1", "v2", NULL, "vdesc2"}, {NULL}, }; struct test_option_group system_groups = { @@ -597,6 +655,11 @@ assert(cmp_layouts(&system_layouts1, l)); rxkb_layout_unref(l); + l = fetch_layout(ctx, "l1", "v2"); + struct test_layout expected = {"l1", "v2", "lbrief1", "vdesc2"}; + assert(cmp_layouts(&expected, l)); + rxkb_layout_unref(l); + g = fetch_option_group(ctx, "grp1"); assert(cmp_option_groups(&system_groups0, g, CMP_EXACT)); rxkb_option_group_unref(g); @@ -609,6 +672,107 @@ } static void +test_load_languages(void) +{ + struct test_model system_models = { + {"m1", "vendor1", "desc1"}, + {NULL}, + }; + struct test_layout system_layouts = { + {"l1", NO_VARIANT, "lbrief1", "ldesc1", + .iso639 = { "abc", "def" }, + .iso3166 = { "uv", "wx" }}, + {"l1", "v1", "vbrief1", "vdesc1", + .iso639 = {"efg"}, + .iso3166 = {"yz"}},
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/test/test.h -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/test/test.h
Changed
@@ -54,6 +54,12 @@ test_key_seq_va(struct xkb_keymap *keymap, va_list args); char * +test_makedir(const char *parent, const char *path); + +char * +test_maketempdir(const char *template); + +char * test_get_path(const char *path_rel); char *
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/test/tool-option-parsing.py -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/test/tool-option-parsing.py
Changed
@@ -100,7 +100,7 @@ for testfunc, reason in self.skipError: if testfunc(rc, stdout, stderr): raise unittest.SkipTest(reason) - assert rc == 0, (stdout, stderr) + assert rc == 0, (rc, stdout, stderr) return stdout, stderr def run_command_invalid(self, args):
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/tools/interactive-wayland.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/tools/interactive-wayland.c
Changed
@@ -42,7 +42,7 @@ #include "xdg-shell-client-protocol.h" #include <wayland-util.h> -#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) struct interactive_dpy { struct wl_display *dpy; @@ -557,7 +557,7 @@ seat->global_name = name; seat->inter = inter; seat->wl_seat = wl_registry_bind(registry, name, &wl_seat_interface, - MAX(version, 5)); + MIN(version, 5)); wl_seat_add_listener(seat->wl_seat, &seat_listener, seat); ret = asprintf(&seat->name_str, "seat:%d", wl_proxy_get_id((struct wl_proxy *) seat->wl_seat)); @@ -607,17 +607,17 @@ else if (strcmp(interface, "xdg_wm_base") == 0) { inter->shell = wl_registry_bind(registry, name, &xdg_wm_base_interface, - MAX(version, 2)); + MIN(version, 2)); xdg_wm_base_add_listener(inter->shell, &shell_listener, inter); } else if (strcmp(interface, "wl_compositor") == 0) { inter->compositor = wl_registry_bind(registry, name, &wl_compositor_interface, - MAX(version, 1)); + MIN(version, 1)); } else if (strcmp(interface, "wl_shm") == 0) { inter->shm = wl_registry_bind(registry, name, &wl_shm_interface, - MAX(version, 1)); + MIN(version, 1)); } }
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/tools/registry-list.c -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/tools/registry-list.c
Changed
@@ -140,11 +140,12 @@ m = rxkb_model_first(ctx); assert(m); /* Empty model list is usually a bug or a bad xml file */ while (m) { + const char *vendor = rxkb_model_get_vendor(m); printf("- name: %s\n" " vendor: %s\n" " description: %s\n", rxkb_model_get_name(m), - rxkb_model_get_vendor(m), + vendor ? vendor : "''", rxkb_model_get_description(m)); m = rxkb_model_next(m); } @@ -159,12 +160,12 @@ const char *variant = rxkb_layout_get_variant(l); const char *brief = rxkb_layout_get_brief(l); - printf("- layout: %s\n" - " variant: %s\n" - " brief: %s\n" + printf("- layout: '%s'\n" + " variant: '%s'\n" + " brief: '%s'\n" " description: %s\n", rxkb_layout_get_name(l), - variant ? variant : "''", + variant ? variant : "", brief ? brief : "''", rxkb_layout_get_description(l)); @@ -173,7 +174,7 @@ if (iso639) { const char *sep = ""; while (iso639) { - printf("%s%s", sep, rxkb_iso639_code_get_code(iso639)); + printf("%s'%s'", sep, rxkb_iso639_code_get_code(iso639)); iso639 = rxkb_iso639_code_next(iso639); sep = ", "; } @@ -184,7 +185,7 @@ if (iso3166) { const char *sep = ""; while (iso3166) { - printf("%s%s", sep, rxkb_iso3166_code_get_code(iso3166)); + printf("%s'%s'", sep, rxkb_iso3166_code_get_code(iso3166)); iso3166 = rxkb_iso3166_code_next(iso3166); sep = ", "; } @@ -199,7 +200,7 @@ while (g) { struct rxkb_option *o; - printf("- name: %s\n" + printf("- name: '%s'\n" " description: %s\n" " allows_multiple: %s\n" " options:\n",
View file
_service:tar_scm:libxkbcommon-1.3.1.tar.xz/tools/xkbcli-list.1 -> _service:tar_scm:libxkbcommon-1.5.0.tar.xz/tools/xkbcli-list.1
Changed
@@ -1,4 +1,4 @@ -.Dd July 27, 2020 +.Dd November 1, 2021 .Dt XKBCLI\-LIST 1 .Os . @@ -11,11 +11,11 @@ .Op Pa /path/to/xkbbase Oo Pa /path/to/xkbbase Oc ... . .Sh DESCRIPTION -.Nm -is a commandline tool to list available model, layout, variant and option (MLVO) values from the XKB registry. +List available model, layout, variant and option (MLVO) values from the XKB registry. +The output is in YAML 1.2 format. . .Pp -Positional arguments provided on the commandline are treated as XKB base directory installations. +Positional arguments are treated as XKB base directory installations. . .Bl -tag -width Ds .It Fl \-help
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2