Merge pull request #206 from cptspiff/remove-convutils
authorArne Morten Kvarving <spiff@xbmc.org>
Mon, 26 Mar 2012 08:36:08 +0000 (01:36 -0700)
committerArne Morten Kvarving <spiff@xbmc.org>
Mon, 26 Mar 2012 08:36:08 +0000 (01:36 -0700)
Remove convutils

xbmc/GUIPassword.cpp
xbmc/cores/DllLoader/exports/emu_kernel32.cpp
xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
xbmc/filesystem/FileRTV.cpp
xbmc/filesystem/RTVDirectory.cpp
xbmc/interfaces/http-api/XBMCConfiguration.cpp
xbmc/linux/ConvUtils.cpp
xbmc/linux/ConvUtils.h
xbmc/linux/PlatformDefs.h

index 8094d52..34b1e3a 100644 (file)
@@ -93,7 +93,8 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const CStdString &strType)
         pItem->m_iBadPwdCount = 0;
         pItem->m_iHasLock = 1;
         g_passwordManager.LockSource(strType,strLabel,false);
-        g_settings.UpdateSource(strType, strLabel, "badpwdcount", itoa(pItem->m_iBadPwdCount, buffer, 10));
+        sprintf(buffer,"%i",pItem->m_iBadPwdCount);
+        g_settings.UpdateSource(strType, strLabel, "badpwdcount", buffer);
         g_settings.SaveSources();
         break;
       }
@@ -102,7 +103,8 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const CStdString &strType)
         // password entry failed
         if (0 != g_guiSettings.GetInt("masterlock.maxretries"))
           pItem->m_iBadPwdCount++;
-        g_settings.UpdateSource(strType, strLabel, "badpwdcount", itoa(pItem->m_iBadPwdCount, buffer, 10));
+        sprintf(buffer,"%i",pItem->m_iBadPwdCount);
+        g_settings.UpdateSource(strType, strLabel, "badpwdcount", buffer);
         g_settings.SaveSources();
         break;
       }
index 09b3dee..0493bb7 100644 (file)
@@ -891,7 +891,11 @@ extern "C" int WINAPI dllMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCST
     destinationBuffer = (LPWSTR)malloc(destinationBufferSize * sizeof(WCHAR));
   }
 
+#ifdef _WIN32
   int ret = MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, destinationBuffer, destinationBufferSize);
+#else
+  int ret = 0;
+#endif
 
   if (ret > 0)
   {
@@ -929,7 +933,11 @@ extern "C" int WINAPI dllWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWS
     destinationBuffer = (LPSTR)malloc(destinationBufferSize * sizeof(char));
   }
 
+#ifdef _WIN32
   int ret = WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, destinationBuffer, destinationBufferSize, lpDefaultChar, lpUsedDefaultChar);
+#else
+  int ret = 0;
+#endif
 
   if (ret > 0)
   {
index 84312cf..076862d 100644 (file)
@@ -1936,7 +1936,12 @@ extern "C"
 
         memcpy(var, envstring, value_start - envstring);
         var[value_start - envstring] = 0;
-        strupr(var);
+        char* temp = var;
+        while (*temp)
+        {
+          *temp = (char)toupper(*temp);
+          temp++;
+        }
 
         strncpy(value, value_start + 1, size);
         if (size)
index edcf6ea..b1a7e4f 100644 (file)
@@ -80,8 +80,9 @@ bool CFileRTV::Open(const char* strHostName, const char* strFileName, int iport)
   if (iport)
   {
     char buffer[10];
+    sprintf(buffer,"%i",iport);
     strHostAndPort += ':';
-    strHostAndPort += itoa(iport, buffer, 10);
+    strHostAndPort += buffer;
   }
 
   // Get the file size of strFileName.  If size is 0 or negative, file doesn't exist so exit.
index 8e629a5..176dd73 100644 (file)
@@ -122,8 +122,9 @@ bool CRTVDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items
   if (url.HasPort())
   {
     char buffer[10];
+    sprintf(buffer,"%i",url.GetPort());
     strHostAndPort += ':';
-    strHostAndPort += itoa(url.GetPort(), buffer, 10);
+    strHostAndPort += buffer;
   }
 
   // No path given, list shows from ReplayGuide
index a2bc84b..4a7a5c6 100644 (file)
@@ -67,13 +67,14 @@ int CXbmcConfiguration::BookmarkSize( int eid, webs_t wp, CStdString& response,
   if (pShares)
   {
     char buffer[10];
+    sprintf(buffer,"%i",pShares->size());
 
-    if (eid!=-1) 
-      ejSetResult( eid, itoa(pShares->size(), buffer, 10));
+    if (eid!=-1)
+      ejSetResult( eid, buffer);
     else
     {
       CStdString tmp;
-      tmp.Format("%s", itoa(pShares->size(), buffer, 10));
+      tmp.Format("%i", pShares->size());
       response="" + tmp;
     }
 
index 372befb..ec47408 100644 (file)
 #include <ctype.h>
 #include <errno.h>
 
-
-/*
- ** The following two functions together make up an itoa()
- ** implementation. Function i2a() is a 'private' function
- ** called by the public itoa() function.
- **
- ** itoa() takes three arguments:
- ** 1) the integer to be converted,
- ** 2) a pointer to a character conversion buffer,
- ** 3) the radix for the conversion
- ** which can range between 2 and 36 inclusive
- ** range errors on the radix default it to base10
- */
-
-static char *i2a(unsigned i, char *a, unsigned r)
-{
-  if (i/r > 0) a = i2a(i/r,a,r);
-  *a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i%r];
-  return a+1;
-}
-
-char *itoa(int i, char *a, int r)
-{
-  if ((r < 2) || (r > 36)) r = 10;
-  if (i<0) {
-    *a = '-';
-    *i2a(-(unsigned)i,a+1,r) = 0;
-  } else *i2a(i,a,r) = 0;
-  return a;
-}
-
 void OutputDebugString(LPCTSTR lpOuputString)
 {
 }
 
-void strlwr( char* string )
-{
-  while ( *string )
-  {
-    *string = (char)tolower( *string );
-    string++;
-  }
-}
-
-void strupr( char* string )
-{
-  while ( *string )
-  {
-    *string = (char)toupper( *string );
-    string++;
-  }
-}
-
 LONGLONG Int32x32To64(LONG Multiplier, LONG Multiplicand)
 {
   LONGLONG result = Multiplier;
@@ -87,35 +38,6 @@ LONGLONG Int32x32To64(LONG Multiplier, LONG Multiplicand)
   return result;
 }
 
-int WideCharToMultiByte(
-  UINT CodePage,
-  DWORD dwFlags,
-  LPCWSTR lpWideCharStr,
-  int cchWideChar,
-  LPSTR lpMultiByteStr,
-  int cbMultiByte,
-  LPCSTR lpDefaultChar,
-  LPBOOL lpUsedDefaultChar
-) {
-
-  // TODO: need to implement WideCharToMultiByte
-  return 0;
-}
-
-int MultiByteToWideChar(
-  UINT CodePage,
-  DWORD dwFlags,
-  LPCSTR lpMultiByteStr,
-  int cbMultiByte,
-  LPWSTR lpWideCharStr,
-  int cchWideChar
-) {
-
-  // TODO: need to implement MultiByteToWideChar
-  return 0;
-
-}
-
 DWORD GetLastError()
 {
   return errno;
index 3d1cacf..c1ff56e 100644 (file)
  */
 #include "PlatformDefs.h" // UINT DWORD LPCSTR LPSTR LPBOOL ...
 
-int WideCharToMultiByte(
-  UINT CodePage,
-  DWORD dwFlags,
-  LPCWSTR lpWideCharStr,
-  int cchWideChar,
-  LPSTR lpMultiByteStr,
-  int cbMultiByte,
-  LPCSTR lpDefaultChar,
-  LPBOOL lpUsedDefaultChar
-);
-
-int MultiByteToWideChar(
-  UINT CodePage,
-  DWORD dwFlags,
-  LPCSTR lpMultiByteStr,
-  int cbMultiByte,
-  LPWSTR lpWideCharStr,
-  int cchWideChar
-);
-
-
 DWORD GetLastError();
 VOID  SetLastError(DWORD dwErrCode);
 
index 33d1c96..d04830c 100644 (file)
@@ -588,12 +588,6 @@ typedef struct _D3DMATRIX {
 #define FILE_SHARE_WRITE                 0x00000002
 #define FILE_SHARE_DELETE                0x00000004
 
-
-// String
-char *itoa(int i, char *a, int r);
-void strlwr(char* string);
-void strupr(char* string);
-
 // Audio stuff
 typedef struct tWAVEFORMATEX
 {