aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/library.xbmc.addon/libXBMC_addon.h18
-rw-r--r--lib/addons/library.xbmc.addon/libXBMC_addon.cpp6
-rw-r--r--xbmc/addons/AddonCallbacks.h6
-rw-r--r--xbmc/addons/AddonCallbacksAddon.cpp15
-rw-r--r--xbmc/addons/AddonCallbacksAddon.h6
5 files changed, 24 insertions, 27 deletions
diff --git a/addons/library.xbmc.addon/libXBMC_addon.h b/addons/library.xbmc.addon/libXBMC_addon.h
index 342f804704..42fcee2a4e 100644
--- a/addons/library.xbmc.addon/libXBMC_addon.h
+++ b/addons/library.xbmc.addon/libXBMC_addon.h
@@ -158,15 +158,15 @@ namespace ADDON
dlsym(m_libXBMC_addon, "XBMC_queue_notification");
if (XBMC_queue_notification == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
- XBMC_unknown_to_utf8 = (const char* (*)(void* HANDLE, void* CB, const char* str))
+ XBMC_unknown_to_utf8 = (char* (*)(void* HANDLE, void* CB, const char* str))
dlsym(m_libXBMC_addon, "XBMC_unknown_to_utf8");
if (XBMC_unknown_to_utf8 == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
- XBMC_get_localized_string = (const char* (*)(void* HANDLE, void* CB, int dwCode))
+ XBMC_get_localized_string = (char* (*)(void* HANDLE, void* CB, int dwCode))
dlsym(m_libXBMC_addon, "XBMC_get_localized_string");
if (XBMC_get_localized_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
- XBMC_get_dvd_menu_language = (const char* (*)(void* HANDLE, void* CB))
+ XBMC_get_dvd_menu_language = (char* (*)(void* HANDLE, void* CB))
dlsym(m_libXBMC_addon, "XBMC_get_dvd_menu_language");
if (XBMC_get_dvd_menu_language == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
@@ -296,7 +296,7 @@ namespace ADDON
* @param str The string to translate.
* @return The string translated to UTF8. Must be freed when done.
*/
- const char* UnknownToUTF8(const char* str)
+ char* UnknownToUTF8(const char* str)
{
return XBMC_unknown_to_utf8(m_Handle, m_Callbacks, str);
}
@@ -306,7 +306,7 @@ namespace ADDON
* @param dwCode The code of the message to get.
* @return The message. Needs to be freed when done.
*/
- const char* GetLocalizedString(int dwCode)
+ char* GetLocalizedString(int dwCode)
{
return XBMC_get_localized_string(m_Handle, m_Callbacks, dwCode);
}
@@ -316,7 +316,7 @@ namespace ADDON
* @brief Get the DVD menu language.
* @return The language. Needs to be freed when done.
*/
- const char* GetDVDMenuLanguage()
+ char* GetDVDMenuLanguage()
{
return XBMC_get_dvd_menu_language(m_Handle, m_Callbacks);
}
@@ -528,9 +528,9 @@ namespace ADDON
void (*XBMC_log)(void *HANDLE, void* CB, const addon_log_t loglevel, const char *msg);
bool (*XBMC_get_setting)(void *HANDLE, void* CB, const char* settingName, void *settingValue);
void (*XBMC_queue_notification)(void *HANDLE, void* CB, const queue_msg_t type, const char *msg);
- const char* (*XBMC_unknown_to_utf8)(void *HANDLE, void* CB, const char* str);
- const char* (*XBMC_get_localized_string)(void *HANDLE, void* CB, int dwCode);
- const char* (*XBMC_get_dvd_menu_language)(void *HANDLE, void* CB);
+ char* (*XBMC_unknown_to_utf8)(void *HANDLE, void* CB, const char* str);
+ char* (*XBMC_get_localized_string)(void *HANDLE, void* CB, int dwCode);
+ char* (*XBMC_get_dvd_menu_language)(void *HANDLE, void* CB);
void* (*XBMC_open_file)(void *HANDLE, void* CB, const char* strFileName, unsigned int flags);
void* (*XBMC_open_file_for_write)(void *HANDLE, void* CB, const char* strFileName, bool bOverWrite);
unsigned int (*XBMC_read_file)(void *HANDLE, void* CB, void* file, void* lpBuf, int64_t uiBufSize);
diff --git a/lib/addons/library.xbmc.addon/libXBMC_addon.cpp b/lib/addons/library.xbmc.addon/libXBMC_addon.cpp
index 2dd9b0a65c..243abb0691 100644
--- a/lib/addons/library.xbmc.addon/libXBMC_addon.cpp
+++ b/lib/addons/library.xbmc.addon/libXBMC_addon.cpp
@@ -84,7 +84,7 @@ DLLEXPORT void XBMC_queue_notification(void *hdl, void* cb, const queue_msg_t ty
((CB_AddOnLib*)cb)->QueueNotification(((AddonCB*)hdl)->addonData, type, msg);
}
-DLLEXPORT const char* XBMC_unknown_to_utf8(void *hdl, void* cb, const char* str)
+DLLEXPORT char* XBMC_unknown_to_utf8(void *hdl, void* cb, const char* str)
{
if (cb == NULL)
return NULL;
@@ -92,7 +92,7 @@ DLLEXPORT const char* XBMC_unknown_to_utf8(void *hdl, void* cb, const char* str)
return ((CB_AddOnLib*)cb)->UnknownToUTF8(str);
}
-DLLEXPORT const char* XBMC_get_localized_string(void *hdl, void* cb, int dwCode)
+DLLEXPORT char* XBMC_get_localized_string(void *hdl, void* cb, int dwCode)
{
if (cb == NULL)
return "";
@@ -100,7 +100,7 @@ DLLEXPORT const char* XBMC_get_localized_string(void *hdl, void* cb, int dwCode)
return ((CB_AddOnLib*)cb)->GetLocalizedString(((AddonCB*)hdl)->addonData, dwCode);
}
-DLLEXPORT const char* XBMC_get_dvd_menu_language(void *hdl, void* cb)
+DLLEXPORT char* XBMC_get_dvd_menu_language(void *hdl, void* cb)
{
if (cb == NULL)
return "";
diff --git a/xbmc/addons/AddonCallbacks.h b/xbmc/addons/AddonCallbacks.h
index 4b2b4c1124..f58629840d 100644
--- a/xbmc/addons/AddonCallbacks.h
+++ b/xbmc/addons/AddonCallbacks.h
@@ -27,9 +27,9 @@
typedef void (*AddOnLogCallback)(void *addonData, const ADDON::addon_log_t loglevel, const char *msg);
typedef void (*AddOnQueueNotification)(void *addonData, const ADDON::queue_msg_t type, const char *msg);
typedef bool (*AddOnGetSetting)(void *addonData, const char *settingName, void *settingValue);
-typedef const char* (*AddOnUnknownToUTF8)(const char *sourceDest);
-typedef const char* (*AddOnGetLocalizedString)(const void* addonData, long dwCode);
-typedef const char* (*AddOnGetDVDMenuLanguage)(const void* addonData);
+typedef char* (*AddOnUnknownToUTF8)(const char *sourceDest);
+typedef char* (*AddOnGetLocalizedString)(const void* addonData, long dwCode);
+typedef char* (*AddOnGetDVDMenuLanguage)(const void* addonData);
typedef void* (*AddOnOpenFile)(const void* addonData, const char* strFileName, unsigned int flags);
typedef void* (*AddOnOpenFileForWrite)(const void* addonData, const char* strFileName, bool bOverWrite);
diff --git a/xbmc/addons/AddonCallbacksAddon.cpp b/xbmc/addons/AddonCallbacksAddon.cpp
index 53547bf402..fa81496590 100644
--- a/xbmc/addons/AddonCallbacksAddon.cpp
+++ b/xbmc/addons/AddonCallbacksAddon.cpp
@@ -227,19 +227,18 @@ bool CAddonCallbacksAddon::GetAddonSetting(void *addonData, const char *strSetti
return false;
}
-const char* CAddonCallbacksAddon::UnknownToUTF8(const char *strSource)
+char* CAddonCallbacksAddon::UnknownToUTF8(const char *strSource)
{
CStdString string;
if (strSource != NULL)
g_charsetConverter.unknownToUTF8(strSource, string);
else
string = "";
- char *buffer = (char*) malloc (string.length()+1);
- strcpy(buffer, string.c_str());
+ char* buffer = strdup(string.c_str());
return buffer;
}
-const char* CAddonCallbacksAddon::GetLocalizedString(const void* addonData, long dwCode)
+char* CAddonCallbacksAddon::GetLocalizedString(const void* addonData, long dwCode)
{
CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
if (!helper || g_application.m_bStop)
@@ -255,12 +254,11 @@ const char* CAddonCallbacksAddon::GetLocalizedString(const void* addonData, long
else
string = g_localizeStrings.Get(dwCode).c_str();
- char *buffer = (char*) malloc (string.length()+1);
- strcpy(buffer, string.c_str());
+ char* buffer = strdup(string.c_str());
return buffer;
}
-const char* CAddonCallbacksAddon::GetDVDMenuLanguage(const void* addonData)
+char* CAddonCallbacksAddon::GetDVDMenuLanguage(const void* addonData)
{
CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
if (!helper)
@@ -268,8 +266,7 @@ const char* CAddonCallbacksAddon::GetDVDMenuLanguage(const void* addonData)
CStdString string = g_langInfo.GetDVDMenuLanguage();
- char *buffer = (char*) malloc (string.length()+1);
- strcpy(buffer, string.c_str());
+ char* buffer = strdup(string.c_str());
return buffer;
}
diff --git a/xbmc/addons/AddonCallbacksAddon.h b/xbmc/addons/AddonCallbacksAddon.h
index 4e60f0782b..d9053f1cfe 100644
--- a/xbmc/addons/AddonCallbacksAddon.h
+++ b/xbmc/addons/AddonCallbacksAddon.h
@@ -38,9 +38,9 @@ public:
static void AddOnLog(void *addonData, const addon_log_t addonLogLevel, const char *strMessage);
static bool GetAddonSetting(void *addonData, const char *strSettingName, void *settingValue);
static void QueueNotification(void *addonData, const queue_msg_t type, const char *strMessage);
- static const char *UnknownToUTF8(const char *strSource);
- static const char *GetLocalizedString(const void* addonData, long dwCode);
- static const char *GetDVDMenuLanguage(const void* addonData);
+ static char* UnknownToUTF8(const char *strSource);
+ static char* GetLocalizedString(const void* addonData, long dwCode);
+ static char* GetDVDMenuLanguage(const void* addonData);
// file operations
static void* OpenFile(const void* addonData, const char* strFileName, unsigned int flags);