From 05c989e58aeffcfb59cebaca6797cb69dd25cb1e Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sat, 16 Jun 2012 14:33:30 +0000 Subject: another portion of "#ifdef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TipperYM/message_pump.cpp | 5 +-- plugins/TipperYM/popwin.cpp | 10 ++--- plugins/TipperYM/str_utils.cpp | 78 +++++++++++---------------------------- plugins/TipperYM/subst.cpp | 8 ++-- plugins/TipperYM/tipper.cpp | 10 ++--- 5 files changed, 35 insertions(+), 76 deletions(-) (limited to 'plugins/TipperYM') diff --git a/plugins/TipperYM/message_pump.cpp b/plugins/TipperYM/message_pump.cpp index 0122d18cb8..4aab0f10b3 100644 --- a/plugins/TipperYM/message_pump.cpp +++ b/plugins/TipperYM/message_pump.cpp @@ -260,11 +260,8 @@ void InitMessagePump() MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags))GetProcAddress(hUserDll, "UpdateLayeredWindow"); MyAnimateWindow =(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll, "AnimateWindow"); MyMonitorFromPoint = (HMONITOR (WINAPI*)(POINT, DWORD))GetProcAddress(hUserDll, "MonitorFromPoint"); -#ifdef _UNICODE MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR, LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoW"); -#else - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR, LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoA"); -#endif + } HMODULE hDwmapiDll = LoadLibrary(_T("dwmapi.dll")); diff --git a/plugins/TipperYM/popwin.cpp b/plugins/TipperYM/popwin.cpp index c9f6d82464..964069ce2d 100644 --- a/plugins/TipperYM/popwin.cpp +++ b/plugins/TipperYM/popwin.cpp @@ -469,7 +469,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // fingerprint icon if (pwd->bIsIconVisible[5]) { -#ifdef _UNICODE + if (ServiceExists(MS_FP_GETCLIENTICONT)) { for (i = 0; opt.exIconsOrder[i] != 5; i++); @@ -481,7 +481,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } } else -#endif + if (ServiceExists(MS_FP_GETCLIENTICON)) { for (i = 0; opt.exIconsOrder[i] != 5; i++); @@ -1017,11 +1017,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } GlobalUnlock(hClipboardData); -#ifdef _UNICODE + SetClipboardData(CF_UNICODETEXT, hClipboardData); -#else - SetClipboardData(CF_TEXT, hClipboardData); -#endif + } CloseClipboard(); diff --git a/plugins/TipperYM/str_utils.cpp b/plugins/TipperYM/str_utils.cpp index 0e9b67f73f..112cc2678b 100644 --- a/plugins/TipperYM/str_utils.cpp +++ b/plugins/TipperYM/str_utils.cpp @@ -70,60 +70,46 @@ bool utf2a(const char *us, char *buff, int bufflen) bool t2w(const TCHAR *ts, wchar_t *buff, int bufflen) { -#ifdef _UNICODE + wcsncpy(buff, ts, bufflen); return true; -#else - return a2w(ts, buff, bufflen); -#endif + } bool w2t(const wchar_t *ws, TCHAR *buff, int bufflen) { -#ifdef _UNICODE + wcsncpy(buff, ws, bufflen); return true; -#else - return w2a(ws, buff, bufflen); -#endif + } bool t2a(const TCHAR *ts, char *buff, int bufflen) { -#ifdef _UNICODE + return w2a(ts, buff, bufflen); -#else - strncpy(buff, ts, bufflen); - return true; -#endif + } bool a2t(const char *as, TCHAR *buff, int bufflen) { -#ifdef _UNICODE + return a2w(as, buff, bufflen); -#else - strncpy(buff, as, bufflen); - return true; -#endif + } bool t2utf(const TCHAR *ts, char *buff, int bufflen) { -#ifdef _UNICODE + return w2utf(ts, buff, bufflen); -#else - return a2utf(ts, buff, bufflen); -#endif + } bool utf2t(const char *us, TCHAR *buff, int bufflen) { -#ifdef _UNICODE + return utf2w(us, buff, bufflen); -#else - return utf2a(us, buff, bufflen); -#endif + } wchar_t *utf2w(const char *us) @@ -190,63 +176,43 @@ char *a2utf(const char *as) TCHAR *w2t(const wchar_t *ws) { -#ifdef _UNICODE + return mir_wstrdup(ws); -#else - return w2a(ws); -#endif + } wchar_t *t2w(const TCHAR *ts) { -#ifdef _UNICODE + return mir_tstrdup(ts); -#else - return a2w(ts); -#endif + } char *t2a(const TCHAR *ts) { -#ifdef _UNICODE + return w2a(ts); -#else - return mir_strdup(ts); -#endif + } TCHAR *a2t(const char *as) { -#ifdef _UNICODE + return a2w(as); -#else - return mir_strdup(as); -#endif + } TCHAR *utf2t(const char *utfs) { -#ifdef _UNICODE + return utf2w(utfs); -#else - wchar_t *ws = utf2w(utfs); - char *ret = w2a(ws); - mir_free(ws); - return ret; -#endif } char *t2utf(const TCHAR *ts) { -#ifdef _UNICODE + return w2utf(ts); -#else - wchar_t *ws = a2w(ts); - char *ret = w2utf(ws); - mir_free(ws); - return ret; -#endif } TCHAR *myfgets(TCHAR *Buf, int MaxCount, FILE *File) diff --git a/plugins/TipperYM/subst.cpp b/plugins/TipperYM/subst.cpp index bc99aee44b..531af67200 100644 --- a/plugins/TipperYM/subst.cpp +++ b/plugins/TipperYM/subst.cpp @@ -61,12 +61,12 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons if (dbv.pszVal) utf2t(dbv.pszVal, buff, bufflen); buff[bufflen - 1] = 0; break; -#ifdef _UNICODE + case DBVT_WCHAR: if (dbv.pwszVal) wcsncpy(buff, dbv.pwszVal, bufflen); buff[bufflen - 1] = 0; break; -#endif + } DBFreeVariant(&dbv); @@ -847,7 +847,7 @@ TCHAR *GetProtoStatusMessage(char *szProto, WORD wStatus) { swzText = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, wStatus, 0); } -#ifdef _UNICODE + else if (swzText == NULL) { // try to use service without SGMA_TCHAR @@ -858,7 +858,7 @@ TCHAR *GetProtoStatusMessage(char *szProto, WORD wStatus) mir_free(tmpMsg); } } -#endif + if (swzText && !swzText[0]) { diff --git a/plugins/TipperYM/tipper.cpp b/plugins/TipperYM/tipper.cpp index 3844e66758..fde1fd7a39 100644 --- a/plugins/TipperYM/tipper.cpp +++ b/plugins/TipperYM/tipper.cpp @@ -274,11 +274,9 @@ void InitUpdaterSupport() update.szComponentName = pluginInfoEx.shortName; update.pbVersion = (BYTE *)CreateVersionString(pluginInfoEx.version, szVersion); update.cpbVersion = (int)strlen((char *)update.pbVersion); -#ifdef _UNICODE + update.szUpdateURL = "http://miranda-easy.net/addons/updater/tipper-ym.zip"; -#else - update.szUpdateURL = "http://miranda-easy.net/addons/updater/tipper-ym_ansi.zip"; -#endif + update.szVersionURL = "http://miranda-easy.net/addons/updater/tipper_version.txt"; update.pbVersionPrefix = (BYTE *)"Tipper YM "; update.cpbVersionPrefix = (int)strlen((char *)update.pbVersionPrefix); @@ -369,9 +367,9 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) // for compatibility with mToolTip status tooltips hShowTipService = CreateServiceFunction("mToolTip/ShowTip", ShowTip); -#ifdef _UNICODE + hShowTipWService = CreateServiceFunction("mToolTip/ShowTipW", ShowTipW); -#endif + hHideTipService = CreateServiceFunction("mToolTip/HideTip", HideTip); hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown); -- cgit v1.2.3