From a4d580a6f87422798ba979d798115daca2649f81 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Jan 2014 21:35:14 +0100 Subject: db/upnp: add fallback for emplace() The method emplace() was added in gcc 4.8. This commit restores compatibility with gcc 4.7. --- src/db/UpnpDatabasePlugin.cxx | 7 ++++++- src/db/upnp/Discovery.cxx | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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; } -- cgit v1.2.3