From 5975b2d0903bd5df128d55e20cd27d7c13b4e46c Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sat, 16 Jun 2012 17:42:08 +0000 Subject: another portion of "#ifdef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@448 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Twitter/Debug.c | 6 ++---- protocols/Twitter/StringConv.h | 11 ++--------- protocols/Twitter/main.cpp | 6 ++---- protocols/Twitter/twitter.h | 7 ++----- protocols/Twitter/utility.h | 12 ++++-------- 5 files changed, 12 insertions(+), 30 deletions(-) (limited to 'protocols/Twitter') diff --git a/protocols/Twitter/Debug.c b/protocols/Twitter/Debug.c index cfc5c7fd4f..947df7a536 100644 --- a/protocols/Twitter/Debug.c +++ b/protocols/Twitter/Debug.c @@ -97,13 +97,11 @@ void _TRACE(LPCSTR fmt, ...) TCHAR buf[DEBUG_TRACE_BUF_SIZE + 3] = _T(""); va_list va; -#ifndef UNICODE - char* tfmt = fmt; -#else + wchar_t tfmt[DEBUG_TRACE_FMT_SIZE]; size_t tmp = 0; mbstowcs_s(&tmp, tfmt, SIZEOF(tfmt), fmt, _TRUNCATE); -#endif + va_start(va, fmt); len = _vsntprintf_s(buf, SIZEOF(buf), _TRUNCATE, tfmt, va); diff --git a/protocols/Twitter/StringConv.h b/protocols/Twitter/StringConv.h index c5266f574d..ec25c15ef7 100644 --- a/protocols/Twitter/StringConv.h +++ b/protocols/Twitter/StringConv.h @@ -39,20 +39,13 @@ inline std::wstring UTF8ToWide(const std::string& str) { return MBToWide(str, C inline std::string ANSIToUTF8(const std::string& str, UINT codePage = CP_ACP) { return WideToUTF8(MBToWide(str, codePage)); } inline std::string UTF8ToANSI(const std::string& str, UINT codePage = CP_ACP) { return WideToMB(UTF8ToWide(str), codePage); } -#ifdef _UNICODE + #define TCHARToUTF8 WideToUTF8 #define UTF8ToTCHAR UTF8ToWide #define TCHARToWide #define WideToTCHAR #define TCHARToMB WideToMB #define MBToTCHAR MBToWide -#else -#define TCHARToUTF8 ANSIToUTF8 -#define UTF8ToTCHAR UTF8ToANSI -#define TCHARToWide MBToWide -#define WideToTCHAR WideToMB -#define TCHARToMB -#define MBToTCHAR -#endif + #endif // StringConv_h__ diff --git a/protocols/Twitter/main.cpp b/protocols/Twitter/main.cpp index 077b54a0fa..42ffac5220 100644 --- a/protocols/Twitter/main.cpp +++ b/protocols/Twitter/main.cpp @@ -109,11 +109,9 @@ int OnModulesLoaded(WPARAM,LPARAM) upd.szBetaChangelogURL = "http://twosx.net/mim/twitter/updater/changelog.html"; upd.pbBetaVersionPrefix = reinterpret_cast("Twitter "); upd.cpbBetaVersionPrefix = (int)strlen(reinterpret_cast(upd.pbBetaVersionPrefix)); -#ifdef UNICODE + upd.szBetaUpdateURL = "http://twosx.net/mim/twitter/updater/twitter.zip"; -#else - upd.szBetaUpdateURL = "http://www.teamboxel.com/update/twitter/ansi"; -#endif + upd.pbVersion = reinterpret_cast( CreateVersionStringPlugin( reinterpret_cast(&pluginInfo),curr_version) ); diff --git a/protocols/Twitter/twitter.h b/protocols/Twitter/twitter.h index d26c06bdbd..54baa768f7 100644 --- a/protocols/Twitter/twitter.h +++ b/protocols/Twitter/twitter.h @@ -30,11 +30,8 @@ using std::vector; #include "StringConv.h" #include "stdafx.h" -#if defined( _UNICODE ) - #define tstring wstring -#else - #define tstring string -#endif +#define tstring wstring + typedef unsigned long long twitter_id; typedef std::map OAuthParameters; diff --git a/protocols/Twitter/utility.h b/protocols/Twitter/utility.h index c827a6d1ec..cc60ee15c4 100644 --- a/protocols/Twitter/utility.h +++ b/protocols/Twitter/utility.h @@ -120,20 +120,16 @@ protected: inline void mbcs_to_tcs(UINT code_page,const char *mbstr,TCHAR *tstr,int tlen) { -#ifdef UNICODE + MultiByteToWideChar(code_page,0,mbstr,-1,tstr,tlen); -#else - strncpy(tstr,mbstr,tlen); -#endif + } inline void wcs_to_tcs(UINT code_page,const wchar_t *wstr,TCHAR *tstr,int tlen) { -#ifdef UNICODE + wcsncpy(tstr,wstr,tlen); -#else - WideCharToMultiByte(code_page,0,wstr,-1,tstr,tlen,0,0); -#endif + } class ScopedLock -- cgit v1.2.3