Commit Graph

15153 Commits

Author SHA1 Message Date
Rosen Penev
77c6c3fabf
remove unreachable code
Found with -Wunreachable-code-break

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:14:13 -07:00
Rosen Penev
e25a3d17e7
remove extra semicolon
Found with -Wextra-semi

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:13:20 -07:00
Rosen Penev
7f10e7a610
fix implicit-fallthrough warnings under clang
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:12:38 -07:00
Rosen Penev
88d56c01e7
fix missing overrides
Found with clang's -Winconsistent-missing-destructor-override

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:11:15 -07:00
Rosen Penev
97425d56e7
remove gcc_unused
[[maybe_unused]] (introduced in C++17) is standard C++.

https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused
says that this is equivalent to the GNU unused attribute.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev
0afb156a5b
remove gcc_warn_unused
[[nodiscard] (introduced in C++17) can be used instead.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev
a192e7b29b
remove gcc_deprecated
[[deprecated]] (introduced in C++14) may be used instead.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev
591f51f3d3
replace noreturn attribute with standard C++ version
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:18 -07:00
Rosen Penev
5e4b7e2fb7
[clang-tidy] fix incorrect rounding
Found with bugprone-incorrect-roundings

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-15 20:22:08 -07:00
Rosen Penev
177371a003
treewide: get rid of C math function usage
Boost does not seem to offer an overload for lrint.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-15 20:22:07 -07:00
Rosen Penev
a78841d6a9
volume_mapping: get rid of exp10 workaround
exp10 is a GNU function, is not part of C++, and is not available
everywhere.

pow(10,x) is an alternative that works just as well. It is used in musl as
the implementation of exp10.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-15 20:17:31 -07:00
Rosen Penev
3ec9fcfc44
treewide: use boost::lround when std::round is unavailable
This is the case with uClibc-ng currently.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-15 20:17:31 -07:00
Max Kellermann
b5d1a09010 util/StringUtil: pass std::string_view to StringArrayContainsCase() 2020-03-13 20:38:40 +01:00
Max Kellermann
85b072b3d3 util/StringCompare: add StringIsEqual() with string_view 2020-03-13 20:36:48 +01:00
Max Kellermann
8a1f1fbe06 util/ASCII: migrate to std::string_view 2020-03-13 20:17:53 +01:00
Max Kellermann
45b60b3d38 fs/Traits: GetParent() returns std::string_view 2020-03-13 20:01:10 +01:00
Max Kellermann
cefc773992 playlist/PlaylistSong: pass std::string_view 2020-03-13 19:58:36 +01:00
Max Kellermann
a885bdba4c fs/Traits: pass string_view to Build() 2020-03-13 19:55:28 +01:00
Max Kellermann
b6b15afb5a fs/Path: make constructor explicit 2020-03-13 19:55:25 +01:00
Max Kellermann
1d560c8f0f fs/AllocatedPath: add string_view constructor 2020-03-13 19:46:29 +01:00
Max Kellermann
189f6eaa6f fs/Traits: add string_view 2020-03-13 19:43:39 +01:00
Max Kellermann
87f78b9c39 fs/Traits: use {} notation for return values 2020-03-13 19:43:23 +01:00
Max Kellermann
aa722bd8ac fs/Traits: use auto 2020-03-13 19:43:23 +01:00
Max Kellermann
58c7ec07a4 fs: use using instead of typedef 2020-03-13 19:43:23 +01:00
Max Kellermann
3796247d6d util/Stringview: use const_pointer instead of hard-coding const char *
Fixes Windows build failure.
2020-03-13 19:43:23 +01:00
Max Kellermann
332f480ec3 util/UriExtract: uri_get_path() returns std::string_view 2020-03-13 18:54:41 +01:00
Max Kellermann
9a164668f2 util/UriExtract: migrate uri_get_scheme() to std::string_view 2020-03-13 18:51:11 +01:00
Max Kellermann
6876d160cf util/StringCompare: add more StringView overloads 2020-03-13 18:49:47 +01:00
Max Kellermann
a63d0ee8fc util/StringView: add method substr() 2020-03-13 18:48:40 +01:00
Max Kellermann
d4135935e4 lib/upnp/Util: remove unused function stringToTokens() 2020-03-13 17:59:07 +01:00
Max Kellermann
569773cc75 lib/upnp/Device: remove UPnPService::clear() 2020-03-13 17:56:29 +01:00
Rosen Penev
a2f5a63bbc
replace stdint.h with cstdint
The former is deprecated by C++14. The standard says they are the same:

The header defines all types and macros the same as the C standard library
header<stdint.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:39 -07:00
Rosen Penev
2db8bcc353
replace stddef.h with cstddef
The former is deprecated with C++14. The standard says both are the same:

The contents and meaning of the header<cstddef>are the same as the C
standard library header<stddef.h>,except that it does not declare the type
wchar_t, that it also declares the type byte and its associated
operations (21.2.5), and as noted in 21.2.3 and 21.2.4.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:38 -07:00
Rosen Penev
c846ee0d1b
replace stdarg.h with cstdarg
The former was deprecated in C++14. The Standard says they are the same:

The contents of the header<cstdarg>are the same as the C standard library
header<stdarg.h>, with the following changes: The restrictions that ISO C
places on the second parameter to the va_start macro in header<stdarg.h>
are different in this International Standard. The parameter parmN is the
rightmost parameter in the variable parameter list of the function
definition (the one just before the...).219If the parameter parmN is a
pack expansion (17.5.3) or an entity resulting from a lambda capture
(8.1.5), the program is ill-formed, no diagnostic required. If the
parameter parmN is of a reference type, or of a type that is not
compatible with the type that results when passing an argument for which
there is no parameter, the behavior is undefined.

Also changed va_list to the std:: namespace version, which is the same.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:03:12 -07:00
Rosen Penev
69a51e12c9
replace signal.h with csignal.h
The former was deprecated with C++14. The standard says they are the same:

The contents of the header<csignal>are the same as the C standard library
header<signal.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 18:56:51 -07:00
Rosen Penev
4b57b7f5a5
replace limits.h with climits
The former was deprecated with C++14. The standard says they are the same
with one exception:

The header<climits>defines all macros the same as the C standard library
header<limits.h>.

[Note:The types of the constants defined by macros in<climits>are not
required to match the types to which themacros refer.— end note]

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 16:14:04 -07:00
Rosen Penev
5cd400f578
replace inttypes.h with cinttypes
The former has been deprecated by C++14. They are also the same.

From the standard:

The contents and meaning of the header<cinttypes>are the same as the C
standard library header<inttypes.h>, with the following changes:

-The header<cinttypes>includes the header<cstdint>instead of<stdint.h>,and
—if and only if the typeintmax_tdesignates an extended integer type
 (6.7.1), the following functionsignatures are added:intmax_t
abs(intmax_t);imaxdiv_t div(intmax_t, intmax_t);which shall have the same
semantics as the function signaturesintmax_t imaxabs(intmax_t)andimaxdiv_t
imaxdiv(intmax_t, intmax_t), respectively.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 16:07:28 -07:00
Rosen Penev
edc4989d9c
change errno.h to cerrno
The former is deprecated by C++14. It's also functionally the same.

From the standard:

19.4
The header<cerrno>is described in Table 43. Its contents are the same as
the POSIX header<errno.h>,except that errno shall be defined as a macro.
[Note: The intent is to remain in close alignment with the POSIX
standard.] A separate errno value shall be provided for each thread.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:51:16 -07:00
Rosen Penev
2b3d6461e3
remove unused ctype.h header
None of the functions in these files come from ctype.h

Also changed one instance of isdigit to the C++ variant.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:43:50 -07:00
Rosen Penev
ab9f5d2067
replace assert.h with cassert
The former was deprecated with C++14.

According to the C++11 and C++17 standards, both files are identical.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:25:38 -07:00
Max Kellermann
a718086ffb test/run_convert: add option --config 2020-03-12 21:41:39 +01:00
Max Kellermann
8d40e68dec test/run_convert: add option --verbose 2020-03-12 21:41:39 +01:00
Max Kellermann
de0affe115 test/run_convert: move code to ParseCommandLine() 2020-03-12 21:40:27 +01:00
Max Kellermann
26e718c7c3 doc/user.rst, .travis.yml: drop GCC 6 support
Debian Stable (Buster) has GCC 8 and Ubuntu LTS (18.04) has GCC 7.

This will unlock a lot of C++17 features like `std::string_view`.
2020-03-12 21:37:07 +01:00
Max Kellermann
82743dfd02 playlist/asx: concatenate multiple CharacterData fragments
Similar to c45f113856
2020-03-12 21:07:37 +01:00
Rosen Penev
f00f8b002a
[clang-tidy] use nodiscard
Introduced in C++17. It replaces gcc's warn_unused_result.

Found with modernize-use-nodiscard.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 12:59:16 -07:00
Max Kellermann
33694642bd playlist/asx: add State::TAG 2020-03-12 20:42:16 +01:00
Max Kellermann
c71242d743 playlist/asx: use tag_table to convert element name to TagType 2020-03-12 20:40:18 +01:00
Max Kellermann
2229e86673 client/Expire: cancel the BackgroundCommand before deleting it
Fixes assertion failure.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/774
2020-03-12 20:32:08 +01:00
Max Kellermann
f24c274f5c client/BackgroundCommand: fix typo in comment 2020-03-12 20:32:07 +01:00