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/Clist_mw/src/CLUIFrames/statusbar.cpp | 8 ------- plugins/Clist_mw/src/clcfonts.cpp | 2 +- plugins/Clist_mw/src/clui.cpp | 33 ++++++++------------------- plugins/Clist_mw/src/commonheaders.cpp | 2 +- plugins/Clist_mw/src/groupmenu.cpp | 4 ++-- 5 files changed, 14 insertions(+), 35 deletions(-) (limited to 'plugins/Clist_mw/src') diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp index 10a0ad3b4b..1b03281334 100644 --- a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -65,14 +65,6 @@ void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis) SelectClipRgn(dis->hDC, hrgn); char *szProto = PD->RealName; -#ifdef _DEBUG - { - //char buf[512]; - //sprintf(buf,"proto: %s draw at pos: %d\r\n",szProto,dis->rcItem.left); - //OutputDebugStringA(buf); - } -#endif - int status = CallProtoService(szProto,PS_GETSTATUS,0,0); SetBkMode(dis->hDC,TRANSPARENT); int x = dis->rcItem.left+extraspace; diff --git a/plugins/Clist_mw/src/clcfonts.cpp b/plugins/Clist_mw/src/clcfonts.cpp index 1ad20dc2b0..a5baeb4970 100644 --- a/plugins/Clist_mw/src/clcfonts.cpp +++ b/plugins/Clist_mw/src/clcfonts.cpp @@ -96,7 +96,7 @@ void RegisterCListFonts() strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); _tcsncpy(fontid.group, _T("Contact List"), SIZEOF(fontid.group)); _tcsncpy(fontid.name, szClistFontIdDescr[fontListOrder[i]], SIZEOF(fontid.name)); - sprintf(idstr, "Font%d", fontListOrder[i]); + mir_snprintf(idstr, SIZEOF(idstr), "Font%d", fontListOrder[i]); strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); fontid.order = fontListOrder[i]; FontRegisterT(&fontid); diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index f96a3a0697..97903b621d 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -136,7 +136,7 @@ int GetConnectingIconForProtoCount(char *szProto) GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH); str = strrchr(szPath,'\\'); if (str != NULL) *str = 0; - _snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\proto_conn_%s.dll", szPath, szProto); + mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\proto_conn_%s.dll", szPath, szProto); lstrcpynA(file,szFullPath,SIZEOF(file)); PathToAbsolute(file, fileFull); @@ -151,25 +151,12 @@ static HICON ExtractIconFromPath(const char *path) char file[MAX_PATH],fileFull[MAX_PATH]; int n; HICON hIcon; - { -// char buf[512]; -// sprintf(buf,"LoadIcon %s\r\n",path); -// OutputDebugStringA(buf); - } lstrcpynA(file,path,SIZEOF(file)); comma = strrchr(file,','); if (comma == NULL) n = 0; else {n = atoi(comma+1); *comma = 0;} PathToAbsolute(file, fileFull); -#ifdef _DEBUG - { -// char buf[512]; -// sprintf(buf,"LoadIconFull %d %s\r\n",n,fileFull); -// OutputDebugStringA(buf); - } -#endif - hIcon = NULL; ExtractIconExA(fileFull,n,NULL,&hIcon,1); return hIcon; @@ -189,7 +176,7 @@ HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean r GetModuleFileNameA(g_hInst, szMyPath, MAX_PATH); str = strrchr(szPath,'\\'); if (str != NULL) *str = 0; - _snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); + mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); } if ( !UseLibrary) { @@ -225,8 +212,8 @@ void RegisterProtoIcons (char *protoname) char buf2[256]; for (i = 0;i<8;i++) { - sprintf(buf,"%s #%d",protoname,i); - sprintf(buf2,"Contact List/Connection Icons %s",protoname); + mir_snprintf(buf, SIZEOF(buf), "%s #%d", protoname, i); + mir_snprintf(buf2, SIZEOF(buf2), "Contact List/Connection Icons %s", protoname); LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i)); } @@ -250,7 +237,7 @@ HICON GetConnectingIconForProto_DLL(char *szProto,int b) HICON hIcon = NULL; b = b-1; - _snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll",szProto); + mir_snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll", szProto); // hIcon = ExtractIconFromPath(szFullPath); // if (hIcon) return hIcon; @@ -260,7 +247,7 @@ HICON GetConnectingIconForProto_DLL(char *szProto,int b) #ifdef _DEBUG { char buf [256]; - sprintf(buf,"IconNotFound %s %d\r\n",szProto,b); + mir_snprintf(buf, SIZEOF(buf), "IconNotFound %s %d\r\n", szProto, b); // OutputDebugStringA(buf); } #endif @@ -270,7 +257,7 @@ HICON GetConnectingIconForProto_DLL(char *szProto,int b) #ifdef _DEBUG char buf [256]; - sprintf(buf,"Icon %d %d\r\n",GetTickCount(),b); + mir_snprintf(buf, SIZEOF(buf), "Icon %d %d\r\n", GetTickCount(), b); //OutputDebugStringA(buf); #endif return(LoadIconA(g_hInst,(LPCSTR)(IDI_ICQC1+b))); @@ -284,7 +271,7 @@ HICON GetConnectingIconForProto(char *szProto,int b) if ( db_get_b(NULL,"CList","UseProtoIconFromIcoLib",1)) { HICON hIcon = 0; char buf[256]; - sprintf(buf,"%s #%d",szProto,b); + mir_snprintf(buf, SIZEOF(buf), "%s #%d", szProto, b); hIcon = LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact List/Connection Icons",buf,0,NULL); if (hIcon == NULL) return (GetConnectingIconForProto_DLL(szProto,b)); @@ -459,7 +446,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l HANDLE hMap; char szName[MAX_PATH]; int rc = 0; - _snprintf(szName,SIZEOF(szName),"Miranda::%u", wParam); // caller will tell us the ID of the map + mir_snprintf(szName, SIZEOF(szName), "Miranda::%u", wParam); // caller will tell us the ID of the map hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS,FALSE,szName); if (hMap != NULL) { void *hView = NULL; @@ -468,7 +455,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l char szFilePath[MAX_PATH], szProfile[MAX_PATH]; CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)&szFilePath); CallService(MS_DB_GETPROFILENAME,MAX_PATH,(LPARAM)&szProfile); - _snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile); + mir_snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile); UnmapViewOfFile(hView); rc = 1; } diff --git a/plugins/Clist_mw/src/commonheaders.cpp b/plugins/Clist_mw/src/commonheaders.cpp index df68c5385c..c76992e096 100644 --- a/plugins/Clist_mw/src/commonheaders.cpp +++ b/plugins/Clist_mw/src/commonheaders.cpp @@ -16,7 +16,7 @@ DWORD exceptFunction(LPEXCEPTION_POINTERS EP) char buf[4096]; - sprintf(buf,"\r\nExceptCode: %x\r\nExceptFlags: %x\r\nExceptAddress: %p\r\n", + mir_snprintf(buf, SIZEOF(buf), "\r\nExceptCode: %x\r\nExceptFlags: %x\r\nExceptAddress: %p\r\n", EP->ExceptionRecord->ExceptionCode, EP->ExceptionRecord->ExceptionFlags, EP->ExceptionRecord->ExceptionAddress diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index 01f428247d..821a57d754 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -103,7 +103,7 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) tmi.ownerdata = mmep; char buf[1024]; - sprintf(buf,"%s/%s",mi->pszService,mi->pszName); + mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName); OptParam op; op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi); @@ -472,7 +472,7 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam) tmi.ownerdata = mmep; char buf[1024]; - sprintf(buf,"%s/%s",mi->pszService,mi->pszName); + mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName); OptParam op; op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi); -- cgit v1.2.3