Commit Graph

178 Commits

Author SHA1 Message Date
Max Kellermann 57fb153c5d db/Interface: pass std::string_view to GetSong() 2020-04-08 23:43:59 +02:00
Max Kellermann dd831d3922 db/simple: pass std::string_view to Directory::LookupDirectory() 2020-04-08 23:38:24 +02:00
Max Kellermann bcf4645263 db/simple/Directory: add LookupResult::uri 2020-04-03 17:18:00 +02:00
Max Kellermann 6c8eb3c7ed db/simple/Directory: rename LookupResult::uri to "rest" 2020-04-03 17:07:15 +02:00
Max Kellermann 747436b17e db,storage: pass std::string_view to PathTraits::Build() 2020-04-03 16:25:09 +02:00
Max Kellermann 7a58b8c3e8 fs/AllocatedPath: pass std::string_view to FromUTF8() 2020-04-03 16:21:41 +02:00
Max Kellermann 91c75a133f lib/icu/Collate: pass std::string_view 2020-04-03 16:13:15 +02:00
Max Kellermann dadf054fbb db/simple/Directory: reimplement LookupDirectory() without allocations
Use std::string_view to avoid modifying the string for the temporary
null terminators.
2020-04-02 20:08:00 +02:00
Max Kellermann 6593b5998a db/simple/Directory: pass std::string_view to several methods 2020-04-02 19:58:24 +02:00
Max Kellermann 386235e2d2 db/simple/Mount: pass std::string_view to WalkMount() 2020-04-02 19:52:03 +02:00
Max Kellermann ddfd92e547 db/simple/PrefixedLightSong: templatize the constructor 2020-04-02 19:51:41 +02:00
Max Kellermann 12b97bbe38 Merge tag 'v0.21.22'
release v0.21.22
2020-04-02 18:02:10 +02:00
Max Kellermann cdddaf21b0 db/simple/Directory: optimize GetName() using the parent's path
This method gets called a lot during MPD startup, via FindChild() and
directory_load_subdir(), so this is worth optimizing at the expense of
code readability.

This speeds up MPD startup by 10%.
2020-04-02 16:12:08 +02:00
Rosen Penev 7fe49cf24d [clang-tidy] use default member init
Found with modernize-use-default-member-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-19 13:38:40 +01: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 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 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
Rosen Penev 452c41b71f [clang-tidy] convert several functions to const &
Found with performance-unnecessary-value-param

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-02-02 13:21:27 -08:00
Rosen Penev 469cd9582f [clang-tidy] use make_unique
Found with modernize-make-unique

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-02-01 19:40:39 -08:00
Max Kellermann 72ec641f0d *: use auto 2020-02-01 14:02:43 +01:00
Max Kellermann cd612c4eef AudioFormat: move to pcm/ 2020-01-18 20:24:59 +01:00
Max Kellermann 2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01:00
Max Kellermann e9af692973 util/Time*: move to time/ 2019-12-16 23:02:14 +01:00
Max Kellermann d63e2c2641 db/update: scan CUE playlist contents
This commit adds a PlaylistPlugin attribute "as_folder" which for now
is only enabled in the "CUE" playlist plugin (which handles separate
"*.cue" files).  If a playlist with this flag set is being scanned
during database update, it will be parsed and its contents will be
added to the database.  This allows clients to inspect them like
directories and its contents will be searchable.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/39
2019-09-08 00:39:53 +02:00
Max Kellermann 5fdb804a50 db/simple/Song: add attribute "target"
Will be used for Song objects representing tracks inside a CUE file.
2019-09-08 00:32:16 +02:00
Max Kellermann ee36a48dbb db/simple/Directory: RemoveSong() returns SongPtr 2019-09-05 21:12:10 +02:00
Max Kellermann 07f212c98c SongSave: return DetachedSong, not a std::unique_ptr<>
Eliminate unnecessary dynamic allocations.
2019-09-05 20:58:04 +02:00
Max Kellermann 7775691965 db/simple/Song: rename "uri" to "filename"
This attribute is not a URI; it is just the filename without its
parent directory path.  To avoid confusion, let's rename it to
"filename", leaving the struct without a "uri" attribute.
2019-09-04 12:04:35 +02:00
Max Kellermann a727150c8d db/simple/Song: remove StringView constructor 2019-09-04 12:03:56 +02:00
Max Kellermann 949916cba1 db/simple/Song: convert NewFrom() to constructor 2019-09-04 12:03:49 +02:00
Max Kellermann 497d090814 db/simple/Song: remove static method NewFile() 2019-09-04 12:03:41 +02:00
Max Kellermann 6a13847287 db/simple/Song: add template constructor 2019-09-04 12:03:37 +02:00
Max Kellermann cbe7d052e8 db/simple/Song: use PathTraitsUTF8::Build() 2019-09-04 12:02:18 +02:00
Max Kellermann f4d0bd8205 db/simple/Song: make "parent" a reference, not a pointer 2019-09-04 12:02:17 +02:00
Max Kellermann 05a29e8458 db/simple/Song: simplify Export() 2019-09-03 20:36:39 +02:00
Max Kellermann 7f9a8b8748 db/simple/Song: convert "uri" to a std::string
No longer allocate it as a "VarSize".  This used to be a clever trick
to save memory 10 years ago, but these days, keeping the code
maintainable seems more important than saving a few kilobytes of
memory.
2019-09-03 20:26:47 +02:00
Max Kellermann af3f637d3f db/simple/Song: pass StringView to constructor 2019-09-03 20:25:04 +02:00
Max Kellermann 2038620bc4 db/simple/Directory: add method IsReallyAFile() 2019-09-02 20:15:52 +02:00
Max Kellermann 5dc7cb87bb db/simple/DirectorySave: use StringIsEqual() 2019-09-02 20:10:26 +02:00
Max Kellermann d663f81420 include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Max Kellermann 33f5e03e80 Merge branch 'v0.21.x' 2019-06-17 22:06:54 +02:00
Max Kellermann a139279575 Copyright year 2019 2019-06-17 11:17:30 +02:00
Max Kellermann 1eae9339f2 db/Interface: CollectUniqueTags() allows multiple "groups"
Instead of passing tag and group, pass an array of tags.  To support a
nested return value, return a nested std::map of std::maps.  Each key
specifies the tag value, and each value may be another nesting level.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/408
2019-06-16 10:39:29 +02:00
Max Kellermann 3fc4da382e db/simple/Song: allow LoadFile(), UpdateFile() to throw
Preparing to move logger calls out of lower-level libaries, and
propagating error details to the caller instead.
2019-05-22 10:19:24 +02:00
Max Kellermann bbdf2dcf1e db/simple/Song: wrap in std::unique_ptr<> 2019-05-21 22:46:34 +02:00
Max Kellermann 02bb47dd08 db/simple/Song: move struct Disposer to separate header
Allow forward-declaring it.
2019-05-21 22:42:32 +02:00
Max Kellermann 0c48b8d084 db/simple/Song: add noexcept 2019-05-21 22:41:21 +02:00
Max Kellermann 8462559b2f db/simple/Song: include cleanup 2019-05-21 22:40:08 +02:00
Max Kellermann 214ddee2f5 util/Time*: move to time/ 2019-05-08 15:47:58 +02:00
Max Kellermann 30e0644722 db/simple: call ReturnSong() on mounted database
Fixes a memory leak, or an assertion failure in the debug build.
2019-02-22 14:52:13 +01:00