aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPär Björklund <per.bjorklund@gmail.com>2017-03-01 18:24:31 +0100
committerPär Björklund <per.bjorklund@gmail.com>2017-03-01 18:24:31 +0100
commitf9f046e868eb6e18e93d06ef9709beb2e04bb4a5 (patch)
tree22199ef0df0ef6faad5970a290727af37595cb61 /lib
parent7070d1cb0dbc7d53079a8612cb4553a9ea2f4622 (diff)
Switch libupnp to unicode as well
Diffstat (limited to 'lib')
-rw-r--r--lib/libUPnP/Neptune/Source/System/Win32/NptWin32Console.cpp3
-rw-r--r--lib/libUPnP/Neptune/Source/System/Win32/NptWin32Debug.cpp20
-rw-r--r--lib/libUPnP/Neptune/Source/System/Win32/NptWin32SerialPort.cpp3
3 files changed, 17 insertions, 9 deletions
diff --git a/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Console.cpp b/lib/libUPnP/Neptune/Source/System/Win32/NptWin32Console.cpp
index 59ac92e89e..e897f8a932 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 c5b157df0f..5d9372a518 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 8edd0ff0a0..9428648bd7 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
}
/*----------------------------------------------------------------------