From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SMS/src/SMS_svc.cpp | 4 ++-- plugins/SMS/src/functions.cpp | 30 +++++++++++++++--------------- plugins/SMS/src/main.cpp | 6 +++--- plugins/SMS/src/options.cpp | 10 +++++----- plugins/SMS/src/receive.cpp | 10 +++++----- plugins/SMS/src/recvdlg.cpp | 6 +++--- plugins/SMS/src/senddlg.cpp | 42 +++++++++++++++++++++--------------------- 7 files changed, 54 insertions(+), 54 deletions(-) (limited to 'plugins/SMS/src') diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 1cbd805a0b..9125b87dc7 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -8,7 +8,7 @@ int LoadServices(void) pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN; // Service creation - for (size_t i=0;ilfFaceName,fontOptionsList[0].szDefFace,SIZEOF(lf->lfFaceName)); + mir_tstrncpy(lf->lfFaceName,fontOptionsList[0].szDefFace,_countof(lf->lfFaceName)); }else{ - mir_tstrncpy(lf->lfFaceName,dbv.ptszVal,SIZEOF(lf->lfFaceName)); + mir_tstrncpy(lf->lfFaceName,dbv.ptszVal,_countof(lf->lfFaceName)); db_free(&dbv); } - mir_snprintf(str,SIZEOF(str),"Font%dSize",i); + mir_snprintf(str,_countof(str),"Font%dSize",i); lf->lfHeight=(char)db_get_b(NULL,SRMMMOD,str,fontOptionsList[0].defSize); lf->lfWidth=0; lf->lfEscapement=0; lf->lfOrientation=0; - mir_snprintf(str,SIZEOF(str),"Font%dSty",i); + mir_snprintf(str,_countof(str),"Font%dSty",i); style=db_get_b(NULL,SRMMMOD,str,fontOptionsList[0].defStyle); lf->lfWeight=style&FONTF_BOLD?FW_BOLD:FW_NORMAL; lf->lfItalic=style&FONTF_ITALIC?1:0; lf->lfUnderline=0; lf->lfStrikeOut=0; - mir_snprintf(str,SIZEOF(str),"Font%dSet",i); + mir_snprintf(str,_countof(str),"Font%dSet",i); lf->lfCharSet=db_get_b(NULL,SRMMMOD,str,MsgDlgGetFontDefaultCharset(lf->lfFaceName)); lf->lfOutPrecision=OUT_DEFAULT_PRECIS; lf->lfClipPrecision=CLIP_DEFAULT_PRECIS; lf->lfQuality=DEFAULT_QUALITY; lf->lfPitchAndFamily=DEFAULT_PITCH|FF_DONTCARE; - mir_snprintf(str,SIZEOF(str),"Font%d",i); + mir_snprintf(str,_countof(str),"Font%d",i); } } diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp index 0d7eeb597d..824d4a568e 100644 --- a/plugins/SMS/src/main.cpp +++ b/plugins/SMS/src/main.cpp @@ -118,17 +118,17 @@ void VersionConversions() { WCHAR wsztm[MAX_PATH]; - if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,SIZEOF(wsztm),NULL)) + if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,_countof(wsztm),NULL)) DB_SMS_SetByte(NULL,"UseSignature",(wsztm[0]=='0')); else DB_SMS_SetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE); - if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,SIZEOF(wsztm),NULL)) + if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,_countof(wsztm),NULL)) DB_SMS_SetByte(NULL,"SignaturePos",(wsztm[0]=='0')); else DB_SMS_SetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS); - if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,SIZEOF(wsztm),NULL)) + if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,_countof(wsztm),NULL)) DB_SMS_SetByte(NULL,"ShowACK",(wsztm[0]=='0')); else DB_SMS_SetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK); diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp index 63420cb407..4d9cafd7e4 100644 --- a/plugins/SMS/src/options.cpp +++ b/plugins/SMS/src/options.cpp @@ -37,14 +37,14 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA case WM_INITDIALOG: TranslateDialogDefault(hWndDlg); - if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,SIZEOF(tszSign),NULL)==FALSE) - mir_sntprintf(tszSign,SIZEOF(tszSign),TranslateT("From %s:\r\n\r\n"),GetContactNameW(NULL)); + if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),NULL)==FALSE) + mir_sntprintf(tszSign,_countof(tszSign),TranslateT("From %s:\r\n\r\n"),GetContactNameW(NULL)); SetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign); { BOOL bUseSign = DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE); CheckDlgButton(hWndDlg, IDC_USESIGNATURE, bUseSign ? BST_CHECKED : BST_UNCHECKED); - EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),bUseSign); + EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,_countof(wSMSSignControlsList),bUseSign); BOOL bSignBebefore=DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS); CheckDlgButton(hWndDlg, IDC_BEGIN, bSignBebefore ? BST_CHECKED : BST_UNCHECKED); @@ -60,7 +60,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA SendMessage(GetParent(hWndDlg),PSM_CHANGED,0,0); switch(LOWORD(wParam)){ case IDC_USESIGNATURE: - EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,SIZEOF(wSMSSignControlsList),IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE)); + EnableControlsArray(hWndDlg,(WORD*)&wSMSSignControlsList,_countof(wSMSSignControlsList),IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE)); break; } break; @@ -70,7 +70,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA case 0: switch (((LPNMHDR)lParam)->code){ case PSN_APPLY: - GetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign,SIZEOF(tszSign)); + GetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign,_countof(tszSign)); DB_SMS_SetStringW(NULL,"Signature",tszSign); DB_SMS_SetByte(NULL,"UseSignature",IsDlgButtonChecked(hWndDlg,IDC_USESIGNATURE)); diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index bc37fe89f3..84eb7cae6e 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -152,10 +152,10 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) tvi.mask=TVIF_TEXT; tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg); tvi.pszText=tszPhone; - tvi.cchTextMax=SIZEOF(tszPhone); + tvi.cchTextMax=_countof(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); } - else GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(szPhone)); + else GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(szPhone)); if (ack->result == ACKRESULT_FAILED) lpszErrorDescription=lpszXML; @@ -164,7 +164,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) GetXMLFieldExBuff(lpszXML,dwXMLSize,szBuff,sizeof(szBuff),NULL,"sms_response","error","params","param",NULL); } - mir_sntprintf(tszErrorMessage,SIZEOF(tszErrorMessage),TranslateT("SMS message didn't send by %S to %s because: %S"),szNetwork,tszPhone,lpszErrorDescription); + mir_sntprintf(tszErrorMessage,_countof(tszErrorMessage),TranslateT("SMS message didn't send by %S to %s because: %S"),szNetwork,tszPhone,lpszErrorDescription); ShowWindow(hWndDlg,SW_SHOWNORMAL); EnableWindow(hWndDlg,FALSE); HWND hwndTimeOut=CreateDialog(ssSMSSettings.hInstance,MAKEINTRESOURCE(IDD_SENDSMSTIMEDOUT),hWndDlg,SMSTimedOutDlgProc); @@ -238,7 +238,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) } else { memcpy(pszServiceFunctionName,SMS_READ,sizeof(SMS_READ)); - mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Message from %s"),GetContactNameW(hContact)); + mir_sntprintf(szToolTip,_countof(szToolTip),TranslateT("SMS Message from %s"),GetContactNameW(hContact)); CLISTEVENT cle = { sizeof(cle) }; cle.flags = CLEF_TCHAR; @@ -261,7 +261,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) UINT iIcon; if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, NULL, NULL, 0, NULL, &iIcon)) { memcpy(pszServiceFunctionName,SMS_READ_ACK,sizeof(SMS_READ_ACK)); - mir_sntprintf(szToolTip,SIZEOF(szToolTip),TranslateT("SMS Confirmation from %s"),GetContactNameW(hContact)); + mir_sntprintf(szToolTip,_countof(szToolTip),TranslateT("SMS Confirmation from %s"),GetContactNameW(hContact)); CLISTEVENT cle = { sizeof(cle) }; cle.flags = CLEF_TCHAR; diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index 3d02256407..230c65c3b8 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -138,7 +138,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l HWND hwndSendSms; MCONTACT hContact; - hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,SIZEOF(wszPhone))); + hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,_countof(wszPhone))); hwndSendSms=SendSMSWindowIsOtherInstanceHContact(hContact); if (hwndSendSms) SetFocus(hwndSendSms); @@ -215,12 +215,12 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s if (dwPhoneSize) dwPhoneSize = CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize); else { - GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(SIZEOF(wszPhoneLocal)-1),&dwPhoneSize,NULL); + GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(_countof(wszPhoneLocal)-1),&dwPhoneSize,NULL); dwPhoneSize++; } lpwszContactDisplayName = GetContactNameW(hContact); - mir_sntprintf(wszTitle, SIZEOF(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart); + mir_sntprintf(wszTitle, _countof(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart); MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize+MAX_PATH); SetWindowText(prswdWindowData->hWnd, wszTitle); diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index c7e3b640aa..34e1ec1177 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -146,7 +146,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l size_t dwSignLen = 0; if (DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE)) - if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,SIZEOF(tszSign),&dwSignLen)) + if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),&dwSignLen)) { SetDlgItemText(hWndDlg,IDC_MESSAGE,tszSign); @@ -155,7 +155,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l EnableWindow(GetDlgItem(hWndDlg,IDOK), dwSignLen != 0); } - mir_sntprintf(tszSign,SIZEOF(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg)); + mir_sntprintf(tszSign,_countof(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg)); SetDlgItemText(hWndDlg,IDC_COUNT,tszSign); } @@ -220,12 +220,12 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l tvi.mask=TVIF_TEXT; tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg); tvi.pszText=tszPhone; - tvi.cchTextMax=SIZEOF(tszPhone); + tvi.cchTextMax=_countof(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); }else{ - GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)); + GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone)); } - mir_sntprintf(tszMessage,SIZEOF(tszMessage),TranslateT("The SMS message send to %s timed out."),tszPhone); + mir_sntprintf(tszMessage,_countof(tszMessage),TranslateT("The SMS message send to %s timed out."),tszPhone); KillTimer(hWndDlg,wParam); ShowWindow(hWndDlg,SW_SHOWNORMAL); EnableWindow(hWndDlg,FALSE); @@ -285,11 +285,11 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l tvi.mask = TVIF_TEXT; tvi.hItem = psswdWindowData->hItemSend; tvi.pszText = tszPhone; - tvi.cchTextMax = SIZEOF(tszPhone); + tvi.cchTextMax = _countof(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); dwPhoneSize = mir_tstrlen(tszPhone); } - else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, SIZEOF(tszPhone)); + else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)); dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(int)dwMessageSize+2); SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize); @@ -310,7 +310,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l case IDC_ADDNUMBER: { TCHAR tszPhone[MAX_PHONE_LEN]; - if (IsPhoneW(tszPhone,GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)))) { + if (IsPhoneW(tszPhone,GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone)))) { TVINSERTSTRUCT tvis = {0}; tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.hInsertAfter = TVI_SORT; @@ -352,7 +352,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l } }else{ TCHAR tszPhone[MAX_PHONE_LEN]; - size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)); + size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,_countof(tszPhone)); if (IsPhoneW(tszPhone,dwPhoneSize)) { size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); @@ -394,7 +394,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); EnableWindow(GetDlgItem(hWndDlg,IDOK), dwMessageSize != 0); - mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg)); + mir_sntprintf(tszBuff, _countof(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg)); SetDlgItemText(hWndDlg,IDC_COUNT,tszBuff); } break; @@ -405,7 +405,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l TCHAR tszPhone[MAX_PHONE_LEN]; DBVARIANT dbv; - size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(SIZEOF(tszPhone)-4)); + size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(_countof(tszPhone)-4)); if (IsPhoneW(tszPhone,dwPhoneSize)) { if (IsContactPhone(psswdWindowData->hMyContact,tszPhone,dwPhoneSize)==FALSE) @@ -413,7 +413,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l mir_tstrcat(tszPhone, _T(" SMS")); for(DWORD i=0;bCont;i++) { - mir_snprintf(szBuff,SIZEOF(szBuff),"MyPhone%d",i); + mir_snprintf(szBuff,_countof(szBuff),"MyPhone%d",i); if (db_get(psswdWindowData->hMyContact,"UserInfo",szBuff,&dbv)) bCont=FALSE; db_free(&dbv); } @@ -575,7 +575,7 @@ HWND SendSMSWindowAdd(MCONTACT hContact) LPTSTR lptszContactDisplayName=GetContactNameW(hContact); TCHAR tszTitle[MAX_PATH]; - mir_sntprintf(tszTitle, SIZEOF(tszTitle), _T("%s - %s"), lptszContactDisplayName, TranslateT("Send SMS")); + mir_sntprintf(tszTitle, _countof(tszTitle), _T("%s - %s"), lptszContactDisplayName, TranslateT("Send SMS")); SetWindowText(psswdWindowData->hWnd,tszTitle); SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_ADDSTRING,0,(LPARAM)lptszContactDisplayName); SendDlgItemMessage(psswdWindowData->hWnd,IDC_NAME,CB_SETCURSEL,0,0); @@ -729,7 +729,7 @@ void SendSMSWindowAsSentSet(HWND hWndDlg) // lvi.mask=LVIF_TEXT|LVIF_IMAGE; // lvi.iItem=GetSendSMSWindowSMSSend(hWndDlg) - 1; // lvi.iSubItem=0; -// ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,SIZEOF(szPhone)); +// ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,_countof(szPhone)); // lvi.pszText=szPhone; // lvi.iImage=2; // ListView_SetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&lvi); @@ -881,7 +881,7 @@ void SendSMSWindowNext(HWND hWndDlg) tvi.mask=TVIF_TEXT; tvi.hItem=SendSMSWindowHItemSendGet(hWndDlg); tvi.pszText=tszPhone; - tvi.cchTextMax=SIZEOF(tszPhone); + tvi.cchTextMax=_countof(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); TreeView_SelectItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),tvi.hItem); dwPhoneSize=mir_wstrlen(tszPhone); @@ -985,7 +985,7 @@ void AddContactPhonesToComboToListParam(MCONTACT hContact,LPSTR lpszModule,LPSTR TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN]; size_t i,dwPhoneSize; - if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) + if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize)) { tszPhone[0]='+'; dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); @@ -997,8 +997,8 @@ void AddContactPhonesToComboToListParam(MCONTACT hContact,LPSTR lpszModule,LPSTR for (i=0;TRUE;i++) { - mir_snprintf(szBuff,SIZEOF(szBuff),"%s%ld",lpszValueName,i); - if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) + mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i); + if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize)) { tszPhone[0]='+'; dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); @@ -1046,7 +1046,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lp tvis.hInsertAfter=TVI_SORT; tvis.item.iImage=tvis.item.iSelectedImage=0; - if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) + if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize)) { tszPhone[0]='+'; dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); @@ -1064,8 +1064,8 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lp for (i=0;TRUE;i++) { - mir_snprintf(szBuff,SIZEOF(szBuff),"%s%ld",lpszValueName,i); - if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize)) + mir_snprintf(szBuff,_countof(szBuff),"%s%ld",lpszValueName,i); + if (DB_GetStaticStringW(hContact,lpszModule,szBuff,tszPhoneRaw,_countof(tszPhoneRaw),&dwPhoneSize)) { tszPhone[0]='+'; dwPhoneSize=CopyNumberW(tszPhone+1,tszPhoneRaw,dwPhoneSize); -- cgit v1.2.3