summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-02-21 13:03:09 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-02-21 13:03:09 +0000
commit1c44f2df0725c7673b0522121461337270cd47c6 (patch)
tree73979ab4ed3fcdf367ccce10ba1811def67d69b6 /plugins
parent1f59d862f624b14135eaf16899d3bc617fa3ff1e (diff)
service MS_VARS_FREEMEMORY replaced with the direct call of mir_free
git-svn-id: http://svn.miranda-ng.org/main/trunk@3669 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/!Deprecated/NewAwaySysMod/AwaySys.cpp18
-rw-r--r--plugins/!Deprecated/NewAwaySysMod/MsgEventAdded.cpp3
-rw-r--r--plugins/!Deprecated/NewAwaySysMod/Notification.cpp2
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp4
-rw-r--r--plugins/ExternalAPI/m_variables.h101
-rw-r--r--plugins/SimpleAR/src/Main.cpp25
-rw-r--r--plugins/SimpleStatusMsg/src/main.cpp44
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp18
-rw-r--r--plugins/StopSpamPlus/src/utils.cpp4
-rw-r--r--plugins/TipperYM/src/subst.cpp302
-rw-r--r--plugins/Utils.pas/mirutils.pas10
-rw-r--r--plugins/Utils/mir_buffer.h2
-rw-r--r--plugins/Variables/src/parse_regexp.cpp4
-rw-r--r--plugins/Variables/src/parse_str.cpp12
-rw-r--r--plugins/Variables/src/variables.cpp50
-rw-r--r--plugins/Variables/src/variables.h3
16 files changed, 264 insertions, 338 deletions
diff --git a/plugins/!Deprecated/NewAwaySysMod/AwaySys.cpp b/plugins/!Deprecated/NewAwaySysMod/AwaySys.cpp
index d573009ede..9e8b0dd5b1 100644
--- a/plugins/!Deprecated/NewAwaySysMod/AwaySys.cpp
+++ b/plugins/!Deprecated/NewAwaySysMod/AwaySys.cpp
@@ -134,7 +134,7 @@ TCString GetDynamicStatMsg(HANDLE hContact, char *szProto, DWORD UIN, int iStatu
if (szResult)
{
VarParseData.Message = szResult;
- CallService(MS_VARS_FREEMEMORY, (WPARAM)szResult, 0);
+ mir_free(szResult);
}
}
return VarParseData.Message = VarParseData.Message.Left(AWAY_MSGDATA_MAX);
@@ -150,7 +150,7 @@ int StatusMsgReq(WPARAM wParam, LPARAM lParam, CString &szProto)
HANDLE hFoundContact = NULL; // if we'll find the contact only on some other protocol, but not on szProto, then we'll use that hContact.
HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact)
- {
+ {
char *szCurProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (DBGetContactSettingDword(hContact, szCurProto, "UIN", 0) == lParam)
{
@@ -356,7 +356,7 @@ int StatusChanged(WPARAM wParam, LPARAM lParam)
int CSStatusChange(WPARAM wParam, LPARAM lParam) // CommonStatus plugins (StartupStatus and AdvancedAutoAway)
{
// wParam = PROTOCOLSETTINGEX** protoSettings
- PROTOCOLSETTINGEX** ps = *(PROTOCOLSETTINGEX***)wParam;
+ PROTOCOLSETTINGEX** ps = *(PROTOCOLSETTINGEX***)wParam;
if (!ps)
{
return -1;
@@ -473,7 +473,7 @@ static INT_PTR SetContactStatMsg(WPARAM wParam, LPARAM lParam)
{
if (g_SetAwayMsgPage.GetWnd()) // already setting something
{
- SetForegroundWindow(g_SetAwayMsgPage.GetWnd());
+ SetForegroundWindow(g_SetAwayMsgPage.GetWnd());
return 0;
}
SetAwayMsgData *dat = new SetAwayMsgData;
@@ -544,7 +544,7 @@ INT_PTR srvAutoreplyUseDefault(WPARAM wParam, LPARAM lParam)
/* //NightFox: deleted used-to-be support
int Create_TopToolbar(WPARAM wParam, LPARAM lParam)
-{
+{
int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
if (ServiceExists(MS_TTB_ADDBUTTON))
{
@@ -967,9 +967,9 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam)
}
//NightFox
- HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInitialise);
-
-
+ HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInitialise);
+
+
return 0;
}
@@ -985,7 +985,7 @@ extern "C" int __declspec(dllexport) Load(void)
InitCommonControls();
InitOptions(); // must be called before we hook CallService
-
+
logservice_register(LOG_ID, LPGENT("New Away System"), _T("NewAwaySys?puts(p,?dbsetting(%subject%,Protocol,p))?if2(_?dbsetting(,?get(p),?pinfo(?get(p),uidsetting)),).log"), TranslateTS(_T("`[`!cdate()-!ctime()`]` ?cinfo(%subject%,display) (?cinfo(%subject%,id)) read your %") _T(VAR_STATDESC) _T("% message:\r\n%extratext%\r\n\r\n")));
if (DBGetContactSettingByte(NULL, MOD_NAME, DB_SETTINGSVER, 0) < 1)
diff --git a/plugins/!Deprecated/NewAwaySysMod/MsgEventAdded.cpp b/plugins/!Deprecated/NewAwaySysMod/MsgEventAdded.cpp
index a8219e7bd7..8f280898c9 100644
--- a/plugins/!Deprecated/NewAwaySysMod/MsgEventAdded.cpp
+++ b/plugins/!Deprecated/NewAwaySysMod/MsgEventAdded.cpp
@@ -304,7 +304,7 @@ int MsgEventAdded(WPARAM wParam, LPARAM lParam)
if (szResult != NULL)
{
Reply = szResult;
- CallService(MS_VARS_FREEMEMORY, (WPARAM)szResult, 0);
+ mir_free(szResult);
}
}
if (Reply.GetLen())
@@ -314,4 +314,3 @@ int MsgEventAdded(WPARAM wParam, LPARAM lParam)
}
return 0;
}
-
diff --git a/plugins/!Deprecated/NewAwaySysMod/Notification.cpp b/plugins/!Deprecated/NewAwaySysMod/Notification.cpp
index ca3f271f47..ce35017c8f 100644
--- a/plugins/!Deprecated/NewAwaySysMod/Notification.cpp
+++ b/plugins/!Deprecated/NewAwaySysMod/Notification.cpp
@@ -216,7 +216,7 @@ int ShowPopupNotification(COptPage &PopupNotifyData, HANDLE hContact, int iStatu
if (szResult)
{
PopupMsg = szResult;
- CallService(MS_VARS_FREEMEMORY, (WPARAM)szResult, 0);
+ mir_free(szResult);
}
} else
{
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index e946b6d864..b80237ee92 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -406,7 +406,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
ptszParsed = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
ChangeAllProtoStatuses(uMode, ptszParsed);
if (ptszParsed)
- CallService(MS_VARS_FREEMEMORY, (WPARAM)ptszParsed, 0);
+ mir_free(ptszParsed);
}else
ChangeAllProtoStatuses(uMode, dbVar.ptszVal);
DBFreeVariant(&dbVar);
@@ -596,7 +596,7 @@ static TCHAR *GetBossKeyText(void)
return buf;
}
-static IconItem iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("Hide Miranda NG"), "hidemim", IDI_DLGPASSWD }
};
diff --git a/plugins/ExternalAPI/m_variables.h b/plugins/ExternalAPI/m_variables.h
index 77b3407291..a352084b20 100644
--- a/plugins/ExternalAPI/m_variables.h
+++ b/plugins/ExternalAPI/m_variables.h
@@ -37,37 +37,6 @@
#endif
// --------------------------------------------------------------------------
-// Memory management
-// --------------------------------------------------------------------------
-
-// Release memory that was allocated by the Variables plugin, e.g. returned
-// strings.
-
-#define MS_VARS_FREEMEMORY "Vars/FreeMemory"
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(void *)pntr
-// Pointer to memory that was allocated by the Variables plugin (e.g. a
-// returned string) (can be NULL).
-// lParam = 0
-
-// Return Value:
-// ------------------------
-// Does return 0 on success, nozero otherwise.
-
-// Note: Do only use this service to free memory that was *explicitliy*
-// stated that it should be free with this service.
-
-// Helper function for easy using:
-#ifndef VARIABLES_NOHELPER
-__inline static void variables_free(void *pntr) {
-
- CallService(MS_VARS_FREEMEMORY, (WPARAM)pntr, 0);
-}
-#endif
-
-// --------------------------------------------------------------------------
// String formatting
// --------------------------------------------------------------------------
@@ -180,51 +149,37 @@ __inline static TCHAR *variables_parse_ex(TCHAR *tszFormat, TCHAR *tszExtraText,
// Note: The returned pointer needs to be released using your own free().
#ifndef VARIABLES_NOHELPER
-__inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact) {
-
- if (ServiceExists(MS_VARS_FORMATSTRING)) {
- FORMATINFO fi;
- TCHAR *tszParsed, *tszResult;
-
- ZeroMemory(&fi, sizeof(fi));
- fi.cbSize = sizeof(fi);
- fi.tszFormat = tszFormat;
- fi.tszExtraText = tszExtraText;
- fi.hContact = hContact;
- fi.flags |= FIF_TCHAR;
- tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
- if (tszParsed) {
- tszResult = mir_tstrdup(tszParsed);
- CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
- return tszResult;
- }
- }
- return tszFormat?mir_tstrdup(tszFormat):tszFormat;
+__inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact)
+{
+ if ( ServiceExists(MS_VARS_FORMATSTRING)) {
+ FORMATINFO fi = { sizeof(fi) };
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags |= FIF_TCHAR;
+ TCHAR *tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ if (tszParsed)
+ return tszParsed;
+ }
+ return tszFormat ? mir_tstrdup(tszFormat) : tszFormat;
}
__inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact,
- TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize) {
-
- if (ServiceExists(MS_VARS_FORMATSTRING)) {
- FORMATINFO fi;
- TCHAR *tszParsed, *tszResult;
-
- ZeroMemory(&fi, sizeof(fi));
- fi.cbSize = sizeof(fi);
- fi.tszFormat = tszFormat;
- fi.tszExtraText = tszExtraText;
- fi.hContact = hContact;
- fi.flags |= FIF_TCHAR;
- fi.tszaTemporaryVars = tszaTemporaryVars;
- fi.cbTemporaryVarsSize = cbTemporaryVarsSize;
- tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
- if (tszParsed) {
- tszResult = mir_tstrdup(tszParsed);
- CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
- return tszResult;
- }
- }
- return tszFormat?mir_tstrdup(tszFormat):tszFormat;
+ TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize)
+{
+ if ( ServiceExists(MS_VARS_FORMATSTRING)) {
+ FORMATINFO fi = { sizeof(fi) };
+ fi.tszFormat = tszFormat;
+ fi.tszExtraText = tszExtraText;
+ fi.hContact = hContact;
+ fi.flags |= FIF_TCHAR;
+ fi.tszaTemporaryVars = tszaTemporaryVars;
+ fi.cbTemporaryVarsSize = cbTemporaryVarsSize;
+ TCHAR *tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ if (tszParsed)
+ return tszParsed;
+ }
+ return tszFormat ? mir_tstrdup(tszFormat) : tszFormat;
}
#endif
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp
index fd81787221..a1041d4d06 100644
--- a/plugins/SimpleAR/src/Main.cpp
+++ b/plugins/SimpleAR/src/Main.cpp
@@ -1,5 +1,5 @@
/*
-Plugin of miranda IM(ICQ) for Communicating with users of the baseProtocol.
+Plugin of miranda IM(ICQ) for Communicating with users of the baseProtocol.
Copyright (C) 2004 Daniel Savi (dss@brturbo.com)
-> Based on J. Lawler BaseProtocol <-
@@ -10,7 +10,7 @@ Added:
- tinyclib http://msdn.microsoft.com/msdnmag/issues/01/01/hood/default.aspx
- C++ version
-Miranda ICQ: the free icq client for MS Windows
+Miranda ICQ: the free icq client for MS Windows
Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede
*/
@@ -191,7 +191,7 @@ INT addEvent(WPARAM wParam, LPARAM lParam)
DBEVENTINFO dbei = {sizeof(dbei)};
if (!fEnabled || !hContact || !hDBEvent)
- return FALSE; /// unspecifyed error
+ return FALSE; /// unspecifyed error
char* pszProto = GetContactProto(hContact);
int status = CallProtoService(pszProto, PS_GETSTATUS, 0, 0);
@@ -200,7 +200,7 @@ INT addEvent(WPARAM wParam, LPARAM lParam)
CallService(MS_DB_EVENT_GET, (WPARAM)hDBEvent, (LPARAM)&dbei); /// detect size of msg
- if ((dbei.eventType != EVENTTYPE_MESSAGE) || (dbei.flags == DBEF_READ))
+ if ((dbei.eventType != EVENTTYPE_MESSAGE) || (dbei.flags == DBEF_READ))
return FALSE; /// we need EVENTTYPE_MESSAGE event..
else
{ /// needed event has occured..
@@ -212,15 +212,15 @@ INT addEvent(WPARAM wParam, LPARAM lParam)
if (DBGetContactSettingTString(hContact,"Protocol","p",&dbv))
// Contact with no protocol ?!!
return FALSE;
- else
+ else
DBFreeVariant(&dbv);
-
+
if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
return FALSE;
-
+
if(DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0))
return FALSE;
-
+
if (!( dbei.flags & DBEF_SENT))
{
int timeBetween=time(NULL)-DBGetContactSettingDword(hContact,protocolname,"LastReplyTS",0);
@@ -260,7 +260,7 @@ INT addEvent(WPARAM wParam, LPARAM lParam)
if (ServiceExists(MS_VARS_FORMATSTRING))
{
FORMATINFO fi;
-
+
ZeroMemory(&fi, sizeof(fi));
fi.cbSize = sizeof(fi);
fi.flags = FIF_TCHAR;
@@ -279,11 +279,8 @@ INT addEvent(WPARAM wParam, LPARAM lParam)
dbei.cbBlob = lstrlenA(pszUtf) + 1;
dbei.pBlob = (PBYTE)pszUtf;
CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
-
- if (ServiceExists(MS_VARS_FORMATSTRING))
- CallService(MS_VARS_FREEMEMORY, (WPARAM)ptszTemp, 0);
- else
- mir_free(ptszTemp);
+
+ mir_free(ptszTemp);
mir_free(ptszTemp2);
mir_free(pszUtf);
if (dbvNick.ptszVal)
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp
index e1b1ce5161..712b8a6b40 100644
--- a/plugins/SimpleStatusMsg/src/main.cpp
+++ b/plugins/SimpleStatusMsg/src/main.cpp
@@ -208,7 +208,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
char *FortuneMsgA;
-
+
if (!ServiceExists(MS_FORTUNEMSG_GETMESSAGE))
continue;
@@ -221,7 +221,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
MoveMemory(msg + i + lstrlen(FortuneMsg), msg + i + 12, (lstrlen(msg) - i - 11) * sizeof(TCHAR));
CopyMemory(msg + i, FortuneMsg, lstrlen(FortuneMsg) * sizeof(TCHAR));
-
+
mir_free(FortuneMsg);
CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsgA);
@@ -233,7 +233,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
char *FortuneMsgA;
-
+
if (!ServiceExists(MS_FORTUNEMSG_GETPROTOMSG))
continue;
@@ -247,7 +247,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
MoveMemory(msg + i + lstrlen(FortuneMsg), msg + i + 17, (lstrlen(msg) - i - 16) * sizeof(TCHAR));
CopyMemory(msg + i, FortuneMsg, lstrlen(FortuneMsg) * sizeof(TCHAR));
-
+
mir_free(FortuneMsg);
CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsgA);
@@ -259,7 +259,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
char *FortuneMsgA;
-
+
if (!ServiceExists(MS_FORTUNEMSG_GETSTATUSMSG))
continue;
@@ -273,7 +273,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status)
MoveMemory(msg + i + lstrlen(FortuneMsg), msg + i + 18, (lstrlen(msg) - i - 17) * sizeof(TCHAR));
CopyMemory(msg + i, FortuneMsg, lstrlen(FortuneMsg) * sizeof(TCHAR));
-
+
mir_free(FortuneMsg);
CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsgA);
@@ -474,7 +474,7 @@ TCHAR *InsertVarsIntoMsg(TCHAR *tszMsg, const char *szProto, int iStatus, HANDLE
if (tszVarsMsg != NULL)
{
TCHAR *format = InsertBuiltinVarsIntoMsg(tszVarsMsg, szProto, iStatus);
- CallService(MS_VARS_FREEMEMORY, (WPARAM)tszVarsMsg, 0);
+ mir_free(tszVarsMsg);
return format;
}
}
@@ -558,7 +558,7 @@ void DBWriteMessage(char *szSetting, TCHAR *tszMsg)
void SaveMessageToDB(const char *szProto, TCHAR *tszMsg, BOOL bIsFormat)
{
char szSetting[80];
-
+
if (!szProto)
{
for (int i = 0; i < accounts->count; ++i)
@@ -568,7 +568,7 @@ void SaveMessageToDB(const char *szProto, TCHAR *tszMsg, BOOL bIsFormat)
if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
-
+
if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
@@ -805,7 +805,7 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam)
if (DBGetContactSettingByte(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
continue;
-
+
if (wParam == ID_STATUS_CURRENT || wParam == 0)
newStatus = GetCurrentStatus(accounts->pa[i]->szModuleName);
@@ -814,7 +814,7 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam)
CallProtoService(accounts->pa[i]->szModuleName, PS_SETSTATUS, newStatus, 0);
continue;
}
-
+
int status_modes_msg = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
if ((Proto_Status2Flag(newStatus) & status_modes_msg) || (newStatus == ID_STATUS_OFFLINE && (Proto_Status2Flag(ID_STATUS_INVISIBLE) & status_modes_msg)))
@@ -961,9 +961,9 @@ INT_PTR ShowStatusMessageDialogInternal(WPARAM wParam, LPARAM lParam)
{
struct MsgBoxInitData *box_data;
BOOL idvstatusmsg = FALSE;
-
+
if (Miranda_Terminated()) return 0;
-
+
if (hTTBButton)
{
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButton, (LPARAM)TTBST_RELEASED);
@@ -1038,9 +1038,9 @@ INT_PTR ShowStatusMessageDialog(WPARAM wParam, LPARAM lParam)
{
struct MsgBoxInitData *box_data;
BOOL idvstatusmsg = FALSE;
-
+
if (Miranda_Terminated()) return 0;
-
+
box_data = (struct MsgBoxInitData *)mir_alloc(sizeof(struct MsgBoxInitData));
for (int i = 0; i < accounts->count; ++i)
@@ -1056,7 +1056,7 @@ INT_PTR ShowStatusMessageDialog(WPARAM wParam, LPARAM lParam)
if (!accounts->pa[i]->bIsVisible)
continue;
-
+
if (!strcmp(accounts->pa[i]->szModuleName, (char *)lParam))
{
box_data->m_szProto = accounts->pa[i]->szModuleName;
@@ -1390,7 +1390,7 @@ int SetStartupStatus(int i)
if (iStatus == ID_STATUS_OFFLINE)
return -1;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) ||
+ if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) ||
!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
{
CallProtoService(accounts->pa[i]->szModuleName, PS_SETSTATUS, (WPARAM)iStatus, 0);
@@ -1425,7 +1425,7 @@ int SetStartupStatus(int i)
if (fmsg)
msg = InsertVarsIntoMsg(fmsg, accounts->pa[i]->szModuleName, iStatus, NULL);
-
+
SaveMessageToDB(accounts->pa[i]->szModuleName, fmsg, TRUE);
SaveMessageToDB(accounts->pa[i]->szModuleName, msg, FALSE);
@@ -1938,7 +1938,7 @@ static int OnAccListChanged(WPARAM wParam, LPARAM lParam)
HookProtoEvent(accounts->pa[i]->szModuleName, ME_ICQ_STATUSMSGREQ, OnICQStatusMsgRequest);
accounts->statusFlags |= (CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0));
-
+
if (CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0))
accounts->statusCount++;
@@ -2058,7 +2058,7 @@ static int OnOkToExit(WPARAM wParam, LPARAM lParam)
if (accounts->statusCount)
{
char szSetting[80];
-
+
for (int i = 0; i < accounts->count; ++i)
{
if (!IsAccountEnabled(accounts->pa[i]))
@@ -2066,7 +2066,7 @@ static int OnOkToExit(WPARAM wParam, LPARAM lParam)
if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
-
+
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sStatus", accounts->pa[i]->szModuleName);
DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0));
}
@@ -2082,7 +2082,7 @@ static int OnPreShutdown(WPARAM wParam, LPARAM lParam)
{
if (!accounts->statusMsgFlags)
return 0;
-
+
AwayMsgPreShutdown();
if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
if (hProtoStatusMenuItem) mir_free(hProtoStatusMenuItem);
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index 494e602a34..30bdf639b4 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -4,12 +4,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -127,13 +127,13 @@ void RemoveExcludedUsers()
plist->hContact = INVALID_HANDLE_VALUE;
}
}while(hContact = db_find_next(hContact));
-
+
plist = first;
while(plist->hContact != INVALID_HANDLE_VALUE)
{
std::string proto=DBGetContactSettingStringPAN_A(plist->hContact,"Protocol","p","");
UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0);
-
+
if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){
LogSpamToFile(plist->hContact, _T("Mark for delete"));
DBWriteContactSettingByte(plist->hContact,"CList","Delete", 1);
@@ -176,8 +176,8 @@ void RemoveTemporaryUsers()
{
std::string proto=DBGetContactSettingStringPAN_A(plist->hContact,"Protocol","p","");
UINT status = CallProtoService(proto.c_str(), PS_GETSTATUS, 0, 0);
-
- if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){
+
+ if(status>= ID_STATUS_CONNECTING && status <= ID_STATUS_OFFLINE){
LogSpamToFile(plist->hContact, _T("Mark for delete"));
DBWriteContactSettingByte(plist->hContact,"CList","Delete", 1);
}else{
@@ -214,7 +214,7 @@ tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){
free(fi.tszFormat);
if (tszParsed) {
tstrResult = tszParsed;
- CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
+ mir_free(tszParsed);
return tstrResult;
}
}
@@ -325,11 +325,11 @@ tstring GetContactUid(HANDLE hContact, tstring Protocol)
break;
case CNFT_DWORD:
#if defined(_MSC_VER) && _MSC_VER >= 1300
-
+
_itoa_s(ci.dVal,aUid,32,10);
#else
_itoa(ci.dVal,aUid,10);
-
+
#endif
OemToChar(aUid, dUid);
Uid=dUid;
diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp
index 885af411ad..4719062ceb 100644
--- a/plugins/StopSpamPlus/src/utils.cpp
+++ b/plugins/StopSpamPlus/src/utils.cpp
@@ -11,7 +11,7 @@ tstring &GetDlgItemString(HWND hwnd, int id)
s = buf;
delete []buf;
return s;
-}
+}
bool IsExistMyMessage(HANDLE hContact)
{
@@ -57,7 +57,7 @@ tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){
free(fi.tszFormat);
if (tszParsed) {
tstrResult = tszParsed;
- CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
+ mir_free(tszParsed);
return tstrResult;
}
}
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp
index 9320430577..6d439f8bec 100644
--- a/plugins/TipperYM/src/subst.cpp
+++ b/plugins/TipperYM/src/subst.cpp
@@ -15,7 +15,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
*/
#include "common.h"
@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA.
#include "popwin.h"
-int ProtoServiceExists(const char *szModule, const char *szService)
+int ProtoServiceExists(const char *szModule, const char *szService)
{
char str[MAXMODULELABELLENGTH];
strcpy(str,szModule);
@@ -32,7 +32,7 @@ int ProtoServiceExists(const char *szModule, const char *szService)
return ServiceExists(str);
}
-bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
+bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen)
{
DBVARIANT dbv;
buff[0] = 0;
@@ -42,7 +42,7 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons
if (!DBGetContactSetting(hContact, szModuleName, szSettingName, &dbv))
{
- switch(dbv.type)
+ switch(dbv.type)
{
case DBVT_BYTE:
_itot(dbv.bVal, buff, 10);
@@ -75,12 +75,12 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons
return buff[0] ? true : false;
}
-void StripBBCodesInPlace(TCHAR *swzText)
+void StripBBCodesInPlace(TCHAR *swzText)
{
if (!DBGetContactSettingByte(0, MODULE, "StripBBCodes", 1))
return;
- if (swzText == 0)
+ if (swzText == 0)
return;
size_t iRead = 0, iWrite = 0;
@@ -88,7 +88,7 @@ void StripBBCodesInPlace(TCHAR *swzText)
while(iRead <= iLen) // copy terminating null too
{
- while(iRead <= iLen && swzText[iRead] != '[')
+ while(iRead <= iLen && swzText[iRead] != '[')
{
if (swzText[iRead] != swzText[iWrite]) swzText[iWrite] = swzText[iRead];
iRead++; iWrite++;
@@ -101,21 +101,21 @@ void StripBBCodesInPlace(TCHAR *swzText)
iRead += 3;
else if (iLen - iRead >= 4 && (_tcsnicmp(swzText + iRead, _T("[/b]"), 4) == 0 || _tcsnicmp(swzText + iRead, _T("[/i]"), 4) == 0))
iRead += 4;
- else if (iLen - iRead >= 6 && (_tcsnicmp(swzText + iRead, _T("[color"), 6) == 0))
+ else if (iLen - iRead >= 6 && (_tcsnicmp(swzText + iRead, _T("[color"), 6) == 0))
{
- while(iRead < iLen && swzText[iRead] != ']') iRead++;
+ while(iRead < iLen && swzText[iRead] != ']') iRead++;
iRead++;// skip the ']'
- }
+ }
else if (iLen - iRead >= 8 && (_tcsnicmp(swzText + iRead, _T("[/color]"), 8) == 0))
iRead += 8;
else if (iLen - iRead >= 5 && (_tcsnicmp(swzText + iRead, _T("[size"), 5) == 0))
{
- while(iRead < iLen && swzText[iRead] != ']') iRead++;
+ while(iRead < iLen && swzText[iRead] != ']') iRead++;
iRead++;// skip the ']'
- }
+ }
else if (iLen - iRead >= 7 && (_tcsnicmp(swzText + iRead, _T("[/size]"), 7) == 0))
iRead += 7;
- else
+ else
{
if (swzText[iRead] != swzText[iWrite]) swzText[iWrite] = swzText[iRead];
iRead++; iWrite++;
@@ -123,28 +123,28 @@ void StripBBCodesInPlace(TCHAR *swzText)
}
}
-DWORD LastMessageTimestamp(HANDLE hContact)
+DWORD LastMessageTimestamp(HANDLE hContact)
{
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
HANDLE hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0);
- while (hDbEvent)
+ while (hDbEvent)
{
dbei.cbBlob = 0;
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
break;
-
+
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0);
}
- if (hDbEvent)
+ if (hDbEvent)
return dbei.timestamp;
return 0;
}
-void FormatTimestamp(DWORD ts, char *szFormat, TCHAR *buff, int bufflen)
+void FormatTimestamp(DWORD ts, char *szFormat, TCHAR *buff, int bufflen)
{
TCHAR swzForm[16];
DBTIMETOSTRINGT dbt = {0};
@@ -155,14 +155,14 @@ void FormatTimestamp(DWORD ts, char *szFormat, TCHAR *buff, int bufflen)
CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
}
-bool Uid(HANDLE hContact, char *szProto, TCHAR *buff, int bufflen)
+bool Uid(HANDLE hContact, char *szProto, TCHAR *buff, int bufflen)
{
char *tmpProto = NULL;
if (hContact) tmpProto = GetContactProto(hContact);
else tmpProto = szProto;
- if (tmpProto)
+ if (tmpProto)
{
char *szUid = ( char* )CallProtoService(tmpProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if (szUid && (INT_PTR)szUid != CALLSERVICE_NOTFOUND)
@@ -172,7 +172,7 @@ bool Uid(HANDLE hContact, char *szProto, TCHAR *buff, int bufflen)
return false;
}
-bool UidName(char *szProto, TCHAR *buff, int bufflen)
+bool UidName(char *szProto, TCHAR *buff, int bufflen)
{
if (szProto)
{
@@ -181,33 +181,33 @@ bool UidName(char *szProto, TCHAR *buff, int bufflen)
{
a2t(szUidName, buff, bufflen);
return true;
- }
+ }
}
return false;
}
-TCHAR *GetLastMessageText(HANDLE hContact)
+TCHAR *GetLastMessageText(HANDLE hContact)
{
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
HANDLE hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0);
- while (hDbEvent)
+ while (hDbEvent)
{
dbei.cbBlob = 0;
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
break;
-
+
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0);
}
- if (hDbEvent)
+ if (hDbEvent)
{
dbei.pBlob = (BYTE *)alloca(dbei.cbBlob);
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
- if (dbei.cbBlob == 0 || dbei.pBlob == 0)
+ if (dbei.cbBlob == 0 || dbei.pBlob == 0)
return 0;
TCHAR *buff = DbGetEventTextT( &dbei, CP_ACP );
@@ -223,27 +223,27 @@ TCHAR *GetLastMessageText(HANDLE hContact)
bool CanRetrieveStatusMsg(HANDLE hContact, char *szProto)
{
- if (opt.bGetNewStatusMsg)
+ if (opt.bGetNewStatusMsg)
{
int iFlags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0);
WORD wStatus = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
if ((CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) && (iFlags & Proto_Status2Flag(wStatus)))
{
iFlags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & (PF1_VISLIST | PF1_INVISLIST);
- if (opt.bDisableIfInvisible && iFlags)
+ if (opt.bDisableIfInvisible && iFlags)
{
- int iVisMode = DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0);
+ int iVisMode = DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0);
int wProtoStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if ((iVisMode == ID_STATUS_OFFLINE) || (wProtoStatus == ID_STATUS_INVISIBLE && iVisMode != ID_STATUS_ONLINE))
return false;
else
return true;
- }
+ }
else
{
return true;
}
- }
+ }
else
{
return false;
@@ -253,25 +253,25 @@ bool CanRetrieveStatusMsg(HANDLE hContact, char *szProto)
return false;
}
-TCHAR *GetStatusMessageText(HANDLE hContact)
+TCHAR *GetStatusMessageText(HANDLE hContact)
{
TCHAR *swzMsg = 0;
DBVARIANT dbv;
char *szProto = GetContactProto(hContact);
- if (szProto)
+ if (szProto)
{
if (!strcmp(szProto, szMetaModuleName))
{
hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
}
- else
- {
+ else
+ {
WORD wStatus = (int)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- if (wStatus == ID_STATUS_OFFLINE)
+ if (wStatus == ID_STATUS_OFFLINE)
return NULL;
- if (!DBGetContactSettingTString(hContact, MODULE, "TempStatusMsg", &dbv))
+ if (!DBGetContactSettingTString(hContact, MODULE, "TempStatusMsg", &dbv))
{
if (_tcslen(dbv.ptszVal) != 0)
swzMsg = mir_tstrdup(dbv.ptszVal);
@@ -279,7 +279,7 @@ TCHAR *GetStatusMessageText(HANDLE hContact)
}
}
- if (!swzMsg)
+ if (!swzMsg)
{
if (CanRetrieveStatusMsg(hContact, szProto))
{
@@ -287,7 +287,7 @@ TCHAR *GetStatusMessageText(HANDLE hContact)
return NULL;
}
- if (!DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv))
+ if (!DBGetContactSettingTString(hContact, "CList", "StatusMsg", &dbv))
{
if (dbv.ptszVal && _tcslen(dbv.ptszVal) != 0)
swzMsg = mir_tstrdup(dbv.ptszVal);
@@ -296,19 +296,19 @@ TCHAR *GetStatusMessageText(HANDLE hContact)
}
}
- if (swzMsg)
+ if (swzMsg)
StripBBCodesInPlace(swzMsg);
return swzMsg;
}
-bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int bufflen)
+bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int bufflen)
{
if (!_tcscmp(swzRawSpec, _T("uid")))
{
return Uid(hContact, 0, buff, bufflen);
- }
- else if (!_tcscmp(swzRawSpec, _T("proto")))
+ }
+ else if (!_tcscmp(swzRawSpec, _T("proto")))
{
char *szProto = GetContactProto(hContact);
if (szProto)
@@ -316,15 +316,15 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
a2t(szProto, buff, bufflen);
return true;
}
- }
- else if (!_tcscmp(swzRawSpec, _T("account")))
+ }
+ else if (!_tcscmp(swzRawSpec, _T("account")))
{
char *szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0);
- if ((INT_PTR)szProto == CALLSERVICE_NOTFOUND)
+ if ((INT_PTR)szProto == CALLSERVICE_NOTFOUND)
{
return GetSysSubstText(hContact, _T("proto"), buff, bufflen);
}
- else if (szProto)
+ else if (szProto)
{
PROTOACCOUNT *pa = ProtoGetAccount(szProto);
if (pa && pa->tszAccountName)
@@ -335,18 +335,18 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
else
return GetSysSubstText(hContact, _T("proto"), buff, bufflen);
}
- }
- else if (!_tcscmp(swzRawSpec, _T("time")))
+ }
+ else if (!_tcscmp(swzRawSpec, _T("time")))
{
if (tmi.printDateTime && !tmi.printDateTimeByContact(hContact, _T("t"), buff, bufflen, TZF_KNOWNONLY))
return true;
}
else if (!_tcscmp(swzRawSpec, _T("uidname")))
{
- char *szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
return UidName(szProto, buff, bufflen);
}
- else if (!_tcscmp(swzRawSpec, _T("status_msg")))
+ else if (!_tcscmp(swzRawSpec, _T("status_msg")))
{
TCHAR *swzMsg = GetStatusMessageText(hContact);
if (swzMsg)
@@ -355,7 +355,7 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
mir_free(swzMsg);
return true;
}
- }
+ }
else if (!_tcscmp(swzRawSpec, _T("last_msg")))
{
TCHAR *swzMsg = GetLastMessageText(hContact);
@@ -365,8 +365,8 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
mir_free(swzMsg);
return true;
}
- }
- else if (!_tcscmp(swzRawSpec, _T("meta_subname")))
+ }
+ else if (!_tcscmp(swzRawSpec, _T("meta_subname")))
{
// get contact list name of active subcontact
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
@@ -374,35 +374,35 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
TCHAR *swzNick = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hSubContact, GCDNF_TCHAR);
if (swzNick) _tcsncpy(buff, swzNick, bufflen);
return true;
- }
+ }
else if (!_tcscmp(swzRawSpec, _T("meta_subuid")))
{
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false;
return Uid(hSubContact, 0, buff, bufflen);
- }
+ }
else if (!_tcscmp(swzRawSpec, _T("meta_subproto")))
{
// get protocol of active subcontact
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
- if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND)
+ if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND)
return false;
return GetSysSubstText(hSubContact, _T("account"), buff, bufflen);
- }
- else if (!_tcscmp(swzRawSpec, _T("last_msg_time")))
+ }
+ else if (!_tcscmp(swzRawSpec, _T("last_msg_time")))
{
DWORD ts = LastMessageTimestamp(hContact);
if (ts == 0) return false;
FormatTimestamp(ts, "t", buff, bufflen);
return true;
- }
- else if (!_tcscmp(swzRawSpec, _T("last_msg_date")))
+ }
+ else if (!_tcscmp(swzRawSpec, _T("last_msg_date")))
{
DWORD ts = LastMessageTimestamp(hContact);
if (ts == 0) return false;
FormatTimestamp(ts, "d", buff, bufflen);
return true;
- }
+ }
else if (!_tcscmp(swzRawSpec, _T("last_msg_reltime")))
{
DWORD ts = LastMessageTimestamp(hContact);
@@ -416,7 +416,7 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
else if (h > 0) mir_sntprintf(buff, bufflen, TranslateT("%dh %dm"), h, m);
else mir_sntprintf(buff, bufflen, TranslateT("%dm"), m);
return true;
- }
+ }
else if (!_tcscmp(swzRawSpec, _T("msg_count_all")) || !_tcscmp(swzRawSpec, _T("msg_count_out")) || !_tcscmp(swzRawSpec, _T("msg_count_in")))
{
DWORD dwCountOut, dwCountIn;
@@ -442,9 +442,9 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
if (dwDiff > (60 * 60 * 24 * 3))
{
DBWriteContactSettingDword(hTmpContact, MODULE, "LastCountTS", dwTime);
- dwCountOut = dwCountIn = dwLastTs = 0;
- }
- else
+ dwCountOut = dwCountIn = dwLastTs = 0;
+ }
+ else
{
dwCountOut = DBGetContactSettingDword(hTmpContact, MODULE, "MsgCountOut", 0);
dwCountIn = DBGetContactSettingDword(hTmpContact, MODULE, "MsgCountIn", 0);
@@ -454,21 +454,21 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
dwNewTs = dwLastTs;
HANDLE dbe = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hTmpContact, 0);
- while (dbe != NULL)
+ while (dbe != NULL)
{
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
if (!CallService(MS_DB_EVENT_GET, (WPARAM)dbe, (LPARAM)&dbei))
{
- if (dbei.eventType == EVENTTYPE_MESSAGE)
+ if (dbei.eventType == EVENTTYPE_MESSAGE)
{
dwNewTs = max(dwNewTs, dbei.timestamp);
- if (dbei.timestamp > dwLastTs)
+ if (dbei.timestamp > dwLastTs)
{
if (dbei.flags & DBEF_SENT) dwCountOut++;
else dwCountIn++;
- }
- else
+ }
+ else
break;
}
}
@@ -481,7 +481,7 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
DBWriteContactSettingDword(hTmpContact, MODULE, "MsgCountIn", dwCountIn);
DBWriteContactSettingDword(hTmpContact, MODULE, "LastMsgTS", dwNewTs);
}
-
+
dwMetaCountOut += dwCountOut;
dwMetaCountIn += dwCountIn;
}
@@ -498,22 +498,22 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle
return false;
}
-bool GetSubstText(HANDLE hContact, const DISPLAYSUBST &ds, TCHAR *buff, int bufflen)
+bool GetSubstText(HANDLE hContact, const DISPLAYSUBST &ds, TCHAR *buff, int bufflen)
{
TranslateFunc *transFunc = 0;
for (int i = 0; i < iTransFuncsCount; i++)
{
- if (translations[i].id == (DWORD)ds.iTranslateFuncId)
+ if (translations[i].id == (DWORD)ds.iTranslateFuncId)
{
transFunc = translations[i].transFunc;
break;
}
}
- if (!transFunc)
+ if (!transFunc)
return false;
- switch (ds.type)
+ switch (ds.type)
{
case DVT_DB:
return transFunc(hContact, ds.szModuleName, ds.szSettingName, buff, bufflen) != 0;
@@ -528,15 +528,15 @@ bool GetSubstText(HANDLE hContact, const DISPLAYSUBST &ds, TCHAR *buff, int buff
return transFunc(hContact, "UserInfo", ds.szSettingName, buff, bufflen) != 0;
}
break;
- }
+ }
}
return false;
}
-bool GetRawSubstText(HANDLE hContact, char *szRawSpec, TCHAR *buff, int bufflen)
+bool GetRawSubstText(HANDLE hContact, char *szRawSpec, TCHAR *buff, int bufflen)
{
size_t lenght = strlen(szRawSpec);
- for (size_t i = 0; i < lenght; i++)
+ for (size_t i = 0; i < lenght; i++)
{
if (szRawSpec[i] == '/')
{
@@ -550,7 +550,7 @@ bool GetRawSubstText(HANDLE hContact, char *szRawSpec, TCHAR *buff, int bufflen)
return true;
else
return translations[0].transFunc(hContact, "UserInfo", &szRawSpec[i + 1], buff, bufflen) != 0;
- }
+ }
else
{
return false;
@@ -565,7 +565,7 @@ bool GetRawSubstText(HANDLE hContact, char *szRawSpec, TCHAR *buff, int bufflen)
return false;
}
-bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFirst, TCHAR *swzDest, int iDestLen)
+bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFirst, TCHAR *swzDest, int iDestLen)
{
// hack - allow empty strings before passing to variables (note - zero length strings return false after this)
if (swzDest && swzSource && _tcslen(swzSource) == 0) {
@@ -585,18 +585,18 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
TCHAR swzVName[LABEL_LEN];
TCHAR swzRep[VALUE_LEN], swzAlt[VALUE_LEN];
- while (si < iSourceLen && di < (size_t)iDestLen - 1)
+ while (si < iSourceLen && di < (size_t)iDestLen - 1)
{
if (swzVarSrc[si] == _T('%'))
{
si++;
v = 0;
- while (si < iSourceLen && v < LABEL_LEN)
+ while (si < iSourceLen && v < LABEL_LEN)
{
if (swzVarSrc[si] == _T('%'))
- {
+ {
// two %'s in a row in variable name disabled: e.g. %a%%b% - this is atbbguous]
- //if (si + 1 < iSourceLen && swzVarSrc[si + 1] == _T('%')) {
+ //if (si + 1 < iSourceLen && swzVarSrc[si + 1] == _T('%')) {
// si++; // skip first %, allow following code to add the second one to the variable name
//} else
break;
@@ -608,7 +608,7 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
if (v == 0) // bSubst len is 0 - just a % symbol
{
swzDest[di] = _T('%');
- }
+ }
else if (si < iSourceLen) // we found end %
{
swzVName[v] = 0;
@@ -618,11 +618,11 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
// apply only to specific protocols
TCHAR *p = _tcsrchr(swzVName, _T('^')); // use last '^', so if you want a ^ in swzAlt text, you can just put a '^' on the end
- if (p)
+ if (p)
{
*p = 0;
p++;
- if (*p)
+ if (*p)
{
char *cp = GetContactProto(hContact);
if (cp != NULL)
@@ -633,12 +633,12 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
cp = acc->szProtoName;
}
}
-
+
if (cp == NULL)
goto empty;
bool negate = false;
- if (*p == _T('!'))
+ if (*p == _T('!'))
{
p++;
if (*p == 0) goto error;
@@ -666,7 +666,7 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
}
}
- if (negate ? spec : !spec)
+ if (negate ? spec : !spec)
goto empty;
}
}
@@ -674,31 +674,31 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
// get alternate text, if bSubst fails
swzAlt[0] = 0;
p = _tcschr(swzVName, _T('|')); // use first '|' - so you can use the '|' symbol in swzAlt text
- if (p)
+ if (p)
{
*p = 0; // clip swzAlt from swzVName
- p++;
+ p++;
if (_tcslen(p) > 4 && _tcsncmp(p, _T("raw:"), 4) == 0) // raw db substitution
- {
+ {
char raw_spec[LABEL_LEN];
p += 4;
t2a(p, raw_spec, LABEL_LEN);
GetRawSubstText(hContact, raw_spec, swzAlt, VALUE_LEN);
- }
+ }
else if (_tcslen(p) > 4 && _tcsncmp(p, _T("sys:"), 4) == 0) // 'system' substitution
- {
+ {
p += 4;
GetSysSubstText(hContact, p, swzAlt, VALUE_LEN);
- }
+ }
else
{
// see if we can find the bSubst
DSListNode *ds_node = opt.dsList;
- while(ds_node)
+ while(ds_node)
{
if (_tcscmp(ds_node->ds.swzName, p) == 0)
break;
-
+
ds_node = ds_node->next;
}
@@ -706,28 +706,28 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
{
GetSubstText(hContact, ds_node->ds, swzAlt, VALUE_LEN);
}
- else
+ else
{
_tcsncpy(swzAlt, p, VALUE_LEN);
bAltSubst = true;
}
}
swzAlt[VALUE_LEN - 1] = 0;
- if (_tcslen(swzAlt) != 0)
+ if (_tcslen(swzAlt) != 0)
bAltSubst = true;
}
-
+
// get bSubst text
if (v > 4 && _tcsncmp(swzVName, _T("raw:"), 4) == 0) // raw db substitution
- {
+ {
char raw_spec[LABEL_LEN];
t2a(&swzVName[4], raw_spec, LABEL_LEN);
bSubst = GetRawSubstText(hContact, raw_spec, swzRep, VALUE_LEN);
- }
+ }
else if (v > 4 && _tcsncmp(swzVName, _T("sys:"), 4) == 0) // 'system' substitution
{
bSubst = GetSysSubstText(hContact, &swzVName[4], swzRep, VALUE_LEN);
- }
+ }
else
{
// see if we can find the bSubst
@@ -736,13 +736,13 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
{
if (_tcscmp(ds_node->ds.swzName, swzVName) == 0)
break;
-
+
ds_node = ds_node->next;
}
- if (!ds_node)
+ if (!ds_node)
goto error; // no such bSubst
-
+
bSubst = GetSubstText(hContact, ds_node->ds, swzRep, VALUE_LEN);
}
@@ -757,18 +757,18 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
size_t alt_len = _tcslen(swzAlt);
_tcsncpy(&swzDest[di], swzAlt, min(alt_len, iDestLen - di));
di += alt_len - 1; // -1 because we inc at bottom of loop
- }
+ }
else
{
goto empty; // empty value
}
- }
+ }
else // no end % - error
{
goto error;
}
- }
+ }
else
{
swzDest[di] = swzVarSrc[si];
@@ -790,7 +790,7 @@ bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFir
// check for a 'blank' string - just spaces etc
- for (si = 0; si <= di; si++)
+ for (si = 0; si <= di; si++)
{
if (swzDest[si] != 0 && swzDest[si] != _T(' ') && swzDest[si] != _T('\t') && swzDest[si] != _T('\r') && swzDest[si] != _T('\n'))
return true;
@@ -809,21 +809,21 @@ error:
return true;
}
-bool GetLabelText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen)
+bool GetLabelText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen)
{
return ApplySubst(hContact, di.swzLabel, false, buff, bufflen);
}
-bool GetValueText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen)
+bool GetValueText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen)
{
return ApplySubst(hContact, di.swzValue, di.bParseTipperVarsFirst, buff, bufflen);
}
-void TruncateString(TCHAR *swzText)
+void TruncateString(TCHAR *swzText)
{
- if (swzText && opt.iLimitCharCount > 3)
+ if (swzText && opt.iLimitCharCount > 3)
{
- if ((int)_tcslen(swzText) > opt.iLimitCharCount)
+ if ((int)_tcslen(swzText) > opt.iLimitCharCount)
{
swzText[opt.iLimitCharCount - 3] = 0;
_tcscat(swzText, _T("..."));
@@ -831,16 +831,16 @@ void TruncateString(TCHAR *swzText)
}
}
-TCHAR *GetProtoStatusMessage(char *szProto, WORD wStatus)
+TCHAR *GetProtoStatusMessage(char *szProto, WORD wStatus)
{
- if (!szProto || wStatus == ID_STATUS_OFFLINE)
+ if (!szProto || wStatus == ID_STATUS_OFFLINE)
return NULL;
// check if protocol supports status message for status
int flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0);
if (!(flags & Proto_Status2Flag(wStatus)))
return NULL;
-
+
TCHAR *swzText = (TCHAR *)CallProtoService(szProto, PS_GETMYAWAYMSG, 0, SGMA_TCHAR);
if ((INT_PTR)swzText == CALLSERVICE_NOTFOUND)
{
@@ -866,65 +866,65 @@ TCHAR *GetProtoStatusMessage(char *szProto, WORD wStatus)
}
if (swzText && opt.bLimitMsg)
- TruncateString(swzText);
+ TruncateString(swzText);
return swzText;
}
-TCHAR *GetProtoExtraStatusTitle(char *szProto)
+TCHAR *GetProtoExtraStatusTitle(char *szProto)
{
DBVARIANT dbv;
TCHAR *swzText = NULL;
- if (!szProto)
+ if (!szProto)
return NULL;
- if (!DBGetContactSettingTString(0, szProto, "XStatusName", &dbv))
+ if (!DBGetContactSettingTString(0, szProto, "XStatusName", &dbv))
{
- if (_tcslen(dbv.ptszVal) != 0)
+ if (_tcslen(dbv.ptszVal) != 0)
swzText = mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
- }
+ }
- if (!swzText)
+ if (!swzText)
{
TCHAR buff[256];
if (EmptyXStatusToDefaultName(0, szProto, 0, buff, 256))
swzText = mir_tstrdup(buff);
- }
+ }
if (opt.bLimitMsg)
- TruncateString(swzText);
+ TruncateString(swzText);
return swzText;
}
-TCHAR *GetProtoExtraStatusMessage(char *szProto)
+TCHAR *GetProtoExtraStatusMessage(char *szProto)
{
DBVARIANT dbv;
TCHAR *swzText = NULL;
- if (!szProto)
+ if (!szProto)
return NULL;
- if (!DBGetContactSettingTString(0, szProto, "XStatusMsg", &dbv))
+ if (!DBGetContactSettingTString(0, szProto, "XStatusMsg", &dbv))
{
if (_tcslen(dbv.ptszVal) != 0)
swzText = mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
if (ServiceExists(MS_VARS_FORMATSTRING))
- {
+ {
HANDLE hContact = db_find_first();
char *proto = GetContactProto(hContact);
while(!proto)
{
hContact = db_find_next(hContact);
- if (hContact)
+ if (hContact)
{
proto = GetContactProto(hContact);
}
- else
+ else
{
hContact = NULL;
break;
@@ -932,27 +932,23 @@ TCHAR *GetProtoExtraStatusMessage(char *szProto)
}
TCHAR *tszParsed = (TCHAR *)variables_parse(swzText, NULL, hContact);
- if (tszParsed)
- {
- mir_free(swzText);
- swzText = mir_tstrdup(tszParsed);
- variables_free(tszParsed);
- }
+ if (tszParsed)
+ replaceStrT(swzText, tszParsed);
}
}
if (opt.bLimitMsg)
- TruncateString(swzText);
+ TruncateString(swzText);
return swzText;
}
-TCHAR *GetListeningTo(char *szProto)
+TCHAR *GetListeningTo(char *szProto)
{
DBVARIANT dbv;
TCHAR *swzText = NULL;
- if (!szProto)
+ if (!szProto)
return NULL;
if (!DBGetContactSettingTString(0, szProto, "ListeningTo", &dbv))
@@ -963,18 +959,18 @@ TCHAR *GetListeningTo(char *szProto)
}
if (opt.bLimitMsg)
- TruncateString(swzText);
+ TruncateString(swzText);
return swzText;
}
-TCHAR *GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szValue)
+TCHAR *GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szValue)
{
DBVARIANT dbv;
TCHAR *swzText = NULL;
char szSetting[128];
- if (!szProto)
+ if (!szProto)
return NULL;
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", szProto, szSlot, szValue);
@@ -986,22 +982,22 @@ TCHAR *GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szV
}
if (opt.bLimitMsg)
- TruncateString(swzText);
+ TruncateString(swzText);
return swzText;
}
-HICON GetJabberActivityIcon(HANDLE hContact, char *szProto)
-{
+HICON GetJabberActivityIcon(HANDLE hContact, char *szProto)
+{
DBVARIANT dbv;
HICON hIcon = NULL;
char szSetting[128];
- if (!szProto)
+ if (!szProto)
return NULL;
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", szProto, "activity", "icon");
- if (!DBGetContactSettingString(hContact, "AdvStatus", szSetting, &dbv))
+ if (!DBGetContactSettingString(hContact, "AdvStatus", szSetting, &dbv))
{
hIcon = Skin_GetIcon(dbv.pszVal);
DBFreeVariant(&dbv);
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas
index b71de66708..ce31833846 100644
--- a/plugins/Utils.pas/mirutils.pas
+++ b/plugins/Utils.pas/mirutils.pas
@@ -72,7 +72,7 @@ uses Messages,dbsettings,common,io,freeimage,syswin;
const
clGroup = 'Group';
-// Save / Load contact
+// Save / Load contact
const
opt_cproto = 'cproto';
opt_cuid = 'cuid';
@@ -194,7 +194,7 @@ begin
end;
tmp:=pointer(CallService(MS_VARS_FORMATSTRING,wparam(@tfi),0));
StrDup(result,tmp);
- CallService(MS_VARS_FREEMEMORY,wparam(tmp),0);
+ mir_free(tmp);
end
else
begin
@@ -233,7 +233,7 @@ begin
end;
tmp:=pointer(CallService(MS_VARS_FORMATSTRING,wparam(@tfi),0));
StrDupW(result,tmp);
- CallService(MS_VARS_FREEMEMORY,wparam(tmp),0);
+ mir_free(tmp);
end
else
begin
@@ -588,7 +588,7 @@ begin
gce.szText.w:=pszText;
gce.dwFlags :=GCEF_ADDTOLOG+GC_UNICODE;
gce.time :=GetCurrentTime;
-
+
CallServiceSync(MS_GC_EVENT,0,lparam(@gce));
end;
@@ -730,7 +730,7 @@ begin
if proto<>nil then
proto^:=#0;
end;
-
+
end;
// Import plugin function adaptation
diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h
index 2b74cb7d11..0428b9b969 100644
--- a/plugins/Utils/mir_buffer.h
+++ b/plugins/Utils/mir_buffer.h
@@ -530,7 +530,7 @@ static void ReplaceTemplate(Buffer<TCHAR> *out, HANDLE hContact, TCHAR *templ, T
if (tmp != NULL)
{
out->append(tmp);
- variables_free(tmp);
+ mir_free(tmp);
out->pack();
return;
}
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp
index 774b64275a..87b3925e2d 100644
--- a/plugins/Variables/src/parse_regexp.cpp
+++ b/plugins/Variables/src/parse_regexp.cpp
@@ -46,7 +46,7 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) {
return NULL;
}
pcre_extra *extra = pcre_study(ppat, 0, &err);
- int nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99);
+ int nmat = pcre_exec(ppat, extra, arg2, (int)strlen(arg2), 0, 0, offsets, 99);
mir_free(arg1);
mir_free(arg2);
if (nmat > 0) {
@@ -96,7 +96,7 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) {
return NULL;
}
pcre_extra *extra = pcre_study(ppat, 0, &err);
- int nmat = pcre_exec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99);
+ int nmat = pcre_exec(ppat, extra, arg2, (int)strlen(arg2), 0, 0, offsets, 99);
if (nmat >= 0) {
ai->flags &= ~AIF_FALSE;
}
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp
index 8b0740654d..df9eef63c4 100644
--- a/plugins/Variables/src/parse_str.cpp
+++ b/plugins/Variables/src/parse_str.cpp
@@ -199,7 +199,7 @@ static TCHAR *parseLen(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- return itot( _tcslen( ai->targv[1] ));
+ return itot((int)_tcslen( ai->targv[1] ));
}
static TCHAR *parseLineCount(ARGUMENTSINFO *ai)
@@ -462,13 +462,13 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai) {
}
move = ttoi(ai->targv[3])%_tcslen(ai->targv[1]);
display = ttoi(ai->targv[2]);
- if (display > _tcslen(ai->targv[1])) {
- display = _tcslen(ai->targv[1]);
- }
+ if (display > _tcslen(ai->targv[1]))
+ display = (unsigned)_tcslen(ai->targv[1]);
+
res = (TCHAR*)mir_alloc((2*_tcslen(ai->targv[1])+1)*sizeof(TCHAR));
- if (res == NULL) {
+ if (res == NULL)
return NULL;
- }
+
ZeroMemory(res, (2*_tcslen(ai->targv[1])+1)*sizeof(TCHAR));
_tcscpy(res, ai->targv[1]);
_tcscat(res, ai->targv[1]);
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp
index dcdc3c48c0..86c8efe983 100644
--- a/plugins/Variables/src/variables.cpp
+++ b/plugins/Variables/src/variables.cpp
@@ -24,7 +24,6 @@ static BOOL bWarningShown = FALSE; // unicode on ansi warning
/* some handles */
static HANDLE
hFormatStringService,
- hFreeMemoryService,
hRegisterVariableService,
hGetMMIService,
hShowHelpService,
@@ -492,51 +491,30 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
return res;
}
-TCHAR *formatString(FORMATINFO *fi) {
-
+TCHAR *formatString(FORMATINFO *fi)
+{
/* the service to format a given string */
- TCHAR *string, *formattedString;
-
if (fi->eCount + fi->pCount > 5000) {
fi->eCount += 1;
fi->pCount += 1;
log_debugA("Variables: Overflow protection; %d parses", fi->eCount + fi->pCount);
return NULL;
}
- if ((fi == NULL) || (fi->tszFormat == NULL)) {
- return NULL;
- }
- string = mir_tstrdup(fi->tszFormat);
- if (string == NULL) {
- return NULL;
- }
- formattedString = replaceDynVars(string, fi);
- mir_free(string);
- if (formattedString == NULL) {
+ if ((fi == NULL) || (fi->tszFormat == NULL))
return NULL;
- }
-
- return formattedString;
-}
-/*
- MS_VARS_FREEMEMORY
-*/
-static INT_PTR freeMemory(WPARAM wParam, LPARAM lParam) {
-
- if ((void*)wParam == NULL) {
- return -1;
- }
- mir_free((void*)wParam);
+ mir_ptr<TCHAR> string( mir_tstrdup(fi->tszFormat));
+ if (string == NULL)
+ return NULL;
- return 0;
+ return replaceDynVars(string, fi);
}
-int setParseOptions(struct ParseOptions *po) {
-
- if (po == NULL) {
+int setParseOptions(struct ParseOptions *po)
+{
+ if (po == NULL)
po = &gParseOpts;
- }
+
ZeroMemory(po, sizeof(struct ParseOptions));
if (!db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0)) {
po->bStripEOL = db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0);
@@ -558,7 +536,6 @@ int LoadVarModule()
setParseOptions(NULL);
hFormatStringService = CreateServiceFunction(MS_VARS_FORMATSTRING, formatStringService);
- hFreeMemoryService = CreateServiceFunction(MS_VARS_FREEMEMORY, freeMemory);
hRegisterVariableService = CreateServiceFunction(MS_VARS_REGISTERTOKEN, registerToken);
// help dialog
hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
@@ -573,7 +550,7 @@ int LoadVarModule()
hShowHelpExService = CreateServiceFunction(MS_VARS_SHOWHELPEX, showHelpExService);
Icon_Register(hInst, LPGEN("Variables"), &icon, 1);
-
+
hIconsChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED, iconsChanged);
hGetIconService = CreateServiceFunction(MS_VARS_GETSKINITEM, getSkinItemService);
@@ -600,7 +577,7 @@ int LoadVarModule()
fi.cbSize = sizeof(fi);
fi.tszFormat = db_get_tsa(NULL, MODULENAME, SETTING_STARTUPTEXT);
if (fi.tszFormat != NULL) {
- freeMemory((WPARAM)formatString(&fi), 0);
+ mir_free(formatString(&fi));
mir_free(fi.tszFormat);
}
}
@@ -616,7 +593,6 @@ int UnloadVarModule() {
UnhookEvent(hIconsChangedHook);
DestroyServiceFunction(hRegisterVariableService);
- DestroyServiceFunction(hFreeMemoryService);
DestroyServiceFunction(hFormatStringService);
DestroyServiceFunction(hGetMMIService);
DestroyServiceFunction(hShowHelpService);
diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h
index 2029c5d848..3030b41f2e 100644
--- a/plugins/Variables/src/variables.h
+++ b/plugins/Variables/src/variables.h
@@ -17,6 +17,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _CRT_NON_CONFORMING_SWPRINTFS
+#define _CRT_SECURE_NO_WARNINGS
+
#include <tchar.h>
#include <malloc.h>