diff options
author | George Hazan <george.hazan@gmail.com> | 2014-11-30 13:03:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-11-30 13:03:10 +0000 |
commit | 46789bd14d5fc7448dbd1b68138a8b08964353bc (patch) | |
tree | 27851079c9870206fe7ccb9e2248dff8ff550af2 /plugins/UserInfoEx/src | |
parent | 1f91ea192b7cbc5265e9bca4c69fcbc157402cfa (diff) |
safe lstr* replacements: mir_strlen, mir_wstrlen, mir_strcpy, mir_wstrcpy,
mir_strncpy, mir_wstrncpy, mir_strcat, mir_wstrcat, mir_strncat, mir_wstrncat
git-svn-id: http://svn.miranda-ng.org/main/trunk@11171 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r-- | plugins/UserInfoEx/src/classPsTreeItem.cpp | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_contact.cpp | 12 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_edit.cpp | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_msgbox.cpp | 4 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 18 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_db.cpp | 6 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_string.cpp | 36 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_string.h | 46 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/psp_options.cpp | 6 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_contactinfo.cpp | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_refreshci.cpp | 14 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_reminder.cpp | 18 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_timezone_old.cpp | 4 |
18 files changed, 71 insertions, 127 deletions
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 602557707a..2969b61fd5 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -215,7 +215,7 @@ BYTE CPsTreeItem::HasName(const LPCSTR pszName) const void CPsTreeItem::Rename(const LPTSTR pszLabel)
{
if (pszLabel && *pszLabel) {
- LPTSTR pszDup = mir_tcsdup(pszLabel);
+ LPTSTR pszDup = mir_tstrdup(pszLabel);
if (pszDup) {
replaceStrT(_ptszLabel, pszDup);
// convert disallowed characters
@@ -257,7 +257,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) LPTSTR ptszLabel = mir_utf8decodeT(pszName);
if (ptszLabel) {
- _ptszLabel = mir_tcsdup(TranslateTS(ptszLabel));
+ _ptszLabel = mir_tstrdup(TranslateTS(ptszLabel));
mir_free(ptszLabel);
}
}
@@ -279,7 +279,7 @@ HICON CPsTreeItem::ProtoIcon() if (!CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&ProtoCount, (LPARAM)&pa)) {
if (_pszName) {
for (int i = 0; i < ProtoCount; i++) {
- if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tcslen(pa[i]->tszAccountName))) {
+ if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) {
CHAR szIconID[MAX_PATH];
mir_snprintf(szIconID, SIZEOF(szIconID), "core_status_%s1", pa[i]->szModuleName);
HICON hIco = Skin_GetIcon(szIconID);
@@ -416,7 +416,7 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp) if (_dwFlags & ODPF_USERINFOTAB)
mir_sntprintf(szTitle, SIZEOF(szTitle), _T("%s\\%s"), odp->ptszTitle, odp->ptszTab);
else
- mir_tcscpy(szTitle, odp->ptszTitle);
+ mir_tstrcpy(szTitle, odp->ptszTitle);
}
// set the unique utf8 encoded name for the item
if (err = Name(szTitle, (_dwFlags & ODPF_UNICODE) == ODPF_UNICODE))
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 9c527acf06..1bf0f67b00 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -942,7 +942,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbex->pItems[cbex->numItems].dwID = (pItem->wMask & CBEXIM_ID) ? pItem->dwID : 0;
// set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) {
mir_sntprintf(cbex->pItems[cbex->numItems].szCat, MAX_CAT, _T("%s %d"), TranslateT("Other"), ++cbex->numOther);
}
@@ -982,7 +982,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L // set new category string
if (pItem->wMask & CBEXIM_CAT) {
// set category string
- if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tcsncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, SIZEOF(cbex->pItems[pItem->iItem].szCat)))
+ if (!pItem->pszCat || !pItem->pszCat[0] || !mir_tstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, SIZEOF(cbex->pItems[pItem->iItem].szCat)))
mir_sntprintf(cbex->pItems[pItem->iItem].szCat, MAX_CAT, _T("%s %d\0"), TranslateT("Other"), ++cbex->numOther);
if (pItem->iItem == cbex->iSelectedItem)
SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat);
@@ -1046,14 +1046,14 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L // return category string
if ((pItem->wMask & CBEXIM_CAT) && pItem->pszCat) {
if (*cbex->pItems[pItem->iItem].szCat != 0)
- mir_tcsncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
+ mir_tstrncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1);
else
*pItem->pszCat = 0;
}
// return value string
if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal) {
if (cbex->pItems[pItem->iItem].pszVal)
- mir_tcsncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
+ mir_tstrncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1);
else
*pItem->pszVal = 0;
}
@@ -1428,7 +1428,7 @@ int CtrlContactWriteItemToDB( db_unset(hContact, pszModule, pszSetting);
else {
if (cbi.wFlags & CBEXIF_SMS)
- mir_tcsncat(szVal, _T(" SMS"), SIZEOF(szVal));
+ mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal));
if (db_set_ts(hContact, pszModule, pszSetting, szVal)) return 1;
}
@@ -1478,7 +1478,7 @@ int CtrlContactWriteMyItemsToDB( while (CtrlContactWndProc(hCtrl, CBEXM_GETITEM, NULL, (LPARAM)&cbi) && cbi.iItem < 50) {
if (!(cbi.wFlags & CBEXIF_DELETED) && *szVal) {
if (cbi.wFlags & CBEXIF_SMS) {
- mir_tcsncat(szVal, _T(" SMS"), SIZEOF(szVal));
+ mir_tstrncat(szVal, _T(" SMS"), SIZEOF(szVal));
}
mir_snprintf(pszSetting, MAXSETTING, szFormatCat, i);
if (*szCat && _tcsncmp(szCat, pszOther, ccOther)) {
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index 71e5f5e0de..cf9511b7f1 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -124,19 +124,19 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) case DBVT_BYTE: _itot_s(dbv.bVal, szText, SIZEOF(szText), 10); SetWindowText(_hwnd, szText); - _pszValue = mir_tcsdup(szText); + _pszValue = mir_tstrdup(szText); break; case DBVT_WORD: _itot_s(dbv.wVal, szText, SIZEOF(szText), 10); SetWindowText(_hwnd, szText); - _pszValue = mir_tcsdup(szText); + _pszValue = mir_tstrdup(szText); break; case DBVT_DWORD: _itot_s(dbv.dVal, szText, SIZEOF(szText), 10); SetWindowText(_hwnd, szText); - _pszValue = mir_tcsdup(szText); + _pszValue = mir_tstrdup(szText); break; case DBVT_TCHAR: @@ -250,7 +250,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) { const int cch = GetWindowTextLength(_hwnd); - _Flags.B.hasChanged = mir_tcslen(_pszValue) != cch; + _Flags.B.hasChanged = mir_tstrlen(_pszValue) != cch; _Flags.B.hasCustom = (cch > 0); if (!_Flags.B.hasChanged && _Flags.B.hasCustom) { diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index 9b4ffac422..ab1fc0064c 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -290,6 +290,6 @@ void CTzCombo::GetTime(LPTSTR szTime, WORD cchTime) now.UTCToTzSpecificLocal(&tzi);
now.TimeFormat(szTime, cchTime);
}
- else mir_tcscpy(szTime, _T("--:--"));
+ else mir_tstrcpy(szTime, _T("--:--"));
}
}
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 9635a2cb70..feb3ff0beb 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -476,8 +476,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP pd.lchContact = NULL; //(HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
// CALLBAC Proc
pd.PluginWindowProc = PopupProc;
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 6eccd83b4e..326d610276 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -443,56 +443,56 @@ static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProt odp.position = 0x8000000;
odp.pfnDlgProc = PSPProcGeneral;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_GENERAL);
- mir_tcsncpy(szTitle + ofs, LPGENT("General"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000001;
odp.pfnDlgProc = PSPProcContactHome;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Contact (private)"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Contact (private)"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ORIGIN);
odp.position = 0x8000002;
odp.pfnDlgProc = PSPProcOrigin;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADVANCED);
- mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Origin"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Origin"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ANNIVERSARY);
odp.position = 0x8000003;
odp.pfnDlgProc = PSPProcAnniversary;
odp.hIcon = (HICON)ICONINDEX(IDI_BIRTHDAY);
- mir_tcsncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Anniversaries"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("General") _T("\\") LPGENT("Anniversaries"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COMPANY);
odp.position = 0x8000004;
odp.pfnDlgProc = PSPProcCompany;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_COMPANY);
- mir_tcsncpy(szTitle + ofs, LPGENT("Work"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("Work"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ADDRESS);
odp.position = 0x8000005;
odp.pfnDlgProc = PSPProcContactWork;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ADDRESS);
- mir_tcsncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (work)"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("Work") _T("\\") LPGENT("Contact (work)"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_ABOUT);
odp.position = 0x8000006;
odp.pfnDlgProc = PSPProcAbout;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_ABOUT);
- mir_tcsncpy(szTitle + ofs, LPGENT("About"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("About"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_PROFILE);
odp.position = 0x8000007;
odp.pfnDlgProc = PSPProcContactProfile;
odp.hIcon = (HICON)ICONINDEX(IDI_TREE_PROFILE);
- mir_tcsncpy(szTitle + ofs, LPGENT("About") _T("\\") LPGENT("Profile"), SIZEOF(szTitle) - ofs);
+ mir_tstrncpy(szTitle + ofs, LPGENT("About") _T("\\") LPGENT("Profile"), SIZEOF(szTitle) - ofs);
AddPage(wParam, (LPARAM)&odp);
return 0;
}
@@ -745,7 +745,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar GetObject(hNormalFont, sizeof(lf), &lf);
lf.lfHeight = 22;
- mir_tcscpy(lf.lfFaceName, _T("Segoe UI"));
+ mir_tstrcpy(lf.lfFaceName, _T("Segoe UI"));
pPs->hCaptionFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)pPs->hCaptionFont, 0);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index f26e726efe..0e294afdfe 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -306,7 +306,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar case EXIM_GROUP:
break;
case EXIM_SUBGROUP:
- if (mir_tcsncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tcslen(pDat->ExImContact->ptszName))) {
+ if (mir_tcsncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(pDat->ExImContact->ptszName))) {
continue;
}
break;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 0d59af26ec..3b52fc4062 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -116,7 +116,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara case 41063:
ZeroMemory(szBtnText, sizeof(szBtnText));
- mir_tcsncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
+ mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText));
iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText);
if (iString != -1) tbb->iString = iString;
// set tooltip
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index 0f27390c84..d2d946001e 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -159,7 +159,7 @@ size_t CLineBuffer::operator + (const CHAR *szVal) size_t CLineBuffer::operator + (const WCHAR *wszVal)
{
if (wszVal) {
- size_t cbLength = mir_wcslen(wszVal);
+ size_t cbLength = mir_wstrlen(wszVal);
CHAR* szVal = mir_u2a(wszVal);
if (szVal) {
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index ed8c032472..12cfcf2a1f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -168,7 +168,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) // dont export meta subcontacts by default and
// export only contact with selectet group name
if (!db_mc_isSub(hContact) &&
- mir_tcsncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tcslen(ExImContact->ptszName))== 0)
+ mir_tcsncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(ExImContact->ptszName))== 0)
{
if (vContact.fromDB(hContact)) {
vContact.Export(xmlfile, &Modules);
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index f91969d216..e0a577d7b8 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -525,19 +525,19 @@ BYTE dbv2String(DBVARIANT* dbv, const BYTE destType) // source value is of type "byte"
case DBVT_BYTE:
_ultow(dbv->bVal, buf, 10);
- dbv->pwszVal = mir_wcsdup(buf);
+ dbv->pwszVal = mir_wstrdup(buf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of type "word"
case DBVT_WORD:
_ultow(dbv->wVal, buf, 10);
- dbv->pwszVal = mir_wcsdup(buf);
+ dbv->pwszVal = mir_wstrdup(buf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of type "dword"
case DBVT_DWORD:
_ultow(dbv->dVal, buf, 10);
- dbv->pwszVal = mir_wcsdup(buf);
+ dbv->pwszVal = mir_wstrdup(buf);
dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED;
break;
// source value is of any string type
diff --git a/plugins/UserInfoEx/src/mir_string.cpp b/plugins/UserInfoEx/src/mir_string.cpp index 778165cbc3..0bfa1925d6 100644 --- a/plugins/UserInfoEx/src/mir_string.cpp +++ b/plugins/UserInfoEx/src/mir_string.cpp @@ -21,42 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -char *mir_strncpy(char *pszDest, const char *pszSrc, const size_t cchDest) -{ - if (!pszDest || !pszSrc || !cchDest) - return NULL; - pszDest = strncpy(pszDest, pszSrc, cchDest-1); - pszDest[cchDest-1] = 0; - return pszDest; -} - -wchar_t *mir_wcsncpy(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest) -{ - if (!pszDest || !pszSrc || !cchDest) - return NULL; - pszDest = wcsncpy(pszDest, pszSrc, cchDest-1); - pszDest[cchDest-1] = 0; - return pszDest; -} - -char *mir_strncat(char *pszDest, const char *pszSrc, const size_t cchDest) -{ - if (!pszDest || !pszSrc || !cchDest) - return NULL; - strncat(pszDest, pszSrc, cchDest-1); - pszDest[cchDest-1] = 0; - return pszDest; -} - -wchar_t *mir_wcsncat(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest) -{ - if (!pszDest || !pszSrc || !cchDest) - return NULL; - pszDest = wcsncat(pszDest, pszSrc, cchDest-1); - pszDest[cchDest-1] = 0; - return pszDest; -} - char *mir_strncat_c(char *pszDest, const char cSrc) { char *pszRet; diff --git a/plugins/UserInfoEx/src/mir_string.h b/plugins/UserInfoEx/src/mir_string.h index 3282e767e2..9e075820be 100644 --- a/plugins/UserInfoEx/src/mir_string.h +++ b/plugins/UserInfoEx/src/mir_string.h @@ -22,27 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _MIR_STRING_H_INCLUDED_
#define _MIR_STRING_H_INCLUDED_
-#define mir_wcsdup mir_wstrdup
+#define mir_tcscmp mir_wcscmp
+#define mir_tcsncmp mir_wcsncmp
+#define mir_tcsicmp mir_wcsicmp
+#define mir_tcsnicmp mir_wcsnicmp
+#define mir_tcschr mir_wcschr
+#define mir_tcsrchr mir_wcsrchr
+#define mir_tcsncat_c mir_wcsncat_c
+#define mir_IsEmpty mir_IsEmptyW
-
- #define mir_tcslen mir_wcslen
- #define mir_tcscpy mir_wcscpy
- #define mir_tcsncpy mir_wcsncpy
- #define mir_tcsncat mir_wcsncat
- #define mir_tcsdup mir_wcsdup
- #define mir_tcscmp mir_wcscmp
- #define mir_tcsncmp mir_wcsncmp
- #define mir_tcsicmp mir_wcsicmp
- #define mir_tcsnicmp mir_wcsnicmp
- #define mir_tcschr mir_wcschr
- #define mir_tcsrchr mir_wcsrchr
- #define mir_tcsncat_c mir_wcsncat_c
- #define mir_IsEmpty mir_IsEmptyW
-
-
-
-#define mir_strlen(s) (((s)!=0)?strlen(s):0)
-#define mir_strcpy(d,s) (((s)!=0&&(d)!=0)?strcpy(d,s):0)
#define mir_strcmp(s1,s2) ((s1)==0||(s2)==0||strcmp((s1),(s2)))
#define mir_strncmp(s1,s2,n) ((s1)==0||(s2)==0||strncmp((s1),(s2),(n)))
#define mir_stricmp(s1,s2) ((s1)==0||(s2)==0||_stricmp((s1),(s2)))
@@ -50,8 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define mir_strchr(s,c) (((s)!=0)?strchr((s),(c)):0)
#define mir_strrchr(s,c) (((s)!=0)?strrchr((s),(c)):0)
-#define mir_wcslen(s) (((s)!=0)?wcslen(s):0)
-#define mir_wcscpy(d,s) (((s)!=0&&(d)!=0)?wcscpy(d,s):0)
#define mir_wcscmp(s1,s2) ((s1)==0||(s2)==0||wcscmp((s1),(s2)))
#define mir_wcsncmp(s1,s2,n) ((s1)==0||(s2)==0||wcsncmp((s1),(s2),(n)))
#define mir_wcsicmp(s1,s2) ((s1)==0||(s2)==0||_wcsicmp((s1),(s2)))
@@ -59,18 +45,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define mir_wcschr(s,c) (((s)!=0)?wcschr((s),(c)):0)
#define mir_wcsrchr(s,c) (((s)!=0)?wcsrchr((s),(c)):0)
-char * mir_strncpy(char *pszDest, const char *pszSrc, const size_t cchDest);
-wchar_t * mir_wcsncpy(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest);
-
-char * mir_strncat(char *pszDest, const char *pszSrc, const size_t cchDest);
-wchar_t * mir_wcsncat(wchar_t *pszDest, const wchar_t *pszSrc, const size_t cchDest);
-
-char * mir_strncat_c(char *pszDest, const char cSrc);
-char * mir_wcsncat_c(char *pszDest, const char cSrc);
+char* mir_strncat_c(char *pszDest, const char cSrc);
+char* mir_wcsncat_c(char *pszDest, const char cSrc);
-char * mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo);
+char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo);
-int mir_IsEmptyA(char *str);
-int mir_IsEmptyW(wchar_t *str);
+int mir_IsEmptyA(char *str);
+int mir_IsEmptyW(wchar_t *str);
#endif /* _MIR_STRING_H_INCLUDED_ */
\ No newline at end of file diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 10c1bb257d..f779891127 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -893,10 +893,10 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR {
POPUPDATAT ppd = { 0 };
ppd.iSeconds = (int)db_get_b(NULL, MODNAME, SET_POPUP_DELAY, 0);
- mir_tcsncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
// Birthday
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, TranslateT("Birthday"), SIZEOF(ppd.lptzContactName));
ppd.lchIcon = Skin_GetIcon(ICO_RMD_DTB0);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -909,7 +909,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR PUAddPopupT(&ppd);
// Anniversary
- mir_tcsncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, TranslateT("Anniversary"), SIZEOF(ppd.lptzContactName));
ppd.lchIcon = Skin_GetIcon(ICO_RMD_DTAX);
if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index 92ccdf4050..f0faf6faaa 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -233,8 +233,8 @@ static FORCEINLINE INT_PTR GCIFirstLast(CONTACTINFO *ci) if (type == DBVT_WCHAR) {
// both firstname and lastname are valid
if (dbvf.type == DBVT_WCHAR && dbvl.type == DBVT_WCHAR) {
- cbf = mir_wcslen(dbvf.pwszVal);
- cbl = mir_wcslen(dbvl.pwszVal);
+ cbf = mir_wstrlen(dbvf.pwszVal);
+ cbl = mir_wstrlen(dbvl.pwszVal);
ci->pszVal = (LPTSTR) mir_alloc((cbf + cbl + 2) * sizeof(WCHAR));
if (ci->pszVal)
@@ -549,7 +549,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) if (ci->dwFlag & CNF_UNICODE) {
WCHAR wszDate[80];
if (GetDateFormatW(LOCALE_USER_DEFAULT, wParam == 1 ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, wszDate, SIZEOF(wszDate)))
- ci->pszVal = (LPTSTR)mir_wcsdup(wszDate);
+ ci->pszVal = (LPTSTR)mir_wstrdup(wszDate);
}
else {
CHAR szDate[80];
@@ -674,7 +674,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) default: // unknown contact
if (ci->dwFlag & CNF_UNICODE)
- ci->pszVal = (LPTSTR)mir_wcsdup(TranslateW(L"'(Unknown Contact)'"));
+ ci->pszVal = (LPTSTR)mir_wstrdup(TranslateW(L"'(Unknown Contact)'"));
else
ci->pszVal = (LPTSTR)mir_strdup(Translate("'(Unknown Contact)'"));
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 3fbbd3d2f9..dd3246d2b7 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -143,7 +143,7 @@ public: {
if (szText)
{
- INT_PTR cch = mir_tcslen(szText);
+ INT_PTR cch = mir_tstrlen(szText);
LPTSTR fmt = (LPTSTR) mir_alloc((cch + 1) * sizeof(TCHAR));
if (fmt)
@@ -352,12 +352,12 @@ class CPopupUpdProgress : public CUpdProgress {
if (_szText)
{
- INT_PTR cb = mir_tcslen(_szText) + 8;
+ INT_PTR cb = mir_tstrlen(_szText) + 8;
LPTSTR pb = (LPTSTR) mir_alloc(cb * sizeof(TCHAR));
if (pb)
{
- mir_tcscpy(pb, _szText);
+ mir_tstrcpy(pb, _szText);
SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TITLET, (LPARAM) pb);
}
@@ -431,8 +431,8 @@ public: pd.lpActions = _popupButtons;
// dummy text
- _szText = mir_tcsdup(szTitle);
- mir_tcscpy(pd.lptzContactName, _szText);
+ _szText = mir_tstrdup(szTitle);
+ mir_tstrcpy(pd.lptzContactName, _szText);
_tcscpy(pd.lptzText, _T(" "));
@@ -462,7 +462,7 @@ public: virtual void SetTitle(LPCTSTR szText)
{
MIR_FREE(_szText);
- _szText = mir_tcsdup(szText);
+ _szText = mir_tstrdup(szText);
UpdateText();
}
@@ -472,7 +472,7 @@ public: **/
virtual void SetText(LPCTSTR szText)
{
- SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TEXTT, (LPARAM) mir_tcsdup(szText));
+ SendMessage(_hWnd, UM_CHANGEPOPUP, CPT_TEXTT, (LPARAM) mir_tstrdup(szText));
}
};
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 59420bba5c..6e0acf4ff6 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -258,9 +258,9 @@ static int NotifyWithPopup(MCONTACT hContact, CEvent::EType eventType, int DaysT mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName),
_T("%s - %s"), TranslateTS(pszDesc), DB::Contact::DisplayName(hContact));
}
- else mir_tcsncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
+ else mir_tstrncpy(ppd.lptzContactName, TranslateT("Reminder"), SIZEOF(ppd.lptzContactName));
- mir_tcsncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzText, pszMsg, MAX_SECONDLINE);
ppd.lchIcon = GetAnnivIcon(CEvent(eventType, DaysToAnniv));
@@ -412,7 +412,7 @@ static BYTE CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE mir_sntprintf(szAnniv, MAX_PATH,
TranslateT("%s has the following anniversaries:\0"),
ContactGender(hContact));
- mir_tcsncpy(strMsg, szAnniv, mir_tcslen(szAnniv));
+ mir_tstrncpy(strMsg, szAnniv, mir_tstrlen(szAnniv));
}
switch (Diff) {
@@ -426,19 +426,19 @@ static BYTE CheckAnniversaries(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE mir_sntprintf(szAnniv, MAX_PATH, TranslateT("%d. %s in %d days\0"), mta.Age() + 1, mta.Description(), Diff);
}
- if (mir_tcslen(szAnniv) >= MAX_SECONDLINE - mir_tcslen(strMsg)) {
+ if (mir_tstrlen(szAnniv) >= MAX_SECONDLINE - mir_tstrlen(strMsg)) {
if (strMsg)
- mir_tcsncat(strMsg, _T("\n...\0"), SIZEOF(strMsg));
+ mir_tstrncat(strMsg, _T("\n...\0"), SIZEOF(strMsg));
else
- mir_tcsncpy(strMsg, _T("\n...\0"), mir_tcslen(_T("\n...\0")));
+ mir_tstrncpy(strMsg, _T("\n...\0"), mir_tstrlen(_T("\n...\0")));
bOverflow = TRUE;
}
else {
if (strMsg)
- mir_tcsncat(strMsg, _T("\n- \0"), SIZEOF(strMsg));
+ mir_tstrncat(strMsg, _T("\n- \0"), SIZEOF(strMsg));
else
- mir_tcsncpy(strMsg, _T("\n- \0"), mir_tcslen(_T("\n- \0")));
- mir_tcsncat(strMsg, szAnniv, SIZEOF(strMsg));
+ mir_tstrncpy(strMsg, _T("\n- \0"), mir_tstrlen(_T("\n- \0")));
+ mir_tstrncat(strMsg, szAnniv, SIZEOF(strMsg));
}
}
}
diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp index 6eb85542aa..a5052f2b3d 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp @@ -201,8 +201,8 @@ public: pTimeZone->dwIndex = TZINDEX_UNSPECIFIED;
if (result == ERROR_SUCCESS) {
- pTimeZone->ptszName = mir_tcsdup(szName);
- pTimeZone->ptszDisplay = mir_tcsdup(szDisplay);
+ pTimeZone->ptszName = mir_tstrdup(szName);
+ pTimeZone->ptszDisplay = mir_tstrdup(szDisplay);
result = (insert(pTimeZone) == ERROR_SUCCESS);
}
|