From 6fd66a9264731bd7ee6d7602675965021d929a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 24 Aug 2022 15:17:08 +0200 Subject: Remove Prolog dependency. The only thing left to reimplement is the tracking of watched episodes in MPC-HC. --- c/wcharptr.cpp | 64 ---------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 c/wcharptr.cpp (limited to 'c/wcharptr.cpp') diff --git a/c/wcharptr.cpp b/c/wcharptr.cpp deleted file mode 100644 index f659767..0000000 --- a/c/wcharptr.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include - -#include "wcharptr.h" -#include "win.h" - -WcharPtr WcharPtr::FromNarrow(const char* const src, const int cp) -{ - int cchNarrow = strlen(src)+1; - int cchWide = MultiByteToWideChar(cp, 0, src, cchNarrow, nullptr, 0); - wchar_t* dst = new wchar_t[cchWide]; - if (!MultiByteToWideChar(cp, 0, src, cchNarrow, dst, cchWide)) { - delete dst; - throw Win32Error(); - } - return dst; -} - -WcharPtr WcharPtr::Copy(const wchar_t* const src) -{ - const int cch = wcslen(src)+1; - wchar_t* dst = new wchar_t[cch]; - memcpy(dst, src, cch*sizeof(wchar_t)); - return dst; -} - -WcharPtr::WcharPtr() noexcept {} - -WcharPtr::~WcharPtr() noexcept -{ - delete m_p; -} - -WcharPtr::operator wchar_t*() noexcept -{ - return m_p; -} - -WcharPtr::WcharPtr(wchar_t* const s) noexcept : m_p(s) {} - -WcharPtr& WcharPtr::operator=(wchar_t* const s) noexcept -{ - if (m_p != s) { - delete m_p; - m_p = s; - } - return *this; -} - -WcharPtr::WcharPtr(WcharPtr&& other) noexcept - : m_p(std::exchange(other.m_p, nullptr)) {} - -WcharPtr& WcharPtr::operator=(WcharPtr&& other) noexcept -{ - std::swap(m_p, other.m_p); - return *this; -} - -wchar_t* WcharPtr::Release() noexcept -{ - wchar_t* const p = m_p; - m_p = nullptr; - return p; -} -- cgit v1.2.3