From 688f55ba998c19304a29727c910504903f4cc49a Mon Sep 17 00:00:00 2001 From: George Hazan <george.hazan@gmail.com> Date: Sun, 30 Nov 2014 18:51:36 +0000 Subject: lstr* replacements git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/GmailNotifier/src/check.cpp | 70 +++++++++++++++++------------------ plugins/GmailNotifier/src/main.cpp | 2 +- plugins/GmailNotifier/src/notify.cpp | 46 +++++++++++------------ plugins/GmailNotifier/src/options.cpp | 4 +- plugins/GmailNotifier/src/utility.cpp | 8 ++-- 5 files changed, 65 insertions(+), 65 deletions(-) (limited to 'plugins/GmailNotifier') diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp index b3821cb7cf..6e407a1afd 100644 --- a/plugins/GmailNotifier/src/check.cpp +++ b/plugins/GmailNotifier/src/check.cpp @@ -23,23 +23,23 @@ void CheckMailInbox(Account *curAcc) curAcc->IsChecking = TRUE; if (!db_get_s(curAcc->hContact, "CList", "MyHandle", &dbv)) { - lstrcpyA(curAcc->results.content, dbv.pszVal); + mir_strcpy(curAcc->results.content, dbv.pszVal); db_free(&dbv); } - else lstrcpyA(curAcc->results.content, curAcc->name); + else mir_strcpy(curAcc->results.content, curAcc->name); tail = strstr(curAcc->results.content, " ["); if (tail) *tail = '\0'; - lstrcatA(curAcc->results.content, " ["); + mir_strcat(curAcc->results.content, " ["); - lstrcpyA(str, curAcc->results.content); - lstrcatA(str, Translate("Checking...")); - lstrcatA(str, "]"); + mir_strcpy(str, curAcc->results.content); + mir_strcat(str, Translate("Checking...")); + mir_strcat(str, "]"); db_set_s(curAcc->hContact, "CList", "MyHandle", str); hHTTPOpen = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, "", "", 0); if (!hHTTPOpen) { - lstrcatA(curAcc->results.content, Translate("Can't open Internet!")); + mir_strcat(curAcc->results.content, Translate("Can't open Internet!")); goto error_handle; } @@ -54,22 +54,22 @@ void CheckMailInbox(Account *curAcc) 0); if (!hHTTPConnection) { - lstrcatA(curAcc->results.content, Translate("Can't reach server!")); + mir_strcat(curAcc->results.content, Translate("Can't reach server!")); goto error_handle; } - lstrcpyA(str, "/a/"); - lstrcatA(str, curAcc->hosted); - lstrcatA(str, "/LoginAction"); + mir_strcpy(str, "/a/"); + mir_strcat(str, curAcc->hosted); + mir_strcat(str, "/LoginAction"); hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, NULL, NULL, INTERNET_FLAG_SECURE, 0); - lstrcatA(requestBuffer, curAcc->hosted); - lstrcatA(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName="); - lstrcatA(requestBuffer, curAcc->name); + mir_strcat(requestBuffer, curAcc->hosted); + mir_strcat(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName="); + mir_strcat(requestBuffer, curAcc->name); tail = strchr(requestBuffer, '@'); *tail = '\0'; - lstrcatA(requestBuffer, "&password="); - lstrcatA(requestBuffer, curAcc->pass); + mir_strcat(requestBuffer, "&password="); + mir_strcat(requestBuffer, curAcc->pass); if (!HttpSendRequestA(hHTTPRequest, contentType, (int)strlen(contentType) + 1, requestBuffer, (int)strlen(requestBuffer) + 1)) { - lstrcpyA(curAcc->results.content, Translate("Can't send account data!")); + mir_strcpy(curAcc->results.content, Translate("Can't send account data!")); goto error_handle; } @@ -79,40 +79,40 @@ void CheckMailInbox(Account *curAcc) hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); if (!hHTTPConnection) { - lstrcatA(curAcc->results.content, Translate("Can't reach server!")); + mir_strcat(curAcc->results.content, Translate("Can't reach server!")); goto error_handle; } if (curAcc->hosted[0]) { - lstrcpyA(str, "/a/"); - lstrcatA(str, curAcc->hosted); - lstrcatA(str, "/feed/atom"); + mir_strcpy(str, "/a/"); + mir_strcat(str, curAcc->hosted); + mir_strcat(str, "/feed/atom"); } - else lstrcpyA(str, "/mail/feed/atom"); + else mir_strcpy(str, "/mail/feed/atom"); hHTTPRequest = HttpOpenRequest(hHTTPConnection, _T("GET"), _A2T(str), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0); InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)strlen(curAcc->name) + 1); InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)strlen(curAcc->pass) + 1); if (!HttpSendRequest(hHTTPRequest, NULL, 0, NULL, 0)) { - lstrcatA(curAcc->results.content, Translate("Can't get RSS feed!")); + mir_strcat(curAcc->results.content, Translate("Can't get RSS feed!")); goto error_handle; } while (InternetReadFile(hHTTPRequest, temp, _MAX_DOWN_BUFFER, &bufferLength) && bufferLength > 0) { temp[bufferLength] = '\0'; - lstrcatA(fileBuffer, temp); + mir_strcat(fileBuffer, temp); } fileBuffer[_MAX_DOWN_BUFFER - 1] = '\0'; curAcc->results_num = ParsePage(fileBuffer, &curAcc->results); if (curAcc->results_num == -1) { - lstrcatA(curAcc->results.content, Translate("Wrong name or password!")); + mir_strcat(curAcc->results.content, Translate("Wrong name or password!")); goto error_handle; } InternetCloseHandle(hHTTPOpen); InternetCloseHandle(hHTTPConnection); InternetCloseHandle(hHTTPRequest); - lstrcatA(curAcc->results.content, _itoa(curAcc->results_num, str, 10)); - lstrcatA(curAcc->results.content, "]"); + mir_strcat(curAcc->results.content, _itoa(curAcc->results_num, str, 10)); + mir_strcat(curAcc->results.content, "]"); curAcc->IsChecking = FALSE; return; @@ -123,7 +123,7 @@ error_handle: InternetCloseHandle(hHTTPConnection); InternetCloseHandle(hHTTPRequest); - lstrcatA(curAcc->results.content, "]"); + mir_strcat(curAcc->results.content, "]"); curAcc->IsChecking = FALSE; } @@ -162,20 +162,20 @@ int ParsePage(char *page, resultLink *prst) str_head += 7; str_tail = strstr(str_head, "</title>"); *str_tail = '\0'; - lstrcpynA(title, str_head, 41); - if (lstrlenA(title) == 40) - lstrcatA(title, "..."); + mir_strncpy(title, str_head, 41); + if (mir_strlen(title) == 40) + mir_strcat(title, "..."); *str_tail = ' '; str_head = strstr(str_head, "<name>") + 6; str_tail = strstr(str_head, "</name>"); *str_tail = '\0'; - lstrcpynA(name, str_head, 11); - lstrcatA(name, ": "); + mir_strncpy(name, str_head, 11); + mir_strcat(name, ": "); *str_tail = ' '; - lstrcpyA(prst->content, name); - lstrcatA(prst->content, title); + mir_strcpy(prst->content, name); + mir_strcat(prst->content, title); MultiByteToWideChar(CP_UTF8, 0, prst->content, -1, str, 64); WideCharToMultiByte(CP_ACP, 0, str, -1, prst->content, 64, NULL, NULL); num++; diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 0458dad8b8..992b2cc633 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -51,7 +51,7 @@ INT_PTR GetStatus(WPARAM wParam, LPARAM lParam) INT_PTR GetName(WPARAM wParam, LPARAM lParam) { - lstrcpynA((char*)lParam, pluginName, wParam); + mir_strncpy((char*)lParam, pluginName, wParam); return 0; } diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index a684e5ff0c..cf6cb8b06e 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 = lstrlenA(prst->content) + 1; + dbei.cbBlob = mir_strlen(prst->content) + 1; dbei.pBlob = (PBYTE)prst->content; db_event_add(curAcc->hContact, &dbei); prst = prst->next; @@ -103,7 +103,7 @@ void NotifyUser(Account *curAcc) ppd.lchContact = curAcc->hContact; ppd.lchIcon = LoadSkinnedProtoIcon(pluginName, ID_STATUS_OCCUPIED); - lstrcpyA(ppd.lpzContactName, curAcc->results.content); + mir_strcpy(ppd.lpzContactName, curAcc->results.content); resultLink *prst = curAcc->results.next; for (int i = 0; i < 5 && i < newMails; i++) { strcat(ppd.lpzText, prst->content); @@ -151,12 +151,12 @@ void __cdecl Login_ThreadFunc(void *lpParam) if (GetBrowser(lpPathBuffer)) { if (opt.AutoLogin == 0) { if (curAcc->hosted[0]) { - lstrcatA(lpPathBuffer, "https://mail.google.com/a/"); - lstrcatA(lpPathBuffer, curAcc->hosted); - lstrcatA(lpPathBuffer, "/?logout"); + mir_strcat(lpPathBuffer, "https://mail.google.com/a/"); + mir_strcat(lpPathBuffer, curAcc->hosted); + mir_strcat(lpPathBuffer, "/?logout"); } else { - lstrcatA(lpPathBuffer, "https://mail.google.com/mail/?logout"); + mir_strcat(lpPathBuffer, "https://mail.google.com/mail/?logout"); } } else { @@ -165,29 +165,29 @@ void __cdecl Login_ThreadFunc(void *lpParam) GetTempFileNameA(buffer, "gmail", 0, szTempName); hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - lstrcpyA(buffer, FORMDATA1); - lstrcatA(buffer, curAcc->hosted); - lstrcatA(buffer, FORMDATA2); - lstrcatA(buffer, curAcc->hosted); - lstrcatA(buffer, FORMDATA3); - lstrcatA(buffer, "<input type=hidden name=userName value="); - lstrcatA(buffer, curAcc->name); + mir_strcpy(buffer, FORMDATA1); + mir_strcat(buffer, curAcc->hosted); + mir_strcat(buffer, FORMDATA2); + mir_strcat(buffer, curAcc->hosted); + mir_strcat(buffer, FORMDATA3); + mir_strcat(buffer, "<input type=hidden name=userName value="); + mir_strcat(buffer, curAcc->name); if ((str_temp = strstr(buffer, "@")) != NULL) *str_temp = '\0'; - lstrcatA(buffer, "><input type=hidden name=password value="); - lstrcatA(buffer, curAcc->pass); - lstrcatA(buffer, "></form></body>"); - WriteFile(hTempFile, buffer, lstrlenA(buffer), &dwBytesWritten, NULL); + mir_strcat(buffer, "><input type=hidden name=password value="); + mir_strcat(buffer, curAcc->pass); + mir_strcat(buffer, "></form></body>"); + WriteFile(hTempFile, buffer, mir_strlen(buffer), &dwBytesWritten, NULL); CloseHandle(hTempFile); - lstrcatA(lpPathBuffer, szTempName); + mir_strcat(lpPathBuffer, szTempName); } else { - lstrcatA(lpPathBuffer, LINK); - lstrcatA(lpPathBuffer, mir_urlEncode(curAcc->name)); - lstrcatA(lpPathBuffer, "&Passwd="); - lstrcatA(lpPathBuffer, mir_urlEncode(curAcc->pass)); + mir_strcat(lpPathBuffer, LINK); + mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->name)); + mir_strcat(lpPathBuffer, "&Passwd="); + mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->pass)); if (opt.AutoLogin == 1) - lstrcatA(lpPathBuffer, "&PersistentCookie=yes"); + mir_strcat(lpPathBuffer, "&PersistentCookie=yes"); } } } diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index 8ac8e51e64..b03a442c96 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -87,7 +87,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { DBVARIANT dbv; if (!db_get_s(NULL, pluginName, "OpenUsePrgPath", &dbv)) { - lstrcpyA(str, dbv.pszVal); + mir_strcpy(str, dbv.pszVal); db_free(&dbv); } } @@ -166,7 +166,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, SIZEOF(acc[curIndex].name))) { tail = strstr(acc[curIndex].name, "@"); if (tail && lstrcmpA(tail + 1, "gmail.com") != 0) - lstrcpyA(acc[curIndex].hosted, tail + 1); + mir_strcpy(acc[curIndex].hosted, tail + 1); SendMessageA(hwndCombo, CB_DELETESTRING, curIndex, 0); SendMessageA(hwndCombo, CB_INSERTSTRING, curIndex, (LONG_PTR)acc[curIndex].name); SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0); diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 9363f27f60..19156366fd 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -11,12 +11,12 @@ void BuildList(void) acc = (Account *)realloc(acc, acc_num * sizeof(Account)); memset(&acc[acc_num-1], 0, sizeof(Account)); acc[acc_num-1].hContact = hContact; - lstrcpyA(acc[acc_num-1].name, dbv.pszVal); + mir_strcpy(acc[acc_num-1].name, dbv.pszVal); CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE); db_free(&dbv); if (!db_get_s(hContact, pluginName, "Password", &dbv)) { - lstrcpyA(acc[acc_num-1].pass, dbv.pszVal); + mir_strcpy(acc[acc_num-1].pass, dbv.pszVal); db_free(&dbv); } } @@ -25,7 +25,7 @@ void BuildList(void) for (int i = 0; i < acc_num; i++) { char *tail = strchr(acc[i].name, '@'); if (tail && lstrcmpA(tail + 1, "gmail.com") != 0) - lstrcpyA(acc[i].hosted, tail + 1); + mir_strcpy(acc[i].hosted, tail + 1); acc[i].IsChecking = FALSE; } } @@ -43,7 +43,7 @@ BOOL GetBrowser(char *str) else if (opt.OpenUsePrg == 0) strKey = strDefault; else if (!db_get_s(NULL, pluginName, "OpenUsePrgPath", &dbv)) { - lstrcpyA(str, dbv.pszVal); + mir_strcpy(str, dbv.pszVal); db_free(&dbv); return FALSE; } -- cgit v1.2.3