diff options
Diffstat (limited to 'protocols/Twitter/src')
-rw-r--r-- | protocols/Twitter/src/StringUtil.cpp | 6 | ||||
-rw-r--r-- | protocols/Twitter/src/StringUtil.h | 6 | ||||
-rw-r--r-- | protocols/Twitter/src/chat.cpp | 12 | ||||
-rw-r--r-- | protocols/Twitter/src/connection.cpp | 6 | ||||
-rw-r--r-- | protocols/Twitter/src/contacts.cpp | 20 | ||||
-rw-r--r-- | protocols/Twitter/src/main.cpp | 2 | ||||
-rw-r--r-- | protocols/Twitter/src/oauth.cpp | 2 | ||||
-rw-r--r-- | protocols/Twitter/src/proto.cpp | 24 | ||||
-rw-r--r-- | protocols/Twitter/src/proto.h | 8 | ||||
-rw-r--r-- | protocols/Twitter/src/stdafx.h | 3 | ||||
-rw-r--r-- | protocols/Twitter/src/theme.cpp | 4 | ||||
-rw-r--r-- | protocols/Twitter/src/twitter.h | 2 | ||||
-rw-r--r-- | protocols/Twitter/src/ui.cpp | 16 | ||||
-rw-r--r-- | protocols/Twitter/src/utility.cpp | 8 | ||||
-rw-r--r-- | protocols/Twitter/src/utility.h | 4 |
15 files changed, 61 insertions, 62 deletions
diff --git a/protocols/Twitter/src/StringUtil.cpp b/protocols/Twitter/src/StringUtil.cpp index d9b7123216..a902495c20 100644 --- a/protocols/Twitter/src/StringUtil.cpp +++ b/protocols/Twitter/src/StringUtil.cpp @@ -24,7 +24,7 @@ THE SOFTWARE. #include "stdafx.h"
-void Split(const tstring& str, std::vector<tstring>& out, TCHAR sep, bool includeEmpty)
+void Split(const wstring& str, std::vector<wstring>& out, wchar_t sep, bool includeEmpty)
{
unsigned start = 0;
unsigned end = 0;
@@ -44,7 +44,7 @@ void Split(const tstring& str, std::vector<tstring>& out, TCHAR sep, bool includ }
}
-tstring GetWord(const tstring& str, unsigned index, bool getRest)
+wstring GetWord(const wstring& str, unsigned index, bool getRest)
{
unsigned start = 0;
unsigned end = 0;
@@ -52,7 +52,7 @@ tstring GetWord(const tstring& str, unsigned index, bool getRest) unsigned count = 0;
while (true) {
- if (end == str.size() || str[end] == _T(' ')) {
+ if (end == str.size() || str[end] == ' ') {
if (end > start) {
if (count == index) {
if (getRest)
diff --git a/protocols/Twitter/src/StringUtil.h b/protocols/Twitter/src/StringUtil.h index 0fe42aedce..f1ebdb55e1 100644 --- a/protocols/Twitter/src/StringUtil.h +++ b/protocols/Twitter/src/StringUtil.h @@ -25,8 +25,8 @@ THE SOFTWARE. #ifndef _STRINGUTIL_H_INCLUDED_
#define _STRINGUTIL_H_INCLUDED_
-void Split(const tstring& str, std::vector<tstring>& out, TCHAR sep, bool includeEmpty);
-tstring GetWord(const tstring& str, unsigned index, bool getRest = false);
+void Split(const wstring& str, std::vector<wstring>& out, wchar_t sep, bool includeEmpty);
+wstring GetWord(const wstring& str, unsigned index, bool getRest = false);
std::string& replaceAll(std::string& context, const std::string& from, const std::string& to);
@@ -42,7 +42,7 @@ inline std::wstring UTF8ToWide(const std::string& str) return (wchar_t*)ptrW(mir_utf8decodeW(str.c_str()));
}
-inline bool Compare(const tstring& one, const tstring& two, bool caseSensitive)
+inline bool Compare(const wstring& one, const wstring& two, bool caseSensitive)
{
return caseSensitive ? (one == two) : (mir_tstrcmpi(one.c_str(), two.c_str()) == 0);
}
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 13d438c185..940d34eee5 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -51,9 +51,9 @@ void TwitterProto::UpdateChat(const twitter_user &update) CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
- mir_free(const_cast<TCHAR*>(gce.ptszNick));
- mir_free(const_cast<TCHAR*>(gce.ptszUID));
- mir_free(const_cast<TCHAR*>(gce.ptszText));
+ mir_free(const_cast<wchar_t*>(gce.ptszNick));
+ mir_free(const_cast<wchar_t*>(gce.ptszUID));
+ mir_free(const_cast<wchar_t*>(gce.ptszText));
}
int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam)
@@ -98,8 +98,8 @@ void TwitterProto::AddChatContact(const char *name, const char *nick) gce.ptszStatus = L"Normal";
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
- mir_free(const_cast<TCHAR*>(gce.ptszNick));
- mir_free(const_cast<TCHAR*>(gce.ptszUID));
+ mir_free(const_cast<wchar_t*>(gce.ptszNick));
+ mir_free(const_cast<wchar_t*>(gce.ptszUID));
}
void TwitterProto::DeleteChatContact(const char *name)
@@ -111,7 +111,7 @@ void TwitterProto::DeleteChatContact(const char *name) gce.ptszUID = gce.ptszNick;
CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
- mir_free(const_cast<TCHAR*>(gce.ptszNick));
+ mir_free(const_cast<wchar_t*>(gce.ptszNick));
}
INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 87c5e25aaa..bad7284cbf 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -400,7 +400,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return;
std::string ext = data->url.substr(data->url.rfind('.')); // finds the filetype of the avatar
- std::tstring filename = GetAvatarFolder() + _T('\\') + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str()); // local filename and path
+ std::wstring filename = GetAvatarFolder() + L'\\' + dbv.ptszVal + (wchar_t*)_A2T(ext.c_str()); // local filename and path
db_free(&dbv);
PROTO_AVATAR_INFORMATION ai = { 0 };
@@ -412,7 +412,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return; // lets just ignore unknown formats... if not it crashes miranda. should probably speak to borkra about this.
}
- _tcsncpy(ai.filename, filename.c_str(), MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now)
+ wcsncpy(ai.filename, filename.c_str(), MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now)
debugLogA("***** Updating avatar: %s", data->url.c_str());
mir_cslock lck(avatar_lock_);
@@ -536,7 +536,7 @@ void TwitterProto::ShowContactPopup(MCONTACT hContact, const std::string &text, DBVARIANT dbv;
if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !getTString(hContact, TWITTER_KEY_UN, &dbv)) {
- _tcsncpy(popup.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME);
+ wcsncpy(popup.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME);
db_free(&dbv);
}
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index e6c2321d29..880ba6974a 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -49,8 +49,8 @@ MCONTACT TwitterProto::AddToList(int, PROTOSEARCHRESULT *psr) if (m_iStatus != ID_STATUS_ONLINE)
return 0;
- ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.t));
- return AddToClientList(_T2A(psr->nick.t), "");
+ ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.w));
+ return AddToClientList(_T2A(psr->nick.w), "");
}
// *************************
@@ -93,10 +93,10 @@ int TwitterProto::GetInfo(MCONTACT hContact, int info_type) struct search_query
{
- search_query(const std::tstring &_query, bool _by_email) : query(_query), by_email(_by_email)
+ search_query(const std::wstring &_query, bool _by_email) : query(_query), by_email(_by_email)
{
}
- std::tstring query;
+ std::wstring query;
bool by_email;
};
@@ -127,27 +127,27 @@ void TwitterProto::DoSearch(void *pArg) if (found) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = mir_a2t(info.username.c_str());
- psr.firstName.t = mir_a2t(info.real_name.c_str());
+ psr.nick.w = mir_a2t(info.username.c_str());
+ psr.firstName.w = mir_a2t(info.real_name.c_str());
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
- mir_free(psr.nick.t);
- mir_free(psr.firstName.t);
+ mir_free(psr.nick.w);
+ mir_free(psr.firstName.w);
}
else ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
delete query;
}
-HANDLE TwitterProto::SearchBasic(const TCHAR *username)
+HANDLE TwitterProto::SearchBasic(const wchar_t *username)
{
ForkThread(&TwitterProto::DoSearch, new search_query(username, false));
return (HANDLE)1;
}
-HANDLE TwitterProto::SearchByEmail(const TCHAR *email)
+HANDLE TwitterProto::SearchByEmail(const wchar_t *email)
{
ForkThread(&TwitterProto::DoSearch, new search_query(email, true));
return (HANDLE)1;
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index 2995269fcd..ccc9b20db5 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -70,7 +70,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC /////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const TCHAR *username)
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
{
TwitterProto *proto = new TwitterProto(proto_name, username);
g_Instances.insert(proto);
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp index 2bd69b9837..b87e008bcb 100644 --- a/protocols/Twitter/src/oauth.cpp +++ b/protocols/Twitter/src/oauth.cpp @@ -396,5 +396,5 @@ wstring mir_twitter::OAuthCreateSignature(const wstring& signatureBase, const ws string data = WideToUTF8(signatureBase);
mir_hmac_sha1(digest, (PBYTE)keyBytes.c_str(), keyBytes.size(), (PBYTE)data.c_str(), data.size());
ptrA encoded(mir_base64_encode(digest, sizeof(digest)));
- return UrlEncode((TCHAR*)_A2T(encoded));
+ return UrlEncode((wchar_t*)_A2T(encoded));
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index ffa2245609..5b58154808 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static volatile LONG g_msgid = 1;
-TwitterProto::TwitterProto(const char *proto_name, const TCHAR *username) :
+TwitterProto::TwitterProto(const char *proto_name, const wchar_t *username) :
PROTO<TwitterProto>(proto_name, username)
{
CreateProtoService(PS_CREATEACCMGRUI, &TwitterProto::SvcCreateAccMgrUI);
@@ -264,7 +264,7 @@ int TwitterProto::OnBuildStatusMenu(WPARAM, LPARAM) // "Send Tweet..."
mi.pszService = "/Tweet";
CreateProtoService(mi.pszService, &TwitterProto::OnTweet);
- mi.name.t = LPGENT("Send Tweet...");
+ mi.name.w = LPGENW("Send Tweet...");
mi.position = 200001;
mi.hIcolibItem = GetIconHandle("tweet");
Menu_AddStatusMenuItem(&mi, m_szModuleName);
@@ -276,18 +276,18 @@ int TwitterProto::OnOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 271828;
odp.hInstance = g_hInstance;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTitle = m_tszUserName;
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.ptszTab = LPGENT("Basic");
+ odp.pwszTab = LPGENW("Basic");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = options_proc;
Options_AddPage(wParam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
- odp.ptszTab = LPGENT("Popups");
+ odp.pwszTab = LPGENW("Popups");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
odp.pfnDlgProc = popup_options_proc;
Options_AddPage(wParam, &odp);
@@ -307,7 +307,7 @@ INT_PTR TwitterProto::OnTweet(WPARAM, LPARAM) int TwitterProto::OnModulesLoaded(WPARAM, LPARAM)
{
- TCHAR descr[512];
+ wchar_t descr[512];
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
@@ -317,7 +317,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
- TCHAR error[200];
+ wchar_t error[200];
mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -330,7 +330,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) nlu.ptszDescriptiveName = descr;
hAvatarNetlib_ = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (hAvatarNetlib_ == NULL) {
- TCHAR error[200];
+ wchar_t error[200];
mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)"));
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -421,7 +421,7 @@ void TwitterProto::SendTweetWorker(void *p) char *text = static_cast<char*>(p);
if (mir_strlen(mir_utf8decodeA(text)) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here.
- TCHAR errorPopup[280];
+ wchar_t errorPopup[280];
mir_sntprintf(errorPopup, TranslateT("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
ShowPopup(errorPopup, 1);
return;
@@ -452,9 +452,9 @@ void TwitterProto::UpdateSettings() }
}
-std::tstring TwitterProto::GetAvatarFolder()
+std::wstring TwitterProto::GetAvatarFolder()
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index 4ef55b48cf..9aaa196240 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class TwitterProto : public PROTO<TwitterProto>
{
public:
- TwitterProto(const char*,const TCHAR*);
+ TwitterProto(const char*,const wchar_t*);
~TwitterProto();
//PROTO_INTERFACE
@@ -33,8 +33,8 @@ public: virtual DWORD_PTR __cdecl GetCaps(int, MCONTACT = 0);
virtual int __cdecl GetInfo(MCONTACT, int);
- virtual HANDLE __cdecl SearchBasic(const TCHAR *);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR *);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t *);
virtual int __cdecl RecvMsg(MCONTACT, PROTORECVEVENT *);
virtual int __cdecl SendMsg(MCONTACT, int, const char *);
@@ -108,7 +108,7 @@ private: void TwitterProto::resetOAuthKeys();
- std::tstring GetAvatarFolder();
+ std::wstring GetAvatarFolder();
mir_cs signon_lock_;
mir_cs avatar_lock_;
diff --git a/protocols/Twitter/src/stdafx.h b/protocols/Twitter/src/stdafx.h index d8b3ba5274..bd46045ca8 100644 --- a/protocols/Twitter/src/stdafx.h +++ b/protocols/Twitter/src/stdafx.h @@ -10,7 +10,6 @@ #include <Wincrypt.h>
#include <stdio.h>
#include <direct.h>
-#include <tchar.h>
#include <time.h>
#include <cstdio>
@@ -29,7 +28,7 @@ using std::list; using std::min;
#include <sstream>
-typedef std::basic_string<TCHAR> tstring;
+typedef std::basic_string<wchar_t> wstring;
#include "resource.h"
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index db2f27dcf7..4f0f988d02 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -95,7 +95,7 @@ void InitContactMenus() SET_UID(mi, 0xfc4e1245, 0xc8e0, 0x4de2, 0x92, 0x15, 0xfc, 0xcf, 0x48, 0xf9, 0x41, 0x56);
mi.position = -2000006000;
mi.hIcolibItem = GetIconHandle("reply");
- mi.name.t = LPGENT("Reply...");
+ mi.name.w = LPGENW("Reply...");
mi.pszService = "Twitter/ReplyToTweet";
g_hMenuItems[0] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&TwitterProto::ReplyToTweet>);
@@ -103,7 +103,7 @@ void InitContactMenus() SET_UID(mi, 0x7f7e4c24, 0x821c, 0x450f, 0x93, 0x76, 0xbe, 0x65, 0xe9, 0x2f, 0xb6, 0xc2);
mi.position = -2000006000;
mi.hIcolibItem = GetIconHandle("homepage");
- mi.name.t = LPGENT("Visit Homepage");
+ mi.name.w = LPGENW("Visit Homepage");
mi.pszService = "Twitter/VisitHomepage";
g_hMenuItems[1] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&TwitterProto::VisitHomepage>);
diff --git a/protocols/Twitter/src/twitter.h b/protocols/Twitter/src/twitter.h index 5558ad376a..d332050108 100644 --- a/protocols/Twitter/src/twitter.h +++ b/protocols/Twitter/src/twitter.h @@ -25,7 +25,7 @@ using std::vector; #include "http.h"
-#define tstring wstring
+#define wstring wstring
typedef unsigned long long twitter_id;
typedef std::map<std::wstring, std::wstring> OAuthParameters;
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index f82017d613..b6e067dab7 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "proto.h"
#include "twitter.h"
-static const TCHAR *sites[] = {
+static const wchar_t *sites[] = {
L"https://api.twitter.com/",
L"https://identi.ca/api/"
};
@@ -80,7 +80,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY) {
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- TCHAR tstr[128];
+ wchar_t tstr[128];
GetDlgItemTextA(hwndDlg, IDC_SERVER, str, _countof(str) - 1);
if (str[mir_strlen(str) - 1] != '/')
@@ -112,14 +112,14 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SetDlgItemText(hwndDlg, IDC_CHARACTERS, L"140");
// Set window title
- TCHAR title[512];
+ wchar_t title[512];
mir_sntprintf(title, L"Send Tweet for %s", proto->m_tszUserName);
SetWindowText(hwndDlg, title);
return true;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK) {
- TCHAR msg[141];
+ wchar_t msg[141];
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, _countof(msg));
@@ -295,8 +295,8 @@ namespace popup_options struct
{
- TCHAR *name;
- TCHAR *text;
+ wchar_t *name;
+ wchar_t *text;
} const quotes[] = {
{
L"Dorothy Parker", L"If, with the literate, I am\n"
@@ -329,8 +329,8 @@ namespace popup_options // Pick a random quote
int q = rand() % _countof(quotes);
- _tcsncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME);
- _tcsncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE);
+ wcsncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME);
+ wcsncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE);
popup.lchContact = hContact;
popup.iSeconds = get_timeout(hwndDlg);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index e8056e02a8..565ef3622b 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -130,7 +130,7 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu return resp_data;
}
-bool save_url(HANDLE hNetlib, const std::string &url, const std::tstring &filename)
+bool save_url(HANDLE hNetlib, const std::string &url, const std::wstring &filename)
{
NETLIBHTTPREQUEST req = { sizeof(req) };
req.requestType = REQUEST_GET;
@@ -144,12 +144,12 @@ bool save_url(HANDLE hNetlib, const std::string &url, const std::tstring &filena bool success = (resp->resultCode == 200);
if (success) {
// Create folder if necessary
- std::tstring dir = filename.substr(0, filename.rfind('\\'));
- if (_taccess(dir.c_str(), 0))
+ std::wstring dir = filename.substr(0, filename.rfind('\\'));
+ if (_waccess(dir.c_str(), 0))
CreateDirectoryTreeT(dir.c_str());
// Write to file
- FILE *f = _tfopen(filename.c_str(), L"wb");
+ FILE *f = _wfopen(filename.c_str(), L"wb");
fwrite(resp->pData, 1, resp->dataLength, f);
fclose(f);
}
diff --git a/protocols/Twitter/src/utility.h b/protocols/Twitter/src/utility.h index a7f4f968cd..d5115a1bad 100644 --- a/protocols/Twitter/src/utility.h +++ b/protocols/Twitter/src/utility.h @@ -90,9 +90,9 @@ protected: PROTO_INTERFACE *ppro_;
};
-inline void mbcs_to_tcs(UINT code_page, const char *mbstr, TCHAR *tstr, int tlen)
+inline void mbcs_to_tcs(UINT code_page, const char *mbstr, wchar_t *tstr, int tlen)
{
MultiByteToWideChar(code_page, 0, mbstr, -1, tstr, tlen);
}
-bool save_url(HANDLE hNetlib,const std::string &url,const std::tstring &filename);
\ No newline at end of file +bool save_url(HANDLE hNetlib,const std::string &url,const std::wstring &filename);
|