summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-30 16:17:46 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-30 16:17:46 +0000
commit7dad3543a2b848f6547b291f812c9643dc0b85f2 (patch)
tree1054ad62ecba19750bb4531f34e9d033ac1b7244 /plugins
parent008fe34954b0bda8fd3487a9658c14581ecd813a (diff)
Variables moved to mir_* memory allocation routines
git-svn-id: http://svn.miranda-ng.org/main/trunk@696 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ExternalAPI/m_variables.h18
-rw-r--r--plugins/Import/mirabilis.cpp2
-rw-r--r--plugins/Import/miranda.cpp10
-rw-r--r--plugins/SeenPlugin/utils.cpp2
-rw-r--r--plugins/TabSRMM/chat/tools.cpp2
-rw-r--r--plugins/Variables/action_variables.cpp20
-rw-r--r--plugins/Variables/condition_variables.cpp6
-rw-r--r--plugins/Variables/contact.cpp40
-rw-r--r--plugins/Variables/contact.h2
-rw-r--r--plugins/Variables/enumprocs.cpp2
-rw-r--r--plugins/Variables/enumprocs.h2
-rw-r--r--plugins/Variables/help.cpp110
-rw-r--r--plugins/Variables/lookup3.cpp4
-rw-r--r--plugins/Variables/main.cpp2
-rw-r--r--plugins/Variables/options.cpp10
-rw-r--r--plugins/Variables/parse_alias.cpp38
-rw-r--r--plugins/Variables/parse_alias.h2
-rw-r--r--plugins/Variables/parse_external.cpp46
-rw-r--r--plugins/Variables/parse_external.h2
-rw-r--r--plugins/Variables/parse_inet.cpp18
-rw-r--r--plugins/Variables/parse_inet.h2
-rw-r--r--plugins/Variables/parse_logic.cpp42
-rw-r--r--plugins/Variables/parse_logic.h2
-rw-r--r--plugins/Variables/parse_math.cpp8
-rw-r--r--plugins/Variables/parse_math.h2
-rw-r--r--plugins/Variables/parse_metacontacts.cpp32
-rw-r--r--plugins/Variables/parse_metacontacts.h2
-rw-r--r--plugins/Variables/parse_miranda.cpp141
-rw-r--r--plugins/Variables/parse_miranda.h2
-rw-r--r--plugins/Variables/parse_regexp.cpp56
-rw-r--r--plugins/Variables/parse_regexp.h2
-rw-r--r--plugins/Variables/parse_str.cpp84
-rw-r--r--plugins/Variables/parse_str.h2
-rw-r--r--plugins/Variables/parse_system.cpp54
-rw-r--r--plugins/Variables/parse_system.h2
-rw-r--r--plugins/Variables/parse_variables.cpp20
-rw-r--r--plugins/Variables/parse_variables.h2
-rw-r--r--plugins/Variables/parse_xml.cpp26
-rw-r--r--plugins/Variables/tokenregister.cpp77
-rw-r--r--plugins/Variables/trigger_variables.cpp12
-rw-r--r--plugins/Variables/trigger_variables.h2
-rw-r--r--plugins/Variables/variables.cpp30
-rw-r--r--plugins/Variables/variables.h4
-rw-r--r--plugins/helpers/db_helpers.cpp8
-rw-r--r--plugins/helpers/gen_helpers.cpp88
45 files changed, 491 insertions, 549 deletions
diff --git a/plugins/ExternalAPI/m_variables.h b/plugins/ExternalAPI/m_variables.h
index 77571f5522..52c3081d08 100644
--- a/plugins/ExternalAPI/m_variables.h
+++ b/plugins/ExternalAPI/m_variables.h
@@ -21,15 +21,19 @@
#define __M_VARS
#if !defined(_TCHAR_DEFINED)
-#include <tchar.h>
+ #include <tchar.h>
+#endif
+
+#if !defined(M_CORE_H__)
+ #include <m_core.h>
#endif
#ifndef VARIABLES_NOHELPER
-#include <m_button.h>
+ #include <m_button.h>
#endif
#ifndef SIZEOF
-#include <win2k.h>
+ #include <win2k.h>
#endif
// --------------------------------------------------------------------------
@@ -190,12 +194,12 @@ __inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText,
fi.flags |= FIF_TCHAR;
tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
if (tszParsed) {
- tszResult = _tcsdup(tszParsed);
+ tszResult = mir_tstrdup(tszParsed);
CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
return tszResult;
}
}
- return tszFormat?_tcsdup(tszFormat):tszFormat;
+ return tszFormat?mir_tstrdup(tszFormat):tszFormat;
}
__inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact,
@@ -215,12 +219,12 @@ __inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraTe
fi.cbTemporaryVarsSize = cbTemporaryVarsSize;
tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
if (tszParsed) {
- tszResult = _tcsdup(tszParsed);
+ tszResult = mir_tstrdup(tszParsed);
CallService(MS_VARS_FREEMEMORY, (WPARAM)tszParsed, 0);
return tszResult;
}
}
- return tszFormat?_tcsdup(tszFormat):tszFormat;
+ return tszFormat?mir_tstrdup(tszFormat):tszFormat;
}
#endif
diff --git a/plugins/Import/mirabilis.cpp b/plugins/Import/mirabilis.cpp
index 1f032827af..3b6bbeeb6e 100644
--- a/plugins/Import/mirabilis.cpp
+++ b/plugins/Import/mirabilis.cpp
@@ -1056,7 +1056,7 @@ BOOL ImportExtendedMessage(DWORD dwOffset)
// Convert timestamp
dbei.timestamp = footer->timestamp + nUCTOffset;
dbei.cbBlob = wLength;
- dbei.pBlob = (PBYTE)calloc(wLength,1);
+ dbei.pBlob = (PBYTE)mir_calloc(wLength,1);
CopyMemory(dbei.pBlob, pszText, dbei.cbBlob);
dbei.pBlob[dbei.cbBlob - 1] = 0;
diff --git a/plugins/Import/miranda.cpp b/plugins/Import/miranda.cpp
index e83eaae869..220f902467 100644
--- a/plugins/Import/miranda.cpp
+++ b/plugins/Import/miranda.cpp
@@ -478,7 +478,7 @@ struct DBHeader* GetHeader(HANDLE hDbFile)
struct DBHeader* pdbHeader;
DWORD dwBytesRead;
- if (( pdbHeader = (DBHeader*)calloc(1, sizeof(struct DBHeader))) == NULL )
+ if (( pdbHeader = (DBHeader*)mir_calloc(1, sizeof(struct DBHeader))) == NULL )
return NULL;
// Goto start of file
@@ -675,7 +675,7 @@ BOOL GetSettingsGroup(HANDLE hDbFile, DWORD dwOffset, struct DBContactSettings**
// ** Read the struct and the following blob
dwBlobSize = pSettings.cbBlob;
- if (!(*pDbSettings = (DBContactSettings *)calloc(1, sizeof(struct DBContactSettings) + dwBlobSize)))
+ if (!(*pDbSettings = (DBContactSettings *)mir_calloc(1, sizeof(struct DBContactSettings) + dwBlobSize)))
return FALSE;
memcpy(*pDbSettings, &pSettings, dwHead );
@@ -772,7 +772,7 @@ int GetSettingValue(char* pBlob, DBVARIANT* dbv)
{
#ifdef _LOGGING
{
- char* pszName = calloc((*pBlob)+1, 1);
+ char* pszName = mir_calloc((*pBlob)+1, 1);
memcpy(pszName, pBlob+1, *pBlob);
AddMessage( LPGEN("Getting type %u value for setting: %s"), (BYTE)*(pBlob+(*pBlob)+1), pszName );
free(pszName);
@@ -800,7 +800,7 @@ int GetSettingValue(char* pBlob, DBVARIANT* dbv)
case DBVT_ASCIIZ:
case DBVT_UTF8:
dbv->cchVal = *(WORD*)pBlob;
- dbv->pszVal = (char *)calloc( dbv->cchVal+1, sizeof( char ));
+ dbv->pszVal = (char *)mir_calloc( dbv->cchVal+1, sizeof( char ));
memcpy( dbv->pszVal, pBlob+2, dbv->cchVal );
dbv->pszVal[ dbv->cchVal ] = 0;
return TRUE;
@@ -808,7 +808,7 @@ int GetSettingValue(char* pBlob, DBVARIANT* dbv)
case DBVTF_VARIABLELENGTH:
case DBVT_BLOB:
dbv->cpbVal = *(WORD*)pBlob;
- dbv->pbVal = (BYTE *)calloc( dbv->cpbVal+1, sizeof( char ));
+ dbv->pbVal = (BYTE *)mir_calloc( dbv->cpbVal+1, sizeof( char ));
memcpy( dbv->pbVal, pBlob+2, dbv->cpbVal );
dbv->pbVal[ dbv->cpbVal ] = 0;
return TRUE;
diff --git a/plugins/SeenPlugin/utils.cpp b/plugins/SeenPlugin/utils.cpp
index 533882977e..33cb50bc37 100644
--- a/plugins/SeenPlugin/utils.cpp
+++ b/plugins/SeenPlugin/utils.cpp
@@ -615,8 +615,6 @@ static DWORD __stdcall waitThread(logthread_info* infoParam)
return 0;
}
-
-
int UpdateValues(WPARAM wparam,LPARAM lparam)
{
DBCONTACTWRITESETTING *cws;
diff --git a/plugins/TabSRMM/chat/tools.cpp b/plugins/TabSRMM/chat/tools.cpp
index f9b0bb786c..ed66bed5da 100644
--- a/plugins/TabSRMM/chat/tools.cpp
+++ b/plugins/TabSRMM/chat/tools.cpp
@@ -536,7 +536,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh
if (gce == 0 || si == 0 || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
- params = (FLASH_PARAMS*)calloc(1, sizeof(FLASH_PARAMS));
+ params = (FLASH_PARAMS*)mir_calloc(1, sizeof(FLASH_PARAMS));
params->hContact = si->hContact;
params->bInactive = TRUE;
if (si->hWnd && si->dat) {
diff --git a/plugins/Variables/action_variables.cpp b/plugins/Variables/action_variables.cpp
index c981400410..541b592fd4 100644
--- a/plugins/Variables/action_variables.cpp
+++ b/plugins/Variables/action_variables.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -34,15 +34,15 @@ static void parseStringThread(void *arg) {
tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)fi, 0);
log_debugA("parseStringThread: %s > %s", fi->tszFormat, tszParsed);
if (tszParsed != NULL) {
- free(tszParsed);
+ mir_free(tszParsed);
}
if (fi->tszFormat != NULL) {
- free(fi->tszFormat);
+ mir_free(fi->tszFormat);
}
if (fi->tszExtraText != NULL) {
- free(fi->tszExtraText);
+ mir_free(fi->tszExtraText);
}
- free(fi);
+ mir_free(fi);
}
@@ -55,18 +55,18 @@ int ParseStringAction(DWORD actionID, REPORTINFO *ri) {
if (DBGetActionSettingByte(actionID, NULL, MODULENAME, SETTING_PARSEASYNC, 0)) {
FORMATINFO *fi;
- fi = ( FORMATINFO* )malloc(sizeof(FORMATINFO));
+ fi = ( FORMATINFO* )mir_alloc(sizeof(FORMATINFO));
ZeroMemory(fi, sizeof(FORMATINFO));
fi->cbSize = sizeof(FORMATINFO);
- fi->tszFormat = _tcsdup(dbv.ptszVal);
- fi->tszExtraText = ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?_tcsdup(ri->td->tszText):NULL;
+ fi->tszFormat = mir_tstrdup(dbv.ptszVal);
+ fi->tszExtraText = ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?mir_tstrdup(ri->td->tszText):NULL;
fi->hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL;
fi->flags |= FIF_TCHAR;
//forkthread(parseStringThread, 0, fi);
mir_forkthread(parseStringThread, fi);
}
else {
- free(variables_parsedup(dbv.ptszVal, ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?ri->td->tszText:NULL, ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL));
+ mir_free(variables_parsedup(dbv.ptszVal, ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?ri->td->tszText:NULL, ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL));
}
DBFreeVariant(&dbv);
}
@@ -146,7 +146,7 @@ INT_PTR CALLBACK DlgProcOptsParseString(HWND hwndDlg, UINT msg, WPARAM wParam, L
tszText = Hlp_GetDlgItemText(hwndDlg, IDC_PARSESTRING);
if (tszText != NULL) {
DBWriteActionSettingTString(actionID, NULL, MODULENAME, SETTING_PARSESTRING, tszText);
- free(tszText);
+ mir_free(tszText);
}
DBWriteActionSettingByte(actionID, NULL, MODULENAME, SETTING_PARSEASYNC, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PARSEASYNC));
break;
diff --git a/plugins/Variables/condition_variables.cpp b/plugins/Variables/condition_variables.cpp
index 6e6739f112..b252a78f8f 100644
--- a/plugins/Variables/condition_variables.cpp
+++ b/plugins/Variables/condition_variables.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -39,7 +39,7 @@ int ParseStringCondition(DWORD conditionID, REPORTINFO *ri) {
fi.tszExtraText = ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?ri->td->tszText:NULL;
fi.hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL;
fi.flags |= FIF_TCHAR;
- free((TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0));
+ mir_free((TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0));
log_debugA("err: %d", fi.eCount);
res = fi.eCount==0?CRV_TRUE:CRV_FALSE;
DBFreeVariant(&dbv);
@@ -116,7 +116,7 @@ INT_PTR CALLBACK DlgProcOptsCondition(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
tszText = Hlp_GetDlgItemText(hwndDlg, IDC_PARSESTRING);
if (tszText != NULL) {
DBWriteConditionSettingTString(conditionID, NULL, MODULENAME, SETTING_PARSESTRING, tszText);
- free(tszText);
+ mir_free(tszText);
}
break;
}
diff --git a/plugins/Variables/contact.cpp b/plugins/Variables/contact.cpp
index 89ab60d72f..78c3cef67c 100644
--- a/plugins/Variables/contact.cpp
+++ b/plugins/Variables/contact.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -131,7 +131,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return NULL;
if ( type & CNF_UNICODE )
- return (TCHAR *)mir_a2u(szProto);
+ return (TCHAR *)mir_a2t(szProto);
return (TCHAR *)mir_strdup(szProto);
case CCNF_ACCOUNT:
@@ -155,7 +155,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return NULL;
if ( type & CNF_UNICODE )
- return (TCHAR *)mir_a2u(protoname);
+ return (TCHAR *)mir_a2t(protoname);
return (TCHAR *)mir_strdup(protoname);
@@ -200,14 +200,14 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return NULL;
if ( type & CNF_UNICODE )
- return (TCHAR *)mir_a2u(dotted);
+ return (TCHAR *)mir_a2t(dotted);
return (TCHAR *)mir_strdup(dotted);
}
case CCNF_GROUP:
if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
if ( type & CNF_UNICODE )
- res = (TCHAR *)mir_a2u(dbv.pszVal);
+ res = (TCHAR *)mir_a2t(dbv.pszVal);
else
res = (TCHAR *)mir_strdup(dbv.pszVal);
@@ -258,7 +258,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
if (type & CNF_UNICODE) {
TCHAR *ptszVal;
- ptszVal = (TCHAR *)mir_a2u((char *)ci.pszVal);
+ ptszVal = (TCHAR *)mir_a2t((char *)ci.pszVal);
mir_free(ci.pszVal);
return ptszVal;
}
@@ -276,7 +276,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
szVal[0] = (char)ci.bVal;
if ( type & CNF_UNICODE )
- return (TCHAR *)a2u(szVal);
+ return (TCHAR *)mir_a2t(szVal);
return (TCHAR *)mir_strdup(szVal);
case CNFT_WORD:
@@ -333,9 +333,9 @@ int getContactFromString( CONTACTSINFO* ci )
}
else {
- WCHAR* tmp = a2u(ci->szContact);
+ WCHAR* tmp = mir_a2t(ci->szContact);
tszContact = NEWTSTR_ALLOCA(tmp);
- free(tmp);
+ mir_free(tmp);
}
if ( (tszContact == NULL) || (_tcslen(tszContact) == 0))
@@ -348,7 +348,7 @@ int getContactFromString( CONTACTSINFO* ci )
for (i=0;i<cacheSize;i++) {
if ( (!_tcscmp(cce[i].tszContact, tszContact)) && (ci->flags == cce[i].flags)) {
/* found in cache */
- ci->hContacts = ( HANDLE* )malloc(sizeof(HANDLE));
+ ci->hContacts = ( HANDLE* )mir_alloc(sizeof(HANDLE));
if (ci->hContacts == NULL) {
LeaveCriticalSection(&csContactCache);
return -1;
@@ -395,20 +395,20 @@ int getContactFromString( CONTACTSINFO* ci )
}
else
{
- szFind = ( TCHAR* )malloc((_tcslen(cInfo) + strlen(szProto) + 4)*sizeof(TCHAR));
+ szFind = ( TCHAR* )mir_alloc((_tcslen(cInfo) + strlen(szProto) + 4)*sizeof(TCHAR));
if (szFind != NULL)
{
- tszProto = a2u(szProto);
+ tszProto = mir_a2t(szProto);
if ( (tszProto != NULL) && (szFind != NULL))
{
wsprintf(szFind, _T("<%s:%s>"), tszProto, cInfo);
mir_free(cInfo);
- free(tszProto);
+ mir_free(tszProto);
if (!_tcsncmp(tszContact, szFind, _tcslen(tszContact)))
bMatch = TRUE;
- free(szFind);
+ mir_free(szFind);
}
}
}
@@ -505,7 +505,7 @@ int getContactFromString( CONTACTSINFO* ci )
cce[cacheSize].hContact = ci->hContacts[0];
cce[cacheSize].flags = ci->flags;
- cce[cacheSize].tszContact = _tcsdup(tszContact);
+ cce[cacheSize].tszContact = mir_tstrdup(tszContact);
if (cce[cacheSize].tszContact != NULL)
cacheSize += 1;
@@ -543,14 +543,14 @@ static int contactSettingChanged(WPARAM wParam, LPARAM lParam)
(( ((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != NULL)) && (!strcmp(dbw->szSetting, uid)) && (cce[i].flags & CI_UNIQUEID)))
{
/* remove from cache */
- free(cce[i].tszContact);
+ mir_free(cce[i].tszContact);
if (cacheSize > 1) {
MoveMemory(&cce[i], &cce[cacheSize-1], sizeof(CONTACTCE));
cce = ( CONTACTCE* )realloc(cce, (cacheSize-1)*sizeof(CONTACTCE));
cacheSize -= 1;
}
else {
- free(cce);
+ mir_free(cce);
cce = NULL;
cacheSize = 0;
}
@@ -600,7 +600,7 @@ TCHAR *encodeContactToString(HANDLE hContact)
if (tszResult == NULL)
return NULL;
- tszProto = mir_a2u(szProto);
+ tszProto = mir_a2t(szProto);
if (tszProto == NULL)
return NULL;
@@ -628,13 +628,13 @@ HANDLE *decodeContactFromString(TCHAR *tszContact)
count = getContactFromString( &ci );
if (count != 1) {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return ( HANDLE* )hContact;
}
if (ci.hContacts != NULL) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
return ( HANDLE* )hContact;
diff --git a/plugins/Variables/contact.h b/plugins/Variables/contact.h
index ecb2e32525..7d980801f3 100644
--- a/plugins/Variables/contact.h
+++ b/plugins/Variables/contact.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/enumprocs.cpp b/plugins/Variables/enumprocs.cpp
index 8f0de1aa8b..5b4bb7922b 100644
--- a/plugins/Variables/enumprocs.cpp
+++ b/plugins/Variables/enumprocs.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/enumprocs.h b/plugins/Variables/enumprocs.h
index 7f7f085520..118c40b67c 100644
--- a/plugins/Variables/enumprocs.h
+++ b/plugins/Variables/enumprocs.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/help.cpp b/plugins/Variables/help.cpp
index 569fcaf7b2..0f214bdcea 100644
--- a/plugins/Variables/help.cpp
+++ b/plugins/Variables/help.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -160,7 +160,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if (tszContact != NULL) {
hContact = decodeContactFromString(tszContact);
log_debugA("VARM_SETSUBJECT decoded: %u", hContact);
- free(tszContact);
+ mir_free(tszContact);
} }
if ( (hContact != INVALID_HANDLE_VALUE) && (hContact != NULL))
@@ -240,7 +240,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
TCHAR *tszContact = encodeContactToString(hContact);
if (tszContact != NULL) {
db_sets(SETTING_SUBJECT, tszContact);
- free(tszContact);
+ mir_free(tszContact);
} } }
break;
}
@@ -259,7 +259,7 @@ static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) {
return NULL;
}
cat = NULL;
- helpText = _strdup(tr->szHelpText);
+ helpText = mir_strdup(tr->szHelpText);
if (helpText == NULL) {
return NULL;
}
@@ -269,16 +269,16 @@ static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) {
*cur = _T('\0');
helpText = ( char* )realloc(helpText, strlen(helpText)+1);
- res = a2u(helpText);
- free(helpText);
+ res = mir_a2t(helpText);
+ mir_free(helpText);
return res;
}
cur++;
}
- res = a2u(helpText);
- free(helpText);
+ res = mir_a2t(helpText);
+ mir_free(helpText);
return res;
}
@@ -292,16 +292,16 @@ static TCHAR *getHelpDescription(TOKENREGISTEREX *tr)
while (cur > tr->szHelpText) {
if (*cur == _T('\t')) {
- cur = _strdup(cur+1);
- TCHAR *res = a2u(cur);
- free(cur);
+ cur = mir_strdup(cur+1);
+ TCHAR *res = mir_a2t(cur);
+ mir_free(cur);
return res;
}
cur--;
}
- return a2u(tr->szHelpText);
+ return mir_a2t(tr->szHelpText);
}
@@ -317,9 +317,9 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
args = NULL;
tArgs = NULL;
if (tr->szHelpText == NULL)
- return _tcsdup(tr->tszTokenString);
+ return mir_tstrdup(tr->tszTokenString);
- helpText = _strdup(tr->szHelpText);
+ helpText = mir_strdup(tr->szHelpText);
if (helpText == NULL)
return NULL;
@@ -342,7 +342,7 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
else args = NULL;
len = _tcslen(tr->tszTokenString) + (args!=NULL?strlen(args):0) + 3;
- desc = ( TCHAR* )calloc(len, sizeof(TCHAR));
+ desc = ( TCHAR* )mir_calloc(len * sizeof(TCHAR));
if (desc == NULL)
return NULL;
@@ -351,15 +351,15 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
else {
if (args != NULL)
- tArgs = a2u(args);
+ tArgs = mir_a2t(args);
mir_sntprintf(desc, len, _T("%c%s%s"), _T(FUNC_CHAR), tr->tszTokenString, (tArgs!=NULL?tArgs:_T("")));
}
if (tArgs != NULL)
- free(tArgs);
+ mir_free(tArgs);
if (helpText != NULL)
- free(helpText);
+ mir_free(helpText);
return desc;
}
@@ -380,8 +380,8 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM lPar
cat2 = getTokenCategory(tr2);
if ( cat1 != NULL && cat2 != NULL ) {
res = _tcscmp(cat1, cat2);
- free(cat1);
- free(cat2);
+ mir_free(cat1);
+ mir_free(cat2);
cat1 = cat2 = NULL;
if (res != 0)
return res;
@@ -393,10 +393,10 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM lPar
}
if (cat1 != NULL)
- free(cat1);
+ mir_free(cat1);
if (cat2 != NULL)
- free(cat2);
+ mir_free(cat2);
return 0;
}
@@ -439,7 +439,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
}
else if (hdd->vhs->szSubjectDesc != NULL) {
- tszHelpDesc = a2u(hdd->vhs->szSubjectDesc);
+ tszHelpDesc = mir_a2t(hdd->vhs->szSubjectDesc);
}
}
@@ -449,7 +449,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
}
else if (hdd->vhs->szExtraTextDesc != NULL) {
- tszHelpDesc = a2u(hdd->vhs->szExtraTextDesc);
+ tszHelpDesc = mir_a2t(hdd->vhs->szExtraTextDesc);
}
}
@@ -465,19 +465,19 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
}
lvItem.pszText = tszTokenDesc;
ListView_InsertItem(hList, &lvItem);
- free(tszTokenDesc);
+ mir_free(tszTokenDesc);
lvItem.mask = LVIF_TEXT;
if (tszHelpDesc == NULL) {
tszHelpDesc = getHelpDescription(tr);
}
if (tszHelpDesc == NULL) {
- tszHelpDesc = _tcsdup(_T("unknown"));
+ tszHelpDesc = mir_tstrdup(_T("unknown"));
}
lvItem.iSubItem = 1;
lvItem.pszText = TranslateTS(tszHelpDesc);
ListView_SetItem(hList, &lvItem);
- free(tszHelpDesc);
+ mir_free(tszHelpDesc);
} while (tr != NULL);
ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hList, 1, LVSCW_AUTOSIZE);
@@ -492,8 +492,8 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
}
cat = getTokenCategory((TOKENREGISTEREX *)lvItem.lParam);
if (cat != NULL) {
- text = _tcsdup(TranslateTS(cat));
- free(cat);
+ text = mir_tstrdup(TranslateTS(cat));
+ mir_free(cat);
}
else {
text = NULL;
@@ -503,7 +503,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
lvItem.pszText = text;
ListView_InsertItem(hList, &lvItem);
if (last != NULL) {
- free(last);
+ mir_free(last);
lvItem.iSubItem = 0;
lvItem.pszText = _T("");
ListView_InsertItem(hList, &lvItem);
@@ -511,11 +511,11 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
last = text;
}
else {
- free(text);
+ mir_free(text);
}
}
if (last != NULL) {
- free(last);
+ mir_free(last);
}
break;
}
@@ -549,14 +549,14 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
if (len < 0) {
break;
}
- tokenString = ( TCHAR* )malloc((len+1)*sizeof(TCHAR));
+ tokenString = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
if (tokenString == NULL) {
break;
}
ZeroMemory(tokenString, (len+1)*sizeof(TCHAR));
wsprintf(tokenString, _T("%c%s%c"), (tr->flags&TRF_FIELD?_T(FIELD_CHAR):_T(FUNC_CHAR)), tr->tszTokenString, (tr->flags&TRF_FIELD?_T(FIELD_CHAR):_T('(')));
SendDlgItemMessage(hwndInputDlg, IDC_TESTSTRING, EM_REPLACESEL, (WPARAM)TRUE, (LPARAM)tokenString);
- free(tokenString);
+ mir_free(tokenString);
SetFocus(GetDlgItem(hwndInputDlg, IDC_TESTSTRING));
}
break;
@@ -673,7 +673,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- dat = ( INPUTDLGDATA* )malloc(sizeof(INPUTDLGDATA));
+ dat = ( INPUTDLGDATA* )mir_alloc(sizeof(INPUTDLGDATA));
ZeroMemory(dat, sizeof(INPUTDLGDATA));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
// splitter things
@@ -775,7 +775,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
TCHAR *string = Hlp_GetDlgItemText(hwndDlg, IDC_TESTSTRING), *extraText;
int len = SendMessage(GetParent(hwndDlg), VARM_GETEXTRATEXTLENGTH, 0, 0);
if (len > 0) {
- extraText = ( TCHAR* )calloc((len+1), sizeof(TCHAR));
+ extraText = ( TCHAR* )mir_calloc((len+1)* sizeof(TCHAR));
SendMessage(GetParent(hwndDlg), VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)extraText);
}
else extraText = NULL;
@@ -787,11 +787,11 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if ( oldString == NULL || _tcscmp(oldString, newString))
SetWindowText(GetDlgItem(hwndDlg, IDC_RESULT), newString);
- free(newString);
+ mir_free(newString);
if (oldString != NULL)
- free(oldString);
+ mir_free(oldString);
}
- free(string);
+ mir_free(string);
} }
break;
@@ -819,7 +819,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
db_setd(SETTING_SPLITTERPOS, dat->splitterPos);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_SPLITTER), GWLP_WNDPROC, (LONG_PTR) OldSplitterProc);
if (dat != NULL) {
- free(dat);
+ mir_free(dat);
dat = NULL;
}
break;
@@ -902,7 +902,7 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
hwndHelpDialog = hwndDlg;
TranslateDialogDefault(hwndDlg);
- dat = ( HELPDLGDATA* )malloc(sizeof(HELPDLGDATA));
+ dat = ( HELPDLGDATA* )mir_alloc(sizeof(HELPDLGDATA));
ZeroMemory(dat, sizeof(HELPDLGDATA));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
dat->vhs = (VARHELPINFO *)lParam;
@@ -945,9 +945,9 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)dat->vhs->fi->tszFormat);
else {
- WCHAR *wszFormatString = a2u(dat->vhs->fi->szFormat);
+ WCHAR *wszFormatString = mir_a2t(dat->vhs->fi->szFormat);
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)wszFormatString);
- free(wszFormatString);
+ mir_free(wszFormatString);
}
}
@@ -957,7 +957,7 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
tszText = Hlp_GetWindowText(dat->vhs->hwndCtrl);
if ( tszText != NULL ) {
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)tszText);
- free(tszText);
+ mir_free(tszText);
}
}
if ( dat->vhs->fi != NULL || dat->vhs->hwndCtrl != NULL ) {
@@ -1004,9 +1004,9 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)dat->vhs->fi->tszExtraText);
else {
- WCHAR *wszSource = a2u(dat->vhs->fi->szExtraText);
+ WCHAR *wszSource = mir_a2t(dat->vhs->fi->szExtraText);
SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)wszSource);
- free(wszSource);
+ mir_free(wszSource);
}
}
@@ -1048,11 +1048,11 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) {
if (dat->vhs->fi->flags&FIF_UNICODE) {
- dat->vhs->fi->tszFormat = ( TCHAR* )calloc((len+1), sizeof(WCHAR));
+ dat->vhs->fi->tszFormat = ( TCHAR* )mir_calloc((len+1)*sizeof(WCHAR));
SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->tszFormat);
}
else {
- dat->vhs->fi->szFormat = ( char* )calloc(len+1, 1);
+ dat->vhs->fi->szFormat = ( char* )mir_calloc(len+1);
SendMessageA(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szFormat);
}
}
@@ -1067,11 +1067,11 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if (len > 0) {
TCHAR *tszText;
- tszText = ( TCHAR* )calloc((len+1), sizeof(TCHAR));
+ tszText = ( TCHAR* )mir_calloc((len+1)*sizeof(TCHAR));
if (tszText != NULL) {
SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)tszText);
SetWindowText(dat->vhs->hwndCtrl, tszText);
- free(tszText);
+ mir_free(tszText);
}
}
SendMessage(GetParent(dat->vhs->hwndCtrl),
@@ -1088,11 +1088,11 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if (len > 0) {
if (dat->vhs->fi->flags&FIF_UNICODE) {
- dat->vhs->fi->tszExtraText = ( TCHAR* )calloc((len+1), sizeof(WCHAR));
+ dat->vhs->fi->tszExtraText = ( TCHAR* )mir_calloc((len+1)*sizeof(WCHAR));
SendMessage(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->tszExtraText);
}
else {
- dat->vhs->fi->szExtraText = ( char* )calloc(len+1, 1);
+ dat->vhs->fi->szExtraText = ( char* )mir_calloc(len+1);
SendMessageA(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szExtraText);
}
@@ -1263,7 +1263,7 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if (IsWindow(dat->hwndExtraTextDlg))
DestroyWindow(dat->hwndExtraTextDlg);
- free(dat);
+ mir_free(dat);
dat = NULL;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)NULL);
break;
@@ -1298,13 +1298,13 @@ INT_PTR showHelpService(WPARAM wParam, LPARAM lParam)
static FORMATINFO *fi = NULL;
if (fi == NULL)
- fi = ( FORMATINFO* )malloc(sizeof(FORMATINFO));
+ fi = ( FORMATINFO* )mir_alloc(sizeof(FORMATINFO));
ZeroMemory(fi, sizeof(FORMATINFO));
fi->cbSize = sizeof(FORMATINFO);
fi->szFormat = (char *)lParam;
if (vhs == NULL)
- vhs = ( VARHELPINFO* )malloc(sizeof(VARHELPINFO));
+ vhs = ( VARHELPINFO* )mir_alloc(sizeof(VARHELPINFO));
ZeroMemory(vhs, sizeof(VARHELPINFO));
vhs->cbSize = sizeof(VARHELPINFO);
diff --git a/plugins/Variables/lookup3.cpp b/plugins/Variables/lookup3.cpp
index b2a91634cf..f2c930950c 100644
--- a/plugins/Variables/lookup3.cpp
+++ b/plugins/Variables/lookup3.cpp
@@ -4,7 +4,7 @@ lookup3.c, by Bob Jenkins, May 2006, Public Domain.
These are functions for producing 32-bit hashes for hash table lookup.
hashword(), hashlittle(), hashbig(), mix(), and final() are externally
useful functions. Routines to test the hash are included if SELF_TEST
-is defined. You can use this free for any purpose. It has no warranty.
+is defined. You can use this mir_free for any purpose. It has no warranty.
You probably want to use hashlittle(). hashlittle() and hashbig()
hash byte arrays. hashlittle() is is faster than hashbig() on
@@ -210,7 +210,7 @@ If you are hashing n strings (uint8 **)k, do it like this:
for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this
-code any way you wish, private, educational, or commercial. It's free.
+code any way you wish, private, educational, or commercial. It's mir_free.
Use for hash table lookup, or anything where one collision in 2^^32 is
acceptable. Do NOT use for cryptographic purposes.
diff --git a/plugins/Variables/main.cpp b/plugins/Variables/main.cpp
index 880d5e8cd6..4d47d84439 100644
--- a/plugins/Variables/main.cpp
+++ b/plugins/Variables/main.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/options.cpp b/plugins/Variables/options.cpp
index 6140bc79dd..22743d0ab5 100644
--- a/plugins/Variables/options.cpp
+++ b/plugins/Variables/options.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -88,14 +88,14 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int len = SendDlgItemMessage(hwndDlg, IDC_FORMATTEXT, WM_GETTEXTLENGTH, 0, 0);
if (len >= 0) {
- TCHAR *szFormatText = ( TCHAR* )calloc((len+1), sizeof(TCHAR));
+ TCHAR *szFormatText = ( TCHAR* )mir_calloc((len+1)* sizeof(TCHAR));
if (szFormatText == NULL)
break;
if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len+1) != 0)
db_sets(SETTING_STARTUPTEXT, szFormatText);
- free(szFormatText);
+ mir_free(szFormatText);
}
db_setb(SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP)?1:0));
db_setb(SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF)?1:0));
@@ -111,9 +111,9 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
TCHAR *newString = variables_parsedup(string, NULL, NULL);
if (newString != NULL) {
SetWindowText(GetDlgItem(hwndDlg, IDC_RESULT), newString);
- free(newString);
+ mir_free(newString);
}
- free(string);
+ mir_free(string);
} }
break;
diff --git a/plugins/Variables/parse_alias.cpp b/plugins/Variables/parse_alias.cpp
index 2fe4164d15..9c44a2f915 100644
--- a/plugins/Variables/parse_alias.cpp
+++ b/plugins/Variables/parse_alias.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -86,7 +86,7 @@ static TCHAR *parseTranslateAlias(ARGUMENTSINFO *ai) {
if ( (areg == NULL) || (areg->argc != ai->argc-1)) {
return NULL;
}
- res = _tcsdup(areg->szTranslation);
+ res = mir_tstrdup(areg->szTranslation);
for (i=0;i<areg->argc;i++) {
res = replaceArguments(res, areg->argv[i], ai->targv[i+1]);
if (res == NULL) {
@@ -107,11 +107,11 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
EnterCriticalSection(&csAliasRegister);
for (i=0;i<arCount;i++) {
if (!_tcscmp(ar[i].szAlias, szAlias)) {
- free(ar[i].szTranslation);
- ar[i].szTranslation = _tcsdup(szTranslation);
+ mir_free(ar[i].szTranslation);
+ ar[i].szTranslation = mir_tstrdup(szTranslation);
for (j=0;j<ar[i].argc;j++) {
if (ar[i].argv[j] != NULL) {
- free(ar[i].argv[j]);
+ mir_free(ar[i].argv[j]);
}
}
ar[i].argc = argc;
@@ -122,7 +122,7 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
}
for (j=0;j<argc;j++) {
if (argv[j] != NULL)
- ar[i].argv[j] = _tcsdup(argv[j]);
+ ar[i].argv[j] = mir_tstrdup(argv[j]);
else
ar[i].argv[j] = NULL;
}
@@ -135,17 +135,17 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
LeaveCriticalSection(&csAliasRegister);
return -1;
}
- ar[arCount].szAlias = _tcsdup(szAlias);
- ar[arCount].szTranslation = _tcsdup(szTranslation);
+ ar[arCount].szAlias = mir_tstrdup(szAlias);
+ ar[arCount].szTranslation = mir_tstrdup(szTranslation);
ar[arCount].argc = argc;
- ar[arCount].argv = ( TCHAR** )malloc(argc * sizeof(TCHAR *));
+ ar[arCount].argv = ( TCHAR** )mir_alloc(argc * sizeof(TCHAR *));
if (ar[arCount].argv == NULL) {
LeaveCriticalSection(&csAliasRegister);
return -1;
}
for (j=0;j<ar[arCount].argc;j++) {
if (argv[j] != NULL)
- ar[arCount].argv[j] = _tcsdup(argv[j]);
+ ar[arCount].argv[j] = mir_tstrdup(argv[j]);
else
ar[arCount].argv[j] = NULL;
}
@@ -169,7 +169,7 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) {
while (isValidTokenChar(*cur))
cur++;
- alias = ( TCHAR* )calloc(((cur-ai->targv[1])+1), sizeof(TCHAR));
+ alias = ( TCHAR* )mir_calloc(((cur-ai->targv[1])+1)*sizeof(TCHAR));
if (alias == NULL)
return NULL;
@@ -180,7 +180,7 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) {
szArgs = NULL;
for (i=0;i<argc;i++) {
if (i == 0)
- szArgs = ( TCHAR* )calloc( _tcslen(argv[i])+2, sizeof(TCHAR));
+ szArgs = ( TCHAR* )mir_calloc(( _tcslen(argv[i])+2)*sizeof(TCHAR));
else
szArgs = ( TCHAR* )realloc(szArgs, (_tcslen(szArgs) + _tcslen(argv[i]) + 2)*sizeof(TCHAR));
@@ -190,24 +190,24 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) {
}
if ( (szArgs != NULL) && (argc > 0)) {
- szArgsA = u2a(szArgs);
+ szArgsA = mir_t2a(szArgs);
- szHelp = ( char* )malloc(32 + strlen(szArgsA));
+ szHelp = ( char* )mir_alloc(32 + strlen(szArgsA));
memset(szHelp, '\0', 32 + strlen(szArgsA));
sprintf(szHelp, "Alias\t(%s)\tuser defined", szArgsA);
res = registerIntToken(alias, parseTranslateAlias, TRF_FUNCTION|TRF_UNPARSEDARGS, szHelp);
- free(szArgsA);
+ mir_free(szArgsA);
}
else {
- szHelp = ( char* )malloc(32);
+ szHelp = ( char* )mir_alloc(32);
memset(szHelp, '\0', 32);
sprintf(szHelp, "Alias\t\tuser defined");
res = registerIntToken(alias, parseTranslateAlias, TRF_FIELD|TRF_UNPARSEDARGS, szHelp);
}
- free(szArgs);
- free(szHelp);
+ mir_free(szArgs);
+ mir_free(szHelp);
- return res==0?_tcsdup(_T("")):NULL;
+ return res==0?mir_tstrdup(_T("")):NULL;
}
int registerAliasTokens()
diff --git a/plugins/Variables/parse_alias.h b/plugins/Variables/parse_alias.h
index 3914988780..d868841fb8 100644
--- a/plugins/Variables/parse_alias.h
+++ b/plugins/Variables/parse_alias.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_external.cpp b/plugins/Variables/parse_external.cpp
index 65226fb0e4..fa3f25ff87 100644
--- a/plugins/Variables/parse_external.cpp
+++ b/plugins/Variables/parse_external.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -39,22 +39,22 @@ static TCHAR *getFullWinampTitleText() {
if (hwndWinamp == NULL)
return NULL;
- szWinText = ( TCHAR* )malloc((GetWindowTextLength(hwndWinamp) + 1)*sizeof(TCHAR));
+ szWinText = ( TCHAR* )mir_alloc((GetWindowTextLength(hwndWinamp) + 1)*sizeof(TCHAR));
if (szWinText == NULL)
return NULL;
if (GetWindowText(hwndWinamp, szWinText, GetWindowTextLength(hwndWinamp)+1) == 0) {
- free(szWinText);
+ mir_free(szWinText);
return NULL;
}
- szTitle = ( TCHAR* )malloc((2*_tcslen(szWinText)+1)*sizeof(TCHAR));
+ szTitle = ( TCHAR* )mir_alloc((2*_tcslen(szWinText)+1)*sizeof(TCHAR));
if (szTitle == NULL) {
- free(szWinText);
+ mir_free(szWinText);
return NULL;
}
_tcscpy(szTitle, szWinText);
_tcscpy(szTitle+_tcslen(szTitle), szWinText);
- free(szWinText);
+ mir_free(szWinText);
return szTitle;
}
@@ -74,14 +74,14 @@ static TCHAR *parseWinampSong(ARGUMENTSINFO *ai) {
scur = _tcschr(szTitle, _T('.'));
cur = _tcsstr(scur, _T(" - Winamp"));
if ( (scur == NULL) || (cur == NULL) || (scur >= cur) || (scur > (szTitle + _tcslen(szTitle) - 2)) || (cur > (szTitle + _tcslen(szTitle)))) {
- free(szTitle);
+ mir_free(szTitle);
return NULL;
}
scur++;
scur++;
*cur = '\0';
- res = _tcsdup(scur);
- free(szTitle);
+ res = mir_tstrdup(scur);
+ mir_free(szTitle);
ai->flags |= AIF_DONTPARSE;
return res;
@@ -102,19 +102,19 @@ static TCHAR *parseWinampState(ARGUMENTSINFO *ai) {
scur = _tcschr(szTitle, _T('.'));
cur = _tcsstr(scur, _T(" - Winamp"));
if ( (scur == NULL) || (cur == NULL)) {
- free(szTitle);
- return _tcsdup(TranslateT("Stopped"));
+ mir_free(szTitle);
+ return mir_tstrdup(TranslateT("Stopped"));
}
if ( (!_tcsncmp(cur+10, _T("[Stopped]"), 9))) {
- free(szTitle);
- return _tcsdup(TranslateT("Stopped"));
+ mir_free(szTitle);
+ return mir_tstrdup(TranslateT("Stopped"));
}
if ( (!_tcsncmp(cur+10, _T("[Paused]"), 8))) {
- free(szTitle);
- return _tcsdup(TranslateT("Paused"));
+ mir_free(szTitle);
+ return mir_tstrdup(TranslateT("Paused"));
}
- free(szTitle);
- return _tcsdup(_T("Playing"));
+ mir_free(szTitle);
+ return mir_tstrdup(_T("Playing"));
}
static unsigned int checkAMIP() {
@@ -154,7 +154,7 @@ static TCHAR *parseAMIPEval(ARGUMENTSINFO *ai) {
return NULL;
}
- cmd = u2a(ai->targv[1]);
+ cmd = mir_t2a(ai->targv[1]);
if (checkAMIP() != 0) {
log_debugA("checkAMIP failed");
@@ -164,13 +164,13 @@ static TCHAR *parseAMIPEval(ARGUMENTSINFO *ai) {
ZeroMemory(&szRes, sizeof(szRes));
if (AC_ERR_NOERROR == acEval(cmd, szRes)) {
- tszRes = a2u(szRes);
+ tszRes = mir_a2t(szRes);
}
else {
lastAMIPFailure = GetTickCount();
}
- free(cmd);
+ mir_free(cmd);
return tszRes;
}
@@ -186,7 +186,7 @@ static TCHAR *parseAMIPFormat(ARGUMENTSINFO *ai) {
return NULL;
}
- cmd = u2a(ai->targv[1]);
+ cmd = mir_t2a(ai->targv[1]);
if (checkAMIP() != 0) {
@@ -194,13 +194,13 @@ static TCHAR *parseAMIPFormat(ARGUMENTSINFO *ai) {
}
if (AC_ERR_NOERROR == acFormat(cmd, szRes)) {
- tszRes = a2u(szRes);
+ tszRes = mir_a2t(szRes);
}
else {
lastAMIPFailure = GetTickCount();
}
- free(cmd);
+ mir_free(cmd);
return tszRes;
}
diff --git a/plugins/Variables/parse_external.h b/plugins/Variables/parse_external.h
index ac31e429fa..201b1e26a3 100644
--- a/plugins/Variables/parse_external.h
+++ b/plugins/Variables/parse_external.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_inet.cpp b/plugins/Variables/parse_inet.cpp
index 41481e3b60..dce4fa76a4 100644
--- a/plugins/Variables/parse_inet.cpp
+++ b/plugins/Variables/parse_inet.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -30,7 +30,7 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) {
return NULL;
}
- res = u2a(ai->targv[1]);
+ res = mir_t2a(ai->targv[1]);
if (res == NULL) {
return NULL;
@@ -51,9 +51,9 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) {
cur+=strlen(hex);
}
- tres = a2u(res);
+ tres = mir_a2t(res);
- free(res);
+ mir_free(res);
return tres;
}
@@ -68,7 +68,7 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) {
return NULL;
}
- res = u2a(ai->targv[1]);
+ res = mir_t2a(ai->targv[1]);
if (res == NULL) {
return NULL;
@@ -85,9 +85,9 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) {
}
res = ( char* )realloc(res, strlen(res)+1);
- tres = a2u(res);
+ tres = mir_a2t(res);
- free(res);
+ mir_free(res);
return tres;
}
@@ -105,7 +105,7 @@ static TCHAR *parseNToA(ARGUMENTSINFO *ai) {
res = inet_ntoa(in);
if (res != NULL) {
- return a2u(res);
+ return mir_a2t(res);
}
@@ -125,7 +125,7 @@ static TCHAR *parseHToA(ARGUMENTSINFO *ai) {
res = inet_ntoa(in);
if (res != NULL) {
- return a2u(res);
+ return mir_a2t(res);
}
diff --git a/plugins/Variables/parse_inet.h b/plugins/Variables/parse_inet.h
index d9e3f23c70..8e9bf66e1b 100644
--- a/plugins/Variables/parse_inet.h
+++ b/plugins/Variables/parse_inet.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_logic.cpp b/plugins/Variables/parse_logic.cpp
index 8a7086ce37..178439a338 100644
--- a/plugins/Variables/parse_logic.cpp
+++ b/plugins/Variables/parse_logic.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -37,11 +37,11 @@ static TCHAR *parseAnd(ARGUMENTSINFO *ai) {
//if (fi.pCount <= 0) {
if (fi.eCount > 0) {
ai->flags |= AIF_FALSE;
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseFalse(ARGUMENTSINFO *ai) {
@@ -51,7 +51,7 @@ static TCHAR *parseFalse(ARGUMENTSINFO *ai) {
}
ai->flags |= AIF_FALSE;
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseIf(ARGUMENTSINFO *ai) {
@@ -70,10 +70,10 @@ static TCHAR *parseIf(ARGUMENTSINFO *ai) {
mir_free(szCondition);
//if (fi.pCount > 0) {
if (fi.eCount == 0) {
- return _tcsdup(ai->targv[2]);
+ return mir_tstrdup(ai->targv[2]);
}
else {
- return _tcsdup(ai->targv[3]);
+ return mir_tstrdup(ai->targv[3]);
}
}
@@ -99,7 +99,7 @@ static TCHAR *parseIf2(ARGUMENTSINFO *ai) {
// ai->flags |= AIF_DONTPARSE;
mir_free(szCondition);
}
- return _tcsdup(ai->targv[2]);
+ return mir_tstrdup(ai->targv[2]);
}
}
@@ -153,12 +153,12 @@ static TCHAR *parseIfequal(ARGUMENTSINFO *ai)
if ( (ttoi(tszFirst)) == (ttoi(tszSecond))) {
mir_free(tszFirst);
mir_free(tszSecond);
- return _tcsdup(ai->targv[3]);
+ return mir_tstrdup(ai->targv[3]);
}
mir_free(tszFirst);
mir_free(tszSecond);
- return _tcsdup(ai->targv[4]);
+ return mir_tstrdup(ai->targv[4]);
}
static TCHAR *parseIfgreater(ARGUMENTSINFO *ai) {
@@ -188,12 +188,12 @@ static TCHAR *parseIfgreater(ARGUMENTSINFO *ai) {
if ( (ttoi(tszFirst)) > (ttoi(tszSecond))) {
mir_free(tszFirst);
mir_free(tszSecond);
- return _tcsdup(ai->targv[3]);
+ return mir_tstrdup(ai->targv[3]);
}
mir_free(tszFirst);
mir_free(tszSecond);
- return _tcsdup(ai->targv[4]);
+ return mir_tstrdup(ai->targv[4]);
}
static TCHAR *parseIflonger(ARGUMENTSINFO *ai) {
@@ -222,12 +222,12 @@ static TCHAR *parseIflonger(ARGUMENTSINFO *ai) {
if ( _tcslen(tszFirst) > _tcslen(tszSecond)) {
mir_free(tszFirst);
mir_free(tszSecond);
- return _tcsdup(ai->targv[3]);
+ return mir_tstrdup(ai->targv[3]);
}
mir_free(tszFirst);
mir_free(tszSecond);
- return _tcsdup(ai->targv[4]);
+ return mir_tstrdup(ai->targv[4]);
}
/*
@@ -243,7 +243,7 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai) {
if (ai->argc != 5) {
return NULL;
}
- res = _tcsdup(_T(""));
+ res = mir_tstrdup(_T(""));
// ai->flags |= AIF_DONTPARSE;
ZeroMemory(&fi, sizeof(fi));
CopyMemory(&fi, ai->fi, sizeof(fi));
@@ -283,7 +283,7 @@ static TCHAR *parseEqual(ARGUMENTSINFO *ai)
if ( ttoi(ai->targv[1]) != ttoi( ai->targv[2] ))
ai->flags |= AIF_FALSE;
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseGreater(ARGUMENTSINFO *ai)
@@ -294,7 +294,7 @@ static TCHAR *parseGreater(ARGUMENTSINFO *ai)
if ( ttoi(ai->targv[1]) <= ttoi(ai->targv[2] ))
ai->flags |= AIF_FALSE;
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseLonger(ARGUMENTSINFO *ai)
@@ -305,7 +305,7 @@ static TCHAR *parseLonger(ARGUMENTSINFO *ai)
if ( _tcslen(ai->targv[1]) <= _tcslen(ai->targv[2]))
ai->flags |= AIF_FALSE;
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseNot(ARGUMENTSINFO *ai) {
@@ -326,7 +326,7 @@ static TCHAR *parseNot(ARGUMENTSINFO *ai) {
ai->flags |= AIF_FALSE;
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseOr(ARGUMENTSINFO *ai) {
@@ -352,7 +352,7 @@ static TCHAR *parseOr(ARGUMENTSINFO *ai) {
}
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseTrue(ARGUMENTSINFO *ai) {
@@ -361,7 +361,7 @@ static TCHAR *parseTrue(ARGUMENTSINFO *ai) {
return NULL;
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseXor(ARGUMENTSINFO *ai) {
@@ -388,7 +388,7 @@ static TCHAR *parseXor(ARGUMENTSINFO *ai) {
val2 = fi.eCount == 0;
ai->flags |= ((val1&AIF_FALSE)==!(val2&AIF_FALSE))?0:AIF_FALSE;
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
int registerLogicTokens() {
diff --git a/plugins/Variables/parse_logic.h b/plugins/Variables/parse_logic.h
index ae20cfd77f..774a94b670 100644
--- a/plugins/Variables/parse_logic.h
+++ b/plugins/Variables/parse_logic.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_math.cpp b/plugins/Variables/parse_math.cpp
index 1d4cb3c30a..9fefb30ee4 100644
--- a/plugins/Variables/parse_math.cpp
+++ b/plugins/Variables/parse_math.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -64,7 +64,7 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai) {
padding = ttoi(ai->targv[2]);
mir_sntprintf(szVal, SIZEOF(szVal), _T("%x"), val);
zeros = max(padding - (signed int)_tcslen(szVal), 0);
- res = ( TCHAR* )malloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -170,7 +170,7 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai) {
return NULL;
zeros = max(padding - (signed int)_tcslen(szVal), 0);
- res = ( TCHAR* )malloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -180,7 +180,7 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai) {
*cur++ = _T('0');
_tcscat(res, szVal);
- free(szVal);
+ mir_free(szVal);
return res;
}
diff --git a/plugins/Variables/parse_math.h b/plugins/Variables/parse_math.h
index 29ce847cba..f185749399 100644
--- a/plugins/Variables/parse_math.h
+++ b/plugins/Variables/parse_math.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_metacontacts.cpp b/plugins/Variables/parse_metacontacts.cpp
index c639668e05..6ffa229e9f 100644
--- a/plugins/Variables/parse_metacontacts.cpp
+++ b/plugins/Variables/parse_metacontacts.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -37,11 +37,11 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
int count = getContactFromString( &ci );
if ( count == 1 && ci.hContacts != NULL ) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
@@ -65,7 +65,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )malloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
@@ -73,13 +73,13 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
TCHAR* tszProto;
- tszProto = a2u(szProto);
+ tszProto = mir_a2t(szProto);
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
mir_free(szUniqueID);
- free(tszProto);
+ mir_free(tszProto);
}
return res;
@@ -99,11 +99,11 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
int count = getContactFromString( &ci );
if ( count == 1 && ci.hContacts != NULL ) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
@@ -126,7 +126,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )malloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
@@ -134,13 +134,13 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
TCHAR* tszProto;
- tszProto = a2u(szProto);
+ tszProto = mir_a2t(szProto);
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
mir_free(szUniqueID);
- free(tszProto);
+ mir_free(tszProto);
}
return res;
@@ -160,11 +160,11 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
int count = getContactFromString( &ci );
if ( count == 1 && ci.hContacts != NULL ) {
hContact = ci.hContacts[0];
- free( ci.hContacts );
+ mir_free( ci.hContacts );
}
else {
if ( ci.hContacts != NULL )
- free( ci.hContacts );
+ mir_free( ci.hContacts );
return NULL;
}
@@ -187,7 +187,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )malloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
@@ -195,13 +195,13 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
TCHAR* tszProto;
- tszProto = a2u(szProto);
+ tszProto = mir_a2t(szProto);
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
mir_free(szUniqueID);
- free(tszProto);
+ mir_free(tszProto);
}
return res;
diff --git a/plugins/Variables/parse_metacontacts.h b/plugins/Variables/parse_metacontacts.h
index d808213915..8015d40413 100644
--- a/plugins/Variables/parse_metacontacts.h
+++ b/plugins/Variables/parse_metacontacts.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_miranda.cpp b/plugins/Variables/parse_miranda.cpp
index 5480a1805b..61f5c00153 100644
--- a/plugins/Variables/parse_miranda.cpp
+++ b/plugins/Variables/parse_miranda.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -31,7 +31,7 @@ static TCHAR *parseCodeToStatus(ARGUMENTSINFO *ai)
status = ttoi(ai->targv[1]);
szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_TCHAR);
if (szStatus != NULL)
- return _tcsdup(szStatus);
+ return mir_tstrdup(szStatus);
return NULL;
}
@@ -108,13 +108,13 @@ static TCHAR *parseContact(ARGUMENTSINFO *ai)
if ( count != 1 && ai->argc != 4 ) {
if ( ci.hContacts != NULL )
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
hContact = ci.hContacts[n];
log_debugA("contact: %x", hContact);
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return encodeContactToString(hContact);
}
@@ -133,7 +133,7 @@ static TCHAR *parseContactCount(ARGUMENTSINFO *ai)
ci.flags = getContactInfoFlags(ai->targv[2]);
count = getContactFromString( &ci );
if ( count != 0 && ci.hContacts != NULL )
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return itot(count);
}
@@ -156,11 +156,11 @@ static TCHAR *parseContactInfo(ARGUMENTSINFO *ai)
count = getContactFromString( &ci );
if ( count == 1 && ci.hContacts != NULL ) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
type = getContactInfoType(ai->targv[2]);
@@ -180,24 +180,19 @@ static TCHAR *parseDBProfileName(ARGUMENTSINFO *ai)
if (CallService(MS_DB_GETPROFILENAME, SIZEOF(name), (LPARAM)name))
return NULL;
-
- return a2u(name);
-
+ return mir_a2t(name);
}
-static TCHAR *parseDBProfilePath(ARGUMENTSINFO *ai) {
-
- char path[MAX_PATH];
-
+static TCHAR *parseDBProfilePath(ARGUMENTSINFO *ai)
+{
if (ai->argc != 1)
return NULL;
+ char path[MAX_PATH];
if (CallService(MS_DB_GETPROFILEPATH, SIZEOF(path), (LPARAM)path))
return NULL;
-
- return a2u(path);
-
+ return mir_a2t(path);
}
static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR* defaultValue) {
@@ -219,19 +214,13 @@ static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR*
var = itot(dbv.dVal);
break;
case DBVT_ASCIIZ:
-
- var = a2u(dbv.pszVal);
-
+ var = mir_a2t(dbv.pszVal);
break;
case DBVT_WCHAR:
-
- var = _wcsdup(dbv.pwszVal);
-
+ var = mir_tstrdup(dbv.pwszVal);
break;
case DBVT_UTF8:
-
- Utf8Decode(dbv.pszVal, &var);
-
+ Utf8Decode(dbv.pszVal, &var);
break;
}
@@ -261,27 +250,27 @@ static TCHAR *parseDBSetting(ARGUMENTSINFO *ai)
count = getContactFromString( &ci );
if ( count == 1 && ci.hContacts != NULL ) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
}
- szModule = u2a(ai->targv[2]);
- szSetting = u2a(ai->targv[3]);
+ szModule = mir_t2a(ai->targv[2]);
+ szSetting = mir_t2a(ai->targv[3]);
if ( ai->argc > 4 && _tcslen(ai->targv[4]) > 0 )
- szDefaultValue = _tcsdup(ai->targv[4]);
+ szDefaultValue = mir_tstrdup(ai->targv[4]);
if ( szModule != NULL && szSetting != NULL ) {
res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
- free(szModule);
- free(szSetting);
+ mir_free(szModule);
+ mir_free(szSetting);
}
return res;
}
@@ -306,11 +295,11 @@ static TCHAR *parseLastSeenDate(ARGUMENTSINFO *ai)
count = getContactFromString( &ci );
if ( count == 1 && ci.hContacts != NULL ) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
if ( ai->argc == 2 || (ai->argc > 2 && _tcslen(ai->targv[2]) == 0))
@@ -337,12 +326,12 @@ static TCHAR *parseLastSeenDate(ARGUMENTSINFO *ai)
lsTime.wMonth = DBGetContactSettingWord(hContact, szModule, "Month", 0);
len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
- res = ( TCHAR* )malloc((len+1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) {
- free(res);
+ mir_free(res);
return NULL;
}
@@ -369,11 +358,11 @@ static TCHAR *parseLastSeenTime(ARGUMENTSINFO *ai)
count = getContactFromString( &ci );
if ( count == 1 && ci.hContacts != NULL ) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
if ( ai->argc == 2 || (ai->argc > 2 && _tcslen(ai->targv[2]) == 0))
@@ -401,12 +390,12 @@ static TCHAR *parseLastSeenTime(ARGUMENTSINFO *ai)
lsTime.wYear = DBGetContactSettingWord(hContact, szModule, "Year", 0);
len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
- res = ( TCHAR* )malloc((len+1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) {
- free(res);
+ mir_free(res);
return NULL;
}
@@ -432,11 +421,11 @@ static TCHAR *parseLastSeenStatus(ARGUMENTSINFO *ai) {
count = getContactFromString( &ci );
if ( (count == 1) && (ci.hContacts != NULL)) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else {
if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
return NULL;
}
szModule = CEX_MODULE;
@@ -450,7 +439,7 @@ static TCHAR *parseLastSeenStatus(ARGUMENTSINFO *ai) {
szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_UNICODE);
if (szStatus != NULL)
- return _tcsdup(szStatus);
+ return mir_tstrdup(szStatus);
return NULL;
}
@@ -466,7 +455,7 @@ static TCHAR *parseMirandaPath(ARGUMENTSINFO *ai) {
if (GetModuleFileName(NULL, path, SIZEOF(path)) == 0)
return NULL;
- return _tcsdup(path);
+ return mir_tstrdup(path);
}
static TCHAR *parseMyStatus(ARGUMENTSINFO *ai) {
@@ -482,14 +471,14 @@ static TCHAR *parseMyStatus(ARGUMENTSINFO *ai) {
status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
else {
- szProto = u2a(ai->targv[1]);
+ szProto = mir_t2a(ai->targv[1]);
status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- free(szProto);
+ mir_free(szProto);
}
szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_UNICODE);
if (szStatus != NULL)
- return _tcsdup(szStatus);
+ return mir_tstrdup(szStatus);
return NULL;
}
@@ -505,7 +494,7 @@ static TCHAR *parseProtoInfo(ARGUMENTSINFO *ai)
szRes = NULL;
tszRes = NULL;
- szProto = u2a(ai->targv[1]);
+ szProto = mir_t2a(ai->targv[1]);
if (!_tcscmp(ai->targv[2], _T(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
@@ -517,7 +506,7 @@ static TCHAR *parseProtoInfo(ARGUMENTSINFO *ai)
szText = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
if (szText != NULL)
- szRes = _strdup(szText);
+ szRes = mir_strdup(szText);
}
else if (!_tcscmp(ai->targv[2], _T(STR_PIUIDSETTING))) {
char *szText;
@@ -526,20 +515,20 @@ static TCHAR *parseProtoInfo(ARGUMENTSINFO *ai)
szText = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
if (szText != NULL)
- szRes = _strdup(szText);
+ szRes = mir_strdup(szText);
}
- free(szProto);
+ mir_free(szProto);
if ( szRes == NULL && tszRes == NULL )
return NULL;
if ( szRes != NULL && tszRes == NULL ) {
- tszRes = a2u(szRes);
- free(szRes);
+ tszRes = mir_a2t(szRes);
+ mir_free(szRes);
}
else if ( szRes != NULL && tszRes != NULL )
- free(szRes);
+ mir_free(szRes);
return tszRes;
}
@@ -568,20 +557,20 @@ static TCHAR *parseSpecialContact(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )malloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
}
- tszProto = a2u(szProto);
+ tszProto = mir_a2t(szProto);
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
mir_free(szUniqueID);
- free(tszProto);
+ mir_free(tszProto);
}
return res;
@@ -732,7 +721,7 @@ static TCHAR *GetMessageDescription(DBEVENTINFO *dbei)
if ( ServiceExists( MS_DB_EVENT_GETTEXT )) {
// Miranda 0.7
TCHAR *buf = DbGetEventTextT(dbei, CP_ACP);
- tszRes = _tcsdup(buf);
+ tszRes = mir_tstrdup(buf);
mir_free(buf);
}
else {
@@ -742,14 +731,14 @@ static TCHAR *GetMessageDescription(DBEVENTINFO *dbei)
if ( dbei->cbBlob > len ) {
int len2 = dbei->cbBlob - len;
- tszRes = ( TCHAR* )calloc(len2, 1);
+ tszRes = ( TCHAR* )mir_calloc(len2);
memcpy( tszRes, &dbei->pBlob[ len ], len2 );
}
else {
- char *szRes = ( char* )calloc(len, sizeof(char));
+ char *szRes = ( char* )mir_calloc(len);
strncpy( szRes, ( const char* )pszSrc, len );
- tszRes = a2u(szRes);
- free(szRes);
+ tszRes = mir_a2t(szRes);
+ mir_free(szRes);
}
}
@@ -810,10 +799,10 @@ static TCHAR *parseDbEvent(ARGUMENTSINFO *ai)
count = getContactFromString( &ci );
if ( (count == 1) && (ci.hContacts != NULL)) {
hContact = ci.hContacts[0];
- free(ci.hContacts);
+ mir_free(ci.hContacts);
}
else if (ci.hContacts != NULL)
- free(ci.hContacts);
+ mir_free(ci.hContacts);
hDbEvent = findDbEvent(hContact, NULL, flags);
if (hDbEvent == NULL)
@@ -822,13 +811,13 @@ static TCHAR *parseDbEvent(ARGUMENTSINFO *ai)
ZeroMemory(&dbe, sizeof(DBEVENTINFO));
dbe.cbSize = sizeof(DBEVENTINFO);
dbe.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
- dbe.pBlob = ( PBYTE )calloc(dbe.cbBlob, 1);
+ dbe.pBlob = ( PBYTE )mir_calloc(dbe.cbBlob);
if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) {
- free(dbe.pBlob);
+ mir_free(dbe.pBlob);
return NULL;
}
res = GetMessageDescription(&dbe);
- free(dbe.pBlob);
+ mir_free(dbe.pBlob);
return res;
}
@@ -839,7 +828,7 @@ static TCHAR *parseTranslate(ARGUMENTSINFO *ai)
return NULL;
TCHAR* res = TranslateTS(ai->targv[1]);
- return (res == NULL) ? NULL : _tcsdup(res);
+ return (res == NULL) ? NULL : mir_tstrdup(res);
}
static TCHAR *parseVersionString(ARGUMENTSINFO *ai) {
@@ -854,7 +843,7 @@ static TCHAR *parseVersionString(ARGUMENTSINFO *ai) {
return NULL;
- return a2u(versionString);
+ return mir_a2t(versionString);
}
@@ -870,7 +859,7 @@ static TCHAR *parseContactNameString(ARGUMENTSINFO *ai)
if (ret == NULL)
return NULL;
- return _tcsdup(ret);
+ return mir_tstrdup(ret);
}
static TCHAR *parseMirDateString(ARGUMENTSINFO *ai)
@@ -888,7 +877,7 @@ static TCHAR *parseMirDateString(ARGUMENTSINFO *ai)
if (CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM) time(NULL), (LPARAM) &tst))
return NULL;
- return _tcsdup(ret);
+ return mir_tstrdup(ret);
}
static TCHAR *parseMirandaCoreVar(ARGUMENTSINFO *ai) {
@@ -906,7 +895,7 @@ static TCHAR *parseMirandaCoreVar(ARGUMENTSINFO *ai) {
mir_sntprintf(path, sizeof(path)-1, _T("%s"), tmpPath);
mir_free(tmpPath);
- return _tcsdup(path);
+ return mir_tstrdup(path);
}
static TCHAR *parseMirSrvExists(ARGUMENTSINFO *ai)
@@ -916,17 +905,17 @@ static TCHAR *parseMirSrvExists(ARGUMENTSINFO *ai)
char* serviceName;
- serviceName = u2a( ai->targv[1] );
+ serviceName = mir_t2a( ai->targv[1] );
if ( !ServiceExists( serviceName ))
ai->flags |= AIF_FALSE;
- free( serviceName );
+ mir_free( serviceName );
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
int registerMirandaTokens() {
diff --git a/plugins/Variables/parse_miranda.h b/plugins/Variables/parse_miranda.h
index 6cf1c12278..0d429d67bb 100644
--- a/plugins/Variables/parse_miranda.h
+++ b/plugins/Variables/parse_miranda.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_regexp.cpp b/plugins/Variables/parse_regexp.cpp
index 7642275eee..88e148e02f 100644
--- a/plugins/Variables/parse_regexp.cpp
+++ b/plugins/Variables/parse_regexp.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -46,29 +46,29 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) {
}
ai->flags = AIF_FALSE;
- arg1 = u2a(ai->targv[1]);
- arg2 = u2a(ai->targv[2]);
+ arg1 = mir_t2a(ai->targv[1]);
+ arg2 = mir_t2a(ai->targv[2]);
ppat = pcreCompile(arg1, 0, &err, &erroffset, NULL);
if (ppat == NULL) {
- free(arg1);
- free(arg2);
+ mir_free(arg1);
+ mir_free(arg2);
return NULL;
}
extra = pcreStudy(ppat, 0, &err);
nmat = pcreExec(ppat, extra, arg2, strlen(arg2), 0, 0, offsets, 99);
- free(arg1);
- free(arg2);
+ mir_free(arg1);
+ mir_free(arg2);
if (nmat > 0) {
ai->flags &= ~AIF_FALSE;
_ltoa(nmat, szVal, 10);
- res = a2u(szVal);
+ res = mir_a2t(szVal);
return res;
}
- return _tcsdup(_T("0"));
+ return mir_tstrdup(_T("0"));
}
/*
@@ -88,23 +88,23 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) {
return NULL;
}
- arg1 = u2a(ai->targv[1]);
- arg2 = u2a(ai->targv[2]);
- arg3 = u2a(ai->targv[3]);
+ arg1 = mir_t2a(ai->targv[1]);
+ arg2 = mir_t2a(ai->targv[2]);
+ arg3 = mir_t2a(ai->targv[3]);
number = atoi(arg3);
if (number < 0) {
- free(arg1);
- free(arg2);
- free(arg3);
+ mir_free(arg1);
+ mir_free(arg2);
+ mir_free(arg3);
return NULL;
}
ai->flags = AIF_FALSE;
ppat = pcreCompile(arg1, 0, &err, &erroffset, NULL);
if (ppat == NULL) {
- free(arg1);
- free(arg2);
- free(arg3);
+ mir_free(arg1);
+ mir_free(arg2);
+ mir_free(arg3);
return NULL;
}
extra = pcreStudy(ppat, 0, &err);
@@ -116,24 +116,24 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) {
ai->flags |= AIF_FALSE;
}
else {
- res = _strdup(substring);
+ res = mir_strdup(substring);
pcreFreeSubstring(substring);
- tres = a2u(res);
+ tres = mir_a2t(res);
- free(res);
- free(arg1);
- free(arg2);
- free(arg3);
+ mir_free(res);
+ mir_free(arg1);
+ mir_free(arg2);
+ mir_free(arg3);
return tres;
}
- free(arg1);
- free(arg2);
- free(arg3);
+ mir_free(arg1);
+ mir_free(arg2);
+ mir_free(arg3);
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
int initPcre() {
diff --git a/plugins/Variables/parse_regexp.h b/plugins/Variables/parse_regexp.h
index 24fb13e529..00d38cab59 100644
--- a/plugins/Variables/parse_regexp.h
+++ b/plugins/Variables/parse_regexp.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_str.cpp b/plugins/Variables/parse_str.cpp
index df1739a815..3f9781dcfc 100644
--- a/plugins/Variables/parse_str.cpp
+++ b/plugins/Variables/parse_str.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -26,7 +26,7 @@ static TCHAR *parseCaps(ARGUMENTSINFO *ai) {
if (ai->argc != 2)
return NULL;
- res = _tcsdup(ai->targv[1]);
+ res = mir_tstrdup(ai->targv[1]);
cur = res;
CharLower(res);
*cur = (TCHAR)CharUpper((LPTSTR)*cur);
@@ -53,7 +53,7 @@ static TCHAR *parseCaps2(ARGUMENTSINFO *ai) {
if (ai->argc != 2)
return NULL;
- res = _tcsdup(ai->targv[1]);
+ res = mir_tstrdup(ai->targv[1]);
cur = res;
*cur = (TCHAR)CharUpper((LPTSTR)*cur);
cur++;
@@ -72,7 +72,7 @@ static TCHAR *parseCrlf(ARGUMENTSINFO *ai) {
ai->flags |= AIF_DONTPARSE;
- return _tcsdup(_T("\r\n"));
+ return mir_tstrdup(_T("\r\n"));
}
static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai) {
@@ -83,7 +83,7 @@ static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai) {
if (ai->argc != 2) {
return NULL;
}
- res = _tcsdup(ai->targv[1]);
+ res = mir_tstrdup(ai->targv[1]);
cur = res;
do {
cur = _tcschr(cur, _T('\n'));
@@ -120,10 +120,10 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai) {
cur++;
}
if (*cur == '\0') {
- return _tcsdup(ai->targv[1]);
+ return mir_tstrdup(ai->targv[1]);
}
cur--;
- res = ( TCHAR* )malloc((cur-ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((cur-ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR));
if (res == NULL) {
return res;
}
@@ -139,7 +139,7 @@ static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) {
TCHAR *res, *cur, *szEol, *szReplacement;
unsigned int pos = 0;
- res = _tcsdup(ai->targv[1]);
+ res = mir_tstrdup(ai->targv[1]);
switch( ai->argc ) {
case 2: szReplacement = _T(" "); break;
case 3: szReplacement = ai->targv[2]; break;
@@ -183,7 +183,7 @@ static TCHAR *parseInsert(ARGUMENTSINFO *ai) {
if (pos > _tcslen(ai->targv[1])) {
return NULL;
}
- res = ( TCHAR* )malloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -208,7 +208,7 @@ static TCHAR *parseLeft(ARGUMENTSINFO *ai) {
return NULL;
}
len = min(len, (signed int)_tcslen(ai->targv[1]));
- res = ( TCHAR* )malloc((len + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((len + 1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -261,7 +261,7 @@ static TCHAR *parseLower(ARGUMENTSINFO *ai) {
if (ai->argc != 2) {
return NULL;
}
- res = _tcsdup(ai->targv[1]);
+ res = mir_tstrdup(ai->targv[1]);
if (res == NULL) {
return NULL;
}
@@ -282,7 +282,7 @@ static TCHAR *parseLongest(ARGUMENTSINFO *ai) {
iLong = i;
}
}
- return _tcsdup(ai->targv[iLong]);
+ return mir_tstrdup(ai->targv[iLong]);
}
static TCHAR *parseNoOp(ARGUMENTSINFO *ai) {
@@ -291,7 +291,7 @@ static TCHAR *parseNoOp(ARGUMENTSINFO *ai) {
return NULL;
}
- return _tcsdup(ai->targv[1]);
+ return mir_tstrdup(ai->targv[1]);
}
static TCHAR *parsePad(ARGUMENTSINFO *ai) {
@@ -311,7 +311,7 @@ static TCHAR *parsePad(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )malloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -341,7 +341,7 @@ static TCHAR *parsePadright(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )malloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -370,7 +370,7 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )malloc((padding + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -401,7 +401,7 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )malloc((padding + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -428,7 +428,7 @@ static TCHAR *parseRepeat(ARGUMENTSINFO *ai) {
if (count < 0) {
return NULL;
}
- res = ( TCHAR* )malloc((count * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((count * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -449,7 +449,7 @@ static TCHAR *parseReplace(ARGUMENTSINFO *ai) {
return NULL;
}
pos = 0;
- res = _tcsdup(ai->targv[1]);
+ res = mir_tstrdup(ai->targv[1]);
for (i=2;i<ai->argc;i+=2) {
if (_tcslen(ai->targv[i]) == 0) {
continue;
@@ -485,7 +485,7 @@ static TCHAR *parseRight(ARGUMENTSINFO *ai) {
return NULL;
}
len = min(len, (signed int)_tcslen(ai->targv[1]));
- res = ( TCHAR* )malloc((len+1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -508,14 +508,14 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai) {
}
if (_tcslen(ai->targv[1]) == 0) {
- return _tcsdup(ai->targv[1]);
+ return mir_tstrdup(ai->targv[1]);
}
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]);
}
- res = ( TCHAR* )malloc((2*_tcslen(ai->targv[1])+1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((2*_tcslen(ai->targv[1])+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -543,7 +543,7 @@ static TCHAR *parseShortest(ARGUMENTSINFO *ai) {
}
}
- return _tcsdup(ai->targv[iShort]);
+ return mir_tstrdup(ai->targv[iShort]);
}
static TCHAR *parseStrchr(ARGUMENTSINFO *ai) {
@@ -557,7 +557,7 @@ static TCHAR *parseStrchr(ARGUMENTSINFO *ai) {
ZeroMemory(szVal, sizeof(szVal));
c = _tcschr(ai->targv[1], *ai->targv[2]);
if ( (c == NULL) || (*c == _T('\0'))) {
- return _tcsdup(_T("0"));
+ return mir_tstrdup(_T("0"));
}
return itot(c-ai->targv[1]+1);
@@ -572,7 +572,7 @@ static TCHAR *parseStrcmp(ARGUMENTSINFO *ai) {
ai->flags |= AIF_FALSE;
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseStrmcmp(ARGUMENTSINFO *ai) {
@@ -590,7 +590,7 @@ static TCHAR *parseStrmcmp(ARGUMENTSINFO *ai) {
}
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseStrncmp(ARGUMENTSINFO *ai) {
@@ -608,7 +608,7 @@ static TCHAR *parseStrncmp(ARGUMENTSINFO *ai) {
ai->flags |= AIF_FALSE;
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseStricmp(ARGUMENTSINFO *ai) {
@@ -621,7 +621,7 @@ static TCHAR *parseStricmp(ARGUMENTSINFO *ai) {
ai->flags |= AIF_FALSE;
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseStrnicmp(ARGUMENTSINFO *ai) {
@@ -639,7 +639,7 @@ static TCHAR *parseStrnicmp(ARGUMENTSINFO *ai) {
ai->flags |= AIF_FALSE;
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseStrrchr(ARGUMENTSINFO *ai) {
@@ -651,7 +651,7 @@ static TCHAR *parseStrrchr(ARGUMENTSINFO *ai) {
}
c = _tcsrchr(ai->targv[1], *ai->targv[2]);
if ( (c == NULL) || (*c == _T('\0'))) {
- return _tcsdup(_T("0"));
+ return mir_tstrdup(_T("0"));
}
return itot(c-ai->targv[1]+1);
@@ -666,7 +666,7 @@ static TCHAR *parseStrstr(ARGUMENTSINFO *ai) {
}
c = _tcsstr(ai->targv[1], ai->targv[2]);
if ( (c == NULL) || (*c == _T('\0'))) {
- return _tcsdup(_T("0"));
+ return mir_tstrdup(_T("0"));
}
return itot(c-ai->targv[1]+1);
@@ -690,7 +690,7 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai) {
if (to < from) {
return NULL;
}
- res = ( TCHAR* )malloc((to-from+1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((to-from+1)*sizeof(TCHAR));
ZeroMemory(res, (to-from+1)*sizeof(TCHAR));
_tcsncpy(res, ai->targv[1]+from, to-from);
@@ -709,7 +709,7 @@ static TCHAR *parseSelect(ARGUMENTSINFO *ai) {
return NULL;
}
- return _tcsdup(ai->targv[n+1]);
+ return mir_tstrdup(ai->targv[n+1]);
}
static TCHAR *parseSwitch(ARGUMENTSINFO *ai) {
@@ -721,7 +721,7 @@ static TCHAR *parseSwitch(ARGUMENTSINFO *ai) {
}
for (i=2;i<ai->argc;i+=2) {
if (!_tcscmp(ai->targv[1], ai->targv[i])) {
- return _tcsdup(ai->targv[i+1]);
+ return mir_tstrdup(ai->targv[i+1]);
}
}
return NULL;
@@ -743,9 +743,9 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai) {
ecur--;
}
if (scur >= ecur) {
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
- res = ( TCHAR* )malloc((ecur-scur+2)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((ecur-scur+2)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -767,7 +767,7 @@ static TCHAR *parseTab(ARGUMENTSINFO *ai) {
if (count < 0) {
return NULL;
}
- res = ( TCHAR* )malloc((count+1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((count+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -787,7 +787,7 @@ static TCHAR *parseUpper(ARGUMENTSINFO *ai) {
if (ai->argc != 2) {
return NULL;
}
- res = _tcsdup(ai->targv[1]);
+ res = mir_tstrdup(ai->targv[1]);
if (res == NULL) {
return NULL;
}
@@ -827,7 +827,7 @@ static TCHAR *getNthWord(TCHAR *szString, int w) {
while ( (*ecur != _T(' ')) && (*ecur != _T('\0'))) {
ecur++;
}
- res = ( TCHAR* )malloc((ecur-scur+1)*sizeof(TCHAR));
+ res = ( TCHAR* )mir_alloc((ecur-scur+1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -870,9 +870,9 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) {
_tcscat(res, szWord);
}
}
- else res = _tcsdup(szWord);
+ else res = mir_tstrdup(szWord);
- free(szWord);
+ mir_free(szWord);
}
return res;
@@ -885,7 +885,7 @@ static TCHAR *parseExtratext(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
if (ai->fi->szExtraText != NULL)
- return _tcsdup(ai->fi->tszExtraText);
+ return mir_tstrdup(ai->fi->tszExtraText);
return NULL;
}
diff --git a/plugins/Variables/parse_str.h b/plugins/Variables/parse_str.h
index e77ff4466c..7942da455f 100644
--- a/plugins/Variables/parse_str.h
+++ b/plugins/Variables/parse_str.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_system.cpp b/plugins/Variables/parse_system.cpp
index 960618ac01..a733f8ba25 100644
--- a/plugins/Variables/parse_system.cpp
+++ b/plugins/Variables/parse_system.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -70,9 +70,9 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) {
return NULL;
if (_tcslen(ai->targv[1]) == 0)
- szCounter = _tcsdup(_T("\\Processor(_Total)\\% Processor Time"));
+ szCounter = mir_tstrdup(_T("\\Processor(_Total)\\% Processor Time"));
else {
- szCounter = ( TCHAR* )malloc((_tcslen(ai->targv[1]) + 32)*sizeof(TCHAR));
+ szCounter = ( TCHAR* )mir_alloc((_tcslen(ai->targv[1]) + 32)*sizeof(TCHAR));
if (szCounter == NULL)
return NULL;
@@ -80,23 +80,23 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) {
}
pdhStatus = PdhValidatePath(szCounter);
if (pdhStatus != ERROR_SUCCESS) {
- free(szCounter);
+ mir_free(szCounter);
return NULL;
}
pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);
if (pdhStatus != ERROR_SUCCESS) {
- free(szCounter);
+ mir_free(szCounter);
return NULL;
}
pdhStatus = PdhAddCounter(hQuery, szCounter, 0, &hCounter);
if (pdhStatus != ERROR_SUCCESS) {
- free(szCounter);
+ mir_free(szCounter);
pdhStatus = PdhCloseQuery(hQuery);
return NULL;
}
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
- free(szCounter);
+ mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return NULL;
@@ -104,20 +104,20 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) {
Sleep(100);
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
- free(szCounter);
+ mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return NULL;
}
pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, (LPDWORD)NULL, &cValue);
if (pdhStatus != ERROR_SUCCESS) {
- free(szCounter);
+ mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return NULL;
}
if (cValue.CStatus != ERROR_SUCCESS) {
- free(szCounter);
+ mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
return NULL;
@@ -125,7 +125,7 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) {
mir_sntprintf(szVal, SIZEOF(szVal), _T("%.0f"), cValue.doubleValue);
//PdhRemoveCounter(*hCounter);
PdhCloseQuery(hQuery);
- free(szCounter);
+ mir_free(szCounter);
return mir_tstrdup(szVal);
}
@@ -457,7 +457,7 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai) {
return NULL;
}
if ( ((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
- tszRes = ( TCHAR* )malloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = ( TCHAR* )mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
_tcscpy(tszRes, ffd.cFileName);
}
while (FindNextFile(hFind, &ffd) != 0) {
@@ -520,7 +520,7 @@ static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai) {
if (ai->argc != 3) {
return NULL;
}
- key = subKey = _tcsdup(ai->targv[1]);
+ key = subKey = mir_tstrdup(ai->targv[1]);
if (subKey == NULL) {
return NULL;
}
@@ -542,15 +542,15 @@ static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai) {
hKey = HKEY_USERS;
}
else {
- free(key);
+ mir_free(key);
return NULL;
}
subKey = cur+1;
if (RegOpenKeyEx(hKey, subKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
- free(key);
+ mir_free(key);
return NULL;
}
- free(key);
+ mir_free(key);
len = MAX_REGVALUE_LENGTH+1;
res = ( TCHAR* )mir_alloc(len*sizeof(TCHAR));
if (res == NULL) {
@@ -714,15 +714,15 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
res = (TCHAR *)pBuf;
}
else {
- res = mir_a2u((char *)pBuf);
- free(pBuf);
+ res = mir_a2t((char *)pBuf);
+ mir_free(pBuf);
}
return res;
}
bufSz = TXTFILEBUFSZ*csz;
- pBuf = ( PBYTE )calloc(bufSz, 1);
+ pBuf = ( PBYTE )mir_calloc(bufSz);
if (pBuf == NULL) {
return NULL;
}
@@ -731,7 +731,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
ZeroMemory(pBuf, bufSz);
if (ReadFile(hFile, pBuf, bufSz-csz, &readSz, NULL) == 0) {
CloseHandle(hFile);
- free(pBuf);
+ mir_free(pBuf);
return NULL;
}
totalReadSz += readSz;
@@ -804,12 +804,12 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
} while ( (totalReadSz < fileSz) && (readSz > 0));
if (linePos < 0) {
CloseHandle(hFile);
- free(pBuf);
+ mir_free(pBuf);
return NULL;
}
if (SetFilePointer(hFile, linePos, NULL, FILE_BEGIN) != linePos) {
CloseHandle(hFile);
- free(pBuf);
+ mir_free(pBuf);
return NULL;
}
ZeroMemory(pBuf, bufSz);
@@ -817,7 +817,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
do {
icur = 0;
if (ReadFile(hFile, pBuf, bufSz-csz, &readSz, NULL) == 0) {
- free(pBuf);
+ mir_free(pBuf);
CloseHandle(hFile);
return NULL;
}
@@ -836,8 +836,8 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
res = (TCHAR *)pBuf;
}
else {
- res = a2u((char *)pBuf);
- free(pBuf);
+ res = mir_a2t((char *)pBuf);
+ mir_free(pBuf);
}
return res;
@@ -850,8 +850,8 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
res = (TCHAR *)pBuf;
}
else {
- res = a2u((char *)pBuf);
- free(pBuf);
+ res = mir_a2t((char *)pBuf);
+ mir_free(pBuf);
}
return res;
diff --git a/plugins/Variables/parse_system.h b/plugins/Variables/parse_system.h
index 4da3f762fe..d4349130f7 100644
--- a/plugins/Variables/parse_system.h
+++ b/plugins/Variables/parse_system.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_variables.cpp b/plugins/Variables/parse_variables.cpp
index 58520f1087..8a4351fbbf 100644
--- a/plugins/Variables/parse_variables.cpp
+++ b/plugins/Variables/parse_variables.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -34,8 +34,8 @@ static int addToVariablesRegister(TCHAR *szName, TCHAR *szText) {
EnterCriticalSection(&csVarRegister);
for (i=0;i<vrCount;i++) {
if ( (!_tcscmp(vr[i].szName, szName))) { // && (vr[i].dwOwnerThread == GetCurrentThreadId())) {
- free(vr[i].szText);
- vr[i].szText = _tcsdup(szText);
+ mir_free(vr[i].szText);
+ vr[i].szText = mir_tstrdup(szText);
LeaveCriticalSection(&csVarRegister);
return 0;
@@ -46,8 +46,8 @@ static int addToVariablesRegister(TCHAR *szName, TCHAR *szText) {
LeaveCriticalSection(&csVarRegister);
return -1;
}
- vr[vrCount].szName = _tcsdup(szName);
- vr[vrCount].szText = _tcsdup(szText);
+ vr[vrCount].szName = mir_tstrdup(szName);
+ vr[vrCount].szText = mir_tstrdup(szText);
vr[vrCount].dwOwnerThread = GetCurrentThreadId();
vrCount += 1;
LeaveCriticalSection(&csVarRegister);
@@ -67,7 +67,7 @@ static TCHAR *searchVariableRegister(TCHAR *szName) {
EnterCriticalSection(&csVarRegister);
for (i=0;i<vrCount;i++) {
if ( (!_tcscmp(vr[i].szName, szName))) { // && (vr[i].dwOwnerThread == GetCurrentThreadId())) {
- res = _tcsdup(vr[i].szText);
+ res = mir_tstrdup(vr[i].szText);
LeaveCriticalSection(&csVarRegister);
return res;
}
@@ -85,8 +85,8 @@ int clearVariableRegister() {
EnterCriticalSection(&csVarRegister);
for (i=0;i<vrCount;i++) {
if (vr[i].dwOwnerThread == GetCurrentThreadId()) {
- free(vr[i].szName);
- free(vr[i].szText);
+ mir_free(vr[i].szName);
+ mir_free(vr[i].szText);
if (vrCount > 1) {
memcpy(&vr[i], &vr[vrCount-1], sizeof(VARIABLEREGISTER));
vr = ( VARIABLEREGISTER* )realloc(vr, (vrCount-1)*sizeof(VARIABLEREGISTER));
@@ -97,7 +97,7 @@ int clearVariableRegister() {
vrCount -= 1;
}
else {
- free(vr);
+ mir_free(vr);
vr = NULL;
vrCount = 0;
}
@@ -138,7 +138,7 @@ static TCHAR *parsePuts(ARGUMENTSINFO *ai) {
return NULL;
}
- return _tcsdup(_T(""));
+ return mir_tstrdup(_T(""));
}
static TCHAR *parseGet(ARGUMENTSINFO *ai) {
diff --git a/plugins/Variables/parse_variables.h b/plugins/Variables/parse_variables.h
index 562e20d72b..5bde654f5f 100644
--- a/plugins/Variables/parse_variables.h
+++ b/plugins/Variables/parse_variables.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/parse_xml.cpp b/plugins/Variables/parse_xml.cpp
index ae6ad960d1..4e360035b4 100644
--- a/plugins/Variables/parse_xml.cpp
+++ b/plugins/Variables/parse_xml.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -64,8 +64,8 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) {
return NULL;
}
- szStyleSheet = u2a(ai->targv[1]);
- szDoc = u2a(ai->targv[2]);
+ szStyleSheet = mir_t2a(ai->targv[1]);
+ szDoc = mir_t2a(ai->targv[2]);
log_debugA("calling xsltParseMemory");
@@ -116,12 +116,12 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) {
pXmlFreeDoc(res);
log_debugA("calling xsltFreeDoc");
pXmlFreeDoc(doc);
- log_debugA("calling free");
- free(szStyleSheet);
- log_debugA("calling free");
- free(szDoc);
+ log_debugA("calling mir_free");
+ mir_free(szStyleSheet);
+ log_debugA("calling mir_free");
+ mir_free(szDoc);
- tszRes = a2u((char *)xmlChRes);
+ tszRes = mir_a2t((char *)xmlChRes);
log_debugA("calling xmlFree");
pXmlFree(xmlChRes);
@@ -145,8 +145,8 @@ static TCHAR *parseXsltf(ARGUMENTSINFO *ai) {
return NULL;
}
- szStyleSheet = u2a(ai->targv[1]);
- szDoc = u2a(ai->targv[2]);
+ szStyleSheet = mir_t2a(ai->targv[1]);
+ szDoc = mir_t2a(ai->targv[2]);
log_debugA("xslt with %s and %s", szStyleSheet, szDoc);
@@ -196,10 +196,10 @@ static TCHAR *parseXsltf(ARGUMENTSINFO *ai) {
//log_debug("calling xmlCleanupParser");
//pXmlCleanupParser();
- free(szStyleSheet);
- free(szDoc);
+ mir_free(szStyleSheet);
+ mir_free(szDoc);
- tszRes = a2u((char *)xmlChRes);
+ tszRes = mir_a2t((char *)xmlChRes);
log_debugA("calling xmlFree");
pXmlFree(xmlChRes);
diff --git a/plugins/Variables/tokenregister.cpp b/plugins/Variables/tokenregister.cpp
index d88b81949a..8b3bb1b87d 100644
--- a/plugins/Variables/tokenregister.cpp
+++ b/plugins/Variables/tokenregister.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -66,13 +66,13 @@ int registerIntToken(TCHAR *szToken, TCHAR *(*parseFunction)(ARGUMENTSINFO *ai),
return registerToken(0, (LPARAM)&tr);
}
-int deRegisterToken(TCHAR *token) {
-
+int deRegisterToken(TCHAR *token)
+{
TokenRegisterEntry *tre;
- if (token == NULL) {
+ if (token == NULL)
return -1;
- }
+
EnterCriticalSection(&csRegister);
tre = FindTokenRegisterByName( token );
if ( tre == NULL ) {
@@ -84,18 +84,18 @@ int deRegisterToken(TCHAR *token) {
LeaveCriticalSection(&csRegister);
if ( !( tre->tr.flags & TRF_PARSEFUNC ) && tre->tr.szService != NULL )
- free( tre->tr.szService );
+ mir_free( tre->tr.szService );
if ( tre->tr.tszTokenString != NULL )
- free( tre->tr.tszTokenString );
+ mir_free( tre->tr.tszTokenString );
if ( tre->tr.szHelpText != NULL )
- free( tre->tr.szHelpText );
+ mir_free( tre->tr.szHelpText );
if ( (tre->tr.flags & TRF_CLEANUP ) && !( tre->tr.flags & TRF_CLEANUPFUNC ) && tre->tr.szCleanupService != NULL )
- free( tre->tr.szCleanupService );
+ mir_free( tre->tr.szCleanupService );
- free( tre );
+ mir_free( tre );
return 0;
}
@@ -117,14 +117,14 @@ INT_PTR registerToken(WPARAM wParam, LPARAM lParam)
WCHAR *wtoken;
- wtoken = a2u( newVr->szTokenString );
+ wtoken = mir_a2t( newVr->szTokenString );
deRegisterToken( wtoken );
hash = NameHashFunction( wtoken );
- free( wtoken );
+ mir_free( wtoken );
}
- tre = ( TokenRegisterEntry* )malloc( sizeof( TokenRegisterEntry ));
+ tre = ( TokenRegisterEntry* )mir_alloc( sizeof( TokenRegisterEntry ));
if ( tre == NULL )
return -1;
@@ -134,20 +134,20 @@ INT_PTR registerToken(WPARAM wParam, LPARAM lParam)
log_debugA("alias");
if ( !( newVr->flags & TRF_PARSEFUNC ) && newVr->szService != NULL )
- tre->tr.szService = _strdup( newVr->szService );
+ tre->tr.szService = mir_strdup( newVr->szService );
if ( newVr->flags & TRF_TCHAR )
- tre->tr.tszTokenString = _tcsdup( newVr->tszTokenString );
+ tre->tr.tszTokenString = mir_tstrdup( newVr->tszTokenString );
else
- tre->tr.tszTokenString = a2u( newVr->szTokenString );
+ tre->tr.tszTokenString = mir_a2t( newVr->szTokenString );
if ( newVr->szHelpText != NULL )
- tre->tr.szHelpText = _strdup( newVr->szHelpText );
+ tre->tr.szHelpText = mir_strdup( newVr->szHelpText );
if (( newVr->flags & TRF_CLEANUP ) && !( newVr->flags & TRF_CLEANUPFUNC ) && newVr->szCleanupService != NULL )
- tre->tr.szCleanupService = _strdup( newVr->szCleanupService );
+ tre->tr.szCleanupService = mir_strdup( newVr->szCleanupService );
EnterCriticalSection(&csRegister);
List_GetIndex(( SortedList* )&tokens, tre, &idx );
@@ -178,27 +178,22 @@ TOKENREGISTEREX *searchRegister(TCHAR *tvar, int type)
TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
{
- int callRes;
- TCHAR *temp, *res;
- TOKENREGISTEREX *thisVr, trCopy;
-
- if ( (ai == NULL) || (ai->argc == 0) || (ai->targv[0] == NULL)) {
+ if ( ai == NULL || ai->argc == 0 || ai->targv[0] == NULL)
return NULL;
- }
- callRes = 0;
- temp = res = NULL;
- thisVr = NULL;
+
+ INT_PTR callRes = 0;
+ TCHAR *temp = NULL, *res = NULL;
+
EnterCriticalSection(&csRegister);
/* note the following limitation: you cannot add/remove tokens during a call from a different thread */
- thisVr = searchRegister( ai->targv[0], 0 );
+ TOKENREGISTEREX *thisVr = searchRegister( ai->targv[0], 0 );
if ( thisVr == NULL ) {
LeaveCriticalSection(&csRegister);
return NULL;
}
- trCopy = *thisVr;
-
+ TOKENREGISTEREX trCopy = *thisVr;
// ai contains WCHARs, convert to chars because the tr doesn't support WCHARs
if ( !( thisVr->flags & TRF_TCHAR )) {
@@ -207,9 +202,9 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
ARGUMENTSINFO cAi;
memcpy(&cAi, ai, sizeof(ARGUMENTSINFO));
- cAi.argv = ( char** )malloc(ai->argc*sizeof(char *));
+ cAi.argv = ( char** )mir_alloc(ai->argc*sizeof(char *));
for ( j=0; j < ai->argc; j++ )
- cAi.argv[j] = u2a( ai->targv[j] );
+ cAi.argv[j] = mir_t2a( ai->targv[j] );
if ( thisVr->flags & TRF_PARSEFUNC )
callRes = (INT_PTR)thisVr->parseFunction( &cAi );
@@ -218,10 +213,10 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
for ( j=0; j < cAi.argc; j++ )
if ( cAi.argv[j] != NULL )
- free( cAi.argv[j] );
+ mir_free( cAi.argv[j] );
if ((char *)callRes != NULL )
- res = a2u(( char* )callRes );
+ res = mir_a2t(( char* )callRes );
}
else {
// unicode variables calls unicode plugin
@@ -231,7 +226,7 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
callRes = CallService( thisVr->szService, (WPARAM)0, (LPARAM)ai );
if (( TCHAR* )callRes != NULL )
- res = _tcsdup(( TCHAR* )callRes );
+ res = mir_tstrdup(( TCHAR* )callRes );
}
@@ -246,7 +241,7 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
if ( trCopy.memType == TR_MEM_MIRANDA )
mir_free(( void* )callRes );
// else if ( trCopy.memType == TR_MEM_VARIABLES )
-// free((void *)callRes);
+// mir_free((void *)callRes);
}
}
LeaveCriticalSection(&csRegister);
@@ -302,18 +297,18 @@ int deinitTokenRegister()
for ( i=0; i < tokens.count; i++ ) {
TokenRegisterEntry *tre = tokens.items[ i ];
if ( !( tre->tr.flags & TRF_PARSEFUNC ) && tre->tr.szService != NULL )
- free( tre->tr.szService );
+ mir_free( tre->tr.szService );
if ( tre->tr.tszTokenString != NULL )
- free( tre->tr.tszTokenString );
+ mir_free( tre->tr.tszTokenString );
if ( tre->tr.szHelpText != NULL )
- free( tre->tr.szHelpText );
+ mir_free( tre->tr.szHelpText );
if (( tre->tr.flags & TRF_CLEANUP ) && !( tre->tr.flags & TRF_CLEANUPFUNC ) && tre->tr.szCleanupService != NULL )
- free( tre->tr.szCleanupService );
+ mir_free( tre->tr.szCleanupService );
- free( tre );
+ mir_free( tre );
}
List_Destroy(( SortedList* )&tokens );
diff --git a/plugins/Variables/trigger_variables.cpp b/plugins/Variables/trigger_variables.cpp
index 16333b29e6..57ddfaff79 100644
--- a/plugins/Variables/trigger_variables.cpp
+++ b/plugins/Variables/trigger_variables.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -35,7 +35,7 @@ static int addToCache(DWORD triggerID) {
for (i=0;i<tvcCount;i++) {
if (tvc[i].triggerID == triggerID) {
- free(tvc[i].parsedText);
+ mir_free(tvc[i].parsedText);
MoveMemory(&tvc[i], &tvc[tvcCount-1], sizeof(TRG_VAR_CACHE));
tvcCount -= 1;
}
@@ -67,7 +67,7 @@ static int removeFromCache(DWORD triggerID) {
for (i=0;i<tvcCount;i++) {
if (tvc[i].triggerID == triggerID) {
- free(tvc[i].parsedText);
+ mir_free(tvc[i].parsedText);
MoveMemory(&tvc[i], &tvc[tvcCount-1], sizeof(TRG_VAR_CACHE));
tvcCount -= 1;
}
@@ -101,7 +101,7 @@ static VOID CALLBACK checkStringsTimer(HWND hwnd,UINT message,UINT_PTR idEvent,D
continue;
}
if (!_tcscmp(tvc[i].parsedText, parsedText)) {
- free(parsedText);
+ mir_free(parsedText);
continue;
}
else {
@@ -118,7 +118,7 @@ static VOID CALLBACK checkStringsTimer(HWND hwnd,UINT message,UINT_PTR idEvent,D
ri.td = &td;
CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- free(tvc[i].parsedText);
+ mir_free(tvc[i].parsedText);
tvc[i].parsedText = parsedText;
}
DBFreeVariant(&dbv);
@@ -163,7 +163,7 @@ INT_PTR CALLBACK DlgProcOptsStringChange(HWND hwndDlg, UINT msg, WPARAM wParam,
tszFormatText = Hlp_GetDlgItemText(hwndDlg, IDC_FORMATTEXT);
if (tszFormatText != NULL) {
DBWriteTriggerSettingTString(triggerID, NULL, MODULENAME, SETTING_TRIGGERTEXT, tszFormatText);
- free(tszFormatText);
+ mir_free(tszFormatText);
}
addToCache(triggerID);
break;
diff --git a/plugins/Variables/trigger_variables.h b/plugins/Variables/trigger_variables.h
index 39679dfa78..6b80087e2d 100644
--- a/plugins/Variables/trigger_variables.h
+++ b/plugins/Variables/trigger_variables.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
diff --git a/plugins/Variables/variables.cpp b/plugins/Variables/variables.cpp
index 448398cafc..83e6bd34e0 100644
--- a/plugins/Variables/variables.cpp
+++ b/plugins/Variables/variables.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -179,9 +179,9 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
for (pos = 0;pos < _tcslen(string);pos++) {
// string may move in memory, iterate by remembering the position in the string
cur = string+pos;
- // free memory from last iteration, this way we can bail out at any time in the loop
+ // mir_free memory from last iteration, this way we can bail out at any time in the loop
if (parsedToken != NULL)
- free(parsedToken);
+ mir_free(parsedToken);
for (i=0;i<argc;i++)
if (argv[i] != NULL)
@@ -247,7 +247,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
fi->eCount += 1;
continue;
}
- token = ( TCHAR* )malloc((tcur-scur+1)*sizeof(TCHAR));
+ token = ( TCHAR* )mir_alloc((tcur-scur+1)*sizeof(TCHAR));
if (token == NULL) {
fi->eCount += 1;
return NULL;
@@ -267,7 +267,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
}
if (tmpVarPos < 0)
tr = searchRegister(token, (*cur==_T(FIELD_CHAR))?TRF_FIELD:TRF_FUNCTION);
- free(token);
+ mir_free(token);
if (tmpVarPos < 0 && tr == NULL) {
fi->eCount += 1;
// token not found, continue
@@ -388,10 +388,10 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
pos--; // parse the same pos again, it changed
if ( tr == NULL )
- parsedToken = NULL; // To avoid free
+ parsedToken = NULL; // To avoid mir_free
}
if (parsedToken != NULL)
- free(parsedToken);
+ mir_free(parsedToken);
for ( i=0; i < argc; i++ )
if ( argv[i] != NULL )
@@ -440,11 +440,11 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
if (!(fi->flags&FIF_TCHAR)) {
copied = TRUE;
- log_debugA("a2u (%s)", fi->szExtraText);
- tszFormat = fi->szFormat!=NULL?a2u(fi->szFormat):NULL;
- tszSource = fi->szExtraText!=NULL?a2u(fi->szExtraText):NULL;
+ log_debugA("mir_a2t (%s)", fi->szExtraText);
+ tszFormat = fi->szFormat!=NULL?mir_a2t(fi->szFormat):NULL;
+ tszSource = fi->szExtraText!=NULL?mir_a2t(fi->szExtraText):NULL;
for(i = 0; i < fi->cbTemporaryVarsSize; i++) {
- fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i]!=NULL?a2u(fi->szaTemporaryVars[i]):NULL;
+ fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i]!=NULL?mir_a2t(fi->szaTemporaryVars[i]):NULL;
}
}
else {
@@ -468,14 +468,14 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
if (copied) {
if (tszFormat != NULL) {
- free(tszFormat);
+ mir_free(tszFormat);
}
if (tszSource != NULL) {
- free(tszSource);
+ mir_free(tszSource);
}
for(i = 0; i < fi->cbTemporaryVarsSize; i++) {
if (fi->tszaTemporaryVars != NULL) {
- free(fi->tszaTemporaryVars);
+ mir_free(fi->tszaTemporaryVars);
}
}
}
@@ -619,7 +619,7 @@ int LoadVarModule() {
fi.tszFormat = db_gets(SETTING_STARTUPTEXT, NULL);
if (fi.tszFormat != NULL) {
freeMemory((WPARAM)formatString(&fi), 0);
- free(fi.tszFormat);
+ mir_free(fi.tszFormat);
}
}
log_debugA("Variables: Init done");
diff --git a/plugins/Variables/variables.h b/plugins/Variables/variables.h
index 814a4263de..17de157cf1 100644
--- a/plugins/Variables/variables.h
+++ b/plugins/Variables/variables.h
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -167,8 +167,6 @@ INT_PTR showHelpExService(WPARAM wParam, LPARAM lParam);
INT_PTR getSkinItemService(WPARAM wParam, LPARAM lParam);
int iconsChanged(WPARAM wParam, LPARAM lParam);
-char* u2a( wchar_t* src );
-wchar_t* a2u( char* src );
int ttoi(TCHAR *string);
TCHAR *itot(int num);
diff --git a/plugins/helpers/db_helpers.cpp b/plugins/helpers/db_helpers.cpp
index cf58b4f3b2..ee33f8ada7 100644
--- a/plugins/helpers/db_helpers.cpp
+++ b/plugins/helpers/db_helpers.cpp
@@ -2,7 +2,7 @@
Helper functions for Miranda-IM (www.miranda-im.org)
Copyright 2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -31,7 +31,7 @@ static int DBRemoveEnumProc(const char *szSetting, LPARAM lParam) {
rs = (struct RemoveSettings *)lParam;
if (!strncmp(szSetting, rs->szPrefix, strlen(rs->szPrefix))) {
rs->szSettings = ( char** )realloc(rs->szSettings, (rs->count+1)*sizeof(char *));
- rs->szSettings[rs->count] = _strdup(szSetting);
+ rs->szSettings[rs->count] = mir_strdup(szSetting);
rs->count += 1;
}
@@ -61,10 +61,10 @@ int Hlp_RemoveDatabaseSettings(HANDLE hContact, char *szModule, char *szPrefix)
if (!DBDeleteContactSetting(hContact, szModule, rs.szSettings[i])) {
count += 1;
}
- free(rs.szSettings[i]);
+ mir_free(rs.szSettings[i]);
}
}
- free(rs.szSettings);
+ mir_free(rs.szSettings);
}
return count;
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp
index 87dd135c6f..2ac1b4212c 100644
--- a/plugins/helpers/gen_helpers.cpp
+++ b/plugins/helpers/gen_helpers.cpp
@@ -2,7 +2,7 @@
Helper functions for Miranda-IM (www.miranda-im.org)
Copyright 2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or 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.
@@ -30,23 +30,19 @@ int ProtoServiceExists(const char *szModule, const char *szService) {
char *Hlp_GetProtocolNameA(const char *proto) {
char protoname[256];
-
- if ( (!ProtoServiceExists(proto, PS_GETNAME)) || (CallProtoService(proto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))) {
+ if ( (!ProtoServiceExists(proto, PS_GETNAME)) || (CallProtoService(proto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname)))
return NULL;
- }
- return _strdup(protoname);
+ return mir_strdup(protoname);
}
TCHAR *Hlp_GetProtocolName(const char *proto) {
char protoname[256];
-
- if ( (!ProtoServiceExists(proto, PS_GETNAME)) || (CallProtoService(proto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))) {
+ if ( (!ProtoServiceExists(proto, PS_GETNAME)) || (CallProtoService(proto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname)))
return NULL;
- }
- return a2u(protoname);
+ return mir_a2t(protoname);
}
@@ -56,7 +52,7 @@ char *Hlp_GetDlgItemTextA(HWND hwndDlg, int nIDDlgItem) {
if (len < 0)
return NULL;
- char *res = ( char* )malloc((len+1));
+ char *res = ( char* )mir_alloc((len+1));
ZeroMemory(res, (len+1));
GetDlgItemTextA(hwndDlg, nIDDlgItem, res, len+1);
@@ -69,33 +65,33 @@ TCHAR *Hlp_GetDlgItemText(HWND hwndDlg, int nIDDlgItem) {
if (len < 0)
return NULL;
- TCHAR *res = ( TCHAR* )malloc((len+1)*sizeof(TCHAR));
+ TCHAR *res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
ZeroMemory(res, (len+1)*sizeof(TCHAR));
GetDlgItemText(hwndDlg, nIDDlgItem, res, len+1);
return res;
}
-char *Hlp_GetWindowTextA(HWND hwndDlg) {
-
+char *Hlp_GetWindowTextA(HWND hwndDlg)
+{
int len = SendMessageA(hwndDlg, WM_GETTEXTLENGTH, 0, 0);
if (len < 0)
return NULL;
- char *res = ( char* )malloc((len+1));
+ char *res = ( char* )mir_alloc((len+1));
ZeroMemory(res, (len+1));
GetWindowTextA(hwndDlg, res, len+1);
return res;
}
-TCHAR *Hlp_GetWindowText(HWND hwndDlg) {
-
+TCHAR *Hlp_GetWindowText(HWND hwndDlg)
+{
int len = SendMessage(hwndDlg, WM_GETTEXTLENGTH, 0, 0);
if (len < 0)
return NULL;
- TCHAR *res = ( TCHAR* )malloc((len+1)*sizeof(TCHAR));
+ TCHAR *res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
ZeroMemory(res, (len+1)*sizeof(TCHAR));
GetWindowText(hwndDlg, res, len+1);
@@ -106,51 +102,13 @@ TCHAR *Hlp_GetWindowText(HWND hwndDlg) {
* Modified from Miranda CList, clistsettings.c
**/
-char* u2a( wchar_t* src )
-{
- int cbLen;
- char* result;
-
- if (src == NULL) {
- return NULL;
- }
- cbLen = WideCharToMultiByte( CP_ACP, 0, src, -1, NULL, 0, NULL, NULL );
- result = ( char* )malloc( cbLen+1 );
- if ( result == NULL )
- return NULL;
-
- WideCharToMultiByte( CP_ACP, 0, src, -1, result, cbLen, NULL, NULL );
- result[ cbLen ] = 0;
- return result;
-}
-
-wchar_t* a2u( char* src )
-{
- int cbLen;
- wchar_t* result;
-
- if (src == NULL) {
- return NULL;
- }
- cbLen = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
- result = ( wchar_t* )malloc( sizeof( wchar_t )*(cbLen+1));
- if ( result == NULL )
- return NULL;
-
- MultiByteToWideChar( CP_ACP, 0, src, -1, result, cbLen );
- result[ cbLen ] = 0;
- return result;
-}
-
// Logging
static int WriteToDebugLogA(const char *szMsg) {
- int res;
-
- res = 0;
- if (ServiceExists(MS_NETLIB_LOG)) {
+ int res = 0;
+ if (ServiceExists(MS_NETLIB_LOG))
res = CallService(MS_NETLIB_LOG, (WPARAM)NULL, (LPARAM)szMsg);
- } else {
+ else {
OutputDebugStringA(szMsg);
OutputDebugStringA("\r\n");
}
@@ -158,8 +116,8 @@ static int WriteToDebugLogA(const char *szMsg) {
return res;
}
-int AddDebugLogMessageA(const char* fmt, ...) {
-
+int AddDebugLogMessageA(const char* fmt, ...)
+{
int res;
char szText[MAX_DEBUG], szFinal[MAX_DEBUG];
va_list va;
@@ -194,10 +152,10 @@ int AddDebugLogMessage(const TCHAR* fmt, ...) {
#endif
- szFinal = u2a(tszFinal);
+ szFinal = mir_t2a(tszFinal);
res = WriteToDebugLogA(szFinal);
- free(szFinal);
+ mir_free(szFinal);
return res;
}
@@ -239,11 +197,11 @@ int AddErrorLogMessage(const TCHAR* fmt, ...) {
#endif
- szFinal = u2a(tszFinal);
+ szFinal = mir_t2a(tszFinal);
res = WriteToDebugLogA(szFinal);
MessageBoxA(NULL, szFinal, "Error", MB_OK|MB_ICONERROR);
- free(szFinal);
+ mir_free(szFinal);
return res;
}
@@ -263,7 +221,7 @@ TCHAR *itot(int num) {
_itoa(num, tRes, 10);
- return a2u(tRes);
+ return mir_a2t(tRes);
}