Changes of Revision 14
ncmpc.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Fri May 12 05:43:37 UTC 2023 - Muhammad Akbar Yanuar Mantari <mantarimay@pm.me>
4
+
5
+- Update to version 0.48
6
+
7
+-------------------------------------------------------------------
8
Fri Jan 13 20:20:20 UTC 2023 - olaf@aepfle.de
9
10
- Update to version 0.47
11
ncmpc.spec
Changed
10
1
2
3
4
Name: ncmpc
5
-Version: 0.47
6
+Version: 0.48
7
Release: 0
8
Summary: Curses Client for the Music Player Daemon
9
License: GPL-2.0-or-later
10
ncmpc-0.47.tar.xz/src/event/IdleEvent.cxx
Deleted
22
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
-
21
-#include "IdleEvent.hxx"
22
ncmpc-0.47.tar.xz/src/util/Compiler.h
Deleted
176
1
2
-/*
3
- * Copyright (C) 2003-2013 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
-
21
-#ifndef COMPILER_H
22
-#define COMPILER_H
23
-
24
-#define GCC_MAKE_VERSION(major, minor, patchlevel) ((major) * 10000 + (minor) * 100 + patchlevel)
25
-
26
-#ifdef __GNUC__
27
-# define GCC_VERSION GCC_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
28
-#else
29
-# define GCC_VERSION 0
30
-#endif
31
-
32
-#ifdef __clang__
33
-# define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
34
-#else
35
-# define CLANG_VERSION 0
36
-#endif
37
-
38
-/**
39
- * Are we building with the specified version of gcc (not clang or any
40
- * other compiler) or newer?
41
- */
42
-#define GCC_CHECK_VERSION(major, minor) \
43
- (!CLANG_VERSION && \
44
- GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
45
-
46
-/**
47
- * Are we building with clang (any version) or at least the specified
48
- * gcc version?
49
- */
50
-#define CLANG_OR_GCC_VERSION(major, minor) \
51
- (CLANG_VERSION || GCC_CHECK_VERSION(major, minor))
52
-
53
-/**
54
- * Are we building with gcc (not clang or any other compiler) and a
55
- * version older than the specified one?
56
- */
57
-#define GCC_OLDER_THAN(major, minor) \
58
- (GCC_VERSION && !CLANG_VERSION && \
59
- GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0))
60
-
61
-#if CLANG_OR_GCC_VERSION(4,0)
62
-
63
-/* GCC 4.x */
64
-
65
-#define gcc_const __attribute__((const))
66
-#define gcc_deprecated __attribute__((deprecated))
67
-#define gcc_may_alias __attribute__((may_alias))
68
-#define gcc_malloc __attribute__((malloc))
69
-#define gcc_noreturn __attribute__((noreturn))
70
-#define gcc_packed __attribute__((packed))
71
-#define gcc_printf(a,b) __attribute__((format(printf, a, b)))
72
-#define gcc_pure __attribute__((pure))
73
-#define gcc_sentinel __attribute__((sentinel))
74
-#define gcc_unused __attribute__((unused))
75
-#define gcc_warn_unused_result __attribute__((warn_unused_result))
76
-
77
-#define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__)))
78
-#define gcc_nonnull_all __attribute__((nonnull))
79
-#define gcc_returns_nonnull __attribute__((returns_nonnull))
80
-
81
-#define gcc_likely(x) __builtin_expect (!!(x), 1)
82
-#define gcc_unlikely(x) __builtin_expect (!!(x), 0)
83
-
84
-#define gcc_aligned(n) __attribute__((aligned(n)))
85
-
86
-#define gcc_visibility_hidden __attribute__((visibility("hidden")))
87
-#define gcc_visibility_default __attribute__((visibility("default")))
88
-
89
-#define gcc_always_inline __attribute__((always_inline))
90
-
91
-#else
92
-
93
-/* generic C compiler */
94
-
95
-#define gcc_const
96
-#define gcc_deprecated
97
-#define gcc_may_alias
98
-#define gcc_malloc
99
-#define gcc_noreturn
100
-#define gcc_packed
101
-#define gcc_printf(a,b)
102
-#define gcc_pure
103
-#define gcc_sentinel
104
-#define gcc_unused
105
-#define gcc_warn_unused_result
106
-
107
-#define gcc_nonnull(...)
108
-#define gcc_nonnull_all
109
-#define gcc_returns_nonnull
110
-
111
-#define gcc_likely(x) (x)
112
-#define gcc_unlikely(x) (x)
113
-
114
-#define gcc_aligned(n)
115
-
116
-#define gcc_visibility_hidden
117
-#define gcc_visibility_default
118
-
119
-#define gcc_always_inline inline
120
-
121
-#endif
122
-
123
-#if CLANG_OR_GCC_VERSION(4,3)
124
-
125
-#define gcc_hot __attribute__((hot))
126
-#define gcc_cold __attribute__((cold))
127
-
128
-#else /* ! GCC_UNUSED >= 40300 */
129
-
130
-#define gcc_hot
131
-#define gcc_cold
132
-
133
-#endif /* ! GCC_UNUSED >= 40300 */
134
-
135
-#if GCC_CHECK_VERSION(4,6)
136
-#define gcc_flatten __attribute__((flatten))
137
-#else
138
-#define gcc_flatten
139
-#endif
140
-
141
-#ifndef __cplusplus
142
-/* plain C99 has "restrict" */
143
-#define gcc_restrict restrict
144
-#elif CLANG_OR_GCC_VERSION(4,0)
145
-/* "__restrict__" is a GCC extension for C++ */
146
-#define gcc_restrict __restrict__
147
-#else
148
-/* disable it on other compilers */
149
-#define gcc_restrict
150
-#endif
151
-
152
-/* C++11 features */
153
-
154
-#if defined(__cplusplus)
155
-
156
-#endif
157
-
158
-#ifndef __has_feature
159
- // define dummy macro for non-clang compilers
160
- #define __has_feature(x) 0
161
-#endif
162
-
163
-#if __has_feature(attribute_unused_on_fields)
164
-#define gcc_unused_field gcc_unused
165
-#else
166
-#define gcc_unused_field
167
-#endif
168
-
169
-#if defined(__GNUC__) || defined(__clang__)
170
-#define gcc_unreachable() __builtin_unreachable()
171
-#else
172
-#define gcc_unreachable()
173
-#endif
174
-
175
-#endif
176
ncmpc-0.47.tar.xz/.github/workflows/build.yml -> ncmpc-0.48.tar.xz/.github/workflows/build.yml
Changed
81
1
2
---
3
+name: CI
4
on:
5
workflow_dispatch:
6
push:
7
8
branches:
9
- master
10
11
+permissions:
12
+ contents: read # to fetch code (actions/checkout)
13
+
14
jobs:
15
build-linux:
16
- runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ os: ubuntu-22.04, ubuntu-20.04
20
+ include:
21
+ - os: ubuntu-22.04
22
+ cc: gcc-11
23
+ cxx: g++-11
24
+ - os: ubuntu-20.04
25
+ cc: gcc-10
26
+ cxx: g++-10
27
+
28
+ runs-on: ${{ matrix.os }}
29
+
30
+ env:
31
+ CC: ccache ${{ matrix.cc }}
32
+ CXX: ccache ${{ matrix.cxx }}
33
+
34
steps:
35
- id: checkout
36
uses: actions/checkout@v3
37
38
- id: cache-ccache
39
uses: hendrikmuhs/ccache-action@v1
40
with:
41
- key: linux
42
+ key: ${{ matrix.os }}
43
44
- name: Install dependencies
45
run: |
46
+ sudo apt-get update
47
sudo apt-get install -y --no-install-recommends \
48
meson \
49
+ ${{ matrix.cxx }} ${{matrix.cc }} \
50
libncursesw5-dev \
51
libncurses5-dev \
52
libpcre2-dev \
53
54
with:
55
action: build
56
directory: output/mini
57
- 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
58
+ 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
59
60
build-macos:
61
runs-on: macos-latest
62
63
pcre2 \
64
libmpdclient
65
66
- - name: Meson Build
67
+ - name: Full Build
68
uses: BSFishy/meson-build@v1.0.3
69
with:
70
action: build
71
- directory: output
72
+ directory: output/full
73
setup-options: -Ddocumentation=disabled -Dlyrics_screen=true -Dchat_screen=true
74
+
75
+ - name: Mini Build
76
+ uses: BSFishy/meson-build@v1.0.3
77
+ with:
78
+ action: build
79
+ directory: output/mini
80
+ 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
81
ncmpc-0.47.tar.xz/NEWS -> ncmpc-0.48.tar.xz/NEWS
Changed
10
1
2
+ncmpc 0.48 - (2023-04-06)
3
+* drop support for ~/.ncmpc/; using only ~/.config/ncmpc/ (XDG)
4
+* improve scroll-offset handling
5
+* experimental table layout
6
+
7
ncmpc 0.47 - (2022-06-30)
8
* handle Ctrl-C in search prompt
9
* link with libintl and libiconv if necessary
10
ncmpc-0.47.tar.xz/README.rst -> ncmpc-0.48.tar.xz/README.rst
Changed
14
1
2
3
You need:
4
5
-- a C++17 compliant compiler (e.g. gcc or clang)
6
+- a C++20 compliant compiler (e.g. gcc or clang)
7
- `libmpdclient <https://www.musicpd.org/libs/libmpdclient/>`__ 2.16
8
- `ncurses <https://www.gnu.org/software/ncurses/>`__
9
-- `Meson 0.47 <http://mesonbuild.com/>`__ and `Ninja <https://ninja-build.org/>`__
10
+- `Meson 0.49 <http://mesonbuild.com/>`__ and `Ninja <https://ninja-build.org/>`__
11
12
Optional:
13
14
ncmpc-0.47.tar.xz/doc/conf.py -> ncmpc-0.48.tar.xz/doc/conf.py
Changed
10
1
2
# built documents.
3
#
4
# The short X.Y version.
5
-version = '0.47'
6
+version = '0.48'
7
# The full version, including alpha/beta/rc tags.
8
release = version
9
10
ncmpc-0.47.tar.xz/doc/index.rst -> ncmpc-0.48.tar.xz/doc/index.rst
Changed
30
1
2
"%artist%|(artist n/a) - %title%|(title n/a)"
3
4
5
+Tables
6
+------
7
+
8
+As an experimental feature, the queue can be displayed as a table.
9
+Beware, this feature is really experimental, and future versions may
10
+do incompatible changes.
11
+
12
+To configure this, add columns to the configuration file, e.g.::
13
+
14
+ song-table-column = "Artist" "%artist%|%name%|%file%" min=20 fraction=2
15
+ song-table-column = "Title" "%title%" min=20 fraction=2
16
+ song-table-column = "Album" "%album%" min=10 fraction=1
17
+ song-table-column = "Time" "%time%" min=8 fraction=0
18
+
19
+Each column has a caption, a format string specifying what is being
20
+displayed, a minimum width (in terminal cells) and a fraction
21
+specifying how much of excess width will be assigned to this column.
22
+
23
+In the above example, the "Time" column will have a fixed width of 8
24
+because ``fraction=0``.
25
+
26
+
27
Chat Protocol
28
-------------
29
30
ncmpc-0.47.tar.xz/lyrics/20-azlyrics.py -> ncmpc-0.48.tar.xz/lyrics/20-azlyrics.py
Changed
27
1
2
-#!/usr/bin/python3
3
-#
4
-# Copyright 2004-2021 The Music Player Daemon Project
5
-# http://www.musicpd.org/
6
-#
7
-# This program is free software; you can redistribute it and/or modify
8
-# it under the terms of the GNU General Public License as published by
9
-# the Free Software Foundation; either version 2 of the License, or
10
-# (at your option) any later version.
11
-#
12
-# This program is distributed in the hope that it will be useful,
13
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-# GNU General Public License for more details.
16
-#
17
-# You should have received a copy of the GNU General Public License along
18
-# with this program; if not, write to the Free Software Foundation, Inc.,
19
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+#!/usr/bin/env python3
21
#
22
+# SPDX-License-Identifier: GPL-2.0-or-later
23
+# Copyright The Music Player Daemon Project
24
25
#
26
# Load lyrics from azlyrics.com if lyrics weren't found in the lyrics directory
27
ncmpc-0.47.tar.xz/lyrics/30-karaoke_texty.py -> ncmpc-0.48.tar.xz/lyrics/30-karaoke_texty.py
Changed
27
1
2
-#!/usr/bin/python3
3
-#
4
-# Copyright 2004-2021 The Music Player Daemon Project
5
-# http://www.musicpd.org/
6
-#
7
-# This program is free software; you can redistribute it and/or modify
8
-# it under the terms of the GNU General Public License as published by
9
-# the Free Software Foundation; either version 2 of the License, or
10
-# (at your option) any later version.
11
-#
12
-# This program is distributed in the hope that it will be useful,
13
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-# GNU General Public License for more details.
16
-#
17
-# You should have received a copy of the GNU General Public License along
18
-# with this program; if not, write to the Free Software Foundation, Inc.,
19
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+#!/usr/bin/env python3
21
#
22
+# SPDX-License-Identifier: GPL-2.0-or-later
23
+# Copyright The Music Player Daemon Project
24
25
#
26
# Load lyrics from karaoketexty.sk if lyrics weren't found in the lyrics directory
27
ncmpc-0.47.tar.xz/lyrics/40-tekstowo.py -> ncmpc-0.48.tar.xz/lyrics/40-tekstowo.py
Changed
27
1
2
-#!/usr/bin/python3
3
-#
4
-# Copyright 2004-2021 The Music Player Daemon Project
5
-# http://www.musicpd.org/
6
-#
7
-# This program is free software; you can redistribute it and/or modify
8
-# it under the terms of the GNU General Public License as published by
9
-# the Free Software Foundation; either version 2 of the License, or
10
-# (at your option) any later version.
11
-#
12
-# This program is distributed in the hope that it will be useful,
13
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-# GNU General Public License for more details.
16
-#
17
-# You should have received a copy of the GNU General Public License along
18
-# with this program; if not, write to the Free Software Foundation, Inc.,
19
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+#!/usr/bin/env python3
21
#
22
+# SPDX-License-Identifier: GPL-2.0-or-later
23
+# Copyright The Music Player Daemon Project
24
25
#
26
# Load lyrics from tekstowo.pl if lyrics weren't found in the lyrics directory
27
ncmpc-0.47.tar.xz/lyrics/50-genius.py -> ncmpc-0.48.tar.xz/lyrics/50-genius.py
Changed
27
1
2
-#!/usr/bin/python3
3
-#
4
-# Copyright 2004-2021 The Music Player Daemon Project
5
-# http://www.musicpd.org/
6
-#
7
-# This program is free software; you can redistribute it and/or modify
8
-# it under the terms of the GNU General Public License as published by
9
-# the Free Software Foundation; either version 2 of the License, or
10
-# (at your option) any later version.
11
-#
12
-# This program is distributed in the hope that it will be useful,
13
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-# GNU General Public License for more details.
16
-#
17
-# You should have received a copy of the GNU General Public License along
18
-# with this program; if not, write to the Free Software Foundation, Inc.,
19
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+#!/usr/bin/env python3
21
#
22
+# SPDX-License-Identifier: GPL-2.0-or-later
23
+# Copyright The Music Player Daemon Project
24
25
#
26
# Load lyrics from genius.com if lyrics weren't found in the lyrics directory
27
ncmpc-0.47.tar.xz/lyrics/51-supermusic.py -> ncmpc-0.48.tar.xz/lyrics/51-supermusic.py
Changed
27
1
2
-#!/usr/bin/python3
3
-#
4
-# Copyright 2004-2021 The Music Player Daemon Project
5
-# http://www.musicpd.org/
6
-#
7
-# This program is free software; you can redistribute it and/or modify
8
-# it under the terms of the GNU General Public License as published by
9
-# the Free Software Foundation; either version 2 of the License, or
10
-# (at your option) any later version.
11
-#
12
-# This program is distributed in the hope that it will be useful,
13
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-# GNU General Public License for more details.
16
-#
17
-# You should have received a copy of the GNU General Public License along
18
-# with this program; if not, write to the Free Software Foundation, Inc.,
19
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+#!/usr/bin/env python3
21
#
22
+# SPDX-License-Identifier: GPL-2.0-or-later
23
+# Copyright The Music Player Daemon Project
24
25
#
26
# Load lyrics from supermusic.cz if lyrics weren't found in the lyrics directory
27
ncmpc-0.47.tar.xz/lyrics/52-zeneszoveg.py -> ncmpc-0.48.tar.xz/lyrics/52-zeneszoveg.py
Changed
27
1
2
-#!/usr/bin/python3
3
-#
4
-# Copyright 2004-2021 The Music Player Daemon Project
5
-# http://www.musicpd.org/
6
-#
7
-# This program is free software; you can redistribute it and/or modify
8
-# it under the terms of the GNU General Public License as published by
9
-# the Free Software Foundation; either version 2 of the License, or
10
-# (at your option) any later version.
11
-#
12
-# This program is distributed in the hope that it will be useful,
13
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-# GNU General Public License for more details.
16
-#
17
-# You should have received a copy of the GNU General Public License along
18
-# with this program; if not, write to the Free Software Foundation, Inc.,
19
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+#!/usr/bin/env python3
21
#
22
+# SPDX-License-Identifier: GPL-2.0-or-later
23
+# Copyright The Music Player Daemon Project
24
25
#
26
# Load lyrics from zeneszoveg.hu if lyrics weren't found in the lyrics directory
27
ncmpc-0.47.tar.xz/lyrics/60-google.py -> ncmpc-0.48.tar.xz/lyrics/60-google.py
Changed
27
1
2
-#!/usr/bin/python3
3
-#
4
-# Copyright 2004-2021 The Music Player Daemon Project
5
-# http://www.musicpd.org/
6
-#
7
-# This program is free software; you can redistribute it and/or modify
8
-# it under the terms of the GNU General Public License as published by
9
-# the Free Software Foundation; either version 2 of the License, or
10
-# (at your option) any later version.
11
-#
12
-# This program is distributed in the hope that it will be useful,
13
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-# GNU General Public License for more details.
16
-#
17
-# You should have received a copy of the GNU General Public License along
18
-# with this program; if not, write to the Free Software Foundation, Inc.,
19
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
+#!/usr/bin/env python3
21
#
22
+# SPDX-License-Identifier: GPL-2.0-or-later
23
+# Copyright The Music Player Daemon Project
24
25
#
26
# Load lyrics from google.com if lyrics weren't found in the lyrics directory
27
ncmpc-0.47.tar.xz/meson.build -> ncmpc-0.48.tar.xz/meson.build
Changed
39
1
2
project('ncmpc', 'cpp',
3
- version: '0.47',
4
+ version: '0.48',
5
meson_version: '>= 0.49',
6
default_options:
7
'cpp_std=c++2a',
8
9
is_windows = host_machine.system() == 'windows'
10
11
thread_dep = dependency('threads')
12
+
13
+m_dep =
14
+if not mini
15
+ m_dep = cc.find_library('m', required: false)
16
+endif
17
+
18
libmpdclient_dep = dependency('libmpdclient', version: '>= 2.16')
19
20
if not mini
21
22
'src/hscroll.cxx',
23
'src/ConfigFile.cxx',
24
'src/ConfigParser.cxx',
25
+ 'src/TableLayout.cxx',
26
+ 'src/TablePaint.cxx',
27
+ 'src/TableGlue.cxx',
28
29
30
if host_machine.system() != 'windows'
31
32
pcre_dep,
33
intl_dep,
34
iconv_dep,
35
+ m_dep,
36
curses_dep,
37
lirc_dep,
38
libmpdclient_dep,
39
ncmpc-0.47.tar.xz/po/he.po -> ncmpc-0.48.tar.xz/po/he.po
Changed
39
1
2
"Project-Id-Version: ncmpc\n"
3
"Report-Msgid-Bugs-To: \n"
4
"POT-Creation-Date: 2020-08-24 15:23+0200\n"
5
-"PO-Revision-Date: 2021-11-08 13:50+0000\n"
6
+"PO-Revision-Date: 2022-10-17 00:55+0000\n"
7
"Last-Translator: Yaron Shahrabani <sh.yaron@gmail.com>\n"
8
"Language-Team: Hebrew <https://hosted.weblate.org/projects/ncmpc/"
9
"translations/he/>\n"
10
11
"Content-Transfer-Encoding: 8bit\n"
12
"Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && "
13
"n % 10 == 0) ? 2 : 3));\n"
14
-"X-Generator: Weblate 4.9-dev\n"
15
+"X-Generator: Weblate 4.15-dev\n"
16
"X-Launchpad-Export-Date: 2010-09-07 18:28+0000\n"
17
18
#: src/Bindings.cxx:80 src/Bindings.cxx:86
19
20
msgstr "הסר שוני מקשים"
21
22
#: src/HelpPage.cxx:215
23
-#, fuzzy
24
msgid "Add a keydef"
25
-msgstr "הוסף מקש חדש"
26
+msgstr "הוספת שוני מקשים"
27
28
#: src/HelpPage.cxx:216
29
msgid "Go up a level"
30
31
#: src/OutputsPage.cxx:168
32
#, c-format
33
msgid "Switched to partition '%s'"
34
-msgstr ""
35
+msgstr "עברת למחיצה ‚%s’"
36
37
#: src/OutputsPage.cxx:180 src/SongPage.cxx:69
38
msgid "Name"
39
ncmpc-0.47.tar.xz/po/ko.po -> ncmpc-0.48.tar.xz/po/ko.po
Changed
151
1
2
"Project-Id-Version: ncmpc\n"
3
"Report-Msgid-Bugs-To: \n"
4
"POT-Creation-Date: 2020-08-24 15:23+0200\n"
5
-"PO-Revision-Date: 2020-10-10 15:26+0000\n"
6
-"Last-Translator: Min Ho Park <parkmino@gmail.com>\n"
7
+"PO-Revision-Date: 2022-09-30 08:16+0000\n"
8
+"Last-Translator: 이정희 <daemul72@gmail.com>\n"
9
"Language-Team: Korean <https://hosted.weblate.org/projects/ncmpc/"
10
"translations/ko/>\n"
11
"Language: ko\n"
12
13
"Content-Type: text/plain; charset=UTF-8\n"
14
"Content-Transfer-Encoding: 8bit\n"
15
"Plural-Forms: nplurals=1; plural=0;\n"
16
-"X-Generator: Weblate 4.3-dev\n"
17
+"X-Generator: Weblate 4.14.1\n"
18
"X-Launchpad-Export-Date: 2009-10-19 13:36+0000\n"
19
20
#: src/Bindings.cxx:80 src/Bindings.cxx:86
21
22
23
#: src/LibraryPage.cxx:45
24
msgid "Artists"
25
-msgstr "연주가"
26
+msgstr "아티스트"
27
28
#: src/LibraryPage.cxx:48 src/LibraryPage.cxx:175
29
msgid "Albums"
30
31
#. while data is retrieved
32
#: src/LyricsPage.cxx:356
33
msgid "loading..."
34
-msgstr "읽는 중..."
35
+msgstr "불러오는 중..."
36
37
#: src/LyricsPage.cxx:378
38
msgid "Editor not configured"
39
40
#. lyrics for the song were saved on hard disk
41
#: src/LyricsPage.cxx:456
42
msgid "Lyrics saved"
43
-msgstr "가사 저장"
44
+msgstr "가사 저장됨"
45
46
#: src/LyricsPage.cxx:462
47
msgid "Lyrics deleted"
48
-msgstr "가사 지움"
49
+msgstr "가사 삭제됨"
50
51
#: src/LyricsPage.cxx:463
52
msgid "No saved lyrics"
53
-msgstr "저장된 가사가 없음"
54
+msgstr "저장된 가사 없음"
55
56
#: src/Main.cxx:133
57
#, c-format
58
59
#. when ncmpc is started with "--version"
60
#: src/Options.cxx:216 src/Options.cxx:219
61
msgid "translator-credits"
62
-msgstr "번역자-기여"
63
+msgstr "이정희 <daemul72@gmail.com>"
64
65
#: src/OutputsPage.cxx:168
66
#, c-format
67
msgid "Switched to partition '%s'"
68
-msgstr "'%s' 칸막이로 바꾸기"
69
+msgstr "'%s' 칸막이로 전환됨"
70
71
#: src/OutputsPage.cxx:180 src/SongPage.cxx:69
72
msgid "Name"
73
74
#: src/OutputsPage.cxx:230
75
#, c-format
76
msgid "Output '%s' enabled"
77
-msgstr "출력 '%s' 사용함"
78
+msgstr "출력 '%s' 활성화됨"
79
80
#: src/OutputsPage.cxx:241
81
#, c-format
82
msgid "Output '%s' disabled"
83
-msgstr "출력 '%s' 사용 안 함"
84
+msgstr "출력 '%s' 비활성화됨"
85
86
#: src/OutputsPage.cxx:371 src/OutputsPage.cxx:480
87
msgid "Outputs"
88
89
#. get path
90
#: src/QueuePage.cxx:314
91
msgid "Add"
92
-msgstr "추가"
93
+msgstr "추가하기"
94
95
#: src/QueuePage.cxx:379 src/QueuePage.cxx:697
96
msgid "Queue"
97
98
#: src/save_playlist.cxx:129
99
#, c-format
100
msgid "Saved %s"
101
-msgstr "%s 저장함"
102
+msgstr "%s 저장됨"
103
104
#: src/screen_client.cxx:41
105
msgid "Database update running"
106
-msgstr "데이터베이스 업데이트 중"
107
+msgstr "데이터베이스 업데이트 실행 중"
108
109
#: src/screen_client.cxx:48
110
#, c-format
111
msgid "Database update of %s started"
112
-msgstr "%s 데이터베이스 업데이트 시작"
113
+msgstr "%s의 데이터베이스 업데이트 시작됨"
114
115
#: src/screen_client.cxx:51
116
msgid "Database update started"
117
-msgstr "데이터베이스 업데이트 시작"
118
+msgstr "데이터베이스 업데이트 시작됨"
119
120
#: src/screen.cxx:158
121
msgid "Repeat mode is on"
122
123
124
#: src/screen.cxx:198
125
msgid "Database updated"
126
-msgstr "데이터베이스 업데이트 함"
127
+msgstr "데이터베이스 업데이트됨"
128
129
#: src/screen.cxx:248
130
msgid "Find mode: Wrapped"
131
-msgstr "찾기 방식: 줄 바꿈"
132
+msgstr "찾기 모드: 줄 바꿈"
133
134
#: src/screen.cxx:249
135
msgid "Find mode: Normal"
136
-msgstr "찾기 방식: 보통"
137
+msgstr "찾기 모드: 보통"
138
139
#: src/screen.cxx:254
140
msgid "Auto center mode: On"
141
-msgstr "자동 가운데 방식: 켜짐"
142
+msgstr "자동 중앙 모드: 켜짐"
143
144
#: src/screen.cxx:255
145
msgid "Auto center mode: Off"
146
-msgstr "자동 가운데 방식: 꺼짐"
147
+msgstr "자동 중앙 모드: 꺼짐"
148
149
#: src/screen_find.cxx:33
150
msgid "Find"
151
ncmpc-0.47.tar.xz/po/nl.po -> ncmpc-0.48.tar.xz/po/nl.po
Changed
366
1
2
"Project-Id-Version: ncmpc\n"
3
"Report-Msgid-Bugs-To: \n"
4
"POT-Creation-Date: 2020-08-24 15:23+0200\n"
5
-"PO-Revision-Date: 2010-02-24 11:17+0000\n"
6
-"Last-Translator: Tom Postma <tom-postma@hetnet.nl>\n"
7
-"Language-Team: Dutch <nl@li.org>\n"
8
+"PO-Revision-Date: 2022-08-23 03:43+0000\n"
9
+"Last-Translator: JeibborRip <rob.jorna@gmail.com>\n"
10
+"Language-Team: Dutch <https://hosted.weblate.org/projects/ncmpc/translations/"
11
+"nl/>\n"
12
"Language: nl\n"
13
"MIME-Version: 1.0\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+"X-Generator: Weblate 4.14-dev\n"
18
"X-Launchpad-Export-Date: 2010-04-05 17:16+0000\n"
19
-"X-Generator: Launchpad (build Unknown)\n"
20
21
#: src/Bindings.cxx:80 src/Bindings.cxx:86
22
#, c-format
23
msgid "Key %s assigned to %s and %s"
24
-msgstr ""
25
+msgstr "Toets %s is toegewezen aan %s en %s"
26
27
#: src/ChatPage.cxx:64 src/ChatPage.cxx:182
28
msgid "Chat"
29
-msgstr ""
30
+msgstr "Babbel"
31
32
#: src/ChatPage.cxx:163
33
msgid "Your message"
34
-msgstr ""
35
+msgstr "Jouw bericht"
36
37
#: src/ChatPage.cxx:172
38
msgid "Message could not be sent"
39
-msgstr ""
40
+msgstr "Bericht kon niet worden verstuurd"
41
42
#: src/Command.cxx:30
43
msgid "Key configuration screen"
44
-msgstr ""
45
+msgstr "Instel scherm voor toets bediening"
46
47
#: src/Command.cxx:33
48
msgid "Quit"
49
-msgstr ""
50
+msgstr "Afsluiten"
51
52
#: src/Command.cxx:37
53
msgid "Move cursor up"
54
-msgstr ""
55
+msgstr "Cursor omhoog"
56
57
#: src/Command.cxx:39
58
msgid "Move cursor down"
59
-msgstr ""
60
+msgstr "Beweeg cursor omlaag"
61
62
#: src/Command.cxx:41
63
msgid "Move cursor to the top of screen"
64
-msgstr ""
65
+msgstr "Plaats de cursor naar het begin van het scherm"
66
67
#: src/Command.cxx:43
68
msgid "Move cursor to the middle of screen"
69
-msgstr ""
70
+msgstr "Plaats de cursor in het midden van het scherm"
71
72
#: src/Command.cxx:45
73
msgid "Move cursor to the bottom of screen"
74
-msgstr ""
75
+msgstr "Plaats de cursor onder aan het scherm"
76
77
#: src/Command.cxx:47
78
msgid "Move cursor to the top of the list"
79
-msgstr ""
80
+msgstr "Plaats de cursor naar het begin van de lijst"
81
82
#: src/Command.cxx:49
83
msgid "Move cursor to the bottom of the list"
84
-msgstr ""
85
+msgstr "Plaats de cursor naar het einde van de lijst"
86
87
#: src/Command.cxx:51
88
msgid "Page up"
89
-msgstr ""
90
+msgstr "Pagina omhoog"
91
92
#: src/Command.cxx:53
93
msgid "Page down"
94
-msgstr ""
95
+msgstr "Pagina omlaag"
96
97
#: src/Command.cxx:55
98
msgid "Range selection"
99
-msgstr ""
100
+msgstr "Selecteer bereik"
101
102
#: src/Command.cxx:57
103
msgid "Scroll down one line"
104
-msgstr ""
105
+msgstr "Eén regel omlaag scrollen"
106
107
#: src/Command.cxx:59
108
msgid "Scroll up one line"
109
-msgstr ""
110
+msgstr "Eén regel omhoog scrollen"
111
112
#: src/Command.cxx:61
113
msgid "Scroll up half a screen"
114
-msgstr ""
115
+msgstr "Een halve pagina omhoog scrollen"
116
117
#: src/Command.cxx:63
118
msgid "Scroll down half a screen"
119
-msgstr ""
120
+msgstr "Een halve pagina omlaag scrollen"
121
122
#: src/Command.cxx:65
123
msgid "Select currently playing song"
124
-msgstr ""
125
+msgstr "Selecteer huidig nummer"
126
127
#: src/Command.cxx:70
128
msgid "Help screen"
129
-msgstr ""
130
+msgstr "Help scherm"
131
132
#: src/Command.cxx:72 src/HelpPage.cxx:141
133
msgid "Queue screen"
134
-msgstr ""
135
+msgstr "Scherm met afspeellijst"
136
137
#: src/Command.cxx:74 src/HelpPage.cxx:156
138
msgid "Browse screen"
139
-msgstr ""
140
+msgstr "Bladerscherm"
141
142
#: src/Command.cxx:79
143
msgid "Play/Enter directory"
144
-msgstr ""
145
+msgstr "Speel/toon map"
146
147
#: src/Command.cxx:81
148
msgid "Pause"
149
-msgstr ""
150
+msgstr "Pauzeer"
151
152
#: src/Command.cxx:83
153
msgid "Stop"
154
-msgstr ""
155
+msgstr "Afsluiten"
156
157
#: src/Command.cxx:85
158
msgid "Crop"
159
-msgstr ""
160
+msgstr "Bijsnijden"
161
162
#: src/Command.cxx:87
163
msgid "Next track"
164
-msgstr ""
165
+msgstr "Volgend nummer"
166
167
#: src/Command.cxx:89
168
msgid "Previous track"
169
-msgstr ""
170
+msgstr "Vorig nummer"
171
172
#: src/Command.cxx:91
173
msgid "Seek forward"
174
-msgstr ""
175
+msgstr "Omlaag zoeken"
176
177
#: src/Command.cxx:93
178
msgid "Seek backward"
179
-msgstr ""
180
+msgstr "Omhoog zoeken"
181
182
#: src/Command.cxx:95
183
msgid "Increase volume"
184
-msgstr ""
185
+msgstr "Harder"
186
187
#: src/Command.cxx:97
188
msgid "Decrease volume"
189
-msgstr ""
190
+msgstr "Zachter"
191
192
#: src/Command.cxx:99
193
msgid "Select/deselect song in queue"
194
-msgstr ""
195
+msgstr "Selecteer/deselecteer nummer in lijst"
196
197
#: src/Command.cxx:101
198
msgid "Select all listed items"
199
-msgstr ""
200
+msgstr "Kies selectie"
201
202
#: src/Command.cxx:103
203
msgid "Delete song from queue"
204
-msgstr ""
205
+msgstr "Verwijder nummer uit de afspeellijst"
206
207
#: src/Command.cxx:105
208
msgid "Shuffle queue"
209
-msgstr ""
210
+msgstr "Herschik de wachtrij"
211
212
#: src/Command.cxx:107
213
msgid "Clear queue"
214
-msgstr ""
215
+msgstr "Leeg huidige afspeellijst"
216
217
#: src/Command.cxx:109
218
msgid "Toggle repeat mode"
219
-msgstr ""
220
+msgstr "Verander de herhaal modus"
221
222
#: src/Command.cxx:111
223
msgid "Toggle random mode"
224
-msgstr ""
225
+msgstr "Willekeur aan/uit zetten"
226
227
#: src/Command.cxx:113
228
msgid "Toggle single mode"
229
-msgstr ""
230
+msgstr "Herhalen aan/uit zetten"
231
232
#: src/Command.cxx:115
233
msgid "Toggle consume mode"
234
-msgstr ""
235
+msgstr "Huidige speellijst bewaren of niet"
236
237
#: src/Command.cxx:117
238
msgid "Toggle crossfade mode"
239
-msgstr ""
240
+msgstr "Nummers in elkaar overvloeien of niet"
241
242
#: src/Command.cxx:119
243
msgid "Start a music database update"
244
-msgstr ""
245
+msgstr "Start een update van de muziekdatabase"
246
247
#: src/Command.cxx:121
248
msgid "Save queue"
249
-msgstr ""
250
+msgstr "Wachtrij bewaren"
251
252
#: src/Command.cxx:123 src/HelpPage.cxx:175
253
msgid "Append song to queue"
254
-msgstr ""
255
+msgstr "Aan de wachtrij toevoegen"
256
257
#: src/Command.cxx:126
258
msgid "Go to root directory"
259
-msgstr ""
260
+msgstr "Naar de hoofdmap"
261
262
#: src/Command.cxx:128
263
msgid "Go to parent directory"
264
-msgstr ""
265
+msgstr "Naar de bovenliggende map"
266
267
#: src/Command.cxx:131
268
msgid "Locate song in browser"
269
-msgstr ""
270
+msgstr "Focus nummer in overzicht"
271
272
#: src/Command.cxx:135
273
msgid "Move item up"
274
-msgstr ""
275
+msgstr "Verplaats item omhoog"
276
277
#: src/Command.cxx:137
278
msgid "Move item down"
279
-msgstr ""
280
+msgstr "Verplaats item omlaag"
281
282
#: src/Command.cxx:139
283
msgid "Refresh screen"
284
-msgstr ""
285
+msgstr "Beeld opnieuw opbouwen"
286
287
#. translators: toggle between wrapping and non-wrapping
288
#. search
289
#: src/Command.cxx:146
290
msgid "Toggle find mode"
291
-msgstr ""
292
+msgstr "Verander de manier van zoeken"
293
294
#. translators: the auto center mode always centers the song
295
#. currently being played
296
#: src/Command.cxx:150
297
msgid "Toggle auto center mode"
298
-msgstr ""
299
+msgstr "Automatisch centreren aan/uitzetten"
300
301
#: src/Command.cxx:155
302
msgid "Next screen"
303
-msgstr ""
304
+msgstr "Volgende pagina"
305
306
#: src/Command.cxx:157
307
msgid "Previous screen"
308
-msgstr ""
309
+msgstr "Vorige pagina"
310
311
#: src/Command.cxx:159
312
msgid "Swap to most recent screen"
313
-msgstr ""
314
+msgstr "Terug naar het vorige overzicht"
315
316
#: src/Command.cxx:164
317
msgid "Forward find"
318
-msgstr ""
319
+msgstr "Zoek vooruit"
320
321
#: src/Command.cxx:166
322
msgid "Forward find next"
323
-msgstr ""
324
+msgstr "Volgende vondst"
325
326
#: src/Command.cxx:168
327
msgid "Backward find"
328
-msgstr ""
329
+msgstr "Achterwaarts zoeken"
330
331
#: src/Command.cxx:170
332
msgid "Backward find previous"
333
-msgstr ""
334
+msgstr "Vorige achterwaartse vondst"
335
336
#. translators: this queries the user for a string
337
#. * and jumps directly (while the user is typing)
338
#. * to the entry which begins with this string
339
#: src/Command.cxx:175
340
msgid "Jump to"
341
-msgstr ""
342
+msgstr "Ga naar"
343
344
#: src/Command.cxx:181
345
msgid "Library page"
346
-msgstr ""
347
+msgstr "Overzicht muziek verzameling"
348
349
#: src/Command.cxx:185 src/HelpPage.cxx:170
350
msgid "Search screen"
351
-msgstr ""
352
+msgstr "Onderzoek"
353
354
#: src/Command.cxx:187
355
msgid "Change search mode"
356
-msgstr ""
357
+msgstr "Manier van zoeken aanpassen"
358
359
#: src/Command.cxx:191
360
msgid "View the selected and the currently playing song"
361
-msgstr ""
362
+msgstr "Informatie over het huidig spelende / geselecteerde nummer"
363
364
#: src/Command.cxx:195 src/HelpPage.cxx:182
365
msgid "Lyrics screen"
366
ncmpc-0.48.tar.xz/po/tr.po
Added
1218
1
2
+# SOME DESCRIPTIVE TITLE.
3
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
4
+# This file is distributed under the same license as the ncmpc package.
5
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
6
+#
7
+msgid ""
8
+msgstr ""
9
+"Project-Id-Version: ncmpc\n"
10
+"Report-Msgid-Bugs-To: \n"
11
+"POT-Creation-Date: 2020-08-24 15:23+0200\n"
12
+"PO-Revision-Date: 2022-11-26 17:48+0000\n"
13
+"Last-Translator: Oğuz Ersen <oguz@ersen.moe>\n"
14
+"Language-Team: Turkish <https://hosted.weblate.org/projects/ncmpc/"
15
+"translations/tr/>\n"
16
+"Language: tr\n"
17
+"MIME-Version: 1.0\n"
18
+"Content-Type: text/plain; charset=UTF-8\n"
19
+"Content-Transfer-Encoding: 8bit\n"
20
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
21
+"X-Generator: Weblate 4.15-dev\n"
22
+
23
+#: src/Bindings.cxx:80 src/Bindings.cxx:86
24
+#, c-format
25
+msgid "Key %s assigned to %s and %s"
26
+msgstr "%s tuşu, %s ve %s komutlarına atandı"
27
+
28
+#: src/ChatPage.cxx:64 src/ChatPage.cxx:182
29
+msgid "Chat"
30
+msgstr "Sohbet"
31
+
32
+#: src/ChatPage.cxx:163
33
+msgid "Your message"
34
+msgstr "Mesajınız"
35
+
36
+#: src/ChatPage.cxx:172
37
+msgid "Message could not be sent"
38
+msgstr "Mesaj gönderilemedi"
39
+
40
+#: src/Command.cxx:30
41
+msgid "Key configuration screen"
42
+msgstr "Tuş yapılandırma ekranı"
43
+
44
+#: src/Command.cxx:33
45
+msgid "Quit"
46
+msgstr "Çıkış"
47
+
48
+#: src/Command.cxx:37
49
+msgid "Move cursor up"
50
+msgstr "İmleci yukarı taşı"
51
+
52
+#: src/Command.cxx:39
53
+msgid "Move cursor down"
54
+msgstr "İmleci aşağı taşı"
55
+
56
+#: src/Command.cxx:41
57
+msgid "Move cursor to the top of screen"
58
+msgstr "İmleci ekranın en üstüne taşı"
59
+
60
+#: src/Command.cxx:43
61
+msgid "Move cursor to the middle of screen"
62
+msgstr "İmleci ekranın ortasına taşı"
63
+
64
+#: src/Command.cxx:45
65
+msgid "Move cursor to the bottom of screen"
66
+msgstr "İmleci ekranın en altına taşı"
67
+
68
+#: src/Command.cxx:47
69
+msgid "Move cursor to the top of the list"
70
+msgstr "İmleci listenin en üstüne taşı"
71
+
72
+#: src/Command.cxx:49
73
+msgid "Move cursor to the bottom of the list"
74
+msgstr "İmleci listenin en altına taşı"
75
+
76
+#: src/Command.cxx:51
77
+msgid "Page up"
78
+msgstr "Bir sayfa yukarı"
79
+
80
+#: src/Command.cxx:53
81
+msgid "Page down"
82
+msgstr "Bir sayfa aşağı"
83
+
84
+#: src/Command.cxx:55
85
+msgid "Range selection"
86
+msgstr "Aralık seçimi"
87
+
88
+#: src/Command.cxx:57
89
+msgid "Scroll down one line"
90
+msgstr "Bir satır aşağı kaydır"
91
+
92
+#: src/Command.cxx:59
93
+msgid "Scroll up one line"
94
+msgstr "Bir satır yukarı kaydır"
95
+
96
+#: src/Command.cxx:61
97
+msgid "Scroll up half a screen"
98
+msgstr "Yarım ekran yukarı kaydır"
99
+
100
+#: src/Command.cxx:63
101
+msgid "Scroll down half a screen"
102
+msgstr "Yarım ekran aşağı kaydır"
103
+
104
+#: src/Command.cxx:65
105
+msgid "Select currently playing song"
106
+msgstr "O anda çalan şarkıyı seçin"
107
+
108
+#: src/Command.cxx:70
109
+msgid "Help screen"
110
+msgstr "Yardım ekranı"
111
+
112
+#: src/Command.cxx:72 src/HelpPage.cxx:141
113
+msgid "Queue screen"
114
+msgstr "Kuyruk ekranı"
115
+
116
+#: src/Command.cxx:74 src/HelpPage.cxx:156
117
+msgid "Browse screen"
118
+msgstr "Göz atma ekranı"
119
+
120
+#: src/Command.cxx:79
121
+msgid "Play/Enter directory"
122
+msgstr "Oynat/Dizine gir"
123
+
124
+#: src/Command.cxx:81
125
+msgid "Pause"
126
+msgstr "Duraklat"
127
+
128
+#: src/Command.cxx:83
129
+msgid "Stop"
130
+msgstr "Durdur"
131
+
132
+#: src/Command.cxx:85
133
+msgid "Crop"
134
+msgstr "Kırp"
135
+
136
+#: src/Command.cxx:87
137
+msgid "Next track"
138
+msgstr "Sonraki parça"
139
+
140
+#: src/Command.cxx:89
141
+msgid "Previous track"
142
+msgstr "Önceki parça"
143
+
144
+#: src/Command.cxx:91
145
+msgid "Seek forward"
146
+msgstr "İleri sar"
147
+
148
+#: src/Command.cxx:93
149
+msgid "Seek backward"
150
+msgstr "Geri sar"
151
+
152
+#: src/Command.cxx:95
153
+msgid "Increase volume"
154
+msgstr "Sesi arttır"
155
+
156
+#: src/Command.cxx:97
157
+msgid "Decrease volume"
158
+msgstr "Sesi azalt"
159
+
160
+#: src/Command.cxx:99
161
+msgid "Select/deselect song in queue"
162
+msgstr "Kuyruktaki şarkıyı seç/seçimini kaldır"
163
+
164
+#: src/Command.cxx:101
165
+msgid "Select all listed items"
166
+msgstr "Listelenen tüm ögeleri seç"
167
+
168
+#: src/Command.cxx:103
169
+msgid "Delete song from queue"
170
+msgstr "Şarkıyı kuyruktan sil"
171
+
172
+#: src/Command.cxx:105
173
+msgid "Shuffle queue"
174
+msgstr "Kuyruğu karıştır"
175
+
176
+#: src/Command.cxx:107
177
+msgid "Clear queue"
178
+msgstr "Kuyruğu temizle"
179
+
180
+#: src/Command.cxx:109
181
+msgid "Toggle repeat mode"
182
+msgstr "Tekrar modunu değiştir"
183
+
184
+#: src/Command.cxx:111
185
+msgid "Toggle random mode"
186
+msgstr "Rastgele modu değiştir"
187
+
188
+#: src/Command.cxx:113
189
+msgid "Toggle single mode"
190
+msgstr "Tekli modunu değiştir"
191
+
192
+#: src/Command.cxx:115
193
+msgid "Toggle consume mode"
194
+msgstr "Tüketim modunu değiştir"
195
+
196
+#: src/Command.cxx:117
197
+msgid "Toggle crossfade mode"
198
+msgstr "Şarkı geçiş modunu değiştir"
199
+
200
+#: src/Command.cxx:119
201
+msgid "Start a music database update"
202
+msgstr "Müzik veri tabanı güncellemesi başlat"
203
+
204
+#: src/Command.cxx:121
205
+msgid "Save queue"
206
+msgstr "Kuyruğu kaydet"
207
+
208
+#: src/Command.cxx:123 src/HelpPage.cxx:175
209
+msgid "Append song to queue"
210
+msgstr "Şarkıyı kuyruğa ekle"
211
+
212
+#: src/Command.cxx:126
213
+msgid "Go to root directory"
214
+msgstr "Kök dizine git"
215
+
216
+#: src/Command.cxx:128
217
+msgid "Go to parent directory"
218
+msgstr "Üst dizine git"
219
+
220
+#: src/Command.cxx:131
221
+msgid "Locate song in browser"
222
+msgstr "Şarkıyı tarayıcıda bul"
223
+
224
+#: src/Command.cxx:135
225
+msgid "Move item up"
226
+msgstr "Ögeyi yukarı taşı"
227
+
228
+#: src/Command.cxx:137
229
+msgid "Move item down"
230
+msgstr "Ögeyi aşağı taşı"
231
+
232
+#: src/Command.cxx:139
233
+msgid "Refresh screen"
234
+msgstr "Ekranı yenile"
235
+
236
+#. translators: toggle between wrapping and non-wrapping
237
+#. search
238
+#: src/Command.cxx:146
239
+msgid "Toggle find mode"
240
+msgstr "Bulma modunu değiştir"
241
+
242
+#. translators: the auto center mode always centers the song
243
+#. currently being played
244
+#: src/Command.cxx:150
245
+msgid "Toggle auto center mode"
246
+msgstr "Otomatik merkez modunu değiştir"
247
+
248
+#: src/Command.cxx:155
249
+msgid "Next screen"
250
+msgstr "Sonraki ekran"
251
+
252
+#: src/Command.cxx:157
253
+msgid "Previous screen"
254
+msgstr "Önceki ekran"
255
+
256
+#: src/Command.cxx:159
257
+msgid "Swap to most recent screen"
258
+msgstr "En son ekrana geç"
259
+
260
+#: src/Command.cxx:164
261
+msgid "Forward find"
262
+msgstr "İleri doğru bul"
263
+
264
+#: src/Command.cxx:166
265
+msgid "Forward find next"
266
+msgstr "İleri doğru sonrakini bul"
267
+
268
+#: src/Command.cxx:168
269
+msgid "Backward find"
270
+msgstr "Geriye doğru bul"
271
+
272
+#: src/Command.cxx:170
273
+msgid "Backward find previous"
274
+msgstr "Geriye doğru öncekini bul"
275
+
276
+#. translators: this queries the user for a string
277
+#. * and jumps directly (while the user is typing)
278
+#. * to the entry which begins with this string
279
+#: src/Command.cxx:175
280
+msgid "Jump to"
281
+msgstr "Atla"
282
+
283
+#: src/Command.cxx:181
284
+msgid "Library page"
285
+msgstr "Kütüphane sayfası"
286
+
287
+#: src/Command.cxx:185 src/HelpPage.cxx:170
288
+msgid "Search screen"
289
+msgstr "Arama ekranı"
290
+
291
+#: src/Command.cxx:187
292
+msgid "Change search mode"
293
+msgstr "Arama modunu değiştir"
294
+
295
+#: src/Command.cxx:191
296
+msgid "View the selected and the currently playing song"
297
+msgstr "Seçilen ve çalmakta olan şarkıyı görüntüle"
298
+
299
+#: src/Command.cxx:195 src/HelpPage.cxx:182
300
+msgid "Lyrics screen"
301
+msgstr "Şarkı sözü ekranı"
302
+
303
+#. translators: interrupt the current background action,
304
+#. e.g. stop loading lyrics from the internet
305
+#: src/Command.cxx:199
306
+msgid "Interrupt action"
307
+msgstr "Eylemi durdur"
308
+
309
+#: src/Command.cxx:201
310
+msgid "Update Lyrics"
311
+msgstr "Şarkı Sözlerini Güncelle"
312
+
313
+#: src/Command.cxx:205
314
+msgid "Edit the current item"
315
+msgstr "Geçerli ögeyi düzenle"
316
+
317
+#: src/Command.cxx:210 src/HelpPage.cxx:197
318
+msgid "Outputs screen"
319
+msgstr "Çıktı ekranı"
320
+
321
+#: src/Command.cxx:215 src/HelpPage.cxx:204
322
+msgid "Chat screen"
323
+msgstr "Sohbet ekranı"
324
+
325
+#: src/ConfigParser.cxx:120
326
+msgid "Word expected"
327
+msgstr "Beklenen sözcük"
328
+
329
+#: src/ConfigParser.cxx:139
330
+msgid "Malformed hotkey definition"
331
+msgstr "Hatalı kısayol tuşu tanımı"
332
+
333
+#. the hotkey configuration
334
+#. line is incomplete
335
+#: src/ConfigParser.cxx:158
336
+msgid "Incomplete hotkey configuration"
337
+msgstr "Eksik kısayol tuşu yapılandırması"
338
+
339
+#. the hotkey configuration
340
+#. contains an unknown
341
+#. command
342
+#: src/ConfigParser.cxx:172
343
+msgid "Unknown command"
344
+msgstr "Bilinmeyen komut"
345
+
346
+#. translators: ncmpc
347
+#. supports displaying the
348
+#. "elapsed" or "remaining"
349
+#. time of a song being
350
+#. played; in this case, the
351
+#. configuration file
352
+#. contained an invalid
353
+#. setting
354
+#: src/ConfigParser.cxx:210
355
+msgid "Bad time display type"
356
+msgstr "Hatalı zaman görüntüleme türü"
357
+
358
+#. an equals sign '=' was expected while parsing a
359
+#. configuration file line
360
+#: src/ConfigParser.cxx:224 src/ConfigParser.cxx:454
361
+msgid "Missing '='"
362
+msgstr "Eksik '='"
363
+
364
+#: src/ConfigParser.cxx:273
365
+msgid "Bad color name"
366
+msgstr "Hatalı renk adı"
367
+
368
+#: src/ConfigParser.cxx:282
369
+msgid "Incomplete color definition"
370
+msgstr "Eksik renk tanımı"
371
+
372
+#: src/ConfigParser.cxx:288 src/SearchPage.cxx:244
373
+msgid "Invalid number"
374
+msgstr "Geçersiz sayı"
375
+
376
+#: src/ConfigParser.cxx:295
377
+msgid "Malformed color definition"
378
+msgstr "Hatalı renk tanımı"
379
+
380
+#. an unknown screen
381
+#. name was specified
382
+#. in the
383
+#. configuration
384
+#. file
385
+#: src/ConfigParser.cxx:359
386
+msgid "Unknown screen name"
387
+msgstr "Bilinmeyen ekran adı"
388
+
389
+#: src/ConfigParser.cxx:388
390
+msgid "Unknown MPD tag"
391
+msgstr "Bilinmeyen MPD etiketi"
392
+
393
+#: src/ConfigParser.cxx:415
394
+msgid "Invalid search mode"
395
+msgstr "Geçersiz arama modu"
396
+
397
+#: src/ConfigParser.cxx:433
398
+msgid "Unknown search mode"
399
+msgstr "Bilinmeyen arama modu"
400
+
401
+#: src/ConfigParser.cxx:621
402
+msgid "Unknown configuration parameter"
403
+msgstr "Bilinmeyen yapılandırma parametresi"
404
+
405
+#: src/CustomColors.cxx:57
406
+msgid "Terminal lacks support for changing colors"
407
+msgstr "Terminalin renklerin değiştirilmesi desteği yok"
408
+
409
+#. translators: the "delete" command is only possible
410
+#. for playlists; the user attempted to delete a song
411
+#. or a directory or something else
412
+#: src/FileBrowserPage.cxx:246
413
+msgid "Deleting this item is not possible"
414
+msgstr "Bu öge silinemez"
415
+
416
+#: src/FileBrowserPage.cxx:254
417
+#, c-format
418
+msgid "Delete playlist %s?"
419
+msgstr "%s oynatma listesi silinsin mi?"
420
+
421
+#. translators: a dialog was aborted by the user
422
+#: src/FileBrowserPage.cxx:259 src/KeyDefPage.cxx:182 src/LyricsPage.cxx:388
423
+#: src/save_playlist.cxx:111
424
+msgid "Aborted"
425
+msgstr "İptal edildi"
426
+
427
+#. translators: MPD deleted the playlist, as requested by the
428
+#. user
429
+#: src/FileBrowserPage.cxx:272
430
+msgid "Playlist deleted"
431
+msgstr "Oynatma listesi silindi"
432
+
433
+#. translators: caption of the browser screen
434
+#: src/FileBrowserPage.cxx:299 src/FileBrowserPage.cxx:381
435
+msgid "Browse"
436
+msgstr "Göz at"
437
+
438
+#: src/FileListPage.cxx:125
439
+#, c-format
440
+msgid "Loading playlist '%s'"
441
+msgstr "'%s' oynatma listesi yükleniyor"
442
+
443
+#: src/FileListPage.cxx:165 src/FileListPage.cxx:254 src/FileListPage.cxx:277
444
+#: src/TagListPage.cxx:184
445
+#, c-format
446
+msgid "Adding '%s' to queue"
447
+msgstr "'%s' kuyruğa ekleniyor"
448
+
449
+#: src/HelpPage.cxx:61
450
+msgid "Movement"
451
+msgstr "Hareket"
452
+
453
+#: src/HelpPage.cxx:106
454
+msgid "Global"
455
+msgstr "Genel"
456
+
457
+#: src/HelpPage.cxx:143
458
+msgid "Play"
459
+msgstr "Oynat"
460
+
461
+#: src/HelpPage.cxx:150
462
+msgid "Center"
463
+msgstr "Merkez"
464
+
465
+#: src/HelpPage.cxx:158
466
+msgid "Enter directory/Select and play song"
467
+msgstr "Dizin gir/Şarkı seç ve oynat"
468
+
469
+#: src/HelpPage.cxx:162
470
+msgid "Delete playlist"
471
+msgstr "Oynatma listesini sil"
472
+
473
+#: src/HelpPage.cxx:172
474
+msgid "New search"
475
+msgstr "Yeni arama"
476
+
477
+#: src/HelpPage.cxx:173
478
+msgid "Select and play"
479
+msgstr "Seç ve oynat"
480
+
481
+#: src/HelpPage.cxx:184
482
+msgid "View Lyrics"
483
+msgstr "Şarkı Sözlerini Görüntüle"
484
+
485
+#: src/HelpPage.cxx:185
486
+msgid "(Re)load lyrics"
487
+msgstr "Şarkı sözlerini (yeniden) yükle"
488
+
489
+#. to translators: this hotkey aborts the retrieval of lyrics
490
+#. from the server
491
+#: src/HelpPage.cxx:188
492
+msgid "Interrupt retrieval"
493
+msgstr "İndirmeyi iptal et"
494
+
495
+#: src/HelpPage.cxx:189
496
+msgid "Download lyrics for currently playing song"
497
+msgstr "Şu anda çalan şarkının sözlerini indir"
498
+
499
+#: src/HelpPage.cxx:190
500
+msgid "Add or edit lyrics"
501
+msgstr "Şarkı sözü ekle veya düzenle"
502
+
503
+#: src/HelpPage.cxx:191
504
+msgid "Save lyrics"
505
+msgstr "Şarkı sözlerini kaydet"
506
+
507
+#: src/HelpPage.cxx:192
508
+msgid "Delete saved lyrics"
509
+msgstr "Kaydedilen şarkı sözlerini sil"
510
+
511
+#: src/HelpPage.cxx:199
512
+msgid "Enable/disable output"
513
+msgstr "Çıktıyı etkinleştir/devre dışı bırak"
514
+
515
+#: src/HelpPage.cxx:206
516
+msgid "Write a message"
517
+msgstr "Bir mesaj yaz"
518
+
519
+#: src/HelpPage.cxx:211
520
+msgid "Keydef screen"
521
+msgstr "Tuş tanımlama ekranı"
522
+
523
+#: src/HelpPage.cxx:213
524
+msgid "Edit keydefs for selected command"
525
+msgstr "Seçili komut için tuş tanımlarını düzenle"
526
+
527
+#: src/HelpPage.cxx:214
528
+msgid "Remove selected keydef"
529
+msgstr "Seçilen tuş tanımını kaldır"
530
+
531
+#: src/HelpPage.cxx:215
532
+msgid "Add a keydef"
533
+msgstr "Bir tuş tanımı ekle"
534
+
535
+#: src/HelpPage.cxx:216
536
+msgid "Go up a level"
537
+msgstr "Bir seviye yukarı git"
538
+
539
+#: src/HelpPage.cxx:217
540
+msgid "Apply and save changes"
541
+msgstr "Değişiklikleri uygula ve kaydet"
542
+
543
+#: src/HelpPage.cxx:246 src/HelpPage.cxx:330
544
+msgid "Help"
545
+msgstr "Yardım"
546
+
547
+#: src/i18n.h:43
548
+msgid "y"
549
+msgstr "e"
550
+
551
+#: src/i18n.h:44
552
+msgid "n"
553
+msgstr "h"
554
+
555
+#: src/KeyDefPage.cxx:161
556
+msgid "Deleted"
557
+msgstr "Silindi"
558
+
559
+#: src/KeyDefPage.cxx:177
560
+#, c-format
561
+msgid "Enter new key for %s: "
562
+msgstr "%s için yeni tuş girin: "
563
+
564
+#: src/KeyDefPage.cxx:187
565
+msgid "Ctrl-Space can't be used"
566
+msgstr "Ctrl-Space kullanılamaz"
567
+
568
+#: src/KeyDefPage.cxx:193
569
+#, c-format
570
+msgid "Error: key %s is already used for %s"
571
+msgstr "Hata: %s tuşu zaten %s için kullanılıyor"
572
+
573
+#: src/KeyDefPage.cxx:203
574
+#, c-format
575
+msgid "Assigned %s to %s"
576
+msgstr "%s tuşu, %s komutuna atandı"
577
+
578
+#: src/KeyDefPage.cxx:230
579
+msgid "Add new key"
580
+msgstr "Yeni tuş ekle"
581
+
582
+#: src/KeyDefPage.cxx:252
583
+#, c-format
584
+msgid "Edit keys for %s"
585
+msgstr "%s komutu için tuşları düzenle"
586
+
587
+#: src/KeyDefPage.cxx:395
588
+msgid "You have new key bindings"
589
+msgstr "Yeni tuş atamalarınız var"
590
+
591
+#: src/KeyDefPage.cxx:397
592
+msgid "Keybindings unchanged."
593
+msgstr "Tuş atamaları değişmedi."
594
+
595
+#: src/KeyDefPage.cxx:407
596
+msgid "Unable to write configuration"
597
+msgstr "Yapılandırma yazılamıyor"
598
+
599
+#: src/KeyDefPage.cxx:416 src/KeyDefPage.cxx:425
600
+msgid "Error"
601
+msgstr "Hata"
602
+
603
+#: src/KeyDefPage.cxx:423
604
+#, c-format
605
+msgid "Wrote %s"
606
+msgstr "%s yazıldı"
607
+
608
+#: src/KeyDefPage.cxx:436
609
+msgid "===> Apply key bindings "
610
+msgstr "===> Tuş atamalarını uygula "
611
+
612
+#: src/KeyDefPage.cxx:438
613
+msgid "===> Apply & Save key bindings "
614
+msgstr "===> Tuş atamalarını uygula ve kaydet "
615
+
616
+#: src/KeyDefPage.cxx:475
617
+msgid "Edit key bindings"
618
+msgstr "Tuş atamalarını düzenle"
619
+
620
+#: src/KeyDefPage.cxx:557
621
+msgid "Note: Did you forget to 'Apply' your changes?"
622
+msgstr "Not: Değişikliklerinizi 'uygulamayı' mı unuttunuz?"
623
+
624
+#: src/KeyDefPage.cxx:607
625
+msgid "Keys"
626
+msgstr "Tuşlar"
627
+
628
+#: src/KeyName.cxx:115
629
+msgid "Undefined"
630
+msgstr "Tanımlanmadı"
631
+
632
+#: src/KeyName.cxx:117
633
+msgid "Space"
634
+msgstr "Space"
635
+
636
+#: src/KeyName.cxx:119
637
+msgid "Enter"
638
+msgstr "Enter"
639
+
640
+#: src/KeyName.cxx:121
641
+msgid "Backspace"
642
+msgstr "Backspace"
643
+
644
+#: src/KeyName.cxx:123
645
+msgid "Delete"
646
+msgstr "Delete"
647
+
648
+#: src/KeyName.cxx:125
649
+msgid "Up"
650
+msgstr "Yukarı"
651
+
652
+#: src/KeyName.cxx:127
653
+msgid "Down"
654
+msgstr "Aşağı"
655
+
656
+#: src/KeyName.cxx:129
657
+msgid "Left"
658
+msgstr "Sol"
659
+
660
+#: src/KeyName.cxx:131
661
+msgid "Right"
662
+msgstr "Sağ"
663
+
664
+#: src/KeyName.cxx:133
665
+msgid "Home"
666
+msgstr "Home"
667
+
668
+#: src/KeyName.cxx:135
669
+msgid "End"
670
+msgstr "End"
671
+
672
+#: src/KeyName.cxx:137
673
+msgid "PageDown"
674
+msgstr "PageDown"
675
+
676
+#: src/KeyName.cxx:139
677
+msgid "PageUp"
678
+msgstr "PageUp"
679
+
680
+#: src/KeyName.cxx:141
681
+msgid "Tab"
682
+msgstr "Tab"
683
+
684
+#: src/KeyName.cxx:143
685
+msgid "Shift+Tab"
686
+msgstr "Shift+Tab"
687
+
688
+#: src/KeyName.cxx:145
689
+msgid "Esc"
690
+msgstr "Esc"
691
+
692
+#: src/KeyName.cxx:147
693
+msgid "Insert"
694
+msgstr "Insert"
695
+
696
+#. translate "^X" to "Ctrl-X"
697
+#: src/KeyName.cxx:167
698
+#, c-format
699
+msgid "Ctrl-%c"
700
+msgstr "Ctrl-%c"
701
+
702
+#. translate "M-X" to "Alt-X"
703
+#: src/KeyName.cxx:173
704
+#, c-format
705
+msgid "Alt-%c"
706
+msgstr "Alt-%c"
707
+
708
+#: src/LibraryPage.cxx:45
709
+msgid "Artists"
710
+msgstr "Sanatçılar"
711
+
712
+#: src/LibraryPage.cxx:48 src/LibraryPage.cxx:175
713
+msgid "Albums"
714
+msgstr "Albümler"
715
+
716
+#: src/LibraryPage.cxx:123
717
+msgid "All"
718
+msgstr "Tümü"
719
+
720
+#: src/LibraryPage.cxx:197
721
+msgid "Songs"
722
+msgstr "Şarkılar"
723
+
724
+#: src/LibraryPage.cxx:314
725
+msgid "Library"
726
+msgstr "Kütüphane"
727
+
728
+#: src/ListWindow.cxx:213
729
+msgid "Range selection disabled"
730
+msgstr "Aralık seçimi devre dışı"
731
+
732
+#: src/ListWindow.cxx:216
733
+msgid "Range selection enabled"
734
+msgstr "Aralık seçimi etkin"
735
+
736
+#. translators: no lyrics were found for the song
737
+#: src/LyricsPage.cxx:253
738
+msgid "No lyrics"
739
+msgstr "Şarkı sözü yok"
740
+
741
+#: src/LyricsPage.cxx:270
742
+#, c-format
743
+msgid "Lyrics timeout occurred after %d seconds"
744
+msgstr "%d saniye sonra şarkı sözü zaman aşımı gerçekleşti"
745
+
746
+#: src/LyricsPage.cxx:353 src/LyricsPage.cxx:361 src/LyricsPage.cxx:371
747
+#: src/LyricsPage.cxx:507
748
+msgid "Lyrics"
749
+msgstr "Şarkı sözleri"
750
+
751
+#. translators: this message is displayed
752
+#. while data is retrieved
753
+#: src/LyricsPage.cxx:356
754
+msgid "loading..."
755
+msgstr "yükleniyor..."
756
+
757
+#: src/LyricsPage.cxx:378
758
+msgid "Editor not configured"
759
+msgstr "Düzenleyici yapılandırılmadı"
760
+
761
+#: src/LyricsPage.cxx:385
762
+msgid "Do you really want to start an editor and edit these lyrics?"
763
+msgstr ""
764
+"Gerçekten bir düzenleyici başlatmak ve bu şarkı sözlerini düzenlemek istiyor "
765
+"musunuz?"
766
+
767
+#: src/LyricsPage.cxx:403 src/LyricsPage.cxx:427
768
+msgid "Can't start editor"
769
+msgstr "Düzenleyici başlatılamıyor"
770
+
771
+#: src/LyricsPage.cxx:430 src/LyricsPage.cxx:434
772
+msgid "Editor exited unexpectedly"
773
+msgstr "Düzenleyici beklenmedik şekilde sonlandı"
774
+
775
+#. lyrics for the song were saved on hard disk
776
+#: src/LyricsPage.cxx:456
777
+msgid "Lyrics saved"
778
+msgstr "Şarkı sözleri kaydedildi"
779
+
780
+#: src/LyricsPage.cxx:462
781
+msgid "Lyrics deleted"
782
+msgstr "Şarkı sözleri silindi"
783
+
784
+#: src/LyricsPage.cxx:463
785
+msgid "No saved lyrics"
786
+msgstr "Kaydedilen şarkı sözü yok"
787
+
788
+#: src/Main.cxx:133
789
+#, c-format
790
+msgid "Connecting to %s"
791
+msgstr "%s ile bağlantı kuruluyor"
792
+
793
+#: src/Main.cxx:149
794
+#, c-format
795
+msgid "Error: MPD version %d.%d.%d is too old (%s needed)"
796
+msgstr "Hata: MPD sürümü %d.%d.%d çok eski (%s gerekli)"
797
+
798
+#. To translators: these credits are shown
799
+#. when ncmpc is started with "--version"
800
+#: src/Options.cxx:216 src/Options.cxx:219
801
+msgid "translator-credits"
802
+msgstr "Oğuz Ersen <oguz@ersen.moe>"
803
+
804
+#: src/OutputsPage.cxx:168
805
+#, c-format
806
+msgid "Switched to partition '%s'"
807
+msgstr "'%s' bölümüne geçildi"
808
+
809
+#: src/OutputsPage.cxx:180 src/SongPage.cxx:69
810
+msgid "Name"
811
+msgstr "Ad"
812
+
813
+#: src/OutputsPage.cxx:230
814
+#, c-format
815
+msgid "Output '%s' enabled"
816
+msgstr "'%s' çıktısı etkin"
817
+
818
+#: src/OutputsPage.cxx:241
819
+#, c-format
820
+msgid "Output '%s' disabled"
821
+msgstr "'%s' çıktısı devre dışı"
822
+
823
+#: src/OutputsPage.cxx:371 src/OutputsPage.cxx:480
824
+msgid "Outputs"
825
+msgstr "Çıktılar"
826
+
827
+#: src/OutputsPage.cxx:383
828
+msgid "Partition"
829
+msgstr "Bölüm"
830
+
831
+#: src/OutputsPage.cxx:407
832
+msgid "Create new partition"
833
+msgstr "Yeni bölüm oluştur"
834
+
835
+#: src/player_command.cxx:94 src/QueuePage.cxx:651
836
+msgid "Shuffled queue"
837
+msgstr "Kuyruk karıştırıldı"
838
+
839
+#: src/player_command.cxx:100
840
+msgid "Cleared queue"
841
+msgstr "Kuyruk temizlendi"
842
+
843
+#. get path
844
+#: src/QueuePage.cxx:314
845
+msgid "Add"
846
+msgstr "Ekle"
847
+
848
+#: src/QueuePage.cxx:379 src/QueuePage.cxx:697
849
+msgid "Queue"
850
+msgstr "Kuyruk"
851
+
852
+#: src/QueuePage.cxx:381
853
+#, c-format
854
+msgid "Queue on %s"
855
+msgstr "%s kuyruğu"
856
+
857
+#. query the user for a filename
858
+#: src/save_playlist.cxx:86
859
+msgid "Save queue as"
860
+msgstr "Kuyruğu farklı kaydet"
861
+
862
+#: src/save_playlist.cxx:108
863
+#, c-format
864
+msgid "Replace %s?"
865
+msgstr "%s değiştirilsin mi?"
866
+
867
+#. success
868
+#: src/save_playlist.cxx:129
869
+#, c-format
870
+msgid "Saved %s"
871
+msgstr "%s kaydedildi"
872
+
873
+#: src/screen_client.cxx:41
874
+msgid "Database update running"
875
+msgstr "Veri tabanı güncellemesi çalışıyor"
876
+
877
+#: src/screen_client.cxx:48
878
+#, c-format
879
+msgid "Database update of %s started"
880
+msgstr "%s veri tabanı güncellemesi başladı"
881
+
882
+#: src/screen_client.cxx:51
883
+msgid "Database update started"
884
+msgstr "Veri tabanı güncellemesi başladı"
885
+
886
+#: src/screen.cxx:158
887
+msgid "Repeat mode is on"
888
+msgstr "Tekrar modu açık"
889
+
890
+#: src/screen.cxx:159
891
+msgid "Repeat mode is off"
892
+msgstr "Tekrar modu kapalı"
893
+
894
+#: src/screen.cxx:163
895
+msgid "Random mode is on"
896
+msgstr "Rastgele modu açık"
897
+
898
+#: src/screen.cxx:164
899
+msgid "Random mode is off"
900
+msgstr "Rastgele modu kapalı"
901
+
902
+#. "single" mode means
903
+#. that MPD will
904
+#. automatically stop
905
+#. after playing one
906
+#. single song
907
+#: src/screen.cxx:173
908
+msgid "Single mode is on"
909
+msgstr "Tekli modu açık"
910
+
911
+#: src/screen.cxx:174
912
+msgid "Single mode is off"
913
+msgstr "Tekli modu kapalı"
914
+
915
+#. "consume" mode means
916
+#. that MPD removes each
917
+#. song which has
918
+#. finished playing
919
+#: src/screen.cxx:182
920
+msgid "Consume mode is on"
921
+msgstr "Tüketim modu açık"
922
+
923
+#: src/screen.cxx:183
924
+msgid "Consume mode is off"
925
+msgstr "Tüketim modu kapalı"
926
+
927
+#: src/screen.cxx:186
928
+#, c-format
929
+msgid "Crossfade %d seconds"
930
+msgstr "%d saniye şarkı geçişi"
931
+
932
+#: src/screen.cxx:198
933
+msgid "Database updated"
934
+msgstr "Veri tabanı güncellendi"
935
+
936
+#: src/screen.cxx:248
937
+msgid "Find mode: Wrapped"
938
+msgstr "Bulma modu: Başa dön"
939
+
940
+#: src/screen.cxx:249
941
+msgid "Find mode: Normal"
942
+msgstr "Bulma modu: Normal"
943
+
944
+#: src/screen.cxx:254
945
+msgid "Auto center mode: On"
946
+msgstr "Otomatik merkez modu: Açık"
947
+
948
+#: src/screen.cxx:255
949
+msgid "Auto center mode: Off"
950
+msgstr "Otomatik merkez modu: Kapalı"
951
+
952
+#: src/screen_find.cxx:33
953
+msgid "Find"
954
+msgstr "Bul"
955
+
956
+#: src/screen_find.cxx:34
957
+msgid "Find backward"
958
+msgstr "Geriye doğru bul"
959
+
960
+#: src/screen_find.cxx:35
961
+msgid "Jump"
962
+msgstr "Atla"
963
+
964
+#: src/screen_find.cxx:81
965
+#, c-format
966
+msgid "Unable to find '%s'"
967
+msgstr "'%s' bulunamıyor"
968
+
969
+#: src/screen_utils.cxx:150
970
+msgid "Password"
971
+msgstr "Parola"
972
+
973
+#: src/SearchPage.cxx:51
974
+msgid "artist"
975
+msgstr "sanatçı"
976
+
977
+#: src/SearchPage.cxx:52
978
+msgid "album"
979
+msgstr "albüm"
980
+
981
+#: src/SearchPage.cxx:53
982
+msgid "title"
983
+msgstr "başlık"
984
+
985
+#: src/SearchPage.cxx:54
986
+msgid "track"
987
+msgstr "parça"
988
+
989
+#: src/SearchPage.cxx:55
990
+msgid "name"
991
+msgstr "ad"
992
+
993
+#: src/SearchPage.cxx:56
994
+msgid "genre"
995
+msgstr "tür"
996
+
997
+#: src/SearchPage.cxx:57
998
+msgid "date"
999
+msgstr "tarih"
1000
+
1001
+#: src/SearchPage.cxx:58
1002
+msgid "composer"
1003
+msgstr "besteci"
1004
+
1005
+#: src/SearchPage.cxx:59
1006
+msgid "performer"
1007
+msgstr "söyleyen"
1008
+
1009
+#: src/SearchPage.cxx:60
1010
+msgid "comment"
1011
+msgstr "yorum"
1012
+
1013
+#: src/SearchPage.cxx:68
1014
+msgid "file"
1015
+msgstr "dosya"
1016
+
1017
+#: src/SearchPage.cxx:90 src/SongPage.cxx:63
1018
+msgid "Title"
1019
+msgstr "Başlık"
1020
+
1021
+#: src/SearchPage.cxx:91 src/SongPage.cxx:62
1022
+msgid "Artist"
1023
+msgstr "Sanatçı"
1024
+
1025
+#: src/SearchPage.cxx:92 src/SongPage.cxx:64
1026
+msgid "Album"
1027
+msgstr "Albüm"
1028
+
1029
+#: src/SearchPage.cxx:93
1030
+msgid "Filename"
1031
+msgstr "Dosya adı"
1032
+
1033
+#: src/SearchPage.cxx:94
1034
+msgid "Artist + Title"
1035
+msgstr "Sanatçı + Başlık"
1036
+
1037
+#: src/SearchPage.cxx:285 src/SearchPage.cxx:289
1038
+msgid "Unrecognized suffix"
1039
+msgstr "Tanınmayan son ek"
1040
+
1041
+#: src/SearchPage.cxx:337
1042
+#, c-format
1043
+msgid "Bad search tag %s"
1044
+msgstr "Hatalı arama etiketi %s"
1045
+
1046
+#: src/SearchPage.cxx:351
1047
+#, c-format
1048
+msgid "No argument for search tag %s"
1049
+msgstr "Arama etiketi için argüman yok %s"
1050
+
1051
+#: src/SearchPage.cxx:446 src/SearchPage.cxx:479 src/SearchPage.cxx:483
1052
+#: src/SearchPage.cxx:487 src/SearchPage.cxx:546
1053
+msgid "Search"
1054
+msgstr "Ara"
1055
+
1056
+#: src/SearchPage.cxx:509
1057
+#, c-format
1058
+msgid "Search mode: %s"
1059
+msgstr "Arama modu: %s"
1060
+
1061
+#: src/SongPage.cxx:65
1062
+msgid "Length"
1063
+msgstr "Uzunluk"
1064
+
1065
+#: src/SongPage.cxx:66
1066
+msgid "Position"
1067
+msgstr "Konum"
1068
+
1069
+#: src/SongPage.cxx:67
1070
+msgid "Composer"
1071
+msgstr "Besteci"
1072
+
1073
+#: src/SongPage.cxx:68
1074
+msgid "Performer"
1075
+msgstr "Söyleyen"
1076
+
1077
+#: src/SongPage.cxx:70
1078
+msgid "Disc"
1079
+msgstr "Disk"
1080
+
1081
+#: src/SongPage.cxx:71
1082
+msgid "Track"
1083
+msgstr "Parça"
1084
+
1085
+#: src/SongPage.cxx:72
1086
+msgid "Date"
1087
+msgstr "Tarih"
1088
+
1089
+#: src/SongPage.cxx:73
1090
+msgid "Genre"
1091
+msgstr "Tür"
1092
+
1093
+#: src/SongPage.cxx:74
1094
+msgid "Comment"
1095
+msgstr "Yorum"
1096
+
1097
+#: src/SongPage.cxx:75
1098
+msgid "Path"
1099
+msgstr "Yol"
1100
+
1101
+#: src/SongPage.cxx:76
1102
+msgid "Bitrate"
1103
+msgstr "Bit hızı"
1104
+
1105
+#: src/SongPage.cxx:77
1106
+msgid "Format"
1107
+msgstr "Biçim"
1108
+
1109
+#: src/SongPage.cxx:94
1110
+msgid "Number of artists"
1111
+msgstr "Sanatçı sayısı"
1112
+
1113
+#: src/SongPage.cxx:95
1114
+msgid "Number of albums"
1115
+msgstr "Albüm sayısı"
1116
+
1117
+#: src/SongPage.cxx:96
1118
+msgid "Number of songs"
1119
+msgstr "Şarkı sayısı"
1120
+
1121
+#: src/SongPage.cxx:97
1122
+msgid "Uptime"
1123
+msgstr "Çalışma süresi"
1124
+
1125
+#: src/SongPage.cxx:98
1126
+msgid "Most recent db update"
1127
+msgstr "En son v.t. güncellemesi"
1128
+
1129
+#: src/SongPage.cxx:99
1130
+msgid "Playtime"
1131
+msgstr "Çalma süresi"
1132
+
1133
+#: src/SongPage.cxx:100
1134
+msgid "DB playtime"
1135
+msgstr "V.T. çalma süresi"
1136
+
1137
+#: src/SongPage.cxx:205
1138
+msgid "Song viewer"
1139
+msgstr "Şarkı görüntüleyici"
1140
+
1141
+#: src/SongPage.cxx:371
1142
+msgid "MPD statistics"
1143
+msgstr "MPD istatistikleri"
1144
+
1145
+#: src/SongPage.cxx:457
1146
+msgid "Selected song"
1147
+msgstr "Seçilen şarkı"
1148
+
1149
+#: src/SongPage.cxx:467
1150
+msgid "Currently playing song"
1151
+msgstr "Çalan şarkı"
1152
+
1153
+#: src/SongPage.cxx:472
1154
+#, c-format
1155
+msgid "%d kbps"
1156
+msgstr "%d kbps"
1157
+
1158
+#: src/SongPage.cxx:556
1159
+msgid "Song"
1160
+msgstr "Şarkı"
1161
+
1162
+#: src/StatusBar.cxx:165
1163
+msgid "Playing:"
1164
+msgstr "Oynatılıyor:"
1165
+
1166
+#: src/StatusBar.cxx:169
1167
+msgid "Paused"
1168
+msgstr "Duraklatıldı"
1169
+
1170
+#: src/Styles.cxx:252 src/Styles.cxx:313
1171
+msgid "Unknown color"
1172
+msgstr "Bilinmeyen renk"
1173
+
1174
+#: src/Styles.cxx:323
1175
+msgid "Unknown color field"
1176
+msgstr "Bilinmeyen renk alanı"
1177
+
1178
+#: src/Styles.cxx:356
1179
+msgid "Terminal lacks color capabilities"
1180
+msgstr "Terminal renk özelliklerine sahip değil"
1181
+
1182
+#: src/TagListPage.cxx:71
1183
+msgid "All tracks"
1184
+msgstr "Tüm parçalar"
1185
+
1186
+#: src/time_format.cxx:44
1187
+msgid "year"
1188
+msgstr "yıl"
1189
+
1190
+#: src/time_format.cxx:46
1191
+msgid "years"
1192
+msgstr "yıl"
1193
+
1194
+#: src/time_format.cxx:54
1195
+msgid "week"
1196
+msgstr "hafta"
1197
+
1198
+#: src/time_format.cxx:57
1199
+msgid "weeks"
1200
+msgstr "hafta"
1201
+
1202
+#: src/time_format.cxx:65
1203
+msgid "day"
1204
+msgstr "gün"
1205
+
1206
+#: src/time_format.cxx:68
1207
+msgid "days"
1208
+msgstr "gün"
1209
+
1210
+#: src/TitleBar.cxx:101
1211
+msgid "Volume n/a"
1212
+msgstr "Ses yok"
1213
+
1214
+#: src/TitleBar.cxx:103
1215
+#, c-format
1216
+msgid "Volume %d%%"
1217
+msgstr "Ses %d%%"
1218
ncmpc-0.47.tar.xz/src/AsyncUserInput.cxx -> ncmpc-0.48.tar.xz/src/AsyncUserInput.cxx
Changed
71
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "config.h"
23
#include "AsyncUserInput.hxx"
24
25
#include "ncmpc.hxx"
26
#include "Point.hxx"
27
28
-static bool
29
-ignore_key(int key)
30
+static constexpr bool
31
+ignore_key(int key) noexcept
32
{
33
return key == ERR || key == '\0';
34
}
35
36
gnu::pure
37
static Command
38
-translate_key(int key)
39
+translate_key(int key) noexcept
40
{
41
return GetGlobalKeyBindings().FindKey(key);
42
}
43
44
45
begin_input_event();
46
47
- if (!do_input_event(socket_event.GetEventLoop(), cmd))
48
+ if (!do_input_event(stdin_event.GetEventLoop(), cmd))
49
return;
50
51
end_input_event();
52
53
}
54
55
AsyncUserInput::AsyncUserInput(EventLoop &event_loop, WINDOW &_w) noexcept
56
- :socket_event(event_loop, BIND_THIS_METHOD(OnSocketReady),
57
+ :stdin_event(event_loop, BIND_THIS_METHOD(OnSocketReady),
58
FileDescriptor{STDIN_FILENO}),
59
w(_w)
60
{
61
- socket_event.ScheduleRead();
62
+ stdin_event.ScheduleRead();
63
}
64
65
void
66
-keyboard_unread(EventLoop &event_loop, int key)
67
+keyboard_unread(EventLoop &event_loop, int key) noexcept
68
{
69
if (ignore_key(key))
70
return;
71
ncmpc-0.47.tar.xz/src/AsyncUserInput.hxx -> ncmpc-0.48.tar.xz/src/AsyncUserInput.hxx
Changed
41
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef ASYNC_USER_INPUT_HXX
23
#define ASYNC_USER_INPUT_HXX
24
25
#include <curses.h>
26
27
class AsyncUserInput {
28
- PipeEvent socket_event;
29
+ PipeEvent stdin_event;
30
31
WINDOW &w;
32
33
34
};
35
36
void
37
-keyboard_unread(EventLoop &event_loop, int key);
38
+keyboard_unread(EventLoop &event_loop, int key) noexcept;
39
40
#endif
41
ncmpc-0.47.tar.xz/src/BasicColors.cxx -> ncmpc-0.48.tar.xz/src/BasicColors.cxx
Changed
40
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "BasicColors.hxx"
23
+#include "util/StringAPI.hxx"
24
25
#include <curses.h>
26
27
-#include <strings.h>
28
#include <stdlib.h>
29
30
static constexpr const char *basic_color_names = {
31
32
ParseBasicColorName(const char *name) noexcept
33
{
34
for (size_t i = 0; basic_color_namesi != nullptr; ++i)
35
- if (strcasecmp(basic_color_namesi, name) == 0)
36
+ if (StringIsEqualIgnoreCase(basic_color_namesi, name))
37
return i;
38
39
return -1;
40
ncmpc-0.47.tar.xz/src/BasicColors.hxx -> ncmpc-0.48.tar.xz/src/BasicColors.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef BASIC_COLORS_HXX
23
#define BASIC_COLORS_HXX
24
ncmpc-0.47.tar.xz/src/BasicMarquee.cxx -> ncmpc-0.48.tar.xz/src/BasicMarquee.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "BasicMarquee.hxx"
23
#include "util/LocaleString.hxx"
24
ncmpc-0.47.tar.xz/src/BasicMarquee.hxx -> ncmpc-0.48.tar.xz/src/BasicMarquee.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef BASIC_MARQUEE_HXX
23
#define BASIC_MARQUEE_HXX
24
ncmpc-0.47.tar.xz/src/Bindings.cxx -> ncmpc-0.48.tar.xz/src/Bindings.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Bindings.hxx"
23
#include "Command.hxx"
24
ncmpc-0.47.tar.xz/src/Bindings.hxx -> ncmpc-0.48.tar.xz/src/Bindings.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef BINDINGS_HXX
23
#define BINDINGS_HXX
24
ncmpc-0.47.tar.xz/src/ChatPage.cxx -> ncmpc-0.48.tar.xz/src/ChatPage.cxx
Changed
51
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ChatPage.hxx"
23
#include "PageMeta.hxx"
24
25
#include "charset.hxx"
26
#include "Command.hxx"
27
#include "Options.hxx"
28
+#include "util/StringAPI.hxx"
29
30
#include <mpd/idle.h>
31
32
33
{
34
/* You'll have to move this out of screen_chat, if you want to use
35
client-to-client messages anywhere else */
36
- assert(strcmp(mpd_message_get_channel(&message), chat_channel) == 0);
37
+ assert(StringIsEqual(mpd_message_get_channel(&message), chat_channel));
38
39
Append(mpd_message_get_text(&message));
40
41
42
return true;
43
44
if (cmd == Command::PLAY) {
45
- auto message = screen_readln(_("Your message"), nullptr, nullptr, nullptr);
46
+ auto message = screen_readln(screen, _("Your message"),
47
+ nullptr, nullptr, nullptr);
48
49
/* the user entered an empty line */
50
if (message.empty())
51
ncmpc-0.47.tar.xz/src/ChatPage.hxx -> ncmpc-0.48.tar.xz/src/ChatPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_CHAT_PAGE_HXX
23
#define NCMPC_CHAT_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/Command.cxx -> ncmpc-0.48.tar.xz/src/Command.cxx
Changed
43
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Command.hxx"
23
#include "i18n.h"
24
+#include "util/StringAPI.hxx"
25
26
#include <iterator>
27
28
29
get_key_command_from_name(const char *name)
30
{
31
for (size_t i = 0; i < size_t(Command::NONE); ++i)
32
- if (strcmp(name, cmdsi.name) == 0)
33
+ if (StringIsEqual(name, cmdsi.name))
34
return Command(i);
35
36
#ifdef ENABLE_LIBRARY_PAGE
37
/* compatibility with 0.32 and older */
38
- if (strcmp(name, "screen-artist") == 0)
39
+ if (StringIsEqual(name, "screen-artist"))
40
return Command::LIBRARY_PAGE;
41
#endif
42
43
ncmpc-0.47.tar.xz/src/Command.hxx -> ncmpc-0.48.tar.xz/src/Command.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef COMMAND_H
23
#define COMMAND_H
24
ncmpc-0.47.tar.xz/src/Completion.cxx -> ncmpc-0.48.tar.xz/src/Completion.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Completion.hxx"
23
24
ncmpc-0.47.tar.xz/src/Completion.hxx -> ncmpc-0.48.tar.xz/src/Completion.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef COMPLETION_HXX
23
#define COMPLETION_HXX
24
ncmpc-0.47.tar.xz/src/ConfigFile.cxx -> ncmpc-0.48.tar.xz/src/ConfigFile.cxx
Changed
59
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ConfigFile.hxx"
23
#include "ConfigParser.hxx"
24
25
return MakeUserConfigPath(KEYS_FILENAME);
26
}
27
28
-#ifndef _WIN32
29
-
30
-std::string
31
-GetHomeConfigPath() noexcept
32
-{
33
- const char *home = GetHomeDirectory();
34
- if (home == nullptr)
35
- return {};
36
-
37
- return BuildPath(home, "." PACKAGE, CONFIG_FILENAME);
38
-}
39
-
40
-#endif
41
-
42
std::string
43
GetUserConfigPath() noexcept
44
{
45
46
if (!filename.empty() && IsFile(filename.c_str()))
47
return filename;
48
49
-#ifndef _WIN32
50
- /* check for user configuration ~/.ncmpc/config */
51
- filename = GetHomeConfigPath();
52
- if (!filename.empty() && IsFile(filename.c_str()))
53
- return filename;
54
-#endif
55
-
56
/* check for global configuration SYSCONFDIR/ncmpc/config */
57
filename = GetSystemConfigPath();
58
if (IsFile(filename.c_str()))
59
ncmpc-0.47.tar.xz/src/ConfigFile.hxx -> ncmpc-0.48.tar.xz/src/ConfigFile.hxx
Changed
36
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef CONFIG_FILE_HXX
23
#define CONFIG_FILE_HXX
24
25
std::string
26
MakeKeysPath();
27
28
-#ifndef _WIN32
29
-std::string
30
-GetHomeConfigPath() noexcept;
31
-#endif
32
-
33
std::string
34
GetUserConfigPath() noexcept;
35
36
ncmpc-0.47.tar.xz/src/ConfigParser.cxx -> ncmpc-0.48.tar.xz/src/ConfigParser.cxx
Changed
461
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ConfigParser.hxx"
23
#include "config.h"
24
25
#include "util/PrintException.hxx"
26
#include "util/RuntimeError.hxx"
27
#include "util/ScopeExit.hxx"
28
+#include "util/StringAPI.hxx"
29
#include "util/StringStrip.hxx"
30
31
+#ifndef NCMPC_MINI
32
+#include "TableGlue.hxx"
33
+#include "TableStructure.hxx"
34
+#endif
35
+
36
#include <algorithm>
37
#include <array>
38
39
40
#include <ctype.h>
41
#include <stdio.h>
42
#include <stdlib.h>
43
-#include <string.h>
44
-#include <strings.h>
45
46
#define MAX_LINE_LENGTH 1024
47
#define COMMENT_TOKEN '#'
48
49
static bool
50
str2bool(char *str) noexcept
51
{
52
- return strcasecmp(str, "yes") == 0 || strcasecmp(str, "true") == 0 ||
53
- strcasecmp(str, "on") == 0 || strcasecmp(str, "1") == 0;
54
+ return StringIsEqualIgnoreCase(str, "yes") ||
55
+ StringIsEqualIgnoreCase(str, "true") ||
56
+ StringIsEqualIgnoreCase(str, "on") ||
57
+ StringIsEqualIgnoreCase(str, "1");
58
}
59
60
static constexpr bool
61
62
return p;
63
}
64
65
+#ifndef NCMPC_MINI
66
+
67
+static constexpr bool
68
+IsValueChar(char ch) noexcept
69
+{
70
+ return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_' || ch == '.';
71
+}
72
+
73
+gnu::pure
74
+static char *
75
+AfterUnquotedValue(char *p) noexcept
76
+{
77
+ while (IsValueChar(*p))
78
+ ++p;
79
+
80
+ return p;
81
+}
82
+
83
+/**
84
+ * Throws on error.
85
+ */
86
+static char *
87
+NextUnquotedValue(char *&pp)
88
+{
89
+ char *value = pp;
90
+
91
+ char *end = AfterUnquotedValue(value);
92
+ if (*end == 0) {
93
+ pp = end;
94
+ } else if (IsWhitespaceFast(*end)) {
95
+ *end = 0;
96
+ pp = StripLeft(end + 1);
97
+ } else
98
+ throw FormatRuntimeError("%s: %s",
99
+ _("Whitespace expected"), end);
100
+
101
+ return value;
102
+}
103
+
104
+/**
105
+ * Throws on error.
106
+ */
107
+static char *
108
+NextQuotedValue(char *&pp)
109
+{
110
+ char *p = pp;
111
+ if (*p != '"')
112
+ throw FormatRuntimeError("%s: %s",
113
+ _("Quoted value expected"), p);
114
+
115
+ ++p;
116
+
117
+ char *const result = p;
118
+
119
+ char *end = strchr(p, '"');
120
+ if (end == nullptr)
121
+ throw FormatRuntimeError("%s: %s",
122
+ _("Closing quote missing"), p);
123
+
124
+ *end = 0;
125
+ pp = end + 1;
126
+ return result;
127
+}
128
+
129
+/**
130
+ * Throws on error.
131
+ */
132
+static std::pair<char *, char *>
133
+NextNameValue(char *&p)
134
+{
135
+ char *name = p;
136
+
137
+ p = after_unquoted_word(p);
138
+ if (*p != '=')
139
+ throw FormatRuntimeError("%s: %s",
140
+ _("Syntax error"), p);
141
+
142
+ *p++ = 0;
143
+
144
+ char *value = NextUnquotedValue(p);
145
+
146
+ return std::make_pair(name, value);
147
+}
148
+
149
+#endif
150
+
151
/**
152
* Throws on error.
153
*/
154
155
static CurrentTimeDisplay
156
ParseCurrentTimeDisplay(const char *str)
157
{
158
- if (strcmp(str, "elapsed") == 0)
159
+ if (StringIsEqual(str, "elapsed"))
160
return CurrentTimeDisplay::ELAPSED;
161
- else if (strcmp(str, "remaining") == 0)
162
+ else if (StringIsEqual(str, "remaining"))
163
return CurrentTimeDisplay::REMAINING;
164
- else if (strcmp(str, "none") == 0)
165
+ else if (StringIsEqual(str, "none"))
166
return CurrentTimeDisplay::NONE;
167
else
168
throw FormatRuntimeError("%s: %s",
169
170
{
171
// TODO: modify screen_search so that its own list of modes can be used
172
// for comparison instead of specifying them here
173
- if (strcasecmp(value, "title") == 0)
174
+ if (StringIsEqualIgnoreCase(value, "title"))
175
return 0;
176
- else if (strcasecmp(value, "artist") == 0)
177
+ else if (StringIsEqualIgnoreCase(value, "artist"))
178
return 1;
179
- else if (strcasecmp(value, "album") == 0)
180
+ else if (StringIsEqualIgnoreCase(value, "album"))
181
return 2;
182
- else if (strcasecmp(value, "filename") == 0)
183
+ else if (StringIsEqualIgnoreCase(value, "filename"))
184
return 3;
185
- else if (strcasecmp(value, "artist+album") == 0)
186
+ else if (StringIsEqualIgnoreCase(value, "artist+album"))
187
return 4;
188
else
189
throw FormatRuntimeError("%s: %s",
190
191
}
192
}
193
194
+#ifndef NCMPC_MINI
195
+
196
+/**
197
+ * Throws on error.
198
+ */
199
+static TableColumn
200
+ParseTableColumn(char *s)
201
+{
202
+ TableColumn column;
203
+
204
+ column.caption = NextQuotedValue(s);
205
+ s = StripLeft(s);
206
+ column.format = NextQuotedValue(s);
207
+ s = StripLeft(s);
208
+
209
+ while (*s != 0) {
210
+ auto nv = NextNameValue(s);
211
+ s = StripLeft(s);
212
+
213
+ const char *name = nv.first;
214
+ const char *value = nv.second;
215
+
216
+ if (StringIsEqual(name, "min")) {
217
+ char *endptr;
218
+ column.min_width = strtoul(value, &endptr, 10);
219
+ if (endptr == value || *endptr != 0 ||
220
+ column.min_width == 0 || column.min_width > 1000)
221
+ throw FormatRuntimeError("%s: %s",
222
+ _("Invalid column width"),
223
+ value);
224
+ } else if (StringIsEqual(name, "fraction")) {
225
+ char *endptr;
226
+ column.fraction_width = strtod(value, &endptr);
227
+ if (endptr == value || *endptr != 0 ||
228
+ column.fraction_width < 0 ||
229
+ column.fraction_width > 1000)
230
+ throw FormatRuntimeError("%s: %s",
231
+ _("Invalid column fraction width"),
232
+ value);
233
+ }
234
+ }
235
+
236
+ return column;
237
+}
238
+
239
+/**
240
+ * Throws on error.
241
+ */
242
+static void
243
+ParseTableColumn(TableStructure &t, char *s)
244
+{
245
+ t.columns.emplace_back(ParseTableColumn(s));
246
+}
247
+
248
+#endif
249
+
250
/**
251
* Throws on error.
252
*/
253
254
char *const value = line;
255
256
/* key definition */
257
- if (!strcasecmp(CONF_KEY_DEFINITION, name))
258
+ if (StringIsEqualIgnoreCase(CONF_KEY_DEFINITION, name))
259
parse_key_definition(value);
260
/* enable colors */
261
- else if(!strcasecmp(CONF_ENABLE_COLORS, name))
262
+ else if(StringIsEqualIgnoreCase(CONF_ENABLE_COLORS, name))
263
#ifdef ENABLE_COLORS
264
options.enable_colors = str2bool(value);
265
#else
266
{}
267
#endif
268
- else if (!strcasecmp(CONF_SCROLL_OFFSET, name))
269
+ else if (StringIsEqualIgnoreCase(CONF_SCROLL_OFFSET, name))
270
options.scroll_offset = atoi(value);
271
/* auto center */
272
- else if (!strcasecmp(CONF_AUTO_CENTER, name))
273
+ else if (StringIsEqualIgnoreCase(CONF_AUTO_CENTER, name))
274
options.auto_center = str2bool(value);
275
/* color assignment */
276
- else if (!strcasecmp(CONF_COLOR, name))
277
+ else if (StringIsEqualIgnoreCase(CONF_COLOR, name))
278
#ifdef ENABLE_COLORS
279
parse_color(value);
280
#else
281
{}
282
#endif
283
/* wide cursor */
284
- else if (!strcasecmp(CONF_WIDE_CURSOR, name))
285
+ else if (StringIsEqualIgnoreCase(CONF_WIDE_CURSOR, name))
286
options.wide_cursor = str2bool(value);
287
- else if (strcasecmp(name, CONF_HARDWARE_CURSOR) == 0)
288
+ else if (StringIsEqualIgnoreCase(name, CONF_HARDWARE_CURSOR))
289
options.hardware_cursor = str2bool(value);
290
/* welcome screen list */
291
- else if (!strcasecmp(CONF_WELCOME_SCREEN_LIST, name))
292
+ else if (StringIsEqualIgnoreCase(CONF_WELCOME_SCREEN_LIST, name))
293
options.welcome_screen_list = str2bool(value);
294
/* visible bitrate */
295
- else if (!strcasecmp(CONF_VISIBLE_BITRATE, name))
296
+ else if (StringIsEqualIgnoreCase(CONF_VISIBLE_BITRATE, name))
297
options.visible_bitrate = str2bool(value);
298
/* timer display type */
299
- else if (!strcasecmp(CONF_TIMEDISPLAY_TYPE, name))
300
+ else if (StringIsEqualIgnoreCase(CONF_TIMEDISPLAY_TYPE, name))
301
options.current_time_display = ParseCurrentTimeDisplay(value);
302
/* color definition */
303
- else if (!strcasecmp(CONF_COLOR_DEFINITION, name))
304
+ else if (StringIsEqualIgnoreCase(CONF_COLOR_DEFINITION, name))
305
#ifdef ENABLE_COLORS
306
parse_color_definition(value);
307
#else
308
{}
309
#endif
310
/* list format string */
311
- else if (!strcasecmp(CONF_LIST_FORMAT, name)) {
312
+ else if (StringIsEqualIgnoreCase(CONF_LIST_FORMAT, name)) {
313
options.list_format = GetStringValue(value);
314
+ } else if (StringIsEqualIgnoreCase("song-table-column", name)) {
315
+#ifndef NCMPC_MINI
316
+ ParseTableColumn(song_table_structure, value);
317
+#endif
318
+
319
/* search format string */
320
- } else if (!strcasecmp(CONF_SEARCH_FORMAT, name)) {
321
+ } else if (StringIsEqualIgnoreCase(CONF_SEARCH_FORMAT, name)) {
322
options.search_format = GetStringValue(value);
323
/* status format string */
324
- } else if (!strcasecmp(CONF_STATUS_FORMAT, name)) {
325
+ } else if (StringIsEqualIgnoreCase(CONF_STATUS_FORMAT, name)) {
326
options.status_format = GetStringValue(value);
327
/* xterm title format string */
328
- } else if (!strcasecmp(CONF_XTERM_TITLE_FORMAT, name)) {
329
+ } else if (StringIsEqualIgnoreCase(CONF_XTERM_TITLE_FORMAT, name)) {
330
options.xterm_title_format = GetStringValue(value);
331
- } else if (!strcasecmp(CONF_LIST_WRAP, name))
332
+ } else if (StringIsEqualIgnoreCase(CONF_LIST_WRAP, name))
333
options.list_wrap = str2bool(value);
334
- else if (!strcasecmp(CONF_FIND_WRAP, name))
335
+ else if (StringIsEqualIgnoreCase(CONF_FIND_WRAP, name))
336
options.find_wrap = str2bool(value);
337
- else if (!strcasecmp(CONF_FIND_SHOW_LAST,name))
338
+ else if (StringIsEqualIgnoreCase(CONF_FIND_SHOW_LAST,name))
339
options.find_show_last_pattern = str2bool(value);
340
- else if (!strcasecmp(CONF_AUDIBLE_BELL, name))
341
+ else if (StringIsEqualIgnoreCase(CONF_AUDIBLE_BELL, name))
342
options.audible_bell = str2bool(value);
343
- else if (!strcasecmp(CONF_VISIBLE_BELL, name))
344
+ else if (StringIsEqualIgnoreCase(CONF_VISIBLE_BELL, name))
345
options.visible_bell = str2bool(value);
346
- else if (!strcasecmp(CONF_BELL_ON_WRAP, name))
347
+ else if (StringIsEqualIgnoreCase(CONF_BELL_ON_WRAP, name))
348
options.bell_on_wrap = str2bool(value);
349
- else if (!strcasecmp(CONF_STATUS_MESSAGE_TIME, name))
350
+ else if (StringIsEqualIgnoreCase(CONF_STATUS_MESSAGE_TIME, name))
351
options.status_message_time = std::chrono::seconds(atoi(value));
352
- else if (!strcasecmp(CONF_XTERM_TITLE, name))
353
+ else if (StringIsEqualIgnoreCase(CONF_XTERM_TITLE, name))
354
options.enable_xterm_title = str2bool(value);
355
- else if (!strcasecmp(CONF_ENABLE_MOUSE, name))
356
+ else if (StringIsEqualIgnoreCase(CONF_ENABLE_MOUSE, name))
357
#ifdef HAVE_GETMOUSE
358
options.enable_mouse = str2bool(value);
359
#else
360
{}
361
#endif
362
- else if (!strcasecmp(CONF_CROSSFADE_TIME, name))
363
+ else if (StringIsEqualIgnoreCase(CONF_CROSSFADE_TIME, name))
364
options.crossfade_time = atoi(value);
365
- else if (!strcasecmp(CONF_SEARCH_MODE, name))
366
+ else if (StringIsEqualIgnoreCase(CONF_SEARCH_MODE, name))
367
options.search_mode = get_search_mode(value);
368
- else if (!strcasecmp(CONF_HIDE_CURSOR, name))
369
+ else if (StringIsEqualIgnoreCase(CONF_HIDE_CURSOR, name))
370
options.hide_cursor = std::chrono::seconds(atoi(value));
371
- else if (!strcasecmp(CONF_SEEK_TIME, name))
372
+ else if (StringIsEqualIgnoreCase(CONF_SEEK_TIME, name))
373
options.seek_time = atoi(value);
374
- else if (!strcasecmp(CONF_LIBRARY_PAGE_TAGS, name)) {
375
+ else if (StringIsEqualIgnoreCase(CONF_LIBRARY_PAGE_TAGS, name)) {
376
#ifdef ENABLE_LIBRARY_PAGE
377
options.library_page_tags = ParseTagList(value);
378
#endif
379
- } else if (!strcasecmp(CONF_SCREEN_LIST, name)) {
380
+ } else if (StringIsEqualIgnoreCase(CONF_SCREEN_LIST, name)) {
381
options.screen_list = check_screen_list(value);
382
- } else if (!strcasecmp(CONF_HOST, name))
383
+ } else if (StringIsEqualIgnoreCase(CONF_HOST, name))
384
options.host = GetStringValue(value);
385
- else if (!strcasecmp(CONF_PORT, name))
386
+ else if (StringIsEqualIgnoreCase(CONF_PORT, name))
387
options.port = atoi(GetStringValue(value).c_str());
388
- else if (!strcasecmp(CONF_PASSWORD, name))
389
+ else if (StringIsEqualIgnoreCase(CONF_PASSWORD, name))
390
options.password = GetStringValue(value);
391
- else if (!strcasecmp(CONF_TIMEOUT, name))
392
+ else if (StringIsEqualIgnoreCase(CONF_TIMEOUT, name))
393
options.timeout_ms = atoi(GetStringValue(value).c_str())
394
* 1000 /* seconds -> milliseconds */;
395
- else if (!strcasecmp(CONF_LYRICS_TIMEOUT, name))
396
+ else if (StringIsEqualIgnoreCase(CONF_LYRICS_TIMEOUT, name))
397
#ifdef ENABLE_LYRICS_SCREEN
398
options.lyrics_timeout = std::chrono::seconds(atoi(GetStringValue(value).c_str()));
399
#else
400
{}
401
#endif
402
- else if (!strcasecmp(CONF_SCROLL, name))
403
+ else if (StringIsEqualIgnoreCase(CONF_SCROLL, name))
404
options.scroll = str2bool(value);
405
- else if (!strcasecmp(CONF_SCROLL_SEP, name)) {
406
+ else if (StringIsEqualIgnoreCase(CONF_SCROLL_SEP, name)) {
407
options.scroll_sep = GetStringValue(value);
408
- } else if (!strcasecmp(CONF_DISPLAY_TIME, name))
409
+ } else if (StringIsEqualIgnoreCase(CONF_DISPLAY_TIME, name))
410
/* obsolete, ignore */
411
{}
412
- else if (!strcasecmp(CONF_JUMP_PREFIX_ONLY, name))
413
+ else if (StringIsEqualIgnoreCase(CONF_JUMP_PREFIX_ONLY, name))
414
#ifdef NCMPC_MINI
415
{}
416
#else
417
options.jump_prefix_only = str2bool(value);
418
#endif
419
- else if (!strcasecmp(CONF_LYRICS_AUTOSAVE, name))
420
+ else if (StringIsEqualIgnoreCase(CONF_LYRICS_AUTOSAVE, name))
421
#ifdef ENABLE_LYRICS_SCREEN
422
options.lyrics_autosave = str2bool(value);
423
#else
424
{}
425
#endif
426
- else if (!strcasecmp(CONF_LYRICS_SHOW_PLUGIN, name))
427
+ else if (StringIsEqualIgnoreCase(CONF_LYRICS_SHOW_PLUGIN, name))
428
#ifdef ENABLE_LYRICS_SCREEN
429
options.lyrics_show_plugin = str2bool(value);
430
#else
431
{}
432
#endif
433
- else if (!strcasecmp(name, CONF_TEXT_EDITOR))
434
+ else if (StringIsEqualIgnoreCase(name, CONF_TEXT_EDITOR))
435
#ifdef ENABLE_LYRICS_SCREEN
436
{
437
options.text_editor = GetStringValue(value);
438
439
#else
440
{}
441
#endif
442
- else if (!strcasecmp(name, CONF_TEXT_EDITOR_ASK))
443
+ else if (StringIsEqualIgnoreCase(name, CONF_TEXT_EDITOR_ASK))
444
#ifdef ENABLE_LYRICS_SCREEN
445
options.text_editor_ask = str2bool(value);
446
#else
447
{}
448
#endif
449
- else if (!strcasecmp(name, CONF_CHAT_PREFIX))
450
+ else if (StringIsEqualIgnoreCase(name, CONF_CHAT_PREFIX))
451
#ifdef ENABLE_CHAT_SCREEN
452
options.chat_prefix = GetStringValue(value);
453
#else
454
{}
455
#endif
456
- else if (!strcasecmp(CONF_SECOND_COLUMN, name))
457
+ else if (StringIsEqualIgnoreCase(CONF_SECOND_COLUMN, name))
458
#ifdef NCMPC_MINI
459
{}
460
#else
461
ncmpc-0.47.tar.xz/src/ConfigParser.hxx -> ncmpc-0.48.tar.xz/src/ConfigParser.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef CONFIG_PARSER_HXX
23
#define CONFIG_PARSER_HXX
24
ncmpc-0.47.tar.xz/src/CustomColors.cxx -> ncmpc-0.48.tar.xz/src/CustomColors.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "CustomColors.hxx"
23
#include "i18n.h"
24
ncmpc-0.47.tar.xz/src/CustomColors.hxx -> ncmpc-0.48.tar.xz/src/CustomColors.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef CUSTOM_COLORS_HXX
23
#define CUSTOM_COLORS_HXX
24
ncmpc-0.47.tar.xz/src/DelayedSeek.cxx -> ncmpc-0.48.tar.xz/src/DelayedSeek.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "DelayedSeek.hxx"
23
#include "mpdclient.hxx"
24
ncmpc-0.47.tar.xz/src/DelayedSeek.hxx -> ncmpc-0.48.tar.xz/src/DelayedSeek.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_DELAYED_SEEK_HXX
23
#define NCMPC_DELAYED_SEEK_HXX
24
ncmpc-0.47.tar.xz/src/Deleter.hxx -> ncmpc-0.48.tar.xz/src/Deleter.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef DELETER_HXX
23
#define DELETER_HXX
24
ncmpc-0.47.tar.xz/src/EditPlaylistPage.cxx -> ncmpc-0.48.tar.xz/src/EditPlaylistPage.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "EditPlaylistPage.hxx"
23
#include "PageMeta.hxx"
24
ncmpc-0.47.tar.xz/src/EditPlaylistPage.hxx -> ncmpc-0.48.tar.xz/src/EditPlaylistPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_EDIT_PLAYLIST_PAGE_HXX
23
#define NCMPC_EDIT_PLAYLIST_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/FileBrowserPage.cxx -> ncmpc-0.48.tar.xz/src/FileBrowserPage.cxx
Changed
46
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "FileBrowserPage.hxx"
23
#include "PageMeta.hxx"
24
25
}
26
27
if(defaultname)
28
- playlist_save(&c, nullptr, Utf8ToLocale(defaultname).c_str());
29
+ playlist_save(screen, &c, nullptr,
30
+ Utf8ToLocale(defaultname).c_str());
31
else
32
- playlist_save(&c, nullptr, nullptr);
33
+ playlist_save(screen, &c, nullptr, nullptr);
34
}
35
36
void
37
38
snprintf(prompt, sizeof(prompt),
39
_("Delete playlist %s?"),
40
Utf8ToLocale(GetUriFilename(mpd_playlist_get_path(playlist))).c_str());
41
- bool confirmed = screen_get_yesno(prompt, false);
42
+ bool confirmed = screen_get_yesno(screen, prompt, false);
43
if (!confirmed) {
44
/* translators: a dialog was aborted by the user */
45
screen_status_message(_("Aborted"));
46
ncmpc-0.47.tar.xz/src/FileBrowserPage.hxx -> ncmpc-0.48.tar.xz/src/FileBrowserPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_FILE_BROWSER_PAGE_HXX
23
#define NCMPC_FILE_BROWSER_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/FileListPage.cxx -> ncmpc-0.48.tar.xz/src/FileListPage.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "config.h"
23
#include "FileListPage.hxx"
24
ncmpc-0.47.tar.xz/src/FileListPage.hxx -> ncmpc-0.48.tar.xz/src/FileListPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef FILE_LIST_PAGE_HXX
23
#define FILE_LIST_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/GlobalBindings.cxx -> ncmpc-0.48.tar.xz/src/GlobalBindings.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "GlobalBindings.hxx"
23
#include "Bindings.hxx"
24
ncmpc-0.47.tar.xz/src/GlobalBindings.hxx -> ncmpc-0.48.tar.xz/src/GlobalBindings.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef GLOBAL_BINDINGS_HXX
23
#define GLOBAL_BINDINGS_HXX
24
ncmpc-0.47.tar.xz/src/HelpPage.cxx -> ncmpc-0.48.tar.xz/src/HelpPage.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "HelpPage.hxx"
23
#include "PageMeta.hxx"
24
ncmpc-0.47.tar.xz/src/HelpPage.hxx -> ncmpc-0.48.tar.xz/src/HelpPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_HELP_PAGE_HXX
23
#define NCMPC_HELP_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/History.hxx -> ncmpc-0.48.tar.xz/src/History.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef HISTORY_HXX
23
#define HISTORY_HXX
24
ncmpc-0.47.tar.xz/src/Instance.cxx -> ncmpc-0.48.tar.xz/src/Instance.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Instance.hxx"
23
#include "Options.hxx"
24
ncmpc-0.47.tar.xz/src/Instance.hxx -> ncmpc-0.48.tar.xz/src/Instance.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_INSTANCE_HXX
23
#define NCMPC_INSTANCE_HXX
24
ncmpc-0.47.tar.xz/src/KeyDefPage.cxx -> ncmpc-0.48.tar.xz/src/KeyDefPage.cxx
Changed
42
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "KeyDefPage.hxx"
23
#include "PageMeta.hxx"
24
25
snprintf(prompt, sizeof(prompt),
26
_("Enter new key for %s: "),
27
get_key_command_name(Command(subcmd)));
28
- const int key = screen_getch(prompt);
29
+ const int key = screen_getch(screen, prompt);
30
31
if (key == ERR) {
32
screen_status_message(_("Aborted"));
33
34
return false;
35
}
36
37
- /* unreachable */
38
- assert(0);
39
return false;
40
}
41
42
ncmpc-0.47.tar.xz/src/KeyDefPage.hxx -> ncmpc-0.48.tar.xz/src/KeyDefPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_KEY_DEF_PAGE_HXX
23
#define NCMPC_KEY_DEF_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/KeyName.cxx -> ncmpc-0.48.tar.xz/src/KeyName.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "KeyName.hxx"
23
#include "i18n.h"
24
ncmpc-0.47.tar.xz/src/KeyName.hxx -> ncmpc-0.48.tar.xz/src/KeyName.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef KEY_NAME_HXX
23
#define KEY_NAME_HXX
24
ncmpc-0.47.tar.xz/src/LibraryPage.cxx -> ncmpc-0.48.tar.xz/src/LibraryPage.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "LibraryPage.hxx"
23
#include "TagListPage.hxx"
24
ncmpc-0.47.tar.xz/src/LibraryPage.hxx -> ncmpc-0.48.tar.xz/src/LibraryPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_LIBRARY_PAGE_HXX
23
#define NCMPC_LIBRARY_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/ListCursor.cxx -> ncmpc-0.48.tar.xz/src/ListCursor.cxx
Changed
87
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ListCursor.hxx"
23
#include "Options.hxx"
24
25
{
26
highlight_cursor = false;
27
28
- if (n > GetHeight() / 2)
29
- start = n - GetHeight() / 2;
30
+ if (n > (GetHeight() - 1) / 2)
31
+ start = n - (GetHeight() - 1) / 2;
32
else
33
start = 0;
34
35
36
if (n < start + scroll_offset)
37
new_start = n - scroll_offset;
38
39
- if (n >= start + GetHeight() - scroll_offset)
40
+ if (n >= new_start + GetHeight() - scroll_offset)
41
new_start = n - GetHeight() + 1 + scroll_offset;
42
43
if (new_start + GetHeight() > length)
44
45
void
46
ListCursor::FetchCursor() noexcept
47
{
48
+ unsigned int target = selected;
49
+
50
if (start > 0 &&
51
- selected < start + scroll_offset)
52
- MoveCursor(start + scroll_offset);
53
- else if (start + GetHeight() < length &&
54
- selected > start + GetHeight() - 1 - scroll_offset)
55
- MoveCursor(start + GetHeight() - 1 - scroll_offset);
56
+ target < start + scroll_offset)
57
+ target = start + scroll_offset;
58
+
59
+ if (start + GetHeight() < length &&
60
+ target > start + GetHeight() - 1 - scroll_offset)
61
+ target = start + GetHeight() - 1 - scroll_offset;
62
+
63
+ MoveCursor(target);
64
}
65
66
ListWindowRange
67
68
{
69
if (start == 0)
70
MoveCursor(start);
71
- else
72
+ else if (start + scroll_offset < start + GetHeight() - 1 - scroll_offset)
73
MoveCursor(start + scroll_offset);
74
+ else
75
+ MoveCursor(start + GetHeight() - 1 - scroll_offset);
76
}
77
78
void
79
ListCursor::MoveCursorMiddle() noexcept
80
{
81
if (length >= GetHeight())
82
- MoveCursor(start + GetHeight() / 2);
83
+ MoveCursor(start + (GetHeight() - 1) / 2);
84
else
85
MoveCursor(length / 2);
86
}
87
ncmpc-0.47.tar.xz/src/ListCursor.hxx -> ncmpc-0.48.tar.xz/src/ListCursor.hxx
Changed
35
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef LIST_CURSOR_HXX
23
#define LIST_CURSOR_HXX
24
25
static constexpr unsigned ClampScrollOffset(unsigned scroll_offset,
26
unsigned height) noexcept
27
{
28
- return scroll_offset * 2 < height
29
- ? scroll_offset
30
- : std::max(height / 2, 1U) - 1;
31
+ return std::min(scroll_offset, height / 2);
32
}
33
34
gnu::pure
35
ncmpc-0.47.tar.xz/src/ListPage.hxx -> ncmpc-0.48.tar.xz/src/ListPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_LIST_PAGE_HXX
23
#define NCMPC_LIST_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/ListRenderer.hxx -> ncmpc-0.48.tar.xz/src/ListRenderer.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef LIST_RENDERER_HXX
23
#define LIST_RENDERER_HXX
24
ncmpc-0.47.tar.xz/src/ListText.hxx -> ncmpc-0.48.tar.xz/src/ListText.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef LIST_TEXT_HXX
23
#define LIST_TEXT_HXX
24
ncmpc-0.47.tar.xz/src/ListWindow.cxx -> ncmpc-0.48.tar.xz/src/ListWindow.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ListWindow.hxx"
23
#include "ListRenderer.hxx"
24
ncmpc-0.47.tar.xz/src/ListWindow.hxx -> ncmpc-0.48.tar.xz/src/ListWindow.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef LIST_WINDOW_HXX
23
#define LIST_WINDOW_HXX
24
ncmpc-0.47.tar.xz/src/LyricsCache.cxx -> ncmpc-0.48.tar.xz/src/LyricsCache.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "LyricsCache.hxx"
23
#include "XdgBaseDirectory.hxx"
24
ncmpc-0.47.tar.xz/src/LyricsCache.hxx -> ncmpc-0.48.tar.xz/src/LyricsCache.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef LYRICS_CACHE_HXX
23
#define LYRICS_CACHE_HXX
24
ncmpc-0.47.tar.xz/src/LyricsLoader.cxx -> ncmpc-0.48.tar.xz/src/LyricsLoader.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "LyricsLoader.hxx"
23
#include "config.h"
24
ncmpc-0.47.tar.xz/src/LyricsLoader.hxx -> ncmpc-0.48.tar.xz/src/LyricsLoader.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef LYRICS_LOADER_HXX
23
#define LYRICS_LOADER_HXX
24
ncmpc-0.47.tar.xz/src/LyricsPage.cxx -> ncmpc-0.48.tar.xz/src/LyricsPage.cxx
Changed
52
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "LyricsPage.hxx"
23
#include "LyricsCache.hxx"
24
25
#include "TextPage.hxx"
26
#include "screen_utils.hxx"
27
#include "ncu.hxx"
28
+#include "util/StringAPI.hxx"
29
30
#include <string>
31
32
33
LyricsPage::MaybeLoad(const struct mpd_song &new_song) noexcept
34
{
35
if (song == nullptr ||
36
- strcmp(mpd_song_get_uri(&new_song),
37
- mpd_song_get_uri(song)) != 0)
38
+ !StringIsEqual(mpd_song_get_uri(&new_song),
39
+ mpd_song_get_uri(song)))
40
Load(new_song);
41
}
42
43
44
if (options.text_editor_ask) {
45
const char *prompt =
46
_("Do you really want to start an editor and edit these lyrics?");
47
- bool really = screen_get_yesno(prompt, false);
48
+ bool really = screen_get_yesno(screen, prompt, false);
49
if (!really) {
50
screen_status_message(_("Aborted"));
51
return;
52
ncmpc-0.47.tar.xz/src/LyricsPage.hxx -> ncmpc-0.48.tar.xz/src/LyricsPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_LYRICS_PAGE_HXX
23
#define NCMPC_LYRICS_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/Main.cxx -> ncmpc-0.48.tar.xz/src/Main.cxx
Changed
199
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "config.h"
23
#include "Instance.hxx"
24
25
#include <locale.h>
26
#endif
27
28
-#define BUFSIZE 1024
29
-
30
static Instance *global_instance;
31
-static struct mpdclient *mpd = nullptr;
32
33
ScreenManager *screen;
34
35
#ifndef NCMPC_MINI
36
static void
37
-update_xterm_title() noexcept
38
+update_xterm_title(struct mpdclient &client) noexcept
39
{
40
- const struct mpd_song *song = mpd->GetPlayingSong();
41
+ const struct mpd_song *song = client.GetPlayingSong();
42
+
43
+ static constexpr std::size_t BUFSIZE = 1024;
44
45
char tmpBUFSIZE;
46
const char *new_title = nullptr;
47
48
#endif
49
50
static bool
51
-should_enable_update_timer() noexcept
52
+should_enable_update_timer(struct mpdclient &client) noexcept
53
{
54
- return mpd->playing;
55
+ return client.playing;
56
}
57
58
static void
59
-auto_update_timer() noexcept
60
+auto_update_timer(Instance &instance) noexcept
61
{
62
- if (should_enable_update_timer())
63
- global_instance->EnableUpdateTimer();
64
+ if (should_enable_update_timer(instance.GetClient()))
65
+ instance.EnableUpdateTimer();
66
else
67
- global_instance->DisableUpdateTimer();
68
+ instance.DisableUpdateTimer();
69
}
70
71
void
72
73
74
#ifndef NCMPC_MINI
75
if (options.enable_xterm_title)
76
- update_xterm_title();
77
+ update_xterm_title(client);
78
#endif
79
80
screen_manager.Update(client, seek);
81
82
{
83
#ifndef NCMPC_MINI
84
/* quit if mpd is pre 0.14 - song id not supported by mpd */
85
- auto *connection = mpd->GetConnection();
86
+ auto &client = global_instance->GetClient();
87
+ auto *connection = client.GetConnection();
88
if (mpd_connection_cmp_server_version(connection, 0, 21, 0) < 0) {
89
const unsigned *version =
90
mpd_connection_get_server_version(connection);
91
screen_status_printf(_("Error: MPD version %d.%d.%d is too old (%s needed)"),
92
version0, version1, version2,
93
"0.21.0");
94
- mpd->Disconnect();
95
+ client.Disconnect();
96
doupdate();
97
98
/* try again after 30 seconds */
99
100
101
global_instance->UpdateClient();
102
103
- auto_update_timer();
104
+ auto_update_timer(*global_instance);
105
}
106
107
void
108
109
void
110
mpdclient_lost_callback() noexcept
111
{
112
- screen->Update(*mpd, global_instance->GetSeek());
113
+ screen->Update(global_instance->GetClient(),
114
+ global_instance->GetSeek());
115
116
global_instance->ScheduleReconnect(std::chrono::seconds(1));
117
}
118
119
void
120
mpdclient_idle_callback(maybe_unused unsigned events) noexcept
121
{
122
+ auto &client = global_instance->GetClient();
123
+
124
#ifndef NCMPC_MINI
125
if (options.enable_xterm_title)
126
- update_xterm_title();
127
+ update_xterm_title(client);
128
#endif
129
130
- screen->Update(*mpd, global_instance->GetSeek());
131
- auto_update_timer();
132
+ screen->Update(client, global_instance->GetSeek());
133
+ auto_update_timer(*global_instance);
134
}
135
136
void
137
138
139
UpdateClient();
140
141
- if (should_enable_update_timer())
142
+ if (should_enable_update_timer(client))
143
ScheduleUpdateTimer();
144
}
145
146
147
148
void end_input_event() noexcept
149
{
150
- screen->Update(*mpd, global_instance->GetSeek());
151
- mpd->events = (enum mpd_idle)0;
152
+ auto &client = global_instance->GetClient();
153
+
154
+ screen->Update(client, global_instance->GetSeek());
155
+ client.events = (enum mpd_idle)0;
156
157
- auto_update_timer();
158
+ auto_update_timer(*global_instance);
159
}
160
161
bool
162
163
}
164
165
try {
166
- screen->OnCommand(*mpd, global_instance->GetSeek(), cmd);
167
+ screen->OnCommand(global_instance->GetClient(),
168
+ global_instance->GetSeek(), cmd);
169
} catch (...) {
170
screen_status_error(std::current_exception());
171
return true;
172
173
do_mouse_event(Point p, mmask_t bstate) noexcept
174
{
175
try {
176
- screen->OnMouse(*mpd, global_instance->GetSeek(), p, bstate);
177
+ screen->OnMouse(global_instance->GetClient(),
178
+ global_instance->GetSeek(), p, bstate);
179
} catch (...) {
180
screen_status_error(std::current_exception());
181
}
182
183
/* create the global Instance */
184
Instance instance;
185
global_instance = &instance;
186
- mpd = &instance.GetClient();
187
screen = &instance.GetScreenManager();
188
189
AtScopeExit() {
190
191
/* attempt to connect */
192
instance.ScheduleReconnect(std::chrono::seconds(0));
193
194
- auto_update_timer();
195
+ auto_update_timer(instance);
196
197
#ifndef NCMPC_MINI
198
instance.ScheduleCheckKeyBindings();
199
ncmpc-0.47.tar.xz/src/Match.cxx -> ncmpc-0.48.tar.xz/src/Match.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Match.hxx"
23
#include "util/ScopeExit.hxx"
24
ncmpc-0.47.tar.xz/src/Match.hxx -> ncmpc-0.48.tar.xz/src/Match.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef MATCH_H
23
#define MATCH_H
24
ncmpc-0.47.tar.xz/src/Options.cxx -> ncmpc-0.48.tar.xz/src/Options.cxx
Changed
64
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Options.hxx"
23
#include "Bindings.hxx"
24
25
#include "charset.hxx"
26
#include "ConfigFile.hxx"
27
#include "i18n.h"
28
+#include "util/StringAPI.hxx"
29
30
#include <stdlib.h>
31
#include <stdio.h>
32
-#include <string.h>
33
34
#define ERROR_UNKNOWN_OPTION 0x01
35
#define ERROR_BAD_ARGUMENT 0x02
36
37
FindOption(const char *l) noexcept
38
{
39
for (const auto &i : option_table)
40
- if (strcmp(l, i.longopt) == 0)
41
+ if (StringIsEqual(l, i.longopt))
42
return &i;
43
44
return nullptr;
45
46
#ifndef NCMPC_MINI
47
printf("configuration files:\n"
48
" %s\n"
49
-#ifndef _WIN32
50
- " %s\n"
51
-#endif
52
" %s\n\n",
53
GetUserConfigPath().c_str(),
54
-#ifndef _WIN32
55
- GetHomeConfigPath().c_str(),
56
-#endif
57
GetSystemConfigPath().c_str());
58
59
- if (strcmp("translator-credits", _("translator-credits")) != 0)
60
+ if (!StringIsEqual("translator-credits", _("translator-credits")))
61
/* To translators: these credits are shown
62
when ncmpc is started with "--version" */
63
printf("\n%s\n", _("translator-credits"));
64
ncmpc-0.47.tar.xz/src/Options.hxx -> ncmpc-0.48.tar.xz/src/Options.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef OPTIONS_HXX
23
#define OPTIONS_HXX
24
ncmpc-0.47.tar.xz/src/OutputsPage.cxx -> ncmpc-0.48.tar.xz/src/OutputsPage.cxx
Changed
65
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "OutputsPage.hxx"
23
#include "Deleter.hxx"
24
25
}
26
};
27
28
+ ScreenManager &screen;
29
+
30
std::vector<Item> items;
31
32
#if LIBMPDCLIENT_CHECK_VERSION(2,18,0)
33
34
#endif
35
36
public:
37
- OutputsPage(WINDOW *w, Size size)
38
- :ListPage(w, size) {}
39
+ OutputsPage(ScreenManager &_screen, WINDOW *w, Size size)
40
+ :ListPage(w, size), screen(_screen) {}
41
42
private:
43
void Clear();
44
45
if (connection == nullptr)
46
return false;
47
48
- auto name = screen_readln(_("Name"), nullptr, nullptr, nullptr);
49
+ auto name = screen_readln(screen, _("Name"), nullptr, nullptr, nullptr);
50
if (name.empty())
51
return false;
52
53
54
}
55
56
static std::unique_ptr<Page>
57
-outputs_init(ScreenManager &, WINDOW *w, Size size)
58
+outputs_init(ScreenManager &screen, WINDOW *w, Size size)
59
{
60
- return std::make_unique<OutputsPage>(w, size);
61
+ return std::make_unique<OutputsPage>(screen, w, size);
62
}
63
64
const char *
65
ncmpc-0.47.tar.xz/src/OutputsPage.hxx -> ncmpc-0.48.tar.xz/src/OutputsPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_OUTPUTS_PAGE_HXX
23
#define NCMPC_OUTPUTS_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/Page.hxx -> ncmpc-0.48.tar.xz/src/Page.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_PAGE_HXX
23
#define NCMPC_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/PageMeta.hxx -> ncmpc-0.48.tar.xz/src/PageMeta.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_PAGE_META_HXX
23
#define NCMPC_PAGE_META_HXX
24
ncmpc-0.47.tar.xz/src/Point.hxx -> ncmpc-0.48.tar.xz/src/Point.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_POINT_HXX
23
#define NCMPC_POINT_HXX
24
ncmpc-0.47.tar.xz/src/ProgressBar.cxx -> ncmpc-0.48.tar.xz/src/ProgressBar.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ProgressBar.hxx"
23
#include "Styles.hxx"
24
ncmpc-0.47.tar.xz/src/ProgressBar.hxx -> ncmpc-0.48.tar.xz/src/ProgressBar.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_PROGRESS_BAR_HXX
23
#define NCMPC_PROGRESS_BAR_HXX
24
ncmpc-0.47.tar.xz/src/ProxyPage.cxx -> ncmpc-0.48.tar.xz/src/ProxyPage.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ProxyPage.hxx"
23
24
ncmpc-0.47.tar.xz/src/ProxyPage.hxx -> ncmpc-0.48.tar.xz/src/ProxyPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_PROXY_PAGE_HXX
23
#define NCMPC_PROXY_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/Queue.cxx -> ncmpc-0.48.tar.xz/src/Queue.cxx
Changed
41
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Queue.hxx"
23
+#include "util/StringAPI.hxx"
24
25
#include <algorithm>
26
27
-#include <string.h>
28
-
29
void
30
MpdQueue::clear() noexcept
31
{
32
33
{
34
for (size_type i = 0; i < size(); ++i) {
35
const auto &song = (*this)i;
36
- if (strcmp(mpd_song_get_uri(&song), filename) == 0)
37
+ if (StringIsEqual(mpd_song_get_uri(&song), filename))
38
return i;
39
}
40
41
ncmpc-0.47.tar.xz/src/Queue.hxx -> ncmpc-0.48.tar.xz/src/Queue.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef QUEUE_HXX
23
#define QUEUE_HXX
24
ncmpc-0.47.tar.xz/src/QueuePage.cxx -> ncmpc-0.48.tar.xz/src/QueuePage.cxx
Changed
152
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "QueuePage.hxx"
23
#include "PageMeta.hxx"
24
25
26
#ifndef NCMPC_MINI
27
#include "hscroll.hxx"
28
+#include "TableGlue.hxx"
29
+#include "TableStructure.hxx"
30
+#include "TableLayout.hxx"
31
+#include "TablePaint.hxx"
32
#endif
33
34
#include <mpd/client.h>
35
36
37
#ifndef NCMPC_MINI
38
mutable class hscroll hscroll;
39
+
40
+ TableLayout table_layout;
41
#endif
42
43
CoarseTimerEvent hide_cursor_timer;
44
45
#ifndef NCMPC_MINI
46
hscroll(screen.GetEventLoop(),
47
w, options.scroll_sep.c_str()),
48
+ table_layout(song_table_structure),
49
#endif
50
hide_cursor_timer(screen.GetEventLoop(),
51
BIND_THIS_METHOD(OnHideCursorTimer))
52
{
53
+#ifndef NCMPC_MINI
54
+ table_layout.Calculate(size.width);
55
+#endif
56
}
57
58
private:
59
60
/* virtual methods from class Page */
61
void OnOpen(struct mpdclient &c) noexcept override;
62
void OnClose() noexcept override;
63
+
64
+ void OnResize(Size size) noexcept override {
65
+ ListPage::OnResize(size);
66
+#ifndef NCMPC_MINI
67
+ table_layout.Calculate(size.width);
68
+#endif
69
+ }
70
+
71
void Paint() const noexcept override;
72
bool PaintStatusBarOverride(const Window &window) const noexcept override;
73
void Update(struct mpdclient &c, unsigned events) noexcept override;
74
75
}
76
77
class DatabaseCompletion final : public Completion {
78
+ ScreenManager &screen;
79
struct mpdclient &c;
80
std::set<std::string> dir_list;
81
82
public:
83
- explicit DatabaseCompletion(struct mpdclient &_c) noexcept
84
- :c(_c) {}
85
+ DatabaseCompletion(ScreenManager &_screen,
86
+ struct mpdclient &_c) noexcept
87
+ :screen(_screen), c(_c) {}
88
89
protected:
90
/* virtual methods from class Completion */
91
92
{
93
if (range.begin() != range.end() &&
94
std::next(range.begin()) != range.end())
95
- screen_display_completion_list(range);
96
+ screen_display_completion_list(screen, range);
97
98
if (line && line0 && linestrlen(line) - 1 == '/') {
99
/* add directory content to list */
100
101
#endif
102
103
static int
104
-handle_add_to_playlist(struct mpdclient *c)
105
+handle_add_to_playlist(ScreenManager &screen, struct mpdclient *c)
106
{
107
#ifndef NCMPC_MINI
108
/* initialize completion support */
109
- DatabaseCompletion _completion(*c);
110
+ DatabaseCompletion _completion{screen, *c};
111
Completion *completion = &_completion;
112
#else
113
Completion *completion = nullptr;
114
#endif
115
116
/* get path */
117
- auto path = screen_readln(_("Add"),
118
+ auto path = screen_readln(screen, _("Add"),
119
nullptr,
120
nullptr,
121
completion);
122
123
assert(i < playlist->size());
124
const auto &song = (*playlist)i;
125
126
+#ifndef NCMPC_MINI
127
+ if (!song_table_structure.columns.empty()) {
128
+ PaintTableRow(w, width, selected,
129
+ (int)mpd_song_get_id(&song) == current_song_id,
130
+ song, table_layout);
131
+ return;
132
+ }
133
+#endif
134
+
135
class hscroll *row_hscroll = nullptr;
136
#ifndef NCMPC_MINI
137
row_hscroll = selected && options.scroll && lw.GetCursorIndex() == i
138
139
}
140
141
case Command::SAVE_PLAYLIST:
142
- playlist_save(&c, nullptr, nullptr);
143
+ playlist_save(screen, &c, nullptr, nullptr);
144
return true;
145
146
case Command::ADD:
147
- handle_add_to_playlist(&c);
148
+ handle_add_to_playlist(screen, &c);
149
return true;
150
151
case Command::SHUFFLE: {
152
ncmpc-0.47.tar.xz/src/QueuePage.hxx -> ncmpc-0.48.tar.xz/src/QueuePage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_QUEUE_PAGE_HXX
23
#define NCMPC_QUEUE_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/SearchPage.cxx -> ncmpc-0.48.tar.xz/src/SearchPage.cxx
Changed
82
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "SearchPage.hxx"
23
#include "PageMeta.hxx"
24
25
#include "screen_utils.hxx"
26
#include "FileListPage.hxx"
27
#include "filelist.hxx"
28
+#include "util/StringAPI.hxx"
29
30
#include <iterator>
31
32
33
static int
34
search_get_tag_id(const char *name)
35
{
36
- if (strcasecmp(name, "file") == 0 ||
37
- strcasecmp(name, _("file")) == 0)
38
+ if (StringIsEqualIgnoreCase(name, "file") ||
39
+ StringIsEqualIgnoreCase(name, _("file")))
40
return SEARCH_URI;
41
42
- if (strcasecmp(name, "modified") == 0)
43
+ if (StringIsEqualIgnoreCase(name, "modified"))
44
return SEARCH_MODIFIED;
45
46
for (unsigned i = 0; search_tagi.name != nullptr; ++i)
47
- if (strcasecmp(search_tagi.name, name) == 0 ||
48
- strcasecmp(search_tagi.localname, name) == 0)
49
+ if (StringIsEqualIgnoreCase(search_tagi.name, name) ||
50
+ StringIsEqualIgnoreCase(search_tagi.localname, name))
51
return search_tagi.tag_type;
52
53
return -1;
54
}
55
56
struct SearchMode {
57
- enum mpd_tag_type table;
58
+ int table;
59
const char *label;
60
};
61
62
63
{ MPD_TAG_TITLE, N_("Title") },
64
{ MPD_TAG_ARTIST, N_("Artist") },
65
{ MPD_TAG_ALBUM, N_("Album") },
66
- { (enum mpd_tag_type)SEARCH_URI, N_("Filename") },
67
- { (enum mpd_tag_type)SEARCH_ARTIST_TITLE, N_("Artist + Title") },
68
+ { SEARCH_URI, N_("Filename") },
69
+ { SEARCH_ARTIST_TITLE, N_("Artist + Title") },
70
{ MPD_TAG_COUNT, nullptr }
71
};
72
73
74
75
Clear(true);
76
77
- pattern = screen_readln(_("Search"),
78
+ pattern = screen_readln(screen, _("Search"),
79
nullptr,
80
&search_history,
81
nullptr);
82
ncmpc-0.47.tar.xz/src/SearchPage.hxx -> ncmpc-0.48.tar.xz/src/SearchPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_SEARCH_PAGE_HXX
23
#define NCMPC_SEARCH_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/Size.hxx -> ncmpc-0.48.tar.xz/src/Size.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_SIZE_HXX
23
#define NCMPC_SIZE_HXX
24
ncmpc-0.47.tar.xz/src/SongPage.cxx -> ncmpc-0.48.tar.xz/src/SongPage.cxx
Changed
51
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "SongPage.hxx"
23
#include "PageMeta.hxx"
24
25
#include "time_format.hxx"
26
#include "mpdclient.hxx"
27
#include "util/LocaleString.hxx"
28
+#include "util/StringAPI.hxx"
29
#include "util/StringStrip.hxx"
30
31
#include <mpd/client.h>
32
33
#include <string>
34
35
#include <assert.h>
36
-#include <string.h>
37
#include <time.h>
38
39
enum {
40
41
42
if (selected_song != nullptr &&
43
(playing_song == nullptr ||
44
- strcmp(mpd_song_get_uri(selected_song),
45
- mpd_song_get_uri(playing_song)) != 0)) {
46
+ !StringIsEqual(mpd_song_get_uri(selected_song),
47
+ mpd_song_get_uri(playing_song)))) {
48
lines.emplace_back(_("Selected song"));
49
AddSong(selected_song);
50
lines.emplace_back(std::string());
51
ncmpc-0.47.tar.xz/src/SongPage.hxx -> ncmpc-0.48.tar.xz/src/SongPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_SONG_PAGE_HXX
23
#define NCMPC_SONG_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/SongPtr.hxx -> ncmpc-0.48.tar.xz/src/SongPtr.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef SONG_PTR_HXX
23
#define SONG_PTR_HXX
24
ncmpc-0.47.tar.xz/src/SongRowPaint.cxx -> ncmpc-0.48.tar.xz/src/SongRowPaint.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "SongRowPaint.hxx"
23
#include "paint.hxx"
24
ncmpc-0.47.tar.xz/src/SongRowPaint.hxx -> ncmpc-0.48.tar.xz/src/SongRowPaint.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_SONG_ROW_PAINT_HXX
23
#define NCMPC_SONG_ROW_PAINT_HXX
24
ncmpc-0.47.tar.xz/src/StatusBar.cxx -> ncmpc-0.48.tar.xz/src/StatusBar.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "StatusBar.hxx"
23
#include "Options.hxx"
24
ncmpc-0.47.tar.xz/src/StatusBar.hxx -> ncmpc-0.48.tar.xz/src/StatusBar.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_STATUS_BAR_HXX
23
#define NCMPC_STATUS_BAR_HXX
24
ncmpc-0.47.tar.xz/src/Styles.cxx -> ncmpc-0.48.tar.xz/src/Styles.cxx
Changed
94
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "Styles.hxx"
23
#include "BasicColors.hxx"
24
#include "CustomColors.hxx"
25
#include "i18n.h"
26
#include "util/RuntimeError.hxx"
27
+#include "util/StringAPI.hxx"
28
#include "util/StringStrip.hxx"
29
30
#ifdef ENABLE_COLORS
31
32
33
#include <assert.h>
34
#include <stdio.h>
35
-#include <strings.h>
36
-#include <string.h>
37
38
/**
39
* Use the terminal's default color.
40
41
StyleByName(const char *name) noexcept
42
{
43
for (size_t i = 1; i < size_t(Style::END); ++i)
44
- if (!strcasecmp(stylesi.name, name))
45
+ if (StringIsEqualIgnoreCase(stylesi.name, name))
46
return Style(i);
47
48
return Style::END;
49
50
if (color >= 0)
51
return color;
52
53
- if (!strcasecmp(s, "none"))
54
+ if (StringIsEqualIgnoreCase(s, "none"))
55
return COLOR_NONE;
56
57
throw FormatRuntimeError("%s: %s", _("Unknown color"), s);
58
59
continue;
60
}
61
62
- if (!strcasecmp(cur, "none"))
63
+ if (StringIsEqualIgnoreCase(cur, "none"))
64
d.fg_color = COLOR_NONE;
65
- else if (!strcasecmp(cur, "grey") ||
66
- !strcasecmp(cur, "gray")) {
67
+ else if (StringIsEqualIgnoreCase(cur, "grey") ||
68
+ StringIsEqualIgnoreCase(cur, "gray")) {
69
d.fg_color = COLOR_BLACK;
70
d.attr |= A_BOLD;
71
}
72
73
/* Attributes */
74
- else if (!strcasecmp(cur, "standout"))
75
+ else if (StringIsEqualIgnoreCase(cur, "standout"))
76
d.attr |= A_STANDOUT;
77
- else if (!strcasecmp(cur, "underline"))
78
+ else if (StringIsEqualIgnoreCase(cur, "underline"))
79
d.attr |= A_UNDERLINE;
80
- else if (!strcasecmp(cur, "reverse"))
81
+ else if (StringIsEqualIgnoreCase(cur, "reverse"))
82
d.attr |= A_REVERSE;
83
- else if (!strcasecmp(cur, "blink"))
84
+ else if (StringIsEqualIgnoreCase(cur, "blink"))
85
d.attr |= A_BLINK;
86
- else if (!strcasecmp(cur, "dim"))
87
+ else if (StringIsEqualIgnoreCase(cur, "dim"))
88
d.attr |= A_DIM;
89
- else if (!strcasecmp(cur, "bold"))
90
+ else if (StringIsEqualIgnoreCase(cur, "bold"))
91
d.attr |= A_BOLD;
92
else
93
throw FormatRuntimeError("%s: %s",
94
ncmpc-0.47.tar.xz/src/Styles.hxx -> ncmpc-0.48.tar.xz/src/Styles.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef STYLES_HXX
23
#define STYLES_HXX
24
ncmpc-0.47.tar.xz/src/TabBar.cxx -> ncmpc-0.48.tar.xz/src/TabBar.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "TabBar.hxx"
23
#include "PageMeta.hxx"
24
ncmpc-0.47.tar.xz/src/TabBar.hxx -> ncmpc-0.48.tar.xz/src/TabBar.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_TAB_BAR_HXX
23
#define NCMPC_TAB_BAR_HXX
24
ncmpc-0.48.tar.xz/src/TableColumn.hxx
Added
16
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#pragma once
6
+
7
+#include <string>
8
+
9
+struct TableColumn {
10
+ std::string caption, format;
11
+
12
+ unsigned min_width = 10;
13
+
14
+ float fraction_width = 1;
15
+};
16
ncmpc-0.48.tar.xz/src/TableGlue.cxx
Added
9
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#include "TableGlue.hxx"
6
+#include "TableStructure.hxx"
7
+
8
+TableStructure song_table_structure;
9
ncmpc-0.48.tar.xz/src/TableGlue.hxx
Added
10
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#pragma once
6
+
7
+struct TableStructure;
8
+
9
+extern TableStructure song_table_structure;
10
ncmpc-0.48.tar.xz/src/TableLayout.cxx
Added
71
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#include "TableLayout.hxx"
6
+#include "TableStructure.hxx"
7
+
8
+#include <math.h>
9
+
10
+void
11
+TableLayout::Calculate(unsigned screen_width) noexcept
12
+{
13
+ if (structure.columns.empty())
14
+ /* shouldn't happen */
15
+ return;
16
+
17
+ std::fill(columns.begin(), columns.end(), TableColumnLayout{});
18
+
19
+ if (screen_width <= structure.columns.front().min_width) {
20
+ /* very narrow window, there's only space for one
21
+ column */
22
+ columns.front().width = screen_width;
23
+ return;
24
+ }
25
+
26
+ /* check how many columns fit on the screen */
27
+
28
+ unsigned remaining_width = screen_width - structure.columns.front().min_width - 1;
29
+ size_t n_visible = 1;
30
+ float fraction_sum = structure.columns.front().fraction_width;
31
+
32
+ for (size_t i = 1; i < structure.columns.size(); ++i) {
33
+ auto &c = structure.columnsi;
34
+
35
+ if (remaining_width < c.min_width)
36
+ /* this column doesn't fit, stop here */
37
+ break;
38
+
39
+ ++n_visible;
40
+ fraction_sum += c.fraction_width;
41
+ remaining_width -= c.min_width;
42
+
43
+ if (remaining_width == 0)
44
+ /* no room for the vertical line */
45
+ break;
46
+
47
+ /* subtract the vertical line */
48
+ --remaining_width;
49
+ }
50
+
51
+ /* distribute the remaining width */
52
+
53
+ for (size_t i = n_visible; i > 0;) {
54
+ auto &c = structure.columns--i;
55
+
56
+ unsigned width = c.min_width;
57
+ if (fraction_sum > 0 && c.fraction_width > 0) {
58
+ unsigned add = lrint(remaining_width * c.fraction_width
59
+ / fraction_sum);
60
+ if (add > remaining_width)
61
+ add = remaining_width;
62
+
63
+ width += add;
64
+ remaining_width -= add;
65
+ fraction_sum -= c.fraction_width;
66
+ }
67
+
68
+ columnsi.width = width;
69
+ }
70
+}
71
ncmpc-0.48.tar.xz/src/TableLayout.hxx
Added
25
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#pragma once
6
+
7
+#include <array>
8
+
9
+struct TableStructure;
10
+
11
+struct TableColumnLayout {
12
+ unsigned width;
13
+};
14
+
15
+struct TableLayout {
16
+ const TableStructure &structure;
17
+
18
+ std::array<TableColumnLayout, 64> columns;
19
+
20
+ explicit TableLayout(const TableStructure &_structure) noexcept
21
+ :structure(_structure) {}
22
+
23
+ void Calculate(unsigned screen_width) noexcept;
24
+};
25
ncmpc-0.48.tar.xz/src/TablePaint.cxx
Added
54
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#include "TablePaint.hxx"
6
+#include "TableLayout.hxx"
7
+#include "TableStructure.hxx"
8
+#include "strfsong.hxx"
9
+#include "paint.hxx"
10
+#include "util/LocaleString.hxx"
11
+
12
+static void
13
+FillSpace(WINDOW *w, unsigned n) noexcept
14
+{
15
+ // TODO: use whline(), which unfortunately doesn't move the cursor
16
+ while (n-- > 0)
17
+ waddch(w, ' ');
18
+}
19
+
20
+void
21
+PaintTableRow(WINDOW *w, unsigned width,
22
+ bool selected, bool highlight, const struct mpd_song &song,
23
+ const TableLayout &layout) noexcept
24
+{
25
+ const auto color = highlight ? Style::LIST_BOLD : Style::LIST;
26
+ row_color(w, color, selected);
27
+
28
+ const size_t n_columns = layout.structure.columns.size();
29
+ for (size_t i = 0; i < n_columns; ++i) {
30
+ const auto &cl = layout.columnsi;
31
+ const auto &cs = layout.structure.columnsi;
32
+ if (cl.width == 0)
33
+ break;
34
+
35
+ if (i > 0) {
36
+ SelectStyle(w, Style::LINE);
37
+ waddch(w, ACS_VLINE);
38
+ row_color(w, color, selected);
39
+ }
40
+
41
+ char buffer1024;
42
+ size_t length = strfsong(buffer, sizeof(buffer),
43
+ cs.format.c_str(), &song);
44
+
45
+ const char *end = AtWidthMB(buffer, length, cl.width);
46
+ length = end - buffer;
47
+
48
+ waddnstr(w, buffer, length);
49
+ FillSpace(w, cl.width - StringWidthMB(buffer, length));
50
+ }
51
+
52
+ row_clear_to_eol(w, width, selected);
53
+}
54
ncmpc-0.48.tar.xz/src/TablePaint.hxx
Added
16
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#pragma once
6
+
7
+#include <curses.h>
8
+
9
+struct TableLayout;
10
+struct mpd_song;
11
+
12
+void
13
+PaintTableRow(WINDOW *w, unsigned width,
14
+ bool selected, bool highlight, const struct mpd_song &song,
15
+ const TableLayout &layout) noexcept;
16
ncmpc-0.48.tar.xz/src/TableStructure.cxx
Added
71
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#include "TableLayout.hxx"
6
+
7
+#include <math.h>
8
+
9
+void
10
+TableLayout::Calculate(unsigned screen_width) noexcept
11
+{
12
+ if (columns.empty())
13
+ /* shouldn't happen */
14
+ return;
15
+
16
+ for (auto &i : columns)
17
+ i.width = 0;
18
+
19
+ if (screen_width <= columns.front().min_width) {
20
+ /* very narrow window, there's only space for one
21
+ column */
22
+ columns.front().width = screen_width;
23
+ return;
24
+ }
25
+
26
+ /* check how many columns fit on the screen */
27
+
28
+ unsigned remaining_width = screen_width - columns.front().min_width - 1;
29
+ size_t n_visible = 1;
30
+ float fraction_sum = columns.front().fraction_width;
31
+
32
+ for (size_t i = 1; i < columns.size(); ++i) {
33
+ auto &c = columnsi;
34
+
35
+ if (remaining_width < c.min_width)
36
+ /* this column doesn't fit, stop here */
37
+ break;
38
+
39
+ ++n_visible;
40
+ fraction_sum += c.fraction_width;
41
+ remaining_width -= c.min_width;
42
+
43
+ if (remaining_width == 0)
44
+ /* no room for the vertical line */
45
+ break;
46
+
47
+ /* subtract the vertical line */
48
+ --remaining_width;
49
+ }
50
+
51
+ /* distribute the remaining width */
52
+
53
+ for (size_t i = n_visible; i > 0;) {
54
+ auto &c = columns--i;
55
+
56
+ unsigned width = c.min_width;
57
+ if (fraction_sum > 0 && c.fraction_width > 0) {
58
+ unsigned add = lrint(remaining_width * c.fraction_width
59
+ / fraction_sum);
60
+ if (add > remaining_width)
61
+ add = remaining_width;
62
+
63
+ width += add;
64
+ remaining_width -= add;
65
+ fraction_sum -= c.fraction_width;
66
+ }
67
+
68
+ c.width = width;
69
+ }
70
+}
71
ncmpc-0.48.tar.xz/src/TableStructure.hxx
Added
14
1
2
+// SPDX-License-Identifier: GPL-2.0-or-later
3
+// Copyright The Music Player Daemon Project
4
+
5
+#pragma once
6
+
7
+#include "TableColumn.hxx"
8
+
9
+#include <vector>
10
+
11
+struct TableStructure {
12
+ std::vector<TableColumn> columns;
13
+};
14
ncmpc-0.47.tar.xz/src/TagFilter.cxx -> ncmpc-0.48.tar.xz/src/TagFilter.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "TagFilter.hxx"
23
24
ncmpc-0.47.tar.xz/src/TagFilter.hxx -> ncmpc-0.48.tar.xz/src/TagFilter.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_TAG_FILTER_HXX
23
#define NCMPC_TAG_FILTER_HXX
24
ncmpc-0.47.tar.xz/src/TagListPage.cxx -> ncmpc-0.48.tar.xz/src/TagListPage.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "TagListPage.hxx"
23
#include "screen_status.hxx"
24
ncmpc-0.47.tar.xz/src/TagListPage.hxx -> ncmpc-0.48.tar.xz/src/TagListPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_TAG_LIST_PAGE_HXX
23
#define NCMPC_TAG_LIST_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/TagMask.hxx -> ncmpc-0.48.tar.xz/src/TagMask.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef TAG_MASK_HXX
23
#define TAG_MASK_HXX
24
ncmpc-0.47.tar.xz/src/TextListRenderer.cxx -> ncmpc-0.48.tar.xz/src/TextListRenderer.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "TextListRenderer.hxx"
23
#include "ListText.hxx"
24
ncmpc-0.47.tar.xz/src/TextListRenderer.hxx -> ncmpc-0.48.tar.xz/src/TextListRenderer.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_TEXT_LIST_RENDERER_HXX
23
#define NCMPC_TEXT_LIST_RENDERER_HXX
24
ncmpc-0.47.tar.xz/src/TextPage.cxx -> ncmpc-0.48.tar.xz/src/TextPage.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "TextPage.hxx"
23
#include "TextListRenderer.hxx"
24
ncmpc-0.47.tar.xz/src/TextPage.hxx -> ncmpc-0.48.tar.xz/src/TextPage.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef TEXT_PAGE_HXX
23
#define TEXT_PAGE_HXX
24
ncmpc-0.47.tar.xz/src/TitleBar.cxx -> ncmpc-0.48.tar.xz/src/TitleBar.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "TitleBar.hxx"
23
#include "TabBar.hxx"
24
ncmpc-0.47.tar.xz/src/TitleBar.hxx -> ncmpc-0.48.tar.xz/src/TitleBar.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_TITLE_BAR_H
23
#define NCMPC_TITLE_BAR_H
24
ncmpc-0.47.tar.xz/src/WaitUserInput.hxx -> ncmpc-0.48.tar.xz/src/WaitUserInput.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef WAIT_USER_INPUT_HXX
23
#define WAIT_USER_INPUT_HXX
24
ncmpc-0.47.tar.xz/src/Window.hxx -> ncmpc-0.48.tar.xz/src/Window.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_WINDOW_HXX
23
#define NCMPC_WINDOW_HXX
24
ncmpc-0.47.tar.xz/src/XdgBaseDirectory.cxx -> ncmpc-0.48.tar.xz/src/XdgBaseDirectory.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "XdgBaseDirectory.hxx"
23
#include "config.h"
24
ncmpc-0.47.tar.xz/src/XdgBaseDirectory.hxx -> ncmpc-0.48.tar.xz/src/XdgBaseDirectory.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef XDG_BASE_DIRECTORY_HXX
23
#define XDG_BASE_DIRECTORY_HXX
24
ncmpc-0.47.tar.xz/src/aconnect.cxx -> ncmpc-0.48.tar.xz/src/aconnect.cxx
Changed
33
1
2
-/* ncmpc (Ncurses MPD Client)
3
- Copyright 2004-2021 The Music Player Daemon Project
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions
7
- are met:
8
-
9
- - Redistributions of source code must retain the above copyright
10
- notice, this list of conditions and the following disclaimer.
11
-
12
- - Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
20
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-*/
28
+// SPDX-License-Identifier: BSD-2-Clause
29
+// Copyright The Music Player Daemon Project
30
31
#include "aconnect.hxx"
32
#include "net/AsyncResolveConnect.hxx"
33
ncmpc-0.47.tar.xz/src/aconnect.hxx -> ncmpc-0.48.tar.xz/src/aconnect.hxx
Changed
43
1
2
-/* ncmpc (Ncurses MPD Client)
3
- Copyright 2004-2021 The Music Player Daemon Project
4
+// SPDX-License-Identifier: BSD-2-Clause
5
+// Copyright The Music Player Daemon Project
6
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions
9
- are met:
10
-
11
- - Redistributions of source code must retain the above copyright
12
- notice, this list of conditions and the following disclaimer.
13
-
14
- - Redistributions in binary form must reproduce the above copyright
15
- notice, this list of conditions and the following disclaimer in the
16
- documentation and/or other materials provided with the distribution.
17
-
18
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
22
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
-*/
30
-
31
-#ifndef ACONNECT_H
32
-#define ACONNECT_H
33
+#pragma once
34
35
#include <exception>
36
37
38
39
void
40
aconnect_cancel(AsyncMpdConnect *ac);
41
-
42
-#endif
43
ncmpc-0.47.tar.xz/src/callbacks.cxx -> ncmpc-0.48.tar.xz/src/callbacks.cxx
Changed
39
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "callbacks.hxx"
23
#include "screen_utils.hxx"
24
#include "screen_status.hxx"
25
#include "mpdclient.hxx"
26
+#include "ncmpc.hxx"
27
28
#include <curses.h>
29
30
31
32
mpd_connection_clear_error(connection);
33
34
- const auto password = screen_read_password(nullptr);
35
+ const auto password = screen_read_password(*screen, nullptr);
36
if (password.empty())
37
return false;
38
39
ncmpc-0.47.tar.xz/src/callbacks.hxx -> ncmpc-0.48.tar.xz/src/callbacks.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_CALLBACKS_H
23
#define NCMPC_CALLBACKS_H
24
ncmpc-0.47.tar.xz/src/charset.cxx -> ncmpc-0.48.tar.xz/src/charset.cxx
Changed
42
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "charset.hxx"
23
#include "util/ScopeExit.hxx"
24
+#include "util/StringAPI.hxx"
25
26
#include <algorithm>
27
28
#include <assert.h>
29
-#include <string.h>
30
31
#ifdef HAVE_ICONV
32
#include <langinfo.h>
33
34
charset_init() noexcept
35
{
36
charset = nl_langinfo(CODESET);
37
- noconvert = charset == nullptr || strcasecmp(charset, "utf-8") == 0;
38
+ noconvert = charset == nullptr || StringIsEqualIgnoreCase(charset, "utf-8");
39
}
40
#endif
41
42
ncmpc-0.47.tar.xz/src/charset.hxx -> ncmpc-0.48.tar.xz/src/charset.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef CHARSET_H
23
#define CHARSET_H
24
ncmpc-0.47.tar.xz/src/db_completion.cxx -> ncmpc-0.48.tar.xz/src/db_completion.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "db_completion.hxx"
23
#include "Completion.hxx"
24
ncmpc-0.47.tar.xz/src/db_completion.hxx -> ncmpc-0.48.tar.xz/src/db_completion.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef DB_COMPLETION_H
23
#define DB_COMPLETION_H
24
ncmpc-0.47.tar.xz/src/defaults.hxx -> ncmpc-0.48.tar.xz/src/defaults.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef DEFAULTS_H
23
#define DEFAULTS_H
24
ncmpc-0.47.tar.xz/src/event/Backend.hxx -> ncmpc-0.48.tar.xz/src/event/Backend.hxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef EVENT_BACKEND_HXX
24
#define EVENT_BACKEND_HXX
25
ncmpc-0.47.tar.xz/src/event/BackendEvents.hxx -> ncmpc-0.48.tar.xz/src/event/BackendEvents.hxx
Changed
35
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
-
21
-#ifndef EVENT_BACKEND_EVENTS_HXX
22
-#define EVENT_BACKEND_EVENTS_HXX
23
+// SPDX-License-Identifier: BSD-2-Clause
24
+
25
+#pragma once
26
27
#include "event/Features.h"
28
29
30
using EventPollBackendEvents = PollEvents;
31
32
#endif
33
-
34
-#endif
35
ncmpc-0.47.tar.xz/src/event/Chrono.hxx -> ncmpc-0.48.tar.xz/src/event/Chrono.hxx
Changed
35
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
+// author: Max Kellermann <max.kellermann@gmail.com>
22
23
-#ifndef MPD_EVENT_CHRONO_HXX
24
-#define MPD_EVENT_CHRONO_HXX
25
+#pragma once
26
27
#include <chrono>
28
29
30
using TimePoint = Clock::time_point;
31
32
} // namespace Event
33
-
34
-#endif /* MAIN_NOTIFY_H */
35
ncmpc-0.47.tar.xz/src/event/CoarseTimerEvent.cxx -> ncmpc-0.48.tar.xz/src/event/CoarseTimerEvent.cxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#include "CoarseTimerEvent.hxx"
38
#include "Loop.hxx"
39
ncmpc-0.47.tar.xz/src/event/CoarseTimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/CoarseTimerEvent.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/event/DeferEvent.cxx -> ncmpc-0.48.tar.xz/src/event/DeferEvent.cxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
+// author: Max Kellermann <max.kellermann@gmail.com>
22
23
#include "DeferEvent.hxx"
24
#include "Loop.hxx"
25
ncmpc-0.47.tar.xz/src/event/DeferEvent.hxx -> ncmpc-0.48.tar.xz/src/event/DeferEvent.hxx
Changed
35
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
+// author: Max Kellermann <max.kellermann@gmail.com>
22
23
-#ifndef MPD_DEFER_EVENT_HXX
24
-#define MPD_DEFER_EVENT_HXX
25
+#pragma once
26
27
#include "util/BindMethod.hxx"
28
#include "util/IntrusiveList.hxx"
29
30
callback();
31
}
32
};
33
-
34
-#endif
35
ncmpc-0.47.tar.xz/src/event/EpollBackend.hxx -> ncmpc-0.48.tar.xz/src/event/EpollBackend.hxx
Changed
34
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
-
21
-#ifndef EVENT_EPOLL_BACKEND_HXX
22
-#define EVENT_EPOLL_BACKEND_HXX
23
+// SPDX-License-Identifier: BSD-2-Clause
24
+// author: Max Kellermann <max.kellermann@gmail.com>
25
26
#include "system/EpollFD.hxx"
27
28
29
return true;
30
}
31
};
32
-
33
-#endif
34
ncmpc-0.47.tar.xz/src/event/EpollEvents.hxx -> ncmpc-0.48.tar.xz/src/event/EpollEvents.hxx
Changed
34
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
22
-#ifndef EVENT_EPOLL_EVENTS_HXX
23
-#define EVENT_EPOLL_EVENTS_HXX
24
+#pragma once
25
26
#include <sys/epoll.h>
27
28
29
static constexpr unsigned ERROR = EPOLLERR;
30
static constexpr unsigned HANGUP = EPOLLHUP;
31
};
32
-
33
-#endif
34
ncmpc-0.47.tar.xz/src/event/FarTimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/FarTimerEvent.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/event/FineTimerEvent.cxx -> ncmpc-0.48.tar.xz/src/event/FineTimerEvent.cxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#include "FineTimerEvent.hxx"
38
#include "Loop.hxx"
39
ncmpc-0.47.tar.xz/src/event/FineTimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/FineTimerEvent.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/event/IdleEvent.hxx -> ncmpc-0.48.tar.xz/src/event/IdleEvent.hxx
Changed
35
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
+// author: Max Kellermann <max.kellermann@gmail.com>
22
23
-#ifndef MPD_SOCKET_IDLE_EVENT_HXX
24
-#define MPD_SOCKET_IDLE_EVENT_HXX
25
+#pragma once
26
27
#include "DeferEvent.hxx"
28
29
30
event.Cancel();
31
}
32
};
33
-
34
-#endif
35
ncmpc-0.47.tar.xz/src/event/Loop.cxx -> ncmpc-0.48.tar.xz/src/event/Loop.cxx
Changed
172
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#include "Loop.hxx"
24
#include "DeferEvent.hxx"
25
#include "SocketEvent.hxx"
26
-#include "IdleEvent.hxx"
27
#include "util/ScopeExit.hxx"
28
29
#ifdef HAVE_THREADED_EVENT_LOOP
30
31
32
#endif
33
34
-void
35
-EventLoop::Break() noexcept
36
-{
37
- if (quit.exchange(true))
38
- return;
39
-
40
-#ifdef HAVE_THREADED_EVENT_LOOP
41
- wake_fd.Write();
42
-#endif
43
-}
44
-
45
bool
46
EventLoop::AddFD(int fd, unsigned events, SocketEvent &event) noexcept
47
{
48
49
void
50
EventLoop::Insert(CoarseTimerEvent &t) noexcept
51
{
52
+ assert(IsInside());
53
+
54
coarse_timers.Insert(t, SteadyNow());
55
again = true;
56
}
57
58
+#ifndef NO_FINE_TIMER_EVENT
59
+
60
void
61
EventLoop::Insert(FineTimerEvent &t) noexcept
62
{
63
64
again = true;
65
}
66
67
+#endif // NO_FINE_TIMER_EVENT
68
+
69
+/**
70
+ * Determines which timeout will happen earlier; either one may be
71
+ * negative to specify "no timeout at all".
72
+ */
73
+static constexpr Event::Duration
74
+GetEarlierTimeout(Event::Duration a, Event::Duration b) noexcept
75
+{
76
+ return b.count() < 0 || (a.count() >= 0 && a < b)
77
+ ? a
78
+ : b;
79
+}
80
+
81
inline Event::Duration
82
EventLoop::HandleTimers() noexcept
83
{
84
const auto now = SteadyNow();
85
86
+#ifndef NO_FINE_TIMER_EVENT
87
auto fine_timeout = timers.Run(now);
88
+#else
89
+ const Event::Duration fine_timeout{-1};
90
+#endif // NO_FINE_TIMER_EVENT
91
auto coarse_timeout = coarse_timers.Run(now);
92
93
- return fine_timeout.count() < 0 ||
94
- (coarse_timeout.count() >= 0 && coarse_timeout < fine_timeout)
95
- ? coarse_timeout
96
- : fine_timeout;
97
+ return GetEarlierTimeout(coarse_timeout, fine_timeout);
98
}
99
100
void
101
-EventLoop::AddDefer(DeferEvent &d) noexcept
102
+EventLoop::AddDefer(DeferEvent &e) noexcept
103
{
104
#ifdef HAVE_THREADED_EVENT_LOOP
105
assert(!IsAlive() || IsInside());
106
#endif
107
108
- defer.push_back(d);
109
+ defer.push_back(e);
110
+
111
+#ifdef HAVE_THREADED_EVENT_LOOP
112
+ /* setting this flag here is only relevant if we've been
113
+ called by a DeferEvent */
114
again = true;
115
+#endif
116
}
117
118
void
119
EventLoop::AddIdle(DeferEvent &e) noexcept
120
{
121
- idle.push_front(e);
122
+ assert(IsInside());
123
+
124
+ idle.push_back(e);
125
+
126
+#ifdef HAVE_THREADED_EVENT_LOOP
127
+ /* setting this flag here is only relevant if we've been
128
+ called by a DeferEvent */
129
again = true;
130
+#endif
131
}
132
133
void
134
135
assert(IsInside());
136
assert(!quit);
137
#ifdef HAVE_THREADED_EVENT_LOOP
138
+ assert(!quit_injected);
139
assert(alive);
140
assert(busy);
141
142
143
};
144
#endif
145
146
- steady_clock_cache.flush();
147
+ FlushClockCaches();
148
149
do {
150
again = false;
151
152
153
Wait(timeout);
154
155
- steady_clock_cache.flush();
156
+ FlushClockCaches();
157
158
#ifdef HAVE_THREADED_EVENT_LOOP
159
{
160
161
162
wake_fd.Read();
163
164
+ if (quit_injected) {
165
+ Break();
166
+ return;
167
+ }
168
+
169
const std::scoped_lock<Mutex> lock(mutex);
170
HandleInject();
171
}
172
ncmpc-0.47.tar.xz/src/event/Loop.hxx -> ncmpc-0.48.tar.xz/src/event/Loop.hxx
Changed
165
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef EVENT_LOOP_HXX
24
#define EVENT_LOOP_HXX
25
26
#include "Chrono.hxx"
27
#include "TimerWheel.hxx"
28
-#include "TimerList.hxx"
29
#include "Backend.hxx"
30
#include "SocketEvent.hxx"
31
#include "event/Features.h"
32
#include "time/ClockCache.hxx"
33
#include "util/IntrusiveList.hxx"
34
35
+#ifndef NO_FINE_TIMER_EVENT
36
+#include "TimerList.hxx"
37
+#endif // NO_FINE_TIMER_EVENT
38
+
39
#ifdef HAVE_THREADED_EVENT_LOOP
40
#include "WakeFD.hxx"
41
#include "thread/Id.hxx"
42
#include "thread/Mutex.hxx"
43
-
44
-#include <boost/intrusive/list.hpp>
45
#endif
46
47
-#include <atomic>
48
#include <cassert>
49
50
#include "io/uring/Features.h"
51
52
#endif
53
54
TimerWheel coarse_timers;
55
+
56
+#ifndef NO_FINE_TIMER_EVENT
57
TimerList timers;
58
+#endif // NO_FINE_TIMER_EVENT
59
60
using DeferList = IntrusiveList<DeferEvent>;
61
62
63
#ifdef HAVE_THREADED_EVENT_LOOP
64
Mutex mutex;
65
66
- using InjectList =
67
- boost::intrusive::list<InjectEvent,
68
- boost::intrusive::base_hook<boost::intrusive::list_base_hook<>>,
69
- boost::intrusive::constant_time_size<false>>;
70
+ using InjectList = IntrusiveList<InjectEvent>;
71
InjectList inject;
72
#endif
73
74
75
SocketList sockets;
76
77
/**
78
- * A linked list of #SocketEvent instances which have a
79
- * non-zero "ready_flags" field, and need to be dispatched.
80
+ * A list of #SocketEvent instances which have a non-zero
81
+ * "ready_flags" field, and need to be dispatched.
82
*/
83
SocketList ready_sockets;
84
85
86
bool alive;
87
#endif
88
89
- std::atomic_bool quit{false};
90
+ bool quit = false;
91
92
/**
93
* True when the object has been modified and another check is
94
95
bool again;
96
97
#ifdef HAVE_THREADED_EVENT_LOOP
98
+ bool quit_injected = false;
99
+
100
/**
101
* True when handling callbacks, false when waiting for I/O or
102
* timeout.
103
104
return steady_clock_cache.now();
105
}
106
107
+ void FlushClockCaches() noexcept {
108
+ steady_clock_cache.flush();
109
+ }
110
+
111
#ifdef HAVE_URING
112
gnu::pure
113
Uring::Queue *GetUring() noexcept;
114
#endif
115
116
/**
117
- * Stop execution of this #EventLoop at the next chance. This
118
- * method is thread-safe and non-blocking: after returning, it
119
- * is not guaranteed that the EventLoop has really stopped.
120
+ * Stop execution of this #EventLoop at the next chance.
121
+ *
122
+ * This method is not thread-safe. For stopping the
123
+ * #EventLoop from within another thread, use InjectBreak().
124
+ */
125
+ void Break() noexcept {
126
+ quit = true;
127
+ }
128
+
129
+#ifdef HAVE_THREADED_EVENT_LOOP
130
+ /**
131
+ * Like Break(), but thread-safe. It is also non-blocking:
132
+ * after returning, it is not guaranteed that the EventLoop
133
+ * has really stopped.
134
*/
135
- void Break() noexcept;
136
+ void InjectBreak() noexcept {
137
+ {
138
+ const std::scoped_lock lock{mutex};
139
+ quit_injected = true;
140
+ }
141
+
142
+ wake_fd.Write();
143
+ }
144
+#endif // HAVE_THREADED_EVENT_LOOP
145
146
bool AddFD(int fd, unsigned events, SocketEvent &event) noexcept;
147
bool ModifyFD(int fd, unsigned events, SocketEvent &event) noexcept;
148
149
bool AbandonFD(SocketEvent &event) noexcept;
150
151
void Insert(CoarseTimerEvent &t) noexcept;
152
+
153
+#ifndef NO_FINE_TIMER_EVENT
154
void Insert(FineTimerEvent &t) noexcept;
155
+#endif // NO_FINE_TIMER_EVENT
156
157
/**
158
* Schedule a call to DeferEvent::RunDeferred().
159
*/
160
- void AddDefer(DeferEvent &d) noexcept;
161
+ void AddDefer(DeferEvent &e) noexcept;
162
void AddIdle(DeferEvent &e) noexcept;
163
164
#ifdef HAVE_THREADED_EVENT_LOOP
165
ncmpc-0.47.tar.xz/src/event/PipeEvent.hxx -> ncmpc-0.48.tar.xz/src/event/PipeEvent.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/event/PollBackend.cxx -> ncmpc-0.48.tar.xz/src/event/PollBackend.cxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#include "PollBackend.hxx"
24
25
ncmpc-0.47.tar.xz/src/event/PollBackend.hxx -> ncmpc-0.48.tar.xz/src/event/PollBackend.hxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef EVENT_POLL_BACKEND_HXX
24
#define EVENT_POLL_BACKEND_HXX
25
ncmpc-0.47.tar.xz/src/event/PollEvents.hxx -> ncmpc-0.48.tar.xz/src/event/PollEvents.hxx
Changed
34
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
22
-#ifndef EVENT_POLL_EVENTS_HXX
23
-#define EVENT_POLL_EVENTS_HXX
24
+#pragma once
25
26
#include <sys/poll.h>
27
28
29
static constexpr unsigned ERROR = POLLERR;
30
static constexpr unsigned HANGUP = POLLHUP;
31
};
32
-
33
-#endif
34
ncmpc-0.47.tar.xz/src/event/PollResultGeneric.hxx -> ncmpc-0.48.tar.xz/src/event/PollResultGeneric.hxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef MPD_EVENT_POLLRESULT_GENERIC_HXX
24
#define MPD_EVENT_POLLRESULT_GENERIC_HXX
25
ncmpc-0.47.tar.xz/src/event/SignalMonitor.cxx -> ncmpc-0.48.tar.xz/src/event/SignalMonitor.cxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#include "SignalMonitor.hxx"
24
#include "event/Features.h"
25
ncmpc-0.47.tar.xz/src/event/SignalMonitor.hxx -> ncmpc-0.48.tar.xz/src/event/SignalMonitor.hxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef MPD_SOCKET_SIGNAL_MONITOR_HXX
24
#define MPD_SOCKET_SIGNAL_MONITOR_HXX
25
ncmpc-0.47.tar.xz/src/event/SocketEvent.cxx -> ncmpc-0.48.tar.xz/src/event/SocketEvent.cxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
+// author: Max Kellermann <max.kellermann@gmail.com>
22
23
#include "SocketEvent.hxx"
24
#include "Loop.hxx"
25
ncmpc-0.47.tar.xz/src/event/SocketEvent.hxx -> ncmpc-0.48.tar.xz/src/event/SocketEvent.hxx
Changed
75
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
+// author: Max Kellermann <max.kellermann@gmail.com>
22
23
-#ifndef MPD_SOCKET_EVENT_HXX
24
-#define MPD_SOCKET_EVENT_HXX
25
+#pragma once
26
27
#include "BackendEvents.hxx"
28
#include "net/SocketDescriptor.hxx"
29
#include "util/BindMethod.hxx"
30
#include "util/IntrusiveList.hxx"
31
32
-#include <cstddef>
33
-#include <type_traits>
34
-
35
class EventLoop;
36
37
/**
38
39
* thread that runs the #EventLoop, except where explicitly documented
40
* as thread-safe.
41
*/
42
-class SocketEvent final : IntrusiveListHook, public EventPollBackendEvents
43
+class SocketEvent final
44
+ : IntrusiveListHook<IntrusiveHookMode::NORMAL>,
45
+ public EventPollBackendEvents
46
{
47
friend class EventLoop;
48
friend struct IntrusiveListBaseHookTraits<SocketEvent>;
49
50
*/
51
static constexpr unsigned IMPLICIT_FLAGS = ERROR|HANGUP;
52
53
- using ssize_t = std::make_signed<size_t>::type;
54
-
55
SocketEvent(EventLoop &_loop, Callback _callback,
56
SocketDescriptor _fd=SocketDescriptor::Undefined()) noexcept
57
:loop(_loop),
58
59
return scheduled_flags;
60
}
61
62
+ unsigned GetReadyFlags() const noexcept {
63
+ return ready_flags;
64
+ }
65
+
66
void SetReadyFlags(unsigned flags) noexcept {
67
ready_flags = flags;
68
}
69
70
*/
71
void Dispatch() noexcept;
72
};
73
-
74
-#endif
75
ncmpc-0.47.tar.xz/src/event/TimerEvent.hxx -> ncmpc-0.48.tar.xz/src/event/TimerEvent.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/event/TimerList.cxx -> ncmpc-0.48.tar.xz/src/event/TimerList.cxx
Changed
64
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
-#include "Loop.hxx"
38
+#include "TimerList.hxx"
39
#include "FineTimerEvent.hxx"
40
41
-#ifdef NO_BOOST
42
-#include <algorithm>
43
-#endif
44
-
45
constexpr bool
46
TimerList::Compare::operator()(const FineTimerEvent &a,
47
const FineTimerEvent &b) const noexcept
48
49
void
50
TimerList::Insert(FineTimerEvent &t) noexcept
51
{
52
-#ifdef NO_BOOST
53
- auto i = std::find_if(timers.begin(), timers.end(), due = t.GetDue()(const auto &other){
54
- return other.GetDue() >= due;
55
- });
56
-
57
- timers.insert(i, t);
58
-#else
59
timers.insert(t);
60
-#endif
61
}
62
63
Event::Duration
64
ncmpc-0.47.tar.xz/src/event/TimerList.hxx -> ncmpc-0.48.tar.xz/src/event/TimerList.hxx
Changed
59
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
#include "Chrono.hxx"
40
#include "event/Features.h"
41
-#include "util/IntrusiveList.hxx"
42
43
-#ifndef NO_BOOST
44
+#ifdef NO_BOOST
45
+#include "util/IntrusiveSortedList.hxx"
46
+#else
47
#include <boost/intrusive/set.hpp>
48
#endif
49
50
51
/* when building without Boost, then this is just a sorted
52
doubly-linked list - this doesn't scale well, but is good
53
enough for most programs */
54
- IntrusiveList<FineTimerEvent> timers;
55
+ IntrusiveSortedList<FineTimerEvent, Compare> timers;
56
#else
57
boost::intrusive::multiset<FineTimerEvent,
58
boost::intrusive::base_hook<boost::intrusive::set_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>>,
59
ncmpc-0.47.tar.xz/src/event/TimerWheel.cxx -> ncmpc-0.48.tar.xz/src/event/TimerWheel.cxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#include "TimerWheel.hxx"
38
#include "CoarseTimerEvent.hxx"
39
ncmpc-0.47.tar.xz/src/event/TimerWheel.hxx -> ncmpc-0.48.tar.xz/src/event/TimerWheel.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/event/WakeFD.hxx -> ncmpc-0.48.tar.xz/src/event/WakeFD.hxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef MPD_WAKE_FD_HXX
24
#define MPD_WAKE_FD_HXX
25
ncmpc-0.47.tar.xz/src/event/WinSelectBackend.cxx -> ncmpc-0.48.tar.xz/src/event/WinSelectBackend.cxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#include "WinSelectBackend.hxx"
24
#include "WinSelectEvents.hxx"
25
ncmpc-0.47.tar.xz/src/event/WinSelectBackend.hxx -> ncmpc-0.48.tar.xz/src/event/WinSelectBackend.hxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef EVENT_WINSELECT_BACKEND_HXX
24
#define EVENT_WINSELECT_BACKEND_HXX
25
ncmpc-0.47.tar.xz/src/event/WinSelectEvents.hxx -> ncmpc-0.48.tar.xz/src/event/WinSelectEvents.hxx
Changed
34
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: BSD-2-Clause
21
22
-#ifndef EVENT_WINSELECT_EVENTS_HXX
23
-#define EVENT_WINSELECT_EVENTS_HXX
24
+#pragma once
25
26
#include <windows.h>
27
28
29
static constexpr unsigned ERROR = 0;
30
static constexpr unsigned HANGUP = 0;
31
};
32
-
33
-#endif
34
ncmpc-0.47.tar.xz/src/event/meson.build -> ncmpc-0.48.tar.xz/src/event/meson.build
Changed
9
1
2
'CoarseTimerEvent.cxx',
3
'FineTimerEvent.cxx',
4
'DeferEvent.cxx',
5
- 'IdleEvent.cxx',
6
'SocketEvent.cxx',
7
'Loop.cxx',
8
event_sources,
9
ncmpc-0.47.tar.xz/src/event/net/ConnectSocket.cxx -> ncmpc-0.48.tar.xz/src/event/net/ConnectSocket.cxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2021 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#include "ConnectSocket.hxx"
38
#include "net/UniqueSocketDescriptor.hxx"
39
ncmpc-0.47.tar.xz/src/event/net/ConnectSocket.hxx -> ncmpc-0.48.tar.xz/src/event/net/ConnectSocket.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2021 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/filelist.cxx -> ncmpc-0.48.tar.xz/src/filelist.cxx
Changed
54
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "filelist.hxx"
23
+#include "util/StringAPI.hxx"
24
#include "util/StringUTF8.hxx"
25
26
#include <mpd/client.h>
27
28
#include <algorithm>
29
30
-#include <string.h>
31
#include <assert.h>
32
33
FileListEntry::~FileListEntry() noexcept
34
35
static bool
36
same_song(const struct mpd_song *a, const struct mpd_song *b) noexcept
37
{
38
- return strcmp(mpd_song_get_uri(a), mpd_song_get_uri(b)) == 0;
39
+ return StringIsEqual(mpd_song_get_uri(a), mpd_song_get_uri(b));
40
}
41
42
int
43
44
45
if (entity != nullptr &&
46
mpd_entity_get_type(entity) == MPD_ENTITY_TYPE_DIRECTORY &&
47
- strcmp(mpd_directory_get_path(mpd_entity_get_directory(entity)),
48
- name) == 0)
49
+ StringIsEqual(mpd_directory_get_path(mpd_entity_get_directory(entity)),
50
+ name))
51
return i;
52
}
53
54
ncmpc-0.47.tar.xz/src/filelist.hxx -> ncmpc-0.48.tar.xz/src/filelist.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef FILELIST_H
23
#define FILELIST_H
24
ncmpc-0.47.tar.xz/src/gidle.cxx -> ncmpc-0.48.tar.xz/src/gidle.cxx
Changed
46
1
2
-/* ncmpc (Ncurses MPD Client)
3
- Copyright 2004-2021 The Music Player Daemon Project
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions
7
- are met:
8
-
9
- - Redistributions of source code must retain the above copyright
10
- notice, this list of conditions and the following disclaimer.
11
-
12
- - Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
20
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-*/
28
+// SPDX-License-Identifier: BSD-2-Clause
29
+// Copyright The Music Player Daemon Project
30
31
#include "gidle.hxx"
32
+#include "util/StringAPI.hxx"
33
34
#include <mpd/async.h>
35
#include <mpd/parser.h>
36
37
return false;
38
39
case MPD_PARSER_PAIR:
40
- if (strcmp(mpd_parser_get_name(parser),
41
- "changed") == 0)
42
+ if (StringIsEqual(mpd_parser_get_name(parser), "changed"))
43
idle_events |=
44
mpd_idle_name_parse(mpd_parser_get_value(parser));
45
46
ncmpc-0.47.tar.xz/src/gidle.hxx -> ncmpc-0.48.tar.xz/src/gidle.hxx
Changed
44
1
2
-/* ncmpc (Ncurses MPD Client)
3
- Copyright 2004-2021 The Music Player Daemon Project
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions
7
- are met:
8
-
9
- - Redistributions of source code must retain the above copyright
10
- notice, this list of conditions and the following disclaimer.
11
-
12
- - Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
20
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-*/
28
-
29
-#ifndef MPD_GLIB_SOURCE_H
30
-#define MPD_GLIB_SOURCE_H
31
+// SPDX-License-Identifier: BSD-2-Clause
32
+// Copyright The Music Player Daemon Project
33
+
34
+#pragma once
35
36
#include "event/SocketEvent.hxx"
37
38
39
40
void UpdateSocket() noexcept;
41
};
42
-
43
-#endif
44
ncmpc-0.47.tar.xz/src/hscroll.cxx -> ncmpc-0.48.tar.xz/src/hscroll.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "hscroll.hxx"
23
#include "Styles.hxx"
24
ncmpc-0.47.tar.xz/src/hscroll.hxx -> ncmpc-0.48.tar.xz/src/hscroll.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef HSCROLL_H
23
#define HSCROLL_H
24
ncmpc-0.47.tar.xz/src/i18n.h -> ncmpc-0.48.tar.xz/src/i18n.h
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef I18N_H
23
#define I18N_H
24
ncmpc-0.47.tar.xz/src/io/FileDescriptor.cxx -> ncmpc-0.48.tar.xz/src/io/FileDescriptor.cxx
Changed
151
1
2
-/*
3
- * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "FileDescriptor.hxx"
34
#include "UniqueFileDescriptor.hxx"
35
36
#include <poll.h>
37
#endif
38
39
-#ifdef __linux__
40
-#include <sys/eventfd.h>
41
-#include <sys/signalfd.h>
42
-#endif
43
-
44
#ifndef O_NOCTTY
45
#define O_NOCTTY 0
46
#endif
47
48
#ifdef _WIN32
49
50
void
51
-FileDescriptor::SetBinaryMode() noexcept
52
+FileDescriptor::SetBinaryMode() const noexcept
53
{
54
_setmode(fd, _O_BINARY);
55
}
56
57
}
58
59
void
60
-FileDescriptor::SetNonBlocking() noexcept
61
+FileDescriptor::SetNonBlocking() const noexcept
62
{
63
assert(IsDefined());
64
65
66
}
67
68
void
69
-FileDescriptor::SetBlocking() noexcept
70
+FileDescriptor::SetBlocking() const noexcept
71
{
72
assert(IsDefined());
73
74
75
}
76
77
void
78
-FileDescriptor::EnableCloseOnExec() noexcept
79
+FileDescriptor::EnableCloseOnExec() const noexcept
80
{
81
assert(IsDefined());
82
83
84
}
85
86
void
87
-FileDescriptor::DisableCloseOnExec() noexcept
88
+FileDescriptor::DisableCloseOnExec() const noexcept
89
{
90
assert(IsDefined());
91
92
93
}
94
95
bool
96
-FileDescriptor::CheckDuplicate(FileDescriptor new_fd) noexcept
97
+FileDescriptor::CheckDuplicate(FileDescriptor new_fd) const noexcept
98
{
99
if (*this == new_fd) {
100
DisableCloseOnExec();
101
102
103
#endif
104
105
-#ifdef __linux__
106
-
107
-bool
108
-FileDescriptor::CreateEventFD(unsigned initval) noexcept
109
-{
110
- fd = ::eventfd(initval, EFD_NONBLOCK|EFD_CLOEXEC);
111
- return fd >= 0;
112
-}
113
-
114
-bool
115
-FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept
116
-{
117
- int new_fd = ::signalfd(fd, mask, SFD_NONBLOCK|SFD_CLOEXEC);
118
- if (new_fd < 0)
119
- return false;
120
-
121
- fd = new_fd;
122
- return true;
123
-}
124
-
125
-#endif
126
-
127
bool
128
-FileDescriptor::Rewind() noexcept
129
+FileDescriptor::Rewind() const noexcept
130
{
131
assert(IsDefined());
132
133
134
}
135
136
void
137
-FileDescriptor::FullRead(void *_buffer, std::size_t length)
138
+FileDescriptor::FullRead(void *_buffer, std::size_t length) const
139
{
140
auto buffer = (std::byte *)_buffer;
141
142
143
}
144
145
void
146
-FileDescriptor::FullWrite(const void *_buffer, std::size_t length)
147
+FileDescriptor::FullWrite(const void *_buffer, std::size_t length) const
148
{
149
auto buffer = (const std::byte *)_buffer;
150
151
ncmpc-0.47.tar.xz/src/io/FileDescriptor.hxx -> ncmpc-0.48.tar.xz/src/io/FileDescriptor.hxx
Changed
159
1
2
-/*
3
- * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#pragma once
34
35
36
#include <unistd.h>
37
#include <sys/types.h>
38
39
-#ifdef __linux__
40
-#include <csignal>
41
-#endif
42
-
43
#ifdef _WIN32
44
#include <wchar.h>
45
#endif
46
47
static bool CreatePipe(FileDescriptor &r, FileDescriptor &w) noexcept;
48
49
#ifdef _WIN32
50
- void EnableCloseOnExec() noexcept {}
51
- void DisableCloseOnExec() noexcept {}
52
- void SetBinaryMode() noexcept;
53
+ void EnableCloseOnExec() const noexcept {}
54
+ void DisableCloseOnExec() const noexcept {}
55
+ void SetBinaryMode() const noexcept;
56
#else
57
static bool CreatePipeNonBlock(FileDescriptor &r,
58
FileDescriptor &w) noexcept;
59
60
- void SetBinaryMode() noexcept {}
61
+ void SetBinaryMode() const noexcept {}
62
63
/**
64
* Enable non-blocking mode on this file descriptor.
65
*/
66
- void SetNonBlocking() noexcept;
67
+ void SetNonBlocking() const noexcept;
68
69
/**
70
* Enable blocking mode on this file descriptor.
71
*/
72
- void SetBlocking() noexcept;
73
+ void SetBlocking() const noexcept;
74
75
/**
76
* Auto-close this file descriptor when a new program is
77
* executed.
78
*/
79
- void EnableCloseOnExec() noexcept;
80
+ void EnableCloseOnExec() const noexcept;
81
82
/**
83
* Do not auto-close this file descriptor when a new program
84
* is executed.
85
*/
86
- void DisableCloseOnExec() noexcept;
87
+ void DisableCloseOnExec() const noexcept;
88
89
/**
90
* Duplicate this file descriptor.
91
92
* this method to inject file descriptors into a new child
93
* process, to be used by a newly executed program.
94
*/
95
- bool CheckDuplicate(FileDescriptor new_fd) noexcept;
96
-#endif
97
-
98
-#ifdef __linux__
99
- bool CreateEventFD(unsigned initval=0) noexcept;
100
- bool CreateSignalFD(const sigset_t *mask) noexcept;
101
+ bool CheckDuplicate(FileDescriptor new_fd) const noexcept;
102
#endif
103
104
/**
105
106
/**
107
* Rewind the pointer to the beginning of the file.
108
*/
109
- bool Rewind() noexcept;
110
+ bool Rewind() const noexcept;
111
112
- off_t Seek(off_t offset) noexcept {
113
+ off_t Seek(off_t offset) const noexcept {
114
return lseek(Get(), offset, SEEK_SET);
115
}
116
117
- off_t Skip(off_t offset) noexcept {
118
+ off_t Skip(off_t offset) const noexcept {
119
return lseek(Get(), offset, SEEK_CUR);
120
}
121
122
123
gnu::pure
124
off_t GetSize() const noexcept;
125
126
- ssize_t Read(void *buffer, std::size_t length) noexcept {
127
+#ifndef _WIN32
128
+ ssize_t ReadAt(off_t offset,
129
+ void *buffer, std::size_t length) const noexcept {
130
+ return ::pread(fd, buffer, length, offset);
131
+ }
132
+#endif
133
+
134
+ ssize_t Read(void *buffer, std::size_t length) const noexcept {
135
return ::read(fd, buffer, length);
136
}
137
138
139
* Read until all of the given buffer has been filled. Throws
140
* on error.
141
*/
142
- void FullRead(void *buffer, std::size_t length);
143
+ void FullRead(void *buffer, std::size_t length) const;
144
145
- ssize_t Write(const void *buffer, std::size_t length) noexcept {
146
+ ssize_t Write(const void *buffer, std::size_t length) const noexcept {
147
return ::write(fd, buffer, length);
148
}
149
150
151
* Write until all of the given buffer has been written.
152
* Throws on error.
153
*/
154
- void FullWrite(const void *buffer, std::size_t length);
155
+ void FullWrite(const void *buffer, std::size_t length) const;
156
157
#ifndef _WIN32
158
int Poll(short events, int timeout) const noexcept;
159
ncmpc-0.47.tar.xz/src/io/Path.hxx -> ncmpc-0.48.tar.xz/src/io/Path.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef IO_PATH_HXX
23
#define IO_PATH_HXX
24
ncmpc-0.47.tar.xz/src/io/UniqueFileDescriptor.hxx -> ncmpc-0.48.tar.xz/src/io/UniqueFileDescriptor.hxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef UNIQUE_FILE_DESCRIPTOR_HXX
34
#define UNIQUE_FILE_DESCRIPTOR_HXX
35
ncmpc-0.47.tar.xz/src/io/uring/Features.h -> ncmpc-0.48.tar.xz/src/io/uring/Features.h
Changed
23
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
/* no definitions, ncmpc doesn't use io_uring */
23
ncmpc-0.47.tar.xz/src/io/uring/Features.hxx -> ncmpc-0.48.tar.xz/src/io/uring/Features.hxx
Changed
23
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
/* no definitions, ncmpc doesn't use io_uring */
23
ncmpc-0.47.tar.xz/src/lirc.cxx -> ncmpc-0.48.tar.xz/src/lirc.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "lirc.hxx"
23
#include "ncmpc.hxx"
24
ncmpc-0.47.tar.xz/src/lirc.hxx -> ncmpc-0.48.tar.xz/src/lirc.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef LIRC_H
23
#define LIRC_H
24
ncmpc-0.47.tar.xz/src/mpdclient.cxx -> ncmpc-0.48.tar.xz/src/mpdclient.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "mpdclient.hxx"
23
#include "callbacks.hxx"
24
ncmpc-0.47.tar.xz/src/mpdclient.hxx -> ncmpc-0.48.tar.xz/src/mpdclient.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef MPDCLIENT_HXX
23
#define MPDCLIENT_HXX
24
ncmpc-0.47.tar.xz/src/ncmpc.hxx -> ncmpc-0.48.tar.xz/src/ncmpc.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_H
23
#define NCMPC_H
24
ncmpc-0.47.tar.xz/src/ncu.cxx -> ncmpc-0.48.tar.xz/src/ncu.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "ncu.hxx"
23
#include "config.h"
24
ncmpc-0.47.tar.xz/src/ncu.hxx -> ncmpc-0.48.tar.xz/src/ncu.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
/*
23
* Basic libnucrses initialization.
24
ncmpc-0.47.tar.xz/src/net/AddressInfo.cxx -> ncmpc-0.48.tar.xz/src/net/AddressInfo.cxx
Changed
35
1
2
-/*
3
- * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "AddressInfo.hxx"
34
#include "Features.hxx"
35
ncmpc-0.47.tar.xz/src/net/AddressInfo.hxx -> ncmpc-0.48.tar.xz/src/net/AddressInfo.hxx
Changed
35
1
2
-/*
3
- * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef NET_ADDRESS_INFO_HXX
34
#define NET_ADDRESS_INFO_HXX
35
ncmpc-0.47.tar.xz/src/net/AllocatedSocketAddress.cxx -> ncmpc-0.48.tar.xz/src/net/AllocatedSocketAddress.cxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "AllocatedSocketAddress.hxx"
34
#include "IPv4Address.hxx"
35
ncmpc-0.47.tar.xz/src/net/AllocatedSocketAddress.hxx -> ncmpc-0.48.tar.xz/src/net/AllocatedSocketAddress.hxx
Changed
50
1
2
-/*
3
- * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef ALLOCATED_SOCKET_ADDRESS_HXX
34
#define ALLOCATED_SOCKET_ADDRESS_HXX
35
36
}
37
38
/**
39
+ * Does the address family support port numbers?
40
+ */
41
+ gnu::pure
42
+ bool HasPort() const noexcept {
43
+ return ((SocketAddress)*this).HasPort();
44
+ }
45
+
46
+ /**
47
* Extract the port number. Returns 0 if not applicable.
48
*/
49
gnu::pure
50
ncmpc-0.47.tar.xz/src/net/AsyncResolveConnect.cxx -> ncmpc-0.48.tar.xz/src/net/AsyncResolveConnect.cxx
Changed
33
1
2
-/* ncmpc (Ncurses MPD Client)
3
- Copyright 2004-2021 The Music Player Daemon Project
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions
7
- are met:
8
-
9
- - Redistributions of source code must retain the above copyright
10
- notice, this list of conditions and the following disclaimer.
11
-
12
- - Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
20
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-*/
28
+// SPDX-License-Identifier: BSD-2-Clause
29
+// Copyright The Music Player Daemon Project
30
31
#include "AsyncResolveConnect.hxx"
32
#include "AllocatedSocketAddress.hxx"
33
ncmpc-0.47.tar.xz/src/net/AsyncResolveConnect.hxx -> ncmpc-0.48.tar.xz/src/net/AsyncResolveConnect.hxx
Changed
43
1
2
-/* ncmpc (Ncurses MPD Client)
3
- Copyright 2004-2021 The Music Player Daemon Project
4
+// SPDX-License-Identifier: BSD-2-Clause
5
+// Copyright The Music Player Daemon Project
6
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions
9
- are met:
10
-
11
- - Redistributions of source code must retain the above copyright
12
- notice, this list of conditions and the following disclaimer.
13
-
14
- - Redistributions in binary form must reproduce the above copyright
15
- notice, this list of conditions and the following disclaimer in the
16
- documentation and/or other materials provided with the distribution.
17
-
18
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
22
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
-*/
30
-
31
-#ifndef NET_ASYNC_RESOLVE_CONNECT_HXX
32
-#define NET_ASYNC_RESOLVE_CONNECT_HXX
33
+#pragma once
34
35
#include "event/net/ConnectSocket.hxx"
36
37
38
*/
39
void Start(const char *host, unsigned port) noexcept;
40
};
41
-
42
-#endif
43
ncmpc-0.47.tar.xz/src/net/Features.hxx -> ncmpc-0.48.tar.xz/src/net/Features.hxx
Changed
43
1
2
-/* ncmpc (Ncurses MPD Client)
3
- Copyright 2004-2021 The Music Player Daemon Project
4
+// SPDX-License-Identifier: BSD-2-Clause
5
+// Copyright The Music Player Daemon Project
6
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions
9
- are met:
10
-
11
- - Redistributions of source code must retain the above copyright
12
- notice, this list of conditions and the following disclaimer.
13
-
14
- - Redistributions in binary form must reproduce the above copyright
15
- notice, this list of conditions and the following disclaimer in the
16
- documentation and/or other materials provided with the distribution.
17
-
18
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
22
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
-*/
30
-
31
-#ifndef NET_FEATURES_HXX
32
-#define NET_FEATURES_HXX
33
+#pragma once
34
35
#define HAVE_TCP
36
37
#ifndef _WIN32
38
#define HAVE_UN
39
#endif
40
-
41
-#endif
42
-
43
ncmpc-0.47.tar.xz/src/net/HostParser.cxx -> ncmpc-0.48.tar.xz/src/net/HostParser.cxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#include "HostParser.hxx"
38
#include "util/CharUtil.hxx"
39
ncmpc-0.47.tar.xz/src/net/HostParser.hxx -> ncmpc-0.48.tar.xz/src/net/HostParser.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/net/IPv4Address.cxx -> ncmpc-0.48.tar.xz/src/net/IPv4Address.cxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "IPv4Address.hxx"
34
35
ncmpc-0.47.tar.xz/src/net/IPv4Address.hxx -> ncmpc-0.48.tar.xz/src/net/IPv4Address.hxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef IPV4_ADDRESS_HXX
34
#define IPV4_ADDRESS_HXX
35
ncmpc-0.47.tar.xz/src/net/IPv6Address.cxx -> ncmpc-0.48.tar.xz/src/net/IPv6Address.cxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "IPv6Address.hxx"
34
#include "IPv4Address.hxx"
35
ncmpc-0.47.tar.xz/src/net/IPv6Address.hxx -> ncmpc-0.48.tar.xz/src/net/IPv6Address.hxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef IPV6_ADDRESS_HXX
34
#define IPV6_ADDRESS_HXX
35
ncmpc-0.47.tar.xz/src/net/Resolver.cxx -> ncmpc-0.48.tar.xz/src/net/Resolver.cxx
Changed
64
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#include "Resolver.hxx"
38
#include "AddressInfo.hxx"
39
#include "HostParser.hxx"
40
#include "util/RuntimeError.hxx"
41
#include "util/CharUtil.hxx"
42
+#include "util/StringAPI.hxx"
43
44
#ifdef _WIN32
45
#include <ws2tcpip.h>
46
47
#include <net/if.h>
48
#endif
49
50
-#include <cstring>
51
-
52
#include <stdio.h>
53
54
AddressInfoList
55
56
} else
57
throw std::runtime_error("Garbage after host name");
58
59
- if (ai_is_passive(hints) && strcmp(host, "*") == 0)
60
+ if (ai_is_passive(hints) && StringIsEqual(host, "*"))
61
host = nullptr;
62
} else {
63
host = nullptr;
64
ncmpc-0.47.tar.xz/src/net/Resolver.hxx -> ncmpc-0.48.tar.xz/src/net/Resolver.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#ifndef NET_RESOLVER_HXX
38
#define NET_RESOLVER_HXX
39
ncmpc-0.47.tar.xz/src/net/SocketAddress.cxx -> ncmpc-0.48.tar.xz/src/net/SocketAddress.cxx
Changed
63
1
2
-/*
3
- * Copyright 2012-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "SocketAddress.hxx"
34
#include "IPv4Address.hxx"
35
36
}
37
}
38
39
-#ifdef __cpp_lib_span
40
-
41
static std::span<const std::byte>
42
GetSteadyPart(const struct sockaddr_in &address) noexcept
43
{
44
45
};
46
}
47
48
-#endif // __cpp_lib_span
49
-
50
#endif // HAVE_TCP
51
52
-#ifdef __cpp_lib_span
53
-
54
std::span<const std::byte>
55
SocketAddress::GetSteadyPart() const noexcept
56
{
57
58
return {};
59
}
60
}
61
-
62
-#endif
63
ncmpc-0.47.tar.xz/src/net/SocketAddress.hxx -> ncmpc-0.48.tar.xz/src/net/SocketAddress.hxx
Changed
95
1
2
-/*
3
- * Copyright 2012-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef SOCKET_ADDRESS_HXX
34
#define SOCKET_ADDRESS_HXX
35
36
#endif
37
38
#include <cstddef>
39
+#include <span>
40
41
#if __cplusplus >= 202002 || (defined(__GNUC__) && __GNUC__ >= 10)
42
#include <version>
43
#endif
44
45
-#ifdef __cpp_lib_span
46
-#include <span>
47
-#endif
48
-
49
#ifdef HAVE_UN
50
#include <string_view>
51
#endif
52
53
size_type _size) noexcept
54
:address(_address), size(_size) {}
55
56
-#ifdef __cpp_lib_span
57
explicit SocketAddress(std::span<const std::byte> src) noexcept
58
:address((const struct sockaddr *)(const void *)src.data()),
59
size(src.size()) {}
60
-#endif
61
62
static constexpr SocketAddress Null() noexcept {
63
return nullptr;
64
65
IPv4Address UnmapV4() const noexcept;
66
67
/**
68
+ * Does the address family support port numbers?
69
+ */
70
+ gnu::pure
71
+ bool HasPort() const noexcept {
72
+ return !IsNull() &&
73
+ (GetFamily() == AF_INET || GetFamily() == AF_INET6);
74
+ }
75
+
76
+ /**
77
* Extract the port number. Returns 0 if not applicable.
78
*/
79
gnu::pure
80
unsigned GetPort() const noexcept;
81
#endif
82
83
-#ifdef __cpp_lib_span
84
operator std::span<const std::byte>() const noexcept {
85
const void *q = reinterpret_cast<const void *>(address);
86
return {
87
88
*/
89
gnu::pure
90
std::span<const std::byte> GetSteadyPart() const noexcept;
91
-#endif
92
93
gnu::pure
94
bool operator==(const SocketAddress other) const noexcept;
95
ncmpc-0.47.tar.xz/src/net/SocketDescriptor.cxx -> ncmpc-0.48.tar.xz/src/net/SocketDescriptor.cxx
Changed
285
1
2
-/*
3
- * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "SocketDescriptor.hxx"
34
#include "SocketAddress.hxx"
35
36
#include "IPv6Address.hxx"
37
38
#ifdef _WIN32
39
-#include <winsock2.h>
40
#include <ws2tcpip.h>
41
#else
42
#include <sys/socket.h>
43
44
#endif
45
46
SocketDescriptor
47
-SocketDescriptor::Accept() noexcept
48
+SocketDescriptor::Accept() const noexcept
49
{
50
#ifdef __linux__
51
int connection_fd = ::accept4(Get(), nullptr, nullptr, SOCK_CLOEXEC);
52
53
}
54
55
bool
56
-SocketDescriptor::Connect(SocketAddress address) noexcept
57
+SocketDescriptor::Connect(SocketAddress address) const noexcept
58
{
59
assert(address.IsDefined());
60
61
62
#endif
63
64
int
65
-SocketDescriptor::GetError() noexcept
66
+SocketDescriptor::GetError() const noexcept
67
{
68
assert(IsDefined());
69
70
71
#ifdef _WIN32
72
73
bool
74
-SocketDescriptor::SetNonBlocking() noexcept
75
+SocketDescriptor::SetNonBlocking() const noexcept
76
{
77
u_long val = 1;
78
return ioctlsocket(fd, FIONBIO, &val) == 0;
79
80
81
bool
82
SocketDescriptor::SetOption(int level, int name,
83
- const void *value, std::size_t size) noexcept
84
+ const void *value, std::size_t size) const noexcept
85
{
86
assert(IsDefined());
87
88
89
}
90
91
bool
92
-SocketDescriptor::SetKeepAlive(bool value) noexcept
93
+SocketDescriptor::SetKeepAlive(bool value) const noexcept
94
{
95
return SetBoolOption(SOL_SOCKET, SO_KEEPALIVE, value);
96
}
97
98
bool
99
-SocketDescriptor::SetReuseAddress(bool value) noexcept
100
+SocketDescriptor::SetReuseAddress(bool value) const noexcept
101
{
102
return SetBoolOption(SOL_SOCKET, SO_REUSEADDR, value);
103
}
104
105
#ifdef __linux__
106
107
bool
108
-SocketDescriptor::SetReusePort(bool value) noexcept
109
+SocketDescriptor::SetReusePort(bool value) const noexcept
110
{
111
return SetBoolOption(SOL_SOCKET, SO_REUSEPORT, value);
112
}
113
114
bool
115
-SocketDescriptor::SetFreeBind(bool value) noexcept
116
+SocketDescriptor::SetFreeBind(bool value) const noexcept
117
{
118
return SetBoolOption(IPPROTO_IP, IP_FREEBIND, value);
119
}
120
121
bool
122
-SocketDescriptor::SetNoDelay(bool value) noexcept
123
+SocketDescriptor::SetNoDelay(bool value) const noexcept
124
{
125
return SetBoolOption(IPPROTO_TCP, TCP_NODELAY, value);
126
}
127
128
bool
129
-SocketDescriptor::SetCork(bool value) noexcept
130
+SocketDescriptor::SetCork(bool value) const noexcept
131
{
132
return SetBoolOption(IPPROTO_TCP, TCP_CORK, value);
133
}
134
135
bool
136
-SocketDescriptor::SetTcpDeferAccept(const int &seconds) noexcept
137
+SocketDescriptor::SetTcpDeferAccept(const int &seconds) const noexcept
138
{
139
return SetOption(IPPROTO_TCP, TCP_DEFER_ACCEPT, &seconds, sizeof(seconds));
140
}
141
142
bool
143
-SocketDescriptor::SetTcpUserTimeout(const unsigned &milliseconds) noexcept
144
+SocketDescriptor::SetTcpUserTimeout(const unsigned &milliseconds) const noexcept
145
{
146
return SetOption(IPPROTO_TCP, TCP_USER_TIMEOUT,
147
&milliseconds, sizeof(milliseconds));
148
}
149
150
bool
151
-SocketDescriptor::SetV6Only(bool value) noexcept
152
+SocketDescriptor::SetV6Only(bool value) const noexcept
153
{
154
return SetBoolOption(IPPROTO_IPV6, IPV6_V6ONLY, value);
155
}
156
157
bool
158
-SocketDescriptor::SetBindToDevice(const char *name) noexcept
159
+SocketDescriptor::SetBindToDevice(const char *name) const noexcept
160
{
161
return SetOption(SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name));
162
}
163
164
#ifdef TCP_FASTOPEN
165
166
bool
167
-SocketDescriptor::SetTcpFastOpen(int qlen) noexcept
168
+SocketDescriptor::SetTcpFastOpen(int qlen) const noexcept
169
{
170
return SetOption(SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen));
171
}
172
173
#endif
174
175
bool
176
-SocketDescriptor::AddMembership(const IPv4Address &address) noexcept
177
+SocketDescriptor::AddMembership(const IPv4Address &address) const noexcept
178
{
179
struct ip_mreq r{address.GetAddress(), IPv4Address(0).GetAddress()};
180
return setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
181
182
}
183
184
bool
185
-SocketDescriptor::AddMembership(const IPv6Address &address) noexcept
186
+SocketDescriptor::AddMembership(const IPv6Address &address) const noexcept
187
{
188
struct ipv6_mreq r{address.GetAddress(), 0};
189
r.ipv6mr_interface = address.GetScopeId();
190
191
}
192
193
bool
194
-SocketDescriptor::AddMembership(SocketAddress address) noexcept
195
+SocketDescriptor::AddMembership(SocketAddress address) const noexcept
196
{
197
switch (address.GetFamily()) {
198
case AF_INET:
199
200
#endif
201
202
bool
203
-SocketDescriptor::Bind(SocketAddress address) noexcept
204
+SocketDescriptor::Bind(SocketAddress address) const noexcept
205
{
206
return bind(Get(), address.GetAddress(), address.GetSize()) == 0;
207
}
208
209
#ifdef __linux__
210
211
bool
212
-SocketDescriptor::AutoBind() noexcept
213
+SocketDescriptor::AutoBind() const noexcept
214
{
215
static constexpr sa_family_t family = AF_LOCAL;
216
return Bind(SocketAddress((const struct sockaddr *)&family,
217
218
#endif
219
220
bool
221
-SocketDescriptor::Listen(int backlog) noexcept
222
+SocketDescriptor::Listen(int backlog) const noexcept
223
{
224
return listen(Get(), backlog) == 0;
225
}
226
227
}
228
229
ssize_t
230
-SocketDescriptor::Read(void *buffer, std::size_t length) noexcept
231
+SocketDescriptor::Read(void *buffer, std::size_t length) const noexcept
232
{
233
int flags = 0;
234
#ifndef _WIN32
235
236
}
237
238
ssize_t
239
-SocketDescriptor::Write(const void *buffer, std::size_t length) noexcept
240
+SocketDescriptor::Write(const void *buffer, std::size_t length) const noexcept
241
{
242
int flags = 0;
243
#ifdef __linux__
244
245
246
ssize_t
247
SocketDescriptor::Read(void *buffer, std::size_t length,
248
- StaticSocketAddress &address) noexcept
249
+ StaticSocketAddress &address) const noexcept
250
{
251
int flags = 0;
252
#ifndef _WIN32
253
254
255
ssize_t
256
SocketDescriptor::Write(const void *buffer, std::size_t length,
257
- SocketAddress address) noexcept
258
+ SocketAddress address) const noexcept
259
{
260
int flags = 0;
261
#ifndef _WIN32
262
263
#ifndef _WIN32
264
265
void
266
-SocketDescriptor::Shutdown() noexcept
267
+SocketDescriptor::Shutdown() const noexcept
268
{
269
shutdown(Get(), SHUT_RDWR);
270
}
271
272
void
273
-SocketDescriptor::ShutdownRead() noexcept
274
+SocketDescriptor::ShutdownRead() const noexcept
275
{
276
shutdown(Get(), SHUT_RD);
277
}
278
279
void
280
-SocketDescriptor::ShutdownWrite() noexcept
281
+SocketDescriptor::ShutdownWrite() const noexcept
282
{
283
shutdown(Get(), SHUT_WR);
284
}
285
ncmpc-0.47.tar.xz/src/net/SocketDescriptor.hxx -> ncmpc-0.48.tar.xz/src/net/SocketDescriptor.hxx
Changed
301
1
2
-/*
3
- * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef SOCKET_DESCRIPTOR_HXX
34
#define SOCKET_DESCRIPTOR_HXX
35
36
#include "Features.hxx"
37
+
38
+#ifndef _WIN32
39
#include "io/FileDescriptor.hxx"
40
+#endif
41
42
#include <type_traits>
43
+#include <utility>
44
+
45
+#ifdef _WIN32
46
+#include <winsock2.h> // for SOCKET, INVALID_SOCKET
47
+#endif
48
49
class SocketAddress;
50
class StaticSocketAddress;
51
52
class IPv6Address;
53
54
/**
55
- * An OO wrapper for a UNIX socket descriptor.
56
+ * An OO wrapper for a Berkeley or WinSock socket descriptor.
57
*/
58
-class SocketDescriptor : protected FileDescriptor {
59
+class SocketDescriptor
60
+#ifndef _WIN32
61
+/* Berkeley sockets are represented as file descriptors */
62
+ : protected FileDescriptor
63
+#endif
64
+{
65
protected:
66
+#ifdef _WIN32
67
+ /* WinSock sockets are not file descriptors, they are a
68
+ special type */
69
+ SOCKET fd;
70
+#else // !_WIN32
71
explicit constexpr SocketDescriptor(FileDescriptor _fd) noexcept
72
:FileDescriptor(_fd) {}
73
+#endif // !_WIN32
74
75
public:
76
SocketDescriptor() = default;
77
78
+#ifdef _WIN32
79
+ explicit constexpr SocketDescriptor(SOCKET _fd) noexcept
80
+ :fd(_fd) {}
81
+#else // !_WIN32
82
explicit constexpr SocketDescriptor(int _fd) noexcept
83
:FileDescriptor(_fd) {}
84
+#endif // !_WIN32
85
86
constexpr bool operator==(SocketDescriptor other) const noexcept {
87
return fd == other.fd;
88
}
89
90
-#ifndef _WIN32
91
+#ifdef _WIN32
92
+ constexpr bool IsDefined() const noexcept {
93
+ return fd != INVALID_SOCKET;
94
+ }
95
+#else // !_WIN32
96
/**
97
* Convert a #FileDescriptor to a #SocketDescriptor. This is only
98
* possible on operating systems where socket descriptors are the
99
100
constexpr const FileDescriptor &ToFileDescriptor() const noexcept {
101
return *this;
102
}
103
-#endif
104
105
using FileDescriptor::IsDefined;
106
-#ifndef _WIN32
107
using FileDescriptor::IsValid;
108
using FileDescriptor::IsSocket;
109
-#endif
110
+#endif // !_WIN32
111
112
/**
113
* Determine the socket type, i.e. SOCK_STREAM, SOCK_DGRAM or
114
115
gnu::pure
116
bool IsStream() const noexcept;
117
118
+ static constexpr SocketDescriptor Undefined() noexcept {
119
+#ifdef _WIN32
120
+ return SocketDescriptor{INVALID_SOCKET};
121
+#else // !_WIN32
122
+ return SocketDescriptor(FileDescriptor::Undefined());
123
+#endif // !_WIN32
124
+ }
125
+
126
+#ifndef _WIN32
127
using FileDescriptor::Get;
128
using FileDescriptor::Set;
129
using FileDescriptor::Steal;
130
using FileDescriptor::SetUndefined;
131
132
- static constexpr SocketDescriptor Undefined() noexcept {
133
- return SocketDescriptor(FileDescriptor::Undefined());
134
- }
135
-
136
using FileDescriptor::EnableCloseOnExec;
137
using FileDescriptor::DisableCloseOnExec;
138
139
-#ifndef _WIN32
140
using FileDescriptor::SetNonBlocking;
141
using FileDescriptor::SetBlocking;
142
using FileDescriptor::Duplicate;
143
using FileDescriptor::CheckDuplicate;
144
using FileDescriptor::Close;
145
#else
146
- bool SetNonBlocking() noexcept;
147
+ constexpr SOCKET Get() const noexcept {
148
+ return fd;
149
+ }
150
+
151
+ constexpr void Set(SOCKET _fd) noexcept {
152
+ fd = _fd;
153
+ }
154
+
155
+ constexpr void SetUndefined() noexcept {
156
+ fd = INVALID_SOCKET;
157
+ }
158
+
159
+ constexpr SOCKET Steal() noexcept {
160
+ return std::exchange(fd, INVALID_SOCKET);
161
+ }
162
+
163
+ void EnableCloseOnExec() const noexcept {}
164
+ void DisableCloseOnExec() const noexcept {}
165
+
166
+ bool SetNonBlocking() const noexcept;
167
168
/**
169
* This method replaces FileDescriptor::Close(), using closesocket()
170
171
SocketDescriptor &b) noexcept;
172
#endif
173
174
- int GetError() noexcept;
175
+ gnu::pure
176
+ int GetError() const noexcept;
177
178
/**
179
* @return the value size or 0 on error
180
181
#endif
182
183
bool SetOption(int level, int name,
184
- const void *value, std::size_t size) noexcept;
185
+ const void *value, std::size_t size) const noexcept;
186
187
- bool SetIntOption(int level, int name, const int &value) noexcept {
188
+ bool SetIntOption(int level, int name,
189
+ const int &value) const noexcept {
190
return SetOption(level, name, &value, sizeof(value));
191
}
192
193
- bool SetBoolOption(int level, int name, bool value) noexcept {
194
+ bool SetBoolOption(int level, int name, bool value) const noexcept {
195
return SetIntOption(level, name, value);
196
}
197
198
- bool SetKeepAlive(bool value=true) noexcept;
199
- bool SetReuseAddress(bool value=true) noexcept;
200
+ bool SetKeepAlive(bool value=true) const noexcept;
201
+ bool SetReuseAddress(bool value=true) const noexcept;
202
203
#ifdef __linux__
204
- bool SetReusePort(bool value=true) noexcept;
205
- bool SetFreeBind(bool value=true) noexcept;
206
- bool SetNoDelay(bool value=true) noexcept;
207
- bool SetCork(bool value=true) noexcept;
208
+ bool SetReusePort(bool value=true) const noexcept;
209
+ bool SetFreeBind(bool value=true) const noexcept;
210
+ bool SetNoDelay(bool value=true) const noexcept;
211
+ bool SetCork(bool value=true) const noexcept;
212
213
- bool SetTcpDeferAccept(const int &seconds) noexcept;
214
+ bool SetTcpDeferAccept(const int &seconds) const noexcept;
215
216
/**
217
* Setter for TCP_USER_TIMEOUT.
218
*/
219
- bool SetTcpUserTimeout(const unsigned &milliseconds) noexcept;
220
+ bool SetTcpUserTimeout(const unsigned &milliseconds) const noexcept;
221
222
- bool SetV6Only(bool value) noexcept;
223
+ bool SetV6Only(bool value) const noexcept;
224
225
/**
226
* Setter for SO_BINDTODEVICE.
227
*/
228
- bool SetBindToDevice(const char *name) noexcept;
229
+ bool SetBindToDevice(const char *name) const noexcept;
230
231
- bool SetTcpFastOpen(int qlen=16) noexcept;
232
+ bool SetTcpFastOpen(int qlen=16) const noexcept;
233
234
- bool AddMembership(const IPv4Address &address) noexcept;
235
- bool AddMembership(const IPv6Address &address) noexcept;
236
- bool AddMembership(SocketAddress address) noexcept;
237
+ bool AddMembership(const IPv4Address &address) const noexcept;
238
+ bool AddMembership(const IPv6Address &address) const noexcept;
239
+ bool AddMembership(SocketAddress address) const noexcept;
240
#endif
241
242
- bool Bind(SocketAddress address) noexcept;
243
+ bool Bind(SocketAddress address) const noexcept;
244
245
#ifdef __linux__
246
/**
247
* Binds the socket to a unique abstract address.
248
*/
249
- bool AutoBind() noexcept;
250
+ bool AutoBind() const noexcept;
251
#endif
252
253
- bool Listen(int backlog) noexcept;
254
+ bool Listen(int backlog) const noexcept;
255
256
- SocketDescriptor Accept() noexcept;
257
+ SocketDescriptor Accept() const noexcept;
258
SocketDescriptor AcceptNonBlock() const noexcept;
259
SocketDescriptor AcceptNonBlock(StaticSocketAddress &address) const noexcept;
260
261
- bool Connect(SocketAddress address) noexcept;
262
+ bool Connect(SocketAddress address) const noexcept;
263
264
gnu::pure
265
StaticSocketAddress GetLocalAddress() const noexcept;
266
267
gnu::pure
268
StaticSocketAddress GetPeerAddress() const noexcept;
269
270
- ssize_t Read(void *buffer, std::size_t length) noexcept;
271
- ssize_t Write(const void *buffer, std::size_t length) noexcept;
272
+ ssize_t Read(void *buffer, std::size_t length) const noexcept;
273
+ ssize_t Write(const void *buffer, std::size_t length) const noexcept;
274
275
#ifdef _WIN32
276
int WaitReadable(int timeout_ms) const noexcept;
277
278
* Receive a datagram and return the source address.
279
*/
280
ssize_t Read(void *buffer, std::size_t length,
281
- StaticSocketAddress &address) noexcept;
282
+ StaticSocketAddress &address) const noexcept;
283
284
/**
285
* Send a datagram to the specified address.
286
*/
287
ssize_t Write(const void *buffer, std::size_t length,
288
- SocketAddress address) noexcept;
289
+ SocketAddress address) const noexcept;
290
291
#ifndef _WIN32
292
- void Shutdown() noexcept;
293
- void ShutdownRead() noexcept;
294
- void ShutdownWrite() noexcept;
295
+ void Shutdown() const noexcept;
296
+ void ShutdownRead() const noexcept;
297
+ void ShutdownWrite() const noexcept;
298
#endif
299
};
300
301
ncmpc-0.47.tar.xz/src/net/SocketError.cxx -> ncmpc-0.48.tar.xz/src/net/SocketError.cxx
Changed
35
1
2
-/*
3
- * Copyright 2015-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "SocketError.hxx"
34
35
ncmpc-0.47.tar.xz/src/net/SocketError.hxx -> ncmpc-0.48.tar.xz/src/net/SocketError.hxx
Changed
35
1
2
-/*
3
- * Copyright 2015-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#pragma once
34
35
ncmpc-0.47.tar.xz/src/net/StaticSocketAddress.cxx -> ncmpc-0.48.tar.xz/src/net/StaticSocketAddress.cxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "StaticSocketAddress.hxx"
34
#include "IPv4Address.hxx"
35
ncmpc-0.47.tar.xz/src/net/StaticSocketAddress.hxx -> ncmpc-0.48.tar.xz/src/net/StaticSocketAddress.hxx
Changed
35
1
2
-/*
3
- * Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef STATIC_SOCKET_ADDRESS_HXX
34
#define STATIC_SOCKET_ADDRESS_HXX
35
ncmpc-0.47.tar.xz/src/net/UniqueSocketDescriptor.hxx -> ncmpc-0.48.tar.xz/src/net/UniqueSocketDescriptor.hxx
Changed
56
1
2
-/*
3
- * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef UNIQUE_SOCKET_DESCRIPTOR_SOCKET_HXX
34
#define UNIQUE_SOCKET_DESCRIPTOR_SOCKET_HXX
35
36
37
explicit UniqueSocketDescriptor(SocketDescriptor _fd) noexcept
38
:SocketDescriptor(_fd) {}
39
+#ifndef _WIN32
40
explicit UniqueSocketDescriptor(FileDescriptor _fd) noexcept
41
:SocketDescriptor(_fd) {}
42
+#endif // !_WIN32
43
explicit UniqueSocketDescriptor(int _fd) noexcept
44
:SocketDescriptor(_fd) {}
45
46
+#ifdef _WIN32
47
+ UniqueSocketDescriptor(UniqueSocketDescriptor &&other) noexcept
48
+ :SocketDescriptor(std::exchange(other.fd, INVALID_SOCKET)) {}
49
+#else // !_WIN32
50
UniqueSocketDescriptor(UniqueSocketDescriptor &&other) noexcept
51
:SocketDescriptor(std::exchange(other.fd, -1)) {}
52
+#endif // !_WIN32
53
54
~UniqueSocketDescriptor() noexcept {
55
if (IsDefined())
56
ncmpc-0.47.tar.xz/src/paint.hxx -> ncmpc-0.48.tar.xz/src/paint.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_PAINT_H
23
#define NCMPC_PAINT_H
24
ncmpc-0.47.tar.xz/src/player_command.cxx -> ncmpc-0.48.tar.xz/src/player_command.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "player_command.hxx"
23
#include "DelayedSeek.hxx"
24
ncmpc-0.47.tar.xz/src/player_command.hxx -> ncmpc-0.48.tar.xz/src/player_command.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_PLAYER_COMMAND_H
23
#define NCMPC_PLAYER_COMMAND_H
24
ncmpc-0.47.tar.xz/src/plugin.cxx -> ncmpc-0.48.tar.xz/src/plugin.cxx
Changed
71
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "plugin.hxx"
23
#include "io/Path.hxx"
24
25
26
#include <assert.h>
27
#include <stdlib.h>
28
+#include <spawn.h>
29
#include <unistd.h>
30
#include <dirent.h>
31
#include <signal.h>
32
33
!UniqueFileDescriptor::CreatePipe(stderr_r, stderr_w))
34
return -1;
35
36
- pid = fork();
37
-
38
- if (pid < 0)
39
- return -1;
40
-
41
- if (pid == 0) {
42
- stdout_w.Duplicate(FileDescriptor(STDOUT_FILENO));
43
- stderr_w.Duplicate(FileDescriptor(STDERR_FILENO));
44
+ posix_spawn_file_actions_t file_actions;
45
+ posix_spawn_file_actions_init(&file_actions);
46
+ AtScopeExit(&file_actions) { posix_spawn_file_actions_destroy(&file_actions); };
47
48
- stdout_r.Close();
49
- stdout_w.Close();
50
- stderr_r.Close();
51
- stderr_w.Close();
52
- close(0);
53
- /* XXX close other fds? */
54
+ posix_spawn_file_actions_addclose(&file_actions, STDIN_FILENO);
55
+ posix_spawn_file_actions_adddup2(&file_actions, stdout_w.Get(),
56
+ STDOUT_FILENO);
57
+ posix_spawn_file_actions_adddup2(&file_actions, stderr_w.Get(),
58
+ STDERR_FILENO);
59
60
- execv(plugin_path, argv.get());
61
- _exit(1);
62
- }
63
-
64
- /* XXX CLOEXEC? */
65
+ if (posix_spawn(&pid, plugin_path, &file_actions, nullptr,
66
+ argv.get(), environ) != 0)
67
+ return -1;
68
69
pipe_stdout.Start(std::move(stdout_r));
70
pipe_stderr.Start(std::move(stderr_r));
71
ncmpc-0.47.tar.xz/src/plugin.hxx -> ncmpc-0.48.tar.xz/src/plugin.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef PLUGIN_H
23
#define PLUGIN_H
24
ncmpc-0.47.tar.xz/src/save_playlist.cxx -> ncmpc-0.48.tar.xz/src/save_playlist.cxx
Changed
81
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "save_playlist.hxx"
23
#include "db_completion.hxx"
24
25
#ifndef NCMPC_MINI
26
27
class PlaylistNameCompletion final : public Completion {
28
+ ScreenManager &screen;
29
struct mpdclient &c;
30
31
public:
32
- explicit PlaylistNameCompletion(struct mpdclient &_c) noexcept
33
- :c(_c) {}
34
+ PlaylistNameCompletion(ScreenManager &_screen,
35
+ struct mpdclient &_c) noexcept
36
+ :screen(_screen), c(_c) {}
37
38
protected:
39
/* virtual methods from class Completion */
40
41
{
42
if (range.begin() != range.end() &&
43
std::next(range.begin()) != range.end())
44
- screen_display_completion_list(range);
45
+ screen_display_completion_list(screen, range);
46
}
47
48
#endif
49
50
int
51
-playlist_save(struct mpdclient *c, const char *name,
52
+playlist_save(ScreenManager &screen, struct mpdclient *c,
53
+ const char *name,
54
const char *defaultname) noexcept
55
{
56
std::string filename;
57
58
Completion *completion = nullptr;
59
#else
60
/* initialize completion support */
61
- PlaylistNameCompletion _completion(*c);
62
+ PlaylistNameCompletion _completion{screen, *c};
63
auto *completion = &_completion;
64
#endif
65
66
/* query the user for a filename */
67
- filename = screen_readln(_("Save queue as"),
68
+ filename = screen_readln(screen, _("Save queue as"),
69
defaultname,
70
nullptr,
71
completion);
72
73
char prompt256;
74
snprintf(prompt, sizeof(prompt),
75
_("Replace %s?"), filename.c_str());
76
- bool replace = screen_get_yesno(prompt, false);
77
+ bool replace = screen_get_yesno(screen, prompt, false);
78
if (!replace) {
79
screen_status_message(_("Aborted"));
80
return -1;
81
ncmpc-0.47.tar.xz/src/save_playlist.hxx -> ncmpc-0.48.tar.xz/src/save_playlist.hxx
Changed
35
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef SAVE_PLAYLIST_H
23
#define SAVE_PLAYLIST_H
24
25
+class ScreenManager;
26
struct mpdclient;
27
28
int
29
-playlist_save(struct mpdclient *c, const char *name,
30
+playlist_save(ScreenManager &screen, struct mpdclient *c,
31
+ const char *name,
32
const char *defaultname) noexcept;
33
34
#endif
35
ncmpc-0.47.tar.xz/src/screen.cxx -> ncmpc-0.48.tar.xz/src/screen.cxx
Changed
46
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen.hxx"
23
#include "PageMeta.hxx"
24
25
#include "player_command.hxx"
26
#include "SongPage.hxx"
27
#include "LyricsPage.hxx"
28
+#include "util/StringAPI.hxx"
29
30
#include <mpd/client.h>
31
32
-#include <string.h>
33
-
34
ScreenManager::PageMap::iterator
35
ScreenManager::MakePage(const PageMeta &sf) noexcept
36
{
37
38
unsigned i;
39
40
for (i = 0; i < options.screen_list.size(); ++i)
41
- if (strcmp(options.screen_listi.c_str(), name) == 0)
42
+ if (StringIsEqual(options.screen_listi.c_str(), name))
43
return i;
44
45
return -1;
46
ncmpc-0.47.tar.xz/src/screen.hxx -> ncmpc-0.48.tar.xz/src/screen.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef SCREEN_H
23
#define SCREEN_H
24
ncmpc-0.47.tar.xz/src/screen_client.cxx -> ncmpc-0.48.tar.xz/src/screen_client.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen_client.hxx"
23
#include "screen_status.hxx"
24
ncmpc-0.47.tar.xz/src/screen_client.hxx -> ncmpc-0.48.tar.xz/src/screen_client.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_SCREEN_CLIENT_H
23
#define NCMPC_SCREEN_CLIENT_H
24
ncmpc-0.47.tar.xz/src/screen_find.cxx -> ncmpc-0.48.tar.xz/src/screen_find.cxx
Changed
42
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen_find.hxx"
23
#include "screen_utils.hxx"
24
25
if (screen.findbuf.empty()) {
26
char *value = options.find_show_last_pattern
27
? (char *) -1 : nullptr;
28
- screen.findbuf=screen_readln(prompt,
29
+ screen.findbuf=screen_readln(screen, prompt,
30
value,
31
&screen.find_history,
32
nullptr);
33
34
char *iter = search_str;
35
36
while(1) {
37
- key = screen_getch(buffer);
38
+ key = screen_getch(screen, buffer);
39
/* if backspace or delete was pressed, process instead of ending loop */
40
if (key == KEY_BACKSPACE || key == KEY_DC) {
41
const char *prev = PrevCharMB(buffer, iter);
42
ncmpc-0.47.tar.xz/src/screen_find.hxx -> ncmpc-0.48.tar.xz/src/screen_find.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_SCREEN_FIND_H
23
#define NCMPC_SCREEN_FIND_H
24
ncmpc-0.47.tar.xz/src/screen_init.cxx -> ncmpc-0.48.tar.xz/src/screen_init.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen.hxx"
23
#include "Page.hxx"
24
ncmpc-0.47.tar.xz/src/screen_list.cxx -> ncmpc-0.48.tar.xz/src/screen_list.cxx
Changed
47
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen_list.hxx"
23
#include "PageMeta.hxx"
24
25
#include "OutputsPage.hxx"
26
#include "ChatPage.hxx"
27
#include "config.h"
28
+#include "util/StringAPI.hxx"
29
30
#include <iterator>
31
32
33
screen_lookup_name(const char *name) noexcept
34
{
35
for (const auto *i : screens)
36
- if (strcmp(name, i->name) == 0)
37
+ if (StringIsEqual(name, i->name))
38
return i;
39
40
#ifdef ENABLE_LIBRARY_PAGE
41
/* compatibility with 0.32 and older */
42
- if (strcmp(name, "artist") == 0)
43
+ if (StringIsEqual(name, "artist"))
44
return &library_page;
45
#endif
46
47
ncmpc-0.47.tar.xz/src/screen_list.hxx -> ncmpc-0.48.tar.xz/src/screen_list.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef SCREEN_LIST_H
23
#define SCREEN_LIST_H
24
ncmpc-0.47.tar.xz/src/screen_paint.cxx -> ncmpc-0.48.tar.xz/src/screen_paint.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen.hxx"
23
#include "Page.hxx"
24
ncmpc-0.47.tar.xz/src/screen_status.cxx -> ncmpc-0.48.tar.xz/src/screen_status.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen_status.hxx"
23
#include "screen.hxx"
24
ncmpc-0.47.tar.xz/src/screen_status.hxx -> ncmpc-0.48.tar.xz/src/screen_status.hxx
Changed
39
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef NCMPC_SCREEN_STATUS_H
23
#define NCMPC_SCREEN_STATUS_H
24
25
-#include "util/Compiler.h"
26
-
27
#include <exception>
28
29
void
30
screen_status_message(const char *msg) noexcept;
31
32
-gcc_printf(1, 2)
33
+#ifdef __GNUC__
34
+__attribute__((format(printf, 1, 2)))
35
+#endif
36
void
37
screen_status_printf(const char *format, ...) noexcept;
38
39
ncmpc-0.47.tar.xz/src/screen_utils.cxx -> ncmpc-0.48.tar.xz/src/screen_utils.cxx
Changed
118
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "screen_utils.hxx"
23
#include "screen.hxx"
24
25
#include "Options.hxx"
26
#include "Styles.hxx"
27
#include "wreadln.hxx"
28
-#include "ncmpc.hxx"
29
#include "config.h"
30
31
#ifndef _WIN32
32
33
}
34
35
int
36
-screen_getch(const char *prompt) noexcept
37
+screen_getch(ScreenManager &screen, const char *prompt) noexcept
38
{
39
- WINDOW *w = screen->status_bar.GetWindow().w;
40
+ WINDOW *w = screen.status_bar.GetWindow().w;
41
42
SelectStyle(w, Style::STATUS_ALERT);
43
werase(w);
44
45
}
46
47
bool
48
-screen_get_yesno(const char *_prompt, bool def) noexcept
49
+screen_get_yesno(ScreenManager &screen, const char *_prompt, bool def) noexcept
50
{
51
/* NOTE: if one day a translator decides to use a multi-byte character
52
for one of the yes/no keys, we'll have to parse it properly */
53
54
snprintf(prompt, sizeof(prompt),
55
"%s %s/%s ", _prompt,
56
YES_TRANSLATION, NO_TRANSLATION);
57
- int key = tolower(screen_getch(prompt));
58
+ int key = tolower(screen_getch(screen, prompt));
59
if (key == YES_TRANSLATION0)
60
return true;
61
else if (key == NO_TRANSLATION0)
62
63
}
64
65
std::string
66
-screen_readln(const char *prompt,
67
+screen_readln(ScreenManager &screen, const char *prompt,
68
const char *value,
69
History *history,
70
Completion *completion) noexcept
71
{
72
- auto *window = &screen->status_bar.GetWindow();
73
+ auto *window = &screen.status_bar.GetWindow();
74
WINDOW *w = window->w;
75
76
wmove(w, 0,0);
77
78
}
79
80
std::string
81
-screen_read_password(const char *prompt) noexcept
82
+screen_read_password(ScreenManager &screen, const char *prompt) noexcept
83
{
84
- auto *window = &screen->status_bar.GetWindow();
85
+ auto *window = &screen.status_bar.GetWindow();
86
WINDOW *w = window->w;
87
88
wmove(w, 0,0);
89
90
}
91
92
void
93
-screen_display_completion_list(Completion::Range range) noexcept
94
+screen_display_completion_list(ScreenManager &screen, Completion::Range range) noexcept
95
{
96
static Completion::Range prev_range;
97
static size_t prev_length = 0;
98
static unsigned offset = 0;
99
- WINDOW *w = screen->main_window.w;
100
+ WINDOW *w = screen.main_window.w;
101
102
size_t length = std::distance(range.begin(), range.end());
103
if (range == prev_range && length == prev_length) {
104
- offset += screen->main_window.size.height;
105
+ offset += screen.main_window.size.height;
106
if (offset >= length)
107
offset = 0;
108
} else {
109
110
SelectStyle(w, Style::STATUS_ALERT);
111
112
auto i = std::next(range.begin(), offset);
113
- for (unsigned y = 0; y < screen->main_window.size.height; ++y, ++i) {
114
+ for (unsigned y = 0; y < screen.main_window.size.height; ++y, ++i) {
115
wmove(w, y, 0);
116
if (i == range.end())
117
break;
118
ncmpc-0.47.tar.xz/src/screen_utils.hxx -> ncmpc-0.48.tar.xz/src/screen_utils.hxx
Changed
64
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef SCREEN_UTILS_H
23
#define SCREEN_UTILS_H
24
25
#include "History.hxx"
26
#include "Completion.hxx"
27
28
+class ScreenManager;
29
+
30
/* sound an audible and/or visible bell */
31
void
32
screen_bell() noexcept;
33
34
/* read a character from the status window */
35
int
36
-screen_getch(const char *prompt) noexcept;
37
+screen_getch(ScreenManager &screen, const char *prompt) noexcept;
38
39
/**
40
* display a prompt, wait for the user to press a key, and compare it with
41
42
* pressed the key for "no"; def otherwise
43
*/
44
bool
45
-screen_get_yesno(const char *prompt, bool def) noexcept;
46
+screen_get_yesno(ScreenManager &screen, const char *prompt, bool def) noexcept;
47
48
std::string
49
-screen_read_password(const char *prompt) noexcept;
50
+screen_read_password(ScreenManager &screen, const char *prompt) noexcept;
51
52
std::string
53
-screen_readln(const char *prompt, const char *value,
54
+screen_readln(ScreenManager &screen, const char *prompt,
55
+ const char *value,
56
History *history, Completion *completion) noexcept;
57
58
void
59
-screen_display_completion_list(Completion::Range range) noexcept;
60
+screen_display_completion_list(ScreenManager &screen,
61
+ Completion::Range range) noexcept;
62
63
#endif
64
ncmpc-0.47.tar.xz/src/signals.cxx -> ncmpc-0.48.tar.xz/src/signals.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include <signal.h>
23
#include "Instance.hxx"
24
ncmpc-0.47.tar.xz/src/strfsong.cxx -> ncmpc-0.48.tar.xz/src/strfsong.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "strfsong.hxx"
23
#include "charset.hxx"
24
ncmpc-0.47.tar.xz/src/strfsong.hxx -> ncmpc-0.48.tar.xz/src/strfsong.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef STRFSONG_H
23
#define STRFSONG_H
24
ncmpc-0.47.tar.xz/src/system/EpollFD.cxx -> ncmpc-0.48.tar.xz/src/system/EpollFD.cxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "EpollFD.hxx"
34
#include "Error.hxx"
35
ncmpc-0.47.tar.xz/src/system/EpollFD.hxx -> ncmpc-0.48.tar.xz/src/system/EpollFD.hxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef EPOLL_FD_HXX
34
#define EPOLL_FD_HXX
35
ncmpc-0.47.tar.xz/src/system/Error.hxx -> ncmpc-0.48.tar.xz/src/system/Error.hxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#pragma once
34
35
ncmpc-0.47.tar.xz/src/system/EventFD.cxx -> ncmpc-0.48.tar.xz/src/system/EventFD.cxx
Changed
46
1
2
-/*
3
- * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "EventFD.hxx"
34
#include "system/Error.hxx"
35
36
#include <sys/eventfd.h>
37
38
EventFD::EventFD()
39
+ :fd(::eventfd(0, EFD_NONBLOCK|EFD_CLOEXEC))
40
{
41
- if (!fd.CreateEventFD(0))
42
+ if (!fd.IsDefined())
43
throw MakeErrno("eventfd() failed");
44
}
45
46
ncmpc-0.47.tar.xz/src/system/EventFD.hxx -> ncmpc-0.48.tar.xz/src/system/EventFD.hxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef EVENT_FD_HXX
34
#define EVENT_FD_HXX
35
ncmpc-0.47.tar.xz/src/system/EventPipe.cxx -> ncmpc-0.48.tar.xz/src/system/EventPipe.cxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#include "EventPipe.hxx"
24
#include "io/FileDescriptor.hxx"
25
ncmpc-0.47.tar.xz/src/system/EventPipe.hxx -> ncmpc-0.48.tar.xz/src/system/EventPipe.hxx
Changed
25
1
2
-/*
3
- * Copyright 2003-2021 The Music Player Daemon Project
4
- * http://www.musicpd.org
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
- */
20
+// SPDX-License-Identifier: GPL-2.0-or-later
21
+// Copyright The Music Player Daemon Project
22
23
#ifndef MPD_EVENT_PIPE_HXX
24
#define MPD_EVENT_PIPE_HXX
25
ncmpc-0.47.tar.xz/src/system/SignalFD.cxx -> ncmpc-0.48.tar.xz/src/system/SignalFD.cxx
Changed
52
1
2
-/*
3
- * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "SignalFD.hxx"
34
#include "Error.hxx"
35
36
void
37
SignalFD::Create(const sigset_t &mask)
38
{
39
- if (!fd.CreateSignalFD(&mask))
40
+ int new_fd = ::signalfd(fd.Get(), &mask, SFD_NONBLOCK|SFD_CLOEXEC);
41
+ if (new_fd < 0)
42
throw MakeErrno("signalfd() failed");
43
+
44
+ if (!fd.IsDefined()) {
45
+ fd = UniqueFileDescriptor{new_fd};
46
+ }
47
+
48
+ assert(new_fd == fd.Get());
49
}
50
51
int
52
ncmpc-0.47.tar.xz/src/system/SignalFD.hxx -> ncmpc-0.48.tar.xz/src/system/SignalFD.hxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef SIGNAL_FD_HXX
34
#define SIGNAL_FD_HXX
35
ncmpc-0.47.tar.xz/src/time/ClockCache.hxx -> ncmpc-0.48.tar.xz/src/time/ClockCache.hxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/time_format.cxx -> ncmpc-0.48.tar.xz/src/time_format.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "time_format.hxx"
23
#include "i18n.h"
24
ncmpc-0.47.tar.xz/src/time_format.hxx -> ncmpc-0.48.tar.xz/src/time_format.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef TIME_FORMAT_H
23
#define TIME_FORMAT_H
24
ncmpc-0.47.tar.xz/src/util/BindMethod.hxx -> ncmpc-0.48.tar.xz/src/util/BindMethod.hxx
Changed
35
1
2
-/*
3
- * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#pragma once
34
35
ncmpc-0.47.tar.xz/src/util/ByteOrder.hxx -> ncmpc-0.48.tar.xz/src/util/ByteOrder.hxx
Changed
139
1
2
-/*
3
- * Copyright 2011-2021 Max Kellermann <max.kellermann@gmail.com>,
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
-
31
-#ifndef BYTE_ORDER_HXX
32
-#define BYTE_ORDER_HXX
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// author: Max Kellermann <max.kellermann@gmail.com>
35
36
-#include "Compiler.h"
37
+#pragma once
38
39
#include <cstdint>
40
41
42
constexpr uint16_t
43
ByteSwap16(uint16_t value) noexcept
44
{
45
-#if CLANG_OR_GCC_VERSION(4,8)
46
+#ifdef __GNUC__
47
return __builtin_bswap16(value);
48
#else
49
return GenericByteSwap16(value);
50
51
constexpr uint32_t
52
ByteSwap32(uint32_t value) noexcept
53
{
54
-#if CLANG_OR_GCC_VERSION(4,3)
55
+#ifdef __GNUC__
56
return __builtin_bswap32(value);
57
#else
58
return GenericByteSwap32(value);
59
60
constexpr uint64_t
61
ByteSwap64(uint64_t value) noexcept
62
{
63
-#if CLANG_OR_GCC_VERSION(4,3)
64
+#ifdef __GNUC__
65
return __builtin_bswap64(value);
66
#else
67
return GenericByteSwap64(value);
68
69
(uint32_t(c) << 8) | uint32_t(d);
70
}
71
72
- PackedBE32 &operator=(uint32_t new_value) noexcept {
73
- d = uint8_t(new_value);
74
- c = uint8_t(new_value >> 8);
75
- b = uint8_t(new_value >> 16);
76
- a = uint8_t(new_value >> 24);
77
- return *this;
78
- }
79
-
80
/**
81
* Reads the raw, big-endian value.
82
*/
83
84
static_assert(sizeof(PackedLE32) == sizeof(uint32_t), "Wrong size");
85
static_assert(alignof(PackedLE32) == 1, "Wrong alignment");
86
87
-#endif
88
+/**
89
+ * A packed little-endian 64 bit integer.
90
+ */
91
+class PackedLE64 {
92
+ uint8_t a, b, c, d, e, f, g, h;
93
+
94
+public:
95
+ PackedLE64() = default;
96
+
97
+ constexpr PackedLE64(uint64_t src) noexcept
98
+ :a(uint8_t(src)),
99
+ b(uint8_t(src >> 8)),
100
+ c(uint8_t(src >> 16)),
101
+ d(uint8_t(src >> 24)),
102
+ e(uint8_t(src >> 32)),
103
+ f(uint8_t(src >> 40)),
104
+ g(uint8_t(src >> 48)),
105
+ h(uint8_t(src >> 56)) {}
106
+
107
+ /**
108
+ * Construct an instance from an integer which is already
109
+ * little-endian.
110
+ */
111
+ static constexpr auto FromLE(uint64_t src) noexcept {
112
+ union {
113
+ uint64_t in;
114
+ PackedLE64 out;
115
+ } u{src};
116
+ return u.out;
117
+ }
118
+
119
+ constexpr operator uint64_t() const noexcept {
120
+ return uint64_t(a) | (uint64_t(b) << 8) |
121
+ (uint64_t(c) << 16) | (uint64_t(d) << 24) |
122
+ (uint64_t(e) << 32) | (uint64_t(f) << 40) |
123
+ (uint64_t(g) << 48) | (uint64_t(h) << 56);
124
+ }
125
+
126
+ /**
127
+ * Reads the raw, big-endian value.
128
+ */
129
+ constexpr uint64_t raw() const noexcept {
130
+ uint64_t x = *this;
131
+ if (IsBigEndian())
132
+ x = ByteSwap64(x);
133
+ return x;
134
+ }
135
+};
136
+
137
+static_assert(sizeof(PackedLE64) == sizeof(uint64_t), "Wrong size");
138
+static_assert(alignof(PackedLE64) == 1, "Wrong alignment");
139
ncmpc-0.47.tar.xz/src/util/Cancellable.hxx -> ncmpc-0.48.tar.xz/src/util/Cancellable.hxx
Changed
35
1
2
-/*
3
- * Copyright 2016-2019 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef CANCELLABLE_HXX
34
#define CANCELLABLE_HXX
35
ncmpc-0.47.tar.xz/src/util/Cast.hxx -> ncmpc-0.48.tar.xz/src/util/Cast.hxx
Changed
35
1
2
-/*
3
- * Copyright (C) 2013-2014 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef CAST_HXX
34
#define CAST_HXX
35
ncmpc-0.47.tar.xz/src/util/CharUtil.hxx -> ncmpc-0.48.tar.xz/src/util/CharUtil.hxx
Changed
48
1
2
-/*
3
- * Copyright 2011-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef CHAR_UTIL_HXX
34
#define CHAR_UTIL_HXX
35
36
return IsAlphaASCII(ch) || IsDigitASCII(ch);
37
}
38
39
+constexpr bool
40
+IsLowerAlphaNumericASCII(char ch) noexcept
41
+{
42
+ return IsLowerAlphaASCII(ch) || IsDigitASCII(ch);
43
+}
44
+
45
/**
46
* Convert the specified ASCII character (0x00..0x7f) to upper case.
47
* Unlike toupper(), it ignores the system locale.
48
ncmpc-0.48.tar.xz/src/util/Concepts.hxx
Added
39
1
2
+// SPDX-License-Identifier: BSD-2-Clause
3
+// author: Max Kellermann <max.kellermann@gmail.com>
4
+
5
+#pragma once
6
+
7
+#include <concepts>
8
+
9
+/**
10
+ * Compatibility wrapper for std::invocable which is unavailable in
11
+ * the Android NDK r25b and Apple Xcode.
12
+ */
13
+#if !defined(ANDROID) && !defined(__APPLE__)
14
+template<typename F, typename... Args>
15
+concept Invocable = std::invocable<F, Args...>;
16
+#else
17
+template<typename F, typename... Args>
18
+concept Invocable = requires(F f, Args... args) {
19
+ { f(args...) };
20
+};
21
+#endif
22
+
23
+/**
24
+ * Compatibility wrapper for std::predicate which is unavailable in
25
+ * the Android NDK r25b and Apple Xcode.
26
+ */
27
+#if !defined(ANDROID) && !defined(__APPLE__)
28
+template<typename F, typename... Args>
29
+concept Predicate = std::predicate<F, Args...>;
30
+#else
31
+template<typename F, typename... Args>
32
+concept Predicate = requires(F f, Args... args) {
33
+ { f(args...) } -> std::same_as<bool>;
34
+};
35
+#endif
36
+
37
+template<typename F, typename T>
38
+concept Disposer = Invocable<F, T *>;
39
ncmpc-0.47.tar.xz/src/util/Exception.cxx -> ncmpc-0.48.tar.xz/src/util/Exception.cxx
Changed
35
1
2
-/*
3
- * Copyright 2016-2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "Exception.hxx"
34
35
ncmpc-0.47.tar.xz/src/util/Exception.hxx -> ncmpc-0.48.tar.xz/src/util/Exception.hxx
Changed
35
1
2
-/*
3
- * Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef EXCEPTION_HXX
34
#define EXCEPTION_HXX
35
ncmpc-0.47.tar.xz/src/util/FNVHash.hxx -> ncmpc-0.48.tar.xz/src/util/FNVHash.hxx
Changed
53
1
2
-/*
3
- * Copyright 2017 Content Management AG
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
/*
38
* Implementation of the Fowler-Noll-Vo hash function.
39
*/
40
41
-#ifndef FNV_HASH_HXX
42
-#define FNV_HASH_HXX
43
+#pragma once
44
45
#include <stddef.h>
46
#include <stdint.h>
47
48
const uint_fast32_t hi(h64 >> 32);
49
return lo ^ hi;
50
}
51
-
52
-#endif
53
ncmpc-0.48.tar.xz/src/util/IntrusiveHookMode.hxx
Added
32
1
2
+// SPDX-License-Identifier: BSD-2-Clause
3
+// author: Max Kellermann <max.kellermann@gmail.com>
4
+
5
+#pragma once
6
+
7
+/**
8
+ * Specifies the mode in which a hook for intrusive containers
9
+ * operates. This is meant to be used as a template argument to the
10
+ * hook class (e.g. #IntrusiveListHook).
11
+ */
12
+enum class IntrusiveHookMode {
13
+ /**
14
+ * No implicit initialization.
15
+ */
16
+ NORMAL,
17
+
18
+ /**
19
+ * Keep track of whether the item is currently linked, allows
20
+ * using method is_linked(). This requires implicit
21
+ * initialization and requires iterating all items when
22
+ * deleting them which adds a considerable amount of overhead.
23
+ */
24
+ TRACK,
25
+
26
+ /**
27
+ * Automatically unlinks the item in the destructor. This
28
+ * implies #TRACK and adds code to the destructor.
29
+ */
30
+ AUTO_UNLINK,
31
+};
32
ncmpc-0.47.tar.xz/src/util/IntrusiveList.hxx -> ncmpc-0.48.tar.xz/src/util/IntrusiveList.hxx
Changed
574
1
2
-/*
3
- * Copyright 2020 Max Kellermann <max.kellermann@gmail.com>
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// author: Max Kellermann <max.kellermann@gmail.com>
35
36
#pragma once
37
38
#include "Cast.hxx"
39
+#include "Concepts.hxx"
40
+#include "IntrusiveHookMode.hxx"
41
#include "MemberPointer.hxx"
42
#include "OptionalCounter.hxx"
43
44
45
46
struct IntrusiveListNode {
47
IntrusiveListNode *next, *prev;
48
+
49
+ static constexpr void Connect(IntrusiveListNode &a,
50
+ IntrusiveListNode &b) noexcept {
51
+ a.next = &b;
52
+ b.prev = &a;
53
+ }
54
};
55
56
+template<IntrusiveHookMode _mode=IntrusiveHookMode::NORMAL>
57
class IntrusiveListHook {
58
template<typename T> friend struct IntrusiveListBaseHookTraits;
59
template<auto member> friend struct IntrusiveListMemberHookTraits;
60
61
IntrusiveListNode siblings;
62
63
public:
64
- IntrusiveListHook() noexcept = default;
65
+ static constexpr IntrusiveHookMode mode = _mode;
66
+
67
+ IntrusiveListHook() noexcept {
68
+ if constexpr (mode >= IntrusiveHookMode::TRACK)
69
+ siblings.next = nullptr;
70
+ }
71
+
72
+ ~IntrusiveListHook() noexcept {
73
+ if constexpr (mode >= IntrusiveHookMode::AUTO_UNLINK)
74
+ if (is_linked())
75
+ unlink();
76
+ }
77
78
IntrusiveListHook(const IntrusiveListHook &) = delete;
79
IntrusiveListHook &operator=(const IntrusiveListHook &) = delete;
80
81
void unlink() noexcept {
82
- siblings.next->prev = siblings.prev;
83
- siblings.prev->next = siblings.next;
84
+ IntrusiveListNode::Connect(*siblings.prev, *siblings.next);
85
+
86
+ if constexpr (mode >= IntrusiveHookMode::TRACK)
87
+ siblings.next = nullptr;
88
+ }
89
+
90
+ bool is_linked() const noexcept {
91
+ static_assert(mode >= IntrusiveHookMode::TRACK);
92
+
93
+ return siblings.next != nullptr;
94
}
95
96
private:
97
98
}
99
};
100
101
-/**
102
- * A variant of #IntrusiveListHook which keeps track of whether it is
103
- * currently in a list.
104
- */
105
-class SafeLinkIntrusiveListHook : public IntrusiveListHook {
106
-public:
107
- SafeLinkIntrusiveListHook() noexcept {
108
- siblings.next = nullptr;
109
- }
110
-
111
- void unlink() noexcept {
112
- IntrusiveListHook::unlink();
113
- siblings.next = nullptr;
114
- }
115
-
116
- bool is_linked() const noexcept {
117
- return siblings.next != nullptr;
118
- }
119
-};
120
-
121
-/**
122
- * A variant of #IntrusiveListHook which auto-unlinks itself from the
123
- * list upon destruction. As a side effect, it has an is_linked()
124
- * method.
125
- */
126
-class AutoUnlinkIntrusiveListHook : public SafeLinkIntrusiveListHook {
127
-public:
128
- ~AutoUnlinkIntrusiveListHook() noexcept {
129
- if (is_linked())
130
- unlink();
131
- }
132
-};
133
+using SafeLinkIntrusiveListHook =
134
+ IntrusiveListHook<IntrusiveHookMode::TRACK>;
135
+using AutoUnlinkIntrusiveListHook =
136
+ IntrusiveListHook<IntrusiveHookMode::AUTO_UNLINK>;
137
138
/**
139
- * Detect the hook type; this is important because
140
- * SafeLinkIntrusiveListHook::unlink() needs to clear the "next"
141
- * pointer. This is a template to postpone the type checks, to allow
142
+ * Detect the hook type which is embedded in the given type as a base
143
+ * class. This is a template to postpone the type checks, to allow
144
* forward-declared types.
145
*/
146
template<typename U>
147
struct IntrusiveListHookDetection {
148
- static_assert(std::is_base_of_v<IntrusiveListHook, U>);
149
-
150
- using type = std::conditional_t<std::is_base_of_v<SafeLinkIntrusiveListHook, U>,
151
- SafeLinkIntrusiveListHook,
152
- IntrusiveListHook>;
153
+ /* TODO can this be simplified somehow, without checking for
154
+ all possible enum values? */
155
+ using type = std::conditional_t<std::is_base_of_v<IntrusiveListHook<IntrusiveHookMode::NORMAL>, U>,
156
+ IntrusiveListHook<IntrusiveHookMode::NORMAL>,
157
+ std::conditional_t<std::is_base_of_v<IntrusiveListHook<IntrusiveHookMode::TRACK>, U>,
158
+ IntrusiveListHook<IntrusiveHookMode::TRACK>,
159
+ std::conditional_t<std::is_base_of_v<IntrusiveListHook<IntrusiveHookMode::AUTO_UNLINK>, U>,
160
+ IntrusiveListHook<IntrusiveHookMode::AUTO_UNLINK>,
161
+ void>>>;
162
};
163
164
/**
165
166
template<typename U>
167
using Hook = typename IntrusiveListHookDetection<U>::type;
168
169
- static constexpr bool IsAutoUnlink() noexcept {
170
- return std::is_base_of_v<AutoUnlinkIntrusiveListHook, T>;
171
- }
172
-
173
static constexpr T *Cast(IntrusiveListNode *node) noexcept {
174
auto *hook = &Hook<T>::Cast(*node);
175
return static_cast<T *>(hook);
176
}
177
178
- static constexpr const T *Cast(const IntrusiveListNode *node) noexcept {
179
- const auto *hook = &Hook<T>::Cast(*node);
180
- return static_cast<const T *>(hook);
181
- }
182
-
183
static constexpr auto &ToHook(T &t) noexcept {
184
return static_cast<Hook<T> &>(t);
185
}
186
-
187
- static constexpr const auto &ToHook(const T &t) noexcept {
188
- return static_cast<const Hook<T> &>(t);
189
- }
190
};
191
192
/**
193
194
struct IntrusiveListMemberHookTraits {
195
using T = MemberPointerContainerType<decltype(member)>;
196
using _Hook = MemberPointerType<decltype(member)>;
197
- using Hook = typename IntrusiveListHookDetection<_Hook>::type;
198
199
- static constexpr bool IsAutoUnlink() noexcept {
200
- return std::is_base_of_v<AutoUnlinkIntrusiveListHook, _Hook>;
201
- }
202
+ template<typename Dummy>
203
+ using Hook = _Hook;
204
205
static constexpr T *Cast(IntrusiveListNode *node) noexcept {
206
- auto &hook = Hook::Cast(*node);
207
- return &ContainerCast(hook, member);
208
- }
209
-
210
- static constexpr const T *Cast(const IntrusiveListNode *node) noexcept {
211
- const auto &hook = Hook::Cast(*node);
212
+ auto &hook = Hook<T>::Cast(*node);
213
return &ContainerCast(hook, member);
214
}
215
216
static constexpr auto &ToHook(T &t) noexcept {
217
return t.*member;
218
}
219
-
220
- static constexpr const auto &ToHook(const T &t) noexcept {
221
- return t.*member;
222
- }
223
};
224
225
/**
226
227
typename HookTraits=IntrusiveListBaseHookTraits<T>,
228
bool constant_time_size=false>
229
class IntrusiveList {
230
- template<typename U>
231
- using Hook = typename IntrusiveListHookDetection<U>::type;
232
-
233
IntrusiveListNode head{&head, &head};
234
235
no_unique_address
236
OptionalCounter<constant_time_size> counter;
237
238
+ static constexpr auto GetHookMode() noexcept {
239
+ return HookTraits::template Hook<T>::mode;
240
+ }
241
+
242
static constexpr T *Cast(IntrusiveListNode *node) noexcept {
243
return HookTraits::Cast(node);
244
}
245
246
static constexpr const T *Cast(const IntrusiveListNode *node) noexcept {
247
- return HookTraits::Cast(node);
248
+ return HookTraits::Cast(const_cast<IntrusiveListNode *>(node));
249
}
250
251
static constexpr auto &ToHook(T &t) noexcept {
252
253
}
254
255
static constexpr const auto &ToHook(const T &t) noexcept {
256
- return HookTraits::ToHook(t);
257
+ return HookTraits::ToHook(const_cast<T &>(t));
258
}
259
260
static constexpr IntrusiveListNode &ToNode(T &t) noexcept {
261
262
}
263
264
public:
265
+ using value_type = T;
266
+ using reference = T &;
267
+ using const_reference = const T &;
268
+ using pointer = T *;
269
+ using const_pointer = const T *;
270
using size_type = std::size_t;
271
272
constexpr IntrusiveList() noexcept = default;
273
274
}
275
276
~IntrusiveList() noexcept {
277
- if constexpr (std::is_base_of_v<SafeLinkIntrusiveListHook, T>)
278
+ if constexpr (GetHookMode() >= IntrusiveHookMode::TRACK)
279
clear();
280
}
281
282
283
a.head.prev->next = &a.head;
284
285
b.head = {&b.head, &b.head};
286
+ } else if (b.empty()) {
287
+ b.head = a.head;
288
+ b.head.next->prev = &b.head;
289
+ b.head.prev->next = &b.head;
290
+
291
+ a.head = {&a.head, &a.head};
292
} else {
293
swap(a.head, b.head);
294
295
296
}
297
298
void clear() noexcept {
299
- if constexpr (std::is_base_of_v<SafeLinkIntrusiveListHook, T>) {
300
+ if constexpr (GetHookMode() >= IntrusiveHookMode::TRACK) {
301
/* for SafeLinkIntrusiveListHook, we need to
302
remove each item manually, or else its
303
is_linked() method will not work */
304
305
}
306
}
307
308
- template<typename D>
309
- void clear_and_dispose(D &&disposer) noexcept {
310
+ void clear_and_dispose(Disposer<value_type> auto disposer) noexcept {
311
while (!empty()) {
312
auto *item = &front();
313
pop_front();
314
315
}
316
}
317
318
- template<typename P, typename D>
319
- void remove_and_dispose_if(P &&pred, D &&dispose) noexcept {
320
+ /**
321
+ * @return the number of removed items
322
+ */
323
+ std::size_t remove_and_dispose_if(Predicate<const_reference> auto pred,
324
+ Disposer<value_type> auto dispose) noexcept {
325
+ std::size_t result = 0;
326
+
327
auto *n = head.next;
328
329
while (n != &head) {
330
331
ToHook(*i).unlink();
332
--counter;
333
dispose(i);
334
+ ++result;
335
}
336
}
337
+
338
+ return result;
339
}
340
341
- const T &front() const noexcept {
342
+ const_reference front() const noexcept {
343
return *Cast(head.next);
344
}
345
346
- T &front() noexcept {
347
+ reference front() noexcept {
348
return *Cast(head.next);
349
}
350
351
352
--counter;
353
}
354
355
- template<typename D>
356
- void pop_front_and_dispose(D &&disposer) noexcept {
357
+ void pop_front_and_dispose(Disposer<value_type> auto disposer) noexcept {
358
auto &i = front();
359
ToHook(i).unlink();
360
--counter;
361
disposer(&i);
362
}
363
364
- T &back() noexcept {
365
+ reference back() noexcept {
366
return *Cast(head.prev);
367
}
368
369
370
:cursor(_cursor) {}
371
372
public:
373
- using iterator_category = std::forward_iterator_tag;
374
+ using iterator_category = std::bidirectional_iterator_tag;
375
using value_type = T;
376
using difference_type = std::ptrdiff_t;
377
using pointer = value_type *;
378
379
return !(*this == other);
380
}
381
382
- constexpr T &operator*() const noexcept {
383
+ constexpr reference operator*() const noexcept {
384
return *Cast(cursor);
385
}
386
387
- constexpr T *operator->() const noexcept {
388
+ constexpr pointer operator->() const noexcept {
389
return Cast(cursor);
390
}
391
392
- iterator &operator++() noexcept {
393
+ auto &operator++() noexcept {
394
cursor = cursor->next;
395
return *this;
396
}
397
+
398
+ auto operator++(int) noexcept {
399
+ auto old = *this;
400
+ cursor = cursor->next;
401
+ return old;
402
+ }
403
+
404
+ auto &operator--() noexcept {
405
+ cursor = cursor->prev;
406
+ return *this;
407
+ }
408
+
409
+ auto operator--(int) noexcept {
410
+ auto old = *this;
411
+ cursor = cursor->prev;
412
+ return old;
413
+ }
414
};
415
416
constexpr iterator begin() noexcept {
417
418
return {&head};
419
}
420
421
- static constexpr iterator iterator_to(T &t) noexcept {
422
+ static constexpr iterator iterator_to(reference t) noexcept {
423
return {&ToNode(t)};
424
}
425
426
427
:cursor(_cursor) {}
428
429
public:
430
- using iterator_category = std::forward_iterator_tag;
431
+ using iterator_category = std::bidirectional_iterator_tag;
432
using value_type = const T;
433
using difference_type = std::ptrdiff_t;
434
using pointer = value_type *;
435
436
return !(*this == other);
437
}
438
439
- constexpr const T &operator*() const noexcept {
440
+ constexpr reference operator*() const noexcept {
441
return *Cast(cursor);
442
}
443
444
- constexpr const T *operator->() const noexcept {
445
+ constexpr pointer operator->() const noexcept {
446
return Cast(cursor);
447
}
448
449
- const_iterator &operator++() noexcept {
450
+ auto &operator++() noexcept {
451
cursor = cursor->next;
452
return *this;
453
}
454
+
455
+ auto operator++(int) noexcept {
456
+ auto old = *this;
457
+ cursor = cursor->next;
458
+ return old;
459
+ }
460
+
461
+ auto &operator--() noexcept {
462
+ cursor = cursor->prev;
463
+ return *this;
464
+ }
465
+
466
+ auto operator--(int) noexcept {
467
+ auto old = *this;
468
+ cursor = cursor->prev;
469
+ return old;
470
+ }
471
};
472
473
constexpr const_iterator begin() const noexcept {
474
475
return {&head};
476
}
477
478
- static constexpr iterator iterator_to(const T &t) noexcept {
479
+ static constexpr const_iterator iterator_to(const_reference t) noexcept {
480
return {&ToNode(t)};
481
}
482
483
484
return result;
485
}
486
487
- template<typename D>
488
- iterator erase_and_dispose(iterator i, D &&disposer) noexcept {
489
+ iterator erase_and_dispose(iterator i,
490
+ Disposer<value_type> auto disposer) noexcept {
491
auto result = erase(i);
492
disposer(&*i);
493
return result;
494
}
495
496
- void push_front(T &t) noexcept {
497
+ void push_front(reference t) noexcept {
498
insert(begin(), t);
499
}
500
501
- void push_back(T &t) noexcept {
502
+ void push_back(reference t) noexcept {
503
insert(end(), t);
504
}
505
506
- void insert(iterator p, T &t) noexcept {
507
+ void insert(iterator p, reference t) noexcept {
508
static_assert(!constant_time_size ||
509
- !HookTraits::IsAutoUnlink(),
510
+ GetHookMode() < IntrusiveHookMode::AUTO_UNLINK,
511
"Can't use auto-unlink hooks with constant_time_size");
512
513
auto &existing_node = ToNode(*p);
514
auto &new_node = ToNode(t);
515
516
- existing_node.prev->next = &new_node;
517
- new_node.prev = existing_node.prev;
518
- existing_node.prev = &new_node;
519
- new_node.next = &existing_node;
520
+ IntrusiveListNode::Connect(*existing_node.prev,
521
+ new_node);
522
+ IntrusiveListNode::Connect(new_node, existing_node);
523
524
++counter;
525
}
526
+
527
+ /**
528
+ * Move one item of the given list to this one before the
529
+ * given position.
530
+ */
531
+ void splice(iterator position,
532
+ IntrusiveList &from, iterator i) noexcept {
533
+ auto &item = *i;
534
+ from.erase(i);
535
+ insert(position, item);
536
+ }
537
+
538
+ /**
539
+ * Move the given range of items of the given list to this one
540
+ * before the given position.
541
+ */
542
+ void splice(iterator position, IntrusiveList &from,
543
+ iterator _begin, iterator _end, size_type n) noexcept {
544
+ if (_begin == _end)
545
+ return;
546
+
547
+ auto &next_node = ToNode(*position);
548
+ auto &prev_node = ToNode(*std::prev(position));
549
+
550
+ auto &first_node = ToNode(*_begin);
551
+ auto &before_first_node = ToNode(*std::prev(_begin));
552
+ auto &last_node = ToNode(*std::prev(_end));
553
+ auto &after_last_node = ToNode(*_end);
554
+
555
+ /* remove from the other list */
556
+ IntrusiveListNode::Connect(before_first_node, after_last_node);
557
+ from.counter -= n;
558
+
559
+ /* insert into this list */
560
+ IntrusiveListNode::Connect(prev_node, first_node);
561
+ IntrusiveListNode::Connect(last_node, next_node);
562
+ counter += n;
563
+ }
564
+
565
+ /**
566
+ * Move all items of the given list to this one before the
567
+ * given position.
568
+ */
569
+ void splice(iterator position, IntrusiveList &from) noexcept {
570
+ splice(position, from, from.begin(), from.end(),
571
+ constant_time_size ? from.size() : 1);
572
+ }
573
};
574
ncmpc-0.48.tar.xz/src/util/IntrusiveSortedList.hxx
Added
43
1
2
+// SPDX-License-Identifier: BSD-2-Clause
3
+// author: Max Kellermann <max.kellermann@gmail.com>
4
+
5
+#pragma once
6
+
7
+#include "IntrusiveList.hxx"
8
+
9
+#include <algorithm> // for std::find_if()
10
+
11
+/**
12
+ * A variant of #IntrusiveList which is sorted automatically. There
13
+ * are obvious scalability problems with this approach, so use with
14
+ * care.
15
+ */
16
+template<typename T, typename Compare=typename T::Compare,
17
+ typename HookTraits=IntrusiveListBaseHookTraits<T>,
18
+ bool constant_time_size=false>
19
+class IntrusiveSortedList
20
+ : public IntrusiveList<T, HookTraits, constant_time_size>
21
+{
22
+ using Base = IntrusiveList<T, HookTraits, constant_time_size>;
23
+
24
+ no_unique_address
25
+ Compare compare;
26
+
27
+public:
28
+ constexpr IntrusiveSortedList() noexcept = default;
29
+ IntrusiveSortedList(IntrusiveSortedList &&src) noexcept = default;
30
+
31
+ using typename Base::reference;
32
+ using Base::begin;
33
+ using Base::end;
34
+
35
+ void insert(reference item) noexcept {
36
+ auto position = std::find_if(begin(), end(), this, &item(const auto &other){
37
+ return !compare(other, item);
38
+ });
39
+
40
+ Base::insert(position, item);
41
+ }
42
+};
43
ncmpc-0.47.tar.xz/src/util/LocaleString.cxx -> ncmpc-0.48.tar.xz/src/util/LocaleString.cxx
Changed
35
1
2
-/*
3
- * Copyright 2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "LocaleString.hxx"
34
35
ncmpc-0.47.tar.xz/src/util/LocaleString.hxx -> ncmpc-0.48.tar.xz/src/util/LocaleString.hxx
Changed
35
1
2
-/*
3
- * Copyright 2018 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef LOCALE_STRING_HXX
34
#define LOCALE_STRING_HXX
35
ncmpc-0.47.tar.xz/src/util/Manual.hxx -> ncmpc-0.48.tar.xz/src/util/Manual.hxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#pragma once
34
35
ncmpc-0.47.tar.xz/src/util/MemberPointer.hxx -> ncmpc-0.48.tar.xz/src/util/MemberPointer.hxx
Changed
39
1
2
-/*
3
- * Copyright 2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
ncmpc-0.47.tar.xz/src/util/OffsetPointer.hxx -> ncmpc-0.48.tar.xz/src/util/OffsetPointer.hxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#pragma once
34
35
ncmpc-0.47.tar.xz/src/util/OptionalCounter.hxx -> ncmpc-0.48.tar.xz/src/util/OptionalCounter.hxx
Changed
65
1
2
-/*
3
- * Copyright 2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#pragma once
38
39
40
constexpr void reset() noexcept {}
41
constexpr auto &operator++() noexcept { return *this; }
42
constexpr auto &operator--() noexcept { return *this; }
43
+ constexpr auto &operator+=(std::size_t) noexcept { return *this; }
44
+ constexpr auto &operator-=(std::size_t) noexcept { return *this; }
45
};
46
47
template<>
48
49
--value;
50
return *this;
51
}
52
+
53
+ constexpr auto &operator+=(std::size_t n) noexcept {
54
+ value += n;
55
+ return *this;
56
+ }
57
+
58
+ constexpr auto &operator-=(std::size_t n) noexcept {
59
+ assert(value >= n);
60
+
61
+ value -= n;
62
+ return *this;
63
+ }
64
};
65
ncmpc-0.47.tar.xz/src/util/PrintException.cxx -> ncmpc-0.48.tar.xz/src/util/PrintException.cxx
Changed
39
1
2
-/*
3
- * Copyright 2007-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#include "PrintException.hxx"
38
39
ncmpc-0.47.tar.xz/src/util/PrintException.hxx -> ncmpc-0.48.tar.xz/src/util/PrintException.hxx
Changed
39
1
2
-/*
3
- * Copyright 2009-2022 CM4all GmbH
4
- * All rights reserved.
5
- *
6
- * author: Max Kellermann <mk@cm4all.com>
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the
18
- * distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31
- * OF THE POSSIBILITY OF SUCH DAMAGE.
32
- */
33
+// SPDX-License-Identifier: BSD-2-Clause
34
+// Copyright CM4all GmbH
35
+// author: Max Kellermann <mk@cm4all.com>
36
37
#ifndef PRINT_EXCEPTION_HXX
38
#define PRINT_EXCEPTION_HXX
39
ncmpc-0.47.tar.xz/src/util/RuntimeError.hxx -> ncmpc-0.48.tar.xz/src/util/RuntimeError.hxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef RUNTIME_ERROR_HXX
34
#define RUNTIME_ERROR_HXX
35
ncmpc-0.47.tar.xz/src/util/ScopeExit.hxx -> ncmpc-0.48.tar.xz/src/util/ScopeExit.hxx
Changed
35
1
2
-/*
3
- * Copyright (C) 2015 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef SCOPE_EXIT_HXX
34
#define SCOPE_EXIT_HXX
35
ncmpc-0.48.tar.xz/src/util/SortList.hxx
Added
97
1
2
+// SPDX-License-Identifier: BSD-2-Clause
3
+// author: Max Kellermann <max.kellermann@gmail.com>
4
+
5
+#pragma once
6
+
7
+#include "Concepts.hxx"
8
+#include "StaticVector.hxx"
9
+
10
+#include <algorithm> // for std::find_if()
11
+
12
+/**
13
+ * Move all items from #src to #dest, keeping both sorted.
14
+ *
15
+ * @param p the predicate by which both lists are already
16
+ * sorted
17
+ */
18
+template<typename List>
19
+constexpr void
20
+MergeList(List &dest, List &src,
21
+ Predicate<typename List::const_reference, typename List::const_reference> auto p) noexcept
22
+{
23
+ const auto dest_end = dest.end(), src_end = src.end();
24
+
25
+ auto dest_at = dest.begin();
26
+
27
+ while (!src.empty()) {
28
+ const auto src_begin = src.begin();
29
+
30
+ /* find the first item of "dest" that is larger than
31
+ the front of "src"; this is the next insertion
32
+ position */
33
+ dest_at = std::find_if(dest_at, dest_end, &p, &src_front = *src_begin(const auto &i){
34
+ return p(src_front, i);
35
+ });
36
+
37
+ if (dest_at == dest_end) {
38
+ /* all items in "src" are larger than
39
+ "this": splice the whole list at
40
+ the end of "this" */
41
+ dest.splice(dest_end, src);
42
+ break;
43
+ }
44
+
45
+ /* find the first item of "src" that is not smaller
46
+ than the "dest" insertion anchor; this is the end
47
+ of the range of items to be spliced */
48
+ const auto &dest_anchor = *dest_at;
49
+ typename List::size_type n = 1;
50
+ auto src_until = std::next(src_begin);
51
+ while (src_until != src_end && p(*src_until, dest_anchor)) {
52
+ ++src_until;
53
+ ++n;
54
+ }
55
+
56
+ dest.splice(dest_at, src, src_begin, src_until, n);
57
+ }
58
+}
59
+
60
+template<typename List>
61
+constexpr void
62
+SortList(List &list,
63
+ Predicate <typename List::const_reference, typename List::const_reference> auto p) noexcept
64
+{
65
+ using std::swap;
66
+
67
+ if (list.empty())
68
+ return;
69
+
70
+ /* bottom-up merge sort */
71
+
72
+ List carry;
73
+ StaticVector<List, 64> array;
74
+
75
+ while (!list.empty()) {
76
+ carry.splice(carry.begin(), list, list.begin());
77
+
78
+ std::size_t i = 0;
79
+ while (i < array.size() && !arrayi.empty()) {
80
+ auto &c = arrayi++;
81
+ MergeList(c, carry, p);
82
+ swap(carry, c);
83
+ }
84
+
85
+ if (i == array.size())
86
+ array.emplace_back();
87
+ swap(carry, arrayi);
88
+ }
89
+
90
+ assert(!array.empty());
91
+
92
+ for (std::size_t i = 1; i < array.size(); ++i)
93
+ MergeList(arrayi, arrayi - 1, p);
94
+
95
+ swap(list, array.back());
96
+}
97
ncmpc-0.47.tar.xz/src/util/StringAPI.hxx -> ncmpc-0.48.tar.xz/src/util/StringAPI.hxx
Changed
35
1
2
-/*
3
- * Copyright 2010-2021 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef STRING_API_HXX
34
#define STRING_API_HXX
35
ncmpc-0.47.tar.xz/src/util/StringCompare.cxx -> ncmpc-0.48.tar.xz/src/util/StringCompare.cxx
Changed
35
1
2
-/*
3
- * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "StringCompare.hxx"
34
35
ncmpc-0.47.tar.xz/src/util/StringCompare.hxx -> ncmpc-0.48.tar.xz/src/util/StringCompare.hxx
Changed
73
1
2
-/*
3
- * Copyright 2013-2022 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#ifndef STRING_COMPARE_HXX
34
#define STRING_COMPARE_HXX
35
36
37
#include <string_view>
38
39
-gnu::pure gnu::nonnull
40
-static inline bool
41
+gnu::nonnull
42
+static constexpr bool
43
StringIsEmpty(const char *string) noexcept
44
{
45
return *string == 0;
46
47
const char *
48
FindStringSuffix(const char *p, const char *suffix) noexcept;
49
50
+template<typename T>
51
+bool
52
+SkipPrefix(std::basic_string_view<T> &haystack,
53
+ std::basic_string_view<T> needle) noexcept
54
+{
55
+ bool match = haystack.starts_with(needle);
56
+ if (match)
57
+ haystack.remove_prefix(needle.size());
58
+ return match;
59
+}
60
+
61
+template<typename T>
62
+bool
63
+RemoveSuffix(std::basic_string_view<T> &haystack,
64
+ std::basic_string_view<T> needle) noexcept
65
+{
66
+ bool match = haystack.ends_with(needle);
67
+ if (match)
68
+ haystack.remove_suffix(needle.size());
69
+ return match;
70
+}
71
+
72
#endif
73
ncmpc-0.47.tar.xz/src/util/StringStrip.cxx -> ncmpc-0.48.tar.xz/src/util/StringStrip.cxx
Changed
90
1
2
-/*
3
- * Copyright 2009-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
#include "StringStrip.hxx"
34
#include "CharUtil.hxx"
35
36
+#include <algorithm>
37
#include <cstring>
38
39
const char *
40
41
return p;
42
}
43
44
+std::string_view
45
+StripLeft(const std::string_view s) noexcept
46
+{
47
+ auto i = std::find_if_not(s.begin(), s.end(),
48
+ (auto ch){ return IsWhitespaceOrNull(ch); });
49
+
50
+#ifdef __clang__
51
+ // libc++ doesn't yet support the C++20 constructor
52
+ return s.substr(std::distance(s.begin(), i));
53
+#else
54
+ return {
55
+ i,
56
+ s.end(),
57
+ };
58
+#endif
59
+}
60
+
61
const char *
62
StripRight(const char *p, const char *end) noexcept
63
{
64
65
pnew_length = 0;
66
}
67
68
+std::string_view
69
+StripRight(std::string_view s) noexcept
70
+{
71
+ auto i = std::find_if_not(s.rbegin(), s.rend(),
72
+ (auto ch){ return IsWhitespaceOrNull(ch); });
73
+
74
+ return s.substr(0, std::distance(i, s.rend()));
75
+}
76
+
77
char *
78
Strip(char *p) noexcept
79
{
80
81
StripRight(p);
82
return p;
83
}
84
+
85
+std::string_view
86
+Strip(std::string_view s) noexcept
87
+{
88
+ return StripRight(StripLeft(s));
89
+}
90
ncmpc-0.47.tar.xz/src/util/StringStrip.hxx -> ncmpc-0.48.tar.xz/src/util/StringStrip.hxx
Changed
72
1
2
-/*
3
- * Copyright 2009-2020 Max Kellermann <max.kellermann@gmail.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- *
9
- * - Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- *
12
- * - Redistributions in binary form must reproduce the above copyright
13
- * notice, this list of conditions and the following disclaimer in the
14
- * documentation and/or other materials provided with the
15
- * distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
- * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
- * OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
+// SPDX-License-Identifier: BSD-2-Clause
31
+// author: Max Kellermann <max.kellermann@gmail.com>
32
33
-#ifndef STRING_STRIP_HXX
34
-#define STRING_STRIP_HXX
35
+#pragma once
36
37
#include <cstddef>
38
+#include <string_view>
39
40
/**
41
* Skips whitespace at the beginning of the string, and returns the
42
43
const char *
44
StripLeft(const char *p, const char *end) noexcept;
45
46
+gnu::pure
47
+std::string_view
48
+StripLeft(std::string_view s) noexcept;
49
+
50
/**
51
* Determine the string's end as if it was stripped on the right side.
52
*/
53
54
void
55
StripRight(char *p) noexcept;
56
57
+gnu::pure
58
+std::string_view
59
+StripRight(std::string_view s) noexcept;
60
+
61
/**
62
* Skip whitespace at the beginning and terminate the string after the
63
* last non-whitespace character.
64
65
char *
66
Strip(char *p) noexcept;
67
68
-#endif
69
+gnu::pure
70
+std::string_view
71
+Strip(std::string_view s) noexcept;
72
ncmpc-0.47.tar.xz/src/util/StringUTF8.cxx -> ncmpc-0.48.tar.xz/src/util/StringUTF8.cxx
Changed
36
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "StringUTF8.hxx"
23
+#include "StringAPI.hxx"
24
25
#include <string.h>
26
27
28
ScopeInitUTF8::ScopeInitUTF8() noexcept
29
{
30
const char *charset = nl_langinfo(CODESET);
31
- if (charset == nullptr || strcasecmp(charset, "utf-8") == 0)
32
+ if (charset == nullptr || StringIsEqualIgnoreCase(charset, "utf-8"))
33
/* if we're already UTF-8, we don't need a special
34
UTF-8 locale */
35
return;
36
ncmpc-0.47.tar.xz/src/util/StringUTF8.hxx -> ncmpc-0.48.tar.xz/src/util/StringUTF8.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef STRING_UTF8_HXX
23
#define STRING_UTF8_HXX
24
ncmpc-0.47.tar.xz/src/util/UriUtil.cxx -> ncmpc-0.48.tar.xz/src/util/UriUtil.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "UriUtil.hxx"
23
24
ncmpc-0.47.tar.xz/src/util/UriUtil.hxx -> ncmpc-0.48.tar.xz/src/util/UriUtil.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef URI_UTIL_HXX
23
#define URI_UTIL_HXX
24
ncmpc-0.47.tar.xz/src/wreadln.cxx -> ncmpc-0.48.tar.xz/src/wreadln.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "wreadln.hxx"
23
#include "Completion.hxx"
24
ncmpc-0.47.tar.xz/src/wreadln.hxx -> ncmpc-0.48.tar.xz/src/wreadln.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef WREADLN_H
23
#define WREADLN_H
24
ncmpc-0.47.tar.xz/src/xterm_title.cxx -> ncmpc-0.48.tar.xz/src/xterm_title.cxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#include "xterm_title.hxx"
23
#include "Options.hxx"
24
ncmpc-0.47.tar.xz/src/xterm_title.hxx -> ncmpc-0.48.tar.xz/src/xterm_title.hxx
Changed
24
1
2
-/* ncmpc (Ncurses MPD Client)
3
- * Copyright 2004-2021 The Music Player Daemon Project
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along
16
- * with this program; if not, write to the Free Software Foundation, Inc.,
17
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
- */
19
+// SPDX-License-Identifier: GPL-2.0-or-later
20
+// Copyright The Music Player Daemon Project
21
22
#ifndef XTERM_TITLE_H
23
#define XTERM_TITLE_H
24