Commit Graph

709 Commits

Author SHA1 Message Date
Max Kellermann 7b44dea4b1 db/upnp/Device: remove unused UPnPService attributes 2014-01-22 09:51:26 +01:00
Max Kellermann 18aea922e9 db/upnp/Directory: "emplace" items into the vector 2014-01-22 09:43:49 +01:00
Max Kellermann 7d194aceb6 db/upnp/Device: emplace/move the UPnPService into the vector
Reduce overhead.
2014-01-22 09:42:46 +01:00
Max Kellermann 2722b8a3df db/upnp/Util: "emplace" items into the list
Reduce overhead.
2014-01-22 09:40:38 +01:00
Max Kellermann fd754ff8f8 db/upnp/Directory: replace std::vector with a simple enum
Reduce bloat.
2014-01-22 09:32:11 +01:00
Max Kellermann b7738e7af3 db/upnp/Directory: join all CDATA nodes for tag values
Expat can call CharacterData() multiple times if the CDATA contains
entity references.  We need to collect all of them in one large
string.
2014-01-22 08:44:35 +01:00
Max Kellermann 99bebabac9 db/upnp/Directory: make "m_dir" private 2014-01-22 08:44:20 +01:00
Max Kellermann 0ed48b364a db/upnp: merge duplicate branches in Namei() 2014-01-21 23:42:02 +01:00
Max Kellermann b38b8b9c18 db/upnp: simplify Namei() 2014-01-21 23:37:27 +01:00
Max Kellermann 5434856136 db/upnp: use std::list instead of std::vector
Reduce overhead.
2014-01-21 23:33:28 +01:00
Max Kellermann aa1eb2f40d db/upnp: use iterator in Namei() 2014-01-21 23:32:42 +01:00
Max Kellermann 7260d7883c db/upnp: move "objid" declaration down
Don't allocate the object when it's not needed.
2014-01-21 23:10:30 +01:00
Max Kellermann 154250f551 db/upnp: eliminate redundant Namei() parameter "oobjid"
The caller should better obtain the object id from the returned
UPnPDirObject instance.
2014-01-21 23:07:33 +01:00
Max Kellermann 3e4fb92cfb db/upnp: remove redundant objid.empty() check from VisitServer()
If Namei() succeeds, the object id is guaranteed to be set.
2014-01-21 23:07:06 +01:00
Max Kellermann 0da713e278 db/upnp: use std::move() to extract server name
Reduce runtime overhead.
2014-01-21 22:57:54 +01:00
Max Kellermann 94cb1545b3 db/upnp: use vector::front() instead of [0] 2014-01-21 22:57:16 +01:00
Max Kellermann 411527a240 db/upnp: don't use stringToTokens() in ParseDuration()
Reduce bloat.
2014-01-21 22:52:12 +01:00
Max Kellermann 7777057d35 db/upnp: don't construct redundant empty vector<string> in Visit()
We know already that vpath is empty, let's use this instance.
2014-01-21 22:47:57 +01:00
Max Kellermann dc5ef9ad01 db/upnp: simplify GetSong() 2014-01-21 22:43:04 +01:00
Max Kellermann 7471f65d95 LightSong: add attribute "real_uri"
The UPnP database plugin can now show relative song URIs for remote
songs.
2014-01-21 21:08:11 +01:00
Max Kellermann ecac7a629e db/upnp: fix empty song URI
Fall back to UPnPDirObject::url if there is no override.
2014-01-21 21:02:21 +01:00
Max Kellermann f5ae1ce00b LightSong: new class to be used by DatabasePlugin callbacks
Detach the Song class completely from the public API, only to be used
by SimpleDatabase and the update thread.
2014-01-19 17:04:51 +01:00
Max Kellermann 738d6f1040 db/proxy: simplify error handling in GetSong()
Check mpd_response_finish() before using mpd_song.  Don't skip this
check even if the mpd_song is non-nullptr.
2014-01-19 11:37:42 +01:00
Max Kellermann ba372197fb db/simple: make borrowed_song_count "mutable"
Simpler to use than const_cast.
2014-01-19 11:23:02 +01:00
Max Kellermann d2cf74027c Song: embed the Tag object statically into class Song
Reduces overhead because we need to manage only one memory allocation.
According to valgrind/massif, we save 7%.
2014-01-19 02:58:55 +01:00
Max Kellermann fdf4dff561 db/upnp: move Tag from UPnPDirObject to Song
The UPnPDirObject is a temporary object, we can move its contents.
This reduces runtime overhead.
2014-01-18 19:09:42 +01:00
Max Kellermann fab6cbed75 db/upnp/Discovery: eliminate attribute "last_seen" 2014-01-18 16:28:12 +01:00
Max Kellermann 051eede1ed db/upnp/Discovery: use monotonic clock instead of time() 2014-01-18 16:26:11 +01:00
Max Kellermann 0696cac50b db/upnp/Discovery: eliminate full copy in getServer() 2014-01-18 16:18:51 +01:00
Max Kellermann 0c2485e86c db/upnp: use getServer() in Visit()
Reduce bloat.
2014-01-18 16:13:33 +01:00
Max Kellermann 7d696a7063 db/upnp/Discovery: eliminate Error attribute
Move code to method Start() and add Error& parameters to several
methods.
2014-01-18 16:08:30 +01:00
Max Kellermann 53573e950f db/upnp: remove unnecessary m_superdir nullptr checks 2014-01-18 16:02:21 +01:00
Max Kellermann 1e99983263 db/upnp: pass ContentDirectoryService references 2014-01-18 15:58:02 +01:00
Max Kellermann 5409e43fb5 db/upnp: cache m_path.back() 2014-01-18 15:44:41 +01:00
Max Kellermann f33f891c54 db/upnp: add UpnpMakeAction() helper function 2014-01-18 15:27:54 +01:00
Max Kellermann 6e55552292 db/upnp/ixmlwrap: getFirstElementValue() returns const char *
Eliminate the std::string bloat.
2014-01-18 15:01:19 +01:00
Max Kellermann e569f82dd3 db/upnp: merge duplicate nullptr check 2014-01-18 14:44:06 +01:00
Max Kellermann 1a4940bbda db/upnp: free IXML_Document *request manually 2014-01-18 14:38:52 +01:00
Max Kellermann 22dd3c8048 db/upnp/Device: move code to method Parse()
Forward the Error to the caller.
2014-01-18 14:29:31 +01:00
Max Kellermann 04b7648e00 db/upnp/Device: use ContentDirectoryDescriptor's move operator
Reduce bloat.
2014-01-18 14:26:24 +01:00
Max Kellermann be0759d465 db/upnp/Discovery: don't copy XML to std::string
Pass "const char *" to Expat.
2014-01-18 14:24:38 +01:00
Max Kellermann 339d939873 db/upnp/Discovery: fix memory leak 2014-01-18 14:03:18 +01:00
Max Kellermann c1950e40e6 db/upnp: remove unused typedef DevServIt 2014-01-18 13:42:54 +01:00
Max Kellermann ad76bad8fd db/upnp: use move operator to assign XML CDATA
Reduce runtime bloat.
2014-01-18 13:39:31 +01:00
Max Kellermann 55737e4ff6 db/upnp/Util: trimstring() constructs string from buffer
Reduce overhead by omitting the part of the buffer that consists only
of whitespace.
2014-01-18 13:36:50 +01:00
Max Kellermann f3b4ddee6c db/upnp/Discovery: free the response body
Memory leak.
2014-01-18 13:08:48 +01:00
Max Kellermann 758b504cf3 db/upnp/Discovery: don't copy the response body
Bloat.
2014-01-18 13:07:42 +01:00
Max Kellermann 416f7c2600 db/upnp: don't hold mutex while downloading device description
Must not perform blocking I/O while holding a mutex.
2014-01-18 13:04:01 +01:00
Max Kellermann b9f02f22c4 db/upnp: don't use WorkQueue for _ADVERTISEMENT_BYEBYE
Remove the ContentDirectoryDescriptor right away.  Reduces bloat.
2014-01-18 12:56:35 +01:00
Max Kellermann b635610409 db/upnp: include cleanup 2014-01-18 12:51:25 +01:00