From 36472b00443e23acf28b0dd26ddc2c2e6216d909 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Tue, 9 Dec 2014 00:59:27 +0000 Subject: code cleanup over mir_sntprintf + small bug fix git-svn-id: http://svn.miranda-ng.org/main/trunk@11295 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/gg.cpp | 6 +++--- protocols/Gadu-Gadu/src/gg_proto.cpp | 2 +- protocols/Gadu-Gadu/src/groupchat.cpp | 2 +- protocols/Gadu-Gadu/src/image.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index bc9bcbb0f1..71f53ce6a7 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -155,20 +155,20 @@ void GGPROTO::cleanuplastplugin(DWORD version) debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version); TCHAR avatarsPath[MAX_PATH]; - mir_sntprintf(avatarsPath, MAX_PATH, _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName); + mir_sntprintf(avatarsPath, SIZEOF(avatarsPath), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName); debugLog(_T("cleanuplastplugin() 1: miranda_avatarcache = %s"), avatarsPath); if (avatarsPath != NULL){ HANDLE hFind = INVALID_HANDLE_VALUE; TCHAR spec[MAX_PATH + 10]; - mir_sntprintf(spec, MAX_PATH + 10, _T("%s\\*.(null)"), avatarsPath); + mir_sntprintf(spec, SIZEOF(spec), _T("%s\\*.(null)"), avatarsPath); WIN32_FIND_DATA ffd; hFind = FindFirstFile(spec, &ffd); if (hFind != INVALID_HANDLE_VALUE) { do { TCHAR filePathT [2*MAX_PATH + 10]; - mir_sntprintf(filePathT, 2*MAX_PATH + 10, _T("%s\\%s"), avatarsPath, ffd.cFileName); + mir_sntprintf(filePathT, SIZEOF(filePathT), _T("%s\\%s"), avatarsPath, ffd.cFileName); if (!_taccess(filePathT, 0)){ debugLog(_T("cleanuplastplugin() 1: remove file = %s"), filePathT); _tremove(filePathT); diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 1f527f6bb5..716a75e376 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -69,7 +69,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED); TCHAR szPath[MAX_PATH]; - mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST( _T("%miranda_userdata%")), m_tszUserName); + mir_sntprintf(szPath, SIZEOF(szPath), _T("%s\\%s\\ImageCache"), (TCHAR*)VARST( _T("%miranda_userdata%")), m_tszUserName); hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName); DWORD dwVersion; diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 895f81a314..070f28cb57 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -305,7 +305,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count // Create new chat window TCHAR status[256]; TCHAR *senderName = sender ? pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0) : NULL; - mir_sntprintf(status, 255, (sender) ? TranslateT("%s initiated the conference.") : TranslateT("This is my own conference."), senderName); + mir_sntprintf(status, SIZEOF(status), (sender) ? TranslateT("%s initiated the conference.") : TranslateT("This is my own conference."), senderName); GCSESSION gcwindow = { sizeof(gcwindow) }; gcwindow.iType = GCW_CHATROOM; diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index fd7ef6e2ab..42a612e758 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -813,7 +813,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, _T(""))) { TCHAR *tmpPath = Utils_ReplaceVarsT( _T("%miranda_userdata%")); - tPathLen = mir_sntprintf(szPath, MAX_PATH, _T("%s\\%s\\ImageCache"), tmpPath, m_tszUserName); + tPathLen = mir_sntprintf(szPath, SIZEOF(szPath), _T("%s\\%s\\ImageCache"), tmpPath, m_tszUserName); mir_free(tmpPath); } else { @@ -840,7 +840,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) for (i = 1; ; ++i) { if ((res = gg_img_isexists(szPath, dat)) != -1) break; - mir_sntprintf(szPath, MAX_PATH, _T("%.*s (%u)%s"), pImgext - szPath, szPath, i, imgext); + mir_sntprintf(szPath, SIZEOF(szPath), _T("%.*s (%u)%s"), pImgext - szPath, szPath, i, imgext); } if (res == 0) { -- cgit v1.2.3