diff options
Diffstat (limited to 'src/core/stdurl/urldialogs.cpp')
-rw-r--r-- | src/core/stdurl/urldialogs.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index 157725362b..f654cae874 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -35,11 +35,10 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact) if (hContact) {
szProto = GetContactProto(hContact);
if (szProto) {
- CONTACTINFO ci;
+ CONTACTINFO ci = { 0 };
int hasName = 0;
char buf[128];
memset(&ci, 0, sizeof(ci));
-
ci.cbSize = sizeof(ci);
ci.hContact = hContact;
ci.szProto = szProto;
@@ -53,7 +52,7 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact) break;
case CNFT_DWORD:
hasName = 1;
- mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal);
+ mir_snprintf(buf, _countof(buf), "%u", ci.dVal);
break;
}
}
@@ -65,12 +64,12 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact) SetDlgItemText(hwndDlg, IDC_NAME, contactName);
szStatus = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
+ mir_sntprintf(newtitle, _countof(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
}
}
- else mir_tstrncpy(newtitle, pszNewTitleStart, SIZEOF(newtitle));
+ else mir_tstrncpy(newtitle, pszNewTitleStart, _countof(newtitle));
- GetWindowText(hwndDlg, oldtitle, SIZEOF(oldtitle));
+ GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
if (mir_tstrcmp(newtitle, oldtitle)) //swt() flickers even if the title hasn't actually changed
SetWindowText(hwndDlg, newtitle);
@@ -108,13 +107,13 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP db_event_markRead(dat->hContact, dat->hDbEvent);
TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0), msg[128];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("URL from %s"), contactName);
+ mir_sntprintf(msg, _countof(msg), TranslateT("URL from %s"), contactName);
SetWindowText(hwndDlg, msg);
SetDlgItemText(hwndDlg, IDC_FROM, contactName);
SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETARROW, 1, 0);
TCHAR str[128];
- TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("t d"), str, SIZEOF(str), 0);
+ TimeZone_PrintTimeStamp(NULL, dbei.timestamp, _T("t d"), str, _countof(str), 0);
SetDlgItemText(hwndDlg, IDC_DATE, str);
}
@@ -166,7 +165,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP HMENU hSubMenu = GetSubMenu(hMenu, 6);
TranslateMenu(hSubMenu);
GetWindowRect((HWND)lParam, &rc);
- GetDlgItemTextA(hwndDlg, IDC_URL, url, SIZEOF(url));
+ GetDlgItemTextA(hwndDlg, IDC_URL, url, _countof(url));
switch(TrackPopupMenu(hSubMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL)) {
case IDM_OPENNEW:
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
@@ -346,7 +345,7 @@ static void AddBrowserPageToCombo(char *url, HWND hwndCombo) char szExistingUrl[1024];
for (i = SendMessage(hwndCombo, CB_GETCOUNT, 0, 0)-1;i>=0;i--) {
- if (SendMessage(hwndCombo, CB_GETLBTEXTLEN, i, 0) >= SIZEOF(szExistingUrl))
+ if (SendMessage(hwndCombo, CB_GETLBTEXTLEN, i, 0) >= _countof(szExistingUrl))
continue;
SendMessageA(hwndCombo, CB_GETLBTEXT, i, (LPARAM)szExistingUrl);
if ( !mir_strcmp(szExistingUrl, url)) return;
@@ -382,7 +381,7 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HW }
int dataLength = GlobalSize(hData)-offsetof(DDEDATA, Value);
DDEDATA *data = (DDEDATA*)GlobalLock(hData);
- windowCount = dataLength/sizeof(DWORD);
+ windowCount = dataLength / sizeof(DWORD);
windowId = (PDWORD)mir_alloc(sizeof(DWORD)*windowCount);
memcpy(windowId, data->Value, windowCount*sizeof(DWORD));
GlobalUnlock(hData);
@@ -402,7 +401,7 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HW for (i=0;i<windowCount;i++) {
if (windowId[i] == 0) break;
{ char str[16];
- mir_snprintf(str, SIZEOF(str), "%d", windowId[i]);
+ mir_snprintf(str, _countof(str), "%d", windowId[i]);
hData = DoDdeRequest(str, hwndDlg);
}
if (hData != NULL) {
@@ -619,7 +618,8 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (ack->hContact != dat->hContact) break;
if (ack->type != ACKTYPE_URL || ack->result != ACKRESULT_SUCCESS) break;
- DBEVENTINFO dbei = { sizeof(dbei) };
+ DBEVENTINFO dbei = { 0 };
+ dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_URL;
dbei.flags = DBEF_SENT;
dbei.szModule = GetContactProto(dat->hContact);
|