From 1ce3da1cca093143d9629bc46e221dd8be962e12 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 31 May 2015 11:46:05 +0000 Subject: - MAllStrings: a handy union to hold an incoming string parameter of any type; - FNAMECHAR: atavism extincted; - PROTOSEARCHRESULT: structure prepared to use results of any type, including utf git-svn-id: http://svn.miranda-ng.org/main/trunk@13932 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AddContactPlus/src/addcontact.cpp | 10 +++--- plugins/AssocMgr/src/test.cpp | 10 +++--- plugins/ContactsPlus/src/receive.cpp | 8 ++--- plugins/GmailNotifier/src/notify.cpp | 4 +-- plugins/SendScreenshotPlus/src/CSend.cpp | 12 ++++---- plugins/Weather/src/weather_addstn.cpp | 51 +++++++++++++++---------------- plugins/WebView/src/webview_services.cpp | 14 ++++----- 7 files changed, 54 insertions(+), 55 deletions(-) (limited to 'plugins') diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 97a255cd99..723c308338 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -264,7 +264,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) } psr->flags = PSR_TCHAR; - psr->id = mir_tstrdup(szUserId); + psr->id.t = mir_tstrdup(szUserId); acs->psr = psr; MCONTACT hContact = (MCONTACT)CallProtoService(acs->proto, PS_ADDTOLIST, IsDlgButtonChecked(hdlg, IDC_ADDTEMP) ? PALF_TEMPORARY : 0, (LPARAM)acs->psr); @@ -340,10 +340,10 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) if (acs) { db_set_s(NULL, "AddContact", "LastProto", acs->proto); if (acs->psr) { - mir_free(acs->psr->nick); - mir_free(acs->psr->firstName); - mir_free(acs->psr->lastName); - mir_free(acs->psr->email); + mir_free(acs->psr->nick.t); + mir_free(acs->psr->firstName.t); + mir_free(acs->psr->lastName.t); + mir_free(acs->psr->email.t); mir_free(acs->psr); } delete acs; diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 5640a5ce18..8b3593e89d 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -117,7 +117,7 @@ static int ServiceParseAimLink(WPARAM,LPARAM lParam) acs.psr=&psr; memset(&psr, 0, sizeof(PROTOSEARCHRESULT)); psr.cbSize=sizeof(PROTOSEARCHRESULT); - psr.nick=sn; + psr.nick.t=sn; CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs); } return 0; @@ -436,7 +436,7 @@ static int ServiceParseYmsgrLink(WPARAM wParam,LPARAM lParam) acs.psr=&psr; memset(&psr, 0, sizeof(PROTOSEARCHRESULT)); psr.cbSize=sizeof(PROTOSEARCHRESULT); - psr.nick=id; + psr.nick.t=id; CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs); } return 0; @@ -551,8 +551,8 @@ static int ServiceParseMsnimLink(WPARAM wParam,LPARAM lParam) acs.psr=&psr; memset(&psr, 0, sizeof(PROTOSEARCHRESULT)); psr.cbSize=sizeof(PROTOSEARCHRESULT); - psr.nick=email; - psr.email=email; + psr.nick.t=email; + psr.email.t=email; CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs); } return 0; @@ -746,7 +746,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) acs.psr=&psr; memset(&psr, 0, sizeof(PROTOSEARCHRESULT)); psr.cbSize=sizeof(PROTOSEARCHRESULT); - psr.nick=jid; + psr.nick.t=jid; CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs); } return 0; diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 73fcba99e9..10aa4e70c5 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -437,10 +437,10 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara fi.psz = wndData->haUin; int iLPos = ListView_FindItem(hLV, -1, &fi); if (iLPos == -1) iLPos = 0; - if (mir_tstrcmp(psr->nick, _T("")) && psr->nick) - ListView_SetItemText(hLV, iLPos, 1, psr->nick); - ListView_SetItemText(hLV, iLPos, 2, psr->firstName); - ListView_SetItemText(hLV, iLPos, 3, psr->lastName); + if (mir_tstrcmp(psr->nick.t, _T("")) && psr->nick.t) + ListView_SetItemText(hLV, iLPos, 1, psr->nick.t); + ListView_SetItemText(hLV, iLPos, 2, psr->firstName.t); + ListView_SetItemText(hLV, iLPos, 3, psr->lastName.t); break; } mir_free(wndData->haUin); diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index b8f426da7f..76f2584973 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -80,7 +80,7 @@ void NotifyUser(Account *curAcc) resultLink *prst = curAcc->results.next; for (int i = 0; i < newMails; i++) { - dbei.cbBlob = mir_strlen(prst->content) + 1; + dbei.cbBlob = (DWORD)mir_strlen(prst->content) + 1; dbei.pBlob = (PBYTE)prst->content; db_event_add(curAcc->hContact, &dbei); prst = prst->next; @@ -177,7 +177,7 @@ void __cdecl Login_ThreadFunc(void *lpParam) mir_strcat(buffer, ">"); - WriteFile(hTempFile, buffer, mir_strlen(buffer), &dwBytesWritten, NULL); + WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, NULL); CloseHandle(hTempFile); mir_strcat(lpPathBuffer, szTempName); } diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index b2adfc3878..090d93f6a5 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -233,15 +233,15 @@ void CSend::svcSendMsgExit(const char* szMessage) { Exit(res); return; }else{ mir_freeAndNil(m_szEventMsg); - m_cbEventMsg=mir_strlen(szMessage)+1; - m_szEventMsg=(char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); + m_cbEventMsg = (DWORD)mir_strlen(szMessage)+1; + m_szEventMsg = (char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); memset(m_szEventMsg, 0, (sizeof(char) * m_cbEventMsg)); mir_strcpy(m_szEventMsg,szMessage); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { char *temp = mir_t2a(m_pszFileDesc); mir_stradd(m_szEventMsg, "\r\n"); mir_stradd(m_szEventMsg, temp); - m_cbEventMsg = mir_strlen(m_szEventMsg)+1; + m_cbEventMsg = (DWORD)mir_strlen(m_szEventMsg)+1; mir_free(temp); } //create a HookEventObj on ME_PROTO_ACK @@ -272,13 +272,13 @@ void CSend::svcSendFileExit() { } mir_freeAndNil(m_szEventMsg); char* szFile = mir_t2a(m_pszFile); - m_cbEventMsg=mir_strlen(szFile)+2; + m_cbEventMsg = (DWORD)mir_strlen(szFile)+2; m_szEventMsg=(char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); memset(m_szEventMsg, 0, (sizeof(char) * m_cbEventMsg)); mir_strcpy(m_szEventMsg,szFile); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { char* temp = mir_t2a(m_pszFileDesc); - m_cbEventMsg += mir_strlen(temp); + m_cbEventMsg += (DWORD)mir_strlen(temp); m_szEventMsg=(char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg); mir_strcpy(m_szEventMsg+mir_strlen(szFile)+1,temp); m_szEventMsg[m_cbEventMsg-1] = 0; @@ -611,7 +611,7 @@ static void HTTPFormAppendData(NETLIBHTTPREQUEST* nlhr, size_t* dataMax, char** } if(data){ memcpy(*dataPos,data,sizeof(char)*len); *dataPos+=len; - nlhr->dataLength+=len; // not necessary + nlhr->dataLength += (int)len; // not necessary } } void CSend::HTTPFormDestroy(NETLIBHTTPREQUEST* nlhr) diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 5f2fd10f6b..ea5f444fdc 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -35,8 +35,7 @@ static TCHAR name1[256]; INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) { PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam; - - if(!psr || !psr->email) + if(!psr || !psr->email.t) return 0; // search for existing contact @@ -46,7 +45,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) DBVARIANT dbv; // check ID to see if the contact already exist in the database if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) { - if ( !mir_tstrcmpi(psr->email, dbv.ptszVal)) { + if ( !mir_tstrcmpi(psr->email.t, dbv.ptszVal)) { // remove the flag for not on list and hidden, thus make the contact visible // and add them on the list if (db_get_b(hContact, "CList", "NotOnList", 1)) { @@ -71,10 +70,10 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) // set contact info and settings TCHAR svc[256]; - _tcsncpy(svc, psr->email, SIZEOF(svc)); svc[SIZEOF(svc)-1] = 0; + _tcsncpy(svc, psr->email.t, SIZEOF(svc)); svc[SIZEOF(svc)-1] = 0; GetSvc(svc); // set settings by obtaining the default for the service - if (psr->lastName[0] != 0) { + if (psr->lastName.t[0] != 0) { WIDATA *sData = GetWIData(svc); db_set_ts(hContact, WEATHERPROTONAME, "MapURL", sData->DefaultMap); db_set_s(hContact, WEATHERPROTONAME, "InfoURL", sData->DefaultURL); @@ -84,14 +83,14 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) db_set_s(hContact, WEATHERPROTONAME, "InfoURL", ""); } // write the other info and settings to the database - db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email); - db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick); + db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email.t); + db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick.t); db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE); AvatarDownloaded(hContact); TCHAR str[256]; - mir_sntprintf(str, SIZEOF(str), TranslateT("Current weather information for %s."), psr->nick); + mir_sntprintf(str, SIZEOF(str), TranslateT("Current weather information for %s."), psr->nick.t); db_set_ts(hContact, WEATHERPROTONAME, "About", str); // make the last update tags to something invalid @@ -256,10 +255,10 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, // set the search result and broadcast it PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; - psr.nick = str; - psr.firstName = _T(" "); - psr.lastName = svcname; - psr.email = newID; + psr.nick.t = str; + psr.firstName.t = _T(" "); + psr.lastName.t = svcname; + psr.email.t = newID; ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr); return 0; @@ -287,10 +286,10 @@ int IDSearch(TCHAR *sID, const int searchId) // return an empty contact on "#" PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; - psr.nick = TranslateT(""); // to be entered - psr.firstName = _T(" "); - psr.lastName = _T(""); - psr.email = TranslateT(""); // to be entered + psr.nick.t = TranslateT(""); // to be entered + psr.firstName.t = _T(" "); + psr.lastName.t = _T(""); + psr.email.t = TranslateT(""); // to be entered ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr); } @@ -349,11 +348,11 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // set the data and broadcast it PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; - psr.nick = Name; - psr.firstName = _T(" "); - psr.lastName = svcname; - psr.email = sID; - psr.id = sID; + psr.nick.t = Name; + psr.firstName.t = _T(" "); + psr.lastName.t = svcname; + psr.email.t = sID; + psr.id.t = sID; ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr); mir_free(szData); return 0; @@ -387,11 +386,11 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; - psr.nick = Name; - psr.firstName = _T(""); - psr.lastName = svcname; - psr.email = sID; - psr.id = sID; + psr.nick.t = Name; + psr.firstName.t = _T(""); + psr.lastName.t = svcname; + psr.email.t = sID; + psr.id.t = sID; ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr); } } diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 77438d6ccc..7f6c29897c 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -304,7 +304,7 @@ INT_PTR BPLoadIcon(WPARAM wParam, LPARAM lParam) static void __cdecl BasicSearchTimerProc(void *pszNick) { PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.nick = (TCHAR*) pszNick; + psr.nick.t = (TCHAR*) pszNick; // broadcast the search result ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); @@ -343,7 +343,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) if (psr == NULL) return 0; - if (psr->nick == NULL) { + if (psr->nick.t == NULL) { WErrorPopup((MCONTACT)"ERROR", TranslateT("Please select site in Find/Add contacts...")); return 0; } @@ -355,7 +355,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) // check ID to see if the contact already exist in the database if (db_get_ts(hContact, MODULENAME, "URL", &dbv)) continue; - if (!mir_tstrcmpi(psr->nick, dbv.ptszVal)) { + if (!mir_tstrcmpi(psr->nick.t, dbv.ptszVal)) { // remove the flag for not on list and hidden, thus make the // contact visible // and add them on the list @@ -379,8 +379,8 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) //Convert url into a name for contact TCHAR Cnick[255]; - if (psr->nick != NULL) - _tcsncpy(Cnick, psr->nick, SIZEOF(Cnick)); + if (psr->nick.t != NULL) + _tcsncpy(Cnick, psr->nick.t, SIZEOF(Cnick)); else Cnick[0] = 0; @@ -436,8 +436,8 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) db_set_ts(hContact, MODULENAME, "Nick", Newnick); db_set_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 1); db_set_s(hContact, MODULENAME, START_STRING_KEY, ""); - db_set_ts(hContact, MODULENAME, URL_KEY, psr->nick); - db_set_ts(hContact, MODULENAME, "Homepage", psr->nick); + db_set_ts(hContact, MODULENAME, URL_KEY, psr->nick.t); + db_set_ts(hContact, MODULENAME, "Homepage", psr->nick.t); db_set_b(hContact, MODULENAME, U_ALLSITE_KEY, 1); db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); -- cgit v1.2.3