From 688f55ba998c19304a29727c910504903f4cc49a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Nov 2014 18:51:36 +0000 Subject: lstr* replacements git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/chat/log.cpp | 32 +++++++++++++++---------------- plugins/TabSRMM/src/chat/message.cpp | 8 ++++---- plugins/TabSRMM/src/chat/options.cpp | 10 +++++----- plugins/TabSRMM/src/chat/services.cpp | 6 +++--- plugins/TabSRMM/src/chat/tools.cpp | 10 +++++----- plugins/TabSRMM/src/chat/window.cpp | 36 +++++++++++++++++------------------ 6 files changed, 51 insertions(+), 51 deletions(-) (limited to 'plugins/TabSRMM/src/chat') diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 37987d4278..cdc0a8af53 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -144,7 +144,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, TCHAR ** } if ( szTemp[0] ) { - size_t iLen = lstrlen(szTemp); + size_t iLen = mir_tstrlen(szTemp); memcpy( d, szTemp, iLen * sizeof(TCHAR)); d += iLen; } @@ -432,9 +432,9 @@ static TCHAR * _tcsrplc(TCHAR **src, const TCHAR *ptrn, const TCHAR *rplc) size_t lSrc, lPtrn, lRplc; TCHAR *tszFound, *tszTail; - lSrc = lstrlen(*src); - lPtrn = lstrlen(ptrn); - lRplc = lstrlen(rplc); + lSrc = mir_tstrlen(*src); + lPtrn = mir_tstrlen(ptrn); + lRplc = mir_tstrlen(rplc); if (lPtrn && lSrc && lSrc >= lPtrn && (tszFound = _tcsstr(*src, ptrn)) != NULL) { if (lRplc > lPtrn) *src = (TCHAR*) mir_realloc((void*) * src, @@ -463,9 +463,9 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r size_t lSrc, lPtrn, lRplc; TCHAR *tszFound, *tszTail; - lSrc = lstrlen(src); - lPtrn = lstrlen(ptrn); - lRplc = lstrlen(rplc); + lSrc = mir_tstrlen(src); + lPtrn = mir_tstrlen(ptrn); + lRplc = mir_tstrlen(rplc); if (lPtrn && lSrc && lSrc >= lPtrn && /* lengths are ok */ (tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */ (n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */ @@ -591,7 +591,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff } if (szTemp[0]) { - int iLen = lstrlenA(szTemp); + int iLen = mir_strlen(szTemp); memcpy(d, szTemp, iLen); d += iLen; } @@ -623,11 +623,11 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, return; if (streamData->lin->ptszNick) { - if (g_Settings.bLogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) { - lstrcpyn(szTemp, streamData->lin->ptszNick, 20); - lstrcpyn(szTemp + 20, _T("..."), 4); + if (g_Settings.bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) { + mir_tstrncpy(szTemp, streamData->lin->ptszNick, 20); + mir_tstrncpy(szTemp + 20, _T("..."), 4); } - else lstrcpyn(szTemp, streamData->lin->ptszNick, 511); + else mir_tstrncpy(szTemp, streamData->lin->ptszNick, 511); if (g_Settings.bClickableNicks) mir_sntprintf(szTemp2, SIZEOF(szTemp2), _T("~~++#%s#++~~"), szTemp); @@ -883,8 +883,8 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings.bShowTime) { TCHAR szTimeStamp[30], szOldTimeStamp[30]; - lstrcpyn(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), 30); - lstrcpyn(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), 30); + mir_tstrncpy(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), 30); + mir_tstrncpy(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), 30); if (!g_Settings.bShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) { streamData->si->LastTime = lin->time; Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp); @@ -906,7 +906,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings.bLogClassicIndicators) Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s", pszIndicator); - lstrcpyn(pszTemp, lin->bIsMe ? g_Settings.pszOutgoingNick : g_Settings.pszIncomingNick, 299); + mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings.pszOutgoingNick : g_Settings.pszIncomingNick, 299); p1 = _tcsstr(pszTemp, _T("%n")); if (p1) p1[1] = 's'; @@ -950,7 +950,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG if (lstrdat->buffer == NULL) { lstrdat->bufferOffset = 0; lstrdat->buffer = Log_CreateRTF(lstrdat); - lstrdat->bufferLen = lstrlenA(lstrdat->buffer); + lstrdat->bufferLen = mir_strlen(lstrdat->buffer); } // give the RTF to the RE control diff --git a/plugins/TabSRMM/src/chat/message.cpp b/plugins/TabSRMM/src/chat/message.cpp index 605341583d..4c45d5bb11 100644 --- a/plugins/TabSRMM/src/chat/message.cpp +++ b/plugins/TabSRMM/src/chat/message.cpp @@ -107,7 +107,7 @@ TCHAR* Chat_DoRtfToTags(char* pszText, SESSION_INFO *si) } else p1 += 7; - MoveMemory(pszText, p1, lstrlenA(p1) + 1); + MoveMemory(pszText, p1, mir_strlen(p1) + 1); p1 = pszText; // iterate through all characters, if rtf control character found then take action @@ -295,9 +295,9 @@ TCHAR* Chat_DoRtfToTags(char* pszText, SESSION_INFO *si) // move the memory and paste in new commands instead of the old RTF if (InsertThis[0] || iRemoveChars) { - MoveMemory(p1 + lstrlenA(InsertThis) , p1 + iRemoveChars, lstrlenA(p1) - iRemoveChars + 1); - CopyMemory(p1, InsertThis, lstrlenA(InsertThis)); - p1 += lstrlenA(InsertThis); + MoveMemory(p1 + mir_strlen(InsertThis) , p1 + iRemoveChars, mir_strlen(p1) - iRemoveChars + 1); + CopyMemory(p1, InsertThis, mir_strlen(InsertThis)); + p1 += mir_strlen(InsertThis); } else p1++; } diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 12567262b6..1103d33dd8 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -224,14 +224,14 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM mir_snprintf(str, SIZEOF(str), "Font%d", i); if ((i == 17 && !strcmp(szMod, CHATFONT_MODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) { lf->lfCharSet = SYMBOL_CHARSET; - lstrcpyn(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName)); + mir_tstrncpy(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName)); } else { ptrT tszDefFace(db_get_tsa(NULL, szMod, str)); if (tszDefFace == NULL) - lstrcpy(lf->lfFaceName, fol[j].szDefFace); + mir_tstrcpy(lf->lfFaceName, fol[j].szDefFace); else - lstrcpyn(lf->lfFaceName, tszDefFace, SIZEOF(lf->lfFaceName)); + mir_tstrncpy(lf->lfFaceName, tszDefFace, SIZEOF(lf->lfFaceName)); } } } @@ -885,11 +885,11 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (idList) { const TCHAR *szUserDir = M.getUserDir(); SHGetPathFromIDList(idList, tszDirectory); - lstrcat(tszDirectory, _T("\\")); + mir_tstrcat(tszDirectory, _T("\\")); TCHAR tszTemp[MAX_PATH]; PathToRelativeT(tszDirectory, tszTemp, szUserDir); - SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), lstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME); + SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME); } psMalloc->Free(idList); psMalloc->Release(); diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 722d902956..6e76d1a302 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -58,15 +58,15 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT // cut nickname if larger than x chars... TCHAR newcontactname[128]; - if (lstrlen(contactName) > 0) { + if (mir_tstrlen(contactName) > 0) { if (M.GetByte("cuttitle", 0)) CutContactName(contactName, newcontactname, SIZEOF(newcontactname)); else { - lstrcpyn(newcontactname, contactName, SIZEOF(newcontactname)); + mir_tstrncpy(newcontactname, contactName, SIZEOF(newcontactname)); newcontactname[127] = 0; } } - else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname)); + else mir_tstrncpy(newcontactname, _T("_U_"), SIZEOF(newcontactname)); newData.item.pszText = newcontactname; newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 2c803e4b98..dcbb4947e2 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -103,7 +103,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa va_list marker; static TCHAR szBuf[4 * 1024]; - if (!fmt || lstrlen(fmt) == 0 || lstrlen(fmt) > 2000) + if (!fmt || mir_tstrlen(fmt) == 0 || mir_tstrlen(fmt) > 2000) return 0; va_start(marker, fmt); @@ -122,7 +122,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, pcli->pfnGetContactDisplayName(hContact, 0)); - lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE); + mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE); pd.iSeconds = g_Settings.iPopupTimeout; if (g_Settings.iPopupStyle == 2) { @@ -554,10 +554,10 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO if (pszWordText) mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("&Message %s"), pszWordText); else - lstrcpyn(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1); + mir_tstrncpy(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1); - if (lstrlen(szTemp) > 40) - lstrcpyn(szTemp + 40, _T("..."), 4); + if (mir_tstrlen(szTemp) > 40) + mir_tstrncpy(szTemp + 40, _T("..."), 4); ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp); gcmi.Type = MENU_ON_NICKLIST; } diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 23489fd0c9..1fb1a58d68 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -208,7 +208,7 @@ bool IsStringValidLink(TCHAR* pszText) { if (pszText == NULL) return false; - if (lstrlen(pszText) < 5 || _tcschr(pszText, '"')) + if (mir_tstrlen(pszText) < 5 || _tcschr(pszText, '"')) return false; if (_totlower(pszText[0]) == 'w' && _totlower(pszText[1]) == 'w' && _totlower(pszText[2]) == 'w' && pszText[3] == '.' && _istalnum(pszText[4])) @@ -1535,11 +1535,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; } if (wParam == '\b' && si->szSearch[0]) // backspace - si->szSearch[lstrlen(si->szSearch) - 1] = '\0'; + si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0'; else if (wParam < ' ') break; else { - if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) { + if (mir_tstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) { MessageBeep(MB_OK); break; } @@ -1557,7 +1557,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, for (i=0; i < iItems; i++) { USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i); if (ui) { - if (!_tcsnicmp(ui->pszNick, si->szSearch, lstrlen(si->szSearch))) { + if (!_tcsnicmp(ui->pszNick, si->szSearch, mir_tstrlen(si->szSearch))) { SendMessage(hwnd, LB_SETSEL, FALSE, -1); SendMessage(hwnd, LB_SETSEL, TRUE, i); si->iSearchItem = i; @@ -1568,7 +1568,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (i == iItems) { MessageBeep(MB_OK); - si->szSearch[lstrlen(si->szSearch) - 1] = '\0'; + si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0'; return 0; } } @@ -1994,11 +1994,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar dat->wStatus = si->wStatus; const TCHAR *szNick = dat->cache->getNick(); - if (lstrlen(szNick) > 0) { + if (mir_tstrlen(szNick) > 0) { if (M.GetByte("cuttitle", 0)) CutContactName(szNick, dat->newtitle, SIZEOF(dat->newtitle)); else { - lstrcpyn(dat->newtitle, szNick, SIZEOF(dat->newtitle)); + mir_tstrncpy(dat->newtitle, szNick, SIZEOF(dat->newtitle)); dat->newtitle[129] = 0; } } @@ -2096,7 +2096,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (si->ptszStatusbarText) mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), _T("%s %s"), mi->ptszModDispName, si->ptszStatusbarText); else { - lstrcpyn(szFinalStatusBarText, mi->ptszModDispName, SIZEOF(szFinalStatusBarText)); + mir_tstrncpy(szFinalStatusBarText, mi->ptszModDispName, SIZEOF(szFinalStatusBarText)); szFinalStatusBarText[511] = 0; } } @@ -2332,16 +2332,16 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SIZE sz; if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) { COLORREF clr_orig = GetTextColor(dis->hDC); - GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(si->szSearch), &sz); + GetTextExtentPoint32(dis->hDC, ui->pszNick, mir_tstrlen(si->szSearch), &sz); SetTextColor(dis->hDC, RGB(250, 250, 0)); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(si->szSearch)); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, mir_tstrlen(si->szSearch)); SetTextColor(dis->hDC, clr_orig); x_offset += sz.cx; - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + lstrlen(si->szSearch), lstrlen(ui->pszNick) - lstrlen(si->szSearch)); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_tstrlen(si->szSearch), mir_tstrlen(ui->pszNick) - mir_tstrlen(si->szSearch)); } else { - GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(ui->pszNick), &sz); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(ui->pszNick)); + GetTextExtentPoint32(dis->hDC, ui->pszNick, mir_tstrlen(ui->pszNick), &sz); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, mir_tstrlen(ui->pszNick)); SelectObject(dis->hDC, hOldFont); } return TRUE; @@ -2665,7 +2665,7 @@ LABEL_SHOWWINDOW: int iRes = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes > 0) { - int iLen = lstrlen(pszWord) - 1; + int iLen = mir_tstrlen(pszWord) - 1; while (iLen >= 0 && strchr(szTrimString, pszWord[iLen])) { pszWord[iLen] = '\0'; iLen--; @@ -2785,8 +2785,8 @@ LABEL_SHOWWINDOW: break; EmptyClipboard(); { - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (lstrlen(tr.lpstrText) + 1)); - lstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (mir_tstrlen(tr.lpstrText) + 1)); + mir_tstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); } @@ -2842,7 +2842,7 @@ LABEL_SHOWWINDOW: else if (msg == WM_LBUTTONUP) { USERINFO *ui = si->pUsers; SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr); - size_t bufSize = lstrlen(tr.lpstrText) + lstrlen(tszAplTmpl) + 3; + size_t bufSize = mir_tstrlen(tr.lpstrText) + mir_tstrlen(tszAplTmpl) + 3; tszTmp = tszAppeal = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR)); tr2.lpstrText = (LPTSTR) mir_alloc(sizeof(TCHAR) * 2); if (chr.cpMin) { @@ -2857,7 +2857,7 @@ LABEL_SHOWWINDOW: else /* in the beginning of the message window */ mir_sntprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText); - st = lstrlen(tszAppeal); + st = mir_tstrlen(tszAppeal); if (chr.cpMax != -1) { tr2.chrg.cpMin = chr.cpMax; tr2.chrg.cpMax = chr.cpMax + 1; -- cgit v1.2.3