diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-25 15:32:06 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-25 15:32:06 +0000 |
commit | a757184e5db3112d3de0b69eec7d39b937e396bc (patch) | |
tree | e903787b3ca3af22a4d95ddf757e178b23da8619 /plugins/YAMN | |
parent | 33ebc5347bee5432ca63efb330acdd5a3b82f3fd (diff) |
replace sprintf to mir_snprintf (part 5)
git-svn-id: http://svn.miranda-ng.org/main/trunk@5481 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAMN')
-rw-r--r-- | plugins/YAMN/src/mails/mime.cpp | 14 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/netlib.cpp | 6 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3.cpp | 19 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3comm.cpp | 18 |
4 files changed, 28 insertions, 29 deletions
diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp index 4e29884b14..30706d9cc2 100644 --- a/plugins/YAMN/src/mails/mime.cpp +++ b/plugins/YAMN/src/mails/mime.cpp @@ -661,36 +661,36 @@ FailBackRaw: for (i=0;i<numparts;i++) {
if (i) { // part before first boudary should not have headers
char infoline[1024]; size_t linesize = 0;
- _snprintf(infoline,100,"%s %d",Translate("Part"),i);
+ mir_snprintf(infoline, SIZEOF(infoline), "%s %d", Translate("Part"), i);
linesize = strlen(infoline);
if (partData[i].TransEnc) {
- _snprintf(infoline+linesize, sizeof(infoline)-linesize,"; %s",partData[i].TransEnc);
+ mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].TransEnc);
linesize = strlen(infoline);
}
if (partData[i].ContType) {
char *CharSetStr=strchr(partData[i].ContType,';');
if (CharSetStr) {
CharSetStr[0]=0;
- _snprintf(infoline+linesize,sizeof(infoline)-linesize,"; %s",partData[i].ContType);
+ mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].ContType);
linesize = strlen(infoline);
partData[i].ContType=CharSetStr+1;
if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) {
- _snprintf(infoline+linesize,sizeof(infoline)-linesize,"; %s",CharSetStr);
+ mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", CharSetStr);
linesize = strlen(infoline);
delete[] CharSetStr;
}
if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) {
- _snprintf(infoline+linesize,sizeof(infoline)-linesize,"; \"%s\"",CharSetStr);
+ mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; \"%s\"", CharSetStr);
linesize = strlen(infoline);
delete[] CharSetStr;
}
}
else {
- _snprintf(infoline+linesize,sizeof(infoline)-linesize,"; %s",partData[i].ContType);
+ mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, "; %s", partData[i].ContType);
linesize = strlen(infoline);
}
}
- sprintf(infoline+linesize,".\r\n");
+ mir_snprintf(infoline + linesize, SIZEOF(infoline) - linesize, ".\r\n");
{
WCHAR *temp=0;
dest[destpos] = dest[destpos+1] = dest[destpos+2] = 0x2022; // bullet;
diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index 0ae92f6f33..e9a1f61dd9 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -14,11 +14,11 @@ HANDLE hNetlibUser=NULL; void __stdcall SSL_DebugLog(const char *fmt, ...)
{
- char str[ 4096 ];
+ char str[4096];
va_list vararg;
va_start( vararg, fmt );
- int tBytes = _vsnprintf( str, sizeof(str)-1, fmt, vararg );
+ int tBytes = mir_vsnprintf(str, SIZEOF(str), fmt, vararg);
if ( tBytes == 0 )
return;
@@ -36,7 +36,7 @@ HANDLE RegisterNLClient(const char *name) static NETLIBUSER nlu={0};
char desc[128];
- sprintf(desc, Translate("%s connection"),name);
+ mir_snprintf(desc, SIZEOF(desc), Translate("%s connection"), name);
#ifdef DEBUG_COMM
DebugLog(CommFile,"<Register PROXY support>");
diff --git a/plugins/YAMN/src/proto/pop3/pop3.cpp b/plugins/YAMN/src/proto/pop3/pop3.cpp index d3f14af9a1..8ca1f2bfb2 100644 --- a/plugins/YAMN/src/proto/pop3/pop3.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3.cpp @@ -124,7 +124,6 @@ char* CPop3Client::RecvRest(char* prev,int mode,int size) NetClient->Recv(PrevString+RcvAll,SizeLeft); //to Rcv stores received bytes SizeLeft=SizeLeft-NetClient->Rcv; RcvAll+=NetClient->Rcv; -// printf("[Read: %s]\n",PrevString); } NetClient->Rcv=RcvAll; //at the end, store the number of all bytes, no the number of last received bytes return PrevString; @@ -202,7 +201,7 @@ char* CPop3Client::User(char* name) char query[128]; char *Result; - sprintf(query,"USER %s\r\n",name); + mir_snprintf(query, SIZEOF(query), "USER %s\r\n", name); NetClient->Send(query); Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK); if (AckFlag==POP3_FERR) @@ -221,7 +220,7 @@ char* CPop3Client::Pass(char* pw) char query[128]; char *Result; - sprintf(query,"PASS %s\r\n",pw); + mir_snprintf(query, SIZEOF(query), "PASS %s\r\n", pw); NetClient->Send(query); Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK); if (AckFlag==POP3_FERR) @@ -251,10 +250,10 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp) hexdigest[0]='\0'; for (int i=0; i < 16; i++) { char tmp[4]; - sprintf(tmp, "%02x", digest[i]); + mir_snprintf(tmp, SIZEOF(tmp), "%02x", digest[i]); strcat(hexdigest, tmp); } - sprintf(query,"APOP %s %s\r\n",name, hexdigest); + mir_snprintf(query, SIZEOF(query), "APOP %s %s\r\n", name, hexdigest); NetClient->Send(query); Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK); if (AckFlag==POP3_FERR) @@ -307,7 +306,7 @@ char* CPop3Client::Top(int nr, int lines) char query[128]; - sprintf(query,"TOP %d %d\r\n",nr,lines); + mir_snprintf(query, SIZEOF(query), "TOP %d %d\r\n", nr, lines); NetClient->Send(query); return RecvRest(NetClient->Recv(),POP3_SEARCHDOT); } @@ -323,11 +322,11 @@ char* CPop3Client::Uidl(int nr) if (nr) { - sprintf(query,"UIDL %d\r\n",nr); + mir_snprintf(query, SIZEOF(query), "UIDL %d\r\n", nr); NetClient->Send(query); return RecvRest(NetClient->Recv(),POP3_SEARCHACK); } - sprintf(query,"UIDL\r\n"); + mir_snprintf(query, SIZEOF(query), "UIDL\r\n"); NetClient->Send(query); return RecvRest(NetClient->Recv(),POP3_SEARCHDOT); } @@ -341,7 +340,7 @@ char* CPop3Client::Dele(int nr) char query[128]; - sprintf(query,"DELE %d\r\n",nr); + mir_snprintf(query, SIZEOF(query), "DELE %d\r\n", nr); NetClient->Send(query); return RecvRest(NetClient->Recv(),POP3_SEARCHACK); } @@ -354,7 +353,7 @@ char* CPop3Client::Retr(int nr) char query[128]; - sprintf(query,"RETR %d\r\n",nr); + mir_snprintf(query, SIZEOF(query), "RETR %d\r\n", nr); NetClient->Send(query); RecvRest(NetClient->Recv(),POP3_SEARCHACK); return NetClient->Recv(); diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index f34251b1c2..fe1bce4457 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -261,7 +261,7 @@ int RegisterPOP3Plugin(WPARAM,LPARAM) if (ERROR_FILE_NOT_FOUND != GetLastError())
{
TCHAR temp[1024] = {0};
- mir_sntprintf(temp, SIZEOF(temp), _T("%s\n%s"),TranslateT("Reading file error. File already in use?"),FileName);
+ mir_sntprintf(temp, SIZEOF(temp), _T("%s\n%s"), TranslateT("Reading file error. File already in use?"), FileName);
MessageBox(NULL,temp,TranslateT("YAMN (internal POP3) read error"),MB_OK);
CallService(MS_YAMN_DELETEFILENAME,(WPARAM)FileName,0);
FileName = NULL;
@@ -331,7 +331,7 @@ DWORD WINAPI WritePOP3Accounts() DWORD ReturnValue = CallService(MS_YAMN_WRITEACCOUNTS,(WPARAM)POP3Plugin,(LPARAM)FileName);
if (ReturnValue == EACC_SYSTEM) {
TCHAR temp[1024] = {0};
- mir_sntprintf(temp, SIZEOF(temp), _T("%s\n%s"), TranslateT("Error while copying data to disk occured. File in use?"), FileName );
+ mir_sntprintf(temp, SIZEOF(temp), _T("%s\n%s"), TranslateT("Error while copying data to disk occured. File in use?"), FileName);
MessageBox(NULL, temp, TranslateT("POP3 plugin- write file error"), MB_OK );
}
@@ -367,7 +367,7 @@ DWORD WINAPI ReadPOP3Options(HACCOUNT Which,char **Parser,char *End) if (*Parser>=End)
return EACC_FILECOMPATIBILITY;
#ifdef DEBUG_FILEREAD
- _stprintf(Debug,_T("CodePage: %d, remaining %d chars"),((HPOP3ACCOUNT)Which)->CP,End-*Parser);
+ mir_sntprintf(Debug, SIZEOF(Debug), _T("CodePage: %d, remaining %d chars"), ((HPOP3ACCOUNT)Which)->CP, End-*Parser);
MessageBox(NULL,Debug,_T("debug"),MB_OK);
#endif
return 0;
@@ -699,7 +699,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) for (NewMsgsPtr=(HYAMNMAIL)NewMails;NewMsgsPtr != NULL;NewMsgsPtr=NewMsgsPtr->Next) {
if (!strcmp(MsgQueuePtr->ID,NewMsgsPtr->ID)) {
TCHAR accstatus[512];
- wsprintf(accstatus,TranslateT("Reading body %s"),NewMsgsPtr->ID);
+ mir_sntprintf(accstatus, SIZEOF(accstatus), TranslateT("Reading body %s"), NewMsgsPtr->ID);
SetAccountStatus(ActualAccount,accstatus);
DataRX=MyClient->Top(MsgQueuePtr->Number,100);
#ifdef DEBUG_DECODE
@@ -772,7 +772,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) {
BOOL autoretr = (ActualAccount->Flags & YAMN_ACC_BODY) != 0;
DataRX=MyClient->Top(MsgQueuePtr->Number,autoretr?100:0);
- wsprintf(accstatus,TranslateT("Reading new mail messages (%d%% done)"),100*i/msgs);
+ mir_sntprintf(accstatus, SIZEOF(accstatus), TranslateT("Reading new mail messages (%d%% done)"), 100 * i / msgs);
SetAccountStatus(ActualAccount,accstatus);
#ifdef DEBUG_DECODE
@@ -1528,14 +1528,14 @@ TCHAR* WINAPI GetErrorString(DWORD Code) TCHAR *ErrorString = new TCHAR[ERRORSTR_MAXLEN];
POP3_ERRORCODE *ErrorCode=(POP3_ERRORCODE *)(UINT_PTR)Code;
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, TranslateT("Error %d-%d-%d-%d:"),ErrorCode->AppError,ErrorCode->POP3Error,ErrorCode->NetError,ErrorCode->SystemError);
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, TranslateT("Error %d-%d-%d-%d:"), ErrorCode->AppError, ErrorCode->POP3Error, ErrorCode->NetError,ErrorCode->SystemError);
if (ErrorCode->POP3Error)
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"),ErrorString,TranslateTS(POP3Errors[ErrorCode->POP3Error-1]));
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"), ErrorString, TranslateTS(POP3Errors[ErrorCode->POP3Error-1]));
if (ErrorCode->NetError) {
if (ErrorCode->SSL)
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"),ErrorString, TranslateTS(SSLErrors[ErrorCode->NetError-1]));
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"), ErrorString, TranslateTS(SSLErrors[ErrorCode->NetError-1]));
else
- mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"),ErrorString, TranslateTS(NetlibErrors[ErrorCode->NetError-4]));
+ mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, _T("%s\n%s"), ErrorString, TranslateTS(NetlibErrors[ErrorCode->NetError-4]));
}
return ErrorString;
|