From bb4a25ee1fb590c3fc84177d3c9518add8ac0c58 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 16 May 2015 17:11:02 +0000 Subject: cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@13623 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MyDetails/src/data.cpp | 6 ++-- plugins/MyDetails/src/frame.cpp | 66 +++++++++++++++++++------------------- plugins/MyDetails/src/services.cpp | 24 +++++++------- 3 files changed, 48 insertions(+), 48 deletions(-) (limited to 'plugins/MyDetails') diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index ff55810448..52111dadcb 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -427,7 +427,7 @@ Protocol *ProtocolArray::Get(const char *name) return NULL; for (int i = 0; i < buffer_len; i++) - if (strcmp(name, buffer[i]->name) == 0) + if (mir_strcmp(name, buffer[i]->name) == 0) return buffer[i]; return NULL; @@ -522,7 +522,7 @@ void ProtocolArray::GetDefaultNick() { ptrT tszNick(db_get_tsa(0, MODULE_NAME, SETTING_DEFAULT_NICK)); if (tszNick) - _tcsncpy_s(default_nick, tszNick, _TRUNCATE); + mir_tstrncpy(default_nick, tszNick, SIZEOF(default_nick)); else default_nick[0] = '\0'; } @@ -531,7 +531,7 @@ void ProtocolArray::GetDefaultAvatar() { ptrT tszFile(db_get_tsa(0, "ContactPhoto", "File")); if (tszFile) - _tcsncpy_s(default_avatar_file, tszFile, _TRUNCATE); + mir_tstrncpy(default_avatar_file, tszFile, SIZEOF(default_avatar_file)); else default_avatar_file[0] = '\0'; } diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index a72b2148ad..125f423f87 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -234,19 +234,19 @@ int CreateFrame() memset(&font_id[i], 0, sizeof(font_id[i])); font_id[i].cbSize = sizeof(FontIDT); - _tcsncpy(font_id[i].group, LPGENT("My details"), SIZEOF(font_id[i].group)); - _tcsncpy(font_id[i].name, font_names[i], SIZEOF(font_id[i].name)); - strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, SIZEOF(font_id[i].dbSettingsGroup)); - _tcsncpy(font_id[i].backgroundName, LPGENT("Background"), SIZEOF(font_id[i].backgroundName)); - _tcsncpy(font_id[i].backgroundGroup, LPGENT("My details"), SIZEOF(font_id[i].backgroundGroup)); + mir_tstrncpy(font_id[i].group, LPGENT("My details"), SIZEOF(font_id[i].group)); + mir_tstrncpy(font_id[i].name, font_names[i], SIZEOF(font_id[i].name)); + mir_strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, SIZEOF(font_id[i].dbSettingsGroup)); + mir_tstrncpy(font_id[i].backgroundName, LPGENT("Background"), SIZEOF(font_id[i].backgroundName)); + mir_tstrncpy(font_id[i].backgroundGroup, LPGENT("My details"), SIZEOF(font_id[i].backgroundGroup)); - strncpy(font_id[i].prefix, font_settings[i], SIZEOF(font_id[i].prefix)); + mir_strncpy(font_id[i].prefix, font_settings[i], SIZEOF(font_id[i].prefix)); font_id[i].deffontsettings.colour = font_colors[i]; font_id[i].deffontsettings.size = -MulDiv(font_sizes[i], GetDeviceCaps(hdc, LOGPIXELSY), 72); font_id[i].deffontsettings.style = font_styles[i]; font_id[i].deffontsettings.charset = DEFAULT_CHARSET; - _tcsncpy(font_id[i].deffontsettings.szFace, _T("Tahoma"), SIZEOF(font_id[i].deffontsettings.szFace)); + mir_tstrncpy(font_id[i].deffontsettings.szFace, _T("Tahoma"), SIZEOF(font_id[i].deffontsettings.szFace)); font_id[i].order = i; font_id[i].flags = FIDF_DEFAULTVALID; FontRegisterT(&font_id[i]); @@ -490,7 +490,7 @@ RECT GetRect(HDC hdc, RECT rc, const TCHAR *text, const TCHAR *def_text, Protoco RECT r_tmp = rc; // Only first line - TCHAR *tmp2 = _tcsdup(tmp); + TCHAR *tmp2 = mir_tstrdup(tmp); TCHAR *pos = _tcschr(tmp2, '\r'); if (pos != NULL) pos[0] = '\0'; @@ -499,7 +499,7 @@ RECT GetRect(HDC hdc, RECT rc, const TCHAR *text, const TCHAR *def_text, Protoco pos[0] = '\0'; if (smileys) - DRAW_TEXT(hdc, tmp2, (int)_tcslen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name); + DRAW_TEXT(hdc, tmp2, (int)mir_tstrlen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name); else DrawText(hdc, tmp2, -1, &r_tmp, uFormat | DT_CALCRECT); @@ -1026,7 +1026,7 @@ void DrawTextWithRect(HDC hdc, const TCHAR *text, const TCHAR *def_text, RECT rc tmp = text; // Only first line - TCHAR *tmp2 = _tcsdup(tmp); + TCHAR *tmp2 = mir_tstrdup(tmp); TCHAR *pos = _tcsrchr(tmp2, '\r'); if (pos != NULL) pos[0] = '\0'; @@ -1069,7 +1069,7 @@ void DrawTextWithRect(HDC hdc, const TCHAR *text, const TCHAR *def_text, RECT rc } } - DRAW_TEXT(hdc, tmp2, (int)_tcslen(tmp2), &r, uFormat, proto->name); + DRAW_TEXT(hdc, tmp2, (int)mir_tstrlen(tmp2), &r, uFormat, proto->name); if (mouse_over) DrawText(hdc, _T(" ..."), 4, &rc_tmp, uFormat); @@ -1263,7 +1263,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_STATUS]); SetTextColor(hdc, font_colour[FONT_STATUS]); - DRAW_TEXT(hdc, proto->status_name, (int)_tcslen(proto->status_name), &rc, uFormat, proto->name); + DRAW_TEXT(hdc, proto->status_name, (int)mir_tstrlen(proto->status_name), &rc, uFormat, proto->name); SelectClipRgn(hdc, NULL); DeleteObject(rgn); @@ -1418,7 +1418,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto mii.dwTypeData = (TCHAR *)malloc(sizeof(TCHAR) * mii.cch); GetMenuItemInfo(menu, i, TRUE, &mii); - if (_tcscmp(mii.dwTypeData, proto->description) == 0) + if (mir_tstrcmp(mii.dwTypeData, proto->description) == 0) submenu = GetSubMenu(menu, i); free(mii.dwTypeData); @@ -1483,7 +1483,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P mii.fType = MFT_STRING; mii.fState = proto->ListeningToEnabled() ? MFS_CHECKED : 0; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 1; if (!proto->CanSetListeningTo()) @@ -1664,7 +1664,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = protocols->Get(i)->description; - mii.cch = (int)_tcslen(protocols->Get(i)->description); + mii.cch = (int)mir_tstrlen(protocols->Get(i)->description); mii.wID = i + 1; if (i == data->protocol_number) { @@ -1725,7 +1725,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 1; if (!proto->CanSetAvatar()) { @@ -1765,7 +1765,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 1; if (!proto->CanSetNick()) { @@ -1813,7 +1813,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 1; if (!proto->CanSetStatusMsg()) { @@ -1833,7 +1833,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 2; if (proto->status == ID_STATUS_OFFLINE) { @@ -1899,7 +1899,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fType = MFT_STRING; mii.fState = proto->ListeningToEnabled() ? MFS_CHECKED : 0; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 5; if (!proto->CanSetListeningTo()) mii.fState |= MFS_DISABLED; @@ -1915,7 +1915,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 4; if (proto->status == ID_STATUS_OFFLINE) { @@ -1934,7 +1934,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 3; if (!proto->CanSetStatusMsg()) { @@ -1952,7 +1952,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 2; if (!proto->CanSetNick()) { @@ -1969,7 +1969,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_ID | MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = tmp; - mii.cch = (int)_tcslen(tmp); + mii.cch = (int)mir_tstrlen(tmp); mii.wID = 1; if (!proto->CanSetAvatar()) { @@ -2373,7 +2373,7 @@ INT_PTR PluginCommand_ShowProtocol(WPARAM, LPARAM lParam) int proto_num = -1; for (int i = 0; i < protocols->GetSize(); i++) { - if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) { proto_num = i; break; } @@ -2409,13 +2409,13 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) if ((HANDLE)wParam == NULL) { Protocol *proto = protocols->Get(cws->szModule); - if (!strcmp(cws->szSetting, "MyHandle") - || !strcmp(cws->szSetting, "UIN") - || !strcmp(cws->szSetting, "Nick") - || !strcmp(cws->szSetting, "FirstName") - || !strcmp(cws->szSetting, "e-mail") - || !strcmp(cws->szSetting, "LastName") - || !strcmp(cws->szSetting, "JID")) + if (!mir_strcmp(cws->szSetting, "MyHandle") + || !mir_strcmp(cws->szSetting, "UIN") + || !mir_strcmp(cws->szSetting, "Nick") + || !mir_strcmp(cws->szSetting, "FirstName") + || !mir_strcmp(cws->szSetting, "e-mail") + || !mir_strcmp(cws->szSetting, "LastName") + || !mir_strcmp(cws->szSetting, "JID")) { // Name changed if (proto != NULL) @@ -2424,7 +2424,7 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) else if (strstr(cws->szModule, "Away")) // Status message changed PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, 0, 0); - else if (proto != NULL && strcmp(cws->szSetting, "ListeningTo") == 0) + else if (proto != NULL && mir_strcmp(cws->szSetting, "ListeningTo") == 0) PostMessage(hwnd_frame, MWM_LISTENINGTO_CHANGED, (WPARAM)proto->name, 0); } diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index 2c68022b63..b9ec1cb21e 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -52,14 +52,14 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam bool foundDefNick = true; for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) { - if (_tcsicmp(protocols->Get(i)->nickname, nick) != 0) { + if (mir_tstrcmpi(protocols->Get(i)->nickname, nick) != 0) { foundDefNick = false; break; } } if (foundDefNick) - if (_tcsicmp(protocols->default_nick, nick) != 0) + if (mir_tstrcmpi(protocols->default_nick, nick) != 0) mir_tstrcpy(protocols->default_nick, nick); } @@ -130,7 +130,7 @@ INT_PTR PluginCommand_SetMyNicknameUI(WPARAM, LPARAM lParam) if (proto != NULL) { int i; for (i = 0; i < protocols->GetSize(); i++) { - if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) { proto_num = i; break; } @@ -164,7 +164,7 @@ INT_PTR PluginCommand_SetMyNickname(WPARAM wParam, LPARAM lParam) char *proto = (char *)wParam; if (proto != NULL) { for (int i = 0; i < protocols->GetSize(); i++) { - if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) { if (!protocols->Get(i)->CanSetNick()) return -2; @@ -212,7 +212,7 @@ INT_PTR PluginCommand_SetMyAvatarUI(WPARAM, LPARAM lParam) if (proto != NULL) { int i; for (i = 0; i < protocols->GetSize(); i++) { - if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) { proto_num = i; break; } @@ -238,7 +238,7 @@ INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam, LPARAM lParam) char *proto = (char *)wParam; if (proto != NULL) { for (int i = 0; i < protocols->GetSize(); i++) { - if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) { if (!protocols->Get(i)->CanSetAvatar()) return -2; @@ -268,7 +268,7 @@ INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam) } for (int i = 0; i < protocols->GetSize(); i++) { - if (_stricmp(protocols->Get(i)->name, proto) == 0) { + if (mir_strcmpi(protocols->Get(i)->name, proto) == 0) { if (!protocols->Get(i)->CanGetAvatar()) return -2; @@ -403,14 +403,14 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam) int proto_num = -1; Protocol *proto = NULL; - if (status != 0 && (status < ID_STATUS_OFFLINE || status > ID_STATUS_OUTTOLUNCH)) + if (status != 0 && (status < ID_STATUS_OFFLINE || status > ID_STATUS_OUTTOLUNCH)) return -10; if (proto_name != NULL) { for (int i = 0; i < protocols->GetSize(); i++) { proto = protocols->Get(i); - if (_stricmp(proto->name, proto_name) == 0) { + if (mir_strcmpi(proto->name, proto_name) == 0) { proto_num = i; break; } @@ -425,10 +425,10 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam) else if (ServiceExists(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG)) { if (status != 0) CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, status, (LPARAM)proto_name); - else if (proto != 0) - CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, proto->status, (LPARAM)proto_name); + else if (proto != 0) + CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, proto->status, (LPARAM)proto_name); else - CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, protocols->GetGlobalStatus(), NULL); + CallService(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, protocols->GetGlobalStatus(), NULL); return 0; } -- cgit v1.2.3