Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
changed: get rid of old EXE section cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
spiff committed Apr 30, 2012
1 parent 4505d08 commit d66af94
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 137 deletions.
2 changes: 0 additions & 2 deletions xbmc/ApplicationMessenger.cpp
Expand Up @@ -26,7 +26,6 @@
#include "guilib/TextureManager.h" #include "guilib/TextureManager.h"
#include "PlayListPlayer.h" #include "PlayListPlayer.h"
#include "Util.h" #include "Util.h"
#include "SectionLoader.h"
#ifdef HAS_PYTHON #ifdef HAS_PYTHON
#include "interfaces/python/XBPython.h" #include "interfaces/python/XBPython.h"
#endif #endif
Expand Down Expand Up @@ -516,7 +515,6 @@ case TMSG_POWERDOWN:
#ifdef HAS_HTTPAPI #ifdef HAS_HTTPAPI
if (!m_pXbmcHttp) if (!m_pXbmcHttp)
{ {
CSectionLoader::Load("LIBHTTP");
m_pXbmcHttp = new CXbmcHttp(); m_pXbmcHttp = new CXbmcHttp();
} }
switch (m_pXbmcHttp->xbmcCommand(pMsg->strParam)) switch (m_pXbmcHttp->xbmcCommand(pMsg->strParam))
Expand Down
104 changes: 0 additions & 104 deletions xbmc/SectionLoader.cpp
Expand Up @@ -45,81 +45,6 @@ CSectionLoader::~CSectionLoader(void)
UnloadAll(); UnloadAll();
} }


bool CSectionLoader::IsLoaded(const CStdString& strSection)
{
CSingleLock lock(g_sectionLoader.m_critSection);

for (int i = 0; i < (int)g_sectionLoader.m_vecLoadedSections.size(); ++i)
{
CSection& section = g_sectionLoader.m_vecLoadedSections[i];
if (section.m_strSectionName == strSection && section.m_lReferenceCount > 0) return true;
}
return false;
}

bool CSectionLoader::Load(const CStdString& strSection)
{
CSingleLock lock(g_sectionLoader.m_critSection);

for (int i = 0; i < (int)g_sectionLoader.m_vecLoadedSections.size(); ++i)
{
CSection& section = g_sectionLoader.m_vecLoadedSections[i];
if (section.m_strSectionName == strSection)
{

#ifdef LOGALL
CLog::Log(LOGDEBUG,"SECTION:LoadSection(%s) count:%i\n", strSection.c_str(), section.m_lReferenceCount);
#endif

section.m_lReferenceCount++;
return true;
}
}

#ifdef HAS_SECTIONS
if ( NULL == XLoadSection(strSection.c_str() ) )
{
CLog::Log(LOGDEBUG,"SECTION:LoadSection(%s) load failed!!\n", strSection.c_str());
return false;
}
HANDLE hHandle = XGetSectionHandle(strSection.c_str());

CLog::Log(LOGDEBUG,"SECTION:Section %s loaded count:1 size:%i\n", strSection.c_str(), XGetSectionSize(hHandle) );
#endif

CSection newSection;
newSection.m_strSectionName = strSection;
newSection.m_lReferenceCount = 1;
g_sectionLoader.m_vecLoadedSections.push_back(newSection);
return true;
}

void CSectionLoader::Unload(const CStdString& strSection)
{
CSingleLock lock(g_sectionLoader.m_critSection);
if (!CSectionLoader::IsLoaded(strSection)) return ;

ivecLoadedSections i;
i = g_sectionLoader.m_vecLoadedSections.begin();
while (i != g_sectionLoader.m_vecLoadedSections.end())
{
CSection& section = *i;
if (section.m_strSectionName == strSection)
{
#ifdef LOGALL
CLog::Log(LOGDEBUG,"SECTION:FreeSection(%s) count:%i\n", strSection.c_str(), section.m_lReferenceCount);
#endif
section.m_lReferenceCount--;
if ( 0 == section.m_lReferenceCount)
{
section.m_unloadDelayStartTick = XbmcThreads::SystemClockMillis();
return ;
}
}
++i;
}
}

LibraryLoader *CSectionLoader::LoadDLL(const CStdString &dllname, bool bDelayUnload /*=true*/, bool bLoadSymbols /*=false*/) LibraryLoader *CSectionLoader::LoadDLL(const CStdString &dllname, bool bDelayUnload /*=true*/, bool bLoadSymbols /*=false*/)
{ {
CSingleLock lock(g_sectionLoader.m_critSection); CSingleLock lock(g_sectionLoader.m_critSection);
Expand Down Expand Up @@ -186,22 +111,6 @@ void CSectionLoader::UnloadDelayed()
{ {
CSingleLock lock(g_sectionLoader.m_critSection); CSingleLock lock(g_sectionLoader.m_critSection);


ivecLoadedSections i = g_sectionLoader.m_vecLoadedSections.begin();
while( i != g_sectionLoader.m_vecLoadedSections.end() )
{
CSection& section = *i;
if( section.m_lReferenceCount == 0 && XbmcThreads::SystemClockMillis() - section.m_unloadDelayStartTick > UNLOAD_DELAY)
{
CLog::Log(LOGDEBUG,"SECTION:UnloadDelayed(SECTION: %s)", section.m_strSectionName.c_str());
#ifdef HAS_SECTIONS
XFreeSection(section.m_strSectionName.c_str());
#endif
i = g_sectionLoader.m_vecLoadedSections.erase(i);
continue;
}
i++;
}

// check if we can unload any unreferenced dlls // check if we can unload any unreferenced dlls
for (int i = 0; i < (int)g_sectionLoader.m_vecLoadedDLLs.size(); ++i) for (int i = 0; i < (int)g_sectionLoader.m_vecLoadedDLLs.size(); ++i)
{ {
Expand All @@ -220,19 +129,6 @@ void CSectionLoader::UnloadDelayed()


void CSectionLoader::UnloadAll() void CSectionLoader::UnloadAll()
{ {
ivecLoadedSections i;
i = g_sectionLoader.m_vecLoadedSections.begin();
while (i != g_sectionLoader.m_vecLoadedSections.end())
{
CSection& section = *i;
//g_sectionLoader.m_vecLoadedSections.erase(i);
CLog::Log(LOGDEBUG,"SECTION:UnloadAll(SECTION: %s)", section.m_strSectionName.c_str());
#ifdef HAS_SECTIONS
XFreeSection(section.m_strSectionName.c_str());
#endif
i = g_sectionLoader.m_vecLoadedSections.erase(i);
}

// delete the dll's // delete the dll's
CSingleLock lock(g_sectionLoader.m_critSection); CSingleLock lock(g_sectionLoader.m_critSection);
vector<CDll>::iterator it = g_sectionLoader.m_vecLoadedDLLs.begin(); vector<CDll>::iterator it = g_sectionLoader.m_vecLoadedDLLs.begin();
Expand Down
12 changes: 0 additions & 12 deletions xbmc/SectionLoader.h
Expand Up @@ -30,13 +30,6 @@ class LibraryLoader;
class CSectionLoader class CSectionLoader
{ {
public: public:
class CSection
{
public:
CStdString m_strSectionName;
long m_lReferenceCount;
unsigned int m_unloadDelayStartTick;
};
class CDll class CDll
{ {
public: public:
Expand All @@ -49,15 +42,10 @@ class CSectionLoader
CSectionLoader(void); CSectionLoader(void);
virtual ~CSectionLoader(void); virtual ~CSectionLoader(void);


static bool IsLoaded(const CStdString& strSection);
static bool Load(const CStdString& strSection);
static void Unload(const CStdString& strSection);
static LibraryLoader* LoadDLL(const CStdString& strSection, bool bDelayUnload=true, bool bLoadSymbols=false); static LibraryLoader* LoadDLL(const CStdString& strSection, bool bDelayUnload=true, bool bLoadSymbols=false);
static void UnloadDLL(const CStdString& strSection); static void UnloadDLL(const CStdString& strSection);
static void UnloadDelayed(); static void UnloadDelayed();
protected: protected:
std::vector<CSection> m_vecLoadedSections;
typedef std::vector<CSection>::iterator ivecLoadedSections;
std::vector<CDll> m_vecLoadedDLLs; std::vector<CDll> m_vecLoadedDLLs;
CCriticalSection m_critSection; CCriticalSection m_critSection;


Expand Down
3 changes: 0 additions & 3 deletions xbmc/filesystem/DAAPDirectory.cpp
Expand Up @@ -22,7 +22,6 @@
#include "DAAPDirectory.h" #include "DAAPDirectory.h"
#include "music/tags/MusicInfoTag.h" #include "music/tags/MusicInfoTag.h"
#include "FileItem.h" #include "FileItem.h"
#include "SectionLoader.h"
#include "utils/log.h" #include "utils/log.h"
#include "utils/URIUtils.h" #include "utils/URIUtils.h"


Expand All @@ -37,7 +36,6 @@ const char unknownArtistAlbum[] = "Unknown";


CDAAPDirectory::CDAAPDirectory(void) CDAAPDirectory::CDAAPDirectory(void)
{ {
CSectionLoader::Load("LIBXDAAP");
// m_currLevel holds where we are in the playlist/artist/album/songs hierarchy (0,1,2,3) // m_currLevel holds where we are in the playlist/artist/album/songs hierarchy (0,1,2,3)
m_currLevel = -1; m_currLevel = -1;
m_thisHost = NULL; m_thisHost = NULL;
Expand All @@ -55,7 +53,6 @@ CDAAPDirectory::~CDAAPDirectory(void)
m_artisthead = NULL; m_artisthead = NULL;


m_currentSongItems = NULL; m_currentSongItems = NULL;
CSectionLoader::Unload("LIBXDAAP");
} }


bool CDAAPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items) bool CDAAPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
Expand Down
3 changes: 0 additions & 3 deletions xbmc/filesystem/DAAPFile.cpp
Expand Up @@ -19,7 +19,6 @@
*/ */


#include "DAAPFile.h" #include "DAAPFile.h"
#include "SectionLoader.h"
#include "threads/SingleLock.h" #include "threads/SingleLock.h"
#include "utils/log.h" #include "utils/log.h"
#include <sys/stat.h> #include <sys/stat.h>
Expand Down Expand Up @@ -79,8 +78,6 @@ void CDaapClient::Release()


DAAP_SClientHost* CDaapClient::GetHost(const CStdString &strHost) DAAP_SClientHost* CDaapClient::GetHost(const CStdString &strHost)
{ {
//We need this section from now on
if( !CSectionLoader::IsLoaded("LIBXDAAP") ) CSectionLoader::Load("LIBXDAAP");
try try
{ {


Expand Down
3 changes: 0 additions & 3 deletions xbmc/filesystem/RTVDirectory.cpp
Expand Up @@ -25,7 +25,6 @@


#include "RTVDirectory.h" #include "RTVDirectory.h"
#include "utils/URIUtils.h" #include "utils/URIUtils.h"
#include "SectionLoader.h"
#include "URL.h" #include "URL.h"
#include "tinyXML/tinyxml.h" #include "tinyXML/tinyxml.h"
#include "FileItem.h" #include "FileItem.h"
Expand All @@ -43,12 +42,10 @@ extern "C"


CRTVDirectory::CRTVDirectory(void) CRTVDirectory::CRTVDirectory(void)
{ {
CSectionLoader::Load("LIBRTV");
} }


CRTVDirectory::~CRTVDirectory(void) CRTVDirectory::~CRTVDirectory(void)
{ {
CSectionLoader::Unload("LIBRTV");
} }


//********************************************************************************************* //*********************************************************************************************
Expand Down
3 changes: 0 additions & 3 deletions xbmc/filesystem/RTVFile.cpp
Expand Up @@ -24,7 +24,6 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////


#include "RTVFile.h" #include "RTVFile.h"
#include "SectionLoader.h"
#include "URL.h" #include "URL.h"
#include "utils/log.h" #include "utils/log.h"
#include <errno.h> #include <errno.h>
Expand All @@ -46,7 +45,6 @@ using namespace XFILE;


CRTVFile::CRTVFile() CRTVFile::CRTVFile()
{ {
CSectionLoader::Load("LIBRTV");
m_filePos = 0; m_filePos = 0;
m_fileSize = 0; m_fileSize = 0;
m_bOpened = false; m_bOpened = false;
Expand All @@ -56,7 +54,6 @@ CRTVFile::CRTVFile()
CRTVFile::~CRTVFile() CRTVFile::~CRTVFile()
{ {
Close(); Close();
CSectionLoader::Unload("LIBRTV");
} }


//********************************************************************************************* //*********************************************************************************************
Expand Down
7 changes: 0 additions & 7 deletions xbmc/utils/LangCodeExpander.cpp
Expand Up @@ -20,7 +20,6 @@
*/ */


#include "LangCodeExpander.h" #include "LangCodeExpander.h"
#include "SectionLoader.h"
#include "tinyXML/tinyxml.h" #include "tinyXML/tinyxml.h"
#include "utils/log.h" #include "utils/log.h"


Expand Down Expand Up @@ -223,33 +222,27 @@ bool CLangCodeExpander::LookupInDb(CStdString& desc, const CStdString& code)
sCode.TrimRight(); sCode.TrimRight();
if(sCode.length() == 2) if(sCode.length() == 2)
{ {
CSectionLoader::Load("LCODE");
longcode = MAKECODE('\0', '\0', sCode[0], sCode[1]); longcode = MAKECODE('\0', '\0', sCode[0], sCode[1]);
for(unsigned int i = 0; i < sizeof(g_iso639_1) / sizeof(LCENTRY); i++) for(unsigned int i = 0; i < sizeof(g_iso639_1) / sizeof(LCENTRY); i++)
{ {
if(g_iso639_1[i].code == longcode) if(g_iso639_1[i].code == longcode)
{ {
desc = g_iso639_1[i].name; desc = g_iso639_1[i].name;
CSectionLoader::Unload("LCODE");
return true; return true;
} }
} }
CSectionLoader::Unload("LCODE");
} }
else if(code.length() == 3) else if(code.length() == 3)
{ {
CSectionLoader::Load("LCODE");
longcode = MAKECODE('\0', sCode[0], sCode[1], sCode[2]); longcode = MAKECODE('\0', sCode[0], sCode[1], sCode[2]);
for(unsigned int i = 0; i < sizeof(g_iso639_2) / sizeof(LCENTRY); i++) for(unsigned int i = 0; i < sizeof(g_iso639_2) / sizeof(LCENTRY); i++)
{ {
if(g_iso639_2[i].code == longcode) if(g_iso639_2[i].code == longcode)
{ {
desc = g_iso639_2[i].name; desc = g_iso639_2[i].name;
CSectionLoader::Unload("LCODE");
return true; return true;
} }
} }
CSectionLoader::Unload("LCODE");
} }
return false; return false;
} }
Expand Down

0 comments on commit d66af94

Please sign in to comment.