aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-13 21:35:14 +0100
committerMax Kellermann <max@duempel.org>2014-01-13 22:24:48 +0100
commita4d580a6f87422798ba979d798115daca2649f81 (patch)
tree3cb0d44e99298e643079b4d9cf6140fbbe43261f
parentca43e634b5adfebdcb9c3c8f61cebf38d42827e0 (diff)
downloadmpd-a4d580a6f87422798ba979d798115daca2649f81.tar.gz
mpd-a4d580a6f87422798ba979d798115daca2649f81.tar.xz
mpd-a4d580a6f87422798ba979d798115daca2649f81.zip
db/upnp: add fallback for emplace()
The method emplace() was added in gcc 4.8. This commit restores compatibility with gcc 4.7.
-rw-r--r--src/db/UpnpDatabasePlugin.cxx7
-rw-r--r--src/db/upnp/Discovery.cxx4
2 files changed, 10 insertions, 1 deletions
diff --git a/src/db/UpnpDatabasePlugin.cxx b/src/db/UpnpDatabasePlugin.cxx
index 68a24cb4f..78171562e 100644
--- a/src/db/UpnpDatabasePlugin.cxx
+++ b/src/db/UpnpDatabasePlugin.cxx
@@ -829,8 +829,13 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
for (auto &dirent : dirbuf.m_items) {
std::string tagvalue;
- if (getTagValue(dirent, tag, tagvalue))
+ if (getTagValue(dirent, tag, tagvalue)) {
+#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
values.emplace(std::move(tagvalue));
+#else
+ values.insert(std::move(tagvalue));
+#endif
+ }
}
}
diff --git a/src/db/upnp/Discovery.cxx b/src/db/upnp/Discovery.cxx
index 8a2b7046d..23705271d 100644
--- a/src/db/upnp/Discovery.cxx
+++ b/src/db/upnp/Discovery.cxx
@@ -142,7 +142,11 @@ discoExplorer(void *)
continue;
}
+#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
auto e = contentDirectories.m_directories.emplace(tsk->deviceId, d);
+#else
+ auto e = contentDirectories.m_directories.insert(std::make_pair(tsk->deviceId, d));
+#endif
if (!e.second)
e.first->second = d;
}