From a757184e5db3112d3de0b69eec7d39b937e396bc Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 25 Jul 2013 15:32:06 +0000 Subject: replace sprintf to mir_snprintf (part 5) git-svn-id: http://svn.miranda-ng.org/main/trunk@5481 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Msg_Export/src/FileViewer.cpp | 18 ++++++++--------- plugins/Msg_Export/src/utils.cpp | 38 +++++++++++++++++------------------ 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'plugins/Msg_Export/src') diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index 3b4a2f12fb..23398db07f 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -198,12 +198,12 @@ int CLStreamRTFInfo::nWriteHeader( char *pszTarget, int nLen ) */ char szRtfHeader[400]; - int nSrcLen = _snprintf( szRtfHeader, sizeof( szRtfHeader ), + int nSrcLen = mir_snprintf(szRtfHeader, SIZEOF(szRtfHeader), "{\\rtf1\\ansi\r\n" "{\\colortbl ;\\red%d\\green%d\\blue%d;\\red%d\\green%d\\blue%d;}\r\n" "\\viewkind4\\uc1\\pard\\cf2 ", - GetRValue( cMyText) ,GetGValue( cMyText) ,GetBValue( cMyText ), - GetRValue( cYourText ),GetGValue( cYourText ),GetBValue( cYourText)); + GetRValue(cMyText), GetGValue(cMyText), GetBValue(cMyText), + GetRValue(cYourText), GetGValue(cYourText), GetBValue(cYourText)); if (nSrcLen > nLen ) { @@ -377,7 +377,7 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff, LONG cb ) SetFilePointer(hFile,n-dwRead,NULL,FILE_CURRENT); break; } - dwCurrent += sprintf( (char*)&pbBuff[dwCurrent], "\\u%d?", nValue ); + dwCurrent += sprintf( (char*)&pbBuff[dwCurrent], "\\u%d?", nValue ); //!!!!!!!!! //continue; /* // Then we have an extended char in the UTF8 file. // we need to convert this to UCS-2 and then to \uN in the RTF @@ -663,9 +663,9 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg ) TCHAR szTmp[1500]; if (nDBCount == -1 ) - mir_sntprintf(szTmp, 1499, LPGENT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str()); + mir_sntprintf(szTmp, 1499, TranslateT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str()); else - mir_sntprintf( szTmp, 1499, LPGENT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount ); + mir_sntprintf(szTmp, 1499, TranslateT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount); SETTEXTEX stText = {0}; stText.codepage = CP_ACP; @@ -730,7 +730,7 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg ) //delete [] pabFileData; TCHAR szTmp[100]; - mir_sntprintf( szTmp, 99, _T("File open time %d\n"), GetTickCount() - dwStart ); + mir_sntprintf(szTmp, 99, _T("File open time %d\n"), GetTickCount() - dwStart); OutputDebugString( szTmp ); GETTEXTLENGTHEX sData = { 0 }; @@ -743,7 +743,7 @@ bool bLoadFile( HWND hwndDlg, CLHistoryDlg * pclDlg ) if ( !bScrollToBottom ) SendMessage( hRichEdit, EM_SETSCROLLPOS, 0, (LPARAM) &ptOldPos ); - mir_sntprintf( szTmp, 99, LPGENT("With scroll to bottom %d\n"), GetTickCount() - dwStart ); + mir_sntprintf(szTmp, 99, TranslateT("With scroll to bottom %d\n"), GetTickCount() - dwStart); OutputDebugString( szTmp ); return true; @@ -1082,7 +1082,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, if (n != sPath.npos ) sPath.erase( 0, n + 1 ); - if (_sntprintf( szTitle, sizeof( szTitle ), szFormat, pszNick, sPath.c_str(), (pclDlg->bUtf8File ? _T("UTF8"):_T("ANSI"))) > 0 ) + if (mir_sntprintf(szTitle, SIZEOF(szTitle), szFormat, pszNick, sPath.c_str(), (pclDlg->bUtf8File ? _T("UTF8"):_T("ANSI"))) > 0) SetWindowText( hwndDlg, szTitle); } } diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index adcaf3f94b..a05718e66f 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -235,7 +235,7 @@ void DisplayLastError(const TCHAR *pszError) DWORD error = GetLastError(); TCHAR szTemp[50]; - _sntprintf(szTemp, sizeof(szTemp), _T("\r\nErrorCode: %d\r\n"), error); + mir_sntprintf(szTemp, SIZEOF(szTemp), _T("\r\nErrorCode: %d\r\n"), error); sError += szTemp; sError += sGetErrorString(error); MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_OK); @@ -520,7 +520,7 @@ bool bWriteHexToFile( HANDLE hFile, void * pData, int nSize ) BYTE * p = (BYTE*)pData; for( int n = 0 ; n < nSize ; n++ ) { - sprintf( cBuf, "%.2X ", p[n] ); + mir_snprintf(cBuf, SIZEOF(cBuf), "%.2X ", p[n]); if ( !bWriteToFile( hFile, cBuf, 3)) return false; } @@ -651,7 +651,7 @@ tstring GetFilePathFromUser( HANDLE hContact ) if (enRenameAction != eDAAutomatic ) { tstring sRemoteUser = NickFromHandle(hContact); - _sntprintf( szTemp, sizeof( szTemp ), + mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("File name for the user \"%s\" has changed!\n\nfrom:\t%s\nto:\t%s\n\nDo you wish to rename file?"), sRemoteUser.c_str(), sPrevFileName.c_str(), @@ -672,7 +672,7 @@ tstring GetFilePathFromUser( HANDLE hContact ) while( ! MoveFile( sPrevFileName.c_str(), sFilePath.c_str())) { - _sntprintf( szTemp, sizeof( szTemp ), + mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("Failed to rename file\n\nfrom:\t%s\nto:\t%s\n\nFailed with error: %s"), sPrevFileName.c_str(), sFilePath.c_str(), @@ -776,7 +776,7 @@ void ReplaceDefines( HANDLE hContact, tstring & sTarget ) if (dwUIN ) { TCHAR sTmp[20]; - _sntprintf( sTmp, sizeof( sTmp ),_T("%d"), dwUIN ); + mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%d"), dwUIN); sReplaceUin = sTmp; } else @@ -873,11 +873,11 @@ void ReplaceTimeVariables( tstring &sRet ) GetLocalTime( &stTime ); TCHAR sTmp[20]; - _sntprintf( sTmp, sizeof( sTmp ),_T("%d"), stTime.wYear ); + mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%d"), stTime.wYear); ReplaceAll( sRet, _T("%year%"), sTmp ); - _sntprintf( sTmp, sizeof( sTmp ),_T("%.2d"), stTime.wMonth ); + mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%.2d"), stTime.wMonth); ReplaceAll( sRet, _T("%month%"), sTmp ); - _sntprintf( sTmp, sizeof( sTmp ),_T("%.2d"), stTime.wDay ); + mir_sntprintf(sTmp, SIZEOF(sTmp), _T("%.2d"), stTime.wDay); ReplaceAll( sRet, _T("%day%"), sTmp ); } } @@ -1108,10 +1108,10 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) ReplaceAll( output, pszReplaceList[nCur], _DBGetString( hContact, sProto.c_str(), pszReplaceListA[nCur], _T(""))); } - _sntprintf( szTemp, sizeof( szTemp ), _T("%d"), db_get_dw(hContact, sProto.c_str(), "UIN", 0)); + mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), db_get_dw(hContact, sProto.c_str(), "UIN", 0)); ReplaceAll( output, _T("%UIN%"), szTemp ); - _sntprintf( szTemp, sizeof( szTemp ), _T("%d"), db_get_w(hContact, sProto.c_str(), "Age", 0)); + mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), db_get_w(hContact, sProto.c_str(), "Age", 0)); ReplaceAll( output, _T("%Age%"), szTemp ); szTemp[0] = (TCHAR)db_get_b(hContact, sProto.c_str(), "Gender", 0); @@ -1130,7 +1130,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) int nIndent; { // Get time stamp - nIndent = _sntprintf( szTemp, sizeof( szTemp ), _T("%-*s"), + nIndent = mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%-*s"), nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); @@ -1253,7 +1253,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) if (dbei.cbBlob < 8 || dbei.cbBlob > 5000 ) { - int n = _sntprintf( szTemp, sizeof( szTemp ), LPGENT("Invalid Database event received. Type %d, size %d"),dbei.eventType, dbei.cbBlob ); + int n = mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("Invalid Database event received. Type %d, size %d"), dbei.eventType, dbei.cbBlob); if ( !bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n)) DisplayErrorDialog( LPGENT("Failed to write Invalid Database event the file :\n"), sFilePath, &dbei ); break; @@ -1284,7 +1284,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) bWriteTextToFile( hFile, LPGENT("UIN :"), bWriteUTF8Format)) { DWORD uin = *((PDWORD)(dbei.pBlob)); - int n = _sntprintf( szTemp, sizeof( szTemp ),_T("%d"), uin ); + int n = mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), uin); if (bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n)) { char *pszEnd = (char *) (dbei.pBlob + dbei.cbSize); @@ -1372,7 +1372,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) } default: { - int n = _sntprintf( szTemp, sizeof( szTemp ), LPGENT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob ); + int n = mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); if ( !bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n)) { DisplayErrorDialog( LPGENT("Failed to write Unknown event to the file :\n"), sFilePath, &dbei ); @@ -1383,7 +1383,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) } else { - int n = _sntprintf( szTemp, sizeof( szTemp ), LPGENT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob ); + int n = mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); bWriteTextToFile( hFile, szTemp, bWriteUTF8Format, n ); } bWriteToFile( hFile, bAppendNewLine ? "\r\n\r\n" : "\r\n" ); @@ -1428,7 +1428,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam) if ( !db_event_get(hDbEvent, &dbei)) { if (dbei.eventType != EVENTTYPE_STATUSCHANGE) { char szTemp[500]; - _snprintf( szTemp, sizeof( szTemp ), "DisableProt_%s", dbei.szModule ); + mir_snprintf(szTemp, SIZEOF(szTemp), "DisableProt_%s", dbei.szModule); if (db_get_b(NULL,MODULE,szTemp,1)) ExportDBEventInfo( hContact, dbei ); } @@ -1614,7 +1614,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) CloseHandle( hPrevFile ); TCHAR szTemp[500]; - _sntprintf( szTemp, sizeof( szTemp ), _T("%s\r\n%s"), + mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s\r\n%s"), TranslateT("User has been deleted do you want to delete the file?"), sFilePath.c_str()); if (enDeleteAction == eDAAutomatic || @@ -1622,9 +1622,9 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) { if ( !DeleteFile( sFilePath.c_str())) { - _sntprintf( szTemp, sizeof( szTemp ), + mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s\r\n%s"), - LPGENT("Failed to delete the file"), + TranslateT("Failed to delete the file"), sFilePath.c_str()); DisplayLastError( szTemp ); -- cgit v1.2.3