Projects
Multimedia
ncmpc
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 14
View file
ncmpc.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri May 12 05:43:37 UTC 2023 - Muhammad Akbar Yanuar Mantari <mantarimay@pm.me> + +- Update to version 0.48 + +------------------------------------------------------------------- Fri Jan 13 20:20:20 UTC 2023 - olaf@aepfle.de - Update to version 0.47
View file
ncmpc.spec
Changed
@@ -17,7 +17,7 @@ Name: ncmpc -Version: 0.47 +Version: 0.48 Release: 0 Summary: Curses Client for the Music Player Daemon License: GPL-2.0-or-later
View file
ncmpc-0.47.tar.xz/src/event/IdleEvent.cxx
Deleted
@@ -1,20 +0,0 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "IdleEvent.hxx"
View file
ncmpc-0.47.tar.xz/src/util/Compiler.h
Deleted
@@ -1,174 +0,0 @@ -/* - * Copyright (C) 2003-2013 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef COMPILER_H -#define COMPILER_H - -#define GCC_MAKE_VERSION(major, minor, patchlevel) ((major) * 10000 + (minor) * 100 + patchlevel) - -#ifdef __GNUC__ -# define GCC_VERSION GCC_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) -#else -# define GCC_VERSION 0 -#endif - -#ifdef __clang__ -# define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) -#else -# define CLANG_VERSION 0 -#endif - -/** - * Are we building with the specified version of gcc (not clang or any - * other compiler) or newer? - */ -#define GCC_CHECK_VERSION(major, minor) \ - (!CLANG_VERSION && \ - GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) - -/** - * Are we building with clang (any version) or at least the specified - * gcc version? - */ -#define CLANG_OR_GCC_VERSION(major, minor) \ - (CLANG_VERSION || GCC_CHECK_VERSION(major, minor)) - -/** - * Are we building with gcc (not clang or any other compiler) and a - * version older than the specified one? - */ -#define GCC_OLDER_THAN(major, minor) \ - (GCC_VERSION && !CLANG_VERSION && \ - GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0)) - -#if CLANG_OR_GCC_VERSION(4,0) - -/* GCC 4.x */ - -#define gcc_const __attribute__((const)) -#define gcc_deprecated __attribute__((deprecated)) -#define gcc_may_alias __attribute__((may_alias)) -#define gcc_malloc __attribute__((malloc)) -#define gcc_noreturn __attribute__((noreturn)) -#define gcc_packed __attribute__((packed)) -#define gcc_printf(a,b) __attribute__((format(printf, a, b))) -#define gcc_pure __attribute__((pure)) -#define gcc_sentinel __attribute__((sentinel)) -#define gcc_unused __attribute__((unused)) -#define gcc_warn_unused_result __attribute__((warn_unused_result)) - -#define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__))) -#define gcc_nonnull_all __attribute__((nonnull)) -#define gcc_returns_nonnull __attribute__((returns_nonnull)) - -#define gcc_likely(x) __builtin_expect (!!(x), 1) -#define gcc_unlikely(x) __builtin_expect (!!(x), 0) - -#define gcc_aligned(n) __attribute__((aligned(n))) - -#define gcc_visibility_hidden __attribute__((visibility("hidden"))) -#define gcc_visibility_default __attribute__((visibility("default"))) - -#define gcc_always_inline __attribute__((always_inline)) - -#else - -/* generic C compiler */ - -#define gcc_const -#define gcc_deprecated -#define gcc_may_alias -#define gcc_malloc -#define gcc_noreturn -#define gcc_packed -#define gcc_printf(a,b) -#define gcc_pure -#define gcc_sentinel -#define gcc_unused -#define gcc_warn_unused_result - -#define gcc_nonnull(...) -#define gcc_nonnull_all -#define gcc_returns_nonnull - -#define gcc_likely(x) (x) -#define gcc_unlikely(x) (x) - -#define gcc_aligned(n) - -#define gcc_visibility_hidden -#define gcc_visibility_default - -#define gcc_always_inline inline - -#endif - -#if CLANG_OR_GCC_VERSION(4,3) - -#define gcc_hot __attribute__((hot)) -#define gcc_cold __attribute__((cold)) - -#else /* ! GCC_UNUSED >= 40300 */ - -#define gcc_hot -#define gcc_cold - -#endif /* ! GCC_UNUSED >= 40300 */ - -#if GCC_CHECK_VERSION(4,6) -#define gcc_flatten __attribute__((flatten)) -#else -#define gcc_flatten -#endif - -#ifndef __cplusplus -/* plain C99 has "restrict" */ -#define gcc_restrict restrict -#elif CLANG_OR_GCC_VERSION(4,0) -/* "__restrict__" is a GCC extension for C++ */ -#define gcc_restrict __restrict__ -#else -/* disable it on other compilers */ -#define gcc_restrict -#endif - -/* C++11 features */ - -#if defined(__cplusplus) - -#endif - -#ifndef __has_feature - // define dummy macro for non-clang compilers - #define __has_feature(x) 0 -#endif - -#if __has_feature(attribute_unused_on_fields) -#define gcc_unused_field gcc_unused -#else -#define gcc_unused_field -#endif - -#if defined(__GNUC__) || defined(__clang__) -#define gcc_unreachable() __builtin_unreachable() -#else -#define gcc_unreachable() -#endif - -#endif
View file
ncmpc-0.47.tar.xz/.github/workflows/build.yml -> ncmpc-0.48.tar.xz/.github/workflows/build.yml
Changed
@@ -1,4 +1,5 @@ --- +name: CI on: workflow_dispatch: push: @@ -16,9 +17,28 @@ branches: - master +permissions: + contents: read # to fetch code (actions/checkout) + jobs: build-linux: - runs-on: ubuntu-latest + strategy: + matrix: + os: ubuntu-22.04, ubuntu-20.04 + include: + - os: ubuntu-22.04 + cc: gcc-11 + cxx: g++-11 + - os: ubuntu-20.04 + cc: gcc-10 + cxx: g++-10 + + runs-on: ${{ matrix.os }} + + env: + CC: ccache ${{ matrix.cc }} + CXX: ccache ${{ matrix.cxx }} + steps: - id: checkout uses: actions/checkout@v3 @@ -26,12 +46,14 @@ - id: cache-ccache uses: hendrikmuhs/ccache-action@v1 with: - key: linux + key: ${{ matrix.os }} - name: Install dependencies run: | + sudo apt-get update sudo apt-get install -y --no-install-recommends \ meson \ + ${{ matrix.cxx }} ${{matrix.cc }} \ libncursesw5-dev \ libncurses5-dev \ libpcre2-dev \ @@ -49,7 +71,7 @@ with: action: build directory: output/mini - setup-options: -Ddocumentation=disabled -Dbuildtype=minsize -Db_ndebug=true -Db_lto=true -Dauto_features=disabled -Dcurses=ncurses -Dcolors=false -Dmultibyte=false -Dtcp=false -Dasync_connect=false -Dmini=true + setup-options: -Ddocumentation=disabled -Dbuildtype=minsize -Db_ndebug=true -Db_lto=true -Dauto_features=disabled -Dcurses=ncurses -Dcolors=false -Dmultibyte=false -Dasync_connect=false -Dmini=true build-macos: runs-on: macos-latest @@ -74,9 +96,16 @@ pcre2 \ libmpdclient - - name: Meson Build + - name: Full Build uses: BSFishy/meson-build@v1.0.3 with: action: build - directory: output + directory: output/full setup-options: -Ddocumentation=disabled -Dlyrics_screen=true -Dchat_screen=true + + - name: Mini Build + uses: BSFishy/meson-build@v1.0.3 + with: + action: build + directory: output/mini + setup-options: -Ddocumentation=disabled -Dbuildtype=minsize -Db_ndebug=true -Db_lto=true -Dauto_features=disabled -Dcurses=ncurses -Dcolors=false -Dmultibyte=false -Dasync_connect=false -Dmini=true
View file
ncmpc-0.47.tar.xz/NEWS -> ncmpc-0.48.tar.xz/NEWS
Changed
@@ -1,3 +1,8 @@ +ncmpc 0.48 - (2023-04-06) +* drop support for ~/.ncmpc/; using only ~/.config/ncmpc/ (XDG) +* improve scroll-offset handling +* experimental table layout + ncmpc 0.47 - (2022-06-30) * handle Ctrl-C in search prompt * link with libintl and libiconv if necessary
View file
ncmpc-0.47.tar.xz/README.rst -> ncmpc-0.48.tar.xz/README.rst
Changed
@@ -13,10 +13,10 @@ You need: -- a C++17 compliant compiler (e.g. gcc or clang) +- a C++20 compliant compiler (e.g. gcc or clang) - `libmpdclient <https://www.musicpd.org/libs/libmpdclient/>`__ 2.16 - `ncurses <https://www.gnu.org/software/ncurses/>`__ -- `Meson 0.47 <http://mesonbuild.com/>`__ and `Ninja <https://ninja-build.org/>`__ +- `Meson 0.49 <http://mesonbuild.com/>`__ and `Ninja <https://ninja-build.org/>`__ Optional:
View file
ncmpc-0.47.tar.xz/doc/conf.py -> ncmpc-0.48.tar.xz/doc/conf.py
Changed
@@ -38,7 +38,7 @@ # built documents. # # The short X.Y version. -version = '0.47' +version = '0.48' # The full version, including alpha/beta/rc tags. release = version
View file
ncmpc-0.47.tar.xz/doc/index.rst -> ncmpc-0.48.tar.xz/doc/index.rst
Changed
@@ -369,6 +369,28 @@ "%artist%|(artist n/a) - %title%|(title n/a)" +Tables +------ + +As an experimental feature, the queue can be displayed as a table. +Beware, this feature is really experimental, and future versions may +do incompatible changes. + +To configure this, add columns to the configuration file, e.g.:: + + song-table-column = "Artist" "%artist%|%name%|%file%" min=20 fraction=2 + song-table-column = "Title" "%title%" min=20 fraction=2 + song-table-column = "Album" "%album%" min=10 fraction=1 + song-table-column = "Time" "%time%" min=8 fraction=0 + +Each column has a caption, a format string specifying what is being +displayed, a minimum width (in terminal cells) and a fraction +specifying how much of excess width will be assigned to this column. + +In the above example, the "Time" column will have a fixed width of 8 +because ``fraction=0``. + + Chat Protocol -------------
View file
ncmpc-0.47.tar.xz/lyrics/20-azlyrics.py -> ncmpc-0.48.tar.xz/lyrics/20-azlyrics.py
Changed
@@ -1,22 +1,7 @@ -#!/usr/bin/python3 -# -# Copyright 2004-2021 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#!/usr/bin/env python3 # +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright The Music Player Daemon Project # # Load lyrics from azlyrics.com if lyrics weren't found in the lyrics directory
View file
ncmpc-0.47.tar.xz/lyrics/30-karaoke_texty.py -> ncmpc-0.48.tar.xz/lyrics/30-karaoke_texty.py
Changed
@@ -1,22 +1,7 @@ -#!/usr/bin/python3 -# -# Copyright 2004-2021 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#!/usr/bin/env python3 # +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright The Music Player Daemon Project # # Load lyrics from karaoketexty.sk if lyrics weren't found in the lyrics directory
View file
ncmpc-0.47.tar.xz/lyrics/40-tekstowo.py -> ncmpc-0.48.tar.xz/lyrics/40-tekstowo.py
Changed
@@ -1,22 +1,7 @@ -#!/usr/bin/python3 -# -# Copyright 2004-2021 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#!/usr/bin/env python3 # +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright The Music Player Daemon Project # # Load lyrics from tekstowo.pl if lyrics weren't found in the lyrics directory
View file
ncmpc-0.47.tar.xz/lyrics/50-genius.py -> ncmpc-0.48.tar.xz/lyrics/50-genius.py
Changed
@@ -1,22 +1,7 @@ -#!/usr/bin/python3 -# -# Copyright 2004-2021 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#!/usr/bin/env python3 # +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright The Music Player Daemon Project # # Load lyrics from genius.com if lyrics weren't found in the lyrics directory
View file
ncmpc-0.47.tar.xz/lyrics/51-supermusic.py -> ncmpc-0.48.tar.xz/lyrics/51-supermusic.py
Changed
@@ -1,22 +1,7 @@ -#!/usr/bin/python3 -# -# Copyright 2004-2021 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#!/usr/bin/env python3 # +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright The Music Player Daemon Project # # Load lyrics from supermusic.cz if lyrics weren't found in the lyrics directory
View file
ncmpc-0.47.tar.xz/lyrics/52-zeneszoveg.py -> ncmpc-0.48.tar.xz/lyrics/52-zeneszoveg.py
Changed
@@ -1,22 +1,7 @@ -#!/usr/bin/python3 -# -# Copyright 2004-2021 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#!/usr/bin/env python3 # +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright The Music Player Daemon Project # # Load lyrics from zeneszoveg.hu if lyrics weren't found in the lyrics directory
View file
ncmpc-0.47.tar.xz/lyrics/60-google.py -> ncmpc-0.48.tar.xz/lyrics/60-google.py
Changed
@@ -1,22 +1,7 @@ -#!/usr/bin/python3 -# -# Copyright 2004-2021 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#!/usr/bin/env python3 # +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright The Music Player Daemon Project # # Load lyrics from google.com if lyrics weren't found in the lyrics directory
View file
ncmpc-0.47.tar.xz/meson.build -> ncmpc-0.48.tar.xz/meson.build
Changed
@@ -1,5 +1,5 @@ project('ncmpc', 'cpp', - version: '0.47', + version: '0.48', meson_version: '>= 0.49', default_options: 'cpp_std=c++2a', @@ -209,6 +209,12 @@ is_windows = host_machine.system() == 'windows' thread_dep = dependency('threads') + +m_dep = +if not mini + m_dep = cc.find_library('m', required: false) +endif + libmpdclient_dep = dependency('libmpdclient', version: '>= 2.16') if not mini @@ -252,6 +258,9 @@ 'src/hscroll.cxx', 'src/ConfigFile.cxx', 'src/ConfigParser.cxx', + 'src/TableLayout.cxx', + 'src/TablePaint.cxx', + 'src/TableGlue.cxx', if host_machine.system() != 'windows' @@ -441,6 +450,7 @@ pcre_dep, intl_dep, iconv_dep, + m_dep, curses_dep, lirc_dep, libmpdclient_dep,
View file
ncmpc-0.47.tar.xz/po/he.po -> ncmpc-0.48.tar.xz/po/he.po
Changed
@@ -3,7 +3,7 @@ "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-08-24 15:23+0200\n" -"PO-Revision-Date: 2021-11-08 13:50+0000\n" +"PO-Revision-Date: 2022-10-17 00:55+0000\n" "Last-Translator: Yaron Shahrabani <sh.yaron@gmail.com>\n" "Language-Team: Hebrew <https://hosted.weblate.org/projects/ncmpc/" "translations/he/>\n" @@ -13,7 +13,7 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && " "n % 10 == 0) ? 2 : 3));\n" -"X-Generator: Weblate 4.9-dev\n" +"X-Generator: Weblate 4.15-dev\n" "X-Launchpad-Export-Date: 2010-09-07 18:28+0000\n" #: src/Bindings.cxx:80 src/Bindings.cxx:86 @@ -525,9 +525,8 @@ msgstr "הסר שוני מקשים" #: src/HelpPage.cxx:215 -#, fuzzy msgid "Add a keydef" -msgstr "הוסף מקש חדש" +msgstr "הוספת שוני מקשים" #: src/HelpPage.cxx:216 msgid "Go up a level" @@ -801,7 +800,7 @@ #: src/OutputsPage.cxx:168 #, c-format msgid "Switched to partition '%s'" -msgstr "" +msgstr "עברת למחיצה ‚%s’" #: src/OutputsPage.cxx:180 src/SongPage.cxx:69 msgid "Name"
View file
ncmpc-0.47.tar.xz/po/ko.po -> ncmpc-0.48.tar.xz/po/ko.po
Changed
@@ -8,8 +8,8 @@ "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-08-24 15:23+0200\n" -"PO-Revision-Date: 2020-10-10 15:26+0000\n" -"Last-Translator: Min Ho Park <parkmino@gmail.com>\n" +"PO-Revision-Date: 2022-09-30 08:16+0000\n" +"Last-Translator: 이정희 <daemul72@gmail.com>\n" "Language-Team: Korean <https://hosted.weblate.org/projects/ncmpc/" "translations/ko/>\n" "Language: ko\n" @@ -17,7 +17,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.3-dev\n" +"X-Generator: Weblate 4.14.1\n" "X-Launchpad-Export-Date: 2009-10-19 13:36+0000\n" #: src/Bindings.cxx:80 src/Bindings.cxx:86 @@ -707,7 +707,7 @@ #: src/LibraryPage.cxx:45 msgid "Artists" -msgstr "연주가" +msgstr "아티스트" #: src/LibraryPage.cxx:48 src/LibraryPage.cxx:175 msgid "Albums" @@ -752,7 +752,7 @@ #. while data is retrieved #: src/LyricsPage.cxx:356 msgid "loading..." -msgstr "읽는 중..." +msgstr "불러오는 중..." #: src/LyricsPage.cxx:378 msgid "Editor not configured" @@ -773,15 +773,15 @@ #. lyrics for the song were saved on hard disk #: src/LyricsPage.cxx:456 msgid "Lyrics saved" -msgstr "가사 저장" +msgstr "가사 저장됨" #: src/LyricsPage.cxx:462 msgid "Lyrics deleted" -msgstr "가사 지움" +msgstr "가사 삭제됨" #: src/LyricsPage.cxx:463 msgid "No saved lyrics" -msgstr "저장된 가사가 없음" +msgstr "저장된 가사 없음" #: src/Main.cxx:133 #, c-format @@ -797,12 +797,12 @@ #. when ncmpc is started with "--version" #: src/Options.cxx:216 src/Options.cxx:219 msgid "translator-credits" -msgstr "번역자-기여" +msgstr "이정희 <daemul72@gmail.com>" #: src/OutputsPage.cxx:168 #, c-format msgid "Switched to partition '%s'" -msgstr "'%s' 칸막이로 바꾸기" +msgstr "'%s' 칸막이로 전환됨" #: src/OutputsPage.cxx:180 src/SongPage.cxx:69 msgid "Name" @@ -811,12 +811,12 @@ #: src/OutputsPage.cxx:230 #, c-format msgid "Output '%s' enabled" -msgstr "출력 '%s' 사용함" +msgstr "출력 '%s' 활성화됨" #: src/OutputsPage.cxx:241 #, c-format msgid "Output '%s' disabled" -msgstr "출력 '%s' 사용 안 함" +msgstr "출력 '%s' 비활성화됨" #: src/OutputsPage.cxx:371 src/OutputsPage.cxx:480 msgid "Outputs" @@ -841,7 +841,7 @@ #. get path #: src/QueuePage.cxx:314 msgid "Add" -msgstr "추가" +msgstr "추가하기" #: src/QueuePage.cxx:379 src/QueuePage.cxx:697 msgid "Queue" @@ -866,20 +866,20 @@ #: src/save_playlist.cxx:129 #, c-format msgid "Saved %s" -msgstr "%s 저장함" +msgstr "%s 저장됨" #: src/screen_client.cxx:41 msgid "Database update running" -msgstr "데이터베이스 업데이트 중" +msgstr "데이터베이스 업데이트 실행 중" #: src/screen_client.cxx:48 #, c-format msgid "Database update of %s started" -msgstr "%s 데이터베이스 업데이트 시작" +msgstr "%s의 데이터베이스 업데이트 시작됨" #: src/screen_client.cxx:51 msgid "Database update started" -msgstr "데이터베이스 업데이트 시작" +msgstr "데이터베이스 업데이트 시작됨" #: src/screen.cxx:158 msgid "Repeat mode is on" @@ -929,23 +929,23 @@ #: src/screen.cxx:198 msgid "Database updated" -msgstr "데이터베이스 업데이트 함" +msgstr "데이터베이스 업데이트됨" #: src/screen.cxx:248 msgid "Find mode: Wrapped" -msgstr "찾기 방식: 줄 바꿈" +msgstr "찾기 모드: 줄 바꿈" #: src/screen.cxx:249 msgid "Find mode: Normal" -msgstr "찾기 방식: 보통" +msgstr "찾기 모드: 보통" #: src/screen.cxx:254 msgid "Auto center mode: On" -msgstr "자동 가운데 방식: 켜짐" +msgstr "자동 중앙 모드: 켜짐" #: src/screen.cxx:255 msgid "Auto center mode: Off" -msgstr "자동 가운데 방식: 꺼짐" +msgstr "자동 중앙 모드: 꺼짐" #: src/screen_find.cxx:33 msgid "Find"
View file
ncmpc-0.47.tar.xz/po/nl.po -> ncmpc-0.48.tar.xz/po/nl.po
Changed
@@ -8,291 +8,293 @@ "Project-Id-Version: ncmpc\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-08-24 15:23+0200\n" -"PO-Revision-Date: 2010-02-24 11:17+0000\n" -"Last-Translator: Tom Postma <tom-postma@hetnet.nl>\n" -"Language-Team: Dutch <nl@li.org>\n" +"PO-Revision-Date: 2022-08-23 03:43+0000\n" +"Last-Translator: JeibborRip <rob.jorna@gmail.com>\n" +"Language-Team: Dutch <https://hosted.weblate.org/projects/ncmpc/translations/" +"nl/>\n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14-dev\n" "X-Launchpad-Export-Date: 2010-04-05 17:16+0000\n" -"X-Generator: Launchpad (build Unknown)\n" #: src/Bindings.cxx:80 src/Bindings.cxx:86 #, c-format msgid "Key %s assigned to %s and %s" -msgstr "" +msgstr "Toets %s is toegewezen aan %s en %s" #: src/ChatPage.cxx:64 src/ChatPage.cxx:182 msgid "Chat" -msgstr "" +msgstr "Babbel" #: src/ChatPage.cxx:163 msgid "Your message" -msgstr "" +msgstr "Jouw bericht" #: src/ChatPage.cxx:172 msgid "Message could not be sent" -msgstr "" +msgstr "Bericht kon niet worden verstuurd" #: src/Command.cxx:30 msgid "Key configuration screen" -msgstr "" +msgstr "Instel scherm voor toets bediening" #: src/Command.cxx:33 msgid "Quit" -msgstr "" +msgstr "Afsluiten" #: src/Command.cxx:37 msgid "Move cursor up" -msgstr "" +msgstr "Cursor omhoog" #: src/Command.cxx:39 msgid "Move cursor down" -msgstr "" +msgstr "Beweeg cursor omlaag" #: src/Command.cxx:41 msgid "Move cursor to the top of screen" -msgstr "" +msgstr "Plaats de cursor naar het begin van het scherm" #: src/Command.cxx:43 msgid "Move cursor to the middle of screen" -msgstr "" +msgstr "Plaats de cursor in het midden van het scherm" #: src/Command.cxx:45 msgid "Move cursor to the bottom of screen" -msgstr "" +msgstr "Plaats de cursor onder aan het scherm" #: src/Command.cxx:47 msgid "Move cursor to the top of the list" -msgstr "" +msgstr "Plaats de cursor naar het begin van de lijst" #: src/Command.cxx:49 msgid "Move cursor to the bottom of the list" -msgstr "" +msgstr "Plaats de cursor naar het einde van de lijst" #: src/Command.cxx:51 msgid "Page up" -msgstr "" +msgstr "Pagina omhoog" #: src/Command.cxx:53 msgid "Page down" -msgstr "" +msgstr "Pagina omlaag" #: src/Command.cxx:55 msgid "Range selection" -msgstr "" +msgstr "Selecteer bereik" #: src/Command.cxx:57 msgid "Scroll down one line" -msgstr "" +msgstr "Eén regel omlaag scrollen" #: src/Command.cxx:59 msgid "Scroll up one line" -msgstr "" +msgstr "Eén regel omhoog scrollen" #: src/Command.cxx:61 msgid "Scroll up half a screen" -msgstr "" +msgstr "Een halve pagina omhoog scrollen" #: src/Command.cxx:63 msgid "Scroll down half a screen" -msgstr "" +msgstr "Een halve pagina omlaag scrollen" #: src/Command.cxx:65 msgid "Select currently playing song" -msgstr "" +msgstr "Selecteer huidig nummer" #: src/Command.cxx:70 msgid "Help screen" -msgstr "" +msgstr "Help scherm" #: src/Command.cxx:72 src/HelpPage.cxx:141 msgid "Queue screen" -msgstr "" +msgstr "Scherm met afspeellijst" #: src/Command.cxx:74 src/HelpPage.cxx:156 msgid "Browse screen" -msgstr "" +msgstr "Bladerscherm" #: src/Command.cxx:79 msgid "Play/Enter directory" -msgstr "" +msgstr "Speel/toon map" #: src/Command.cxx:81 msgid "Pause" -msgstr "" +msgstr "Pauzeer" #: src/Command.cxx:83 msgid "Stop" -msgstr "" +msgstr "Afsluiten" #: src/Command.cxx:85 msgid "Crop" -msgstr "" +msgstr "Bijsnijden" #: src/Command.cxx:87 msgid "Next track" -msgstr "" +msgstr "Volgend nummer" #: src/Command.cxx:89 msgid "Previous track" -msgstr "" +msgstr "Vorig nummer" #: src/Command.cxx:91 msgid "Seek forward" -msgstr "" +msgstr "Omlaag zoeken" #: src/Command.cxx:93 msgid "Seek backward" -msgstr "" +msgstr "Omhoog zoeken" #: src/Command.cxx:95 msgid "Increase volume" -msgstr "" +msgstr "Harder" #: src/Command.cxx:97 msgid "Decrease volume" -msgstr "" +msgstr "Zachter" #: src/Command.cxx:99 msgid "Select/deselect song in queue" -msgstr "" +msgstr "Selecteer/deselecteer nummer in lijst" #: src/Command.cxx:101 msgid "Select all listed items" -msgstr "" +msgstr "Kies selectie"
View file
ncmpc-0.48.tar.xz/po/tr.po
Added
@@ -0,0 +1,1216 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the ncmpc package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: ncmpc\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-08-24 15:23+0200\n" +"PO-Revision-Date: 2022-11-26 17:48+0000\n" +"Last-Translator: Oğuz Ersen <oguz@ersen.moe>\n" +"Language-Team: Turkish <https://hosted.weblate.org/projects/ncmpc/" +"translations/tr/>\n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.15-dev\n" + +#: src/Bindings.cxx:80 src/Bindings.cxx:86 +#, c-format +msgid "Key %s assigned to %s and %s" +msgstr "%s tuşu, %s ve %s komutlarına atandı" + +#: src/ChatPage.cxx:64 src/ChatPage.cxx:182 +msgid "Chat" +msgstr "Sohbet" + +#: src/ChatPage.cxx:163 +msgid "Your message" +msgstr "Mesajınız" + +#: src/ChatPage.cxx:172 +msgid "Message could not be sent" +msgstr "Mesaj gönderilemedi" + +#: src/Command.cxx:30 +msgid "Key configuration screen" +msgstr "Tuş yapılandırma ekranı" + +#: src/Command.cxx:33 +msgid "Quit" +msgstr "Çıkış" + +#: src/Command.cxx:37 +msgid "Move cursor up" +msgstr "İmleci yukarı taşı" + +#: src/Command.cxx:39 +msgid "Move cursor down" +msgstr "İmleci aşağı taşı" + +#: src/Command.cxx:41 +msgid "Move cursor to the top of screen" +msgstr "İmleci ekranın en üstüne taşı" + +#: src/Command.cxx:43 +msgid "Move cursor to the middle of screen" +msgstr "İmleci ekranın ortasına taşı" + +#: src/Command.cxx:45 +msgid "Move cursor to the bottom of screen" +msgstr "İmleci ekranın en altına taşı" + +#: src/Command.cxx:47 +msgid "Move cursor to the top of the list" +msgstr "İmleci listenin en üstüne taşı" + +#: src/Command.cxx:49 +msgid "Move cursor to the bottom of the list" +msgstr "İmleci listenin en altına taşı" + +#: src/Command.cxx:51 +msgid "Page up" +msgstr "Bir sayfa yukarı" + +#: src/Command.cxx:53 +msgid "Page down" +msgstr "Bir sayfa aşağı" + +#: src/Command.cxx:55 +msgid "Range selection" +msgstr "Aralık seçimi" + +#: src/Command.cxx:57 +msgid "Scroll down one line" +msgstr "Bir satır aşağı kaydır" + +#: src/Command.cxx:59 +msgid "Scroll up one line" +msgstr "Bir satır yukarı kaydır" + +#: src/Command.cxx:61 +msgid "Scroll up half a screen" +msgstr "Yarım ekran yukarı kaydır" + +#: src/Command.cxx:63 +msgid "Scroll down half a screen" +msgstr "Yarım ekran aşağı kaydır" + +#: src/Command.cxx:65 +msgid "Select currently playing song" +msgstr "O anda çalan şarkıyı seçin" + +#: src/Command.cxx:70 +msgid "Help screen" +msgstr "Yardım ekranı" + +#: src/Command.cxx:72 src/HelpPage.cxx:141 +msgid "Queue screen" +msgstr "Kuyruk ekranı" + +#: src/Command.cxx:74 src/HelpPage.cxx:156 +msgid "Browse screen" +msgstr "Göz atma ekranı" + +#: src/Command.cxx:79 +msgid "Play/Enter directory" +msgstr "Oynat/Dizine gir" + +#: src/Command.cxx:81 +msgid "Pause" +msgstr "Duraklat" + +#: src/Command.cxx:83 +msgid "Stop" +msgstr "Durdur" + +#: src/Command.cxx:85 +msgid "Crop" +msgstr "Kırp" + +#: src/Command.cxx:87 +msgid "Next track" +msgstr "Sonraki parça" + +#: src/Command.cxx:89 +msgid "Previous track" +msgstr "Önceki parça" + +#: src/Command.cxx:91 +msgid "Seek forward" +msgstr "İleri sar" + +#: src/Command.cxx:93 +msgid "Seek backward" +msgstr "Geri sar" + +#: src/Command.cxx:95 +msgid "Increase volume" +msgstr "Sesi arttır" + +#: src/Command.cxx:97 +msgid "Decrease volume" +msgstr "Sesi azalt" + +#: src/Command.cxx:99 +msgid "Select/deselect song in queue" +msgstr "Kuyruktaki şarkıyı seç/seçimini kaldır" + +#: src/Command.cxx:101 +msgid "Select all listed items" +msgstr "Listelenen tüm ögeleri seç" + +#: src/Command.cxx:103 +msgid "Delete song from queue" +msgstr "Şarkıyı kuyruktan sil" + +#: src/Command.cxx:105 +msgid "Shuffle queue" +msgstr "Kuyruğu karıştır" + +#: src/Command.cxx:107 +msgid "Clear queue" +msgstr "Kuyruğu temizle" + +#: src/Command.cxx:109 +msgid "Toggle repeat mode" +msgstr "Tekrar modunu değiştir" + +#: src/Command.cxx:111 +msgid "Toggle random mode" +msgstr "Rastgele modu değiştir" + +#: src/Command.cxx:113 +msgid "Toggle single mode" +msgstr "Tekli modunu değiştir" + +#: src/Command.cxx:115 +msgid "Toggle consume mode" +msgstr "Tüketim modunu değiştir" + +#: src/Command.cxx:117 +msgid "Toggle crossfade mode" +msgstr "Şarkı geçiş modunu değiştir" + +#: src/Command.cxx:119
View file
ncmpc-0.47.tar.xz/src/AsyncUserInput.cxx -> ncmpc-0.48.tar.xz/src/AsyncUserInput.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "config.h" #include "AsyncUserInput.hxx" @@ -24,15 +9,15 @@ #include "ncmpc.hxx" #include "Point.hxx" -static bool -ignore_key(int key) +static constexpr bool +ignore_key(int key) noexcept { return key == ERR || key == '\0'; } gnu::pure static Command -translate_key(int key) +translate_key(int key) noexcept { return GetGlobalKeyBindings().FindKey(key); } @@ -69,7 +54,7 @@ begin_input_event(); - if (!do_input_event(socket_event.GetEventLoop(), cmd)) + if (!do_input_event(stdin_event.GetEventLoop(), cmd)) return; end_input_event(); @@ -77,15 +62,15 @@ } AsyncUserInput::AsyncUserInput(EventLoop &event_loop, WINDOW &_w) noexcept - :socket_event(event_loop, BIND_THIS_METHOD(OnSocketReady), + :stdin_event(event_loop, BIND_THIS_METHOD(OnSocketReady), FileDescriptor{STDIN_FILENO}), w(_w) { - socket_event.ScheduleRead(); + stdin_event.ScheduleRead(); } void -keyboard_unread(EventLoop &event_loop, int key) +keyboard_unread(EventLoop &event_loop, int key) noexcept { if (ignore_key(key)) return;
View file
ncmpc-0.47.tar.xz/src/AsyncUserInput.hxx -> ncmpc-0.48.tar.xz/src/AsyncUserInput.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef ASYNC_USER_INPUT_HXX #define ASYNC_USER_INPUT_HXX @@ -24,7 +9,7 @@ #include <curses.h> class AsyncUserInput { - PipeEvent socket_event; + PipeEvent stdin_event; WINDOW &w; @@ -36,6 +21,6 @@ }; void -keyboard_unread(EventLoop &event_loop, int key); +keyboard_unread(EventLoop &event_loop, int key) noexcept; #endif
View file
ncmpc-0.47.tar.xz/src/BasicColors.cxx -> ncmpc-0.48.tar.xz/src/BasicColors.cxx
Changed
@@ -1,26 +1,11 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "BasicColors.hxx" +#include "util/StringAPI.hxx" #include <curses.h> -#include <strings.h> #include <stdlib.h> static constexpr const char *basic_color_names = { @@ -48,7 +33,7 @@ ParseBasicColorName(const char *name) noexcept { for (size_t i = 0; basic_color_namesi != nullptr; ++i) - if (strcasecmp(basic_color_namesi, name) == 0) + if (StringIsEqualIgnoreCase(basic_color_namesi, name)) return i; return -1;
View file
ncmpc-0.47.tar.xz/src/BasicColors.hxx -> ncmpc-0.48.tar.xz/src/BasicColors.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef BASIC_COLORS_HXX #define BASIC_COLORS_HXX
View file
ncmpc-0.47.tar.xz/src/BasicMarquee.cxx -> ncmpc-0.48.tar.xz/src/BasicMarquee.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "BasicMarquee.hxx" #include "util/LocaleString.hxx"
View file
ncmpc-0.47.tar.xz/src/BasicMarquee.hxx -> ncmpc-0.48.tar.xz/src/BasicMarquee.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef BASIC_MARQUEE_HXX #define BASIC_MARQUEE_HXX
View file
ncmpc-0.47.tar.xz/src/Bindings.cxx -> ncmpc-0.48.tar.xz/src/Bindings.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Bindings.hxx" #include "Command.hxx"
View file
ncmpc-0.47.tar.xz/src/Bindings.hxx -> ncmpc-0.48.tar.xz/src/Bindings.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef BINDINGS_HXX #define BINDINGS_HXX
View file
ncmpc-0.47.tar.xz/src/ChatPage.cxx -> ncmpc-0.48.tar.xz/src/ChatPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ChatPage.hxx" #include "PageMeta.hxx" @@ -26,6 +11,7 @@ #include "charset.hxx" #include "Command.hxx" #include "Options.hxx" +#include "util/StringAPI.hxx" #include <mpd/idle.h> @@ -94,7 +80,7 @@ { /* You'll have to move this out of screen_chat, if you want to use client-to-client messages anywhere else */ - assert(strcmp(mpd_message_get_channel(&message), chat_channel) == 0); + assert(StringIsEqual(mpd_message_get_channel(&message), chat_channel)); Append(mpd_message_get_text(&message)); @@ -159,7 +145,8 @@ return true; if (cmd == Command::PLAY) { - auto message = screen_readln(_("Your message"), nullptr, nullptr, nullptr); + auto message = screen_readln(screen, _("Your message"), + nullptr, nullptr, nullptr); /* the user entered an empty line */ if (message.empty())
View file
ncmpc-0.47.tar.xz/src/ChatPage.hxx -> ncmpc-0.48.tar.xz/src/ChatPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_CHAT_PAGE_HXX #define NCMPC_CHAT_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/Command.cxx -> ncmpc-0.48.tar.xz/src/Command.cxx
Changed
@@ -1,23 +1,9 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Command.hxx" #include "i18n.h" +#include "util/StringAPI.hxx" #include <iterator> @@ -265,12 +251,12 @@ get_key_command_from_name(const char *name) { for (size_t i = 0; i < size_t(Command::NONE); ++i) - if (strcmp(name, cmdsi.name) == 0) + if (StringIsEqual(name, cmdsi.name)) return Command(i); #ifdef ENABLE_LIBRARY_PAGE /* compatibility with 0.32 and older */ - if (strcmp(name, "screen-artist") == 0) + if (StringIsEqual(name, "screen-artist")) return Command::LIBRARY_PAGE; #endif
View file
ncmpc-0.47.tar.xz/src/Command.hxx -> ncmpc-0.48.tar.xz/src/Command.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef COMMAND_H #define COMMAND_H
View file
ncmpc-0.47.tar.xz/src/Completion.cxx -> ncmpc-0.48.tar.xz/src/Completion.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Completion.hxx"
View file
ncmpc-0.47.tar.xz/src/Completion.hxx -> ncmpc-0.48.tar.xz/src/Completion.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef COMPLETION_HXX #define COMPLETION_HXX
View file
ncmpc-0.47.tar.xz/src/ConfigFile.cxx -> ncmpc-0.48.tar.xz/src/ConfigFile.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ConfigFile.hxx" #include "ConfigParser.hxx" @@ -52,20 +37,6 @@ return MakeUserConfigPath(KEYS_FILENAME); } -#ifndef _WIN32 - -std::string -GetHomeConfigPath() noexcept -{ - const char *home = GetHomeDirectory(); - if (home == nullptr) - return {}; - - return BuildPath(home, "." PACKAGE, CONFIG_FILENAME); -} - -#endif - std::string GetUserConfigPath() noexcept { @@ -151,13 +122,6 @@ if (!filename.empty() && IsFile(filename.c_str())) return filename; -#ifndef _WIN32 - /* check for user configuration ~/.ncmpc/config */ - filename = GetHomeConfigPath(); - if (!filename.empty() && IsFile(filename.c_str())) - return filename; -#endif - /* check for global configuration SYSCONFDIR/ncmpc/config */ filename = GetSystemConfigPath(); if (IsFile(filename.c_str()))
View file
ncmpc-0.47.tar.xz/src/ConfigFile.hxx -> ncmpc-0.48.tar.xz/src/ConfigFile.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef CONFIG_FILE_HXX #define CONFIG_FILE_HXX @@ -24,11 +9,6 @@ std::string MakeKeysPath(); -#ifndef _WIN32 -std::string -GetHomeConfigPath() noexcept; -#endif - std::string GetUserConfigPath() noexcept;
View file
ncmpc-0.47.tar.xz/src/ConfigParser.cxx -> ncmpc-0.48.tar.xz/src/ConfigParser.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ConfigParser.hxx" #include "config.h" @@ -34,8 +19,14 @@ #include "util/PrintException.hxx" #include "util/RuntimeError.hxx" #include "util/ScopeExit.hxx" +#include "util/StringAPI.hxx" #include "util/StringStrip.hxx" +#ifndef NCMPC_MINI +#include "TableGlue.hxx" +#include "TableStructure.hxx" +#endif + #include <algorithm> #include <array> @@ -43,8 +34,6 @@ #include <ctype.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> -#include <strings.h> #define MAX_LINE_LENGTH 1024 #define COMMENT_TOKEN '#' @@ -100,8 +89,10 @@ static bool str2bool(char *str) noexcept { - return strcasecmp(str, "yes") == 0 || strcasecmp(str, "true") == 0 || - strcasecmp(str, "on") == 0 || strcasecmp(str, "1") == 0; + return StringIsEqualIgnoreCase(str, "yes") || + StringIsEqualIgnoreCase(str, "true") || + StringIsEqualIgnoreCase(str, "on") || + StringIsEqualIgnoreCase(str, "1"); } static constexpr bool @@ -125,6 +116,92 @@ return p; } +#ifndef NCMPC_MINI + +static constexpr bool +IsValueChar(char ch) noexcept +{ + return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_' || ch == '.'; +} + +gnu::pure +static char * +AfterUnquotedValue(char *p) noexcept +{ + while (IsValueChar(*p)) + ++p; + + return p; +} + +/** + * Throws on error. + */ +static char * +NextUnquotedValue(char *&pp) +{ + char *value = pp; + + char *end = AfterUnquotedValue(value); + if (*end == 0) { + pp = end; + } else if (IsWhitespaceFast(*end)) { + *end = 0; + pp = StripLeft(end + 1); + } else + throw FormatRuntimeError("%s: %s", + _("Whitespace expected"), end); + + return value; +} + +/** + * Throws on error. + */ +static char * +NextQuotedValue(char *&pp) +{ + char *p = pp; + if (*p != '"') + throw FormatRuntimeError("%s: %s", + _("Quoted value expected"), p); + + ++p; + + char *const result = p; + + char *end = strchr(p, '"'); + if (end == nullptr) + throw FormatRuntimeError("%s: %s", + _("Closing quote missing"), p); + + *end = 0; + pp = end + 1; + return result; +} + +/** + * Throws on error. + */ +static std::pair<char *, char *> +NextNameValue(char *&p) +{ + char *name = p; + + p = after_unquoted_word(p); + if (*p != '=') + throw FormatRuntimeError("%s: %s", + _("Syntax error"), p); + + *p++ = 0; + + char *value = NextUnquotedValue(p); + + return std::make_pair(name, value); +} + +#endif + /** * Throws on error. */ @@ -189,11 +266,11 @@ static CurrentTimeDisplay ParseCurrentTimeDisplay(const char *str) { - if (strcmp(str, "elapsed") == 0) + if (StringIsEqual(str, "elapsed")) return CurrentTimeDisplay::ELAPSED; - else if (strcmp(str, "remaining") == 0) + else if (StringIsEqual(str, "remaining")) return CurrentTimeDisplay::REMAINING; - else if (strcmp(str, "none") == 0) + else if (StringIsEqual(str, "none")) return CurrentTimeDisplay::NONE; else throw FormatRuntimeError("%s: %s", @@ -416,15 +493,15 @@ { // TODO: modify screen_search so that its own list of modes can be used // for comparison instead of specifying them here - if (strcasecmp(value, "title") == 0) + if (StringIsEqualIgnoreCase(value, "title")) return 0; - else if (strcasecmp(value, "artist") == 0) + else if (StringIsEqualIgnoreCase(value, "artist")) return 1; - else if (strcasecmp(value, "album") == 0) + else if (StringIsEqualIgnoreCase(value, "album")) return 2; - else if (strcasecmp(value, "filename") == 0) + else if (StringIsEqualIgnoreCase(value, "filename")) return 3; - else if (strcasecmp(value, "artist+album") == 0) + else if (StringIsEqualIgnoreCase(value, "artist+album")) return 4; else throw FormatRuntimeError("%s: %s", @@ -433,6 +510,62 @@ } } +#ifndef NCMPC_MINI + +/** + * Throws on error. + */ +static TableColumn +ParseTableColumn(char *s)
View file
ncmpc-0.47.tar.xz/src/ConfigParser.hxx -> ncmpc-0.48.tar.xz/src/ConfigParser.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef CONFIG_PARSER_HXX #define CONFIG_PARSER_HXX
View file
ncmpc-0.47.tar.xz/src/CustomColors.cxx -> ncmpc-0.48.tar.xz/src/CustomColors.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "CustomColors.hxx" #include "i18n.h"
View file
ncmpc-0.47.tar.xz/src/CustomColors.hxx -> ncmpc-0.48.tar.xz/src/CustomColors.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef CUSTOM_COLORS_HXX #define CUSTOM_COLORS_HXX
View file
ncmpc-0.47.tar.xz/src/DelayedSeek.cxx -> ncmpc-0.48.tar.xz/src/DelayedSeek.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "DelayedSeek.hxx" #include "mpdclient.hxx"
View file
ncmpc-0.47.tar.xz/src/DelayedSeek.hxx -> ncmpc-0.48.tar.xz/src/DelayedSeek.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_DELAYED_SEEK_HXX #define NCMPC_DELAYED_SEEK_HXX
View file
ncmpc-0.47.tar.xz/src/Deleter.hxx -> ncmpc-0.48.tar.xz/src/Deleter.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef DELETER_HXX #define DELETER_HXX
View file
ncmpc-0.47.tar.xz/src/EditPlaylistPage.cxx -> ncmpc-0.48.tar.xz/src/EditPlaylistPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "EditPlaylistPage.hxx" #include "PageMeta.hxx"
View file
ncmpc-0.47.tar.xz/src/EditPlaylistPage.hxx -> ncmpc-0.48.tar.xz/src/EditPlaylistPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_EDIT_PLAYLIST_PAGE_HXX #define NCMPC_EDIT_PLAYLIST_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/FileBrowserPage.cxx -> ncmpc-0.48.tar.xz/src/FileBrowserPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "FileBrowserPage.hxx" #include "PageMeta.hxx" @@ -223,9 +208,10 @@ } if(defaultname) - playlist_save(&c, nullptr, Utf8ToLocale(defaultname).c_str()); + playlist_save(screen, &c, nullptr, + Utf8ToLocale(defaultname).c_str()); else - playlist_save(&c, nullptr, nullptr); + playlist_save(screen, &c, nullptr, nullptr); } void @@ -258,7 +244,7 @@ snprintf(prompt, sizeof(prompt), _("Delete playlist %s?"), Utf8ToLocale(GetUriFilename(mpd_playlist_get_path(playlist))).c_str()); - bool confirmed = screen_get_yesno(prompt, false); + bool confirmed = screen_get_yesno(screen, prompt, false); if (!confirmed) { /* translators: a dialog was aborted by the user */ screen_status_message(_("Aborted"));
View file
ncmpc-0.47.tar.xz/src/FileBrowserPage.hxx -> ncmpc-0.48.tar.xz/src/FileBrowserPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_FILE_BROWSER_PAGE_HXX #define NCMPC_FILE_BROWSER_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/FileListPage.cxx -> ncmpc-0.48.tar.xz/src/FileListPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "config.h" #include "FileListPage.hxx"
View file
ncmpc-0.47.tar.xz/src/FileListPage.hxx -> ncmpc-0.48.tar.xz/src/FileListPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef FILE_LIST_PAGE_HXX #define FILE_LIST_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/GlobalBindings.cxx -> ncmpc-0.48.tar.xz/src/GlobalBindings.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "GlobalBindings.hxx" #include "Bindings.hxx"
View file
ncmpc-0.47.tar.xz/src/GlobalBindings.hxx -> ncmpc-0.48.tar.xz/src/GlobalBindings.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef GLOBAL_BINDINGS_HXX #define GLOBAL_BINDINGS_HXX
View file
ncmpc-0.47.tar.xz/src/HelpPage.cxx -> ncmpc-0.48.tar.xz/src/HelpPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "HelpPage.hxx" #include "PageMeta.hxx"
View file
ncmpc-0.47.tar.xz/src/HelpPage.hxx -> ncmpc-0.48.tar.xz/src/HelpPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_HELP_PAGE_HXX #define NCMPC_HELP_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/History.hxx -> ncmpc-0.48.tar.xz/src/History.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef HISTORY_HXX #define HISTORY_HXX
View file
ncmpc-0.47.tar.xz/src/Instance.cxx -> ncmpc-0.48.tar.xz/src/Instance.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Instance.hxx" #include "Options.hxx"
View file
ncmpc-0.47.tar.xz/src/Instance.hxx -> ncmpc-0.48.tar.xz/src/Instance.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_INSTANCE_HXX #define NCMPC_INSTANCE_HXX
View file
ncmpc-0.47.tar.xz/src/KeyDefPage.cxx -> ncmpc-0.48.tar.xz/src/KeyDefPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "KeyDefPage.hxx" #include "PageMeta.hxx" @@ -174,7 +159,7 @@ snprintf(prompt, sizeof(prompt), _("Enter new key for %s: "), get_key_command_name(Command(subcmd))); - const int key = screen_getch(prompt); + const int key = screen_getch(screen, prompt); if (key == ERR) { screen_status_message(_("Aborted")); @@ -300,8 +285,6 @@ return false; } - /* unreachable */ - assert(0); return false; }
View file
ncmpc-0.47.tar.xz/src/KeyDefPage.hxx -> ncmpc-0.48.tar.xz/src/KeyDefPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_KEY_DEF_PAGE_HXX #define NCMPC_KEY_DEF_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/KeyName.cxx -> ncmpc-0.48.tar.xz/src/KeyName.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "KeyName.hxx" #include "i18n.h"
View file
ncmpc-0.47.tar.xz/src/KeyName.hxx -> ncmpc-0.48.tar.xz/src/KeyName.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef KEY_NAME_HXX #define KEY_NAME_HXX
View file
ncmpc-0.47.tar.xz/src/LibraryPage.cxx -> ncmpc-0.48.tar.xz/src/LibraryPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "LibraryPage.hxx" #include "TagListPage.hxx"
View file
ncmpc-0.47.tar.xz/src/LibraryPage.hxx -> ncmpc-0.48.tar.xz/src/LibraryPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_LIBRARY_PAGE_HXX #define NCMPC_LIBRARY_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/ListCursor.cxx -> ncmpc-0.48.tar.xz/src/ListCursor.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ListCursor.hxx" #include "Options.hxx" @@ -81,8 +66,8 @@ { highlight_cursor = false; - if (n > GetHeight() / 2) - start = n - GetHeight() / 2; + if (n > (GetHeight() - 1) / 2) + start = n - (GetHeight() - 1) / 2; else start = 0; @@ -104,7 +89,7 @@ if (n < start + scroll_offset) new_start = n - scroll_offset; - if (n >= start + GetHeight() - scroll_offset) + if (n >= new_start + GetHeight() - scroll_offset) new_start = n - GetHeight() + 1 + scroll_offset; if (new_start + GetHeight() > length) @@ -139,12 +124,17 @@ void ListCursor::FetchCursor() noexcept { + unsigned int target = selected; + if (start > 0 && - selected < start + scroll_offset) - MoveCursor(start + scroll_offset); - else if (start + GetHeight() < length && - selected > start + GetHeight() - 1 - scroll_offset) - MoveCursor(start + GetHeight() - 1 - scroll_offset); + target < start + scroll_offset) + target = start + scroll_offset; + + if (start + GetHeight() < length && + target > start + GetHeight() - 1 - scroll_offset) + target = start + GetHeight() - 1 - scroll_offset; + + MoveCursor(target); } ListWindowRange @@ -189,15 +179,17 @@ { if (start == 0) MoveCursor(start); - else + else if (start + scroll_offset < start + GetHeight() - 1 - scroll_offset) MoveCursor(start + scroll_offset); + else + MoveCursor(start + GetHeight() - 1 - scroll_offset); } void ListCursor::MoveCursorMiddle() noexcept { if (length >= GetHeight()) - MoveCursor(start + GetHeight() / 2); + MoveCursor(start + (GetHeight() - 1) / 2); else MoveCursor(length / 2); }
View file
ncmpc-0.47.tar.xz/src/ListCursor.hxx -> ncmpc-0.48.tar.xz/src/ListCursor.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef LIST_CURSOR_HXX #define LIST_CURSOR_HXX @@ -307,9 +292,7 @@ static constexpr unsigned ClampScrollOffset(unsigned scroll_offset, unsigned height) noexcept { - return scroll_offset * 2 < height - ? scroll_offset - : std::max(height / 2, 1U) - 1; + return std::min(scroll_offset, height / 2); } gnu::pure
View file
ncmpc-0.47.tar.xz/src/ListPage.hxx -> ncmpc-0.48.tar.xz/src/ListPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_LIST_PAGE_HXX #define NCMPC_LIST_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/ListRenderer.hxx -> ncmpc-0.48.tar.xz/src/ListRenderer.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef LIST_RENDERER_HXX #define LIST_RENDERER_HXX
View file
ncmpc-0.47.tar.xz/src/ListText.hxx -> ncmpc-0.48.tar.xz/src/ListText.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef LIST_TEXT_HXX #define LIST_TEXT_HXX
View file
ncmpc-0.47.tar.xz/src/ListWindow.cxx -> ncmpc-0.48.tar.xz/src/ListWindow.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ListWindow.hxx" #include "ListRenderer.hxx"
View file
ncmpc-0.47.tar.xz/src/ListWindow.hxx -> ncmpc-0.48.tar.xz/src/ListWindow.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef LIST_WINDOW_HXX #define LIST_WINDOW_HXX
View file
ncmpc-0.47.tar.xz/src/LyricsCache.cxx -> ncmpc-0.48.tar.xz/src/LyricsCache.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "LyricsCache.hxx" #include "XdgBaseDirectory.hxx"
View file
ncmpc-0.47.tar.xz/src/LyricsCache.hxx -> ncmpc-0.48.tar.xz/src/LyricsCache.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef LYRICS_CACHE_HXX #define LYRICS_CACHE_HXX
View file
ncmpc-0.47.tar.xz/src/LyricsLoader.cxx -> ncmpc-0.48.tar.xz/src/LyricsLoader.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "LyricsLoader.hxx" #include "config.h"
View file
ncmpc-0.47.tar.xz/src/LyricsLoader.hxx -> ncmpc-0.48.tar.xz/src/LyricsLoader.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef LYRICS_LOADER_HXX #define LYRICS_LOADER_HXX
View file
ncmpc-0.47.tar.xz/src/LyricsPage.cxx -> ncmpc-0.48.tar.xz/src/LyricsPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "LyricsPage.hxx" #include "LyricsCache.hxx" @@ -32,6 +17,7 @@ #include "TextPage.hxx" #include "screen_utils.hxx" #include "ncu.hxx" +#include "util/StringAPI.hxx" #include <string> @@ -280,8 +266,8 @@ LyricsPage::MaybeLoad(const struct mpd_song &new_song) noexcept { if (song == nullptr || - strcmp(mpd_song_get_uri(&new_song), - mpd_song_get_uri(song)) != 0) + !StringIsEqual(mpd_song_get_uri(&new_song), + mpd_song_get_uri(song))) Load(new_song); } @@ -366,7 +352,7 @@ if (options.text_editor_ask) { const char *prompt = _("Do you really want to start an editor and edit these lyrics?"); - bool really = screen_get_yesno(prompt, false); + bool really = screen_get_yesno(screen, prompt, false); if (!really) { screen_status_message(_("Aborted")); return;
View file
ncmpc-0.47.tar.xz/src/LyricsPage.hxx -> ncmpc-0.48.tar.xz/src/LyricsPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_LYRICS_PAGE_HXX #define NCMPC_LYRICS_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/Main.cxx -> ncmpc-0.48.tar.xz/src/Main.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "config.h" #include "Instance.hxx" @@ -53,18 +38,17 @@ #include <locale.h> #endif -#define BUFSIZE 1024 - static Instance *global_instance; -static struct mpdclient *mpd = nullptr; ScreenManager *screen; #ifndef NCMPC_MINI static void -update_xterm_title() noexcept +update_xterm_title(struct mpdclient &client) noexcept { - const struct mpd_song *song = mpd->GetPlayingSong(); + const struct mpd_song *song = client.GetPlayingSong(); + + static constexpr std::size_t BUFSIZE = 1024; char tmpBUFSIZE; const char *new_title = nullptr; @@ -86,18 +70,18 @@ #endif static bool -should_enable_update_timer() noexcept +should_enable_update_timer(struct mpdclient &client) noexcept { - return mpd->playing; + return client.playing; } static void -auto_update_timer() noexcept +auto_update_timer(Instance &instance) noexcept { - if (should_enable_update_timer()) - global_instance->EnableUpdateTimer(); + if (should_enable_update_timer(instance.GetClient())) + instance.EnableUpdateTimer(); else - global_instance->DisableUpdateTimer(); + instance.DisableUpdateTimer(); } void @@ -109,7 +93,7 @@ #ifndef NCMPC_MINI if (options.enable_xterm_title) - update_xterm_title(); + update_xterm_title(client); #endif screen_manager.Update(client, seek); @@ -133,14 +117,15 @@ { #ifndef NCMPC_MINI /* quit if mpd is pre 0.14 - song id not supported by mpd */ - auto *connection = mpd->GetConnection(); + auto &client = global_instance->GetClient(); + auto *connection = client.GetConnection(); if (mpd_connection_cmp_server_version(connection, 0, 21, 0) < 0) { const unsigned *version = mpd_connection_get_server_version(connection); screen_status_printf(_("Error: MPD version %d.%d.%d is too old (%s needed)"), version0, version1, version2, "0.21.0"); - mpd->Disconnect(); + client.Disconnect(); doupdate(); /* try again after 30 seconds */ @@ -154,7 +139,7 @@ global_instance->UpdateClient(); - auto_update_timer(); + auto_update_timer(*global_instance); } void @@ -167,7 +152,8 @@ void mpdclient_lost_callback() noexcept { - screen->Update(*mpd, global_instance->GetSeek()); + screen->Update(global_instance->GetClient(), + global_instance->GetSeek()); global_instance->ScheduleReconnect(std::chrono::seconds(1)); } @@ -179,13 +165,15 @@ void mpdclient_idle_callback(maybe_unused unsigned events) noexcept { + auto &client = global_instance->GetClient(); + #ifndef NCMPC_MINI if (options.enable_xterm_title) - update_xterm_title(); + update_xterm_title(client); #endif - screen->Update(*mpd, global_instance->GetSeek()); - auto_update_timer(); + screen->Update(client, global_instance->GetSeek()); + auto_update_timer(*global_instance); } void @@ -196,7 +184,7 @@ UpdateClient(); - if (should_enable_update_timer()) + if (should_enable_update_timer(client)) ScheduleUpdateTimer(); } @@ -207,10 +195,12 @@ void end_input_event() noexcept { - screen->Update(*mpd, global_instance->GetSeek()); - mpd->events = (enum mpd_idle)0; + auto &client = global_instance->GetClient(); + + screen->Update(client, global_instance->GetSeek()); + client.events = (enum mpd_idle)0; - auto_update_timer(); + auto_update_timer(*global_instance); } bool @@ -222,7 +212,8 @@ } try { - screen->OnCommand(*mpd, global_instance->GetSeek(), cmd); + screen->OnCommand(global_instance->GetClient(), + global_instance->GetSeek(), cmd); } catch (...) { screen_status_error(std::current_exception()); return true; @@ -241,7 +232,8 @@ do_mouse_event(Point p, mmask_t bstate) noexcept { try { - screen->OnMouse(*mpd, global_instance->GetSeek(), p, bstate); + screen->OnMouse(global_instance->GetClient(), + global_instance->GetSeek(), p, bstate); } catch (...) { screen_status_error(std::current_exception()); } @@ -317,7 +309,6 @@ /* create the global Instance */ Instance instance; global_instance = &instance; - mpd = &instance.GetClient(); screen = &instance.GetScreenManager(); AtScopeExit() { @@ -332,7 +323,7 @@ /* attempt to connect */ instance.ScheduleReconnect(std::chrono::seconds(0)); - auto_update_timer(); + auto_update_timer(instance); #ifndef NCMPC_MINI instance.ScheduleCheckKeyBindings();
View file
ncmpc-0.47.tar.xz/src/Match.cxx -> ncmpc-0.48.tar.xz/src/Match.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Match.hxx" #include "util/ScopeExit.hxx"
View file
ncmpc-0.47.tar.xz/src/Match.hxx -> ncmpc-0.48.tar.xz/src/Match.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef MATCH_H #define MATCH_H
View file
ncmpc-0.47.tar.xz/src/Options.cxx -> ncmpc-0.48.tar.xz/src/Options.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Options.hxx" #include "Bindings.hxx" @@ -23,10 +8,10 @@ #include "charset.hxx" #include "ConfigFile.hxx" #include "i18n.h" +#include "util/StringAPI.hxx" #include <stdlib.h> #include <stdio.h> -#include <string.h> #define ERROR_UNKNOWN_OPTION 0x01 #define ERROR_BAD_ARGUMENT 0x02 @@ -77,7 +62,7 @@ FindOption(const char *l) noexcept { for (const auto &i : option_table) - if (strcmp(l, i.longopt) == 0) + if (StringIsEqual(l, i.longopt)) return &i; return nullptr; @@ -202,17 +187,11 @@ #ifndef NCMPC_MINI printf("configuration files:\n" " %s\n" -#ifndef _WIN32 - " %s\n" -#endif " %s\n\n", GetUserConfigPath().c_str(), -#ifndef _WIN32 - GetHomeConfigPath().c_str(), -#endif GetSystemConfigPath().c_str()); - if (strcmp("translator-credits", _("translator-credits")) != 0) + if (!StringIsEqual("translator-credits", _("translator-credits"))) /* To translators: these credits are shown when ncmpc is started with "--version" */ printf("\n%s\n", _("translator-credits"));
View file
ncmpc-0.47.tar.xz/src/Options.hxx -> ncmpc-0.48.tar.xz/src/Options.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef OPTIONS_HXX #define OPTIONS_HXX
View file
ncmpc-0.47.tar.xz/src/OutputsPage.cxx -> ncmpc-0.48.tar.xz/src/OutputsPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "OutputsPage.hxx" #include "Deleter.hxx" @@ -111,6 +96,8 @@ } }; + ScreenManager &screen; + std::vector<Item> items; #if LIBMPDCLIENT_CHECK_VERSION(2,18,0) @@ -118,8 +105,8 @@ #endif public: - OutputsPage(WINDOW *w, Size size) - :ListPage(w, size) {} + OutputsPage(ScreenManager &_screen, WINDOW *w, Size size) + :ListPage(w, size), screen(_screen) {} private: void Clear(); @@ -176,7 +163,7 @@ if (connection == nullptr) return false; - auto name = screen_readln(_("Name"), nullptr, nullptr, nullptr); + auto name = screen_readln(screen, _("Name"), nullptr, nullptr, nullptr); if (name.empty()) return false; @@ -357,9 +344,9 @@ } static std::unique_ptr<Page> -outputs_init(ScreenManager &, WINDOW *w, Size size) +outputs_init(ScreenManager &screen, WINDOW *w, Size size) { - return std::make_unique<OutputsPage>(w, size); + return std::make_unique<OutputsPage>(screen, w, size); } const char *
View file
ncmpc-0.47.tar.xz/src/OutputsPage.hxx -> ncmpc-0.48.tar.xz/src/OutputsPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_OUTPUTS_PAGE_HXX #define NCMPC_OUTPUTS_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/Page.hxx -> ncmpc-0.48.tar.xz/src/Page.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_PAGE_HXX #define NCMPC_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/PageMeta.hxx -> ncmpc-0.48.tar.xz/src/PageMeta.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_PAGE_META_HXX #define NCMPC_PAGE_META_HXX
View file
ncmpc-0.47.tar.xz/src/Point.hxx -> ncmpc-0.48.tar.xz/src/Point.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_POINT_HXX #define NCMPC_POINT_HXX
View file
ncmpc-0.47.tar.xz/src/ProgressBar.cxx -> ncmpc-0.48.tar.xz/src/ProgressBar.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ProgressBar.hxx" #include "Styles.hxx"
View file
ncmpc-0.47.tar.xz/src/ProgressBar.hxx -> ncmpc-0.48.tar.xz/src/ProgressBar.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_PROGRESS_BAR_HXX #define NCMPC_PROGRESS_BAR_HXX
View file
ncmpc-0.47.tar.xz/src/ProxyPage.cxx -> ncmpc-0.48.tar.xz/src/ProxyPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ProxyPage.hxx"
View file
ncmpc-0.47.tar.xz/src/ProxyPage.hxx -> ncmpc-0.48.tar.xz/src/ProxyPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_PROXY_PAGE_HXX #define NCMPC_PROXY_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/Queue.cxx -> ncmpc-0.48.tar.xz/src/Queue.cxx
Changed
@@ -1,27 +1,11 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Queue.hxx" +#include "util/StringAPI.hxx" #include <algorithm> -#include <string.h> - void MpdQueue::clear() noexcept { @@ -89,7 +73,7 @@ { for (size_type i = 0; i < size(); ++i) { const auto &song = (*this)i; - if (strcmp(mpd_song_get_uri(&song), filename) == 0) + if (StringIsEqual(mpd_song_get_uri(&song), filename)) return i; }
View file
ncmpc-0.47.tar.xz/src/Queue.hxx -> ncmpc-0.48.tar.xz/src/Queue.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef QUEUE_HXX #define QUEUE_HXX
View file
ncmpc-0.47.tar.xz/src/QueuePage.cxx -> ncmpc-0.48.tar.xz/src/QueuePage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "QueuePage.hxx" #include "PageMeta.hxx" @@ -45,6 +30,10 @@ #ifndef NCMPC_MINI #include "hscroll.hxx" +#include "TableGlue.hxx" +#include "TableStructure.hxx" +#include "TableLayout.hxx" +#include "TablePaint.hxx" #endif #include <mpd/client.h> @@ -61,6 +50,8 @@ #ifndef NCMPC_MINI mutable class hscroll hscroll; + + TableLayout table_layout; #endif CoarseTimerEvent hide_cursor_timer; @@ -82,10 +73,14 @@ #ifndef NCMPC_MINI hscroll(screen.GetEventLoop(), w, options.scroll_sep.c_str()), + table_layout(song_table_structure), #endif hide_cursor_timer(screen.GetEventLoop(), BIND_THIS_METHOD(OnHideCursorTimer)) { +#ifndef NCMPC_MINI + table_layout.Calculate(size.width); +#endif } private: @@ -126,6 +121,14 @@ /* virtual methods from class Page */ void OnOpen(struct mpdclient &c) noexcept override; void OnClose() noexcept override; + + void OnResize(Size size) noexcept override { + ListPage::OnResize(size); +#ifndef NCMPC_MINI + table_layout.Calculate(size.width); +#endif + } + void Paint() const noexcept override; bool PaintStatusBarOverride(const Window &window) const noexcept override; void Update(struct mpdclient &c, unsigned events) noexcept override; @@ -249,12 +252,14 @@ } class DatabaseCompletion final : public Completion { + ScreenManager &screen; struct mpdclient &c; std::set<std::string> dir_list; public: - explicit DatabaseCompletion(struct mpdclient &_c) noexcept - :c(_c) {} + DatabaseCompletion(ScreenManager &_screen, + struct mpdclient &_c) noexcept + :screen(_screen), c(_c) {} protected: /* virtual methods from class Completion */ @@ -281,7 +286,7 @@ { if (range.begin() != range.end() && std::next(range.begin()) != range.end()) - screen_display_completion_list(range); + screen_display_completion_list(screen, range); if (line && line0 && linestrlen(line) - 1 == '/') { /* add directory content to list */ @@ -294,18 +299,18 @@ #endif static int -handle_add_to_playlist(struct mpdclient *c) +handle_add_to_playlist(ScreenManager &screen, struct mpdclient *c) { #ifndef NCMPC_MINI /* initialize completion support */ - DatabaseCompletion _completion(*c); + DatabaseCompletion _completion{screen, *c}; Completion *completion = &_completion; #else Completion *completion = nullptr; #endif /* get path */ - auto path = screen_readln(_("Add"), + auto path = screen_readln(screen, _("Add"), nullptr, nullptr, completion); @@ -381,6 +386,15 @@ assert(i < playlist->size()); const auto &song = (*playlist)i; +#ifndef NCMPC_MINI + if (!song_table_structure.columns.empty()) { + PaintTableRow(w, width, selected, + (int)mpd_song_get_id(&song) == current_song_id, + song, table_layout); + return; + } +#endif + class hscroll *row_hscroll = nullptr; #ifndef NCMPC_MINI row_hscroll = selected && options.scroll && lw.GetCursorIndex() == i @@ -615,11 +629,11 @@ } case Command::SAVE_PLAYLIST: - playlist_save(&c, nullptr, nullptr); + playlist_save(screen, &c, nullptr, nullptr); return true; case Command::ADD: - handle_add_to_playlist(&c); + handle_add_to_playlist(screen, &c); return true; case Command::SHUFFLE: {
View file
ncmpc-0.47.tar.xz/src/QueuePage.hxx -> ncmpc-0.48.tar.xz/src/QueuePage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_QUEUE_PAGE_HXX #define NCMPC_QUEUE_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/SearchPage.cxx -> ncmpc-0.48.tar.xz/src/SearchPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "SearchPage.hxx" #include "PageMeta.hxx" @@ -29,6 +14,7 @@ #include "screen_utils.hxx" #include "FileListPage.hxx" #include "filelist.hxx" +#include "util/StringAPI.hxx" #include <iterator> @@ -61,23 +47,23 @@ static int search_get_tag_id(const char *name) { - if (strcasecmp(name, "file") == 0 || - strcasecmp(name, _("file")) == 0) + if (StringIsEqualIgnoreCase(name, "file") || + StringIsEqualIgnoreCase(name, _("file"))) return SEARCH_URI; - if (strcasecmp(name, "modified") == 0) + if (StringIsEqualIgnoreCase(name, "modified")) return SEARCH_MODIFIED; for (unsigned i = 0; search_tagi.name != nullptr; ++i) - if (strcasecmp(search_tagi.name, name) == 0 || - strcasecmp(search_tagi.localname, name) == 0) + if (StringIsEqualIgnoreCase(search_tagi.name, name) || + StringIsEqualIgnoreCase(search_tagi.localname, name)) return search_tagi.tag_type; return -1; } struct SearchMode { - enum mpd_tag_type table; + int table; const char *label; }; @@ -85,8 +71,8 @@ { MPD_TAG_TITLE, N_("Title") }, { MPD_TAG_ARTIST, N_("Artist") }, { MPD_TAG_ALBUM, N_("Album") }, - { (enum mpd_tag_type)SEARCH_URI, N_("Filename") }, - { (enum mpd_tag_type)SEARCH_ARTIST_TITLE, N_("Artist + Title") }, + { SEARCH_URI, N_("Filename") }, + { SEARCH_ARTIST_TITLE, N_("Artist + Title") }, { MPD_TAG_COUNT, nullptr } }; @@ -428,7 +414,7 @@ Clear(true); - pattern = screen_readln(_("Search"), + pattern = screen_readln(screen, _("Search"), nullptr, &search_history, nullptr);
View file
ncmpc-0.47.tar.xz/src/SearchPage.hxx -> ncmpc-0.48.tar.xz/src/SearchPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_SEARCH_PAGE_HXX #define NCMPC_SEARCH_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/Size.hxx -> ncmpc-0.48.tar.xz/src/Size.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_SIZE_HXX #define NCMPC_SIZE_HXX
View file
ncmpc-0.47.tar.xz/src/SongPage.cxx -> ncmpc-0.48.tar.xz/src/SongPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "SongPage.hxx" #include "PageMeta.hxx" @@ -31,6 +16,7 @@ #include "time_format.hxx" #include "mpdclient.hxx" #include "util/LocaleString.hxx" +#include "util/StringAPI.hxx" #include "util/StringStrip.hxx" #include <mpd/client.h> @@ -41,7 +27,6 @@ #include <string> #include <assert.h> -#include <string.h> #include <time.h> enum { @@ -458,8 +443,8 @@ if (selected_song != nullptr && (playing_song == nullptr || - strcmp(mpd_song_get_uri(selected_song), - mpd_song_get_uri(playing_song)) != 0)) { + !StringIsEqual(mpd_song_get_uri(selected_song), + mpd_song_get_uri(playing_song)))) { lines.emplace_back(_("Selected song")); AddSong(selected_song); lines.emplace_back(std::string());
View file
ncmpc-0.47.tar.xz/src/SongPage.hxx -> ncmpc-0.48.tar.xz/src/SongPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_SONG_PAGE_HXX #define NCMPC_SONG_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/SongPtr.hxx -> ncmpc-0.48.tar.xz/src/SongPtr.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef SONG_PTR_HXX #define SONG_PTR_HXX
View file
ncmpc-0.47.tar.xz/src/SongRowPaint.cxx -> ncmpc-0.48.tar.xz/src/SongRowPaint.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "SongRowPaint.hxx" #include "paint.hxx"
View file
ncmpc-0.47.tar.xz/src/SongRowPaint.hxx -> ncmpc-0.48.tar.xz/src/SongRowPaint.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_SONG_ROW_PAINT_HXX #define NCMPC_SONG_ROW_PAINT_HXX
View file
ncmpc-0.47.tar.xz/src/StatusBar.cxx -> ncmpc-0.48.tar.xz/src/StatusBar.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "StatusBar.hxx" #include "Options.hxx"
View file
ncmpc-0.47.tar.xz/src/StatusBar.hxx -> ncmpc-0.48.tar.xz/src/StatusBar.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_STATUS_BAR_HXX #define NCMPC_STATUS_BAR_HXX
View file
ncmpc-0.47.tar.xz/src/Styles.cxx -> ncmpc-0.48.tar.xz/src/Styles.cxx
Changed
@@ -1,26 +1,12 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Styles.hxx" #include "BasicColors.hxx" #include "CustomColors.hxx" #include "i18n.h" #include "util/RuntimeError.hxx" +#include "util/StringAPI.hxx" #include "util/StringStrip.hxx" #ifdef ENABLE_COLORS @@ -29,8 +15,6 @@ #include <assert.h> #include <stdio.h> -#include <strings.h> -#include <string.h> /** * Use the terminal's default color. @@ -198,7 +182,7 @@ StyleByName(const char *name) noexcept { for (size_t i = 1; i < size_t(Style::END); ++i) - if (!strcasecmp(stylesi.name, name)) + if (StringIsEqualIgnoreCase(stylesi.name, name)) return Style(i); return Style::END; @@ -244,7 +228,7 @@ if (color >= 0) return color; - if (!strcasecmp(s, "none")) + if (StringIsEqualIgnoreCase(s, "none")) return COLOR_NONE; throw FormatRuntimeError("%s: %s", _("Unknown color"), s); @@ -285,26 +269,26 @@ continue; } - if (!strcasecmp(cur, "none")) + if (StringIsEqualIgnoreCase(cur, "none")) d.fg_color = COLOR_NONE; - else if (!strcasecmp(cur, "grey") || - !strcasecmp(cur, "gray")) { + else if (StringIsEqualIgnoreCase(cur, "grey") || + StringIsEqualIgnoreCase(cur, "gray")) { d.fg_color = COLOR_BLACK; d.attr |= A_BOLD; } /* Attributes */ - else if (!strcasecmp(cur, "standout")) + else if (StringIsEqualIgnoreCase(cur, "standout")) d.attr |= A_STANDOUT; - else if (!strcasecmp(cur, "underline")) + else if (StringIsEqualIgnoreCase(cur, "underline")) d.attr |= A_UNDERLINE; - else if (!strcasecmp(cur, "reverse")) + else if (StringIsEqualIgnoreCase(cur, "reverse")) d.attr |= A_REVERSE; - else if (!strcasecmp(cur, "blink")) + else if (StringIsEqualIgnoreCase(cur, "blink")) d.attr |= A_BLINK; - else if (!strcasecmp(cur, "dim")) + else if (StringIsEqualIgnoreCase(cur, "dim")) d.attr |= A_DIM; - else if (!strcasecmp(cur, "bold")) + else if (StringIsEqualIgnoreCase(cur, "bold")) d.attr |= A_BOLD; else throw FormatRuntimeError("%s: %s",
View file
ncmpc-0.47.tar.xz/src/Styles.hxx -> ncmpc-0.48.tar.xz/src/Styles.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef STYLES_HXX #define STYLES_HXX
View file
ncmpc-0.47.tar.xz/src/TabBar.cxx -> ncmpc-0.48.tar.xz/src/TabBar.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "TabBar.hxx" #include "PageMeta.hxx"
View file
ncmpc-0.47.tar.xz/src/TabBar.hxx -> ncmpc-0.48.tar.xz/src/TabBar.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_TAB_BAR_HXX #define NCMPC_TAB_BAR_HXX
View file
ncmpc-0.48.tar.xz/src/TableColumn.hxx
Added
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#pragma once + +#include <string> + +struct TableColumn { + std::string caption, format; + + unsigned min_width = 10; + + float fraction_width = 1; +};
View file
ncmpc-0.48.tar.xz/src/TableGlue.cxx
Added
@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#include "TableGlue.hxx" +#include "TableStructure.hxx" + +TableStructure song_table_structure;
View file
ncmpc-0.48.tar.xz/src/TableGlue.hxx
Added
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#pragma once + +struct TableStructure; + +extern TableStructure song_table_structure;
View file
ncmpc-0.48.tar.xz/src/TableLayout.cxx
Added
@@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#include "TableLayout.hxx" +#include "TableStructure.hxx" + +#include <math.h> + +void +TableLayout::Calculate(unsigned screen_width) noexcept +{ + if (structure.columns.empty()) + /* shouldn't happen */ + return; + + std::fill(columns.begin(), columns.end(), TableColumnLayout{}); + + if (screen_width <= structure.columns.front().min_width) { + /* very narrow window, there's only space for one + column */ + columns.front().width = screen_width; + return; + } + + /* check how many columns fit on the screen */ + + unsigned remaining_width = screen_width - structure.columns.front().min_width - 1; + size_t n_visible = 1; + float fraction_sum = structure.columns.front().fraction_width; + + for (size_t i = 1; i < structure.columns.size(); ++i) { + auto &c = structure.columnsi; + + if (remaining_width < c.min_width) + /* this column doesn't fit, stop here */ + break; + + ++n_visible; + fraction_sum += c.fraction_width; + remaining_width -= c.min_width; + + if (remaining_width == 0) + /* no room for the vertical line */ + break; + + /* subtract the vertical line */ + --remaining_width; + } + + /* distribute the remaining width */ + + for (size_t i = n_visible; i > 0;) { + auto &c = structure.columns--i; + + unsigned width = c.min_width; + if (fraction_sum > 0 && c.fraction_width > 0) { + unsigned add = lrint(remaining_width * c.fraction_width + / fraction_sum); + if (add > remaining_width) + add = remaining_width; + + width += add; + remaining_width -= add; + fraction_sum -= c.fraction_width; + } + + columnsi.width = width; + } +}
View file
ncmpc-0.48.tar.xz/src/TableLayout.hxx
Added
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#pragma once + +#include <array> + +struct TableStructure; + +struct TableColumnLayout { + unsigned width; +}; + +struct TableLayout { + const TableStructure &structure; + + std::array<TableColumnLayout, 64> columns; + + explicit TableLayout(const TableStructure &_structure) noexcept + :structure(_structure) {} + + void Calculate(unsigned screen_width) noexcept; +};
View file
ncmpc-0.48.tar.xz/src/TablePaint.cxx
Added
@@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#include "TablePaint.hxx" +#include "TableLayout.hxx" +#include "TableStructure.hxx" +#include "strfsong.hxx" +#include "paint.hxx" +#include "util/LocaleString.hxx" + +static void +FillSpace(WINDOW *w, unsigned n) noexcept +{ + // TODO: use whline(), which unfortunately doesn't move the cursor + while (n-- > 0) + waddch(w, ' '); +} + +void +PaintTableRow(WINDOW *w, unsigned width, + bool selected, bool highlight, const struct mpd_song &song, + const TableLayout &layout) noexcept +{ + const auto color = highlight ? Style::LIST_BOLD : Style::LIST; + row_color(w, color, selected); + + const size_t n_columns = layout.structure.columns.size(); + for (size_t i = 0; i < n_columns; ++i) { + const auto &cl = layout.columnsi; + const auto &cs = layout.structure.columnsi; + if (cl.width == 0) + break; + + if (i > 0) { + SelectStyle(w, Style::LINE); + waddch(w, ACS_VLINE); + row_color(w, color, selected); + } + + char buffer1024; + size_t length = strfsong(buffer, sizeof(buffer), + cs.format.c_str(), &song); + + const char *end = AtWidthMB(buffer, length, cl.width); + length = end - buffer; + + waddnstr(w, buffer, length); + FillSpace(w, cl.width - StringWidthMB(buffer, length)); + } + + row_clear_to_eol(w, width, selected); +}
View file
ncmpc-0.48.tar.xz/src/TablePaint.hxx
Added
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#pragma once + +#include <curses.h> + +struct TableLayout; +struct mpd_song; + +void +PaintTableRow(WINDOW *w, unsigned width, + bool selected, bool highlight, const struct mpd_song &song, + const TableLayout &layout) noexcept;
View file
ncmpc-0.48.tar.xz/src/TableStructure.cxx
Added
@@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#include "TableLayout.hxx" + +#include <math.h> + +void +TableLayout::Calculate(unsigned screen_width) noexcept +{ + if (columns.empty()) + /* shouldn't happen */ + return; + + for (auto &i : columns) + i.width = 0; + + if (screen_width <= columns.front().min_width) { + /* very narrow window, there's only space for one + column */ + columns.front().width = screen_width; + return; + } + + /* check how many columns fit on the screen */ + + unsigned remaining_width = screen_width - columns.front().min_width - 1; + size_t n_visible = 1; + float fraction_sum = columns.front().fraction_width; + + for (size_t i = 1; i < columns.size(); ++i) { + auto &c = columnsi; + + if (remaining_width < c.min_width) + /* this column doesn't fit, stop here */ + break; + + ++n_visible; + fraction_sum += c.fraction_width; + remaining_width -= c.min_width; + + if (remaining_width == 0) + /* no room for the vertical line */ + break; + + /* subtract the vertical line */ + --remaining_width; + } + + /* distribute the remaining width */ + + for (size_t i = n_visible; i > 0;) { + auto &c = columns--i; + + unsigned width = c.min_width; + if (fraction_sum > 0 && c.fraction_width > 0) { + unsigned add = lrint(remaining_width * c.fraction_width + / fraction_sum); + if (add > remaining_width) + add = remaining_width; + + width += add; + remaining_width -= add; + fraction_sum -= c.fraction_width; + } + + c.width = width; + } +}
View file
ncmpc-0.48.tar.xz/src/TableStructure.hxx
Added
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#pragma once + +#include "TableColumn.hxx" + +#include <vector> + +struct TableStructure { + std::vector<TableColumn> columns; +};
View file
ncmpc-0.47.tar.xz/src/TagFilter.cxx -> ncmpc-0.48.tar.xz/src/TagFilter.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "TagFilter.hxx"
View file
ncmpc-0.47.tar.xz/src/TagFilter.hxx -> ncmpc-0.48.tar.xz/src/TagFilter.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_TAG_FILTER_HXX #define NCMPC_TAG_FILTER_HXX
View file
ncmpc-0.47.tar.xz/src/TagListPage.cxx -> ncmpc-0.48.tar.xz/src/TagListPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "TagListPage.hxx" #include "screen_status.hxx"
View file
ncmpc-0.47.tar.xz/src/TagListPage.hxx -> ncmpc-0.48.tar.xz/src/TagListPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_TAG_LIST_PAGE_HXX #define NCMPC_TAG_LIST_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/TagMask.hxx -> ncmpc-0.48.tar.xz/src/TagMask.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef TAG_MASK_HXX #define TAG_MASK_HXX
View file
ncmpc-0.47.tar.xz/src/TextListRenderer.cxx -> ncmpc-0.48.tar.xz/src/TextListRenderer.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "TextListRenderer.hxx" #include "ListText.hxx"
View file
ncmpc-0.47.tar.xz/src/TextListRenderer.hxx -> ncmpc-0.48.tar.xz/src/TextListRenderer.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_TEXT_LIST_RENDERER_HXX #define NCMPC_TEXT_LIST_RENDERER_HXX
View file
ncmpc-0.47.tar.xz/src/TextPage.cxx -> ncmpc-0.48.tar.xz/src/TextPage.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "TextPage.hxx" #include "TextListRenderer.hxx"
View file
ncmpc-0.47.tar.xz/src/TextPage.hxx -> ncmpc-0.48.tar.xz/src/TextPage.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef TEXT_PAGE_HXX #define TEXT_PAGE_HXX
View file
ncmpc-0.47.tar.xz/src/TitleBar.cxx -> ncmpc-0.48.tar.xz/src/TitleBar.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "TitleBar.hxx" #include "TabBar.hxx"
View file
ncmpc-0.47.tar.xz/src/TitleBar.hxx -> ncmpc-0.48.tar.xz/src/TitleBar.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_TITLE_BAR_H #define NCMPC_TITLE_BAR_H
View file
ncmpc-0.47.tar.xz/src/WaitUserInput.hxx -> ncmpc-0.48.tar.xz/src/WaitUserInput.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef WAIT_USER_INPUT_HXX #define WAIT_USER_INPUT_HXX
View file
ncmpc-0.47.tar.xz/src/Window.hxx -> ncmpc-0.48.tar.xz/src/Window.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_WINDOW_HXX #define NCMPC_WINDOW_HXX
View file
ncmpc-0.47.tar.xz/src/XdgBaseDirectory.cxx -> ncmpc-0.48.tar.xz/src/XdgBaseDirectory.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "XdgBaseDirectory.hxx" #include "config.h"
View file
ncmpc-0.47.tar.xz/src/XdgBaseDirectory.hxx -> ncmpc-0.48.tar.xz/src/XdgBaseDirectory.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef XDG_BASE_DIRECTORY_HXX #define XDG_BASE_DIRECTORY_HXX
View file
ncmpc-0.47.tar.xz/src/aconnect.cxx -> ncmpc-0.48.tar.xz/src/aconnect.cxx
Changed
@@ -1,29 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - Copyright 2004-2021 The Music Player Daemon Project - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright The Music Player Daemon Project #include "aconnect.hxx" #include "net/AsyncResolveConnect.hxx"
View file
ncmpc-0.47.tar.xz/src/aconnect.hxx -> ncmpc-0.48.tar.xz/src/aconnect.hxx
Changed
@@ -1,32 +1,7 @@ -/* ncmpc (Ncurses MPD Client) - Copyright 2004-2021 The Music Player Daemon Project +// SPDX-License-Identifier: BSD-2-Clause +// Copyright The Music Player Daemon Project - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef ACONNECT_H -#define ACONNECT_H +#pragma once #include <exception> @@ -50,5 +25,3 @@ void aconnect_cancel(AsyncMpdConnect *ac); - -#endif
View file
ncmpc-0.47.tar.xz/src/callbacks.cxx -> ncmpc-0.48.tar.xz/src/callbacks.cxx
Changed
@@ -1,25 +1,11 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "callbacks.hxx" #include "screen_utils.hxx" #include "screen_status.hxx" #include "mpdclient.hxx" +#include "ncmpc.hxx" #include <curses.h> @@ -32,7 +18,7 @@ mpd_connection_clear_error(connection); - const auto password = screen_read_password(nullptr); + const auto password = screen_read_password(*screen, nullptr); if (password.empty()) return false;
View file
ncmpc-0.47.tar.xz/src/callbacks.hxx -> ncmpc-0.48.tar.xz/src/callbacks.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_CALLBACKS_H #define NCMPC_CALLBACKS_H
View file
ncmpc-0.47.tar.xz/src/charset.cxx -> ncmpc-0.48.tar.xz/src/charset.cxx
Changed
@@ -1,28 +1,13 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "charset.hxx" #include "util/ScopeExit.hxx" +#include "util/StringAPI.hxx" #include <algorithm> #include <assert.h> -#include <string.h> #ifdef HAVE_ICONV #include <langinfo.h> @@ -38,7 +23,7 @@ charset_init() noexcept { charset = nl_langinfo(CODESET); - noconvert = charset == nullptr || strcasecmp(charset, "utf-8") == 0; + noconvert = charset == nullptr || StringIsEqualIgnoreCase(charset, "utf-8"); } #endif
View file
ncmpc-0.47.tar.xz/src/charset.hxx -> ncmpc-0.48.tar.xz/src/charset.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef CHARSET_H #define CHARSET_H
View file
ncmpc-0.47.tar.xz/src/db_completion.cxx -> ncmpc-0.48.tar.xz/src/db_completion.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "db_completion.hxx" #include "Completion.hxx"
View file
ncmpc-0.47.tar.xz/src/db_completion.hxx -> ncmpc-0.48.tar.xz/src/db_completion.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef DB_COMPLETION_H #define DB_COMPLETION_H
View file
ncmpc-0.47.tar.xz/src/defaults.hxx -> ncmpc-0.48.tar.xz/src/defaults.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef DEFAULTS_H #define DEFAULTS_H
View file
ncmpc-0.47.tar.xz/src/event/Backend.hxx -> ncmpc-0.48.tar.xz/src/event/Backend.hxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef EVENT_BACKEND_HXX #define EVENT_BACKEND_HXX
View file
ncmpc-0.47.tar.xz/src/event/BackendEvents.hxx -> ncmpc-0.48.tar.xz/src/event/BackendEvents.hxx
Changed
@@ -1,24 +1,6 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef EVENT_BACKEND_EVENTS_HXX -#define EVENT_BACKEND_EVENTS_HXX +// SPDX-License-Identifier: BSD-2-Clause + +#pragma once #include "event/Features.h" @@ -38,5 +20,3 @@ using EventPollBackendEvents = PollEvents; #endif - -#endif
View file
ncmpc-0.47.tar.xz/src/event/Chrono.hxx -> ncmpc-0.48.tar.xz/src/event/Chrono.hxx
Changed
@@ -1,24 +1,7 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> -#ifndef MPD_EVENT_CHRONO_HXX -#define MPD_EVENT_CHRONO_HXX +#pragma once #include <chrono> @@ -33,5 +16,3 @@ using TimePoint = Clock::time_point; } // namespace Event - -#endif /* MAIN_NOTIFY_H */
View file
ncmpc-0.47.tar.xz/src/event/CoarseTimerEvent.cxx -> ncmpc-0.48.tar.xz/src/event/CoarseTimerEvent.cxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #include "CoarseTimerEvent.hxx" #include "Loop.hxx"
View file
ncmpc-0.47.tar.xz/src/event/CoarseTimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/CoarseTimerEvent.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/event/DeferEvent.cxx -> ncmpc-0.48.tar.xz/src/event/DeferEvent.cxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "DeferEvent.hxx" #include "Loop.hxx"
View file
ncmpc-0.47.tar.xz/src/event/DeferEvent.hxx -> ncmpc-0.48.tar.xz/src/event/DeferEvent.hxx
Changed
@@ -1,24 +1,7 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> -#ifndef MPD_DEFER_EVENT_HXX -#define MPD_DEFER_EVENT_HXX +#pragma once #include "util/BindMethod.hxx" #include "util/IntrusiveList.hxx" @@ -76,5 +59,3 @@ callback(); } }; - -#endif
View file
ncmpc-0.47.tar.xz/src/event/EpollBackend.hxx -> ncmpc-0.48.tar.xz/src/event/EpollBackend.hxx
Changed
@@ -1,24 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef EVENT_EPOLL_BACKEND_HXX -#define EVENT_EPOLL_BACKEND_HXX +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "system/EpollFD.hxx" @@ -81,5 +62,3 @@ return true; } }; - -#endif
View file
ncmpc-0.47.tar.xz/src/event/EpollEvents.hxx -> ncmpc-0.48.tar.xz/src/event/EpollEvents.hxx
Changed
@@ -1,24 +1,6 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause -#ifndef EVENT_EPOLL_EVENTS_HXX -#define EVENT_EPOLL_EVENTS_HXX +#pragma once #include <sys/epoll.h> @@ -28,5 +10,3 @@ static constexpr unsigned ERROR = EPOLLERR; static constexpr unsigned HANGUP = EPOLLHUP; }; - -#endif
View file
ncmpc-0.47.tar.xz/src/event/FarTimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/FarTimerEvent.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/event/FineTimerEvent.cxx -> ncmpc-0.48.tar.xz/src/event/FineTimerEvent.cxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #include "FineTimerEvent.hxx" #include "Loop.hxx"
View file
ncmpc-0.47.tar.xz/src/event/FineTimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/FineTimerEvent.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/event/IdleEvent.hxx -> ncmpc-0.48.tar.xz/src/event/IdleEvent.hxx
Changed
@@ -1,24 +1,7 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> -#ifndef MPD_SOCKET_IDLE_EVENT_HXX -#define MPD_SOCKET_IDLE_EVENT_HXX +#pragma once #include "DeferEvent.hxx" @@ -57,5 +40,3 @@ event.Cancel(); } }; - -#endif
View file
ncmpc-0.47.tar.xz/src/event/Loop.cxx -> ncmpc-0.48.tar.xz/src/event/Loop.cxx
Changed
@@ -1,26 +1,9 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "Loop.hxx" #include "DeferEvent.hxx" #include "SocketEvent.hxx" -#include "IdleEvent.hxx" #include "util/ScopeExit.hxx" #ifdef HAVE_THREADED_EVENT_LOOP @@ -88,17 +71,6 @@ #endif -void -EventLoop::Break() noexcept -{ - if (quit.exchange(true)) - return; - -#ifdef HAVE_THREADED_EVENT_LOOP - wake_fd.Write(); -#endif -} - bool EventLoop::AddFD(int fd, unsigned events, SocketEvent &event) noexcept { @@ -152,10 +124,14 @@ void EventLoop::Insert(CoarseTimerEvent &t) noexcept { + assert(IsInside()); + coarse_timers.Insert(t, SteadyNow()); again = true; } +#ifndef NO_FINE_TIMER_EVENT + void EventLoop::Insert(FineTimerEvent &t) noexcept { @@ -165,36 +141,63 @@ again = true; } +#endif // NO_FINE_TIMER_EVENT + +/** + * Determines which timeout will happen earlier; either one may be + * negative to specify "no timeout at all". + */ +static constexpr Event::Duration +GetEarlierTimeout(Event::Duration a, Event::Duration b) noexcept +{ + return b.count() < 0 || (a.count() >= 0 && a < b) + ? a + : b; +} + inline Event::Duration EventLoop::HandleTimers() noexcept { const auto now = SteadyNow(); +#ifndef NO_FINE_TIMER_EVENT auto fine_timeout = timers.Run(now); +#else + const Event::Duration fine_timeout{-1}; +#endif // NO_FINE_TIMER_EVENT auto coarse_timeout = coarse_timers.Run(now); - return fine_timeout.count() < 0 || - (coarse_timeout.count() >= 0 && coarse_timeout < fine_timeout) - ? coarse_timeout - : fine_timeout; + return GetEarlierTimeout(coarse_timeout, fine_timeout); } void -EventLoop::AddDefer(DeferEvent &d) noexcept +EventLoop::AddDefer(DeferEvent &e) noexcept { #ifdef HAVE_THREADED_EVENT_LOOP assert(!IsAlive() || IsInside()); #endif - defer.push_back(d); + defer.push_back(e); + +#ifdef HAVE_THREADED_EVENT_LOOP + /* setting this flag here is only relevant if we've been + called by a DeferEvent */ again = true; +#endif } void EventLoop::AddIdle(DeferEvent &e) noexcept { - idle.push_front(e); + assert(IsInside()); + + idle.push_back(e); + +#ifdef HAVE_THREADED_EVENT_LOOP + /* setting this flag here is only relevant if we've been + called by a DeferEvent */ again = true; +#endif } void @@ -274,6 +277,7 @@ assert(IsInside()); assert(!quit); #ifdef HAVE_THREADED_EVENT_LOOP + assert(!quit_injected); assert(alive); assert(busy); @@ -297,7 +301,7 @@ }; #endif - steady_clock_cache.flush(); + FlushClockCaches(); do { again = false; @@ -342,7 +346,7 @@ Wait(timeout); - steady_clock_cache.flush(); + FlushClockCaches(); #ifdef HAVE_THREADED_EVENT_LOOP { @@ -424,6 +428,11 @@ wake_fd.Read(); + if (quit_injected) { + Break(); + return; + } + const std::scoped_lock<Mutex> lock(mutex); HandleInject(); }
View file
ncmpc-0.47.tar.xz/src/event/Loop.hxx -> ncmpc-0.48.tar.xz/src/event/Loop.hxx
Changed
@@ -1,43 +1,27 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef EVENT_LOOP_HXX #define EVENT_LOOP_HXX #include "Chrono.hxx" #include "TimerWheel.hxx" -#include "TimerList.hxx" #include "Backend.hxx" #include "SocketEvent.hxx" #include "event/Features.h" #include "time/ClockCache.hxx" #include "util/IntrusiveList.hxx" +#ifndef NO_FINE_TIMER_EVENT +#include "TimerList.hxx" +#endif // NO_FINE_TIMER_EVENT + #ifdef HAVE_THREADED_EVENT_LOOP #include "WakeFD.hxx" #include "thread/Id.hxx" #include "thread/Mutex.hxx" - -#include <boost/intrusive/list.hpp> #endif -#include <atomic> #include <cassert> #include "io/uring/Features.h" @@ -66,7 +50,10 @@ #endif TimerWheel coarse_timers; + +#ifndef NO_FINE_TIMER_EVENT TimerList timers; +#endif // NO_FINE_TIMER_EVENT using DeferList = IntrusiveList<DeferEvent>; @@ -80,10 +67,7 @@ #ifdef HAVE_THREADED_EVENT_LOOP Mutex mutex; - using InjectList = - boost::intrusive::list<InjectEvent, - boost::intrusive::base_hook<boost::intrusive::list_base_hook<>>, - boost::intrusive::constant_time_size<false>>; + using InjectList = IntrusiveList<InjectEvent>; InjectList inject; #endif @@ -96,8 +80,8 @@ SocketList sockets; /** - * A linked list of #SocketEvent instances which have a - * non-zero "ready_flags" field, and need to be dispatched. + * A list of #SocketEvent instances which have a non-zero + * "ready_flags" field, and need to be dispatched. */ SocketList ready_sockets; @@ -120,7 +104,7 @@ bool alive; #endif - std::atomic_bool quit{false}; + bool quit = false; /** * True when the object has been modified and another check is @@ -129,6 +113,8 @@ bool again; #ifdef HAVE_THREADED_EVENT_LOOP + bool quit_injected = false; + /** * True when handling callbacks, false when waiting for I/O or * timeout. @@ -182,17 +168,40 @@ return steady_clock_cache.now(); } + void FlushClockCaches() noexcept { + steady_clock_cache.flush(); + } + #ifdef HAVE_URING gnu::pure Uring::Queue *GetUring() noexcept; #endif /** - * Stop execution of this #EventLoop at the next chance. This - * method is thread-safe and non-blocking: after returning, it - * is not guaranteed that the EventLoop has really stopped. + * Stop execution of this #EventLoop at the next chance. + * + * This method is not thread-safe. For stopping the + * #EventLoop from within another thread, use InjectBreak(). + */ + void Break() noexcept { + quit = true; + } + +#ifdef HAVE_THREADED_EVENT_LOOP + /** + * Like Break(), but thread-safe. It is also non-blocking: + * after returning, it is not guaranteed that the EventLoop + * has really stopped. */ - void Break() noexcept; + void InjectBreak() noexcept { + { + const std::scoped_lock lock{mutex}; + quit_injected = true; + } + + wake_fd.Write(); + } +#endif // HAVE_THREADED_EVENT_LOOP bool AddFD(int fd, unsigned events, SocketEvent &event) noexcept; bool ModifyFD(int fd, unsigned events, SocketEvent &event) noexcept; @@ -206,12 +215,15 @@ bool AbandonFD(SocketEvent &event) noexcept; void Insert(CoarseTimerEvent &t) noexcept; + +#ifndef NO_FINE_TIMER_EVENT void Insert(FineTimerEvent &t) noexcept; +#endif // NO_FINE_TIMER_EVENT /** * Schedule a call to DeferEvent::RunDeferred(). */ - void AddDefer(DeferEvent &d) noexcept; + void AddDefer(DeferEvent &e) noexcept; void AddIdle(DeferEvent &e) noexcept; #ifdef HAVE_THREADED_EVENT_LOOP
View file
ncmpc-0.47.tar.xz/src/event/PipeEvent.hxx -> ncmpc-0.48.tar.xz/src/event/PipeEvent.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/event/PollBackend.cxx -> ncmpc-0.48.tar.xz/src/event/PollBackend.cxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "PollBackend.hxx"
View file
ncmpc-0.47.tar.xz/src/event/PollBackend.hxx -> ncmpc-0.48.tar.xz/src/event/PollBackend.hxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef EVENT_POLL_BACKEND_HXX #define EVENT_POLL_BACKEND_HXX
View file
ncmpc-0.47.tar.xz/src/event/PollEvents.hxx -> ncmpc-0.48.tar.xz/src/event/PollEvents.hxx
Changed
@@ -1,24 +1,6 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause -#ifndef EVENT_POLL_EVENTS_HXX -#define EVENT_POLL_EVENTS_HXX +#pragma once #include <sys/poll.h> @@ -28,5 +10,3 @@ static constexpr unsigned ERROR = POLLERR; static constexpr unsigned HANGUP = POLLHUP; }; - -#endif
View file
ncmpc-0.47.tar.xz/src/event/PollResultGeneric.hxx -> ncmpc-0.48.tar.xz/src/event/PollResultGeneric.hxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef MPD_EVENT_POLLRESULT_GENERIC_HXX #define MPD_EVENT_POLLRESULT_GENERIC_HXX
View file
ncmpc-0.47.tar.xz/src/event/SignalMonitor.cxx -> ncmpc-0.48.tar.xz/src/event/SignalMonitor.cxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "SignalMonitor.hxx" #include "event/Features.h"
View file
ncmpc-0.47.tar.xz/src/event/SignalMonitor.hxx -> ncmpc-0.48.tar.xz/src/event/SignalMonitor.hxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef MPD_SOCKET_SIGNAL_MONITOR_HXX #define MPD_SOCKET_SIGNAL_MONITOR_HXX
View file
ncmpc-0.47.tar.xz/src/event/SocketEvent.cxx -> ncmpc-0.48.tar.xz/src/event/SocketEvent.cxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "SocketEvent.hxx" #include "Loop.hxx"
View file
ncmpc-0.47.tar.xz/src/event/SocketEvent.hxx -> ncmpc-0.48.tar.xz/src/event/SocketEvent.hxx
Changed
@@ -1,33 +1,13 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> -#ifndef MPD_SOCKET_EVENT_HXX -#define MPD_SOCKET_EVENT_HXX +#pragma once #include "BackendEvents.hxx" #include "net/SocketDescriptor.hxx" #include "util/BindMethod.hxx" #include "util/IntrusiveList.hxx" -#include <cstddef> -#include <type_traits> - class EventLoop; /** @@ -43,7 +23,9 @@ * thread that runs the #EventLoop, except where explicitly documented * as thread-safe. */ -class SocketEvent final : IntrusiveListHook, public EventPollBackendEvents +class SocketEvent final + : IntrusiveListHook<IntrusiveHookMode::NORMAL>, + public EventPollBackendEvents { friend class EventLoop; friend struct IntrusiveListBaseHookTraits<SocketEvent>; @@ -75,8 +57,6 @@ */ static constexpr unsigned IMPLICIT_FLAGS = ERROR|HANGUP; - using ssize_t = std::make_signed<size_t>::type; - SocketEvent(EventLoop &_loop, Callback _callback, SocketDescriptor _fd=SocketDescriptor::Undefined()) noexcept :loop(_loop), @@ -130,6 +110,10 @@ return scheduled_flags; } + unsigned GetReadyFlags() const noexcept { + return ready_flags; + } + void SetReadyFlags(unsigned flags) noexcept { ready_flags = flags; } @@ -181,5 +165,3 @@ */ void Dispatch() noexcept; }; - -#endif
View file
ncmpc-0.47.tar.xz/src/event/TimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/TimerEvent.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/event/TimerList.cxx -> ncmpc-0.48.tar.xz/src/event/TimerList.cxx
Changed
@@ -1,42 +1,10 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> -#include "Loop.hxx" +#include "TimerList.hxx" #include "FineTimerEvent.hxx" -#ifdef NO_BOOST -#include <algorithm> -#endif - constexpr bool TimerList::Compare::operator()(const FineTimerEvent &a, const FineTimerEvent &b) const noexcept @@ -54,15 +22,7 @@ void TimerList::Insert(FineTimerEvent &t) noexcept { -#ifdef NO_BOOST - auto i = std::find_if(timers.begin(), timers.end(), due = t.GetDue()(const auto &other){ - return other.GetDue() >= due; - }); - - timers.insert(i, t); -#else timers.insert(t); -#endif } Event::Duration
View file
ncmpc-0.47.tar.xz/src/event/TimerList.hxx -> ncmpc-0.48.tar.xz/src/event/TimerList.hxx
Changed
@@ -1,42 +1,15 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once #include "Chrono.hxx" #include "event/Features.h" -#include "util/IntrusiveList.hxx" -#ifndef NO_BOOST +#ifdef NO_BOOST +#include "util/IntrusiveSortedList.hxx" +#else #include <boost/intrusive/set.hpp> #endif @@ -55,7 +28,7 @@ /* when building without Boost, then this is just a sorted doubly-linked list - this doesn't scale well, but is good enough for most programs */ - IntrusiveList<FineTimerEvent> timers; + IntrusiveSortedList<FineTimerEvent, Compare> timers; #else boost::intrusive::multiset<FineTimerEvent, boost::intrusive::base_hook<boost::intrusive::set_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>>,
View file
ncmpc-0.47.tar.xz/src/event/TimerWheel.cxx -> ncmpc-0.48.tar.xz/src/event/TimerWheel.cxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #include "TimerWheel.hxx" #include "CoarseTimerEvent.hxx"
View file
ncmpc-0.47.tar.xz/src/event/TimerWheel.hxx -> ncmpc-0.48.tar.xz/src/event/TimerWheel.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/event/WakeFD.hxx -> ncmpc-0.48.tar.xz/src/event/WakeFD.hxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef MPD_WAKE_FD_HXX #define MPD_WAKE_FD_HXX
View file
ncmpc-0.47.tar.xz/src/event/WinSelectBackend.cxx -> ncmpc-0.48.tar.xz/src/event/WinSelectBackend.cxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "WinSelectBackend.hxx" #include "WinSelectEvents.hxx"
View file
ncmpc-0.47.tar.xz/src/event/WinSelectBackend.hxx -> ncmpc-0.48.tar.xz/src/event/WinSelectBackend.hxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef EVENT_WINSELECT_BACKEND_HXX #define EVENT_WINSELECT_BACKEND_HXX
View file
ncmpc-0.47.tar.xz/src/event/WinSelectEvents.hxx -> ncmpc-0.48.tar.xz/src/event/WinSelectEvents.hxx
Changed
@@ -1,24 +1,6 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: BSD-2-Clause -#ifndef EVENT_WINSELECT_EVENTS_HXX -#define EVENT_WINSELECT_EVENTS_HXX +#pragma once #include <windows.h> @@ -34,5 +16,3 @@ static constexpr unsigned ERROR = 0; static constexpr unsigned HANGUP = 0; }; - -#endif
View file
ncmpc-0.47.tar.xz/src/event/meson.build -> ncmpc-0.48.tar.xz/src/event/meson.build
Changed
@@ -23,7 +23,6 @@ 'CoarseTimerEvent.cxx', 'FineTimerEvent.cxx', 'DeferEvent.cxx', - 'IdleEvent.cxx', 'SocketEvent.cxx', 'Loop.cxx', event_sources,
View file
ncmpc-0.47.tar.xz/src/event/net/ConnectSocket.cxx -> ncmpc-0.48.tar.xz/src/event/net/ConnectSocket.cxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2021 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #include "ConnectSocket.hxx" #include "net/UniqueSocketDescriptor.hxx"
View file
ncmpc-0.47.tar.xz/src/event/net/ConnectSocket.hxx -> ncmpc-0.48.tar.xz/src/event/net/ConnectSocket.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2021 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/filelist.cxx -> ncmpc-0.48.tar.xz/src/filelist.cxx
Changed
@@ -1,29 +1,14 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "filelist.hxx" +#include "util/StringAPI.hxx" #include "util/StringUTF8.hxx" #include <mpd/client.h> #include <algorithm> -#include <string.h> #include <assert.h> FileListEntry::~FileListEntry() noexcept @@ -120,7 +105,7 @@ static bool same_song(const struct mpd_song *a, const struct mpd_song *b) noexcept { - return strcmp(mpd_song_get_uri(a), mpd_song_get_uri(b)) == 0; + return StringIsEqual(mpd_song_get_uri(a), mpd_song_get_uri(b)); } int @@ -152,8 +137,8 @@ if (entity != nullptr && mpd_entity_get_type(entity) == MPD_ENTITY_TYPE_DIRECTORY && - strcmp(mpd_directory_get_path(mpd_entity_get_directory(entity)), - name) == 0) + StringIsEqual(mpd_directory_get_path(mpd_entity_get_directory(entity)), + name)) return i; }
View file
ncmpc-0.47.tar.xz/src/filelist.hxx -> ncmpc-0.48.tar.xz/src/filelist.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef FILELIST_H #define FILELIST_H
View file
ncmpc-0.47.tar.xz/src/gidle.cxx -> ncmpc-0.48.tar.xz/src/gidle.cxx
Changed
@@ -1,31 +1,8 @@ -/* ncmpc (Ncurses MPD Client) - Copyright 2004-2021 The Music Player Daemon Project - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright The Music Player Daemon Project #include "gidle.hxx" +#include "util/StringAPI.hxx" #include <mpd/async.h> #include <mpd/parser.h> @@ -93,8 +70,7 @@ return false; case MPD_PARSER_PAIR: - if (strcmp(mpd_parser_get_name(parser), - "changed") == 0) + if (StringIsEqual(mpd_parser_get_name(parser), "changed")) idle_events |= mpd_idle_name_parse(mpd_parser_get_value(parser));
View file
ncmpc-0.47.tar.xz/src/gidle.hxx -> ncmpc-0.48.tar.xz/src/gidle.hxx
Changed
@@ -1,32 +1,7 @@ -/* ncmpc (Ncurses MPD Client) - Copyright 2004-2021 The Music Player Daemon Project - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef MPD_GLIB_SOURCE_H -#define MPD_GLIB_SOURCE_H +// SPDX-License-Identifier: BSD-2-Clause +// Copyright The Music Player Daemon Project + +#pragma once #include "event/SocketEvent.hxx" @@ -104,5 +79,3 @@ void UpdateSocket() noexcept; }; - -#endif
View file
ncmpc-0.47.tar.xz/src/hscroll.cxx -> ncmpc-0.48.tar.xz/src/hscroll.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "hscroll.hxx" #include "Styles.hxx"
View file
ncmpc-0.47.tar.xz/src/hscroll.hxx -> ncmpc-0.48.tar.xz/src/hscroll.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef HSCROLL_H #define HSCROLL_H
View file
ncmpc-0.47.tar.xz/src/i18n.h -> ncmpc-0.48.tar.xz/src/i18n.h
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef I18N_H #define I18N_H
View file
ncmpc-0.47.tar.xz/src/io/FileDescriptor.cxx -> ncmpc-0.48.tar.xz/src/io/FileDescriptor.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "FileDescriptor.hxx" #include "UniqueFileDescriptor.hxx" @@ -41,11 +15,6 @@ #include <poll.h> #endif -#ifdef __linux__ -#include <sys/eventfd.h> -#include <sys/signalfd.h> -#endif - #ifndef O_NOCTTY #define O_NOCTTY 0 #endif @@ -185,7 +154,7 @@ #ifdef _WIN32 void -FileDescriptor::SetBinaryMode() noexcept +FileDescriptor::SetBinaryMode() const noexcept { _setmode(fd, _O_BINARY); } @@ -209,7 +178,7 @@ } void -FileDescriptor::SetNonBlocking() noexcept +FileDescriptor::SetNonBlocking() const noexcept { assert(IsDefined()); @@ -218,7 +187,7 @@ } void -FileDescriptor::SetBlocking() noexcept +FileDescriptor::SetBlocking() const noexcept { assert(IsDefined()); @@ -227,7 +196,7 @@ } void -FileDescriptor::EnableCloseOnExec() noexcept +FileDescriptor::EnableCloseOnExec() const noexcept { assert(IsDefined()); @@ -236,7 +205,7 @@ } void -FileDescriptor::DisableCloseOnExec() noexcept +FileDescriptor::DisableCloseOnExec() const noexcept { assert(IsDefined()); @@ -251,7 +220,7 @@ } bool -FileDescriptor::CheckDuplicate(FileDescriptor new_fd) noexcept +FileDescriptor::CheckDuplicate(FileDescriptor new_fd) const noexcept { if (*this == new_fd) { DisableCloseOnExec(); @@ -262,30 +231,8 @@ #endif -#ifdef __linux__ - -bool -FileDescriptor::CreateEventFD(unsigned initval) noexcept -{ - fd = ::eventfd(initval, EFD_NONBLOCK|EFD_CLOEXEC); - return fd >= 0; -} - -bool -FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept -{ - int new_fd = ::signalfd(fd, mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (new_fd < 0) - return false; - - fd = new_fd; - return true; -} - -#endif - bool -FileDescriptor::Rewind() noexcept +FileDescriptor::Rewind() const noexcept { assert(IsDefined()); @@ -302,7 +249,7 @@ } void -FileDescriptor::FullRead(void *_buffer, std::size_t length) +FileDescriptor::FullRead(void *_buffer, std::size_t length) const { auto buffer = (std::byte *)_buffer; @@ -320,7 +267,7 @@ } void -FileDescriptor::FullWrite(const void *_buffer, std::size_t length) +FileDescriptor::FullWrite(const void *_buffer, std::size_t length) const { auto buffer = (const std::byte *)_buffer;
View file
ncmpc-0.47.tar.xz/src/io/FileDescriptor.hxx -> ncmpc-0.48.tar.xz/src/io/FileDescriptor.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #pragma once @@ -35,10 +9,6 @@ #include <unistd.h> #include <sys/types.h> -#ifdef __linux__ -#include <csignal> -#endif - #ifdef _WIN32 #include <wchar.h> #endif @@ -151,36 +121,36 @@ static bool CreatePipe(FileDescriptor &r, FileDescriptor &w) noexcept; #ifdef _WIN32 - void EnableCloseOnExec() noexcept {} - void DisableCloseOnExec() noexcept {} - void SetBinaryMode() noexcept; + void EnableCloseOnExec() const noexcept {} + void DisableCloseOnExec() const noexcept {} + void SetBinaryMode() const noexcept; #else static bool CreatePipeNonBlock(FileDescriptor &r, FileDescriptor &w) noexcept; - void SetBinaryMode() noexcept {} + void SetBinaryMode() const noexcept {} /** * Enable non-blocking mode on this file descriptor. */ - void SetNonBlocking() noexcept; + void SetNonBlocking() const noexcept; /** * Enable blocking mode on this file descriptor. */ - void SetBlocking() noexcept; + void SetBlocking() const noexcept; /** * Auto-close this file descriptor when a new program is * executed. */ - void EnableCloseOnExec() noexcept; + void EnableCloseOnExec() const noexcept; /** * Do not auto-close this file descriptor when a new program * is executed. */ - void DisableCloseOnExec() noexcept; + void DisableCloseOnExec() const noexcept; /** * Duplicate this file descriptor. @@ -203,12 +173,7 @@ * this method to inject file descriptors into a new child * process, to be used by a newly executed program. */ - bool CheckDuplicate(FileDescriptor new_fd) noexcept; -#endif - -#ifdef __linux__ - bool CreateEventFD(unsigned initval=0) noexcept; - bool CreateSignalFD(const sigset_t *mask) noexcept; + bool CheckDuplicate(FileDescriptor new_fd) const noexcept; #endif /** @@ -223,13 +188,13 @@ /** * Rewind the pointer to the beginning of the file. */ - bool Rewind() noexcept; + bool Rewind() const noexcept; - off_t Seek(off_t offset) noexcept { + off_t Seek(off_t offset) const noexcept { return lseek(Get(), offset, SEEK_SET); } - off_t Skip(off_t offset) noexcept { + off_t Skip(off_t offset) const noexcept { return lseek(Get(), offset, SEEK_CUR); } @@ -244,7 +209,14 @@ gnu::pure off_t GetSize() const noexcept; - ssize_t Read(void *buffer, std::size_t length) noexcept { +#ifndef _WIN32 + ssize_t ReadAt(off_t offset, + void *buffer, std::size_t length) const noexcept { + return ::pread(fd, buffer, length, offset); + } +#endif + + ssize_t Read(void *buffer, std::size_t length) const noexcept { return ::read(fd, buffer, length); } @@ -252,9 +224,9 @@ * Read until all of the given buffer has been filled. Throws * on error. */ - void FullRead(void *buffer, std::size_t length); + void FullRead(void *buffer, std::size_t length) const; - ssize_t Write(const void *buffer, std::size_t length) noexcept { + ssize_t Write(const void *buffer, std::size_t length) const noexcept { return ::write(fd, buffer, length); } @@ -262,7 +234,7 @@ * Write until all of the given buffer has been written. * Throws on error. */ - void FullWrite(const void *buffer, std::size_t length); + void FullWrite(const void *buffer, std::size_t length) const; #ifndef _WIN32 int Poll(short events, int timeout) const noexcept;
View file
ncmpc-0.47.tar.xz/src/io/Path.hxx -> ncmpc-0.48.tar.xz/src/io/Path.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef IO_PATH_HXX #define IO_PATH_HXX
View file
ncmpc-0.47.tar.xz/src/io/UniqueFileDescriptor.hxx -> ncmpc-0.48.tar.xz/src/io/UniqueFileDescriptor.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef UNIQUE_FILE_DESCRIPTOR_HXX #define UNIQUE_FILE_DESCRIPTOR_HXX
View file
ncmpc-0.47.tar.xz/src/io/uring/Features.h -> ncmpc-0.48.tar.xz/src/io/uring/Features.h
Changed
@@ -1,19 +1,4 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project /* no definitions, ncmpc doesn't use io_uring */
View file
ncmpc-0.47.tar.xz/src/io/uring/Features.hxx -> ncmpc-0.48.tar.xz/src/io/uring/Features.hxx
Changed
@@ -1,19 +1,4 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project /* no definitions, ncmpc doesn't use io_uring */
View file
ncmpc-0.47.tar.xz/src/lirc.cxx -> ncmpc-0.48.tar.xz/src/lirc.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "lirc.hxx" #include "ncmpc.hxx"
View file
ncmpc-0.47.tar.xz/src/lirc.hxx -> ncmpc-0.48.tar.xz/src/lirc.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef LIRC_H #define LIRC_H
View file
ncmpc-0.47.tar.xz/src/mpdclient.cxx -> ncmpc-0.48.tar.xz/src/mpdclient.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "mpdclient.hxx" #include "callbacks.hxx"
View file
ncmpc-0.47.tar.xz/src/mpdclient.hxx -> ncmpc-0.48.tar.xz/src/mpdclient.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef MPDCLIENT_HXX #define MPDCLIENT_HXX
View file
ncmpc-0.47.tar.xz/src/ncmpc.hxx -> ncmpc-0.48.tar.xz/src/ncmpc.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_H #define NCMPC_H
View file
ncmpc-0.47.tar.xz/src/ncu.cxx -> ncmpc-0.48.tar.xz/src/ncu.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "ncu.hxx" #include "config.h"
View file
ncmpc-0.47.tar.xz/src/ncu.hxx -> ncmpc-0.48.tar.xz/src/ncu.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project /* * Basic libnucrses initialization.
View file
ncmpc-0.47.tar.xz/src/net/AddressInfo.cxx -> ncmpc-0.48.tar.xz/src/net/AddressInfo.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "AddressInfo.hxx" #include "Features.hxx"
View file
ncmpc-0.47.tar.xz/src/net/AddressInfo.hxx -> ncmpc-0.48.tar.xz/src/net/AddressInfo.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef NET_ADDRESS_INFO_HXX #define NET_ADDRESS_INFO_HXX
View file
ncmpc-0.47.tar.xz/src/net/AllocatedSocketAddress.cxx -> ncmpc-0.48.tar.xz/src/net/AllocatedSocketAddress.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "AllocatedSocketAddress.hxx" #include "IPv4Address.hxx"
View file
ncmpc-0.47.tar.xz/src/net/AllocatedSocketAddress.hxx -> ncmpc-0.48.tar.xz/src/net/AllocatedSocketAddress.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef ALLOCATED_SOCKET_ADDRESS_HXX #define ALLOCATED_SOCKET_ADDRESS_HXX @@ -176,6 +150,14 @@ } /** + * Does the address family support port numbers? + */ + gnu::pure + bool HasPort() const noexcept { + return ((SocketAddress)*this).HasPort(); + } + + /** * Extract the port number. Returns 0 if not applicable. */ gnu::pure
View file
ncmpc-0.47.tar.xz/src/net/AsyncResolveConnect.cxx -> ncmpc-0.48.tar.xz/src/net/AsyncResolveConnect.cxx
Changed
@@ -1,29 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - Copyright 2004-2021 The Music Player Daemon Project - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright The Music Player Daemon Project #include "AsyncResolveConnect.hxx" #include "AllocatedSocketAddress.hxx"
View file
ncmpc-0.47.tar.xz/src/net/AsyncResolveConnect.hxx -> ncmpc-0.48.tar.xz/src/net/AsyncResolveConnect.hxx
Changed
@@ -1,32 +1,7 @@ -/* ncmpc (Ncurses MPD Client) - Copyright 2004-2021 The Music Player Daemon Project +// SPDX-License-Identifier: BSD-2-Clause +// Copyright The Music Player Daemon Project - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef NET_ASYNC_RESOLVE_CONNECT_HXX -#define NET_ASYNC_RESOLVE_CONNECT_HXX +#pragma once #include "event/net/ConnectSocket.hxx" @@ -46,5 +21,3 @@ */ void Start(const char *host, unsigned port) noexcept; }; - -#endif
View file
ncmpc-0.47.tar.xz/src/net/Features.hxx -> ncmpc-0.48.tar.xz/src/net/Features.hxx
Changed
@@ -1,38 +1,10 @@ -/* ncmpc (Ncurses MPD Client) - Copyright 2004-2021 The Music Player Daemon Project +// SPDX-License-Identifier: BSD-2-Clause +// Copyright The Music Player Daemon Project - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef NET_FEATURES_HXX -#define NET_FEATURES_HXX +#pragma once #define HAVE_TCP #ifndef _WIN32 #define HAVE_UN #endif - -#endif -
View file
ncmpc-0.47.tar.xz/src/net/HostParser.cxx -> ncmpc-0.48.tar.xz/src/net/HostParser.cxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #include "HostParser.hxx" #include "util/CharUtil.hxx"
View file
ncmpc-0.47.tar.xz/src/net/HostParser.hxx -> ncmpc-0.48.tar.xz/src/net/HostParser.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/net/IPv4Address.cxx -> ncmpc-0.48.tar.xz/src/net/IPv4Address.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "IPv4Address.hxx"
View file
ncmpc-0.47.tar.xz/src/net/IPv4Address.hxx -> ncmpc-0.48.tar.xz/src/net/IPv4Address.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef IPV4_ADDRESS_HXX #define IPV4_ADDRESS_HXX
View file
ncmpc-0.47.tar.xz/src/net/IPv6Address.cxx -> ncmpc-0.48.tar.xz/src/net/IPv6Address.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "IPv6Address.hxx" #include "IPv4Address.hxx"
View file
ncmpc-0.47.tar.xz/src/net/IPv6Address.hxx -> ncmpc-0.48.tar.xz/src/net/IPv6Address.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef IPV6_ADDRESS_HXX #define IPV6_ADDRESS_HXX
View file
ncmpc-0.47.tar.xz/src/net/Resolver.cxx -> ncmpc-0.48.tar.xz/src/net/Resolver.cxx
Changed
@@ -1,40 +1,13 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #include "Resolver.hxx" #include "AddressInfo.hxx" #include "HostParser.hxx" #include "util/RuntimeError.hxx" #include "util/CharUtil.hxx" +#include "util/StringAPI.hxx" #ifdef _WIN32 #include <ws2tcpip.h> @@ -44,8 +17,6 @@ #include <net/if.h> #endif -#include <cstring> - #include <stdio.h> AddressInfoList @@ -129,7 +100,7 @@ } else throw std::runtime_error("Garbage after host name"); - if (ai_is_passive(hints) && strcmp(host, "*") == 0) + if (ai_is_passive(hints) && StringIsEqual(host, "*")) host = nullptr; } else { host = nullptr;
View file
ncmpc-0.47.tar.xz/src/net/Resolver.hxx -> ncmpc-0.48.tar.xz/src/net/Resolver.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #ifndef NET_RESOLVER_HXX #define NET_RESOLVER_HXX
View file
ncmpc-0.47.tar.xz/src/net/SocketAddress.cxx -> ncmpc-0.48.tar.xz/src/net/SocketAddress.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "SocketAddress.hxx" #include "IPv4Address.hxx" @@ -129,8 +103,6 @@ } } -#ifdef __cpp_lib_span - static std::span<const std::byte> GetSteadyPart(const struct sockaddr_in &address) noexcept { @@ -149,12 +121,8 @@ }; } -#endif // __cpp_lib_span - #endif // HAVE_TCP -#ifdef __cpp_lib_span - std::span<const std::byte> SocketAddress::GetSteadyPart() const noexcept { @@ -179,5 +147,3 @@ return {}; } } - -#endif
View file
ncmpc-0.47.tar.xz/src/net/SocketAddress.hxx -> ncmpc-0.48.tar.xz/src/net/SocketAddress.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef SOCKET_ADDRESS_HXX #define SOCKET_ADDRESS_HXX @@ -39,15 +13,12 @@ #endif #include <cstddef> +#include <span> #if __cplusplus >= 202002 || (defined(__GNUC__) && __GNUC__ >= 10) #include <version> #endif -#ifdef __cpp_lib_span -#include <span> -#endif - #ifdef HAVE_UN #include <string_view> #endif @@ -79,11 +50,9 @@ size_type _size) noexcept :address(_address), size(_size) {} -#ifdef __cpp_lib_span explicit SocketAddress(std::span<const std::byte> src) noexcept :address((const struct sockaddr *)(const void *)src.data()), size(src.size()) {} -#endif static constexpr SocketAddress Null() noexcept { return nullptr; @@ -164,13 +133,21 @@ IPv4Address UnmapV4() const noexcept; /** + * Does the address family support port numbers? + */ + gnu::pure + bool HasPort() const noexcept { + return !IsNull() && + (GetFamily() == AF_INET || GetFamily() == AF_INET6); + } + + /** * Extract the port number. Returns 0 if not applicable. */ gnu::pure unsigned GetPort() const noexcept; #endif -#ifdef __cpp_lib_span operator std::span<const std::byte>() const noexcept { const void *q = reinterpret_cast<const void *>(address); return { @@ -188,7 +165,6 @@ */ gnu::pure std::span<const std::byte> GetSteadyPart() const noexcept; -#endif gnu::pure bool operator==(const SocketAddress other) const noexcept;
View file
ncmpc-0.47.tar.xz/src/net/SocketDescriptor.cxx -> ncmpc-0.48.tar.xz/src/net/SocketDescriptor.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "SocketDescriptor.hxx" #include "SocketAddress.hxx" @@ -34,7 +8,6 @@ #include "IPv6Address.hxx" #ifdef _WIN32 -#include <winsock2.h> #include <ws2tcpip.h> #else #include <sys/socket.h> @@ -78,7 +51,7 @@ #endif SocketDescriptor -SocketDescriptor::Accept() noexcept +SocketDescriptor::Accept() const noexcept { #ifdef __linux__ int connection_fd = ::accept4(Get(), nullptr, nullptr, SOCK_CLOEXEC); @@ -120,7 +93,7 @@ } bool -SocketDescriptor::Connect(SocketAddress address) noexcept +SocketDescriptor::Connect(SocketAddress address) const noexcept { assert(address.IsDefined()); @@ -213,7 +186,7 @@ #endif int -SocketDescriptor::GetError() noexcept +SocketDescriptor::GetError() const noexcept { assert(IsDefined()); @@ -254,7 +227,7 @@ #ifdef _WIN32 bool -SocketDescriptor::SetNonBlocking() noexcept +SocketDescriptor::SetNonBlocking() const noexcept { u_long val = 1; return ioctlsocket(fd, FIONBIO, &val) == 0; @@ -264,7 +237,7 @@ bool SocketDescriptor::SetOption(int level, int name, - const void *value, std::size_t size) noexcept + const void *value, std::size_t size) const noexcept { assert(IsDefined()); @@ -273,13 +246,13 @@ } bool -SocketDescriptor::SetKeepAlive(bool value) noexcept +SocketDescriptor::SetKeepAlive(bool value) const noexcept { return SetBoolOption(SOL_SOCKET, SO_KEEPALIVE, value); } bool -SocketDescriptor::SetReuseAddress(bool value) noexcept +SocketDescriptor::SetReuseAddress(bool value) const noexcept { return SetBoolOption(SOL_SOCKET, SO_REUSEADDR, value); } @@ -287,50 +260,50 @@ #ifdef __linux__ bool -SocketDescriptor::SetReusePort(bool value) noexcept +SocketDescriptor::SetReusePort(bool value) const noexcept { return SetBoolOption(SOL_SOCKET, SO_REUSEPORT, value); } bool -SocketDescriptor::SetFreeBind(bool value) noexcept +SocketDescriptor::SetFreeBind(bool value) const noexcept { return SetBoolOption(IPPROTO_IP, IP_FREEBIND, value); } bool -SocketDescriptor::SetNoDelay(bool value) noexcept +SocketDescriptor::SetNoDelay(bool value) const noexcept { return SetBoolOption(IPPROTO_TCP, TCP_NODELAY, value); } bool -SocketDescriptor::SetCork(bool value) noexcept +SocketDescriptor::SetCork(bool value) const noexcept { return SetBoolOption(IPPROTO_TCP, TCP_CORK, value); } bool -SocketDescriptor::SetTcpDeferAccept(const int &seconds) noexcept +SocketDescriptor::SetTcpDeferAccept(const int &seconds) const noexcept { return SetOption(IPPROTO_TCP, TCP_DEFER_ACCEPT, &seconds, sizeof(seconds)); } bool -SocketDescriptor::SetTcpUserTimeout(const unsigned &milliseconds) noexcept +SocketDescriptor::SetTcpUserTimeout(const unsigned &milliseconds) const noexcept { return SetOption(IPPROTO_TCP, TCP_USER_TIMEOUT, &milliseconds, sizeof(milliseconds)); } bool -SocketDescriptor::SetV6Only(bool value) noexcept +SocketDescriptor::SetV6Only(bool value) const noexcept { return SetBoolOption(IPPROTO_IPV6, IPV6_V6ONLY, value); } bool -SocketDescriptor::SetBindToDevice(const char *name) noexcept +SocketDescriptor::SetBindToDevice(const char *name) const noexcept { return SetOption(SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name)); } @@ -338,7 +311,7 @@ #ifdef TCP_FASTOPEN bool -SocketDescriptor::SetTcpFastOpen(int qlen) noexcept +SocketDescriptor::SetTcpFastOpen(int qlen) const noexcept { return SetOption(SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)); } @@ -346,7 +319,7 @@ #endif bool -SocketDescriptor::AddMembership(const IPv4Address &address) noexcept +SocketDescriptor::AddMembership(const IPv4Address &address) const noexcept { struct ip_mreq r{address.GetAddress(), IPv4Address(0).GetAddress()}; return setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, @@ -354,7 +327,7 @@ } bool -SocketDescriptor::AddMembership(const IPv6Address &address) noexcept +SocketDescriptor::AddMembership(const IPv6Address &address) const noexcept { struct ipv6_mreq r{address.GetAddress(), 0}; r.ipv6mr_interface = address.GetScopeId(); @@ -363,7 +336,7 @@ } bool -SocketDescriptor::AddMembership(SocketAddress address) noexcept +SocketDescriptor::AddMembership(SocketAddress address) const noexcept { switch (address.GetFamily()) { case AF_INET: @@ -381,7 +354,7 @@ #endif
View file
ncmpc-0.47.tar.xz/src/net/SocketDescriptor.hxx -> ncmpc-0.48.tar.xz/src/net/SocketDescriptor.hxx
Changed
@@ -1,39 +1,21 @@ -/* - * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef SOCKET_DESCRIPTOR_HXX #define SOCKET_DESCRIPTOR_HXX #include "Features.hxx" + +#ifndef _WIN32 #include "io/FileDescriptor.hxx" +#endif #include <type_traits> +#include <utility> + +#ifdef _WIN32 +#include <winsock2.h> // for SOCKET, INVALID_SOCKET +#endif class SocketAddress; class StaticSocketAddress; @@ -41,24 +23,44 @@ class IPv6Address; /** - * An OO wrapper for a UNIX socket descriptor. + * An OO wrapper for a Berkeley or WinSock socket descriptor. */ -class SocketDescriptor : protected FileDescriptor { +class SocketDescriptor +#ifndef _WIN32 +/* Berkeley sockets are represented as file descriptors */ + : protected FileDescriptor +#endif +{ protected: +#ifdef _WIN32 + /* WinSock sockets are not file descriptors, they are a + special type */ + SOCKET fd; +#else // !_WIN32 explicit constexpr SocketDescriptor(FileDescriptor _fd) noexcept :FileDescriptor(_fd) {} +#endif // !_WIN32 public: SocketDescriptor() = default; +#ifdef _WIN32 + explicit constexpr SocketDescriptor(SOCKET _fd) noexcept + :fd(_fd) {} +#else // !_WIN32 explicit constexpr SocketDescriptor(int _fd) noexcept :FileDescriptor(_fd) {} +#endif // !_WIN32 constexpr bool operator==(SocketDescriptor other) const noexcept { return fd == other.fd; } -#ifndef _WIN32 +#ifdef _WIN32 + constexpr bool IsDefined() const noexcept { + return fd != INVALID_SOCKET; + } +#else // !_WIN32 /** * Convert a #FileDescriptor to a #SocketDescriptor. This is only * possible on operating systems where socket descriptors are the @@ -78,13 +80,11 @@ constexpr const FileDescriptor &ToFileDescriptor() const noexcept { return *this; } -#endif using FileDescriptor::IsDefined; -#ifndef _WIN32 using FileDescriptor::IsValid; using FileDescriptor::IsSocket; -#endif +#endif // !_WIN32 /** * Determine the socket type, i.e. SOCK_STREAM, SOCK_DGRAM or @@ -99,26 +99,49 @@ gnu::pure bool IsStream() const noexcept; + static constexpr SocketDescriptor Undefined() noexcept { +#ifdef _WIN32 + return SocketDescriptor{INVALID_SOCKET}; +#else // !_WIN32 + return SocketDescriptor(FileDescriptor::Undefined()); +#endif // !_WIN32 + } + +#ifndef _WIN32 using FileDescriptor::Get; using FileDescriptor::Set; using FileDescriptor::Steal; using FileDescriptor::SetUndefined; - static constexpr SocketDescriptor Undefined() noexcept { - return SocketDescriptor(FileDescriptor::Undefined()); - } - using FileDescriptor::EnableCloseOnExec; using FileDescriptor::DisableCloseOnExec; -#ifndef _WIN32 using FileDescriptor::SetNonBlocking; using FileDescriptor::SetBlocking; using FileDescriptor::Duplicate; using FileDescriptor::CheckDuplicate; using FileDescriptor::Close; #else - bool SetNonBlocking() noexcept; + constexpr SOCKET Get() const noexcept { + return fd; + } + + constexpr void Set(SOCKET _fd) noexcept { + fd = _fd; + } + + constexpr void SetUndefined() noexcept { + fd = INVALID_SOCKET; + } + + constexpr SOCKET Steal() noexcept { + return std::exchange(fd, INVALID_SOCKET); + } + + void EnableCloseOnExec() const noexcept {} + void DisableCloseOnExec() const noexcept {} + + bool SetNonBlocking() const noexcept; /** * This method replaces FileDescriptor::Close(), using closesocket() @@ -154,7 +177,8 @@ SocketDescriptor &b) noexcept; #endif - int GetError() noexcept; + gnu::pure + int GetError() const noexcept; /** * @return the value size or 0 on error @@ -172,62 +196,63 @@ #endif bool SetOption(int level, int name, - const void *value, std::size_t size) noexcept; + const void *value, std::size_t size) const noexcept; - bool SetIntOption(int level, int name, const int &value) noexcept { + bool SetIntOption(int level, int name, + const int &value) const noexcept { return SetOption(level, name, &value, sizeof(value)); } - bool SetBoolOption(int level, int name, bool value) noexcept { + bool SetBoolOption(int level, int name, bool value) const noexcept { return SetIntOption(level, name, value); } - bool SetKeepAlive(bool value=true) noexcept; - bool SetReuseAddress(bool value=true) noexcept; + bool SetKeepAlive(bool value=true) const noexcept;
View file
ncmpc-0.47.tar.xz/src/net/SocketError.cxx -> ncmpc-0.48.tar.xz/src/net/SocketError.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2015-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "SocketError.hxx"
View file
ncmpc-0.47.tar.xz/src/net/SocketError.hxx -> ncmpc-0.48.tar.xz/src/net/SocketError.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2015-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/net/StaticSocketAddress.cxx -> ncmpc-0.48.tar.xz/src/net/StaticSocketAddress.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "StaticSocketAddress.hxx" #include "IPv4Address.hxx"
View file
ncmpc-0.47.tar.xz/src/net/StaticSocketAddress.hxx -> ncmpc-0.48.tar.xz/src/net/StaticSocketAddress.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef STATIC_SOCKET_ADDRESS_HXX #define STATIC_SOCKET_ADDRESS_HXX
View file
ncmpc-0.47.tar.xz/src/net/UniqueSocketDescriptor.hxx -> ncmpc-0.48.tar.xz/src/net/UniqueSocketDescriptor.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef UNIQUE_SOCKET_DESCRIPTOR_SOCKET_HXX #define UNIQUE_SOCKET_DESCRIPTOR_SOCKET_HXX @@ -46,13 +20,20 @@ explicit UniqueSocketDescriptor(SocketDescriptor _fd) noexcept :SocketDescriptor(_fd) {} +#ifndef _WIN32 explicit UniqueSocketDescriptor(FileDescriptor _fd) noexcept :SocketDescriptor(_fd) {} +#endif // !_WIN32 explicit UniqueSocketDescriptor(int _fd) noexcept :SocketDescriptor(_fd) {} +#ifdef _WIN32 + UniqueSocketDescriptor(UniqueSocketDescriptor &&other) noexcept + :SocketDescriptor(std::exchange(other.fd, INVALID_SOCKET)) {} +#else // !_WIN32 UniqueSocketDescriptor(UniqueSocketDescriptor &&other) noexcept :SocketDescriptor(std::exchange(other.fd, -1)) {} +#endif // !_WIN32 ~UniqueSocketDescriptor() noexcept { if (IsDefined())
View file
ncmpc-0.47.tar.xz/src/paint.hxx -> ncmpc-0.48.tar.xz/src/paint.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_PAINT_H #define NCMPC_PAINT_H
View file
ncmpc-0.47.tar.xz/src/player_command.cxx -> ncmpc-0.48.tar.xz/src/player_command.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "player_command.hxx" #include "DelayedSeek.hxx"
View file
ncmpc-0.47.tar.xz/src/player_command.hxx -> ncmpc-0.48.tar.xz/src/player_command.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_PLAYER_COMMAND_H #define NCMPC_PLAYER_COMMAND_H
View file
ncmpc-0.47.tar.xz/src/plugin.cxx -> ncmpc-0.48.tar.xz/src/plugin.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "plugin.hxx" #include "io/Path.hxx" @@ -29,6 +14,7 @@ #include <assert.h> #include <stdlib.h> +#include <spawn.h> #include <unistd.h> #include <dirent.h> #include <signal.h> @@ -263,27 +249,19 @@ !UniqueFileDescriptor::CreatePipe(stderr_r, stderr_w)) return -1; - pid = fork(); - - if (pid < 0) - return -1; - - if (pid == 0) { - stdout_w.Duplicate(FileDescriptor(STDOUT_FILENO)); - stderr_w.Duplicate(FileDescriptor(STDERR_FILENO)); + posix_spawn_file_actions_t file_actions; + posix_spawn_file_actions_init(&file_actions); + AtScopeExit(&file_actions) { posix_spawn_file_actions_destroy(&file_actions); }; - stdout_r.Close(); - stdout_w.Close(); - stderr_r.Close(); - stderr_w.Close(); - close(0); - /* XXX close other fds? */ + posix_spawn_file_actions_addclose(&file_actions, STDIN_FILENO); + posix_spawn_file_actions_adddup2(&file_actions, stdout_w.Get(), + STDOUT_FILENO); + posix_spawn_file_actions_adddup2(&file_actions, stderr_w.Get(), + STDERR_FILENO); - execv(plugin_path, argv.get()); - _exit(1); - } - - /* XXX CLOEXEC? */ + if (posix_spawn(&pid, plugin_path, &file_actions, nullptr, + argv.get(), environ) != 0) + return -1; pipe_stdout.Start(std::move(stdout_r)); pipe_stderr.Start(std::move(stderr_r));
View file
ncmpc-0.47.tar.xz/src/plugin.hxx -> ncmpc-0.48.tar.xz/src/plugin.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef PLUGIN_H #define PLUGIN_H
View file
ncmpc-0.47.tar.xz/src/save_playlist.cxx -> ncmpc-0.48.tar.xz/src/save_playlist.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "save_playlist.hxx" #include "db_completion.hxx" @@ -33,11 +18,13 @@ #ifndef NCMPC_MINI class PlaylistNameCompletion final : public Completion { + ScreenManager &screen; struct mpdclient &c; public: - explicit PlaylistNameCompletion(struct mpdclient &_c) noexcept - :c(_c) {} + PlaylistNameCompletion(ScreenManager &_screen, + struct mpdclient &_c) noexcept + :screen(_screen), c(_c) {} protected: /* virtual methods from class Completion */ @@ -60,13 +47,14 @@ { if (range.begin() != range.end() && std::next(range.begin()) != range.end()) - screen_display_completion_list(range); + screen_display_completion_list(screen, range); } #endif int -playlist_save(struct mpdclient *c, const char *name, +playlist_save(ScreenManager &screen, struct mpdclient *c, + const char *name, const char *defaultname) noexcept { std::string filename; @@ -76,12 +64,12 @@ Completion *completion = nullptr; #else /* initialize completion support */ - PlaylistNameCompletion _completion(*c); + PlaylistNameCompletion _completion{screen, *c}; auto *completion = &_completion; #endif /* query the user for a filename */ - filename = screen_readln(_("Save queue as"), + filename = screen_readln(screen, _("Save queue as"), defaultname, nullptr, completion); @@ -104,7 +92,7 @@ char prompt256; snprintf(prompt, sizeof(prompt), _("Replace %s?"), filename.c_str()); - bool replace = screen_get_yesno(prompt, false); + bool replace = screen_get_yesno(screen, prompt, false); if (!replace) { screen_status_message(_("Aborted")); return -1;
View file
ncmpc-0.47.tar.xz/src/save_playlist.hxx -> ncmpc-0.48.tar.xz/src/save_playlist.hxx
Changed
@@ -1,28 +1,15 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef SAVE_PLAYLIST_H #define SAVE_PLAYLIST_H +class ScreenManager; struct mpdclient; int -playlist_save(struct mpdclient *c, const char *name, +playlist_save(ScreenManager &screen, struct mpdclient *c, + const char *name, const char *defaultname) noexcept; #endif
View file
ncmpc-0.47.tar.xz/src/screen.cxx -> ncmpc-0.48.tar.xz/src/screen.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen.hxx" #include "PageMeta.hxx" @@ -30,11 +15,10 @@ #include "player_command.hxx" #include "SongPage.hxx" #include "LyricsPage.hxx" +#include "util/StringAPI.hxx" #include <mpd/client.h> -#include <string.h> - ScreenManager::PageMap::iterator ScreenManager::MakePage(const PageMeta &sf) noexcept { @@ -102,7 +86,7 @@ unsigned i; for (i = 0; i < options.screen_list.size(); ++i) - if (strcmp(options.screen_listi.c_str(), name) == 0) + if (StringIsEqual(options.screen_listi.c_str(), name)) return i; return -1;
View file
ncmpc-0.47.tar.xz/src/screen.hxx -> ncmpc-0.48.tar.xz/src/screen.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef SCREEN_H #define SCREEN_H
View file
ncmpc-0.47.tar.xz/src/screen_client.cxx -> ncmpc-0.48.tar.xz/src/screen_client.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen_client.hxx" #include "screen_status.hxx"
View file
ncmpc-0.47.tar.xz/src/screen_client.hxx -> ncmpc-0.48.tar.xz/src/screen_client.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_SCREEN_CLIENT_H #define NCMPC_SCREEN_CLIENT_H
View file
ncmpc-0.47.tar.xz/src/screen_find.cxx -> ncmpc-0.48.tar.xz/src/screen_find.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen_find.hxx" #include "screen_utils.hxx" @@ -58,7 +43,7 @@ if (screen.findbuf.empty()) { char *value = options.find_show_last_pattern ? (char *) -1 : nullptr; - screen.findbuf=screen_readln(prompt, + screen.findbuf=screen_readln(screen, prompt, value, &screen.find_history, nullptr); @@ -106,7 +91,7 @@ char *iter = search_str; while(1) { - key = screen_getch(buffer); + key = screen_getch(screen, buffer); /* if backspace or delete was pressed, process instead of ending loop */ if (key == KEY_BACKSPACE || key == KEY_DC) { const char *prev = PrevCharMB(buffer, iter);
View file
ncmpc-0.47.tar.xz/src/screen_find.hxx -> ncmpc-0.48.tar.xz/src/screen_find.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_SCREEN_FIND_H #define NCMPC_SCREEN_FIND_H
View file
ncmpc-0.47.tar.xz/src/screen_init.cxx -> ncmpc-0.48.tar.xz/src/screen_init.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen.hxx" #include "Page.hxx"
View file
ncmpc-0.47.tar.xz/src/screen_list.cxx -> ncmpc-0.48.tar.xz/src/screen_list.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen_list.hxx" #include "PageMeta.hxx" @@ -30,6 +15,7 @@ #include "OutputsPage.hxx" #include "ChatPage.hxx" #include "config.h" +#include "util/StringAPI.hxx" #include <iterator> @@ -79,12 +65,12 @@ screen_lookup_name(const char *name) noexcept { for (const auto *i : screens) - if (strcmp(name, i->name) == 0) + if (StringIsEqual(name, i->name)) return i; #ifdef ENABLE_LIBRARY_PAGE /* compatibility with 0.32 and older */ - if (strcmp(name, "artist") == 0) + if (StringIsEqual(name, "artist")) return &library_page; #endif
View file
ncmpc-0.47.tar.xz/src/screen_list.hxx -> ncmpc-0.48.tar.xz/src/screen_list.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef SCREEN_LIST_H #define SCREEN_LIST_H
View file
ncmpc-0.47.tar.xz/src/screen_paint.cxx -> ncmpc-0.48.tar.xz/src/screen_paint.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen.hxx" #include "Page.hxx"
View file
ncmpc-0.47.tar.xz/src/screen_status.cxx -> ncmpc-0.48.tar.xz/src/screen_status.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen_status.hxx" #include "screen.hxx"
View file
ncmpc-0.47.tar.xz/src/screen_status.hxx -> ncmpc-0.48.tar.xz/src/screen_status.hxx
Changed
@@ -1,32 +1,17 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef NCMPC_SCREEN_STATUS_H #define NCMPC_SCREEN_STATUS_H -#include "util/Compiler.h" - #include <exception> void screen_status_message(const char *msg) noexcept; -gcc_printf(1, 2) +#ifdef __GNUC__ +__attribute__((format(printf, 1, 2))) +#endif void screen_status_printf(const char *format, ...) noexcept;
View file
ncmpc-0.47.tar.xz/src/screen_utils.cxx -> ncmpc-0.48.tar.xz/src/screen_utils.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "screen_utils.hxx" #include "screen.hxx" @@ -23,7 +8,6 @@ #include "Options.hxx" #include "Styles.hxx" #include "wreadln.hxx" -#include "ncmpc.hxx" #include "config.h" #ifndef _WIN32 @@ -54,9 +38,9 @@ } int -screen_getch(const char *prompt) noexcept +screen_getch(ScreenManager &screen, const char *prompt) noexcept { - WINDOW *w = screen->status_bar.GetWindow().w; + WINDOW *w = screen.status_bar.GetWindow().w; SelectStyle(w, Style::STATUS_ALERT); werase(w); @@ -91,7 +75,7 @@ } bool -screen_get_yesno(const char *_prompt, bool def) noexcept +screen_get_yesno(ScreenManager &screen, const char *_prompt, bool def) noexcept { /* NOTE: if one day a translator decides to use a multi-byte character for one of the yes/no keys, we'll have to parse it properly */ @@ -100,7 +84,7 @@ snprintf(prompt, sizeof(prompt), "%s %s/%s ", _prompt, YES_TRANSLATION, NO_TRANSLATION); - int key = tolower(screen_getch(prompt)); + int key = tolower(screen_getch(screen, prompt)); if (key == YES_TRANSLATION0) return true; else if (key == NO_TRANSLATION0) @@ -110,12 +94,12 @@ } std::string -screen_readln(const char *prompt, +screen_readln(ScreenManager &screen, const char *prompt, const char *value, History *history, Completion *completion) noexcept { - auto *window = &screen->status_bar.GetWindow(); + auto *window = &screen.status_bar.GetWindow(); WINDOW *w = window->w; wmove(w, 0,0); @@ -137,9 +121,9 @@ } std::string -screen_read_password(const char *prompt) noexcept +screen_read_password(ScreenManager &screen, const char *prompt) noexcept { - auto *window = &screen->status_bar.GetWindow(); + auto *window = &screen.status_bar.GetWindow(); WINDOW *w = window->w; wmove(w, 0,0); @@ -183,16 +167,16 @@ } void -screen_display_completion_list(Completion::Range range) noexcept +screen_display_completion_list(ScreenManager &screen, Completion::Range range) noexcept { static Completion::Range prev_range; static size_t prev_length = 0; static unsigned offset = 0; - WINDOW *w = screen->main_window.w; + WINDOW *w = screen.main_window.w; size_t length = std::distance(range.begin(), range.end()); if (range == prev_range && length == prev_length) { - offset += screen->main_window.size.height; + offset += screen.main_window.size.height; if (offset >= length) offset = 0; } else { @@ -204,7 +188,7 @@ SelectStyle(w, Style::STATUS_ALERT); auto i = std::next(range.begin(), offset); - for (unsigned y = 0; y < screen->main_window.size.height; ++y, ++i) { + for (unsigned y = 0; y < screen.main_window.size.height; ++y, ++i) { wmove(w, y, 0); if (i == range.end()) break;
View file
ncmpc-0.47.tar.xz/src/screen_utils.hxx -> ncmpc-0.48.tar.xz/src/screen_utils.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef SCREEN_UTILS_H #define SCREEN_UTILS_H @@ -22,13 +7,15 @@ #include "History.hxx" #include "Completion.hxx" +class ScreenManager; + /* sound an audible and/or visible bell */ void screen_bell() noexcept; /* read a character from the status window */ int -screen_getch(const char *prompt) noexcept; +screen_getch(ScreenManager &screen, const char *prompt) noexcept; /** * display a prompt, wait for the user to press a key, and compare it with @@ -38,16 +25,18 @@ * pressed the key for "no"; def otherwise */ bool -screen_get_yesno(const char *prompt, bool def) noexcept; +screen_get_yesno(ScreenManager &screen, const char *prompt, bool def) noexcept; std::string -screen_read_password(const char *prompt) noexcept; +screen_read_password(ScreenManager &screen, const char *prompt) noexcept; std::string -screen_readln(const char *prompt, const char *value, +screen_readln(ScreenManager &screen, const char *prompt, + const char *value, History *history, Completion *completion) noexcept; void -screen_display_completion_list(Completion::Range range) noexcept; +screen_display_completion_list(ScreenManager &screen, + Completion::Range range) noexcept; #endif
View file
ncmpc-0.47.tar.xz/src/signals.cxx -> ncmpc-0.48.tar.xz/src/signals.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include <signal.h> #include "Instance.hxx"
View file
ncmpc-0.47.tar.xz/src/strfsong.cxx -> ncmpc-0.48.tar.xz/src/strfsong.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "strfsong.hxx" #include "charset.hxx"
View file
ncmpc-0.47.tar.xz/src/strfsong.hxx -> ncmpc-0.48.tar.xz/src/strfsong.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef STRFSONG_H #define STRFSONG_H
View file
ncmpc-0.47.tar.xz/src/system/EpollFD.cxx -> ncmpc-0.48.tar.xz/src/system/EpollFD.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "EpollFD.hxx" #include "Error.hxx"
View file
ncmpc-0.47.tar.xz/src/system/EpollFD.hxx -> ncmpc-0.48.tar.xz/src/system/EpollFD.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef EPOLL_FD_HXX #define EPOLL_FD_HXX
View file
ncmpc-0.47.tar.xz/src/system/Error.hxx -> ncmpc-0.48.tar.xz/src/system/Error.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/system/EventFD.cxx -> ncmpc-0.48.tar.xz/src/system/EventFD.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "EventFD.hxx" #include "system/Error.hxx" @@ -35,8 +9,9 @@ #include <sys/eventfd.h> EventFD::EventFD() + :fd(::eventfd(0, EFD_NONBLOCK|EFD_CLOEXEC)) { - if (!fd.CreateEventFD(0)) + if (!fd.IsDefined()) throw MakeErrno("eventfd() failed"); }
View file
ncmpc-0.47.tar.xz/src/system/EventFD.hxx -> ncmpc-0.48.tar.xz/src/system/EventFD.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef EVENT_FD_HXX #define EVENT_FD_HXX
View file
ncmpc-0.47.tar.xz/src/system/EventPipe.cxx -> ncmpc-0.48.tar.xz/src/system/EventPipe.cxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "EventPipe.hxx" #include "io/FileDescriptor.hxx"
View file
ncmpc-0.47.tar.xz/src/system/EventPipe.hxx -> ncmpc-0.48.tar.xz/src/system/EventPipe.hxx
Changed
@@ -1,21 +1,5 @@ -/* - * Copyright 2003-2021 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef MPD_EVENT_PIPE_HXX #define MPD_EVENT_PIPE_HXX
View file
ncmpc-0.47.tar.xz/src/system/SignalFD.cxx -> ncmpc-0.48.tar.xz/src/system/SignalFD.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "SignalFD.hxx" #include "Error.hxx" @@ -37,8 +11,15 @@ void SignalFD::Create(const sigset_t &mask) { - if (!fd.CreateSignalFD(&mask)) + int new_fd = ::signalfd(fd.Get(), &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (new_fd < 0) throw MakeErrno("signalfd() failed"); + + if (!fd.IsDefined()) { + fd = UniqueFileDescriptor{new_fd}; + } + + assert(new_fd == fd.Get()); } int
View file
ncmpc-0.47.tar.xz/src/system/SignalFD.hxx -> ncmpc-0.48.tar.xz/src/system/SignalFD.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef SIGNAL_FD_HXX #define SIGNAL_FD_HXX
View file
ncmpc-0.47.tar.xz/src/time/ClockCache.hxx -> ncmpc-0.48.tar.xz/src/time/ClockCache.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/time_format.cxx -> ncmpc-0.48.tar.xz/src/time_format.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "time_format.hxx" #include "i18n.h"
View file
ncmpc-0.47.tar.xz/src/time_format.hxx -> ncmpc-0.48.tar.xz/src/time_format.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef TIME_FORMAT_H #define TIME_FORMAT_H
View file
ncmpc-0.47.tar.xz/src/util/BindMethod.hxx -> ncmpc-0.48.tar.xz/src/util/BindMethod.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/util/ByteOrder.hxx -> ncmpc-0.48.tar.xz/src/util/ByteOrder.hxx
Changed
@@ -1,36 +1,7 @@ -/* - * Copyright 2011-2021 Max Kellermann <max.kellermann@gmail.com>, - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef BYTE_ORDER_HXX -#define BYTE_ORDER_HXX +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> -#include "Compiler.h" +#pragma once #include <cstdint> @@ -108,7 +79,7 @@ constexpr uint16_t ByteSwap16(uint16_t value) noexcept { -#if CLANG_OR_GCC_VERSION(4,8) +#ifdef __GNUC__ return __builtin_bswap16(value); #else return GenericByteSwap16(value); @@ -118,7 +89,7 @@ constexpr uint32_t ByteSwap32(uint32_t value) noexcept { -#if CLANG_OR_GCC_VERSION(4,3) +#ifdef __GNUC__ return __builtin_bswap32(value); #else return GenericByteSwap32(value); @@ -128,7 +99,7 @@ constexpr uint64_t ByteSwap64(uint64_t value) noexcept { -#if CLANG_OR_GCC_VERSION(4,3) +#ifdef __GNUC__ return __builtin_bswap64(value); #else return GenericByteSwap64(value); @@ -329,14 +300,6 @@ (uint32_t(c) << 8) | uint32_t(d); } - PackedBE32 &operator=(uint32_t new_value) noexcept { - d = uint8_t(new_value); - c = uint8_t(new_value >> 8); - b = uint8_t(new_value >> 16); - a = uint8_t(new_value >> 24); - return *this; - } - /** * Reads the raw, big-endian value. */ @@ -506,4 +469,54 @@ static_assert(sizeof(PackedLE32) == sizeof(uint32_t), "Wrong size"); static_assert(alignof(PackedLE32) == 1, "Wrong alignment"); -#endif +/** + * A packed little-endian 64 bit integer. + */ +class PackedLE64 { + uint8_t a, b, c, d, e, f, g, h; + +public: + PackedLE64() = default; + + constexpr PackedLE64(uint64_t src) noexcept + :a(uint8_t(src)), + b(uint8_t(src >> 8)), + c(uint8_t(src >> 16)), + d(uint8_t(src >> 24)), + e(uint8_t(src >> 32)), + f(uint8_t(src >> 40)), + g(uint8_t(src >> 48)), + h(uint8_t(src >> 56)) {} + + /** + * Construct an instance from an integer which is already + * little-endian. + */ + static constexpr auto FromLE(uint64_t src) noexcept { + union { + uint64_t in; + PackedLE64 out; + } u{src}; + return u.out; + } + + constexpr operator uint64_t() const noexcept { + return uint64_t(a) | (uint64_t(b) << 8) | + (uint64_t(c) << 16) | (uint64_t(d) << 24) | + (uint64_t(e) << 32) | (uint64_t(f) << 40) | + (uint64_t(g) << 48) | (uint64_t(h) << 56); + } + + /** + * Reads the raw, big-endian value. + */ + constexpr uint64_t raw() const noexcept { + uint64_t x = *this; + if (IsBigEndian()) + x = ByteSwap64(x); + return x; + } +}; + +static_assert(sizeof(PackedLE64) == sizeof(uint64_t), "Wrong size"); +static_assert(alignof(PackedLE64) == 1, "Wrong alignment");
View file
ncmpc-0.47.tar.xz/src/util/Cancellable.hxx -> ncmpc-0.48.tar.xz/src/util/Cancellable.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2016-2019 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef CANCELLABLE_HXX #define CANCELLABLE_HXX
View file
ncmpc-0.47.tar.xz/src/util/Cast.hxx -> ncmpc-0.48.tar.xz/src/util/Cast.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright (C) 2013-2014 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef CAST_HXX #define CAST_HXX
View file
ncmpc-0.47.tar.xz/src/util/CharUtil.hxx -> ncmpc-0.48.tar.xz/src/util/CharUtil.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2011-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef CHAR_UTIL_HXX #define CHAR_UTIL_HXX @@ -123,6 +97,12 @@ return IsAlphaASCII(ch) || IsDigitASCII(ch); } +constexpr bool +IsLowerAlphaNumericASCII(char ch) noexcept +{ + return IsLowerAlphaASCII(ch) || IsDigitASCII(ch); +} + /** * Convert the specified ASCII character (0x00..0x7f) to upper case. * Unlike toupper(), it ignores the system locale.
View file
ncmpc-0.48.tar.xz/src/util/Concepts.hxx
Added
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> + +#pragma once + +#include <concepts> + +/** + * Compatibility wrapper for std::invocable which is unavailable in + * the Android NDK r25b and Apple Xcode. + */ +#if !defined(ANDROID) && !defined(__APPLE__) +template<typename F, typename... Args> +concept Invocable = std::invocable<F, Args...>; +#else +template<typename F, typename... Args> +concept Invocable = requires(F f, Args... args) { + { f(args...) }; +}; +#endif + +/** + * Compatibility wrapper for std::predicate which is unavailable in + * the Android NDK r25b and Apple Xcode. + */ +#if !defined(ANDROID) && !defined(__APPLE__) +template<typename F, typename... Args> +concept Predicate = std::predicate<F, Args...>; +#else +template<typename F, typename... Args> +concept Predicate = requires(F f, Args... args) { + { f(args...) } -> std::same_as<bool>; +}; +#endif + +template<typename F, typename T> +concept Disposer = Invocable<F, T *>;
View file
ncmpc-0.47.tar.xz/src/util/Exception.cxx -> ncmpc-0.48.tar.xz/src/util/Exception.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2016-2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "Exception.hxx"
View file
ncmpc-0.47.tar.xz/src/util/Exception.hxx -> ncmpc-0.48.tar.xz/src/util/Exception.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef EXCEPTION_HXX #define EXCEPTION_HXX
View file
ncmpc-0.47.tar.xz/src/util/FNVHash.hxx -> ncmpc-0.48.tar.xz/src/util/FNVHash.hxx
Changed
@@ -1,41 +1,12 @@ -/* - * Copyright 2017 Content Management AG - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> /* * Implementation of the Fowler-Noll-Vo hash function. */ -#ifndef FNV_HASH_HXX -#define FNV_HASH_HXX +#pragma once #include <stddef.h> #include <stdint.h> @@ -112,5 +83,3 @@ const uint_fast32_t hi(h64 >> 32); return lo ^ hi; } - -#endif
View file
ncmpc-0.48.tar.xz/src/util/IntrusiveHookMode.hxx
Added
@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> + +#pragma once + +/** + * Specifies the mode in which a hook for intrusive containers + * operates. This is meant to be used as a template argument to the + * hook class (e.g. #IntrusiveListHook). + */ +enum class IntrusiveHookMode { + /** + * No implicit initialization. + */ + NORMAL, + + /** + * Keep track of whether the item is currently linked, allows + * using method is_linked(). This requires implicit + * initialization and requires iterating all items when + * deleting them which adds a considerable amount of overhead. + */ + TRACK, + + /** + * Automatically unlinks the item in the destructor. This + * implies #TRACK and adds code to the destructor. + */ + AUTO_UNLINK, +};
View file
ncmpc-0.47.tar.xz/src/util/IntrusiveList.hxx -> ncmpc-0.48.tar.xz/src/util/IntrusiveList.hxx
Changed
@@ -1,38 +1,11 @@ -/* - * Copyright 2020 Max Kellermann <max.kellermann@gmail.com> - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #pragma once #include "Cast.hxx" +#include "Concepts.hxx" +#include "IntrusiveHookMode.hxx" #include "MemberPointer.hxx" #include "OptionalCounter.hxx" @@ -42,8 +15,15 @@ struct IntrusiveListNode { IntrusiveListNode *next, *prev; + + static constexpr void Connect(IntrusiveListNode &a, + IntrusiveListNode &b) noexcept { + a.next = &b; + b.prev = &a; + } }; +template<IntrusiveHookMode _mode=IntrusiveHookMode::NORMAL> class IntrusiveListHook { template<typename T> friend struct IntrusiveListBaseHookTraits; template<auto member> friend struct IntrusiveListMemberHookTraits; @@ -53,14 +33,33 @@ IntrusiveListNode siblings; public: - IntrusiveListHook() noexcept = default; + static constexpr IntrusiveHookMode mode = _mode; + + IntrusiveListHook() noexcept { + if constexpr (mode >= IntrusiveHookMode::TRACK) + siblings.next = nullptr; + } + + ~IntrusiveListHook() noexcept { + if constexpr (mode >= IntrusiveHookMode::AUTO_UNLINK) + if (is_linked()) + unlink(); + } IntrusiveListHook(const IntrusiveListHook &) = delete; IntrusiveListHook &operator=(const IntrusiveListHook &) = delete; void unlink() noexcept { - siblings.next->prev = siblings.prev; - siblings.prev->next = siblings.next; + IntrusiveListNode::Connect(*siblings.prev, *siblings.next); + + if constexpr (mode >= IntrusiveHookMode::TRACK) + siblings.next = nullptr; + } + + bool is_linked() const noexcept { + static_assert(mode >= IntrusiveHookMode::TRACK); + + return siblings.next != nullptr; } private: @@ -73,52 +72,27 @@ } }; -/** - * A variant of #IntrusiveListHook which keeps track of whether it is - * currently in a list. - */ -class SafeLinkIntrusiveListHook : public IntrusiveListHook { -public: - SafeLinkIntrusiveListHook() noexcept { - siblings.next = nullptr; - } - - void unlink() noexcept { - IntrusiveListHook::unlink(); - siblings.next = nullptr; - } - - bool is_linked() const noexcept { - return siblings.next != nullptr; - } -}; - -/** - * A variant of #IntrusiveListHook which auto-unlinks itself from the - * list upon destruction. As a side effect, it has an is_linked() - * method. - */ -class AutoUnlinkIntrusiveListHook : public SafeLinkIntrusiveListHook { -public: - ~AutoUnlinkIntrusiveListHook() noexcept { - if (is_linked()) - unlink(); - } -}; +using SafeLinkIntrusiveListHook = + IntrusiveListHook<IntrusiveHookMode::TRACK>; +using AutoUnlinkIntrusiveListHook = + IntrusiveListHook<IntrusiveHookMode::AUTO_UNLINK>; /** - * Detect the hook type; this is important because - * SafeLinkIntrusiveListHook::unlink() needs to clear the "next" - * pointer. This is a template to postpone the type checks, to allow + * Detect the hook type which is embedded in the given type as a base + * class. This is a template to postpone the type checks, to allow * forward-declared types. */ template<typename U> struct IntrusiveListHookDetection { - static_assert(std::is_base_of_v<IntrusiveListHook, U>); - - using type = std::conditional_t<std::is_base_of_v<SafeLinkIntrusiveListHook, U>, - SafeLinkIntrusiveListHook, - IntrusiveListHook>; + /* TODO can this be simplified somehow, without checking for + all possible enum values? */ + using type = std::conditional_t<std::is_base_of_v<IntrusiveListHook<IntrusiveHookMode::NORMAL>, U>, + IntrusiveListHook<IntrusiveHookMode::NORMAL>, + std::conditional_t<std::is_base_of_v<IntrusiveListHook<IntrusiveHookMode::TRACK>, U>, + IntrusiveListHook<IntrusiveHookMode::TRACK>, + std::conditional_t<std::is_base_of_v<IntrusiveListHook<IntrusiveHookMode::AUTO_UNLINK>, U>, + IntrusiveListHook<IntrusiveHookMode::AUTO_UNLINK>, + void>>>; }; /** @@ -129,27 +103,14 @@ template<typename U> using Hook = typename IntrusiveListHookDetection<U>::type; - static constexpr bool IsAutoUnlink() noexcept { - return std::is_base_of_v<AutoUnlinkIntrusiveListHook, T>; - } - static constexpr T *Cast(IntrusiveListNode *node) noexcept { auto *hook = &Hook<T>::Cast(*node); return static_cast<T *>(hook); } - static constexpr const T *Cast(const IntrusiveListNode *node) noexcept { - const auto *hook = &Hook<T>::Cast(*node); - return static_cast<const T *>(hook); - } - static constexpr auto &ToHook(T &t) noexcept { return static_cast<Hook<T> &>(t); } - - static constexpr const auto &ToHook(const T &t) noexcept { - return static_cast<const Hook<T> &>(t); - } }; /** @@ -159,29 +120,18 @@ struct IntrusiveListMemberHookTraits { using T = MemberPointerContainerType<decltype(member)>; using _Hook = MemberPointerType<decltype(member)>; - using Hook = typename IntrusiveListHookDetection<_Hook>::type; - static constexpr bool IsAutoUnlink() noexcept { - return std::is_base_of_v<AutoUnlinkIntrusiveListHook, _Hook>;
View file
ncmpc-0.48.tar.xz/src/util/IntrusiveSortedList.hxx
Added
@@ -0,0 +1,41 @@ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> + +#pragma once + +#include "IntrusiveList.hxx" + +#include <algorithm> // for std::find_if() + +/** + * A variant of #IntrusiveList which is sorted automatically. There + * are obvious scalability problems with this approach, so use with + * care. + */ +template<typename T, typename Compare=typename T::Compare, + typename HookTraits=IntrusiveListBaseHookTraits<T>, + bool constant_time_size=false> +class IntrusiveSortedList + : public IntrusiveList<T, HookTraits, constant_time_size> +{ + using Base = IntrusiveList<T, HookTraits, constant_time_size>; + + no_unique_address + Compare compare; + +public: + constexpr IntrusiveSortedList() noexcept = default; + IntrusiveSortedList(IntrusiveSortedList &&src) noexcept = default; + + using typename Base::reference; + using Base::begin; + using Base::end; + + void insert(reference item) noexcept { + auto position = std::find_if(begin(), end(), this, &item(const auto &other){ + return !compare(other, item); + }); + + Base::insert(position, item); + } +};
View file
ncmpc-0.47.tar.xz/src/util/LocaleString.cxx -> ncmpc-0.48.tar.xz/src/util/LocaleString.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "LocaleString.hxx"
View file
ncmpc-0.47.tar.xz/src/util/LocaleString.hxx -> ncmpc-0.48.tar.xz/src/util/LocaleString.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2018 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef LOCALE_STRING_HXX #define LOCALE_STRING_HXX
View file
ncmpc-0.47.tar.xz/src/util/Manual.hxx -> ncmpc-0.48.tar.xz/src/util/Manual.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/util/MemberPointer.hxx -> ncmpc-0.48.tar.xz/src/util/MemberPointer.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/util/OffsetPointer.hxx -> ncmpc-0.48.tar.xz/src/util/OffsetPointer.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #pragma once
View file
ncmpc-0.47.tar.xz/src/util/OptionalCounter.hxx -> ncmpc-0.48.tar.xz/src/util/OptionalCounter.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #pragma once @@ -44,6 +16,8 @@ constexpr void reset() noexcept {} constexpr auto &operator++() noexcept { return *this; } constexpr auto &operator--() noexcept { return *this; } + constexpr auto &operator+=(std::size_t) noexcept { return *this; } + constexpr auto &operator-=(std::size_t) noexcept { return *this; } }; template<> @@ -71,4 +45,16 @@ --value; return *this; } + + constexpr auto &operator+=(std::size_t n) noexcept { + value += n; + return *this; + } + + constexpr auto &operator-=(std::size_t n) noexcept { + assert(value >= n); + + value -= n; + return *this; + } };
View file
ncmpc-0.47.tar.xz/src/util/PrintException.cxx -> ncmpc-0.48.tar.xz/src/util/PrintException.cxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2007-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #include "PrintException.hxx"
View file
ncmpc-0.47.tar.xz/src/util/PrintException.hxx -> ncmpc-0.48.tar.xz/src/util/PrintException.hxx
Changed
@@ -1,34 +1,6 @@ -/* - * Copyright 2009-2022 CM4all GmbH - * All rights reserved. - * - * author: Max Kellermann <mk@cm4all.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright CM4all GmbH +// author: Max Kellermann <mk@cm4all.com> #ifndef PRINT_EXCEPTION_HXX #define PRINT_EXCEPTION_HXX
View file
ncmpc-0.47.tar.xz/src/util/RuntimeError.hxx -> ncmpc-0.48.tar.xz/src/util/RuntimeError.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef RUNTIME_ERROR_HXX #define RUNTIME_ERROR_HXX
View file
ncmpc-0.47.tar.xz/src/util/ScopeExit.hxx -> ncmpc-0.48.tar.xz/src/util/ScopeExit.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright (C) 2015 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef SCOPE_EXIT_HXX #define SCOPE_EXIT_HXX
View file
ncmpc-0.48.tar.xz/src/util/SortList.hxx
Added
@@ -0,0 +1,95 @@ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> + +#pragma once + +#include "Concepts.hxx" +#include "StaticVector.hxx" + +#include <algorithm> // for std::find_if() + +/** + * Move all items from #src to #dest, keeping both sorted. + * + * @param p the predicate by which both lists are already + * sorted + */ +template<typename List> +constexpr void +MergeList(List &dest, List &src, + Predicate<typename List::const_reference, typename List::const_reference> auto p) noexcept +{ + const auto dest_end = dest.end(), src_end = src.end(); + + auto dest_at = dest.begin(); + + while (!src.empty()) { + const auto src_begin = src.begin(); + + /* find the first item of "dest" that is larger than + the front of "src"; this is the next insertion + position */ + dest_at = std::find_if(dest_at, dest_end, &p, &src_front = *src_begin(const auto &i){ + return p(src_front, i); + }); + + if (dest_at == dest_end) { + /* all items in "src" are larger than + "this": splice the whole list at + the end of "this" */ + dest.splice(dest_end, src); + break; + } + + /* find the first item of "src" that is not smaller + than the "dest" insertion anchor; this is the end + of the range of items to be spliced */ + const auto &dest_anchor = *dest_at; + typename List::size_type n = 1; + auto src_until = std::next(src_begin); + while (src_until != src_end && p(*src_until, dest_anchor)) { + ++src_until; + ++n; + } + + dest.splice(dest_at, src, src_begin, src_until, n); + } +} + +template<typename List> +constexpr void +SortList(List &list, + Predicate <typename List::const_reference, typename List::const_reference> auto p) noexcept +{ + using std::swap; + + if (list.empty()) + return; + + /* bottom-up merge sort */ + + List carry; + StaticVector<List, 64> array; + + while (!list.empty()) { + carry.splice(carry.begin(), list, list.begin()); + + std::size_t i = 0; + while (i < array.size() && !arrayi.empty()) { + auto &c = arrayi++; + MergeList(c, carry, p); + swap(carry, c); + } + + if (i == array.size()) + array.emplace_back(); + swap(carry, arrayi); + } + + assert(!array.empty()); + + for (std::size_t i = 1; i < array.size(); ++i) + MergeList(arrayi, arrayi - 1, p); + + swap(list, array.back()); +}
View file
ncmpc-0.47.tar.xz/src/util/StringAPI.hxx -> ncmpc-0.48.tar.xz/src/util/StringAPI.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2010-2021 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef STRING_API_HXX #define STRING_API_HXX
View file
ncmpc-0.47.tar.xz/src/util/StringCompare.cxx -> ncmpc-0.48.tar.xz/src/util/StringCompare.cxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "StringCompare.hxx"
View file
ncmpc-0.47.tar.xz/src/util/StringCompare.hxx -> ncmpc-0.48.tar.xz/src/util/StringCompare.hxx
Changed
@@ -1,31 +1,5 @@ -/* - * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #ifndef STRING_COMPARE_HXX #define STRING_COMPARE_HXX @@ -38,8 +12,8 @@ #include <string_view> -gnu::pure gnu::nonnull -static inline bool +gnu::nonnull +static constexpr bool StringIsEmpty(const char *string) noexcept { return *string == 0; @@ -139,4 +113,26 @@ const char * FindStringSuffix(const char *p, const char *suffix) noexcept; +template<typename T> +bool +SkipPrefix(std::basic_string_view<T> &haystack, + std::basic_string_view<T> needle) noexcept +{ + bool match = haystack.starts_with(needle); + if (match) + haystack.remove_prefix(needle.size()); + return match; +} + +template<typename T> +bool +RemoveSuffix(std::basic_string_view<T> &haystack, + std::basic_string_view<T> needle) noexcept +{ + bool match = haystack.ends_with(needle); + if (match) + haystack.remove_suffix(needle.size()); + return match; +} + #endif
View file
ncmpc-0.47.tar.xz/src/util/StringStrip.cxx -> ncmpc-0.48.tar.xz/src/util/StringStrip.cxx
Changed
@@ -1,35 +1,10 @@ -/* - * Copyright 2009-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> #include "StringStrip.hxx" #include "CharUtil.hxx" +#include <algorithm> #include <cstring> const char * @@ -50,6 +25,23 @@ return p; } +std::string_view +StripLeft(const std::string_view s) noexcept +{ + auto i = std::find_if_not(s.begin(), s.end(), + (auto ch){ return IsWhitespaceOrNull(ch); }); + +#ifdef __clang__ + // libc++ doesn't yet support the C++20 constructor + return s.substr(std::distance(s.begin(), i)); +#else + return { + i, + s.end(), + }; +#endif +} + const char * StripRight(const char *p, const char *end) noexcept { @@ -76,6 +68,15 @@ pnew_length = 0; } +std::string_view +StripRight(std::string_view s) noexcept +{ + auto i = std::find_if_not(s.rbegin(), s.rend(), + (auto ch){ return IsWhitespaceOrNull(ch); }); + + return s.substr(0, std::distance(i, s.rend())); +} + char * Strip(char *p) noexcept { @@ -83,3 +84,9 @@ StripRight(p); return p; } + +std::string_view +Strip(std::string_view s) noexcept +{ + return StripRight(StripLeft(s)); +}
View file
ncmpc-0.47.tar.xz/src/util/StringStrip.hxx -> ncmpc-0.48.tar.xz/src/util/StringStrip.hxx
Changed
@@ -1,36 +1,10 @@ -/* - * Copyright 2009-2020 Max Kellermann <max.kellermann@gmail.com> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ +// SPDX-License-Identifier: BSD-2-Clause +// author: Max Kellermann <max.kellermann@gmail.com> -#ifndef STRING_STRIP_HXX -#define STRING_STRIP_HXX +#pragma once #include <cstddef> +#include <string_view> /** * Skips whitespace at the beginning of the string, and returns the @@ -57,6 +31,10 @@ const char * StripLeft(const char *p, const char *end) noexcept; +gnu::pure +std::string_view +StripLeft(std::string_view s) noexcept; + /** * Determine the string's end as if it was stripped on the right side. */ @@ -90,6 +68,10 @@ void StripRight(char *p) noexcept; +gnu::pure +std::string_view +StripRight(std::string_view s) noexcept; + /** * Skip whitespace at the beginning and terminate the string after the * last non-whitespace character. @@ -98,4 +80,6 @@ char * Strip(char *p) noexcept; -#endif +gnu::pure +std::string_view +Strip(std::string_view s) noexcept;
View file
ncmpc-0.47.tar.xz/src/util/StringUTF8.cxx -> ncmpc-0.48.tar.xz/src/util/StringUTF8.cxx
Changed
@@ -1,22 +1,8 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "StringUTF8.hxx" +#include "StringAPI.hxx" #include <string.h> @@ -29,7 +15,7 @@ ScopeInitUTF8::ScopeInitUTF8() noexcept { const char *charset = nl_langinfo(CODESET); - if (charset == nullptr || strcasecmp(charset, "utf-8") == 0) + if (charset == nullptr || StringIsEqualIgnoreCase(charset, "utf-8")) /* if we're already UTF-8, we don't need a special UTF-8 locale */ return;
View file
ncmpc-0.47.tar.xz/src/util/StringUTF8.hxx -> ncmpc-0.48.tar.xz/src/util/StringUTF8.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef STRING_UTF8_HXX #define STRING_UTF8_HXX
View file
ncmpc-0.47.tar.xz/src/util/UriUtil.cxx -> ncmpc-0.48.tar.xz/src/util/UriUtil.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "UriUtil.hxx"
View file
ncmpc-0.47.tar.xz/src/util/UriUtil.hxx -> ncmpc-0.48.tar.xz/src/util/UriUtil.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef URI_UTIL_HXX #define URI_UTIL_HXX
View file
ncmpc-0.47.tar.xz/src/wreadln.cxx -> ncmpc-0.48.tar.xz/src/wreadln.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "wreadln.hxx" #include "Completion.hxx"
View file
ncmpc-0.47.tar.xz/src/wreadln.hxx -> ncmpc-0.48.tar.xz/src/wreadln.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef WREADLN_H #define WREADLN_H
View file
ncmpc-0.47.tar.xz/src/xterm_title.cxx -> ncmpc-0.48.tar.xz/src/xterm_title.cxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #include "xterm_title.hxx" #include "Options.hxx"
View file
ncmpc-0.47.tar.xz/src/xterm_title.hxx -> ncmpc-0.48.tar.xz/src/xterm_title.hxx
Changed
@@ -1,20 +1,5 @@ -/* ncmpc (Ncurses MPD Client) - * Copyright 2004-2021 The Music Player Daemon Project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project #ifndef XTERM_TITLE_H #define XTERM_TITLE_H
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
.