kumquat-buildroot/package/kodi-pvr-mediaportal-tvserver/0007-Remove-charset-converter-dependency.patch
Bernd Kuhls da3a5b45cb package/kodi-pvr-mediaportal-tvserver: bump version to 8.1.0-Matrix
Added patch series from upstream PR 127 to remove the dependency to
kodi-platform, switch dependency to kodi.

Added missing dependency to tinyxml.

Switch license file to LICENSE.md.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-03-06 22:56:48 +01:00

56 lines
1.6 KiB
Diff

From bb752566a31029df4ca2c8a2d7fca6680570bfe6 Mon Sep 17 00:00:00 2001
From: phunkyfish <phunkyfish@gmail.com>
Date: Thu, 8 Oct 2020 16:10:44 +0100
Subject: [PATCH] Remove charset converter dependency
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
src/windows/FileUtils.cpp | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/windows/FileUtils.cpp b/src/windows/FileUtils.cpp
index 0c8a03e..f829b2a 100644
--- a/src/windows/FileUtils.cpp
+++ b/src/windows/FileUtils.cpp
@@ -6,24 +6,36 @@
*/
#include "../FileUtils.h"
-#include "p8-platform/windows/CharsetConverter.h"
#include <string>
#include "../utils.h"
#ifdef TARGET_WINDOWS_DESKTOP
#include <Shlobj.h>
#endif
-#ifdef TARGET_WINDOWS
#include <windows.h>
#include <fileapi.h>
-#endif
+
+std::wstring ToW(const char* str, size_t length)
+{
+ int result = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, length, nullptr, 0);
+ if (result == 0)
+ return std::wstring();
+
+ auto newStr = std::make_unique<wchar_t[]>(result);
+ result = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, length, newStr.get(), result);
+
+ if (result == 0)
+ return std::wstring();
+
+ return std::wstring(newStr.get(), result);
+}
namespace OS
{
bool CFile::Exists(const std::string& strFileName, long* errCode)
{
std::string strWinFile = ToWindowsPath(strFileName);
- std::wstring strWFile = p8::windows::ToW(strWinFile.c_str());
+ std::wstring strWFile = ToW(strWinFile.c_str(), 0);
DWORD dwAttr = GetFileAttributesW(strWFile.c_str());
if(dwAttr != 0xffffffff)