Skip to content

Commit

Permalink
Reworked AutPtrHandle to make it a generic scopeguard
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxxi authored and popcornmix committed Sep 18, 2015
1 parent bd669ad commit 5add64a
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 230 deletions.
3 changes: 1 addition & 2 deletions project/VS2010Express/XBMC.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,6 @@
<ClCompile Include="..\..\xbmc\utils\AliasShortcutUtils.cpp" />
<ClCompile Include="..\..\xbmc\utils\Archive.cpp" />
<ClCompile Include="..\..\xbmc\utils\AsyncFileCopy.cpp" />
<ClCompile Include="..\..\xbmc\utils\AutoPtrHandle.cpp" />
<ClCompile Include="..\..\xbmc\utils\Base64.cpp" />
<ClCompile Include="..\..\xbmc\utils\BitstreamStats.cpp" />
<ClCompile Include="..\..\xbmc\utils\CharsetConverter.cpp" />
Expand Down Expand Up @@ -2167,7 +2166,7 @@
<ClInclude Include="..\..\xbmc\utils\AliasShortcutUtils.h" />
<ClInclude Include="..\..\xbmc\utils\Archive.h" />
<ClInclude Include="..\..\xbmc\utils\AsyncFileCopy.h" />
<ClInclude Include="..\..\xbmc\utils\AutoPtrHandle.h" />
<ClInclude Include="..\..\xbmc\utils\ScopeGuard.h" />
<ClInclude Include="..\..\xbmc\utils\Base64.h" />
<ClInclude Include="..\..\xbmc\utils\BitstreamStats.h" />
<ClInclude Include="..\..\xbmc\utils\CharsetConverter.h" />
Expand Down
11 changes: 4 additions & 7 deletions project/VS2010Express/XBMC.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1396,9 +1396,6 @@
<ClCompile Include="..\..\xbmc\utils\AsyncFileCopy.cpp">
<Filter>utils</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\utils\AutoPtrHandle.cpp">
<Filter>utils</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\utils\BitstreamStats.cpp">
<Filter>utils</Filter>
</ClCompile>
Expand Down Expand Up @@ -4444,9 +4441,6 @@
<ClInclude Include="..\..\xbmc\utils\AsyncFileCopy.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\utils\AutoPtrHandle.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\utils\BitstreamStats.h">
<Filter>utils</Filter>
</ClInclude>
Expand Down Expand Up @@ -6325,6 +6319,9 @@
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEStreamData.h">
<Filter>cores\AudioEngine\Utils</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\utils\ScopeGuard.h">
<Filter>utils</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
Expand Down Expand Up @@ -6411,4 +6408,4 @@
<Filter>shaders</Filter>
</FxCompile>
</ItemGroup>
</Project>
</Project>
2 changes: 0 additions & 2 deletions xbmc/cores/VideoRenderers/DXVAHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
#include "RenderFlags.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSettings.h"
#include "utils/AutoPtrHandle.h"
#include "utils/Log.h"
#include "utils/win32/memcpy_sse2.h"
#include "win32/WIN32Util.h"
#include "windowing/WindowingFactory.h"

using namespace DXVA;
using namespace AUTOPTR;

#define LOGIFERROR(a) \
do { \
Expand Down
2 changes: 0 additions & 2 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@
#include "../DVDCodecUtils.h"
#include "DXVA.h"
#include "settings/AdvancedSettings.h"
#include "utils/AutoPtrHandle.h"
#include "utils/Log.h"
#include "utils/StringUtils.h"
#include "windowing/WindowingFactory.h"

using namespace DXVA;
using namespace AUTOPTR;

static void RelBufferS(void *opaque, uint8_t *data)
{ ((CDecoder*)opaque)->RelBuffer(data); }
Expand Down
3 changes: 0 additions & 3 deletions xbmc/cores/playercorefactory/PlayerCoreFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "FileItem.h"
#include "profiles/ProfilesManager.h"
#include "settings/AdvancedSettings.h"
#include "utils/AutoPtrHandle.h"
#include "PlayerCoreConfig.h"
#include "PlayerSelectionRule.h"
#include "guilib/LocalizeStrings.h"
Expand All @@ -36,8 +35,6 @@

#define PLAYERCOREFACTORY_XML "playercorefactory.xml"

using namespace AUTOPTR;

CPlayerCoreFactory::CPlayerCoreFactory()
{ }

Expand Down
2 changes: 0 additions & 2 deletions xbmc/dbwrappers/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "filesystem/SpecialProtocol.h"
#include "filesystem/File.h"
#include "profiles/ProfilesManager.h"
#include "utils/AutoPtrHandle.h"
#include "utils/log.h"
#include "utils/SortUtils.h"
#include "utils/StringUtils.h"
Expand All @@ -35,7 +34,6 @@
#include "mysqldataset.h"
#endif

using namespace AUTOPTR;
using namespace dbiplus;

#define MAX_COMPRESS_COUNT 20
Expand Down
5 changes: 4 additions & 1 deletion xbmc/filesystem/FileCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "threads/SystemClock.h"
#include "utils/AutoPtrHandle.h"
#include "FileCache.h"
#include "threads/Thread.h"
#include "File.h"
Expand All @@ -30,6 +29,10 @@
#include "utils/log.h"
#include "settings/AdvancedSettings.h"

#if !defined(TARGET_WINDOWS)
#include "linux/ConvUtils.h" //GetLastError()
#endif

#include <cassert>
#include <algorithm>
#include <memory>
Expand Down
2 changes: 0 additions & 2 deletions xbmc/music/MusicDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
#include "utils/LegacyPathTranslation.h"
#include "utils/log.h"
#include "TextureCache.h"
#include "utils/AutoPtrHandle.h"
#include "interfaces/AnnouncementManager.h"
#include "dbwrappers/dataset.h"
#include "utils/XMLUtils.h"
Expand All @@ -70,7 +69,6 @@

#include <utility>

using namespace AUTOPTR;
using namespace XFILE;
using namespace MUSICDATABASEDIRECTORY;
using namespace KODI::MESSAGING;
Expand Down
8 changes: 6 additions & 2 deletions xbmc/network/cddb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ using namespace CDDB;

//-------------------------------------------------------------------------------------------------------------------
Xcddb::Xcddb()
: m_cddb_socket(INVALID_SOCKET)
#if defined(TARGET_WINDOWS)
: m_cddb_socket(closesocket, INVALID_SOCKET)
#else
: m_cddb_socket(close, -1)
#endif
, m_cddb_ip_adress(g_advancedSettings.m_cddbAddress)
{
m_lastError = 0;
Expand Down Expand Up @@ -123,7 +127,7 @@ bool Xcddb::openSocket()
//-------------------------------------------------------------------------------------------------------------------
bool Xcddb::closeSocket()
{
if ( m_cddb_socket.isValid() )
if (m_cddb_socket)
{
m_cddb_socket.reset();
}
Expand Down
9 changes: 7 additions & 2 deletions xbmc/network/cddb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#endif
#include "storage/cdioSupport.h"

#include "utils/AutoPtrHandle.h"
#include "utils/ScopeGuard.h"

namespace CDDB
{
Expand Down Expand Up @@ -92,7 +92,12 @@ class Xcddb

protected:
std::string m_strNull;
AUTOPTR::CAutoPtrSocket m_cddb_socket;
#if defined(TARGET_WINDOWS)
using CAutoPtrSocket = KODI::UTILS::CScopeGuard<SOCKET, INVALID_SOCKET, decltype(closesocket)>;
#else
using CAutoPtrSocket = KODI::UTILS::CScopeGuard<int, -1, decltype(close)>;
#endif
CAutoPtrSocket m_cddb_socket;
const static int recv_buffer = 4096;
int m_lastError;
std::map<int, std::string> m_mapTitles;
Expand Down
136 changes: 0 additions & 136 deletions xbmc/utils/AutoPtrHandle.cpp

This file was deleted.

Loading

0 comments on commit 5add64a

Please sign in to comment.