summaryrefslogtreecommitdiff
path: root/Sessions/Src/Main.cpp
diff options
context:
space:
mode:
authormataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-07-17 10:53:36 +0000
committermataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-07-17 10:53:36 +0000
commita818ed0593c74735eb2e888bb09c169cf82c894f (patch)
tree9120a06b22e6fe73d379833a75a5f1a8716aa68e /Sessions/Src/Main.cpp
parentd96825ee41c0e597d3b1839e30f9cf31c04d00cd (diff)
Sessions:
using mir_* functions git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@153 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'Sessions/Src/Main.cpp')
-rw-r--r--Sessions/Src/Main.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/Sessions/Src/Main.cpp b/Sessions/Src/Main.cpp
index 73c80f0..0a4a173 100644
--- a/Sessions/Src/Main.cpp
+++ b/Sessions/Src/Main.cpp
@@ -230,7 +230,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar
SavePosition(hdlg, "SaveDlg");
if (lenght>0)
{
- GetWindowText(GetDlgItem(hdlg, IDC_LIST),szUserSessionName,sizeof(szUserSessionName));
+ GetWindowText(GetDlgItem(hdlg, IDC_LIST), szUserSessionName, SIZEOF(szUserSessionName));
szUserSessionName[lenght+1]='\0';
if(IsDlgButtonChecked(hdlg,IDC_SELCONTACTS)&&bSC)
{
@@ -452,7 +452,7 @@ INT_PTR CloseCurrentSession(WPARAM wparam,LPARAM lparam)
while(session_list[0]!=0)
{
- mwid.cbSize=sizeof(MessageWindowInputData);
+ mwid.cbSize = sizeof(MessageWindowInputData);
mwid.hContact=(HANDLE)session_list[i];
mwid.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH;
@@ -552,29 +552,29 @@ int SaveSessionDate()
if(session_list[0]!=0)
{
TimeSize=GetTimeFormat(LOCALE_USER_DEFAULT,0/*TIME_NOSECONDS*/,NULL,NULL,NULL,0);
- szTimeBuf = (TCHAR*)malloc((TimeSize+1)*sizeof(TCHAR));
+ szTimeBuf = (TCHAR*)mir_alloc((TimeSize+1)*sizeof(TCHAR));
GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/,NULL,NULL,szTimeBuf,TimeSize);
DateSize=GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,NULL,NULL,NULL,0);
- szDateBuf = (TCHAR*)malloc((DateSize+1)*sizeof(TCHAR));
+ szDateBuf = (TCHAR*)mir_alloc((DateSize+1)*sizeof(TCHAR));
GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,NULL,NULL,szDateBuf,DateSize );
- szSessionTime = (TCHAR*)malloc((DateSize+TimeSize+4)*sizeof(TCHAR));
+ szSessionTime = (TCHAR*)mir_alloc((DateSize+TimeSize+4)*sizeof(TCHAR));
lenn=_tcslen(szSessionTime);
- _sntprintf(szSessionTime,((DateSize+TimeSize+4)*sizeof(TCHAR)),_T("%s - %s")/*TCHAR_STR_PARAM _T(" - ") TCHAR_STR_PARAM*/,szTimeBuf,szDateBuf);
+ mir_sntprintf(szSessionTime, ((DateSize+TimeSize+4)*sizeof(TCHAR)), _T("%s - %s")/*TCHAR_STR_PARAM _T(" - ") TCHAR_STR_PARAM*/, szTimeBuf,szDateBuf);
- mir_snprintf(szSessionDate,SIZEOF(szSessionDate),"%s_%u","SessionDate",0);
+ mir_snprintf(szSessionDate, SIZEOF(szSessionDate), "%s_%u", "SessionDate", 0);
DBGetContactSettingTString(NULL, __INTERNAL_NAME, szSessionDate, &dbv);
- szSessionDateBuf_1=_tcsdup(dbv.ptszVal);
+ szSessionDateBuf_1 = mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
DBWriteContactSettingTString(NULL, __INTERNAL_NAME, szSessionDate, szSessionTime);
- free(szSessionTime);
+ mir_free(szSessionTime);
ResaveSettings("SessionDate",1,ses_limit,szSessionDateBuf_1);
- if(szTimeBuf) free(szTimeBuf);
- if(szDateBuf) free(szDateBuf);
+ if(szTimeBuf) mir_free(szTimeBuf);
+ if(szDateBuf) mir_free(szDateBuf);
}
if(g_bCrashRecovery) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "lastSaveCompleted", 1);
return 0;
@@ -591,11 +591,11 @@ int SaveUserSessionName(TCHAR *szUSessionName)
if(session_list[0]!=0)
{
- szUserSessionName= _tcsdup(szUSessionName);
- mir_snprintf(szUserSessionNameBuf,SIZEOF(szUserSessionNameBuf),"%s_%u","UserSessionDsc",0);
+ szUserSessionName = mir_tstrdup(szUSessionName);
+ mir_snprintf(szUserSessionNameBuf, SIZEOF(szUserSessionNameBuf), "%s_%u", "UserSessionDsc", 0);
if(!DBGetContactSettingTString(NULL, __INTERNAL_NAME, szUserSessionNameBuf, &dbv))
{
- szUserSessionNameBuf_1=_tcsdup(dbv.ptszVal);
+ szUserSessionNameBuf_1 = mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
ResaveSettings("UserSessionDsc",1,255,szUserSessionNameBuf_1);
}
@@ -603,7 +603,7 @@ int SaveUserSessionName(TCHAR *szUSessionName)
DBWriteContactSettingTString(NULL, __INTERNAL_NAME, szUserSessionNameBuf, szUserSessionName);
//free(szUserSessionNameBuf_1);
- free(szUserSessionName);
+ mir_free(szUserSessionName);
return 0;
}
@@ -713,28 +713,28 @@ int DelUserDefSession(int ses_count)
SetInSessionOrder(hContact,1,ses_count,0);
}
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","UserSessionDsc",ses_count);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", ses_count);
DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName);
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","FavUserSession",ses_count);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count);
DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName);
for (i=(ses_count+1);;i++)
{
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","UserSessionDsc",i);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i);
if ((szSessionNameBuf=DBGetStringT(NULL, __INTERNAL_NAME, szSessionName))/*&&(szSessionHandlesBuf=DBGetStringT(NULL,PLGNAME,szSessionHandles))*/)
{
MarkUserDefSession(i-1,IsMarkedUserDefSession(i));
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","UserSessionDsc",i-1);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i-1);
DBWriteContactSettingTString(NULL, __INTERNAL_NAME, szSessionName, szSessionNameBuf);
}
else
{
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","UserSessionDsc",i-1);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i-1);
DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName);
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","FavUserSession",i-1);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", i-1);
DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName);
break;
}
@@ -760,22 +760,22 @@ int DeleteAutoSession(int ses_count)
SetInSessionOrder(hContact,0,ses_count,0);
}
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","SessionDate",ses_count);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", ses_count);
DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName);
for (i=(ses_count+1);;i++)
{
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","SessionDate",i);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i);
if ((szSessionNameBuf=DBGetStringT(NULL, __INTERNAL_NAME, szSessionName))/*&&(szSessionHandlesBuf=DBGetStringT(NULL,PLGNAME,szSessionHandles))*/)
{
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","SessionDate",i-1);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i-1);
DBWriteContactSettingTString(NULL, __INTERNAL_NAME, szSessionName, szSessionNameBuf);
}
else
{
- mir_snprintf(szSessionName,SIZEOF(szSessionName),"%s_%u","SessionDate",i-1);
+ mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i-1);
DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName);
break;
}
@@ -971,7 +971,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam)
hibSessionsLoadLast =(HANDLE)AddIcon(hiSessionsLoadLast, "SessionsLoadLast", _T("Load last Session"));
CLISTMENUITEM cl;
- ZeroMemory(&cl,sizeof(cl));
+ ZeroMemory(&cl, sizeof(cl));
cl.cbSize = sizeof(CLISTMENUITEM);
cl.position = 1000000000;
cl.flags = CMIM_ALL | CMIF_TCHAR;
@@ -998,8 +998,8 @@ static int PluginInit(WPARAM wparam,LPARAM lparam)
cl.position = 10100000;
hmLoadSession = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
- ZeroMemory(&cl,sizeof(cl));
- cl.cbSize=sizeof(cl);
+ ZeroMemory(&cl, sizeof(cl));
+ cl.cbSize = sizeof(cl);
cl.flags = CMIM_ICON;
cl.hIcon = hiSessionsSave;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmSaveCurrentSession, (LPARAM)&cl);