diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-12 16:21:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-12 16:21:37 +0000 |
commit | 58ff50e5bf8dbb6b28d54370423232dc0221cd53 (patch) | |
tree | b71113e7574217421cb622e584f643df490e708a /plugins/TabSRMM/src | |
parent | c2cb7db85cbd67c5b95c2735d9b917eb0ac1d234 (diff) |
mir_alloc/calloc/free instead of simple malloc/calloc/free
git-svn-id: http://svn.miranda-ng.org/main/trunk@5660 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
26 files changed, 177 insertions, 188 deletions
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 06c3ff0d70..da368c2fd7 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -107,16 +107,16 @@ static void TSAPI LoadTheme(MButtonCtrl *ctl) int TSAPI TBStateConvert2Flat(int state)
{
switch (state) {
- case PBS_NORMAL:
- return TS_NORMAL;
- case PBS_HOT:
- return TS_HOT;
- case PBS_PRESSED:
- return TS_PRESSED;
- case PBS_DISABLED:
- return TS_DISABLED;
- case PBS_DEFAULTED:
- return TS_NORMAL;
+ case PBS_NORMAL:
+ return TS_NORMAL;
+ case PBS_HOT:
+ return TS_HOT;
+ case PBS_PRESSED:
+ return TS_PRESSED;
+ case PBS_DISABLED:
+ return TS_DISABLED;
+ case PBS_DEFAULTED:
+ return TS_NORMAL;
}
return TS_NORMAL;
}
@@ -375,12 +375,12 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_NCCREATE:
SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW);
- bct = (MButtonCtrl*)malloc(sizeof(MButtonCtrl));
+ bct = (MButtonCtrl*)mir_alloc(sizeof(MButtonCtrl));
if (bct == NULL)
return FALSE;
{
char *p = (char*)bct ;
- _DebugTraceA("SESSION_INFO allocated: crashes at %lp", p + offsetof(MButtonCtrl, cHot));
+ _DebugTraceA("MButtonCtrl allocated: crashes at %lp", p + offsetof(MButtonCtrl, cHot));
}
ZeroMemory(bct, sizeof(MButtonCtrl));
bct->hwnd = hwndDlg;
@@ -415,7 +415,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; // DONT! fall thru
case WM_NCDESTROY:
- free(bct);
+ mir_free(bct);
SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)NULL);
break;
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 58fed2cc7a..0e878bcb93 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -94,7 +94,7 @@ static int DBRemoveEnumProc(const char *szSetting, LPARAM lParam) RemoveSettings *rs = (RemoveSettings *)lParam;
if (!rs->szPrefix || !strncmp(szSetting, rs->szPrefix, strlen(rs->szPrefix))) {
- rs->szSettings = (char **)realloc(rs->szSettings, (rs->count + 1) * sizeof(char *));
+ rs->szSettings = (char **)mir_realloc(rs->szSettings, (rs->count + 1) * sizeof(char *));
rs->szSettings[rs->count] = _strdup(szSetting);
rs->count += 1;
}
@@ -124,10 +124,10 @@ static int Hlp_RemoveDatabaseSettings(HANDLE hContact, char *szModule, char *szP if (!db_unset(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/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index ee7830c91d..96c049f032 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -444,9 +444,9 @@ static TCHAR * _tcsrplc(TCHAR **src, const TCHAR *ptrn, const TCHAR *rplc) lRplc = lstrlen(rplc);
if (lPtrn && lSrc && lSrc >= lPtrn && (tszFound = _tcsstr(*src, ptrn)) != NULL) {
if (lRplc > lPtrn)
- *src = (TCHAR*) realloc((void*) * src,
+ *src = (TCHAR*) mir_realloc((void*) * src,
sizeof(TCHAR) * (lSrc + lRplc - lPtrn + 1));
- if (tszTail = (TCHAR*) malloc(sizeof(TCHAR) *
+ if (tszTail = (TCHAR*) mir_alloc(sizeof(TCHAR) *
(lSrc - (tszFound - *src) - lPtrn + 1))) {
/* save tail */
_tcscpy(tszTail, tszFound + lPtrn);
@@ -454,7 +454,7 @@ static TCHAR * _tcsrplc(TCHAR **src, const TCHAR *ptrn, const TCHAR *rplc) _tcscpy(tszFound, rplc);
/* write tail */
_tcscpy(tszFound + lRplc, tszTail);
- free((void*) tszTail);
+ mir_free((void*) tszTail);
}
}
return *src;
@@ -476,7 +476,7 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r if (lPtrn && lSrc && lSrc >= lPtrn && /* lengths are ok */
(tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */
(n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */
- (tszTail = (TCHAR*) malloc(sizeof(TCHAR) *
+ (tszTail = (TCHAR*) mir_alloc(sizeof(TCHAR) *
(lSrc - (tszFound - src) - lPtrn + 1))) != NULL) {
/* save tail */
_tcscpy(tszTail, tszFound + lPtrn);
@@ -484,7 +484,7 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r _tcscpy(tszFound, rplc);
/* write tail */
_tcscpy(tszFound + lRplc, tszTail);
- free((void*) tszTail);
+ mir_free(tszTail);
}
return src;
}
@@ -942,7 +942,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG CopyMemory(pbBuff, lstrdat->buffer + lstrdat->bufferOffset, *pcb);
lstrdat->bufferOffset += *pcb;
- // free stuff if the streaming operation is complete
+ // mir_free stuff if the streaming operation is complete
if (lstrdat->bufferOffset == lstrdat->bufferLen) {
mir_free(lstrdat->buffer);
lstrdat->buffer = NULL;
@@ -1323,7 +1323,6 @@ void LoadMsgLogBitmaps(void) void FreeMsgLogBitmaps(void)
{
- int i;
- for (i=0; i < SIZEOF(pLogIconBmpBits); i++)
+ for (int i=0; i < SIZEOF(pLogIconBmpBits); i++)
mir_free(pLogIconBmpBits[i]);
}
diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/chat/muchighlight.cpp index 1777657801..e5d96b3ea4 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.cpp +++ b/plugins/TabSRMM/src/chat/muchighlight.cpp @@ -34,18 +34,12 @@ void CMUCHighlight::cleanup()
{
- if (m_NickPatternString)
- mir_free(m_NickPatternString);
- if (m_TextPatternString)
- mir_free(m_TextPatternString);
-
+ mir_free(m_NickPatternString);
+ mir_free(m_TextPatternString);
m_TextPatternString = m_NickPatternString = 0;
- if (m_NickPatterns)
- mir_free(m_NickPatterns);
- if (m_TextPatterns)
- mir_free(m_TextPatterns);
-
+ mir_free(m_NickPatterns);
+ mir_free(m_TextPatterns);
m_iNickPatterns = m_iTextPatterns = 0;
m_NickPatterns = m_TextPatterns = 0;
}
@@ -194,8 +188,7 @@ skip_textpatterns: ::SendMessage(psi->dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)psi->dat->szStatusBar);
}
#endif
- if (tszMe)
- mir_free(tszMe);
+ mir_free(tszMe);
}
/*
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index bcbea06b5c..5419240089 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -580,7 +580,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
if (iLen > 0) {
- pszText = (TCHAR*)realloc(pszText, (iLen + 2) * sizeof(TCHAR));
+ pszText = (TCHAR*)mir_realloc(pszText, (iLen + 2) * sizeof(TCHAR));
GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
db_set_ts(NULL, "Chat", "AddToGroup", pszText);
} else
@@ -588,12 +588,11 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM g_Settings.hGroup = 0;
- if (pszText)
- free(pszText);
+ mir_free(pszText);
b = M.GetByte("Chat", "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, sizeof(branch1) / sizeof(branch1[0]));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, sizeof(branch2) / sizeof(branch2[0]));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2));
LoadGlobalSettings();
MM_FontsChanged();
@@ -1029,10 +1028,10 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (PluginConfig.m_chat_enabled) {
int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
if (iLen > 0) {
- TCHAR *pszText1 = (TCHAR*)malloc(iLen*sizeof(TCHAR) + 2);
+ TCHAR *pszText1 = (TCHAR*)mir_alloc(iLen*sizeof(TCHAR) + 2);
GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1);
db_set_ts(NULL, "Chat", "LogDirectory", pszText1);
- free(pszText1);
+ mir_free(pszText1);
g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED;
db_set_b(0, "Chat", "LoggingEnabled", g_Settings.bLoggingEnabled);
}
@@ -1053,28 +1052,28 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "LogTimestamp", pszText);
} else db_unset(NULL, "Chat", "LogTimestamp");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "HeaderTime", pszText);
} else db_unset(NULL, "Chat", "HeaderTime");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "HeaderIncoming", pszText);
} else db_unset(NULL, "Chat", "HeaderIncoming");
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
if (iLen > 0) {
- pszText = (char *)realloc(pszText, iLen + 1);
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
db_set_s(NULL, "Chat", "HeaderOutgoing", pszText);
} else db_unset(NULL, "Chat", "HeaderOutgoing");
@@ -1082,9 +1081,8 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen);
}
+ mir_free(pszText);
- if (pszText != NULL)
- free(pszText);
if (hListBkgBrush)
DeleteObject(hListBkgBrush);
hListBkgBrush = CreateSolidBrush(M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 835f1acc60..393a92e111 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -504,7 +504,7 @@ void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p) UpdateTrayMenu(dat, si->wStatus, si->pszModule, dat ? dat->szStatus : NULL, si->hContact, p->bHighlight ? 1 : 1);
}
- free(p);
+ mir_free(p);
}
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix)
@@ -513,7 +513,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight return FALSE;
TWindowData *dat = NULL;
- FLASH_PARAMS *params = (FLASH_PARAMS*)calloc(1, sizeof(FLASH_PARAMS));
+ FLASH_PARAMS *params = (FLASH_PARAMS*)mir_calloc( sizeof(FLASH_PARAMS));
params->hContact = si->hContact;
params->bInactive = TRUE;
if (si->hWnd && si->dat) {
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 20a0eb9d54..6e8359f036 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -1699,7 +1699,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (iCount != LB_ERR) {
int iSelectedItems = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
if (iSelectedItems != LB_ERR) {
- int *pItems = (int *)malloc(sizeof(int) * (iSelectedItems + 1));
+ int *pItems = (int *)mir_alloc(sizeof(int) * (iSelectedItems + 1));
if (pItems) {
if (SendMessage(hwnd, LB_GETSELITEMS, (WPARAM)iSelectedItems, (LPARAM)pItems) != LB_ERR) {
for (int i=0; i < iSelectedItems; i++) {
@@ -1708,7 +1708,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, DoEventHookAsync(hwndParent, parentdat->ptszID, parentdat->pszModule, GC_USER_NICKLISTMENU, ui1->pszUID, NULL, (LPARAM)uID);
}
}
- free(pItems);
+ mir_free(pItems);
}
}
}
@@ -1866,7 +1866,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TNewWindowData *newData = (TNewWindowData*)lParam;
si = (SESSION_INFO*)newData->hdbEvent;
- TWindowData *dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
+ TWindowData *dat = (TWindowData*)mir_calloc( sizeof(TWindowData));
dat->si = si;
dat->hContact = si->hContact;
dat->szProto = GetContactProto(si->hContact);
@@ -2871,8 +2871,8 @@ LABEL_SHOWWINDOW: USERINFO *ui = si->pUsers;
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr);
size_t bufSize = lstrlen(tr.lpstrText) + lstrlen(tszAplTmpl) + 3;
- tszTmp = tszAppeal = (TCHAR*)malloc(bufSize * sizeof(TCHAR));
- tr2.lpstrText = (LPTSTR) malloc(sizeof(TCHAR) * 2);
+ tszTmp = tszAppeal = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR));
+ tr2.lpstrText = (LPTSTR) mir_alloc(sizeof(TCHAR) * 2);
if (chr.cpMin) {
/* prepend nick with space if needed */
tr2.chrg.cpMin = chr.cpMin - 1;
@@ -2901,8 +2901,8 @@ LABEL_SHOWWINDOW: tszAppeal[st++] = _T('\0');
}
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)tszAppeal);
- free((void*) tr2.lpstrText);
- free((void*) tszAppeal);
+ mir_free((void*) tr2.lpstrText);
+ mir_free((void*) tszAppeal);
}
}
SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
@@ -3573,7 +3573,7 @@ LABEL_SHOWWINDOW: delete dat->Panel;
if (dat->pContainer->dwFlags & CNT_SIDEBAR)
dat->pContainer->SideBar->removeSession(dat);
- free(dat);
+ mir_free(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
}
break;
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 8dc00e2830..791e8d4a28 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -308,11 +308,11 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM lParam) if (m_history[m_iHistoryTop].szText == NULL) {
if (iLength < HISTORY_INITIAL_ALLOCSIZE)
iLength = HISTORY_INITIAL_ALLOCSIZE;
- m_history[m_iHistoryTop].szText = (TCHAR*)malloc(iLength);
+ m_history[m_iHistoryTop].szText = (TCHAR*)mir_alloc(iLength);
m_history[m_iHistoryTop].lLen = iLength;
} else {
if (iLength > m_history[m_iHistoryTop].lLen) {
- m_history[m_iHistoryTop].szText = (TCHAR*)realloc(m_history[m_iHistoryTop].szText, iLength);
+ m_history[m_iHistoryTop].szText = (TCHAR*)mir_realloc(m_history[m_iHistoryTop].szText, iLength);
m_history[m_iHistoryTop].lLen = iLength;
}
}
@@ -326,7 +326,7 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM lParam) }
}
if (szFromStream)
- free(szFromStream);
+ mir_free(szFromStream);
if (oldTop)
m_iHistoryTop = oldTop;
}
@@ -394,12 +394,12 @@ void CContactCache::allocHistory() m_iHistorySize = M.GetByte("historysize", 15);
if (m_iHistorySize < 10)
m_iHistorySize = 10;
- m_history = (TInputHistory *)malloc(sizeof(TInputHistory) * (m_iHistorySize + 1));
+ m_history = (TInputHistory *)mir_alloc(sizeof(TInputHistory) * (m_iHistorySize + 1));
m_iHistoryCurrent = 0;
m_iHistoryTop = 0;
if (m_history)
ZeroMemory(m_history, sizeof(TInputHistory) * m_iHistorySize);
- m_history[m_iHistorySize].szText = (TCHAR*)malloc((HISTORY_INITIAL_ALLOCSIZE + 1) * sizeof(TCHAR));
+ m_history[m_iHistorySize].szText = (TCHAR*)mir_alloc((HISTORY_INITIAL_ALLOCSIZE + 1) * sizeof(TCHAR));
m_history[m_iHistorySize].lLen = HISTORY_INITIAL_ALLOCSIZE;
}
@@ -418,10 +418,10 @@ void CContactCache::releaseAlloced() if (m_history) {
for (i=0; i <= m_iHistorySize; i++) {
if (m_history[i].szText != 0) {
- free(m_history[i].szText);
+ mir_free(m_history[i].szText);
}
}
- free(m_history);
+ mir_free(m_history);
m_history = 0;
}
if ( lstrcmp( m_tszProto, C_INVALID_PROTO_T ))
@@ -556,7 +556,7 @@ void CContactCache::cacheUpdateMetaChanged() * normalize the status message with proper cr/lf sequences.
* @param src TCHAR*: original status message
* @param fStripAll bool: strip all cr/lf sequences and replace them with spaces (use for title bar)
- * @return TCHAR*: converted status message. CALLER is responsible to free it, MUST use mir_free()
+ * @return TCHAR*: converted status message. CALLER is responsible to mir_free it, MUST use mir_free()
*/
TCHAR* CContactCache::getNormalizedStatusMsg(const TCHAR *src, bool fStripAll)
{
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 5246a123c8..e5e009636f 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -126,11 +126,11 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) }
/*
- * CreateContainer MUST malloc() a struct ContainerWindowData and pass its address
+ * CreateContainer MUST mir_alloc() a struct ContainerWindowData and pass its address
* to CreateDialogParam() via the LPARAM. It also adds the struct to the linked list
* of containers.
*
- * The WM_DESTROY handler of the container DlgProc is responsible for free()'ing the
+ * The WM_DESTROY handler of the container DlgProc is responsible for mir_free()'ing the
* pointer and for removing the struct from the linked list.
*/
@@ -139,7 +139,7 @@ TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hCont char *szKey = "TAB_ContainersW";
int iFirstFree = -1, iFound = FALSE;
- TContainerData *pContainer = (TContainerData *)calloc(sizeof(TContainerData), 1);
+ TContainerData *pContainer = (TContainerData *)mir_calloc( sizeof(TContainerData));
if (!pContainer)
return NULL;
@@ -175,7 +175,7 @@ TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hCont pContainer->iContainerIndex = i;
iFound = TRUE;
}
- else if (!_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN))
+ else if (!_tcsncmp(dbv.ptszVal, _T("**mir_free**"), CONTAINER_NAMELEN))
iFirstFree = i;
}
db_free(&dbv);
@@ -1279,7 +1279,7 @@ panel_found: szNewTitle = Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat);
if (szNewTitle) {
SetWindowText(hwndDlg, szNewTitle);
- free((void*)szNewTitle);
+ mir_free((void*)szNewTitle);
}
}
}
@@ -1576,7 +1576,7 @@ panel_found: if (pContainer->isCloned && pContainer->hContactFrom != 0) {
//if (pContainer->settings == 0)
- // pContainer->settings = (TContainerSettings *)malloc(sizeof(TContainerSettings));
+ // pContainer->settings = (TContainerSettings *)mir_alloc(sizeof(TContainerSettings));
//CopyMemory((void*)pContainer->settings, (void*)&PluginConfig.globalContainerSettings, sizeof(TContainerSettings));
//Utils::ReadContainerSettingsFromDB(pContainer->hContactFrom, pContainer->settings);
@@ -1896,13 +1896,13 @@ panel_found: if (pContainer->hwndStatus)
DestroyWindow(pContainer->hwndStatus);
- // free private theme...
+ // mir_free private theme...
if (pContainer->theme.isPrivate) {
- free(pContainer->ltr_templates);
- free(pContainer->rtl_templates);
- free(pContainer->theme.logFonts);
- free(pContainer->theme.fontColors);
- free(pContainer->theme.rtfFonts);
+ mir_free(pContainer->ltr_templates);
+ mir_free(pContainer->rtl_templates);
+ mir_free(pContainer->theme.logFonts);
+ mir_free(pContainer->theme.fontColors);
+ mir_free(pContainer->theme.rtfFonts);
}
if (pContainer->hwndTip)
@@ -1928,8 +1928,8 @@ panel_found: delete pContainer->MenuBar;
delete pContainer->SideBar;
if (pContainer->settings != &PluginConfig.globalContainerSettings)
- free(pContainer->settings);
- free(pContainer);
+ mir_free(pContainer->settings);
+ mir_free(pContainer);
}
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
@@ -2379,7 +2379,7 @@ void TSAPI DeleteContainer(int iIndex) if (!db_get_ts(NULL, szKey, szIndex, &dbv)) {
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
TCHAR *wszContainerName = dbv.ptszVal;
- db_set_ts(NULL, szKey, szIndex, _T("**free**"));
+ db_set_ts(NULL, szKey, szIndex, _T("**mir_free**"));
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
DBVARIANT dbv_c;
@@ -2464,7 +2464,7 @@ HMENU TSAPI BuildContainerMenu() break;
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
- if (_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN))
+ if (_tcsncmp(dbv.ptszVal, _T("**mir_free**"), CONTAINER_NAMELEN))
AppendMenu(hMenu, MF_STRING, IDM_CONTAINERMENU + i, !_tcscmp(dbv.ptszVal, _T("default")) ?
TranslateT("Default container") : dbv.ptszVal);
}
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 7aaa6cb651..f3f494c08f 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -279,7 +279,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, mir_snprintf(szCname, 40, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex);
pContainer->settings->fPrivate = false;
db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings));
- free(pContainer->settings);
+ mir_free(pContainer->settings);
}
pContainer->settings = &PluginConfig.globalContainerSettings;
pContainer->settings->fPrivate = false;
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 3786788f74..0aaaa2952a 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -603,7 +603,7 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) DBEVENTINFO dbe = { sizeof(dbe) };
if (pdata->pluginOptions->bPreview && hContact) {
dbe.cbBlob = db_event_getBlobSize(hEvent);
- dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
+ dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob);
}
db_event_get(hEvent, &dbe);
@@ -648,7 +648,7 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) pdata->eventData = (EVENT_DATAT *)mir_realloc(pdata->eventData, pdata->nrEventsAlloced * sizeof(EVENT_DATAT));
}
if (dbe.pBlob)
- free(dbe.pBlob);
+ mir_free(dbe.pBlob);
CallService(MS_POPUP_CHANGETEXTT, (WPARAM)pdata->hWnd, (LPARAM)lpzText);
return 0;
@@ -667,7 +667,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent // fix for a crash
if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
dbe.cbBlob = db_event_getBlobSize(hEvent);
- dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
+ dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob);
}
db_event_get(hEvent, &dbe);
@@ -737,7 +737,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent else PopupList.push_back(pdata);
if (dbe.pBlob)
- free(dbe.pBlob);
+ mir_free(dbe.pBlob);
return 0;
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 0ef7069e3c..364fa2a8ed 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -867,7 +867,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) if (szStreamOut != NULL) {
SETTEXTEX stx = {ST_DEFAULT, CP_UTF8};
SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szStreamOut);
- free(szStreamOut);
+ mir_free(szStreamOut);
}
}
@@ -1099,7 +1099,7 @@ LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM w if (hClip) {
HGLOBAL hgbl;
TCHAR *tszLocked;
- TCHAR *tszText = (TCHAR*)malloc((lstrlen((TCHAR*)hClip) + 2) * sizeof(TCHAR));
+ TCHAR *tszText = (TCHAR*)mir_alloc((lstrlen((TCHAR*)hClip) + 2) * sizeof(TCHAR));
lstrcpy(tszText, (TCHAR*)hClip);
Utils::FilterEventMarkers(tszText);
@@ -1111,7 +1111,7 @@ LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM w GlobalUnlock(hgbl);
SetClipboardData(CF_UNICODETEXT, hgbl);
if (tszText)
- free(tszText);
+ mir_free(tszText);
}
CloseClipboard();
}
@@ -1644,7 +1644,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam) TCHAR szBuf[100];
if (dat->iNextQueuedEvent >= dat->iEventQueueSize) {
- dat->hQueuedEvents = (HANDLE *)realloc(dat->hQueuedEvents, (dat->iEventQueueSize + 10) * sizeof(HANDLE));
+ dat->hQueuedEvents = (HANDLE *)mir_realloc(dat->hQueuedEvents, (dat->iEventQueueSize + 10) * sizeof(HANDLE));
dat->iEventQueueSize += 10;
}
dat->hQueuedEvents[dat->iNextQueuedEvent++] = hDbEvent;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 565705a020..081ea47669 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -431,13 +431,13 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case DM_SENDMESSAGECOMMANDW:
SendMessageCommand_W(wParam, lParam);
if (lParam)
- free((void*)lParam);
+ mir_free((void*)lParam);
return 0;
case DM_SENDMESSAGECOMMAND:
SendMessageCommand(wParam, lParam);
if (lParam)
- free((void*)lParam);
+ mir_free((void*)lParam);
return 0;
/*
diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h index 86caf2b1a9..d17a5220a2 100644 --- a/plugins/TabSRMM/src/infopanel.h +++ b/plugins/TabSRMM/src/infopanel.h @@ -77,8 +77,7 @@ public: CTip (const HWND hwndParent, const HANDLE hContact, const TCHAR *pszText = 0, const CInfoPanel *panel = 0);
~CTip()
{
- if (m_pszText)
- mir_free(m_pszText);
+ mir_free(m_pszText);
}
void show (const RECT& rc, POINT& pt, const HICON hIcon = 0, const TCHAR *szTitle = 0);
const HWND getHwnd () const { return(m_hwnd); }
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 6f46ca8d01..ab30dd53d6 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -130,7 +130,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) menulimit = M.GetByte("tabmodplus","MenuCount", 0);
if ( menulimit ) {
hMenu = CreatePopupMenu();
- //pszMenu=malloc(menulimit*sizeof(TCHAR*));
+ //pszMenu=mir_alloc(menulimit*sizeof(TCHAR*));
} else break;
for ( menunum=0;menunum<menulimit;menunum++ ) {
pszMenu[menunum]=getMenuEntry(menunum);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 3dade62354..07eacac903 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1275,7 +1275,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TNewWindowData *newData = (TNewWindowData *) lParam;
- dat = (TWindowData*)calloc(sizeof(TWindowData), 1);
+ dat = (TWindowData*)mir_calloc(sizeof(TWindowData));
if (newData->iTabID >= 0) {
dat->pContainer = newData->pContainer;
m_pContainer = dat->pContainer;
@@ -1337,7 +1337,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->sendMode |= dat->hContact == 0 ? SMODE_MULTIPLE : 0;
dat->sendMode |= M.GetByte(dat->hContact, "no_ack", 0) ? SMODE_NOACK : 0;
- dat->hQueuedEvents = (HANDLE*)calloc(sizeof(HANDLE), EVENT_QUEUE_SIZE);
+ dat->hQueuedEvents = (HANDLE*)mir_calloc(sizeof(HANDLE) * EVENT_QUEUE_SIZE);
dat->iEventQueueSize = EVENT_QUEUE_SIZE;
dat->iCurrentQueueError = -1;
@@ -1349,7 +1349,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->maxHistory = M.GetDword(dat->hContact, "maxhist", M.GetDword("maxhist", 0));
dat->curHistory = 0;
if (dat->maxHistory)
- dat->hHistoryEvents = (HANDLE *)malloc(dat->maxHistory * sizeof(HANDLE));
+ dat->hHistoryEvents = (HANDLE *)mir_alloc(dat->maxHistory * sizeof(HANDLE));
else
dat->hHistoryEvents = NULL;
@@ -2199,7 +2199,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (streamOut) {
Utils::FilterEventMarkers(streamOut);
SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
- free(streamOut);
+ mir_free(streamOut);
}
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
} else if (M.GetByte("autocopy", 1) && !isShift) {
@@ -2983,7 +2983,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP InvalidateRect(hwndEdit, NULL, FALSE);
if (memRequired > dat->iSendBufferSize) {
- dat->sendBuffer = (char *) realloc(dat->sendBuffer, memRequired);
+ dat->sendBuffer = (char *) mir_realloc(dat->sendBuffer, memRequired);
dat->iSendBufferSize = memRequired;
}
if (utfResult) {
@@ -2997,7 +2997,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
mir_free(decoded);
}
- free(streamOut);
+ mir_free(streamOut);
}
if (memRequired == 0 || dat->sendBuffer[0] == 0)
break;
@@ -3027,7 +3027,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
if (szFromStream)
- free(szFromStream);
+ mir_free(szFromStream);
}
// END /all /MOD
if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
@@ -3076,7 +3076,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP szQuoted = QuoteText(selected, iCharsPerLine, 0);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
if (szQuoted)
- free(szQuoted);
+ mir_free(szQuoted);
break;
}
else {
@@ -3094,7 +3094,7 @@ quote_from_last: if (sel.cpMin == sel.cpMax) {
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = db_event_getBlobSize(hDBEvent);
- szText = (TCHAR*)malloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
+ szText = (TCHAR*)mir_alloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf
dbei.pBlob = (BYTE *)szText;
db_event_get(hDBEvent, &dbei);
iSize = (int)(strlen((char *)dbei.pBlob)) + 1;
@@ -3106,7 +3106,7 @@ quote_from_last: if (iSize != dbei.cbBlob)
szConverted = (TCHAR*) & dbei.pBlob[iSize];
else {
- szConverted = (TCHAR*)malloc(sizeof(TCHAR) * iSize);
+ szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * iSize);
iAlloced = TRUE;
MultiByteToWideChar(CP_ACP, 0, (char *) dbei.pBlob, -1, szConverted, iSize);
}
@@ -3117,14 +3117,14 @@ quote_from_last: MoveMemory(szText + iDescr + 2, szText + sizeof(DWORD) + iDescr, dbei.cbBlob - iDescr - sizeof(DWORD) - 1);
szText[iDescr] = '\r';
szText[iDescr+1] = '\n';
- szConverted = (TCHAR*)malloc(sizeof(TCHAR) * (1 + lstrlenA((char *)szText)));
+ szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR) * (1 + lstrlenA((char *)szText)));
MultiByteToWideChar(CP_ACP, 0, (char *) szText, -1, szConverted, 1 + lstrlenA((char *)szText));
iAlloced = TRUE;
}
szQuoted = QuoteText(szConverted, iCharsPerLine, 0);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
- free(szText);
- free(szQuoted);
+ mir_free(szText);
+ mir_free(szQuoted);
if (iAlloced)
mir_free(szConverted);
}
@@ -3134,9 +3134,9 @@ quote_from_last: Utils::FilterEventMarkers(converted);
szQuoted = QuoteText(converted, iCharsPerLine, 0);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted);
- free(szQuoted);
+ mir_free(szQuoted);
mir_free(converted);
- free(szFromStream);
+ mir_free(szFromStream);
}
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
@@ -3615,7 +3615,7 @@ quote_from_last: char *msg = Message_GetFromStream(GetDlgItem(hwndDlg, IDC_MESSAGE), dat, (CP_UTF8 << 16) | (SF_TEXT | SF_USECODEPAGE));
if (msg) {
db_set_s(dat->hContact, SRMSGMOD, "SavedMsg", msg);
- free(msg);
+ mir_free(msg);
} else
db_set_s(dat->hContact, SRMSGMOD, "SavedMsg", "");
}
@@ -3630,12 +3630,12 @@ quote_from_last: DM_FreeTheme(dat);
if (dat->sendBuffer != NULL)
- free(dat->sendBuffer);
+ mir_free(dat->sendBuffer);
if (dat->hHistoryEvents)
- free(dat->hHistoryEvents);
+ mir_free(dat->hHistoryEvents);
/*
- * search the sendqueue for unfinished send jobs and free them. Leave unsent
+ * search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
* messages in the queue as they can be acked later
*/
{
@@ -3657,7 +3657,7 @@ quote_from_last: }
if (dat->hQueuedEvents)
- free(dat->hQueuedEvents);
+ mir_free(dat->hQueuedEvents);
if (dat->hSmileyIcon)
DestroyIcon(dat->hSmileyIcon);
@@ -3748,7 +3748,7 @@ quote_from_last: CallService(MS_DB_CONTACT_DELETE, (WPARAM)dat->hContact, 0);
delete dat->Panel;
- free(dat);
+ mir_free(dat);
}
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 0c359630a9..2c734a008d 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -742,7 +742,7 @@ int TSAPI CheckValidSmileyPack(const char *szProto, HANDLE hContact) }
/*
- * return value MUST be free()'d by caller.
+ * return value MUST be mir_free()'d by caller.
*/
TCHAR* TSAPI QuoteText(const TCHAR *text, int charsPerLine, int removeExistingQuotes)
@@ -752,13 +752,13 @@ TCHAR* TSAPI QuoteText(const TCHAR *text, int charsPerLine, int removeExistingQu TCHAR *strout;
bufSize = lstrlenW(text) + 23;
- strout = (TCHAR*)malloc(bufSize * sizeof(TCHAR));
+ strout = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR));
inChar = 0;
justDoneLineBreak = 1;
for (outChar = 0, lineChar = 0;text[inChar];) {
if (outChar >= bufSize - 8) {
bufSize += 20;
- strout = (TCHAR*)realloc(strout, bufSize * sizeof(TCHAR));
+ strout = (TCHAR*)mir_realloc(strout, bufSize * sizeof(TCHAR));
}
if (justDoneLineBreak && text[inChar] != '\r' && text[inChar] != '\n') {
if (removeExistingQuotes)
@@ -928,13 +928,13 @@ static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, char ** ppText = (char **) dwCookie;
if (*ppText == NULL) {
- *ppText = (char *)malloc(cb + 2);
+ *ppText = (char *)mir_alloc(cb + 2);
CopyMemory(*ppText, pbBuff, cb);
*pcb = cb;
dwRead = cb;
*(*ppText + cb) = '\0';
} else {
- char *p = (char *)realloc(*ppText, dwRead + cb + 2);
+ char *p = (char *)mir_realloc(*ppText, dwRead + cb + 2);
CopyMemory(p + dwRead, pbBuff, cb);
*ppText = p;
*pcb = cb;
@@ -947,7 +947,7 @@ static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, /*
* retrieve contents of the richedit control by streaming. Used to get the
* typed message before sending it.
- * caller must free the returned pointer.
+ * caller must mir_free the returned pointer.
* UNICODE version returns UTF-8 encoded string.
*/
@@ -2087,17 +2087,17 @@ void TSAPI LoadOverrideTheme(TContainerData *pContainer) return;
}
if (pContainer->ltr_templates == NULL) {
- pContainer->ltr_templates = (TTemplateSet *)malloc(sizeof(TTemplateSet));
+ pContainer->ltr_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet));
CopyMemory(pContainer->ltr_templates, <R_Active, sizeof(TTemplateSet));
}
if (pContainer->rtl_templates == NULL) {
- pContainer->rtl_templates = (TTemplateSet *)malloc(sizeof(TTemplateSet));
+ pContainer->rtl_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet));
CopyMemory(pContainer->rtl_templates, &RTL_Active, sizeof(TTemplateSet));
}
- pContainer->theme.logFonts = (LOGFONTA *)malloc(sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2));
- pContainer->theme.fontColors = (COLORREF *)malloc(sizeof(COLORREF) * (MSGDLGFONTCOUNT + 2));
- pContainer->theme.rtfFonts = (char *)malloc((MSGDLGFONTCOUNT + 2) * RTFCACHELINESIZE);
+ pContainer->theme.logFonts = (LOGFONTA *)mir_alloc(sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2));
+ pContainer->theme.fontColors = (COLORREF *)mir_alloc(sizeof(COLORREF) * (MSGDLGFONTCOUNT + 2));
+ pContainer->theme.rtfFonts = (char *)mir_alloc((MSGDLGFONTCOUNT + 2) * RTFCACHELINESIZE);
ReadThemeFromINI(pContainer->szAbsThemeFile, pContainer, bReadTemplates ? 0 : 1, THEME_READ_ALL);
pContainer->theme.left_indent *= 15;
@@ -2237,7 +2237,7 @@ static void TSAPI MTH_updatePreview(const TWindowData *dat) HWND hwndEdit = GetDlgItem(dat->hwnd, dat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE);
int len = GetWindowTextLengthA(hwndEdit);
RECT windRect;
- char * thestr = (char *)malloc(len + 5);
+ char * thestr = (char *)mir_alloc(len + 5);
GetWindowTextA(hwndEdit, thestr, len + 1);
GetWindowRect(dat->pContainer->hwnd, &windRect);
@@ -2248,7 +2248,7 @@ static void TSAPI MTH_updatePreview(const TWindowData *dat) CallService(MTH_SETFORMULA, 0, (LPARAM)thestr);
CallService(MTH_RESIZE, 0, (LPARAM)&mathWndInfo);
- free(thestr);
+ mir_free(thestr);
}
void TSAPI MTH_updateMathWindow(const TWindowData *dat)
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 696445170f..d96c398f13 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -225,7 +225,7 @@ static void AppendToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced if (charsDone >= 0)
break;
*cbBufferAlloced += 1024;
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
va_end(va);
*cbBufferEnd += charsDone;
@@ -239,7 +239,7 @@ static int AppendUnicodeToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferA int lineLen = (int)(wcslen(line)) * 9 + 8;
if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
cbBufferAlloced[0] += (lineLen + 1024UL - lineLen % 1024UL);
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
d = *buffer + *cbBufferEnd;
@@ -335,7 +335,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int if (charsDone >= 0)
break;
*cbBufferAlloced += 1024;
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
va_end(va);
*cbBufferEnd += charsDone;
@@ -351,7 +351,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int if (*cbBufferEnd + 5 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
switch (tag) {
case 'b':
@@ -367,7 +367,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int continue;
case 's':
*cbBufferAlloced += 20;
- *buffer = (char *)realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
MoveMemory(*buffer + i + 6, *buffer + i + 1, (*cbBufferEnd - i) + 1);
CopyMemory(*buffer + i, begin ? "\\strike1 " : "\\strike0 ", begin ? 9 : 9);
*cbBufferEnd += 5;
@@ -392,7 +392,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int if ((*buffer)[i] == '\r' && (*buffer)[i + 1] == '\n') {
if (*cbBufferEnd + 5 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 6, *buffer + i + 2, *cbBufferEnd - i - 1);
CopyMemory(*buffer + i, "\\line ", 6);
@@ -400,7 +400,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int } else if ((*buffer)[i] == '\n') {
if (*cbBufferEnd + 6 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 6, *buffer + i + 1, *cbBufferEnd - i);
CopyMemory(*buffer + i, "\\line ", 6);
@@ -408,7 +408,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int } else if ((*buffer)[i] == '\t') {
if (*cbBufferEnd + 5 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 5, *buffer + i + 1, *cbBufferEnd - i);
CopyMemory(*buffer + i, "\\tab ", 5);
@@ -416,7 +416,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int } else if ((*buffer)[i] == '\\' || (*buffer)[i] == '{' || (*buffer)[i] == '}') {
if (*cbBufferEnd + 2 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 1, *buffer + i, *cbBufferEnd - i + 1);
(*buffer)[i] = '\\';
@@ -501,7 +501,7 @@ static void Build_RTF_Header(char **buffer, int *bufferEnd, int *bufferAlloced, }
-//free() the return value
+//mir_free() the return value
static char *CreateRTFHeader(TWindowData *dat)
{
char *buffer;
@@ -509,7 +509,7 @@ static char *CreateRTFHeader(TWindowData *dat) bufferEnd = 0;
bufferAlloced = 1024;
- buffer = (char *) malloc(bufferAlloced);
+ buffer = (char *) mir_alloc(bufferAlloced);
buffer[0] = '\0';
Build_RTF_Header(&buffer, &bufferEnd, &bufferAlloced, dat);
@@ -527,7 +527,7 @@ static void AppendTimeStamp(TCHAR *szFinalTimestamp, int isSent, char **buffer, }
}
-//free() the return value
+//mir_free() the return value
static char *CreateRTFTail(TWindowData *dat)
{
char *buffer;
@@ -535,7 +535,7 @@ static char *CreateRTFTail(TWindowData *dat) bufferEnd = 0;
bufferAlloced = 1024;
- buffer = (char *) malloc(bufferAlloced);
+ buffer = (char *) mir_alloc(bufferAlloced);
buffer[0] = '\0';
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "}");
return buffer;
@@ -582,7 +582,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, HANDLE hContact, HA bufferEnd = 0;
bufferAlloced = 1024;
- buffer = (char *) malloc(bufferAlloced);
+ buffer = (char *) mir_alloc(bufferAlloced);
buffer[0] = '\0';
if (streamData->dbei != 0)
@@ -591,14 +591,14 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, HANDLE hContact, HA dbei.cbSize = sizeof(dbei);
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == -1) {
- free(buffer);
+ mir_free(buffer);
return NULL;
}
- dbei.pBlob = (PBYTE) malloc(dbei.cbBlob);
+ dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob);
db_event_get(hDbEvent, &dbei);
if (!DbEventIsShown(dat, &dbei)) {
- free(dbei.pBlob);
- free(buffer);
+ mir_free(dbei.pBlob);
+ mir_free(buffer);
return NULL;
}
}
@@ -609,8 +609,8 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, HANDLE hContact, HA if (rtfMessage == NULL) {
msg = DbGetEventTextT(&dbei, dat->codePage);
if (!msg) {
- free(dbei.pBlob);
- free(buffer);
+ mir_free(dbei.pBlob);
+ mir_free(buffer);
return NULL;
}
TrimMessage(msg);
@@ -1150,7 +1150,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, HANDLE hContact, HA AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\par");
if (streamData->dbei == 0)
- free(dbei.pBlob);
+ mir_free(dbei.pBlob);
dat->iLastEventType = MAKELONG((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)), dbei.eventType);
dat->lastEventTime = dbei.timestamp;
@@ -1165,14 +1165,14 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG dat->bufferOffset = 0;
switch (dat->stage) {
case STREAMSTAGE_HEADER:
- if (dat->buffer) free(dat->buffer);
+ if (dat->buffer) mir_free(dat->buffer);
dat->buffer = CreateRTFHeader(dat->dlgDat);
dat->stage = STREAMSTAGE_EVENTS;
break;
case STREAMSTAGE_EVENTS:
if (dat->eventsToInsert) {
do {
- if (dat->buffer) free(dat->buffer);
+ if (dat->buffer) mir_free(dat->buffer);
dat->buffer = Template_CreateRTFFromDbEvent(dat->dlgDat, dat->hContact, dat->hDbEvent, !dat->isEmpty, dat);
if (dat->buffer)
dat->hDbEventLast = dat->hDbEvent;
@@ -1188,7 +1188,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG dat->stage = STREAMSTAGE_TAIL;
//fall through
case STREAMSTAGE_TAIL: {
- if (dat->buffer) free(dat->buffer);
+ if (dat->buffer) mir_free(dat->buffer);
dat->buffer = CreateRTFTail(dat->dlgDat);
dat->stage = STREAMSTAGE_STOP;
break;
@@ -1203,7 +1203,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG CopyMemory(pbBuff, dat->buffer + dat->bufferOffset, *pcb);
dat->bufferOffset += *pcb;
if (dat->bufferOffset == dat->bufferLen) {
- free(dat->buffer);
+ mir_free(dat->buffer);
dat->buffer = NULL;
}
return 0;
@@ -1402,7 +1402,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, TRUE, 0);
InvalidateRect(GetDlgItem(hwndDlg, IDC_LOG), NULL, FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_QUOTE), dat->hDbEventLast != NULL);
- if (streamData.buffer) free(streamData.buffer);
+ if (streamData.buffer) mir_free(streamData.buffer);
}
static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppend, BOOL isSent)
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 220fa49018..f875050f99 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -140,7 +140,7 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox) M.pathToRelative(tszFinalName, tszRel, M.getSkinPath());
if ((lr = SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)szBuf)) != CB_ERR) {
- TCHAR *idata = (TCHAR*)malloc((lstrlen(tszRel) + 1) * sizeof(TCHAR));
+ TCHAR *idata = (TCHAR*)mir_alloc((lstrlen(tszRel) + 1) * sizeof(TCHAR));
_tcscpy(idata, tszRel);
SendMessage(hwndCombobox, CB_SETITEMDATA, lr, (LPARAM)idata);
@@ -206,7 +206,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox) }
/**
- * free the item extra data (used to store the skin filenames for
+ * mir_free the item extra data (used to store the skin filenames for
* each entry).
*/
static void TSAPI FreeComboData(HWND hwndCombobox)
@@ -217,7 +217,7 @@ static void TSAPI FreeComboData(HWND hwndCombobox) void *idata = (void*)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
if (idata && idata != (void*)CB_ERR)
- free(idata);
+ mir_free(idata);
}
}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index d4459839bb..a8a444b2de 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -314,7 +314,7 @@ INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam) if (GetCurrentThreadId() != PluginConfig.dwThreadID) {
if (lParam) {
unsigned iLen = lstrlenW((wchar_t *)lParam);
- wchar_t *tszText = (wchar_t *)malloc((iLen + 1) * sizeof(wchar_t));
+ wchar_t *tszText = (wchar_t *)mir_alloc((iLen + 1) * sizeof(wchar_t));
wcsncpy(tszText, (wchar_t *)lParam, iLen + 1);
tszText[iLen] = 0;
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SENDMESSAGECOMMANDW, wParam, (LPARAM)tszText);
@@ -369,7 +369,7 @@ INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) if (GetCurrentThreadId() != PluginConfig.dwThreadID) {
if (lParam) {
unsigned iLen = lstrlenA((char *)lParam);
- char *szText = (char *)malloc(iLen + 1);
+ char *szText = (char *)mir_alloc(iLen + 1);
strncpy(szText, (char *)lParam, iLen + 1);
szText[iLen] = 0;
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SENDMESSAGECOMMAND, wParam, (LPARAM)szText);
@@ -450,7 +450,7 @@ int SplitmsgShutdown(void) FreeTabConfig();
if (Utils::rtf_ctable)
- free(Utils::rtf_ctable);
+ mir_free(Utils::rtf_ctable);
UnloadTSButtonModule();
diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index 515e6350a0..9dc569f9ff 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -187,7 +187,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (db_get_ts(NULL, szKey, szValue, &dbv))
break; // end of list
if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) {
- if (_tcsncmp(dbv.ptszVal, _T("**free**"), CONTAINER_NAMELEN)) {
+ if (_tcsncmp(dbv.ptszVal, _T("**mir_free**"), CONTAINER_NAMELEN)) {
iItemNew = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_ADDSTRING, 0, (LPARAM)(!_tcscmp(dbv.ptszVal, _T("default")) ?
TranslateT("Default container") : dbv.ptszVal));
if (iItemNew != LB_ERR)
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 676d0df6de..abdb49aba1 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -81,7 +81,7 @@ int SendQueue::addTo(TWindowData *dat, const int iLen, int dwFlags) return 0;
}
/*
- * find a free entry in the send queue...
+ * find a mir_free entry in the send queue...
*/
for (i=0; i < NR_SENDJOBS; i++) {
if (m_jobs[i].hOwner != 0 || m_jobs[i].iStatus != 0) {
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 92c8ce0bf6..9e0e62cd46 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -139,8 +139,8 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP TemplateEditorNew *teNew = (TemplateEditorNew *)lParam;
COLORREF url_visited = RGB(128, 0, 128);
COLORREF url_unvisited = RGB(0, 0, 255);
- dat = (TWindowData*)calloc( sizeof(TWindowData), 1);
- dat->pContainer = (TContainerData *)malloc(sizeof(TContainerData));
+ dat = (TWindowData*)mir_calloc( sizeof(TWindowData));
+ dat->pContainer = (TContainerData *)mir_alloc(sizeof(TContainerData));
ZeroMemory((void*)dat->pContainer, sizeof(TContainerData));
teInfo = (TemplateEditorInfo *)dat->pContainer;
ZeroMemory((void*)teInfo, sizeof(TemplateEditorInfo));
@@ -378,9 +378,9 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP Utils::enableDlgControl(teInfo->hwndParent, IDC_MODIFY, TRUE);
Utils::enableDlgControl(teInfo->hwndParent, IDC_RTLMODIFY, TRUE);
if (dat->pContainer)
- free(dat->pContainer);
+ mir_free(dat->pContainer);
if (dat)
- free(dat);
+ mir_free(dat);
db_set_dw(0, SRMSGMOD_T, "cc1", SendDlgItemMessage(hwndDlg, IDC_COLOR1, CPM_GETCOLOUR, 0, 0));
db_set_dw(0, SRMSGMOD_T, "cc2", SendDlgItemMessage(hwndDlg, IDC_COLOR2, CPM_GETCOLOUR, 0, 0));
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 8cbcbca575..6f0113ae75 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -937,7 +937,7 @@ void CImageItem::SetBitmap32Alpha(HBITMAP hBitmap, BYTE bAlpha) return;
DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8);
- BYTE *p = (BYTE *)malloc(dwLen);
+ BYTE *p = (BYTE *)mir_alloc(dwLen);
if (p == NULL)
return;
memset(p, 0, dwLen);
@@ -953,7 +953,7 @@ void CImageItem::SetBitmap32Alpha(HBITMAP hBitmap, BYTE bAlpha) }
}
SetBitmapBits(hBitmap, bmp.bmWidth * bmp.bmHeight * 4, p);
- free(p);
+ mir_free(p);
}
void CImageItem::PreMultiply(HBITMAP hBitmap, int mode)
@@ -964,7 +964,7 @@ void CImageItem::PreMultiply(HBITMAP hBitmap, int mode) int width = bmp.bmWidth;
int height = bmp.bmHeight;
DWORD dwLen = width * height * 4;
- BYTE *p = (BYTE *)malloc(dwLen);
+ BYTE *p = (BYTE *)mir_alloc(dwLen);
if (p) {
::GetBitmapBits(hBitmap, dwLen, p);
for (int y = 0; y < height; ++y) {
@@ -982,7 +982,7 @@ void CImageItem::PreMultiply(HBITMAP hBitmap, int mode) }
}
dwLen = ::SetBitmapBits(hBitmap, dwLen, p);
- free(p);
+ mir_free(p);
}
}
@@ -1001,7 +1001,7 @@ void CImageItem::Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha width = bmp.bmWidth;
height = bmp.bmHeight;
dwLen = width * height * 4;
- p = (BYTE *)malloc(dwLen);
+ p = (BYTE *)mir_alloc(dwLen);
if (p) {
::GetBitmapBits(hBitmap, dwLen, p);
for (y = 0; y < height; ++y) {
@@ -1016,7 +1016,7 @@ void CImageItem::Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha }
}
dwLen = ::SetBitmapBits(hBitmap, dwLen, p);
- free(p);
+ mir_free(p);
}
}
@@ -1101,7 +1101,7 @@ bool CSkin::warnToClose() const }
/**
- * free the aero tab bitmaps
+ * mir_free the aero tab bitmaps
* only called on exit, NOT when a skin is unloaded as these elements
* are always needed (even without a skin)
*/
@@ -1406,7 +1406,7 @@ void CSkin::Load(void) return;
TCHAR *p;
- TCHAR *szSections = (TCHAR*)malloc(6004);
+ TCHAR *szSections = (TCHAR*)mir_alloc(6004);
int i = 1, j = 0;
UINT data;
TCHAR buffer[500];
@@ -1547,7 +1547,7 @@ void CSkin::Load(void) else
CSkin::m_DefaultFontColor = GetSysColor(COLOR_BTNTEXT);
buffer[499] = 0;
- free(szSections);
+ mir_free(szSections);
LoadItems();
::FreeTabConfig();
@@ -1573,7 +1573,7 @@ void CSkin::LoadItems() m_nrSkinIcons = 0;
- szSections = (TCHAR*)malloc((SECT_BUFFER_SIZE + 2) * sizeof(TCHAR));
+ szSections = (TCHAR*)mir_alloc((SECT_BUFFER_SIZE + 2) * sizeof(TCHAR));
ZeroMemory(szSections, (SECT_BUFFER_SIZE + 2) * sizeof(TCHAR));
GetPrivateProfileSection(_T("Icons"), szSections, SECT_BUFFER_SIZE, m_tszFileName);
@@ -1590,7 +1590,7 @@ void CSkin::LoadItems() ZeroMemory(&m_skinIcons[m_nrSkinIcons], sizeof(TIconDesc));
m_skinIcons[m_nrSkinIcons].uId = tmpIconDesc.uId;
m_skinIcons[m_nrSkinIcons].phIcon = (HICON *)(&m_skinIcons[m_nrSkinIcons].uId);
- m_skinIcons[m_nrSkinIcons].szName = (TCHAR*)malloc(sizeof(TCHAR) * (lstrlen(p) + 1));
+ m_skinIcons[m_nrSkinIcons].szName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (lstrlen(p) + 1));
lstrcpy(m_skinIcons[m_nrSkinIcons].szName, p);
m_nrSkinIcons++;
}
@@ -1620,7 +1620,7 @@ void CSkin::LoadItems() p += (lstrlen(p) + 1);
}
*/
- free(szSections);
+ mir_free(szSections);
g_ButtonSet.top = GetPrivateProfileInt(_T("ButtonArea"), _T("top"), 0, m_tszFileName);
g_ButtonSet.bottom = GetPrivateProfileInt(_T("ButtonArea"), _T("bottom"), 0, m_tszFileName);
g_ButtonSet.left = GetPrivateProfileInt(_T("ButtonArea"), _T("left"), 0, m_tszFileName);
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index 13c54498c2..7443fd74ad 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -346,7 +346,7 @@ void TSAPI LoadFavoritesAndRecent() }
if (iIndex == 0) {
- free(recentEntries);
+ mir_free(recentEntries);
return;
}
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index b31fa03c94..bfce442532 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -58,7 +58,7 @@ LRESULT TSAPI _dlgReturn(HWND hWnd, LRESULT result) void* Utils::safeAlloc(const size_t size)
{
__try {
- unsigned char* _p = reinterpret_cast<unsigned char*>(malloc(size));
+ unsigned char* _p = reinterpret_cast<unsigned char*>(mir_alloc(size));
*_p = 0;
return(reinterpret_cast<void*>(_p));
@@ -327,7 +327,7 @@ ok: /**
* format the title bar string for IM chat sessions using placeholders.
- * the caller must free() the returned string
+ * the caller must mir_free() the returned string
*/
const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
{
@@ -475,7 +475,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat }
length = title.length();
- szResult = (TCHAR*)malloc((length + 2) * sizeof(TCHAR));
+ szResult = (TCHAR*)mir_alloc((length + 2) * sizeof(TCHAR));
if (szResult) {
_tcsncpy(szResult, title.c_str(), length);
szResult[length] = 0;
@@ -608,7 +608,7 @@ void Utils::RTF_CTableInit() {
int iSize = sizeof(TRTFColorTable) * RTF_CTABLE_DEFSIZE;
- rtf_ctable = (TRTFColorTable *)malloc(iSize);
+ rtf_ctable = (TRTFColorTable *)mir_alloc(iSize);
ZeroMemory(rtf_ctable, iSize);
CopyMemory(rtf_ctable, _rtf_ctable, iSize);
rtf_ctable_size = RTF_CTABLE_DEFSIZE;
@@ -624,7 +624,7 @@ void Utils::RTF_ColorAdd(const TCHAR *tszColname, size_t length) COLORREF clr;
rtf_ctable_size++;
- rtf_ctable = (TRTFColorTable *)realloc(rtf_ctable, sizeof(TRTFColorTable) * rtf_ctable_size);
+ rtf_ctable = (TRTFColorTable *)mir_realloc(rtf_ctable, sizeof(TRTFColorTable) * rtf_ctable_size);
clr = _tcstol(tszColname, &stopped, 16);
mir_sntprintf(rtf_ctable[rtf_ctable_size - 1].szName, length + 1, _T("%06x"), clr);
rtf_ctable[rtf_ctable_size - 1].menuid = rtf_ctable[rtf_ctable_size - 1].index = 0;
@@ -776,7 +776,7 @@ void Utils::ReadPrivateContainerSettings(TContainerData *pContainer, bool fForce Utils::ReadContainerSettingsFromDB(0, &csTemp, szCname);
if (csTemp.fPrivate || fForce) {
if (pContainer->settings == 0 || pContainer->settings == &PluginConfig.globalContainerSettings)
- pContainer->settings = (TContainerSettings *)malloc(sizeof(TContainerSettings));
+ pContainer->settings = (TContainerSettings *)mir_alloc(sizeof(TContainerSettings));
CopyMemory((void*)pContainer->settings, (void*)&csTemp, sizeof(TContainerSettings));
pContainer->settings->fPrivate = true;
}
|