diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/addcontact/addcontact.cpp | 20 | ||||
-rw-r--r-- | src/modules/findadd/findadd.cpp | 40 | ||||
-rw-r--r-- | src/modules/findadd/searchresults.cpp | 20 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 39 |
4 files changed, 58 insertions, 61 deletions
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index d0028ee77f..0c905b1c52 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -52,11 +52,11 @@ public: if (m_acs.psr) {
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)mir_alloc(m_acs.psr->cbSize);
memcpy(psr, m_acs.psr, m_acs.psr->cbSize);
- psr->nick = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick);
- psr->firstName = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName);
- psr->lastName = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName);
- psr->email = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->email) : mir_a2t((char*)psr->email);
- psr->id = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->id) : mir_a2t((char*)psr->id);
+ psr->nick.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->nick.t) : mir_a2t((char*)psr->nick.t);
+ psr->firstName.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->firstName.t) : mir_a2t((char*)psr->firstName.t);
+ psr->lastName.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->lastName.t) : mir_a2t((char*)psr->lastName.t);
+ psr->email.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->email.t) : mir_a2t((char*)psr->email.t);
+ psr->id.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->id.t) : mir_a2t((char*)psr->id.t);
psr->flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR;
m_acs.psr = psr;
}
@@ -98,7 +98,7 @@ public: }
if (!isSet) {
szName = (m_acs.handleType == HANDLE_EVENT) ? (tmpStr = mir_a2t(szUin)) :
- (m_acs.psr->id ? m_acs.psr->id : m_acs.psr->nick);
+ (m_acs.psr->id.t ? m_acs.psr->id.t : m_acs.psr->nick.t);
}
}
@@ -152,10 +152,10 @@ public: Window_FreeIcon_IcoLib(m_hwnd);
if (m_acs.psr) {
- mir_free(m_acs.psr->nick);
- mir_free(m_acs.psr->firstName);
- mir_free(m_acs.psr->lastName);
- mir_free(m_acs.psr->email);
+ mir_free(m_acs.psr->nick.t);
+ mir_free(m_acs.psr->firstName.t);
+ mir_free(m_acs.psr->lastName.t);
+ mir_free(m_acs.psr->email.t);
mir_free(m_acs.psr);
}
}
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index f031259d37..82820806e6 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -772,7 +772,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id = str; + psr.id.t = str; acs.psr = &psr; acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, @@ -801,7 +801,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_CONTEXTMENU: { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; LVHITTESTINFO lvhti; lvhti.pt = pt; @@ -872,19 +872,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP /* Next block is not needed but behavior will be kept */ bool isUnicode = (psr->flags & PSR_UNICODE) != 0; - if (psr->id) { - BOOL validPtr = isUnicode ? IsBadStringPtrW((wchar_t*)psr->id, 25) : IsBadStringPtrA((char*)psr->id, 25); + if (psr->id.t) { + BOOL validPtr = isUnicode ? IsBadStringPtrW((wchar_t*)psr->id.t, 25) : IsBadStringPtrA((char*)psr->id.t, 25); if (!validPtr) { isUnicode = false; - lsr->psr.id = NULL; + lsr->psr.id.t = NULL; } - else lsr->psr.id = isUnicode ? mir_u2t((wchar_t*)psr->id) : mir_a2t((char*)psr->id); + else lsr->psr.id.t = isUnicode ? mir_u2t((wchar_t*)psr->id.t) : mir_a2t((char*)psr->id.t); } - lsr->psr.nick = isUnicode ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick); - lsr->psr.firstName = isUnicode ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName); - lsr->psr.lastName = isUnicode ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName); - lsr->psr.email = isUnicode ? mir_u2t((wchar_t*)psr->email) : mir_a2t((char*)psr->email); + lsr->psr.nick.t = isUnicode ? mir_u2t((wchar_t*)psr->nick.t) : mir_a2t((char*)psr->nick.t); + lsr->psr.firstName.t = isUnicode ? mir_u2t((wchar_t*)psr->firstName.t) : mir_a2t((char*)psr->firstName.t); + lsr->psr.lastName.t = isUnicode ? mir_u2t((wchar_t*)psr->lastName.t) : mir_a2t((char*)psr->lastName.t); + lsr->psr.email.t = isUnicode ? mir_u2t((wchar_t*)psr->email.t) : mir_a2t((char*)psr->email.t); lsr->psr.flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR; LVITEM lvi = { 0 }; @@ -920,11 +920,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->bFlexSearchResult = FALSE; memcpy(&lsr->psr, psr, psr->cbSize); - lsr->psr.nick = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick); - lsr->psr.firstName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName); - lsr->psr.lastName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName); - lsr->psr.email = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->email) : mir_a2t((char*)psr->email); - lsr->psr.id = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->id) : mir_a2t((char*)psr->id); + lsr->psr.nick.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->nick.t) : mir_a2t((char*)psr->nick.t); + lsr->psr.firstName.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->firstName.t) : mir_a2t((char*)psr->firstName.t); + lsr->psr.lastName.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->lastName.t) : mir_a2t((char*)psr->lastName.t); + lsr->psr.email.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->email.t) : mir_a2t((char*)psr->email.t); + lsr->psr.id.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->id.t) : mir_a2t((char*)psr->id.t); lsr->psr.flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR; LVITEM lvi = { 0 }; @@ -944,11 +944,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP } int iItem = ListView_InsertItem(hwndList, &lvi); int col = 1; - SetListItemText(hwndList, iItem, col++, lsr->psr.id); - SetListItemText(hwndList, iItem, col++, lsr->psr.nick); - SetListItemText(hwndList, iItem, col++, lsr->psr.firstName); - SetListItemText(hwndList, iItem, col++, lsr->psr.lastName); - SetListItemText(hwndList, iItem, col++, lsr->psr.email); + SetListItemText(hwndList, iItem, col++, lsr->psr.id.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.nick.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.firstName.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.lastName.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.email.t); SetStatusBarResultInfo(hwndDlg); } } diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 20b9cc344c..9ab089c02b 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -136,15 +136,15 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa case COLUMNID_PROTO:
return mir_strcmp(lsr1->szProto, lsr2->szProto)*sortMultiplier;
case COLUMNID_HANDLE:
- return mir_tstrcmpi(lsr1->psr.id, lsr2->psr.id)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.id.t, lsr2->psr.id.t)*sortMultiplier;
case COLUMNID_NICK:
- return mir_tstrcmpi(lsr1->psr.nick, lsr2->psr.nick)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.nick.t, lsr2->psr.nick.t)*sortMultiplier;
case COLUMNID_FIRST:
- return mir_tstrcmpi(lsr1->psr.firstName, lsr2->psr.firstName)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.firstName.t, lsr2->psr.firstName.t)*sortMultiplier;
case COLUMNID_LAST:
- return mir_tstrcmpi(lsr1->psr.lastName, lsr2->psr.lastName)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.lastName.t, lsr2->psr.lastName.t)*sortMultiplier;
case COLUMNID_EMAIL:
- return mir_tstrcmpi(lsr1->psr.email, lsr2->psr.email)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.email.t, lsr2->psr.email.t)*sortMultiplier;
}
}
else {
@@ -165,11 +165,11 @@ void FreeSearchResults(HWND hwndResults) ListView_GetItem(hwndResults, &lvi);
struct ListSearchResult *lsr = (struct ListSearchResult*)lvi.lParam;
if (lsr == NULL) continue;
- mir_free(lsr->psr.id);
- mir_free(lsr->psr.email);
- mir_free(lsr->psr.nick);
- mir_free(lsr->psr.firstName);
- mir_free(lsr->psr.lastName);
+ mir_free(lsr->psr.id.t);
+ mir_free(lsr->psr.email.t);
+ mir_free(lsr->psr.nick.t);
+ mir_free(lsr->psr.firstName.t);
+ mir_free(lsr->psr.lastName.t);
mir_free(lsr);
}
ListView_DeleteAllItems(hwndResults);
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index a3108365bf..b209ce9d38 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -356,21 +356,19 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
else {
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
+ PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)_alloca(psr->cbSize);
memcpy(psra, psr, psr->cbSize);
- psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
- psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
- psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
- psra->email = (PROTOCHAR*)mir_u2a(psr->email);
+ psra->nick.a = mir_u2a(psr->nick.t);
+ psra->firstName.a = mir_u2a(psr->firstName.t);
+ psra->lastName.a = mir_u2a(psr->lastName.t);
+ psra->email.a = mir_u2a(psr->email.t);
INT_PTR res = (INT_PTR)ppi->AddToList(wParam, psra);
- mir_free(psra->nick);
- mir_free(psra->firstName);
- mir_free(psra->lastName);
- mir_free(psra->email);
- mir_free(psra);
-
+ mir_free(psra->nick.a);
+ mir_free(psra->firstName.a);
+ mir_free(psra->lastName.a);
+ mir_free(psra->email.a);
return res;
}
@@ -516,20 +514,19 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char if (!mir_strcmp(szService, PS_ADDTOLIST)) {
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
if (!(psr->flags & PSR_UNICODE)) {
- PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
+ PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)_alloca(psr->cbSize);
memcpy(psra, psr, psr->cbSize);
- psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
- psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
- psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
- psra->email = (PROTOCHAR*)mir_u2a(psr->email);
+ psra->nick.a = mir_u2a(psr->nick.t);
+ psra->firstName.a = mir_u2a(psr->firstName.t);
+ psra->lastName.a = mir_u2a(psr->lastName.t);
+ psra->email.a = mir_u2a(psr->email.t);
INT_PTR res = ProtoCallService(szModule, szService, wParam, (LPARAM)psra);
- mir_free(psra->nick);
- mir_free(psra->firstName);
- mir_free(psra->lastName);
- mir_free(psra->email);
- mir_free(psra);
+ mir_free(psra->nick.a);
+ mir_free(psra->firstName.a);
+ mir_free(psra->lastName.a);
+ mir_free(psra->email.a);
return res;
}
}
|