[stdstring] get rid of CStdString in cores/AudioEngine/
authorArne Morten Kvarving <cptspiff@gmail.com>
Wed, 25 Jun 2014 14:44:58 +0000 (16:44 +0200)
committerJonathan Marshall <jmarshall@xbmc.org>
Sun, 13 Jul 2014 20:33:02 +0000 (08:33 +1200)
15 files changed:
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h
xbmc/cores/AudioEngine/Interfaces/AE.h
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp
xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp
xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
xbmc/cores/AudioEngine/Sinks/osx/CoreAudioStream.cpp
xbmc/cores/AudioEngine/Utils/AEBuffer.cpp
xbmc/cores/AudioEngine/Utils/AEBuffer.h
xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp
xbmc/cores/AudioEngine/Utils/AEChannelInfo.h
xbmc/cores/AudioEngine/Utils/AEELDParser.cpp
xbmc/cores/AudioEngine/Utils/AEUtil.cpp
xbmc/cores/AudioEngine/Utils/AEUtil.h

index 9324e1e..01aafe3 100644 (file)
@@ -19,7 +19,6 @@
  *
  */
 
-#include "utils/StdString.h"
 #include "cores/AudioEngine/Interfaces/AESound.h"
 #include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h"
 #include "filesystem/File.h"
index ee50e2f..353fcaa 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <list>
 #include <map>
+#include <vector>
 
 #include "system.h"
 #include "threads/CriticalSection.h"
index 9013c21..8dee4bc 100644 (file)
@@ -30,7 +30,6 @@
 #include "AESinkALSA.h"
 #include "cores/AudioEngine/Utils/AEUtil.h"
 #include "cores/AudioEngine/Utils/AEELDParser.h"
-#include "utils/StdString.h"
 #include "utils/log.h"
 #include "utils/MathUtils.h"
 #include "utils/SystemInfo.h"
index aff9c06..a23f827 100644 (file)
@@ -90,7 +90,7 @@ static const winEndpointsToAEDeviceType winEndpoints[EndpointFormFactor_enum_cou
 };
 
 // implemented in AESinkWASAPI.cpp
-extern CStdStringA localWideToUtf(LPCWSTR wstr);
+extern std::string localWideToUtf(LPCWSTR wstr);
 
 static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext)
 {
@@ -98,12 +98,14 @@ static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescription, LP
   std::list<DSDevice> &enumerator = *static_cast<std::list<DSDevice>*>(lpContext);
 
   int bufSize = MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, NULL, 0);
-  CStdStringW strW (L"", bufSize);
-  if ( bufSize == 0 || MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, strW.GetBuf(bufSize), bufSize) != bufSize )
-    strW.clear();
-  strW.RelBuf();
+  wchar_t *strW = new wchar_t[bufSize+1];
+  if ( bufSize == 0 || MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, strW, bufSize) != bufSize )
+    strW[0] = 0;
+  else
+    strW[bufSize] = 0;
 
   dev.name = localWideToUtf(strW);
+  delete[] strW;
 
   dev.lpGuid = lpGuid;
 
index f55872a..2b6e646 100644 (file)
@@ -23,7 +23,6 @@
 #include <limits.h>
 
 #include "cores/AudioEngine/Utils/AEUtil.h"
-#include "utils/StdString.h"
 #include "utils/log.h"
 #include "threads/SingleLock.h"
 #include <sstream>
index be58cac..2b70b8e 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "cores/AudioEngine/Sinks/AESinkProfiler.h"
 #include "cores/AudioEngine/Utils/AEUtil.h"
-#include "utils/StdString.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
 
index dfd7714..3dd1029 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "cores/AudioEngine/Utils/AEUtil.h"
 #include "settings/AdvancedSettings.h"
-#include "utils/StdString.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
 #include "threads/SingleLock.h"
@@ -165,15 +164,15 @@ DWORD ChLayoutToChMask(const enum AEChannel * layout, unsigned int * numberOfCha
   return mask;
 }
 
-CStdStringA localWideToUtf(LPCWSTR wstr)
+std::string localWideToUtf(LPCWSTR wstr)
 {
   if (wstr == NULL)
     return "";
   int bufSize = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
-  CStdStringA strA ("", bufSize);
-  if ( bufSize == 0 || WideCharToMultiByte(CP_UTF8, 0, wstr, -1, strA.GetBuf(bufSize), bufSize, NULL, NULL) != bufSize )
+  std::string strA ("", bufSize);
+  strA.resize(bufSize);
+  if ( bufSize == 0 || WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &strA[0], bufSize, NULL, NULL) != bufSize )
     strA.clear();
-  strA.RelBuf();
   return strA;
 }
 
index cfa4cbd..1599e68 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "CoreAudioHelpers.h"
 #include "utils/log.h"
-#include "utils/StdString.h"
 
 CCoreAudioStream::CCoreAudioStream() :
   m_StreamId  (0    )
@@ -427,7 +426,7 @@ OSStatus CCoreAudioStream::HardwareStreamListener(AudioObjectID inObjectID,
       // hardware physical format has changed.
       if (AudioObjectGetPropertyData(ca_stream->m_StreamId, &inAddresses[i], 0, NULL, &propertySize, &actualFormat) == noErr)
       {
-        CStdString formatString;
+        std::string formatString;
         CLog::Log(LOGINFO, "CCoreAudioStream::HardwareStreamListener: "
           "Hardware physical format changed to %s", StreamDescriptionToString(actualFormat, formatString));
         ca_stream->m_physical_format_event.Set();
@@ -440,7 +439,7 @@ OSStatus CCoreAudioStream::HardwareStreamListener(AudioObjectID inObjectID,
       UInt32 propertySize = sizeof(AudioStreamBasicDescription);
       if (AudioObjectGetPropertyData(ca_stream->m_StreamId, &inAddresses[i], 0, NULL, &propertySize, &actualFormat) == noErr)
       {
-        CStdString formatString;
+        std::string formatString;
         CLog::Log(LOGINFO, "CCoreAudioStream::HardwareStreamListener: "
           "Hardware virtual format changed to %s", StreamDescriptionToString(actualFormat, formatString));
         ca_stream->m_virtual_format_event.Set();
index 1ebe5ec..6eb4770 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include "AEBuffer.h"
-#include "utils/StdString.h" /* needed for ASSERT */
 #include <algorithm>
 
 CAEBuffer::CAEBuffer() :
index ab54cb4..cb067c7 100644 (file)
  */
 
 #include "system.h"
-
-#ifdef _DEBUG
-#include "utils/StdString.h" /* needed for ASSERT */
-#endif
+#include <assert.h>
 
 /**
  * This class wraps a block of 16 byte aligned memory for simple buffer
@@ -56,8 +53,8 @@ public:
   inline void Write(const void *src, const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(src);
-    ASSERT(size <= m_bufferSize);
+    assert(src);
+    assert(size <= m_bufferSize);
   #endif
     memcpy(m_buffer, src, size);
     m_bufferPos = 0;
@@ -66,8 +63,8 @@ public:
   inline void Push(const void *src, const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(src);
-    ASSERT(size <= m_bufferSize - m_bufferPos);
+    assert(src);
+    assert(size <= m_bufferSize - m_bufferPos);
   #endif
     memcpy(m_buffer + m_bufferPos, src, size);
     m_bufferPos += size;
@@ -76,8 +73,8 @@ public:
   inline void UnShift(const void *src, const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(src);
-    ASSERT(size < m_bufferSize - m_bufferPos);
+    assert(src);
+    assert(size < m_bufferSize - m_bufferPos);
   #endif
     memmove(m_buffer + size, m_buffer, m_bufferSize - size);
     memcpy (m_buffer, src, size);
@@ -87,7 +84,7 @@ public:
   inline void* Take(const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(size <= m_bufferSize - m_bufferPos);
+    assert(size <= m_bufferSize - m_bufferPos);
   #endif
 
     void* ret = m_buffer + m_bufferPos;
@@ -99,7 +96,7 @@ public:
   inline void* Raw(const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(size <= m_bufferSize);
+    assert(size <= m_bufferSize);
   #endif
     return m_buffer;
   }
@@ -108,8 +105,8 @@ public:
   inline void Read(void *dst, const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(size <= m_bufferSize);
-    ASSERT(dst);
+    assert(size <= m_bufferSize);
+    assert(dst);
   #endif
     memcpy(dst, m_buffer, size);
   }
@@ -117,7 +114,7 @@ public:
   inline void Pop(void *dst, const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(size <= m_bufferPos);
+    assert(size <= m_bufferPos);
   #endif
     m_bufferPos -= size;
     if (dst)
@@ -127,7 +124,7 @@ public:
   inline void Shift(void *dst, const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(size <= m_bufferPos);
+    assert(size <= m_bufferPos);
   #endif
     if (dst)
       memcpy(dst, m_buffer, size);
@@ -158,7 +155,7 @@ public:
   inline void CursorSeek (const size_t pos )
   {
   #ifdef _DEBUG
-    ASSERT(pos <= m_bufferSize);
+    assert(pos <= m_bufferSize);
   #endif
     m_cursorPos = pos;
   }
@@ -166,7 +163,7 @@ public:
   inline void* CursorRead(const size_t size)
   {
   #ifdef _DEBUG
-    ASSERT(m_cursorPos + size <= m_bufferPos);
+    assert(m_cursorPos + size <= m_bufferPos);
   #endif
     uint8_t* out = m_buffer + m_cursorPos;
     m_cursorPos += size;
index 37988e1..f2657ad 100644 (file)
@@ -21,6 +21,7 @@
 #include "AEChannelInfo.h"
 #include <limits>
 #include <string.h>
+#include <assert.h>
 
 CAEChannelInfo::CAEChannelInfo()
 {
@@ -162,14 +163,14 @@ CAEChannelInfo& CAEChannelInfo::operator=(const enum AEChannel* rhs)
   }
 
   /* the last entry should be NULL, if not we were passed a non null terminated list */
-  ASSERT(rhs[m_channelCount] == AE_CH_NULL);
+  assert(rhs[m_channelCount] == AE_CH_NULL);
 
   return *this;
 }
 
 CAEChannelInfo& CAEChannelInfo::operator=(const enum AEStdChLayout rhs)
 {
-  ASSERT(rhs > AE_CH_LAYOUT_INVALID && rhs < AE_CH_LAYOUT_MAX);
+  assert(rhs > AE_CH_LAYOUT_INVALID && rhs < AE_CH_LAYOUT_MAX);
 
   static enum AEChannel layouts[AE_CH_LAYOUT_MAX][9] = {
     {AE_CH_FC, AE_CH_NULL},
@@ -210,8 +211,8 @@ bool CAEChannelInfo::operator!=(const CAEChannelInfo& rhs)
 
 CAEChannelInfo& CAEChannelInfo::operator+=(const enum AEChannel& rhs)
 {
-  ASSERT(m_channelCount < AE_CH_MAX);
-  ASSERT(rhs > AE_CH_NULL && rhs < AE_CH_MAX);
+  assert(m_channelCount < AE_CH_MAX);
+  assert(rhs > AE_CH_NULL && rhs < AE_CH_MAX);
 
   m_channels[m_channelCount++] = rhs;
   return *this;
@@ -219,7 +220,7 @@ CAEChannelInfo& CAEChannelInfo::operator+=(const enum AEChannel& rhs)
 
 CAEChannelInfo& CAEChannelInfo::operator-=(const enum AEChannel& rhs)
 {
-  ASSERT(rhs > AE_CH_NULL && rhs < AE_CH_MAX);
+  assert(rhs > AE_CH_NULL && rhs < AE_CH_MAX);
 
   unsigned int i = 0;
   while(i < m_channelCount && m_channels[i] != rhs)
@@ -237,7 +238,7 @@ CAEChannelInfo& CAEChannelInfo::operator-=(const enum AEChannel& rhs)
 
 const enum AEChannel CAEChannelInfo::operator[](unsigned int i) const
 {
-  ASSERT(i < m_channelCount);
+  assert(i < m_channelCount);
   return m_channels[i];
 }
 
@@ -259,7 +260,7 @@ CAEChannelInfo::operator std::string() const
 
 const char* CAEChannelInfo::GetChName(const enum AEChannel ch)
 {
-  ASSERT(ch >= 0 && ch < AE_CH_MAX);
+  assert(ch >= 0 && ch < AE_CH_MAX);
 
   static const char* channels[AE_CH_MAX] =
   {
@@ -363,4 +364,4 @@ void CAEChannelInfo::AddMissingChannels(const CAEChannelInfo& rhs)
   for (unsigned int i = 0; i < rhs.Count(); i++)
     if (!HasChannel(rhs[i]))
       *this += rhs[i];
-}
\ No newline at end of file
+}
index 2a6e5db..d0dd196 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <stdint.h>
 #include <vector>
-#include "utils/StdString.h"
+#include <string>
 
 /**
  * The possible channels
index ff9f2c7..af4715c 100644 (file)
@@ -22,6 +22,7 @@
 #include "AEDeviceInfo.h"
 #include "utils/EndianSwap.h"
 #include <string.h>
+#include <algorithm>
 
 #include <stdio.h>
 
index c9d5af4..12c5fa7 100644 (file)
@@ -21,7 +21,6 @@
   #define __STDC_LIMIT_MACROS
 #endif
 
-#include "utils/StdString.h"
 #include "AEUtil.h"
 #include "utils/log.h"
 #include "utils/TimeUtils.h"
@@ -500,7 +499,7 @@ void CAEUtil::FloatRand4(const float min, const float max, float result[4], __m1
     const float factor = delta / (float)INT32_MAX;
 
     /* cant return sseresult if we are not using SSE intrinsics */
-    ASSERT(result && !sseresult);
+    assert(result && !sseresult);
 
     result[0] = ((float)(m_seed = (214013 * m_seed + 2531011)) * factor) - delta;
     result[1] = ((float)(m_seed = (214013 * m_seed + 2531011)) * factor) - delta;
index f467314..1e61c50 100644 (file)
@@ -20,7 +20,6 @@
  */
 
 #include "AEAudioFormat.h"
-#include "utils/StdString.h"
 #include "PlatformDefs.h"
 #include <math.h>