summaryrefslogtreecommitdiffstats
path: root/lib/libUPnP/patches/0042-platinum-switch-build-to-unicode.patch
blob: da4375661ca0930966ca3a7709384a894f952deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
diff --git a/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Console.cpp b/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Console.cpp
index 59ac92e..e897f8a 100644
--- a/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Console.cpp
+++ b/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Console.cpp
@@ -15,6 +15,7 @@
 
 #include "NptConfig.h"
 #include "NptConsole.h"
+#include "NptDebug.h"
 
 /*----------------------------------------------------------------------
 |   NPT_Console::Output
@@ -22,7 +23,7 @@
 void
 NPT_Console::Output(const char* message)
 {
-    OutputDebugString(message);
+    NPT_DebugOutput(message);
     printf("%s", message);
 }
 
diff --git a/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Debug.cpp b/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Debug.cpp
index c5b157d..5d9372a 100644
--- a/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Debug.cpp
+++ b/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Debug.cpp
@@ -11,16 +11,13 @@
 |   includes
 +---------------------------------------------------------------------*/
 #include <stdio.h>
-#if defined(_XBOX)
-#include <xtl.h>
-#else
 #include <windows.h>
-#endif
 
 #include "NptConfig.h"
 #include "NptDefs.h"
 #include "NptTypes.h"
 #include "NptDebug.h"
+#include <memory>
 
 /*----------------------------------------------------------------------
 |   NPT_DebugOutput
@@ -28,9 +25,16 @@
 void
 NPT_DebugOutput(const char* message)
 {
-#if !defined(_WIN32_WCE)
-    OutputDebugString(message);
-#endif
-    printf("%s", message);
+  int result = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, message, -1, nullptr, 0);
+  if (result == 0)
+    return;
+
+  auto newStr = std::make_unique<wchar_t[]>(result + 1);
+  result = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, message, result, newStr.get(), result);
+
+  if (result == 0)
+    return;
+
+  OutputDebugString(newStr.get());
 }
 
diff --git a/lib/libUPnP/Neptune/Source/System/Win32/NptWin32SerialPort.cpp b/lib/libUPnP/Neptune/Source/System/Win32/NptWin32SerialPort.cpp
index 8edd0ff..9428648 100644
--- a/lib/libUPnP/Neptune/Source/System/Win32/NptWin32SerialPort.cpp
+++ b/lib/libUPnP/Neptune/Source/System/Win32/NptWin32SerialPort.cpp
@@ -207,6 +207,8 @@ NPT_Win32SerialPort::Open(unsigned int              speed,
                           NPT_SerialPortFlowControl flow_control,
                           NPT_SerialPortParity      parity)
 {
+    return NPT_FAILURE; // We don't need serial port suppurt
+#if 0
     // check if we're already open
     if (!m_HandleReference.IsNull()) {
         return NPT_ERROR_SERIAL_PORT_ALREADY_OPEN;
@@ -278,6 +280,7 @@ NPT_Win32SerialPort::Open(unsigned int              speed,
     m_HandleReference = new NPT_Win32HandleWrapper(handle);
 
     return NPT_SUCCESS;
+#endif
 }
 
 /*----------------------------------------------------------------------