fix compilation --without-taglib

This commit is contained in:
Andrzej Rybczak
2012-08-29 09:07:20 +02:00
parent ddeec3aea0
commit 4cb0e2232a
22 changed files with 609 additions and 247 deletions

View File

@@ -365,24 +365,16 @@ void UpdateSongList(Menu<MPD::Song> *menu)
}
#ifdef HAVE_TAGLIB_H
std::string FindSharedDir(Menu<MPD::Song> *menu)
{
MPD::SongList list;
for (size_t i = 0; i < menu->Size(); ++i)
list.push_back(&(*menu)[i]);
return FindSharedDir(list);
}
std::string FindSharedDir(const MPD::SongList &v)
{
if (v.empty()) // this should never happen, but in case...
FatalError("empty SongList passed to FindSharedDir(const SongList &)!");
size_t i = -1;
std::string first = v.front()->GetDirectory();
std::string first = v.front().getDirectory();
for (MPD::SongList::const_iterator it = ++v.begin(); it != v.end(); ++it)
{
size_t j = 0;
std::string dir = (*it)->GetDirectory();
std::string dir = it->getDirectory();
size_t length = std::min(first.length(), dir.length());
while (!first.compare(j, 1, dir, j, 1) && j < length && j < i)
++j;