diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-25 20:15:05 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-25 20:15:05 +0000 |
commit | 9d32b9cd791fb5f51dad17567152c70a8511a500 (patch) | |
tree | fd7aa3250ed409e720f26c341c0a5d736ed8083c /plugins/YAMN | |
parent | 125a25c86eed41352d45eb8fb6f994f65700c3ec (diff) |
replace sprintf to mir_snprintf (part 6)
git-svn-id: http://svn.miranda-ng.org/main/trunk@5485 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAMN')
-rw-r--r-- | plugins/YAMN/src/account.cpp | 35 | ||||
-rw-r--r-- | plugins/YAMN/src/browser/badconnect.cpp | 5 | ||||
-rw-r--r-- | plugins/YAMN/src/debug.cpp | 10 |
3 files changed, 23 insertions, 27 deletions
diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index 8138528813..376389eddb 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -226,7 +226,7 @@ DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugS Finder=*Parser;
while((*Finder != (TCHAR)0) && (Finder<=End)) Finder++;
- _stprintf(Debug,_T("%s: %s,length is %d, remaining %d chars"),DebugString,*Parser,Finder-*Parser,End-Finder);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("%s: %s,length is %d, remaining %d chars"), DebugString, *Parser, Finder-*Parser, End-Finder);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
if (Finder>=End)
return EACC_FILECOMPATIBILITY;
@@ -281,7 +281,7 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *Deb Finder=*Parser;
while((*Finder != (WCHAR)0) && (Finder<=(WCHAR *)End)) Finder++;
- swprintf(Debug,L"%s: %s,length is %d, remaining %d chars",DebugString,*Parser,Finder-*Parser,(WCHAR *)End-Finder);
+ mir_sntprintf(Debug, SIZEOF(Debug), L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, (WCHAR *)End-Finder);
MessageBoxW(NULL,Debug,L"debug",MB_OK);
if (Finder>=(WCHAR *)End)
return EACC_FILECOMPATIBILITY;
@@ -337,7 +337,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("NFlags: %04x, remaining %d chars"),Which->Flags,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("NFlags: %04x, remaining %d chars"), Which->Flags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -346,7 +346,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("PopupB: %04x, remaining %d chars"),Which->PopupB,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupB: %04x, remaining %d chars"), Which->PopupB, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PopupT=*(COLORREF *)(*Parser);
@@ -354,7 +354,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("PopupT: %04x, remaining %d chars"),Which->PopupT,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupT: %04x, remaining %d chars"), Which->PopupT, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PopupTime=*(DWORD *)(*Parser);
@@ -362,7 +362,7 @@ static DWORD ReadNotificationFromMemory(char **Parser,char *End,YAMN_NOTIFICATIO if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("PopupTime: %04x, remaining %d chars"),Which->PopupTime,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("PopupTime: %04x, remaining %d chars"), Which->PopupTime, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -512,7 +512,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End) if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("Port: %d, remaining %d chars"),Which->Server->Port,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("Port: %d, remaining %d chars"), Which->Server->Port, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
#ifdef DEBUG_FILEREAD
@@ -535,19 +535,19 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End) if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("Flags: %04x, remaining %d chars"),Which->Flags,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("Flags: %04x, remaining %d chars"), Which->Flags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->StatusFlags=*(DWORD *)(*Parser);
(*Parser)+=sizeof(DWORD);
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("STFlags: %04x, remaining %d chars"),Which->StatusFlags,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("STFlags: %04x, remaining %d chars"), Which->StatusFlags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->PluginFlags=*(DWORD *)(*Parser);
(*Parser)+=sizeof(DWORD);
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("PFlags: %04x, remaining %d chars"),Which->PluginFlags,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("PFlags: %04x, remaining %d chars"), Which->PluginFlags, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -558,7 +558,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End) if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("Interval: %d, remaining %d chars"),Which->Interval,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("Interval: %d, remaining %d chars"), Which->Interval, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
@@ -601,7 +601,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End) if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("LastChecked: %04x, remaining %d chars"),Which->LastChecked,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("LastChecked: %04x, remaining %d chars"), Which->LastChecked, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastSChecked=*(SYSTEMTIME *)(*Parser);
@@ -609,7 +609,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End) if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("LastSChecked: %04x, remaining %d chars"),Which->LastSChecked,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("LastSChecked: %04x, remaining %d chars"), Which->LastSChecked, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastSynchronised=*(SYSTEMTIME *)(*Parser);
@@ -617,7 +617,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End) if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("LastSynchronised: %04x, remaining %d chars"),Which->LastSynchronised,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("LastSynchronised: %04x, remaining %d chars"), Which->LastSynchronised, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
Which->LastMail=*(SYSTEMTIME *)(*Parser);
@@ -625,7 +625,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which,char **Parser,char *End) if (*Parser>End) //WARNING! There's only > at the end of testing
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("LastMail: %04x, remaining %d chars"),Which->LastMail,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("LastMail: %04x, remaining %d chars"), Which->LastMail, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
if (*Parser==End)
@@ -831,11 +831,6 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin,HANDLE File) {
for (ActualAccount=Plugin->FirstAccount;ActualAccount != NULL;ActualAccount=ActualAccount->Next)
{
-/* TCHAR DEBUG[100];
- Beep(3000,100);Sleep(200);
- _stprintf(DEBUG,_T("Browsing account %s"),ActualAccount->Name==NULL ? _T("(null)") : ActualAccount->Name);
- MessageBox(NULL,DEBUG,_T("debug- WriteAccount..."),MB_OK);
-*/
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read wait\n");
#endif
diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index cb549b29f3..c233475d29 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -117,8 +117,9 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n");
#endif
- TitleStrA = new char[strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE))];
- wsprintfA(TitleStrA,Translate(BADCONNECTTITLE),ActualAccount->Name);
+ int size = strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE));
+ TitleStrA = new char[size];
+ mir_snprintf(TitleStrA, size, Translate(BADCONNECTTITLE), ActualAccount->Name);
ShowPopup=ActualAccount->BadConnectN.Flags & YAMN_ACC_POP;
ShowMsg=ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG;
diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index c459d0cbb7..2f2d3d1069 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -43,21 +43,21 @@ void InitDebug() InitializeCriticalSection(&FileAccessCS);
#ifdef DEBUG_SYNCHRO
- _stprintf(DebugFileName,DebugSynchroFileName2,DebugUserDirectory);
+ mir_sntprintf(DebugFileName, SIZEOF(DebugFileName), DebugSynchroFileName2, DebugUserDirectory);
SynchroFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(SynchroFile,"Synchro debug file created by %s\n",YAMN_VER);
#endif
#ifdef DEBUG_COMM
- _stprintf(DebugFileName,DebugCommFileName2,DebugUserDirectory);
+ mir_sntprintf(DebugFileName, SIZEOF(DebugFileName), DebugCommFileName2, DebugUserDirectory);
CommFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(CommFile,"Communication debug file created by %s\n",YAMN_VER);
#endif
#ifdef DEBUG_DECODE
- _stprintf(DebugFileName,DebugDecodeFileName2,DebugUserDirectory);
+ mir_sntprintf(DebugFileName, SIZEOF(DebugFileName), DebugDecodeFileName2, DebugUserDirectory);
DecodeFile=CreateFile(DebugFileName,GENERIC_WRITE,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
DebugLog(DecodeFile,"Decoding kernel debug file created by %s\n",YAMN_VER);
@@ -93,7 +93,7 @@ void DebugLog(HANDLE File,const char *fmt,...) va_start(vararg,fmt);
str=(char *)malloc(strsize=65536);
mir_snprintf(tids, SIZEOF(tids), "[%x]",GetCurrentThreadId());
- while(_vsnprintf(str,strsize,fmt,vararg)==-1)
+ while(mir_vsnprintf(str, strsize, fmt, vararg)==-1)
str=(char *)realloc(str,strsize+=65536);
va_end(vararg);
EnterCriticalSection(&FileAccessCS);
@@ -114,7 +114,7 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...) va_start(vararg,fmt);
str=(WCHAR *)malloc((strsize=65536)*sizeof(WCHAR));
mir_snprintf(tids, SIZEOF(tids), "[%x]",GetCurrentThreadId());
- while(_vsnwprintf(str,strsize,fmt,vararg)==-1)
+ while(mir_vsnwprintf(str, strsize, fmt, vararg)==-1)
str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
va_end(vararg);
EnterCriticalSection(&FileAccessCS);
|