removed all methods related to loading string blocks into memory. afaik this is obsol...
authorwsoltys <wiso@no.way>
Thu, 12 Sep 2013 19:21:29 +0000 (21:21 +0200)
committerwsoltys <wiso@no.way>
Tue, 1 Oct 2013 18:33:38 +0000 (20:33 +0200)
xbmc/addons/AddonCallbacksGUI.cpp
xbmc/addons/AddonCallbacksGUI.h
xbmc/guilib/LocalizeStrings.cpp
xbmc/guilib/LocalizeStrings.h
xbmc/interfaces/legacy/WindowXML.cpp
xbmc/interfaces/legacy/WindowXML.h

index d140e41..51870c7 100644 (file)
@@ -1431,9 +1431,6 @@ void CGUIAddonWindow::AllocResources(bool forceLoad /*= FALSE */)
 
 void CGUIAddonWindow::FreeResources(bool forceUnLoad /*= FALSE */)
 {
-  // Unload temporary language strings
-  ClearAddonStrings();
-
   CGUIMediaWindow::FreeResources(forceUnLoad);
 }
 
@@ -1519,12 +1516,6 @@ void CGUIAddonWindow::PulseActionEvent()
   m_actionEvent.Set();
 }
 
-void CGUIAddonWindow::ClearAddonStrings()
-{
-  // Unload temporary language strings
-  g_localizeStrings.ClearBlock(m_addon->Path());
-}
-
 bool CGUIAddonWindow::OnClick(int iItem)
 {
   // Hook Over calling  CGUIMediaWindow::OnClick(iItem) results in it trying to PLAY the file item
index 3d0fd4c..fadd857 100644 (file)
@@ -146,7 +146,6 @@ public:
 protected:
   virtual void     Update();
   virtual void     GetContextButtons(int itemNumber, CContextButtons &buttons);
-  void             ClearAddonStrings();
   void             SetupShares();
 
   bool (*CBOnInit)(GUIHANDLE cbhdl);
index 5a5f322..0acc669 100644 (file)
@@ -259,43 +259,3 @@ void CLocalizeStrings::Clear(uint32_t start, uint32_t end)
       ++it;
   }
 }
-
-uint32_t CLocalizeStrings::LoadBlock(const CStdString &id, const CStdString &path, const CStdString &language)
-{
-  iBlocks it = m_blocks.find(id);
-  if (it != m_blocks.end())
-    return it->second;  // already loaded
-
-  // grab a new block
-  uint32_t offset = block_start + m_blocks.size()*block_size;
-  m_blocks.insert(make_pair(id, offset));
-
-  // load the strings
-  CStdString encoding;
-  bool success = LoadStr2Mem(path, language, encoding, offset);
-  if (!success)
-  {
-    if (language.Equals(SOURCE_LANGUAGE)) // no fallback, nothing to do
-      return 0;
-  }
-
-  // load the fallback
-  if (!language.Equals(SOURCE_LANGUAGE))
-    success |= LoadStr2Mem(path, SOURCE_LANGUAGE, encoding, offset);
-
-  return success ? offset : 0;
-}
-
-void CLocalizeStrings::ClearBlock(const CStdString &id)
-{
-  iBlocks it = m_blocks.find(id);
-  if (it == m_blocks.end())
-  {
-    CLog::Log(LOGERROR, "%s: Trying to clear non existent block %s", __FUNCTION__, id.c_str());
-    return; // doesn't exist
-  }
-
-  // clear our block
-  Clear(it->second, it->second + block_size);
-  m_blocks.erase(it);
-}
index e27656a..8b0e6fa 100644 (file)
@@ -57,8 +57,6 @@ public:
   void ClearSkinStrings();
   const CStdString& Get(uint32_t code) const;
   void Clear();
-  uint32_t LoadBlock(const CStdString &id, const CStdString &path, const CStdString &language);
-  void ClearBlock(const CStdString &id);
 protected:
   void Clear(uint32_t start, uint32_t end);
 
@@ -98,10 +96,6 @@ protected:
   typedef std::map<uint32_t, LocStr>::const_iterator ciStrings;
   typedef std::map<uint32_t, LocStr>::iterator       iStrings;
 
-  static const uint32_t block_start = 0xf000000;
-  static const uint32_t block_size = 4096;
-  std::map<CStdString, uint32_t> m_blocks;
-  typedef std::map<CStdString, uint32_t>::iterator iBlocks;
   CCriticalSection m_critSection;
 };
 
index 3962ca5..3203f35 100644 (file)
@@ -421,8 +421,6 @@ namespace XBMCAddon
     void WindowXML::FreeResources(bool forceUnLoad /*= FALSE */)
     {
       TRACE;
-      // Unload temporary language strings
-      ClearScriptStrings();
 
       ref(window)->FreeResources(forceUnLoad);
     }
@@ -467,8 +465,6 @@ namespace XBMCAddon
         CLog::Log(LOGERROR, "%s: Unable to load skin file %s", __FUNCTION__, strPath.c_str());
         return false;
       }
-      // load the strings in
-      unsigned int offset = LoadScriptStrings();
 
       CStdString xml;
       char *buffer = new char[(unsigned int)file.GetLength()+1];
@@ -479,22 +475,6 @@ namespace XBMCAddon
       {
         buffer[size] = 0;
         xml = buffer;
-        if (offset)
-        {
-          // replace the occurences of SCRIPT### with offset+###
-          // not particularly efficient, but it works
-          int pos = xml.Find("SCRIPT");
-          while (pos != (int)CStdString::npos)
-          {
-            CStdString num = xml.Mid(pos + 6, 4);
-            int number = atol(num.c_str());
-            CStdString oldNumber, newNumber;
-            oldNumber.Format("SCRIPT%d", number);
-            newNumber.Format("%lu", offset + number);
-            xml.Replace(oldNumber, newNumber);
-            pos = xml.Find("SCRIPT", pos + 6);
-          }
-        }
       }
       delete[] buffer;
 
@@ -507,25 +487,6 @@ namespace XBMCAddon
       return interceptor->Load(xmlDoc.RootElement());
     }
 
-    unsigned int WindowXML::LoadScriptStrings()
-    {
-      TRACE;
-      // Path where the language strings reside
-      CStdString pathToLanguageFile = URIUtils::AddFileToFolder(m_scriptPath, "resources");
-      pathToLanguageFile = URIUtils::AddFileToFolder(pathToLanguageFile, "language");
-      URIUtils::AddSlashAtEnd(pathToLanguageFile);
-
-      // allocate a bunch of strings
-      return g_localizeStrings.LoadBlock(m_scriptPath, pathToLanguageFile, CSettings::Get().GetString("locale.language"));
-    }
-
-    void WindowXML::ClearScriptStrings()
-    {
-      TRACE;
-      // Unload temporary language strings
-      g_localizeStrings.ClearBlock(m_scriptPath);
-    }
-
     void WindowXML::SetupShares()
     {
       TRACE;
index 8b9c2c8..07c2ac3 100644 (file)
@@ -105,8 +105,6 @@ namespace XBMCAddon
       SWIGHIDDENVIRTUAL void     GetContextButtons(int itemNumber, CContextButtons &buttons);
       SWIGHIDDENVIRTUAL bool     Update(const String &strPath);
 
-      unsigned int     LoadScriptStrings();
-      void             ClearScriptStrings();
       void             SetupShares();
       String       m_scriptPath;
       String       m_mediaDir;