From 7dad3543a2b848f6547b291f812c9643dc0b85f2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 30 Jun 2012 16:17:46 +0000 Subject: Variables moved to mir_* memory allocation routines git-svn-id: http://svn.miranda-ng.org/main/trunk@696 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/parse_external.cpp | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'plugins/Variables/parse_external.cpp') 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; } -- cgit v1.2.3