From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewsAggregator/Src/Authentication.cpp | 12 ++--- plugins/NewsAggregator/Src/CheckFeed.cpp | 62 ++++++++++++------------ plugins/NewsAggregator/Src/ExportImport.cpp | 70 +++++++++++++-------------- plugins/NewsAggregator/Src/Menus.cpp | 18 +++---- plugins/NewsAggregator/Src/NewsAggregator.cpp | 6 +-- plugins/NewsAggregator/Src/Options.cpp | 40 +++++++-------- plugins/NewsAggregator/Src/Services.cpp | 10 ++-- plugins/NewsAggregator/Src/Utils.cpp | 48 +++++++++--------- plugins/NewsAggregator/Src/stdafx.h | 18 +++---- 9 files changed, 142 insertions(+), 142 deletions(-) (limited to 'plugins/NewsAggregator/Src') diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index c2f23cc1f1..f72bee89fc 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -21,13 +21,13 @@ Boston, MA 02111-1307, USA. void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg) { - TCHAR *tlogin = NULL, *tpass = NULL; + wchar_t *tlogin = NULL, *tpass = NULL; if (hContact && db_get_b(hContact, MODULE, "UseAuth", 0)) { tlogin = db_get_tsa(hContact, MODULE, "Login"); tpass = db_get_tsa(hContact, MODULE, "Password"); } else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) { - TCHAR buf[MAX_PATH] = {0}; + wchar_t buf[MAX_PATH] = {0}; GetDlgItemText(hwndDlg, IDC_LOGIN, buf, _countof(buf)); tlogin = mir_tstrdup(buf); GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, _countof(buf)); @@ -55,7 +55,7 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)&SelItem); if (SelItem.hwndList) { - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; if (GetDlgItemText(SelItem.hwndList, IDC_FEEDTITLE, str, _countof(str))) SetDlgItemText(hwndDlg, IDC_FEEDNAME, str); else { @@ -64,13 +64,13 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } } else if (SelItem.hContact) { - TCHAR *ptszNick = db_get_tsa(SelItem.hContact, MODULE, "Nick"); + wchar_t *ptszNick = db_get_tsa(SelItem.hContact, MODULE, "Nick"); if (ptszNick) { SetDlgItemText(hwndDlg, IDC_FEEDNAME, ptszNick); mir_free(ptszNick); } else { - TCHAR *ptszURL = db_get_tsa(SelItem.hContact, MODULE, "URL"); + wchar_t *ptszURL = db_get_tsa(SelItem.hContact, MODULE, "URL"); if (ptszURL) { SetDlgItemText(hwndDlg, IDC_FEEDNAME, ptszURL); mir_free(ptszURL); @@ -85,7 +85,7 @@ INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK: { ItemInfo &SelItem = *(ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - TCHAR username[MAX_PATH]; + wchar_t username[MAX_PATH]; char passw[MAX_PATH]; if (!GetDlgItemText(hwndDlg, IDC_FEEDUSERNAME, username, _countof(username))) { MessageBox(hwndDlg, TranslateT("Enter your username"), TranslateT("Error"), MB_OK | MB_ICONERROR); diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index c9967ba341..4abe1c0395 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -19,13 +19,13 @@ Boston, MA 02111-1307, USA. #include "stdafx.h" -LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) +LPCTSTR CheckFeed(wchar_t *tszURL, HWND hwndDlg) { Netlib_LogfT(hNetlibUser, L"Started validating feed %s.", tszURL); char *szData = NULL; GetNewsData(tszURL, &szData, NULL, hwndDlg); if (szData) { - TCHAR *tszData = mir_utf8decodeT(szData); + wchar_t *tszData = mir_utf8decodeT(szData); if (!tszData) tszData = mir_a2t(szData); int bytesParsed = 0; @@ -56,11 +56,11 @@ LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) for (int j = 0; j < xmlGetChildCount(chan); j++) { HXML child = xmlGetChild(chan, j); if (!mir_tstrcmpi(xmlGetName(child), L"title")) { - TCHAR mes[MAX_PATH]; + wchar_t mes[MAX_PATH]; mir_sntprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION); if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); return mir_tstrdup(buf); } @@ -73,11 +73,11 @@ LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) for (int j = 0; j < xmlGetChildCount(node); j++) { HXML child = xmlGetChild(node, j); if (!mir_tstrcmpi(xmlGetName(child), L"title")) { - TCHAR mes[MAX_PATH]; + wchar_t mes[MAX_PATH]; mir_sntprintf(mes, TranslateT("%s\nis a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION); if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); return mir_tstrdup(buf); } @@ -92,7 +92,7 @@ LPCTSTR CheckFeed(TCHAR *tszURL, HWND hwndDlg) xmlDestroyNode(hXml); } Netlib_LogfT(hNetlibUser, L"%s is not a valid feed's address.", tszURL); - TCHAR mes[MAX_PATH]; + wchar_t mes[MAX_PATH]; mir_sntprintf(mes, TranslateT("%s\nis not a valid feed's address."), tszURL); MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONERROR); return NULL; @@ -183,7 +183,7 @@ void CheckCurrentFeed(MCONTACT hContact) if (!db_get_b(hContact, MODULE, "CheckState", 1) != 0) return; - TCHAR *szURL = db_get_tsa(hContact, MODULE, "URL"); + wchar_t *szURL = db_get_tsa(hContact, MODULE, "URL"); if (szURL == NULL) return; @@ -194,7 +194,7 @@ void CheckCurrentFeed(MCONTACT hContact) mir_free(szURL); if (szData) { - TCHAR *tszData = mir_utf8decodeT(szData); + wchar_t *tszData = mir_utf8decodeT(szData); if (!tszData) tszData = mir_a2t(szData); int bytesParsed = 0; @@ -228,7 +228,7 @@ void CheckCurrentFeed(MCONTACT hContact) for (int i = 0; i < xmlGetAttrCount(node); i++) { LPCTSTR szAttrName = xmlGetAttrName(node, i); if (!mir_tstrcmpi(szAttrName, L"version")) { - TCHAR ver[MAX_PATH]; + wchar_t ver[MAX_PATH]; mir_sntprintf(ver, L"RSS %s", xmlGetAttrValue(node, szAttrName)); db_set_ts(hContact, MODULE, "MirVer", ver); break; @@ -245,7 +245,7 @@ void CheckCurrentFeed(MCONTACT hContact) if (!mir_tstrcmpi(childName, L"title")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -257,7 +257,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(childName, L"link")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -269,7 +269,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(childName, L"description")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -284,7 +284,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(childName, L"language")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -296,7 +296,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(childName, L"managingEditor")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -308,7 +308,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(childName, L"category")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -320,7 +320,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(childName, L"copyright")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -339,9 +339,9 @@ void CheckCurrentFeed(MCONTACT hContact) PROTO_AVATAR_INFORMATION ai = { 0 }; ai.hContact = hContact; - TCHAR *szNick = db_get_tsa(hContact, MODULE, "Nick"); + wchar_t *szNick = db_get_tsa(hContact, MODULE, "Nick"); if (szNick) { - TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1; + wchar_t *ext = wcsrchr((wchar_t *)url, '.') + 1; ai.format = ProtoGetAvatarFormat(url); CMString filename = szNick; @@ -362,7 +362,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(childName, L"lastBuildDate")) { LPCTSTR szChildText = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(child)), -1, buf, _countof(buf)); szChildText = buf; } @@ -387,7 +387,7 @@ void CheckCurrentFeed(MCONTACT hContact) LPCTSTR itemName = xmlGetName(itemval); LPCTSTR value = NULL; if (!mir_tstrcmpi(codepage, L"koi8-r")) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; MultiByteToWideChar(20866, 0, _T2A(xmlGetText(itemval)), -1, buf, _countof(buf)); value = buf; } @@ -483,10 +483,10 @@ void CheckCurrentFeed(MCONTACT hContact) if (szNick) { PROTO_AVATAR_INFORMATION ai = { 0 }; ai.hContact = hContact; - TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1; + wchar_t *ext = wcsrchr((wchar_t *)url, '.') + 1; ai.format = ProtoGetAvatarFormat(ext); - TCHAR *filename = szNick; + wchar_t *filename = szNick; mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); @@ -501,7 +501,7 @@ void CheckCurrentFeed(MCONTACT hContact) else if (!mir_tstrcmpi(szChildName, L"updated")) { LPCTSTR szChildText = xmlGetText(child); if (szChildText) { - TCHAR *lastupdtime = (TCHAR *)szChildText; + wchar_t *lastupdtime = (wchar_t *)szChildText; time_t stamp = DateToUnixTime(lastupdtime, 1); double deltaupd = difftime(time(NULL), stamp); double deltacheck = difftime(time(NULL), (time_t)db_get_dw(hContact, MODULE, "LastCheck", 0)); @@ -587,7 +587,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) if (!db_get_b(hContact, MODULE, "CheckState", 1)) return; - TCHAR *szURL = db_get_tsa(hContact, MODULE, "URL"); + wchar_t *szURL = db_get_tsa(hContact, MODULE, "URL"); if (szURL == NULL) return; @@ -598,7 +598,7 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) if (szData == NULL) return; - TCHAR *tszData = mir_utf8decodeT(szData); + wchar_t *tszData = mir_utf8decodeT(szData); if (!tszData) tszData = mir_a2t(szData); int bytesParsed = 0; @@ -626,12 +626,12 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) PROTO_AVATAR_INFORMATION ai = { 0 }; ai.hContact = hContact; - TCHAR *szNick = db_get_tsa(hContact, MODULE, "Nick"); + wchar_t *szNick = db_get_tsa(hContact, MODULE, "Nick"); if (szNick) { - TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1; + wchar_t *ext = wcsrchr((wchar_t *)url, '.') + 1; ai.format = ProtoGetAvatarFormat(ext); - TCHAR *filename = szNick; + wchar_t *filename = szNick; mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); @@ -661,10 +661,10 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) PROTO_AVATAR_INFORMATION ai = { 0 }; ai.hContact = hContact; - TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1; + wchar_t *ext = wcsrchr((wchar_t *)url, '.') + 1; ai.format = ProtoGetAvatarFormat(ext); - TCHAR *filename = szNick; + wchar_t *filename = szNick; mir_sntprintf(ai.filename, L"%s\\%s.%s", tszRoot, filename, ext); if (DownloadFile(url, ai.filename)) { db_set_ts(hContact, MODULE, "ImagePath", ai.filename); diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index cbaac0f4b3..0943dcd303 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -40,7 +40,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM switch (LOWORD(wParam)) { case IDOK: { - TCHAR FileName[MAX_PATH]; + wchar_t FileName[MAX_PATH]; GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, _countof(FileName)); int bytesParsed = 0; HXML hXml = xmlParseFile(FileName, &bytesParsed, NULL); @@ -56,7 +56,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM while (node) { int outlineAttr = xmlGetAttrCount(node); int outlineChildsCount = xmlGetChildCount(node); - TCHAR *xmlUrl = (TCHAR *)xmlGetAttrValue(node, L"xmlUrl"); + wchar_t *xmlUrl = (wchar_t *)xmlGetAttrValue(node, L"xmlUrl"); if (!xmlUrl && !outlineChildsCount) { HXML tmpnode = node; node = xmlGetNextNode(node); @@ -74,19 +74,19 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else if (!xmlUrl && outlineChildsCount) node = xmlGetFirstChild(node); else if (xmlUrl) { - TCHAR *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL; + wchar_t *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL; BYTE NeedToImport = FALSE; for (int i = 0; i < outlineAttr; i++) { if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"text")) { text = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); if (!text) { isTextUTF = 0; - text = (TCHAR *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); + text = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); } else isTextUTF = 1; for (int j = 0; j < count; j++) { - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)j, (LPARAM)item); if (!mir_tstrcmpi(item, text)) { NeedToImport = TRUE; @@ -99,7 +99,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM url = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); if ( !url) { isURLUTF = false; - url = (TCHAR *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); + url = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); } else isURLUTF = true; if (GetContactByURL(url) && NeedToImport) { @@ -112,7 +112,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM siteurl = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); if ( !siteurl) { isSiteURLUTF = false; - siteurl = (TCHAR *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); + siteurl = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); } else isSiteURLUTF = true; continue; @@ -123,12 +123,12 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (NeedToImport) { HXML parent = xmlGetParent(node); - TCHAR tmpgroup[1024]; + wchar_t tmpgroup[1024]; while (mir_tstrcmpi(xmlGetName(parent), L"body")) { for (int i = 0; i < xmlGetAttrCount(parent); i++) { if (!mir_tstrcmpi(xmlGetAttrName(parent, i), L"text")) { if ( !group) - group = (TCHAR *)xmlGetAttrValue(parent, xmlGetAttrName(parent, i)); + group = (wchar_t *)xmlGetAttrValue(parent, xmlGetAttrName(parent, i)); else { mir_sntprintf(tmpgroup, L"%s\\%s", xmlGetAttrValue(parent, xmlGetAttrName(parent, i)), group); group = tmpgroup; @@ -139,7 +139,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM parent = xmlGetParent(parent); } - TCHAR *ptszGroup = NULL; + wchar_t *ptszGroup = NULL; if (group) { ptszGroup = mir_utf8decodeT(_T2A(group)); if ( !ptszGroup) { @@ -193,7 +193,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM DeleteAllItems(hwndList); UpdateList(hwndList); } - TCHAR mes[MAX_PATH]; + wchar_t mes[MAX_PATH]; if (DUPES) mir_sntprintf(mes, TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES); else @@ -208,12 +208,12 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_BROWSEIMPORTFILE: { - TCHAR FileName[MAX_PATH]; + wchar_t FileName[MAX_PATH]; VARST tszMirDir(L"%miranda_path%"); OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); - TCHAR tmp[MAX_PATH]; + wchar_t tmp[MAX_PATH]; mir_sntprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; @@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM while (node) { int outlineAttr = xmlGetAttrCount(node); int outlineChildsCount = xmlGetChildCount(node); - TCHAR *xmlUrl = (TCHAR *)xmlGetAttrValue(node, L"xmlUrl"); + wchar_t *xmlUrl = (wchar_t *)xmlGetAttrValue(node, L"xmlUrl"); if (!xmlUrl && !outlineChildsCount) { HXML tmpnode = node; node = xmlGetNextNode(node); @@ -256,11 +256,11 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else if (xmlUrl) { for (int i = 0; i < outlineAttr; i++) { if (!mir_tstrcmpi(xmlGetAttrName(node, i), L"text")) { - TCHAR *text = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); + wchar_t *text = mir_utf8decodeT(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i)))); bool isTextUTF; if (!text) { isTextUTF = false; - text = (TCHAR *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); + text = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i)); } else isTextUTF = true; SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)text); @@ -310,7 +310,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsImportList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0); @@ -328,7 +328,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS))) EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); int cursel = (int)SendMessage(FeedsImportList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsImportList, LB_DELETESTRING, (WPARAM)cursel, 0); @@ -351,7 +351,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); int count = (int)SendMessage(FeedsList, LB_GETCOUNT, 0, 0); for (int i = 0; i < count; i++) { - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsList, LB_GETTEXT, (WPARAM)i, (LPARAM)item); SendMessage(FeedsImportList, LB_ADDSTRING, 0, (LPARAM)item); } @@ -370,7 +370,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); int count = (int)SendMessage(FeedsImportList, LB_GETCOUNT, 0, 0); for (int i = 0; i < count; i++) { - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)i, (LPARAM)item); SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); } @@ -393,7 +393,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsImportList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0); @@ -414,7 +414,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS))) EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); int cursel = (int)SendMessage(FeedsImportList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsImportList, LB_DELETESTRING, (WPARAM)cursel, 0); @@ -452,7 +452,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TranslateDialogDefault(hwndDlg); Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, MODULE, "ExportDlg"); for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { - TCHAR *message = db_get_tsa(hContact, MODULE, "Nick"); + wchar_t *message = db_get_tsa(hContact, MODULE, "Nick"); if (message != NULL) { SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)message); mir_free(message); @@ -471,12 +471,12 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM switch (LOWORD(wParam)) { case IDOK: { - TCHAR FileName[MAX_PATH]; + wchar_t FileName[MAX_PATH]; VARST tszMirDir(L"%miranda_path%"); OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); - TCHAR tmp[MAX_PATH]; + wchar_t tmp[MAX_PATH]; mir_sntprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; @@ -497,10 +497,10 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int count = (int)SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0); for (int i = 0; i < count; i++) { - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)i, (LPARAM)item); MCONTACT hContact = GetContactByNick(item); - TCHAR + wchar_t *title = db_get_tsa(hContact, MODULE, "Nick"), *url = db_get_tsa(hContact, MODULE, "URL"), *siteurl = db_get_tsa(hContact, MODULE, "Homepage"), @@ -509,7 +509,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HXML elem = header; if (group) { - TCHAR *section = _tcstok(group, L"\\"); + wchar_t *section = wcstok(group, L"\\"); while (section != NULL) { HXML existgroup = xmlGetChildByAttrValue(header, L"outline", L"title", section); @@ -521,7 +521,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } else { elem = existgroup; } - section = _tcstok(NULL, L"\\"); + section = wcstok(NULL, L"\\"); } elem = xmlAddChild(elem, L"outline", NULL); } @@ -556,7 +556,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0); @@ -574,7 +574,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS))) EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); int cursel = (int)SendMessage(FeedsExportList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsExportList, LB_DELETESTRING, (WPARAM)cursel, 0); @@ -597,7 +597,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); int count = (int)SendMessage(FeedsList, LB_GETCOUNT, 0, 0); for (int i = 0; i < count; i++) { - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsList, LB_GETTEXT, (WPARAM)i, (LPARAM)item); SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item); } @@ -616,7 +616,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); int count = (int)SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0); for (int i = 0; i < count; i++) { - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)i, (LPARAM)item); SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); } @@ -639,7 +639,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE); int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0); @@ -660,7 +660,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS))) EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE); int cursel = (int)SendMessage(FeedsExportList, LB_GETCURSEL, 0, 0); - TCHAR item[MAX_PATH]; + wchar_t item[MAX_PATH]; SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item); SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item); SendMessage(FeedsExportList, LB_DELETESTRING, (WPARAM)cursel, 0); diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index 6733becea1..44aaf21532 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -25,43 +25,43 @@ void InitMenu() { CMenuItem mi; mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("News Aggregator"), 500099000); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("News Aggregator"), 500099000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D9733E4F-1946-4390-8EB3-591E8687222E"); SET_UID(mi, 0x3ec91864, 0xefa7, 0x4994, 0xb7, 0x75, 0x6c, 0x96, 0xcb, 0x29, 0x2f, 0x93); mi.position = 10100001; if (db_get_b(NULL, MODULE, "AutoUpdate", 1)) - mi.name.t = LPGENT("Auto Update Enabled"); + mi.name.w = LPGENW("Auto Update Enabled"); else - mi.name.t = LPGENT("Auto Update Disabled"); + mi.name.w = LPGENW("Auto Update Disabled"); mi.hIcolibItem = GetIconHandle("main"); mi.pszService = MS_NEWSAGGREGATOR_ENABLED; hService2[0] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x8076bb4d, 0x1e44, 0x43af, 0x97, 0x1e, 0x31, 0xd8, 0xa4, 0xe9, 0xb8, 0x37); mi.position = 20100001; - mi.name.t = LPGENT("Check All Feeds"); + mi.name.w = LPGENW("Check All Feeds"); mi.pszService = MS_NEWSAGGREGATOR_CHECKALLFEEDS; hService2[1] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xb876484d, 0x28aa, 0x4e03, 0x9e, 0x98, 0xed, 0xbc, 0xd1, 0xcf, 0x31, 0x80); mi.position = 20100002; mi.hIcolibItem = GetIconHandle("addfeed"); - mi.name.t = LPGENT("Add Feed"); + mi.name.w = LPGENW("Add Feed"); mi.pszService = MS_NEWSAGGREGATOR_ADDFEED; hService2[2] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x600bf2c2, 0xa974, 0x44d3, 0x98, 0xf9, 0xe6, 0x65, 0x7c, 0x1f, 0x63, 0x37); mi.position = 20100003; mi.hIcolibItem = GetIconHandle("importfeeds"); - mi.name.t = LPGENT("Import Feeds"); + mi.name.w = LPGENW("Import Feeds"); mi.pszService = MS_NEWSAGGREGATOR_IMPORTFEEDS; hService2[3] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xc09c8119, 0x64c2, 0x49bd, 0x81, 0xf, 0x54, 0x20, 0x69, 0xd7, 0x30, 0xcf); mi.position = 20100004; mi.hIcolibItem = GetIconHandle("exportfeeds"); - mi.name.t = LPGENT("Export Feeds"); + mi.name.w = LPGENW("Export Feeds"); mi.pszService = MS_NEWSAGGREGATOR_EXPORTFEEDS; hService2[4] = Menu_AddMainMenuItem(&mi); @@ -70,12 +70,12 @@ void InitMenu() mi.root = NULL; mi.position = -0x7FFFFFFA; mi.hIcolibItem = GetIconHandle("checkfeed"); - mi.name.t = LPGENT("Check feed"); + mi.name.w = LPGENW("Check feed"); mi.pszService = MS_NEWSAGGREGATOR_CHECKFEED; hService2[5] = Menu_AddContactMenuItem(&mi, MODULE); SET_UID(mi, 0x41a70fbc, 0x9241, 0x44c0, 0x90, 0x90, 0x87, 0xd2, 0xc5, 0x9f, 0xc9, 0xac); - mi.name.t = LPGENT("Change feed"); + mi.name.w = LPGENW("Change feed"); mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED; hService2[6] = Menu_AddContactMenuItem(&mi, MODULE); diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index ecfd2009ec..8d040fdcc0 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -25,7 +25,7 @@ int hLangpack; HANDLE hPrebuildMenuHook = NULL; HWND hAddFeedDlg; MWindowList hChangeFeedDlgList = NULL; -TCHAR tszRoot[MAX_PATH] = {0}; +wchar_t tszRoot[MAX_PATH] = {0}; HANDLE hUpdateMutex; PLUGININFOEX pluginInfoEx = { @@ -92,8 +92,8 @@ extern "C" __declspec(dllexport) int Load(void) HOTKEYDESC hkd = { sizeof(hkd) }; hkd.dwFlags = HKD_TCHAR; hkd.pszName = "NewsAggregator/CheckAllFeeds"; - hkd.ptszDescription = LPGENT("Check All Feeds"); - hkd.ptszSection = LPGENT("News Aggregator"); + hkd.ptszDescription = LPGENW("Check All Feeds"); + hkd.ptszSection = LPGENW("News Aggregator"); hkd.pszService = MS_NEWSAGGREGATOR_CHECKALLFEEDS; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL+HKCOMB_A, 'O') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index 74fdfc6f71..e27cd761d9 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -37,7 +37,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; char passw[MAX_PATH]; { if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) { @@ -94,7 +94,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case IDC_TAGHELP: - TCHAR tszTagHelp[1024]; + wchar_t tszTagHelp[1024]; mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s", L"##", TranslateT("The title of the item."), L"#<description>#", TranslateT("The item synopsis."), @@ -114,10 +114,10 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_DISCOVERY: EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); - TCHAR tszURL[MAX_PATH] = { 0 }; - TCHAR *tszTitle = NULL; + wchar_t tszURL[MAX_PATH] = { 0 }; + wchar_t *tszTitle = NULL; if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) - tszTitle = (TCHAR*)CheckFeed(tszURL, hwndDlg); + tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg); else MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK); SetDlgItemText(hwndDlg, IDC_FEEDTITLE, tszTitle); @@ -167,7 +167,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_FEEDTITLE, SelItem.nick); SetDlgItemInt(hwndDlg, IDC_CHECKTIME, db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME), TRUE); - TCHAR *szMsgFormat = db_get_tsa(hContact, MODULE, "MsgFormat"); + wchar_t *szMsgFormat = db_get_tsa(hContact, MODULE, "MsgFormat"); if (szMsgFormat) { SetDlgItemText(hwndDlg, IDC_TAGSEDIT, szMsgFormat); mir_free(szMsgFormat); @@ -177,7 +177,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE); - TCHAR *szLogin = db_get_tsa(hContact, MODULE, "Login"); + wchar_t *szLogin = db_get_tsa(hContact, MODULE, "Login"); if (szLogin) { SetDlgItemText(hwndDlg, IDC_LOGIN, szLogin); mir_free(szLogin); @@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; { ItemInfo *SelItem = (ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char passw[MAX_PATH]; @@ -254,7 +254,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_TAGHELP: - TCHAR tszTagHelp[1024]; + wchar_t tszTagHelp[1024]; mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s", L"#<title>#", TranslateT("The title of the item."), L"#<description>#", TranslateT("The item synopsis."), @@ -272,11 +272,11 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_DISCOVERY: - TCHAR tszURL[MAX_PATH] = { 0 }; + wchar_t tszURL[MAX_PATH] = { 0 }; if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) { EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); - TCHAR *tszTitle = (TCHAR*)CheckFeed(tszURL, hwndDlg); + wchar_t *tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg); SetDlgItemText(hwndDlg, IDC_FEEDTITLE, tszTitle); mir_free(tszTitle); EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), TRUE); @@ -314,13 +314,13 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP WindowList_Add(hChangeFeedDlgList, hwndDlg, hContact); Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, MODULE, "ChangeDlg"); - TCHAR *ptszNick = db_get_tsa(hContact, MODULE, "Nick"); + wchar_t *ptszNick = db_get_tsa(hContact, MODULE, "Nick"); if (ptszNick) { SetDlgItemText(hwndDlg, IDC_FEEDTITLE, ptszNick); mir_free(ptszNick); } - TCHAR *ptszURL = db_get_tsa(hContact, MODULE, "URL"); + wchar_t *ptszURL = db_get_tsa(hContact, MODULE, "URL"); if (ptszNick) { SetDlgItemText(hwndDlg, IDC_FEEDURL, ptszURL); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); @@ -329,7 +329,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemInt(hwndDlg, IDC_CHECKTIME, db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME), TRUE); - TCHAR *ptszMsgFormat = db_get_tsa(hContact, MODULE, "MsgFormat"); + wchar_t *ptszMsgFormat = db_get_tsa(hContact, MODULE, "MsgFormat"); if (ptszMsgFormat) { SetDlgItemText(hwndDlg, IDC_TAGSEDIT, ptszMsgFormat); mir_free(ptszMsgFormat); @@ -339,7 +339,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_USEAUTH, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE); - TCHAR *ptszLogin = db_get_tsa(hContact, MODULE, "Login"); + wchar_t *ptszLogin = db_get_tsa(hContact, MODULE, "Login"); if (ptszLogin) { SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin); mir_free(ptszLogin); @@ -353,7 +353,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: - TCHAR str[MAX_PATH]; + wchar_t str[MAX_PATH]; { MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char passw[MAX_PATH]; @@ -410,7 +410,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_TAGHELP: - TCHAR tszTagHelp[1024]; + wchar_t tszTagHelp[1024]; mir_sntprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s", L"#<title>#", TranslateT("The title of the item."), L"#<description>#", TranslateT("The item synopsis."), @@ -428,11 +428,11 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_DISCOVERY: - TCHAR tszURL[MAX_PATH] = { 0 }; + wchar_t tszURL[MAX_PATH] = { 0 }; if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_tstrcmp(tszURL, L"http://") != 0) { EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE); SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait...")); - TCHAR *tszTitle = (TCHAR*)CheckFeed(tszURL, hwndDlg); + wchar_t *tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg); SetDlgItemText(hwndDlg, IDC_FEEDTITLE, tszTitle); mir_free(tszTitle); EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), TRUE); @@ -492,7 +492,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDC_REMOVE: if (MessageBox(hwndDlg, TranslateT("Are you sure?"), TranslateT("Contact deleting"), MB_YESNO | MB_ICONWARNING) == IDYES) { - TCHAR nick[MAX_PATH], url[MAX_PATH]; + wchar_t nick[MAX_PATH], url[MAX_PATH]; sel = ListView_GetSelectionMark(hwndList); ListView_GetItemText(hwndList, sel, 0, nick, _countof(nick)); ListView_GetItemText(hwndList, sel, 1, url, _countof(url)); diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index bc2d5dabe6..d3cdfb6839 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -37,10 +37,10 @@ int OnFoldersChanged(WPARAM, LPARAM) int NewsAggrInit(WPARAM, LPARAM) { - if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT L"\\Avatars\\" DEFAULT_AVATARS_FOLDER)) + if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT L"\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER))) FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, L""); else - mir_tstrncpy(tszRoot, VARST(L"%miranda_userdata%\\Avatars\\" DEFAULT_AVATARS_FOLDER), _countof(tszRoot)); + mir_tstrncpy(tszRoot, VARST(L"%miranda_userdata%\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER)), _countof(tszRoot)); for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1)) @@ -211,7 +211,7 @@ INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam, LPARAM lParam) if (db_get_b(NULL, MODULE, "AutoUpdate", 1) != 0 && !ThreadRunning) mir_forkthread(UpdateThreadProc, (void *)TRUE); - TCHAR *ptszImageURL = db_get_tsa(pai->hContact, MODULE, "ImageURL"); + wchar_t *ptszImageURL = db_get_tsa(pai->hContact, MODULE, "ImageURL"); if(ptszImageURL == NULL) return GAIR_NOAVATAR; @@ -228,9 +228,9 @@ INT_PTR NewsAggrRecvMessage(WPARAM, LPARAM lParam) void UpdateMenu(bool State) { if (!State) // to enable auto-update - Menu_ModifyItem(hService2[0], LPGENT("Auto Update Enabled"), GetIconHandle("enabled")); + Menu_ModifyItem(hService2[0], LPGENW("Auto Update Enabled"), GetIconHandle("enabled")); else // to disable auto-update - Menu_ModifyItem(hService2[0], LPGENT("Auto Update Disabled"), GetIconHandle("disabled")); + Menu_ModifyItem(hService2[0], LPGENW("Auto Update Disabled"), GetIconHandle("disabled")); CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, State ? TTBST_PUSHED : 0); db_set_b(NULL, MODULE, "AutoUpdate", !State); diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index d79697cbc4..6a7558ba34 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -43,7 +43,7 @@ void NetlibUnInit() hNetlibUser = NULL; } -void GetNewsData(TCHAR *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg) +void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg) { Netlib_LogfT(hNetlibUser, L"Getting feed data %s.", tszUrl); NETLIBHTTPREQUEST nlhr = { 0 }; @@ -52,7 +52,7 @@ void GetNewsData(TCHAR *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg) nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT; - if (_tcsstr(tszUrl, L"https://") != NULL) + if (wcsstr(tszUrl, L"https://") != NULL) nlhr.flags |= NLHRF_SSL; char *szUrl = mir_t2a(tszUrl); nlhr.szUrl = szUrl; @@ -142,14 +142,14 @@ void UpdateList(HWND hwndList) UpdateListFlag = TRUE; lvI.mask = LVIF_TEXT; lvI.iSubItem = 0; - TCHAR *ptszNick = db_get_tsa(hContact, MODULE, "Nick"); + wchar_t *ptszNick = db_get_tsa(hContact, MODULE, "Nick"); if (ptszNick) { lvI.pszText = ptszNick; lvI.iItem = i; ListView_InsertItem(hwndList, &lvI); lvI.iSubItem = 1; - TCHAR *ptszURL = db_get_tsa(hContact, MODULE, "URL"); + wchar_t *ptszURL = db_get_tsa(hContact, MODULE, "URL"); if (ptszURL) { lvI.pszText = ptszURL; ListView_SetItem(hwndList, &lvI); @@ -168,35 +168,35 @@ void DeleteAllItems(HWND hwndList) ListView_DeleteAllItems(hwndList); } -time_t __stdcall DateToUnixTime(const TCHAR *stamp, bool FeedType) +time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType) { struct tm timestamp; - TCHAR date[9]; + wchar_t date[9]; int i, y; time_t t; if (stamp == NULL) return 0; - TCHAR *p = NEWTSTR_ALLOCA(stamp); + wchar_t *p = NEWWSTR_ALLOCA(stamp); if (FeedType) { // skip '-' chars int si = 0, sj = 0; while (true) { - if (p[si] == _T('-')) + if (p[si] == '-') si++; else if (!(p[sj++] = p[si++])) break; } } else { - TCHAR *weekday, monthstr[4], timezonesign[2]; + wchar_t *weekday, monthstr[4], timezonesign[2]; int day, month = 0, year, hour, min, sec, timezoneh, timezonem; - if (_tcsstr(p, L",")) { - weekday = _tcstok(p, L","); - p = _tcstok(NULL, L","); - _stscanf(p + 1, L"%d %3s %d %d:%d:%d %1s%02d%02d", &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); + if (wcsstr(p, L",")) { + weekday = wcstok(p, L","); + p = wcstok(NULL, L","); + swscanf(p + 1, L"%d %3s %d %d:%d:%d %1s%02d%02d", &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); if (!mir_tstrcmpi(monthstr, L"Jan")) month = 1; if (!mir_tstrcmpi(monthstr, L"Feb")) @@ -230,13 +230,13 @@ time_t __stdcall DateToUnixTime(const TCHAR *stamp, bool FeedType) else mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec); } - else if (_tcsstr(p, L"T")) { - _stscanf(p, L"%d-%d-%dT%d:%d:%d", &year, &month, &day, &hour, &min, &sec); + else if (wcsstr(p, L"T")) { + swscanf(p, L"%d-%d-%dT%d:%d:%d", &year, &month, &day, &hour, &min, &sec); mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour, min, sec); } else { - _stscanf(p, L"%d-%d-%d %d:%d:%d %1s%02d%02d", &year, &month, &day, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); + swscanf(p, L"%d-%d-%d %d:%d:%d %1s%02d%02d", &year, &month, &day, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); if (!mir_tstrcmp(timezonesign, L"+")) mir_sntprintf(p, 4 + 2 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1, L"%04d%02d%02dT%02d:%02d:%02d", year, month, day, hour - timezoneh, min - timezonem, sec); else if (!mir_tstrcmp(timezonesign, L"-")) @@ -273,7 +273,7 @@ time_t __stdcall DateToUnixTime(const TCHAR *stamp, bool FeedType) for (; *p != '\0' && !isdigit(*p); p++); // Parse time - if (_stscanf(p, L"%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3) + if (swscanf(p, L"%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3) return 0; timestamp.tm_isdst = 0; // DST is already present in _timezone below @@ -320,16 +320,16 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) } } if (date != NULL && size != NULL) { - TCHAR *tdate = mir_a2t(date); - TCHAR *tsize = mir_a2t(size); + wchar_t *tdate = mir_a2t(date); + wchar_t *tsize = mir_a2t(size); struct _stat buf; - int fh = _topen(tszLocal, _O_RDONLY); + int fh = _wopen(tszLocal, _O_RDONLY); if (fh != -1) { _fstat(fh, &buf); time_t modtime = DateToUnixTime(tdate, 0); time_t filemodtime = mktime(localtime(&buf.st_atime)); - if (modtime > filemodtime && buf.st_size != _ttoi(tsize)) { + if (modtime > filemodtime && buf.st_size != _wtoi(tsize)) { DWORD dwBytes; HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); WriteFile(hFile, pReply->pData, (DWORD)pReply->dataLength, &dwBytes, NULL); @@ -451,7 +451,7 @@ HRESULT TestDocumentText(IHTMLDocument3 *pHtmlDoc, BSTR &message) return hr; } -LPCTSTR ClearText(CMString &result, const TCHAR *message) +LPCTSTR ClearText(CMString &result, const wchar_t *message) { BSTR bstrHtml = SysAllocString(message), bstrRes = SysAllocString(L""); HRESULT hr = TestMarkupServices(bstrHtml, &TestDocumentText, bstrRes); @@ -465,7 +465,7 @@ LPCTSTR ClearText(CMString &result, const TCHAR *message) return result; } -MCONTACT GetContactByNick(const TCHAR *nick) +MCONTACT GetContactByNick(const wchar_t *nick) { MCONTACT hContact = NULL; @@ -477,7 +477,7 @@ MCONTACT GetContactByNick(const TCHAR *nick) return hContact; } -MCONTACT GetContactByURL(const TCHAR *url) +MCONTACT GetContactByURL(const wchar_t *url) { MCONTACT hContact = NULL; diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h index b4787929cb..6640bcb4ca 100644 --- a/plugins/NewsAggregator/Src/stdafx.h +++ b/plugins/NewsAggregator/Src/stdafx.h @@ -62,14 +62,14 @@ extern UINT_PTR timerId; // check if Feeds is currently updating extern bool ThreadRunning; extern bool UpdateListFlag; -extern TCHAR tszRoot[MAX_PATH]; +extern wchar_t tszRoot[MAX_PATH]; struct ItemInfo { HWND hwndList; MCONTACT hContact; int SelNumber; - TCHAR nick[MAX_PATH]; - TCHAR url[MAX_PATH]; + wchar_t nick[MAX_PATH]; + wchar_t url[MAX_PATH]; }; //============ STRUCT USED TO MAKE AN UPDATE LIST ============ @@ -125,24 +125,24 @@ void CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime void CALLBACK timerProc2(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); bool IsMyContact(MCONTACT hContact); -void GetNewsData(TCHAR *szUrl, char **szData, MCONTACT hContact, HWND hwndDlg); +void GetNewsData(wchar_t *szUrl, char **szData, MCONTACT hContact, HWND hwndDlg); void CreateList(HWND hwndList); void UpdateList(HWND hwndList); void DeleteAllItems(HWND hwndList); -time_t __stdcall DateToUnixTime(const TCHAR *stamp, bool FeedType); +time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType); void CheckCurrentFeed(MCONTACT hContact); void CheckCurrentFeedAvatar(MCONTACT hContact); -LPCTSTR CheckFeed(TCHAR* tszURL, HWND hwndDlg); +LPCTSTR CheckFeed(wchar_t* tszURL, HWND hwndDlg); void UpdateMenu(bool State); int ImportFeedsDialog(); -LPCTSTR ClearText(CMString &value, const TCHAR *message); +LPCTSTR ClearText(CMString &value, const wchar_t *message); bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal); void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg); INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -MCONTACT GetContactByNick(const TCHAR *nick); -MCONTACT GetContactByURL(const TCHAR *url); +MCONTACT GetContactByNick(const wchar_t *nick); +MCONTACT GetContactByURL(const wchar_t *url); // =============== NewsAggregator SERVICES ================ // Check all Feeds info -- cgit v1.2.3