diff options
author | Jasmin Jessich <jasmin@anw.at> | 2017-05-19 20:31:08 +0200 |
---|---|---|
committer | Jasmin Jessich <jasmin@anw.at> | 2017-05-20 02:49:29 +0200 |
commit | eba2ad612cc25fcfcd7347f360b5506ba8921835 (patch) | |
tree | 5cb0d596e1d7e448856e28921fe83daf70ea86be | |
parent | 3aea661f98a0dbf87a4331640ad0408bdb8c4092 (diff) | |
download | vdr-plugin-live-eba2ad612cc25fcfcd7347f360b5506ba8921835.tar.gz vdr-plugin-live-eba2ad612cc25fcfcd7347f360b5506ba8921835.tar.bz2 |
gcc-6 fixes
- New file autoptr.h to switch between "std::unique_ptr" and
"std::auto_ptr" depending on the GCC version, by new macro AUTO_PTR.
- Removed some "using namespace std" and add some "#define __STL_CONFIG_H"
before including header files. This will not define "swap" in vdr/tools.h.
- Remove also "using namespace std::tr1".
-rw-r--r-- | autoptr.h | 14 | ||||
-rw-r--r-- | epgsearch/services.h | 7 | ||||
-rw-r--r-- | grab.h | 3 | ||||
-rw-r--r-- | live.cpp | 5 | ||||
-rw-r--r-- | live.h | 3 | ||||
-rw-r--r-- | pages/edit_timer.ecpp | 7 | ||||
-rw-r--r-- | recman.cpp | 57 | ||||
-rw-r--r-- | tasks.cpp | 4 | ||||
-rw-r--r-- | thread.h | 4 | ||||
-rw-r--r-- | timers.cpp | 3 |
10 files changed, 67 insertions, 40 deletions
diff --git a/autoptr.h b/autoptr.h new file mode 100644 index 0000000..3349367 --- /dev/null +++ b/autoptr.h @@ -0,0 +1,14 @@ +#ifndef VDR_LIVE_AUTOPTR_H +#define VDR_LIVE_AUTOPTR_H + +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + +#if GCC_VERSION > 50000 +# define AUTO_PTR std::unique_ptr +#else +# define AUTO_PTR std::auto_ptr +#endif + +#endif // VDR_LIVE_AUTOPTR_H diff --git a/epgsearch/services.h b/epgsearch/services.h index 35cca9b..e7f80dd 100644 --- a/epgsearch/services.h +++ b/epgsearch/services.h @@ -29,6 +29,7 @@ The project's page is at http://winni.vdr-developer.org/epgsearch #include <memory> #include <set> #include <vdr/osdbase.h> +#include "../autoptr.h" // Data structure for service "Epgsearch-search-v1.0" struct Epgsearch_search_v1_0 @@ -157,7 +158,7 @@ class cServiceHandler struct Epgsearch_services_v1_0 { // in/out - std::auto_ptr<cServiceHandler> handler; + AUTO_PTR<cServiceHandler> handler; }; // Data structures for service "Epgsearch-services-v1.1" @@ -173,7 +174,7 @@ class cServiceHandler_v1_1 : public cServiceHandler struct Epgsearch_services_v1_1 { // in/out - std::auto_ptr<cServiceHandler_v1_1> handler; + AUTO_PTR<cServiceHandler_v1_1> handler; }; // Data structures for service "Epgsearch-services-v1.2" @@ -189,7 +190,7 @@ class cServiceHandler_v1_2 : public cServiceHandler_v1_1 struct Epgsearch_services_v1_2 { // in/out - std::auto_ptr<cServiceHandler_v1_2> handler; + AUTO_PTR<cServiceHandler_v1_2> handler; }; #endif @@ -3,6 +3,7 @@ #include "stdext.h" #include "tasks.h" +#include "autoptr.h" namespace vdrlive { @@ -28,7 +29,7 @@ private: void PutImage( char* image, int size ); - std::auto_ptr< GrabImageTask > m_task; + AUTO_PTR< GrabImageTask > m_task; GrabImagePtr m_image; int m_size; }; @@ -4,6 +4,9 @@ * See the README file for copyright information and how to reach the author. */ +// To get rid of the swap definition in vdr/tools.h +#define __STL_CONFIG_H + #include <vdr/config.h> #include <vdr/plugin.h> #include "i18n.h" @@ -18,8 +21,6 @@ namespace vdrlive { -using namespace std; - const char *Plugin::VERSION = LIVEVERSION; const char *Plugin::DESCRIPTION = LIVESUMMARY; @@ -6,6 +6,7 @@ #include <vdr/config.h> #include <vdr/plugin.h> #include "thread.h" +#include "autoptr.h" namespace vdrlive { @@ -33,7 +34,7 @@ private: static std::string m_configDirectory; static std::string m_resourceDirectory; - std::auto_ptr< ServerThread > m_thread; + AUTO_PTR< ServerThread > m_thread; }; } // namespace vdrlive diff --git a/pages/edit_timer.ecpp b/pages/edit_timer.ecpp index 8920b77..ecc8c6e 100644 --- a/pages/edit_timer.ecpp +++ b/pages/edit_timer.ecpp @@ -1,4 +1,8 @@ <%pre> + +// To get rid of the swap definition in vdr/tools.h +#define __STL_CONFIG_H + #include <memory> #include <vdr/channels.h> #include <vdr/config.h> @@ -14,6 +18,7 @@ #include "livefeatures.h" #include "epgsearch.h" #include "users.h" +#include "autoptr.h" using namespace std; using namespace vdrlive; @@ -106,7 +111,7 @@ cTimer* timer; if (message.empty()) edit_timerreferer = request.getHeader("Referer:", "timers.html"); - auto_ptr< cTimer > eventTimer; + AUTO_PTR< cTimer > eventTimer; if ( timer == 0 && !epgid.empty()) { EpgEvents::DecodeDomId(epgid, channelid, eventid); if ( channelid.Valid() && eventid != 0 ) { @@ -14,18 +14,19 @@ #define INDEXFILESUFFIX "/index.vdr" #define LENGTHFILESUFFIX "/length.vdr" -using namespace std::tr1; -using namespace std; +using std::string; +using std::vector; +using std::pair; namespace vdrlive { /** * Implementation of class RecordingsManager: */ - weak_ptr< RecordingsManager > RecordingsManager::m_recMan; - shared_ptr< RecordingsTree > RecordingsManager::m_recTree; - shared_ptr< RecordingsList > RecordingsManager::m_recList; - shared_ptr< DirectoryList > RecordingsManager::m_recDirs; + std::tr1::weak_ptr< RecordingsManager > RecordingsManager::m_recMan; + std::tr1::shared_ptr< RecordingsTree > RecordingsManager::m_recTree; + std::tr1::shared_ptr< RecordingsList > RecordingsManager::m_recList; + std::tr1::shared_ptr< DirectoryList > RecordingsManager::m_recDirs; time_t RecordingsManager::m_recordingsState = 0; string RecordingsManager::m_UpdateFileName; @@ -35,7 +36,7 @@ namespace vdrlive { // use any longer, it will be freed automaticaly, which leads to a // release of the VDR recordings lock. Upon requesting access to // the RecordingsManager via LiveRecordingsManger function, first - // the weak ptr is locked (obtaining a shared_ptr from an possible + // the weak ptr is locked (obtaining a std::tr1::shared_ptr from an possible // existing instance) and if not successfull a new instance is // created, which again locks the VDR Recordings. // @@ -58,7 +59,7 @@ namespace vdrlive { { RecordingsManagerPtr recMan = EnsureValidData(); if (! recMan) { - return RecordingsTreePtr(recMan, shared_ptr< RecordingsTree >()); + return RecordingsTreePtr(recMan, std::tr1::shared_ptr< RecordingsTree >()); } return RecordingsTreePtr(recMan, m_recTree); } @@ -67,25 +68,25 @@ namespace vdrlive { { RecordingsManagerPtr recMan = EnsureValidData(); if (! recMan) { - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >()); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >()); } - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); } RecordingsListPtr RecordingsManager::GetRecordingsList(time_t begin, time_t end, bool ascending) const { RecordingsManagerPtr recMan = EnsureValidData(); if (! recMan) { - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >()); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >()); } - return RecordingsListPtr(recMan, shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); + return RecordingsListPtr(recMan, std::tr1::shared_ptr< RecordingsList >(new RecordingsList(m_recList, ascending))); } DirectoryListPtr RecordingsManager::GetDirectoryList() const { RecordingsManagerPtr recMan = EnsureValidData(); if (!recMan) { - return DirectoryListPtr(recMan, shared_ptr< DirectoryList >()); + return DirectoryListPtr(recMan, std::tr1::shared_ptr< DirectoryList >()); } return DirectoryListPtr(recMan, m_recDirs); } @@ -211,7 +212,7 @@ namespace vdrlive { if (archiveType==1) { string dvdFile = filename + "/dvd.vdr"; - ifstream dvd(dvdFile.c_str()); + std::ifstream dvd(dvdFile.c_str()); if (dvd) { string archiveDisc; @@ -225,7 +226,7 @@ namespace vdrlive { } } else if(archiveType==2) { string hddFile = filename + "/hdd.vdr"; - ifstream hdd(hddFile.c_str()); + std::ifstream hdd(hddFile.c_str()); if (hdd) { string archiveDisc; @@ -274,7 +275,7 @@ namespace vdrlive { RecordingsManagerPtr RecordingsManager::EnsureValidData() { // Get singleton instance of RecordingsManager. 'this' is not - // an instance of shared_ptr of the singleton + // an instance of std::tr1::shared_ptr of the singleton // RecordingsManager, so we obtain it in the overall // recommended way. RecordingsManagerPtr recMan = LiveRecordingsManager(); @@ -298,21 +299,21 @@ namespace vdrlive { m_recDirs.reset(); } if (stateChanged || !m_recTree) { - m_recTree = shared_ptr< RecordingsTree >(new RecordingsTree(recMan)); + m_recTree = std::tr1::shared_ptr< RecordingsTree >(new RecordingsTree(recMan)); } if (!m_recTree) { esyslog("[LIVE]: creation of recordings tree failed!"); return RecordingsManagerPtr(); } if (stateChanged || !m_recList) { - m_recList = shared_ptr< RecordingsList >(new RecordingsList(RecordingsTreePtr(recMan, m_recTree))); + m_recList = std::tr1::shared_ptr< RecordingsList >(new RecordingsList(RecordingsTreePtr(recMan, m_recTree))); } if (!m_recList) { esyslog("[LIVE]: creation of recordings list failed!"); return RecordingsManagerPtr(); } if (stateChanged || !m_recDirs) { - m_recDirs = shared_ptr< DirectoryList >(new DirectoryList(recMan)); + m_recDirs = std::tr1::shared_ptr< DirectoryList >(new DirectoryList(recMan)); } if (!m_recDirs) { esyslog("[LIVE]: creation of directory list failed!"); @@ -546,13 +547,13 @@ namespace vdrlive { * Implementation of class RecordingsTreePtr: */ RecordingsTreePtr::RecordingsTreePtr() : - shared_ptr<RecordingsTree>(), + std::tr1::shared_ptr<RecordingsTree>(), m_recManPtr() { } RecordingsTreePtr::RecordingsTreePtr(RecordingsManagerPtr recManPtr, std::tr1::shared_ptr< RecordingsTree > recTree) : - shared_ptr<RecordingsTree>(recTree), + std::tr1::shared_ptr<RecordingsTree>(recTree), m_recManPtr(recManPtr) { } @@ -572,7 +573,7 @@ namespace vdrlive { return; } - stack< RecordingsItemPtr > treeStack; + std::stack< RecordingsItemPtr > treeStack; treeStack.push(recTree->Root()); while (!treeStack.empty()) { @@ -590,7 +591,7 @@ namespace vdrlive { } } - RecordingsList::RecordingsList(shared_ptr< RecordingsList > recList, bool ascending) : + RecordingsList::RecordingsList(std::tr1::shared_ptr< RecordingsList > recList, bool ascending) : m_pRecVec(new RecVecType(recList->size())) { if (!m_pRecVec) { @@ -604,7 +605,7 @@ namespace vdrlive { } } - RecordingsList::RecordingsList(shared_ptr< RecordingsList > recList, time_t begin, time_t end, bool ascending) : + RecordingsList::RecordingsList(std::tr1::shared_ptr< RecordingsList > recList, time_t begin, time_t end, bool ascending) : m_pRecVec(new RecVecType()) { if (end > begin) { @@ -646,8 +647,8 @@ namespace vdrlive { /** * Implementation of class RecordingsList: */ - RecordingsListPtr::RecordingsListPtr(RecordingsManagerPtr recManPtr, shared_ptr< RecordingsList > recList) : - shared_ptr< RecordingsList >(recList), + RecordingsListPtr::RecordingsListPtr(RecordingsManagerPtr recManPtr, std::tr1::shared_ptr< RecordingsList > recList) : + std::tr1::shared_ptr< RecordingsList >(recList), m_recManPtr(recManPtr) { } @@ -716,8 +717,8 @@ namespace vdrlive { /** * Implementation of class DirectoryListPtr: */ - DirectoryListPtr::DirectoryListPtr(RecordingsManagerPtr recManPtr, shared_ptr< DirectoryList > recDirs) : - shared_ptr< DirectoryList >(recDirs), + DirectoryListPtr::DirectoryListPtr(RecordingsManagerPtr recManPtr, std::tr1::shared_ptr< DirectoryList > recDirs) : + std::tr1::shared_ptr< DirectoryList >(recDirs), m_recManPtr(recManPtr) { } @@ -13,8 +13,8 @@ namespace vdrlive { -using namespace std; -using namespace std::tr1; +using std::for_each; +using std::tr1::bind; using namespace std::tr1::placeholders; const char* NowReplaying() @@ -3,6 +3,8 @@ #include <memory> #include <vdr/thread.h> +#include "autoptr.h" + namespace tnt { class Tntnet; } @@ -19,7 +21,7 @@ protected: virtual void Action(); private: - std::auto_ptr< tnt::Tntnet > m_server; + AUTO_PTR< tnt::Tntnet > m_server; }; } // namespace vdrlive @@ -5,6 +5,7 @@ #include "timers.h" #include "tools.h" #include "i18n.h" +#include "autoptr.h" static bool operator<( cTimer const& left, cTimer const& right ) { @@ -272,7 +273,7 @@ namespace vdrlive { void TimerManager::DoInsertTimer( TimerPair& timerData ) { - auto_ptr< cTimer > newTimer( new cTimer ); + AUTO_PTR< cTimer > newTimer( new cTimer ); if ( !newTimer->Parse( timerData.second.c_str() ) ) { StoreError( timerData, tr("Error in timer settings") ); return; |