summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
commit6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch)
tree2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/SmileyAdd/src
parenta61c8728b379057fe7f0a0d86fe0b037598229dd (diff)
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
Diffstat (limited to 'plugins/SmileyAdd/src')
-rw-r--r--plugins/SmileyAdd/src/SmileyBase.cpp8
-rw-r--r--plugins/SmileyAdd/src/SmileyBase.h6
-rw-r--r--plugins/SmileyAdd/src/customsmiley.cpp22
-rw-r--r--plugins/SmileyAdd/src/customsmiley.h10
-rw-r--r--plugins/SmileyAdd/src/download.cpp10
-rw-r--r--plugins/SmileyAdd/src/general.cpp22
-rw-r--r--plugins/SmileyAdd/src/imagecache.cpp2
-rw-r--r--plugins/SmileyAdd/src/options.cpp12
-rw-r--r--plugins/SmileyAdd/src/richcall.cpp2
-rw-r--r--plugins/SmileyAdd/src/services.cpp6
-rw-r--r--plugins/SmileyAdd/src/smileyroutines.cpp26
-rw-r--r--plugins/SmileyAdd/src/smileyroutines.h4
-rw-r--r--plugins/SmileyAdd/src/smileys.cpp46
-rw-r--r--plugins/SmileyAdd/src/smileys.h4
-rw-r--r--plugins/SmileyAdd/src/smltool.cpp2
-rw-r--r--plugins/SmileyAdd/src/stdafx.h6
16 files changed, 95 insertions, 93 deletions
diff --git a/plugins/SmileyAdd/src/SmileyBase.cpp b/plugins/SmileyAdd/src/SmileyBase.cpp
index 8d9a58b94f..583396fbe7 100644
--- a/plugins/SmileyAdd/src/SmileyBase.cpp
+++ b/plugins/SmileyAdd/src/SmileyBase.cpp
@@ -91,7 +91,7 @@ void ISmileyBase::SendOnViewChange(void)
}
}
-bool ISmileyBase::QueryHitPointSpecial(int x, int y, HWND hwnd, TCHAR **smltxt)
+bool ISmileyBase::QueryHitPointSpecial(int x, int y, HWND hwnd, wchar_t **smltxt)
{
bool result = m_visible && m_hwnd == hwnd;
if (result)
@@ -101,9 +101,9 @@ bool ISmileyBase::QueryHitPointSpecial(int x, int y, HWND hwnd, TCHAR **smltxt)
return result;
}
-void ISmileyBase::SetHint(TCHAR *smltxt)
+void ISmileyBase::SetHint(wchar_t *smltxt)
{
- m_smltxt = _tcsdup(smltxt);
+ m_smltxt = wcsdup(smltxt);
}
@@ -374,7 +374,7 @@ void CloseSmileys(void)
}
}
-int CheckForTip(int x, int y, HWND hwnd, TCHAR **smltxt)
+int CheckForTip(int x, int y, HWND hwnd, wchar_t **smltxt)
{
for (int i = 0; i < regSmileys.getCount(); i++)
if (regSmileys[i]->QueryHitPointSpecial(x, y, hwnd, smltxt))
diff --git a/plugins/SmileyAdd/src/SmileyBase.h b/plugins/SmileyAdd/src/SmileyBase.h
index 10378a52b3..499e960510 100644
--- a/plugins/SmileyAdd/src/SmileyBase.h
+++ b/plugins/SmileyAdd/src/SmileyBase.h
@@ -39,7 +39,7 @@ class ISmileyBase : public IOleObject, public IViewObject2, public ITooltipData
DWORD m_advf;
LONG m_lRefCount;
- TCHAR* m_smltxt;
+ wchar_t* m_smltxt;
protected:
SIZEL m_sizeExtent;
@@ -56,8 +56,8 @@ public:
virtual void OnClose(void);
void SendOnViewChange(void);
- bool QueryHitPointSpecial(int x, int y, HWND hwnd, TCHAR **smltxt);
- void SetHint(TCHAR *smltxt);
+ bool QueryHitPointSpecial(int x, int y, HWND hwnd, wchar_t **smltxt);
+ void SetHint(wchar_t *smltxt);
virtual void Draw() PURE;
virtual void SetPosition(HWND hwnd, LPCRECT lpRect);
diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp
index 97480911f6..a61a014e9c 100644
--- a/plugins/SmileyAdd/src/customsmiley.cpp
+++ b/plugins/SmileyAdd/src/customsmiley.cpp
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
SmileyPackCListType g_SmileyPackCStore;
-bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, TCHAR *dir)
+bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, wchar_t *dir)
{
bool res = true;
if (GetSmileyPack(hContact) == NULL) {
@@ -36,7 +36,7 @@ bool SmileyPackCListType::AddSmileyPack(MCONTACT hContact, TCHAR *dir)
return res;
}
-bool SmileyPackCListType::AddSmiley(MCONTACT hContact, TCHAR *path)
+bool SmileyPackCListType::AddSmiley(MCONTACT hContact, wchar_t *path)
{
SmileyPackCType *smpack = GetSmileyPack(hContact);
if (smpack == NULL) {
@@ -59,7 +59,7 @@ SmileyPackCType* SmileyPackCListType::GetSmileyPack(MCONTACT id)
}
-SmileyCType::SmileyCType(const CMString &fullpath, const TCHAR *filepath)
+SmileyCType::SmileyCType(const CMString &fullpath, const wchar_t *filepath)
{
LoadFromResource(fullpath, 0);
CreateTriggerText(_T2A(filepath));
@@ -78,7 +78,7 @@ bool SmileyCType::CreateTriggerText(char *text)
return false;
char save = res[reslen]; res[reslen] = 0; // safe because of mir_alloc
- TCHAR *txt = mir_utf8decodeT(res);
+ wchar_t *txt = mir_utf8decodeT(res);
res[reslen] = save;
if (txt == NULL)
@@ -93,19 +93,19 @@ bool SmileyCType::CreateTriggerText(char *text)
// SmileyPackCType
//
-bool SmileyPackCType::LoadSmileyDir(TCHAR *dir)
+bool SmileyPackCType::LoadSmileyDir(wchar_t *dir)
{
CMString dirs = dir;
dirs += L"\\*.*";
- _tfinddata_t c_file;
- INT_PTR hFile = _tfindfirst((TCHAR*)dirs.c_str(), &c_file);
+ _wfinddata_t c_file;
+ INT_PTR hFile = _wfindfirst((wchar_t*)dirs.c_str(), &c_file);
if (hFile > -1L) {
do {
if (c_file.name[0] != '.') {
CMString fullpath = dir;
fullpath = fullpath + L"\\" + c_file.name;
- TCHAR *div = _tcsrchr(c_file.name, '.');
+ wchar_t *div = wcsrchr(c_file.name, '.');
if (div) {
*div = 0;
SmileyCType *smlc = new SmileyCType(fullpath, c_file.name);
@@ -115,7 +115,7 @@ bool SmileyPackCType::LoadSmileyDir(TCHAR *dir)
m_SmileyList.insert(smlc);
}
}
- } while (_tfindnext(hFile, &c_file) == 0);
+ } while (_wfindnext(hFile, &c_file) == 0);
_findclose(hFile);
AddTriggersToSmileyLookup();
return true;
@@ -123,7 +123,7 @@ bool SmileyPackCType::LoadSmileyDir(TCHAR *dir)
return false;
}
-bool SmileyPackCType::LoadSmiley(TCHAR *path)
+bool SmileyPackCType::LoadSmiley(wchar_t *path)
{
CMString dirs = path;
int slash = dirs.ReverseFind('\\');
@@ -137,7 +137,7 @@ bool SmileyPackCType::LoadSmiley(TCHAR *path)
return true;
}
- m_SmileyList.insert(new SmileyCType(dirs, (TCHAR*)name.c_str()));
+ m_SmileyList.insert(new SmileyCType(dirs, (wchar_t*)name.c_str()));
CMString empty;
m_SmileyLookup.insert(new SmileyLookup(
diff --git a/plugins/SmileyAdd/src/customsmiley.h b/plugins/SmileyAdd/src/customsmiley.h
index 3517d348cd..b1366e83bc 100644
--- a/plugins/SmileyAdd/src/customsmiley.h
+++ b/plugins/SmileyAdd/src/customsmiley.h
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class SmileyCType : public SmileyType
{
public:
- SmileyCType(const CMString &fullpath, const TCHAR *filepath);
+ SmileyCType(const CMString &fullpath, const wchar_t *filepath);
bool CreateTriggerText(char *text);
};
@@ -52,8 +52,8 @@ public:
MCONTACT GetId(void) { return m_id; }
void SetId(MCONTACT id) { m_id = id; }
- bool LoadSmiley(TCHAR *path);
- bool LoadSmileyDir(TCHAR *dir);
+ bool LoadSmiley(wchar_t *path);
+ bool LoadSmileyDir(wchar_t *dir);
};
@@ -68,8 +68,8 @@ private:
public:
int NumberOfSmileyPacks(void) { return m_SmileyPacks.getCount(); }
- bool AddSmiley(MCONTACT hContact, TCHAR *path);
- bool AddSmileyPack(MCONTACT hContact, TCHAR *dir);
+ bool AddSmiley(MCONTACT hContact, wchar_t *path);
+ bool AddSmileyPack(MCONTACT hContact, wchar_t *dir);
void ClearAndFreeAll(void) { m_SmileyPacks.destroy(); }
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp
index b015c34603..2f45d51950 100644
--- a/plugins/SmileyAdd/src/download.cpp
+++ b/plugins/SmileyAdd/src/download.cpp
@@ -36,7 +36,7 @@ struct QueueElem
static HANDLE g_hDlMutex;
static OBJLIST<QueueElem> dlQueue(10);
-static TCHAR cachepath[MAX_PATH];
+static wchar_t cachepath[MAX_PATH];
static bool threadRunning;
bool InternetDownloadFile(const char *szUrl, char *szDest, HANDLE &hHttpDwnl)
@@ -131,13 +131,13 @@ void __cdecl SmileyDownloadThread(void*)
WaitForSingleObject(g_hDlMutex, 3000);
while (!Miranda_Terminated() && dlQueue.getCount()) {
ReleaseMutex(g_hDlMutex);
- if (_taccess(dlQueue[0].fname.c_str(), 0) != 0) {
+ if (_waccess(dlQueue[0].fname.c_str(), 0) != 0) {
InternetDownloadFile(_T2A(dlQueue[0].url.c_str()), _T2A(dlQueue[0].fname.c_str()), hHttpDwnl);
WaitForSingleObject(g_hDlMutex, 3000);
CMString fname(dlQueue[0].fname);
if (dlQueue[0].needext) { fname += GetImageExt(fname); needext = true; }
- _trename(dlQueue[0].fname.c_str(), fname.c_str());
+ _wrename(dlQueue[0].fname.c_str(), fname.c_str());
}
else WaitForSingleObject(g_hDlMutex, 3000);
@@ -175,8 +175,8 @@ bool GetSmileyFile(CMString &url, const CMString &packstr)
if (needext)
filename += L".*";
- _tfinddata_t c_file;
- INT_PTR hFile = _tfindfirst((TCHAR*)filename.c_str(), &c_file);
+ _wfinddata_t c_file;
+ INT_PTR hFile = _wfindfirst((wchar_t*)filename.c_str(), &c_file);
if (hFile > -1) {
_findclose(hFile);
filename.Truncate(pathpos);
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp
index 5a6b94ca63..0a27734c92 100644
--- a/plugins/SmileyAdd/src/general.cpp
+++ b/plugins/SmileyAdd/src/general.cpp
@@ -59,11 +59,11 @@ HICON GetDefaultIcon(bool copy)
return resIco;
}
-const TCHAR* GetImageExt(CMString &fname)
+const wchar_t* GetImageExt(CMString &fname)
{
- const TCHAR *ext = L"";
+ const wchar_t *ext = L"";
- int fileId = _topen(fname.c_str(), O_RDONLY | _O_BINARY);
+ int fileId = _wopen(fname.c_str(), O_RDONLY | _O_BINARY);
if (fileId != -1) {
BYTE buf[6];
@@ -126,18 +126,18 @@ HICON ImageList_GetIconFixed(HIMAGELIST himl, INT i, UINT fStyle)
void pathToRelative(const CMString &pSrc, CMString &pOut)
{
- TCHAR szOutPath[MAX_PATH];
+ wchar_t szOutPath[MAX_PATH];
PathToRelativeT(pSrc.c_str(), szOutPath);
pOut = szOutPath;
}
void pathToAbsolute(const CMString &pSrc, CMString &pOut)
{
- TCHAR szOutPath[MAX_PATH];
+ wchar_t szOutPath[MAX_PATH];
- TCHAR *szVarPath = Utils_ReplaceVarsT(pSrc.c_str());
- if (szVarPath == (TCHAR*)CALLSERVICE_NOTFOUND || szVarPath == NULL) {
- TCHAR szExpPath[MAX_PATH];
+ wchar_t *szVarPath = Utils_ReplaceVarsT(pSrc.c_str());
+ if (szVarPath == (wchar_t*)CALLSERVICE_NOTFOUND || szVarPath == NULL) {
+ wchar_t szExpPath[MAX_PATH];
ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, _countof(szExpPath));
PathToAbsoluteT(szExpPath, szOutPath);
}
@@ -186,7 +186,7 @@ bool InitGdiPlus(void)
{
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
- static const TCHAR errmsg[] = L"GDI+ not installed.\n"
+ static const wchar_t errmsg[] = L"GDI+ not installed.\n"
L"GDI+ can be downloaded here: http://www.microsoft.com/downloads";
__try {
@@ -227,9 +227,9 @@ bool IsSmileyProto(char *proto)
return proto && mir_strcmp(proto, META_PROTO) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & (PF1_IM | PF1_CHAT));
}
-void ReportError(const TCHAR *errmsg)
+void ReportError(const wchar_t *errmsg)
{
- static const TCHAR title[] = L"Miranda SmileyAdd";
+ static const wchar_t title[] = L"Miranda SmileyAdd";
POPUPDATAT pd = { 0 };
mir_tstrcpy(pd.lpwzContactName, title);
diff --git a/plugins/SmileyAdd/src/imagecache.cpp b/plugins/SmileyAdd/src/imagecache.cpp
index 1592a858fc..6960adff96 100644
--- a/plugins/SmileyAdd/src/imagecache.cpp
+++ b/plugins/SmileyAdd/src/imagecache.cpp
@@ -528,7 +528,7 @@ void DestroyImageCache(void)
ImageBase* AddCacheImage(const CMString &file, int index)
{
CMString tmpfile(file); tmpfile.AppendFormat(L"#%d", index);
- unsigned id = mir_hash(tmpfile.c_str(), tmpfile.GetLength() * sizeof(TCHAR));
+ unsigned id = mir_hash(tmpfile.c_str(), tmpfile.GetLength() * sizeof(wchar_t));
WaitForSingleObject(g_hMutexIm, 3000);
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp
index 86264d591a..8466424240 100644
--- a/plugins/SmileyAdd/src/options.cpp
+++ b/plugins/SmileyAdd/src/options.cpp
@@ -204,7 +204,7 @@ BOOL OptionsDialogType::DialogProcedure(UINT msg, WPARAM wParam, LPARAM lParam)
void OptionsDialogType::AddCategory(void)
{
- TCHAR cat[30];
+ wchar_t cat[30];
GetDlgItemText(m_hwndDialog, IDC_NEWCATEGORY, cat, _countof(cat));
CMString catd = cat;
@@ -327,7 +327,7 @@ void OptionsDialogType::PopulateSmPackList(void)
SmileyCategoryListType::SmileyCategoryVectorType &smc = *tmpsmcat.GetSmileyCategoryList();
for (int i = 0; i < smc.getCount(); i++) {
if (smc[i].IsVisible()) {
- tvi.item.pszText = (TCHAR*)smc[i].GetDisplayName().c_str();
+ tvi.item.pszText = (wchar_t*)smc[i].GetDisplayName().c_str();
if (!smc[i].IsProto()) {
tvi.item.iImage = 0;
tvi.item.iSelectedImage = 0;
@@ -463,7 +463,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item)
{
OPENFILENAME ofn = { 0 };
- TCHAR filename[MAX_PATH] = L"";
+ wchar_t filename[MAX_PATH] = L"";
ofn.lpstrFile = filename;
ofn.nMaxFile = _countof(filename);
@@ -480,7 +480,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item)
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = m_hwndDialog;
- TCHAR filter[512], *pfilter;
+ wchar_t filter[512], *pfilter;
mir_tstrcpy(filter, TranslateT("Smiley packs"));
mir_tstrcat(filter, L" (*.msl;*.asl;*.xep)");
pfilter = filter + mir_tstrlen(filter) + 1;
@@ -511,7 +511,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item)
void OptionsDialogType::FilenameChanged(void)
{
- TCHAR str[MAX_PATH];
+ wchar_t str[MAX_PATH];
GetDlgItemText(m_hwndDialog, IDC_FILENAME, str, _countof(str));
SmileyCategoryType *smc = tmpsmcat.GetSmileyCategory(GetSelProto());
@@ -593,7 +593,7 @@ void OptionsType::ReadPackFileName(CMString &filename, const CMString &name, con
CMString settingKey = name + L"-filename";
ptrT tszValue(db_get_tsa(NULL, "SmileyAdd", _T2A(settingKey.c_str())));
- filename = (tszValue != NULL) ? (TCHAR*)tszValue : defaultFilename;
+ filename = (tszValue != NULL) ? (wchar_t*)tszValue : defaultFilename;
}
void OptionsType::WritePackFileName(const CMString &filename, const CMString &name)
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp
index 9e994418ea..92a556a81c 100644
--- a/plugins/SmileyAdd/src/richcall.cpp
+++ b/plugins/SmileyAdd/src/richcall.cpp
@@ -97,7 +97,7 @@ static void SetPosition(HWND hwnd)
static void SetTooltip(long x, long y, HWND hwnd, RichEditData *rdt)
{
- TCHAR *smltxt;
+ wchar_t *smltxt;
int needtip = CheckForTip(x, y, hwnd, &smltxt);
if (needtip == rdt->tipActive)
return;
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp
index c0d453624c..1abad18364 100644
--- a/plugins/SmileyAdd/src/services.cpp
+++ b/plugins/SmileyAdd/src/services.cpp
@@ -301,7 +301,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM)
const int ind = i + 3;
mi.position = ind;
- mi.name.t = (TCHAR*)smc[i].GetDisplayName().c_str();
+ mi.name.w = (wchar_t*)smc[i].GetDisplayName().c_str();
if (cat == smc[i].GetName()) {
mi.flags |= CMIF_CHECKED;
@@ -315,7 +315,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM)
}
mi.position = 1;
- mi.name.t = L"<None>";
+ mi.name.w = L"<None>";
if (cat == L"<None>") {
mi.flags |= CMIF_CHECKED;
nonecheck = false;
@@ -326,7 +326,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM)
menuHandleArray.insert(hMenu);
mi.position = 2;
- mi.name.t = LPGENT("Protocol specific");
+ mi.name.w = LPGENW("Protocol specific");
if (nonecheck) mi.flags |= CMIF_CHECKED; else mi.flags &= ~CMIF_CHECKED;
hMenu = Menu_AddContactMenuItem(&mi);
diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp
index d71a91fed0..e6d7dfd7ed 100644
--- a/plugins/SmileyAdd/src/smileyroutines.cpp
+++ b/plugins/SmileyAdd/src/smileyroutines.cpp
@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+#include <tchar.h>
+
ISmileyBase* CreateSmileyObject(SmileyType *sml);
ISmileyBase* CreateAniSmileyObject(SmileyType *sml, COLORREF clr, bool ishpp);
@@ -29,7 +31,7 @@ bool g_HiddenTextSupported = true;
const GUID IID_ITextDocument =
{ 0x8CC497C0, 0xA1DF, 0x11CE, { 0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D } };
-void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, const TCHAR *lpstrText, SmileysQueueType &smllist, const bool firstOnly)
+void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, const wchar_t *lpstrText, SmileysQueueType &smllist, const bool firstOnly)
{
if (lpstrText == NULL || *lpstrText == 0) return;
@@ -98,20 +100,20 @@ void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack,
ReplaceSmileyType *dat = new ReplaceSmileyType;
- const TCHAR *textToSearch = lpstrText + smloff;
- const TCHAR *textSmlStart = lpstrText + (*smlf)[firstSmlRef].pos;
- const TCHAR *textSmlEnd = textSmlStart + (*smlf)[firstSmlRef].len;
+ const wchar_t *textToSearch = lpstrText + smloff;
+ const wchar_t *textSmlStart = lpstrText + (*smlf)[firstSmlRef].pos;
+ const wchar_t *textSmlEnd = textSmlStart + (*smlf)[firstSmlRef].len;
// check if leading space exist
- const TCHAR *prech = _tcsdec(textToSearch, textSmlStart);
- dat->ldspace = prech != NULL ? _istspace(*prech) != 0 : smloff == 0;
+ const wchar_t *prech = _wcsdec(textToSearch, textSmlStart);
+ dat->ldspace = prech != NULL ? iswspace(*prech) != 0 : smloff == 0;
// check if trailing space exist
- dat->trspace = *textSmlEnd == 0 || _istspace(*textSmlEnd);
+ dat->trspace = *textSmlEnd == 0 || iswspace(*textSmlEnd);
// compute text location in RichEdit
- dat->loc.cpMin = (long)_tcsnccnt(textToSearch, (*smlf)[firstSmlRef].pos - smloff) + numCharsSoFar;
- dat->loc.cpMax = numCharsSoFar = (long)_tcsnccnt(textSmlStart, (*smlf)[firstSmlRef].len) + dat->loc.cpMin;
+ dat->loc.cpMin = (long)_wcsncnt(textToSearch, (*smlf)[firstSmlRef].pos - smloff) + numCharsSoFar;
+ dat->loc.cpMax = numCharsSoFar = (long)_wcsncnt(textSmlStart, (*smlf)[firstSmlRef].len) + dat->loc.cpMin;
if (!opt.EnforceSpaces || (dat->ldspace && dat->trspace)) {
dat->ldspace |= !opt.SurroundSmileyWithSpaces;
@@ -143,7 +145,7 @@ void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack,
}
-void FindSmileyInText(SmileyPackType *smp, const TCHAR *str, unsigned &first, unsigned &size, SmileyType **sml)
+void FindSmileyInText(SmileyPackType *smp, const wchar_t *str, unsigned &first, unsigned &size, SmileyType **sml)
{
SmileysQueueType smllist;
LookupAllSmileys(smp, NULL, str, smllist, true);
@@ -221,9 +223,9 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const
// disable screen updates
TextDocument->Freeze(&cnt);
- TCHAR classname[20];
+ wchar_t classname[20];
GetClassName(hwnd, classname, _countof(classname));
- bool ishpp = (_tcsncmp(classname, L"THppRichEdit", 12) == 0) || fireView;
+ bool ishpp = (wcsncmp(classname, L"THppRichEdit", 12) == 0) || fireView;
SetRichCallback(hwnd, NULL, false, true);
diff --git a/plugins/SmileyAdd/src/smileyroutines.h b/plugins/SmileyAdd/src/smileyroutines.h
index 93b00cb08e..2507afc11e 100644
--- a/plugins/SmileyAdd/src/smileyroutines.h
+++ b/plugins/SmileyAdd/src/smileyroutines.h
@@ -34,10 +34,10 @@ typedef SMOBJLIST<ReplaceSmileyType> SmileysQueueType;
-void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, const TCHAR *lpstrText, SmileysQueueType &smllist, const bool firstOnly);
+void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, const wchar_t *lpstrText, SmileysQueueType &smllist, const bool firstOnly);
void ReplaceSmileys(HWND hwnd, SmileyPackType *smp, SmileyPackCType *smcp, const CHARRANGE &sel, bool useHidden, bool ignoreLast, bool unFreeze, bool fireView = 0);
void ReplaceSmileysWithText(HWND hwnd, CHARRANGE &sel, bool keepFrozen);
-void FindSmileyInText(SmileyPackType *smp, const TCHAR *str, unsigned &first, unsigned &size, SmileyType **index);
+void FindSmileyInText(SmileyPackType *smp, const wchar_t *str, unsigned &first, unsigned &size, SmileyType **index);
SmileyType* FindButtonSmiley(SmileyPackType *smp);
#endif
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp
index 97c63f00a5..7024c5ed97 100644
--- a/plugins/SmileyAdd/src/smileys.cpp
+++ b/plugins/SmileyAdd/src/smileys.cpp
@@ -208,14 +208,14 @@ SmileyType* SmileyPackType::GetSmiley(unsigned index)
return (index < (unsigned)m_SmileyList.getCount()) ? &m_SmileyList[index] : NULL;
}
-static DWORD_PTR ConvertServiceParam(MCONTACT hContact, const TCHAR *param)
+static DWORD_PTR ConvertServiceParam(MCONTACT hContact, const wchar_t *param)
{
if (param == NULL)
return 0;
if (mir_tstrcmpi(L"hContact", param) == 0)
return hContact;
- if (_istdigit(*param))
- return _ttoi(param);
+ if (iswdigit(*param))
+ return _wtoi(param);
return (DWORD_PTR)param;
}
@@ -253,10 +253,10 @@ SmileyPackType::~SmileyPackType()
if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
}
-static const TCHAR urlRegEx[] =
+static const wchar_t urlRegEx[] =
L"(?:ftp|https|http|file|aim|webcal|irc|msnim|xmpp|gopher|mailto|news|nntp|telnet|wais|prospero)://?[\\w.?%:/$+;]*";
-static const TCHAR pathRegEx[] = L"[\\s\"][a-zA-Z]:[\\\\/][\\w.\\-\\\\/]*";
-static const TCHAR timeRegEx[] = L"\\d{1,2}:\\d{2}:\\d{2}|\\d{1,2}:\\d{2}";
+static const wchar_t pathRegEx[] = L"[\\s\"][a-zA-Z]:[\\\\/][\\w.\\-\\\\/]*";
+static const wchar_t timeRegEx[] = L"\\d{1,2}:\\d{2}:\\d{2}|\\d{1,2}:\\d{2}";
void SmileyPackType::AddTriggersToSmileyLookup(void)
{
@@ -354,11 +354,11 @@ bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &pa
pathToAbsolute(filename, modpath);
// Load xep file
- int fh = _topen(modpath.c_str(), _O_BINARY | _O_RDONLY);
+ int fh = _wopen(modpath.c_str(), _O_BINARY | _O_RDONLY);
if (fh == -1) {
if (!noerr) {
- static const TCHAR errmsg[] = LPGENT("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
- TCHAR msgtxt[1024];
+ static const wchar_t errmsg[] = LPGENW("Smiley pack %s for category \"%s\" not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
+ wchar_t msgtxt[1024];
mir_sntprintf(msgtxt, TranslateTS(errmsg), modpath.c_str(), packname);
ReportError(msgtxt);
}
@@ -443,8 +443,8 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &
_TMatcher *m0 = pat->createTMatcher(tbuf);
while (m0->findNextMatch()) {
POINT tpt;
- tpt.x = _ttol(m0->getGroup(2).c_str());
- tpt.y = _ttol(m0->getGroup(3).c_str());
+ tpt.x = _wtol(m0->getGroup(2).c_str());
+ tpt.y = _wtol(m0->getGroup(3).c_str());
if (m0->getGroup(1) == L"Selection")
selec = tpt;
@@ -479,7 +479,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &
SmileyType *dat = new SmileyType;
- const int iconIndex = _ttol(m0->getGroup(3).c_str());
+ const int iconIndex = _wtol(m0->getGroup(3).c_str());
dat->SetHidden(m0->getStartingIndex(1) >= 0);
if (m0->getStartingIndex(4) >= 0) {
@@ -517,8 +517,8 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &
m_SmileyList.insert(dat);
if (!noerr) {
- static const TCHAR errmsg[] = LPGENT("Smiley #%u in file %s for smiley pack %s not found.");
- TCHAR msgtxt[1024];
+ static const wchar_t errmsg[] = LPGENW("Smiley #%u in file %s for smiley pack %s not found.");
+ wchar_t msgtxt[1024];
mir_sntprintf(msgtxt, TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
errorFound = true;
@@ -642,7 +642,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&)
SmileyType *dat = new SmileyType;
dat->SetRegEx(true);
- dat->SetImList(m_hSmList, _ttol(m0->getGroup(1).c_str()));
+ dat->SetImList(m_hSmList, _wtol(m0->getGroup(1).c_str()));
dat->m_ToolText = m0->getGroup(2);
DecodeHTML(dat->m_ToolText);
@@ -897,7 +897,7 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr
CMString patha;
pathToAbsolute(paths, patha);
- if (_taccess(patha.c_str(), 0) != 0)
+ if (_waccess(patha.c_str(), 0) != 0)
paths = defaultFile;
}
@@ -923,7 +923,7 @@ void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString &defau
CMString paths = _A2T(path), patha;
pathToAbsolute(paths, patha);
- if (_taccess(patha.c_str(), 0) != 0)
+ if (_waccess(patha.c_str(), 0) != 0)
paths = defaultFile;
CMString dName(acc), displayName;
displayName.AppendFormat(TranslateT("%s global smiley pack"), dName.GetBuffer());
@@ -995,7 +995,7 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co
CMString paths = _A2T(path), patha;
pathToAbsolute(paths, patha);
- if (_taccess(patha.c_str(), 0) != 0)
+ if (_waccess(patha.c_str(), 0) != 0)
paths = defaultFile;
AddCategory(displayName, displayName, smcTransportProto, paths);
@@ -1055,7 +1055,7 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void)
SmileyLookup::SmileyLookup(const CMString &str, const bool regexs, const int ind, const CMString &smpt)
{
- TCHAR msgtxt[1024];
+ wchar_t msgtxt[1024];
m_ind = ind;
if (regexs) {
@@ -1067,13 +1067,13 @@ SmileyLookup::SmileyLookup(const CMString &str, const bool regexs, const int ind
m_valid &= (!matcher->findFirstMatch() ||
matcher->getStartingIndex() != matcher->getEndingIndex());
if (!m_valid) {
- static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" could produce \"empty matches\".");
+ static const wchar_t errmsg[] = LPGENW("Regular expression \"%s\" in smiley pack \"%s\" could produce \"empty matches\".");
mir_sntprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
delete matcher;
}
else {
- static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" malformed.");
+ static const wchar_t errmsg[] = LPGENW("Regular expression \"%s\" in smiley pack \"%s\" malformed.");
mir_sntprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
@@ -1112,8 +1112,8 @@ void SmileyLookup::Find(const CMString &str, SmileyLocVecType &smlcur, bool firs
delete matcher;
}
else {
- const TCHAR *pos = str.c_str();
- while ((pos = _tcsstr(pos, m_text.c_str())) != NULL) {
+ const wchar_t *pos = str.c_str();
+ while ((pos = wcsstr(pos, m_text.c_str())) != NULL) {
smlcur.insert(new SmileyLocType(pos - str.c_str(), m_text.GetLength()));
pos += m_text.GetLength();
if (firstOnly && m_ind != -1)
diff --git a/plugins/SmileyAdd/src/smileys.h b/plugins/SmileyAdd/src/smileys.h
index 765480e123..cba4999442 100644
--- a/plugins/SmileyAdd/src/smileys.h
+++ b/plugins/SmileyAdd/src/smileys.h
@@ -69,7 +69,7 @@ public:
bool IsSound(void) const { return (m_flags & SoundSmiley) != 0; }
bool IsText(void) const { return (m_flags & TextSmiley) != 0; }
- bool IsFileFound(void) { return _taccess(m_filepath.c_str(), 0) == 0; }
+ bool IsFileFound(void) { return _waccess(m_filepath.c_str(), 0) == 0; }
bool IsValid(void) { return m_size.cx != 0; }
ImageBase* CreateCachedImage(void);
@@ -203,7 +203,7 @@ public:
SmileyType* GetSmiley(unsigned index);
- const TCHAR* GetButtonSmiley(void) const { return m_ButtonSmiley.c_str(); }
+ const wchar_t* GetButtonSmiley(void) const { return m_ButtonSmiley.c_str(); }
bool LoadSmileyFile(const CMString &filename, const CMString &packname, bool onlyInfo, bool noerr = false);
diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp
index d427c47644..8db7726c1f 100644
--- a/plugins/SmileyAdd/src/smltool.cpp
+++ b/plugins/SmileyAdd/src/smltool.cpp
@@ -236,7 +236,7 @@ void SmileyToolWindowType::SmileySel(int but)
ti.uId = (UINT_PTR)m_hwndDialog;
const CMString &toolText = m_pSmileyPack->GetSmiley(m_CurrentHotTrack)->GetToolText();
- ti.lpszText = const_cast<TCHAR*>(toolText.c_str());
+ ti.lpszText = const_cast<wchar_t*>(toolText.c_str());
SendMessage(m_hToolTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
SendMessage(m_hToolTip, TTM_ACTIVATE, TRUE, 0);
diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h
index 3f9d130e8e..4599a5a6f3 100644
--- a/plugins/SmileyAdd/src/stdafx.h
+++ b/plugins/SmileyAdd/src/stdafx.h
@@ -120,7 +120,7 @@ int UpdateSrmmDlg(WPARAM wParam, LPARAM lParam);
//functions for general use (defined in general.cpp)
int CalculateTextHeight(HDC hdc, CHARFORMAT2 *chf);
-const TCHAR* GetImageExt(CMString &fname);
+const wchar_t* GetImageExt(CMString &fname);
MCONTACT DecodeMetaContact(MCONTACT hContact);
bool IsSmileyProto(char *proto);
@@ -133,7 +133,7 @@ void pathToAbsolute(const CMString &pSrc, CMString &pOut);
bool InitGdiPlus(void);
void DestroyGdiPlus(void);
-void ReportError(const TCHAR *errmsg);
+void ReportError(const wchar_t *errmsg);
HICON GetDefaultIcon(bool copy = true);
void CloseRichCallback(HWND hwnd);
@@ -144,7 +144,7 @@ void ProcessAllInputAreas(bool restoreText);
void RichEditData_Destroy(void);
void CloseSmileys(void);
-int CheckForTip(int x, int y, HWND hwnd, TCHAR **smltxt);
+int CheckForTip(int x, int y, HWND hwnd, wchar_t **smltxt);
void UrlDecode(char *str);