From e200569cd319448d12099f27a2713c69da382d26 Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat@gmail.com>
Date: Sun, 11 Aug 2019 18:50:07 -0700
Subject: Move the wstr converters to a separate header

---
 alc/alc.cpp             |  1 +
 alc/alconfig.cpp        |  1 +
 alc/backends/dsound.cpp |  1 +
 alc/backends/wasapi.cpp |  1 +
 alc/backends/wave.cpp   |  1 +
 alc/backends/winmm.cpp  |  1 +
 alc/compat.h            | 30 ------------------------------
 alc/helpers.cpp         |  1 +
 8 files changed, 7 insertions(+), 30 deletions(-)

(limited to 'alc')

diff --git a/alc/alc.cpp b/alc/alc.cpp
index c1989913..adead648 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -85,6 +85,7 @@
 #include "mastering.h"
 #include "opthelpers.h"
 #include "ringbuffer.h"
+#include "strutils.h"
 #include "threads.h"
 #include "uhjfilter.h"
 #include "vecmat.h"
diff --git a/alc/alconfig.cpp b/alc/alconfig.cpp
index e7632ef7..f6190b58 100644
--- a/alc/alconfig.cpp
+++ b/alc/alconfig.cpp
@@ -47,6 +47,7 @@
 
 #include "alcmain.h"
 #include "logging.h"
+#include "strutils.h"
 #include "compat.h"
 
 
diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp
index b9e52c0c..ad182cf7 100644
--- a/alc/backends/dsound.cpp
+++ b/alc/backends/dsound.cpp
@@ -49,6 +49,7 @@
 #include "ringbuffer.h"
 #include "compat.h"
 #include "dynload.h"
+#include "strutils.h"
 #include "threads.h"
 
 /* MinGW-w64 needs this for some unknown reason now. */
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index bd009463..cc53be66 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -59,6 +59,7 @@
 #include "ringbuffer.h"
 #include "compat.h"
 #include "converter.h"
+#include "strutils.h"
 #include "threads.h"
 
 
diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp
index 6ca2fab4..aa4130af 100644
--- a/alc/backends/wave.cpp
+++ b/alc/backends/wave.cpp
@@ -43,6 +43,7 @@
 #include "compat.h"
 #include "endiantest.h"
 #include "logging.h"
+#include "strutils.h"
 #include "threads.h"
 #include "vector.h"
 
diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp
index cd32e95b..b6787a24 100644
--- a/alc/backends/winmm.cpp
+++ b/alc/backends/winmm.cpp
@@ -40,6 +40,7 @@
 #include "alcmain.h"
 #include "alu.h"
 #include "ringbuffer.h"
+#include "strutils.h"
 #include "threads.h"
 #include "compat.h"
 
diff --git a/alc/compat.h b/alc/compat.h
index 648fa5b1..f2e10513 100644
--- a/alc/compat.h
+++ b/alc/compat.h
@@ -10,36 +10,6 @@
 #include <string>
 #include <fstream>
 
-inline std::string wstr_to_utf8(const WCHAR *wstr)
-{
-    std::string ret;
-
-    int len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, nullptr, 0, nullptr, nullptr);
-    if(len > 0)
-    {
-        ret.resize(len);
-        WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &ret[0], len, nullptr, nullptr);
-        ret.pop_back();
-    }
-
-    return ret;
-}
-
-inline std::wstring utf8_to_wstr(const char *str)
-{
-    std::wstring ret;
-
-    int len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
-    if(len > 0)
-    {
-        ret.resize(len);
-        MultiByteToWideChar(CP_UTF8, 0, str, -1, &ret[0], len);
-        ret.pop_back();
-    }
-
-    return ret;
-}
-
 
 namespace al {
 
diff --git a/alc/helpers.cpp b/alc/helpers.cpp
index b952c5ed..27219b03 100644
--- a/alc/helpers.cpp
+++ b/alc/helpers.cpp
@@ -106,6 +106,7 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
 #include "cpu_caps.h"
 #include "fpu_modes.h"
 #include "logging.h"
+#include "strutils.h"
 #include "vector.h"
 
 
-- 
cgit v1.2.3