aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPär Björklund <per.bjorklund@gmail.com>2016-09-22 18:16:12 +0200
committerGitHub <noreply@github.com>2016-09-22 18:16:12 +0200
commit48b57c85e4cb71834a2bb18d2661b4d36f4cb808 (patch)
treef68cd018c00d2b41462f31d41b977b590f8aea42
parent8465b196e3bfc2a199d3498c6e33537f22ce7b9d (diff)
parent495346a5378522103004dcacc0fbdf348f46051a (diff)
Merge pull request #10491 from Jalle19/drop-random-utils
Drop AsyncFileCopy and some random seemingly unused stuff
-rw-r--r--xbmc/Application.cpp4
-rw-r--r--xbmc/guilib/GUIFontTTF.cpp2
-rw-r--r--xbmc/pvr/PVRDatabase.cpp1
-rw-r--r--xbmc/pvr/PVRDatabase.h2
-rw-r--r--xbmc/utils/AsyncFileCopy.cpp112
-rw-r--r--xbmc/utils/AsyncFileCopy.h54
-rw-r--r--xbmc/utils/CMakeLists.txt2
-rw-r--r--xbmc/utils/test/CMakeLists.txt1
-rw-r--r--xbmc/utils/test/TestAsyncFileCopy.cpp55
9 files changed, 0 insertions, 233 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 945043fdb5..7bfe9e76b6 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -247,10 +247,6 @@ using namespace XbmcThreads;
using KODI::MESSAGING::HELPERS::DialogResponse;
-// uncomment this if you want to use release libs in the debug build.
-// Atm this saves you 7 mb of memory
-#define USE_RELEASE_LIBS
-
#define MAX_FFWD_SPEED 5
//extern IDirectSoundRenderer* m_pAudioDecoder;
diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp
index b5a937c307..9e59eb8eb5 100644
--- a/xbmc/guilib/GUIFontTTF.cpp
+++ b/xbmc/guilib/GUIFontTTF.cpp
@@ -42,8 +42,6 @@
#include FT_OUTLINE_H
#include FT_STROKER_H
-#define USE_RELEASE_LIBS
-
#ifdef TARGET_WINDOWS
#ifdef NDEBUG
#pragma comment(lib, "freetype.lib")
diff --git a/xbmc/pvr/PVRDatabase.cpp b/xbmc/pvr/PVRDatabase.cpp
index 8addd58656..7a56fbc165 100644
--- a/xbmc/pvr/PVRDatabase.cpp
+++ b/xbmc/pvr/PVRDatabase.cpp
@@ -27,7 +27,6 @@
#include "pvr/channels/PVRChannel.h"
#include "pvr/channels/PVRChannelGroupInternal.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
-#include "pvr/PVRManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "utils/log.h"
diff --git a/xbmc/pvr/PVRDatabase.h b/xbmc/pvr/PVRDatabase.h
index c437c0c85e..1d5b202b53 100644
--- a/xbmc/pvr/PVRDatabase.h
+++ b/xbmc/pvr/PVRDatabase.h
@@ -26,8 +26,6 @@
#include "pvr/PVRManager.h"
-class CVideoSettings;
-
namespace PVR
{
class CPVRChannelGroup;
diff --git a/xbmc/utils/AsyncFileCopy.cpp b/xbmc/utils/AsyncFileCopy.cpp
deleted file mode 100644
index b030516d04..0000000000
--- a/xbmc/utils/AsyncFileCopy.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2005-2013 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "threads/SystemClock.h"
-#include "AsyncFileCopy.h"
-#include "dialogs/GUIDialogProgress.h"
-#include "guilib/GUIWindowManager.h"
-#include "log.h"
-#include "utils/StringUtils.h"
-#include "URL.h"
-#include "utils/Variant.h"
-
-CAsyncFileCopy::CAsyncFileCopy() : CThread("AsyncFileCopy")
-{
- m_cancelled = false;
- m_succeeded = false;
- m_running = false;
- m_percent = 0;
- m_speed = 0;
-}
-
-CAsyncFileCopy::~CAsyncFileCopy()
-{
- StopThread();
-}
-
-bool CAsyncFileCopy::Copy(const std::string &from, const std::string &to, const std::string &heading)
-{
- // reset the variables to their appropriate states
- m_from = from;
- m_to = to;
- m_cancelled = false;
- m_succeeded = false;
- m_percent = 0;
- m_speed = 0;
- m_running = true;
- CURL url1(from);
- CURL url2(to);
-
- // create our thread, which starts the file copy operation
- Create();
- CGUIDialogProgress *dlg = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
- unsigned int time = XbmcThreads::SystemClockMillis();
- while (m_running)
- {
- m_event.WaitMSec(1000 / 30);
- if (!m_running)
- break;
- // start the dialog up as needed
- if (dlg && !dlg->IsDialogRunning() && (XbmcThreads::SystemClockMillis() - time) > 500) // wait 0.5 seconds before starting dialog
- {
- dlg->SetHeading(CVariant{heading});
- dlg->SetLine(0, CVariant{url1.GetWithoutUserDetails()});
- dlg->SetLine(1, CVariant{url2.GetWithoutUserDetails()});
- dlg->SetPercentage(0);
- dlg->Open();
- }
- // and update the dialog as we go
- if (dlg && dlg->IsDialogRunning())
- {
- dlg->SetHeading(CVariant{heading});
- dlg->SetLine(0, CVariant{url1.Get()});
- dlg->SetLine(1, CVariant{url2.Get()});
- dlg->SetLine(2, CVariant{ StringUtils::Format("%2.2f KB/s", m_speed / 1024) });
- dlg->SetPercentage(m_percent);
- dlg->Progress();
- m_cancelled = dlg->IsCanceled();
- }
- }
- if (dlg)
- dlg->Close();
- return !m_cancelled && m_succeeded;
-}
-
-bool CAsyncFileCopy::OnFileCallback(void *pContext, int ipercent, float avgSpeed)
-{
- m_percent = ipercent;
- m_speed = avgSpeed;
- m_event.Set();
- return !m_cancelled;
-}
-
-void CAsyncFileCopy::Process()
-{
- try
- {
- m_succeeded = XFILE::CFile::Copy(m_from, m_to, this);
- }
- catch (...)
- {
- m_succeeded = false;
- CLog::Log(LOGERROR, "%s: unhandled exception copying file", __FUNCTION__);
- }
- m_running = false;
-}
diff --git a/xbmc/utils/AsyncFileCopy.h b/xbmc/utils/AsyncFileCopy.h
deleted file mode 100644
index 00b36f7545..0000000000
--- a/xbmc/utils/AsyncFileCopy.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2005-2013 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <string>
-#include "threads/Thread.h"
-#include "filesystem/File.h"
-
-class CAsyncFileCopy : public CThread, public XFILE::IFileCallback
-{
-public:
- CAsyncFileCopy();
- virtual ~CAsyncFileCopy();
-
- /// \brief Main routine to copy files from one source to another.
- /// \return true if successful, and false if it failed or was cancelled.
- bool Copy(const std::string &from, const std::string &to, const std::string &heading);
-
- /// \brief callback from CFile::Copy()
- virtual bool OnFileCallback(void *pContext, int ipercent, float avgSpeed);
-
-protected:
- virtual void Process();
-
-private:
- /// volatile variables as we access these from both threads
- volatile int m_percent; ///< current percentage (0..100)
- volatile float m_speed; ///< current speed (in bytes per second)
- volatile bool m_cancelled; ///< whether or not we cancelled the operation
- volatile bool m_running; ///< whether or not the copy operation is still in progress
-
- bool m_succeeded; ///< whether or not the copy operation was successful
- std::string m_from; ///< source URL to copy from
- std::string m_to; ///< destination URL to copy to
- CEvent m_event; ///< event to set to force an update
-};
diff --git a/xbmc/utils/CMakeLists.txt b/xbmc/utils/CMakeLists.txt
index b0cdc04be2..c9d8c438c3 100644
--- a/xbmc/utils/CMakeLists.txt
+++ b/xbmc/utils/CMakeLists.txt
@@ -2,7 +2,6 @@ set(SOURCES ActorProtocol.cpp
AlarmClock.cpp
AliasShortcutUtils.cpp
Archive.cpp
- AsyncFileCopy.cpp
auto_buffer.cpp
Base64.cpp
BitstreamConverter.cpp
@@ -78,7 +77,6 @@ set(HEADERS ActorProtocol.h
AlarmClock.h
AliasShortcutUtils.h
Archive.h
- AsyncFileCopy.h
auto_buffer.h
Base64.h
BitstreamConverter.h
diff --git a/xbmc/utils/test/CMakeLists.txt b/xbmc/utils/test/CMakeLists.txt
index c298ba8c47..515907d0cb 100644
--- a/xbmc/utils/test/CMakeLists.txt
+++ b/xbmc/utils/test/CMakeLists.txt
@@ -1,7 +1,6 @@
set(SOURCES TestAlarmClock.cpp
TestAliasShortcutUtils.cpp
TestArchive.cpp
- TestAsyncFileCopy.cpp
TestBase64.cpp
TestBitstreamStats.cpp
TestCharsetConverter.cpp
diff --git a/xbmc/utils/test/TestAsyncFileCopy.cpp b/xbmc/utils/test/TestAsyncFileCopy.cpp
deleted file mode 100644
index 186c2dc15c..0000000000
--- a/xbmc/utils/test/TestAsyncFileCopy.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2005-2013 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "utils/AsyncFileCopy.h"
-#include "filesystem/File.h"
-
-#include "test/TestUtils.h"
-
-#include "gtest/gtest.h"
-
-static const char refdata[] = "\x01\x02\x03\x04\x05\x06\x07\x08"
- "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
- "\x11\x12\x13\x14\x15\x16\x17\x18"
- "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
- "\x21\x22\x23\x24\x25\x26\x27\x28"
- "\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30";
-
-TEST(TestAsyncFileCopy, General)
-{
- CAsyncFileCopy c;
- XFILE::CFile *f1, *f2;
- char vardata[sizeof(refdata)];
-
- ASSERT_NE(nullptr, (f1 = XBMC_CREATETEMPFILE("")));
- ASSERT_NE(nullptr, (f2 = XBMC_CREATETEMPFILE(".copy")));
-
- EXPECT_EQ((int)sizeof(refdata), f1->Write(refdata, sizeof(refdata)));
- f1->Close();
- f2->Close();
- EXPECT_TRUE(c.Copy(XBMC_TEMPFILEPATH(f1), XBMC_TEMPFILEPATH(f2), ""));
- EXPECT_TRUE(f2->Open(XBMC_TEMPFILEPATH(f2)));
- EXPECT_EQ(sizeof(refdata), f2->Read(vardata, sizeof(refdata)));
- f2->Close();
- EXPECT_TRUE(!memcmp(vardata, refdata, sizeof(refdata)));
-
- EXPECT_TRUE(XBMC_DELETETEMPFILE(f1));
- EXPECT_TRUE(XBMC_DELETETEMPFILE(f2));
-}