From 2329457a8658926ceae20cf6ff883b24965e052f Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 10 Jul 2015 16:59:27 +0000 Subject: UserInfoEx: -Cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@14525 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/ctrl_contact.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'plugins/UserInfoEx/src/ctrl_contact.cpp') diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index b8780f5b7b..372e830963 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -341,22 +341,25 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam noRecursion = 1; { TCHAR szText[MAXDATASIZE], *pText, *pArea, *pNumber; - int isValid = 1; + bool isValid = true; GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)); - if (szText[0] != '+') isValid = 0; + if (szText[0] != '+') + isValid = false; if (isValid) { - int i, country = _tcstol(szText + 1, &pText, 10); + int country = _tcstol(szText + 1, &pText, 10); if (pText - szText > 4) - isValid = 0; + isValid = false; else { + int i; for (i = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) { if (country == SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, i, 0)) { SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, i, 0); break; } } + if (i < 0) + isValid = false; } - if (i < 0) isValid = 0; } if (isValid) { pArea = pText + _tcscspn(pText, _T("0123456789")); -- cgit v1.2.3