summaryrefslogtreecommitdiff
path: root/plugins/Watrack_MPD
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Watrack_MPD')
-rwxr-xr-xplugins/Watrack_MPD/src/init.cpp6
-rwxr-xr-xplugins/Watrack_MPD/src/main.cpp2
-rwxr-xr-xplugins/Watrack_MPD/src/utilities.cpp12
3 files changed, 5 insertions, 15 deletions
diff --git a/plugins/Watrack_MPD/src/init.cpp b/plugins/Watrack_MPD/src/init.cpp
index 3a1b47de37..2d50447cdd 100755
--- a/plugins/Watrack_MPD/src/init.cpp
+++ b/plugins/Watrack_MPD/src/init.cpp
@@ -51,8 +51,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
void InitVars()
{
gbPort = db_get_w(NULL, szModuleName, "Port", 6600);
- gbPassword = (TCHAR*)malloc(64*sizeof(TCHAR));
- gbHost = (TCHAR*)malloc(128*sizeof(TCHAR));
gbHost = UniGetContactSettingUtf(NULL, szModuleName, "Server", _T("127.0.0.1"));
gbPassword = UniGetContactSettingUtf(NULL, szModuleName, "Password", _T(""));
}
@@ -84,7 +82,7 @@ extern "C" __declspec(dllexport) int Load()
extern "C" __declspec(dllexport) int Unload(void)
{
- free(gbHost);
- free(gbPassword);
+ mir_free(gbHost);
+ mir_free(gbPassword);
return 0;
}
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp
index 85c595be9b..00063245b9 100755
--- a/plugins/Watrack_MPD/src/main.cpp
+++ b/plugins/Watrack_MPD/src/main.cpp
@@ -123,7 +123,7 @@ int Parser()
for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++)
tmp[i] = ptr[i];
tmp[i] = '\0';
- strcpy(ver, tmp);
+ strncpy_s(ver, tmp, _TRUNCATE);
SongInfo.txtver = mir_utf8decodeT(tmp);
}
else
diff --git a/plugins/Watrack_MPD/src/utilities.cpp b/plugins/Watrack_MPD/src/utilities.cpp
index 8ff7a65624..1375cc2bc1 100755
--- a/plugins/Watrack_MPD/src/utilities.cpp
+++ b/plugins/Watrack_MPD/src/utilities.cpp
@@ -19,14 +19,6 @@
TCHAR* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
- TCHAR* szRes = NULL;
- if (db_get_ts(hContact, szModule, szSetting, &dbv))
- return _tcsdup(szDef);
- else if(dbv.pszVal)
- szRes = _tcsdup(dbv.ptszVal);
- else
- szRes = _tcsdup(szDef);
- db_free(&dbv);
- return szRes;
+ TCHAR *szRes = db_get_tsa(hContact, szModule, szSetting);
+ return szRes ? szRes : mir_tstrdup(szDef);
}