db/upnp: rename variables

This commit is contained in:
Max Kellermann 2014-01-26 12:38:21 +01:00
parent bd0cfffe23
commit 4a3dc2cea2

View File

@ -69,8 +69,8 @@ public:
}; };
class UpnpDatabase : public Database { class UpnpDatabase : public Database {
LibUPnP *m_lib; LibUPnP *lib;
UPnPDeviceDirectory *m_superdir; UPnPDeviceDirectory *discovery;
public: public:
static Database *Create(EventLoop &loop, DatabaseListener &listener, static Database *Create(EventLoop &loop, DatabaseListener &listener,
@ -175,17 +175,17 @@ UpnpDatabase::Configure(const config_param &, Error &)
bool bool
UpnpDatabase::Open(Error &error) UpnpDatabase::Open(Error &error)
{ {
m_lib = new LibUPnP(); lib = new LibUPnP();
if (!m_lib->ok()) { if (!lib->ok()) {
error.Set(m_lib->GetInitError()); error.Set(lib->GetInitError());
delete m_lib; delete lib;
return false; return false;
} }
m_superdir = new UPnPDeviceDirectory(m_lib); discovery = new UPnPDeviceDirectory(lib);
if (!m_superdir->Start(error)) { if (!discovery->Start(error)) {
delete m_superdir; delete discovery;
delete m_lib; delete lib;
return false; return false;
} }
@ -198,8 +198,8 @@ UpnpDatabase::Open(Error &error)
void void
UpnpDatabase::Close() UpnpDatabase::Close()
{ {
delete m_superdir; delete discovery;
delete m_lib; delete lib;
} }
void void
@ -223,7 +223,7 @@ UpnpDatabase::GetSong(const char *uri, Error &error) const
} }
ContentDirectoryService server; ContentDirectoryService server;
if (!m_superdir->getServer(vpath.front().c_str(), server, error)) if (!discovery->getServer(vpath.front().c_str(), server, error))
return nullptr; return nullptr;
vpath.pop_front(); vpath.pop_front();
@ -277,7 +277,7 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
return true; return true;
std::list<std::string> searchcaps; std::list<std::string> searchcaps;
if (!server.getSearchCapabilities(m_lib->getclh(), searchcaps, error)) if (!server.getSearchCapabilities(lib->getclh(), searchcaps, error))
return false; return false;
if (searchcaps.empty()) if (searchcaps.empty())
@ -344,7 +344,7 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
} }
} }
return server.search(m_lib->getclh(), return server.search(lib->getclh(),
objid, cond.c_str(), dirbuf, objid, cond.c_str(), dirbuf,
error); error);
} }
@ -431,7 +431,7 @@ UpnpDatabase::ReadNode(const ContentDirectoryService &server,
Error &error) const Error &error) const
{ {
UPnPDirContent dirbuf; UPnPDirContent dirbuf;
if (!server.getMetadata(m_lib->getclh(), objid, dirbuf, error)) if (!server.getMetadata(lib->getclh(), objid, dirbuf, error))
return false; return false;
if (dirbuf.objects.size() == 1) { if (dirbuf.objects.size() == 1) {
@ -485,7 +485,7 @@ UpnpDatabase::Namei(const ContentDirectoryService &server,
return true; return true;
} }
const UpnpClient_Handle handle = m_lib->getclh(); const UpnpClient_Handle handle = lib->getclh();
std::string objid(rootid); std::string objid(rootid);
@ -663,7 +663,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
and loop here, but it's not useful as mpd will only return and loop here, but it's not useful as mpd will only return
data to the client when we're done anyway. */ data to the client when we're done anyway. */
UPnPDirContent dirbuf; UPnPDirContent dirbuf;
if (!server.readDir(m_lib->getclh(), tdirent.m_id.c_str(), dirbuf, if (!server.readDir(lib->getclh(), tdirent.m_id.c_str(), dirbuf,
error)) error))
return false; return false;
@ -692,7 +692,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
auto vpath = stringToTokens(selection.uri, "/", true); auto vpath = stringToTokens(selection.uri, "/", true);
if (vpath.empty()) { if (vpath.empty()) {
std::vector<ContentDirectoryService> servers; std::vector<ContentDirectoryService> servers;
if (!m_superdir->getDirServices(servers, error)) if (!discovery->getDirServices(servers, error))
return false; return false;
for (const auto &server : servers) { for (const auto &server : servers) {
@ -717,7 +717,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
vpath.pop_front(); vpath.pop_front();
ContentDirectoryService server; ContentDirectoryService server;
if (!m_superdir->getServer(servername.c_str(), server, error)) if (!discovery->getServer(servername.c_str(), server, error))
return false; return false;
return VisitServer(server, vpath, selection, return VisitServer(server, vpath, selection,
@ -734,7 +734,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
return true; return true;
std::vector<ContentDirectoryService> servers; std::vector<ContentDirectoryService> servers;
if (!m_superdir->getDirServices(servers, error)) if (!discovery->getDirServices(servers, error))
return false; return false;
std::set<std::string> values; std::set<std::string> values;