From 428bf0cbd77813a43094cb5c984436deff251936 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 29 Jul 2016 12:36:34 +0000 Subject: no more TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17143 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SmileyAdd/src/customsmiley.cpp | 14 +-- plugins/SmileyAdd/src/customsmiley.h | 2 +- plugins/SmileyAdd/src/download.cpp | 16 +-- plugins/SmileyAdd/src/download.h | 2 +- plugins/SmileyAdd/src/general.cpp | 10 +- plugins/SmileyAdd/src/imagecache.cpp | 24 ++-- plugins/SmileyAdd/src/imagecache.h | 10 +- plugins/SmileyAdd/src/options.cpp | 50 ++++---- plugins/SmileyAdd/src/options.h | 12 +- plugins/SmileyAdd/src/regexp/WCMatcher.cpp | 20 ++-- plugins/SmileyAdd/src/regexp/WCMatcher.h | 32 +++--- plugins/SmileyAdd/src/regexp/WCPattern.cpp | 178 ++++++++++++++--------------- plugins/SmileyAdd/src/regexp/WCPattern.h | 158 ++++++++++++------------- plugins/SmileyAdd/src/services.cpp | 32 +++--- plugins/SmileyAdd/src/smileyroutines.cpp | 2 +- plugins/SmileyAdd/src/smileys.cpp | 122 ++++++++++---------- plugins/SmileyAdd/src/smileys.h | 92 +++++++-------- plugins/SmileyAdd/src/smltool.cpp | 4 +- plugins/SmileyAdd/src/stdafx.h | 6 +- 19 files changed, 393 insertions(+), 393 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index 64fdd3d17e..5f9ff1b9fb 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -59,7 +59,7 @@ SmileyPackCType* SmileyPackCListType::GetSmileyPack(MCONTACT id) } -SmileyCType::SmileyCType(const CMString &fullpath, const wchar_t *filepath) +SmileyCType::SmileyCType(const CMStringW &fullpath, const wchar_t *filepath) { LoadFromResource(fullpath, 0); CreateTriggerText(_T2A(filepath)); @@ -95,7 +95,7 @@ bool SmileyCType::CreateTriggerText(char *text) bool SmileyPackCType::LoadSmileyDir(wchar_t *dir) { - CMString dirs = dir; + CMStringW dirs = dir; dirs += L"\\*.*"; _wfinddata_t c_file; @@ -103,7 +103,7 @@ bool SmileyPackCType::LoadSmileyDir(wchar_t *dir) if (hFile > -1L) { do { if (c_file.name[0] != '.') { - CMString fullpath = dir; + CMStringW fullpath = dir; fullpath = fullpath + L"\\" + c_file.name; wchar_t *div = wcsrchr(c_file.name, '.'); if (div) { @@ -125,11 +125,11 @@ bool SmileyPackCType::LoadSmileyDir(wchar_t *dir) bool SmileyPackCType::LoadSmiley(wchar_t *path) { - CMString dirs = path; + CMStringW dirs = path; int slash = dirs.ReverseFind('\\'); int dot = dirs.ReverseFind('.'); - CMString name = dirs.Mid(slash + 1, dot - slash - 1); + CMStringW name = dirs.Mid(slash + 1, dot - slash - 1); for (int i = 0; i < m_SmileyList.getCount(); i++) if (m_SmileyList[i].GetTriggerText() == name) { @@ -139,7 +139,7 @@ bool SmileyPackCType::LoadSmiley(wchar_t *path) m_SmileyList.insert(new SmileyCType(dirs, (wchar_t*)name.c_str())); - CMString empty; + CMStringW empty; m_SmileyLookup.insert(new SmileyLookup( m_SmileyList[m_SmileyList.getCount() - 1].GetTriggerText(), false, m_SmileyList.getCount() - 1, empty)); @@ -148,7 +148,7 @@ bool SmileyPackCType::LoadSmiley(wchar_t *path) void SmileyPackCType::AddTriggersToSmileyLookup(void) { - CMString empty; + CMStringW empty; for (int dist = 0; dist < m_SmileyList.getCount(); dist++) { SmileyLookup *dats = new SmileyLookup(m_SmileyList[dist].GetTriggerText(), false, dist, empty); m_SmileyLookup.insert(dats); diff --git a/plugins/SmileyAdd/src/customsmiley.h b/plugins/SmileyAdd/src/customsmiley.h index b1366e83bc..bd76875796 100644 --- a/plugins/SmileyAdd/src/customsmiley.h +++ b/plugins/SmileyAdd/src/customsmiley.h @@ -22,7 +22,7 @@ along with this program. If not, see . class SmileyCType : public SmileyType { public: - SmileyCType(const CMString &fullpath, const wchar_t *filepath); + SmileyCType(const CMStringW &fullpath, const wchar_t *filepath); bool CreateTriggerText(char *text); }; diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 8a46c4fc70..8e7fa9f86f 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -23,11 +23,11 @@ static HANDLE hFolder; struct QueueElem { - CMString url; - CMString fname; + CMStringW url; + CMStringW fname; bool needext; - QueueElem(CMString &purl, CMString &pfname, bool ne) + QueueElem(CMStringW &purl, CMStringW &pfname, bool ne) : url(purl), fname(pfname), needext(ne) { } @@ -135,7 +135,7 @@ void __cdecl SmileyDownloadThread(void*) InternetDownloadFile(_T2A(dlQueue[0].url.c_str()), _T2A(dlQueue[0].fname.c_str()), hHttpDwnl); WaitForSingleObject(g_hDlMutex, 3000); - CMString fname(dlQueue[0].fname); + CMStringW fname(dlQueue[0].fname); if (dlQueue[0].needext) { fname += GetImageExt(fname); needext = true; } _wrename(dlQueue[0].fname.c_str(), fname.c_str()); } @@ -156,14 +156,14 @@ void __cdecl SmileyDownloadThread(void*) } } -bool GetSmileyFile(CMString &url, const CMString &packstr) +bool GetSmileyFile(CMStringW &url, const CMStringW &packstr) { _TPattern *urlsplit = _TPattern::compile(L".*/(.*)"); _TMatcher *m0 = urlsplit->createTMatcher(url); m0->findFirstMatch(); - CMString filename; + CMStringW filename; filename.AppendFormat(L"%s\\%s\\", cachepath, packstr.c_str()); int pathpos = filename.GetLength(); filename += m0->getGroup(1); @@ -213,13 +213,13 @@ void GetSmileyCacheFolder(void) FoldersGetCustomPathT(hFolder, cachepath, MAX_PATH, L""); HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged); } - else mir_wstrncpy(cachepath, VARST(L"%miranda_userdata%\\SmileyCache"), MAX_PATH); + else mir_wstrncpy(cachepath, VARSW(L"%miranda_userdata%\\SmileyCache"), MAX_PATH); } void DownloadInit(void) { NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_TCHAR; + nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = "SmileyAdd"; nlu.ptszDescriptiveName = TranslateT("SmileyAdd HTTP connections"); hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); diff --git a/plugins/SmileyAdd/src/download.h b/plugins/SmileyAdd/src/download.h index 0e1b50bf3f..87a9322a8b 100644 --- a/plugins/SmileyAdd/src/download.h +++ b/plugins/SmileyAdd/src/download.h @@ -19,7 +19,7 @@ along with this program. If not, see . #ifndef SMILEYADD_DOWNLOAD_H_ #define SMILEYADD_DOWNLOAD_H_ -bool GetSmileyFile(CMString &url, const CMString &packstr); +bool GetSmileyFile(CMStringW &url, const CMStringW &packstr); void DownloadInit(void); void DownloadClose(void); diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index 4fda95dd92..3071b83494 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -59,7 +59,7 @@ HICON GetDefaultIcon(bool copy) return resIco; } -const wchar_t* GetImageExt(CMString &fname) +const wchar_t* GetImageExt(CMStringW &fname) { const wchar_t *ext = L""; @@ -124,14 +124,14 @@ HICON ImageList_GetIconFixed(HIMAGELIST himl, INT i, UINT fStyle) return hIcon; } -void pathToRelative(const CMString &pSrc, CMString &pOut) +void pathToRelative(const CMStringW &pSrc, CMStringW &pOut) { wchar_t szOutPath[MAX_PATH]; PathToRelativeT(pSrc.c_str(), szOutPath); pOut = szOutPath; } -void pathToAbsolute(const CMString &pSrc, CMString &pOut) +void pathToAbsolute(const CMStringW &pSrc, CMStringW &pOut) { wchar_t szOutPath[MAX_PATH]; @@ -139,10 +139,10 @@ void pathToAbsolute(const CMString &pSrc, CMString &pOut) if (szVarPath == (wchar_t*)CALLSERVICE_NOTFOUND || szVarPath == NULL) { wchar_t szExpPath[MAX_PATH]; ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, _countof(szExpPath)); - PathToAbsoluteT(szExpPath, szOutPath); + PathToAbsoluteW(szExpPath, szOutPath); } else { - PathToAbsoluteT(szVarPath, szOutPath); + PathToAbsoluteW(szVarPath, szOutPath); mir_free(szVarPath); } pOut = szOutPath; diff --git a/plugins/SmileyAdd/src/imagecache.cpp b/plugins/SmileyAdd/src/imagecache.cpp index 6960adff96..aa20f59a70 100644 --- a/plugins/SmileyAdd/src/imagecache.cpp +++ b/plugins/SmileyAdd/src/imagecache.cpp @@ -21,7 +21,7 @@ along with this program. If not, see . static HANDLE g_hMutexIm; static OBJLIST g_imagecache(25, ImageType::CompareImg); -static CMString lastdllname; +static CMStringW lastdllname; static HMODULE lastmodule; static time_t laststamp; static UINT_PTR timerId; @@ -58,7 +58,7 @@ static void CALLBACK sttMainThreadCallback(PVOID) } -static HMODULE LoadDll(const CMString &file) +static HMODULE LoadDll(const CMStringW &file) { WaitForSingleObject(g_hMutexIm, 3000); @@ -190,7 +190,7 @@ int ImageBase::SelectNextFrame(const int frame) ///////////////////////////////////////////////////////////////////////////////////////// -IconType::IconType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type) +IconType::IconType(const unsigned id, const CMStringW &file, const int index, const IcoTypeEnum type) : ImageBase(id) { m_SmileyIcon = NULL; @@ -279,7 +279,7 @@ void ImageListItemType::GetSize(SIZE &size) ImageList_GetIconSize(m_hImList, (int*)&size.cx, (int*)&size.cy); } -ImageType::ImageType(const unsigned id, const CMString &file, IStream *pStream) +ImageType::ImageType(const unsigned id, const CMStringW &file, IStream *pStream) : ImageBase(id) { m_bmp = NULL; @@ -310,7 +310,7 @@ ImageType::ImageType(const unsigned id, const CMString &file, IStream *pStream) } } -ImageType::ImageType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type) +ImageType::ImageType(const unsigned id, const CMStringW &file, const int index, const IcoTypeEnum type) : ImageBase(id) { m_bmp = NULL; @@ -415,17 +415,17 @@ ImageFType::ImageFType(const unsigned id) m_bmp = NULL; } -ImageFType::ImageFType(const unsigned id, const CMString &file) +ImageFType::ImageFType(const unsigned id, const CMStringW &file) : ImageBase(id) { m_bmp = NULL; - FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeT(file.c_str(), 0); + FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeU(file.c_str(), 0); if (fif == FIF_UNKNOWN) - fif = fei->FI_GetFIFFromFilenameT(file.c_str()); + fif = fei->FI_GetFIFFromFilenameU(file.c_str()); if (fif == FIF_UNKNOWN) return; - FIBITMAP *dib = fei->FI_LoadT(fif, file.c_str(), 0); + FIBITMAP *dib = fei->FI_LoadU(fif, file.c_str(), 0); if (dib == NULL) return; bool transp = fei->FI_IsTransparent(dib) != 0; @@ -525,9 +525,9 @@ void DestroyImageCache(void) CloseHandle(g_hMutexIm); } -ImageBase* AddCacheImage(const CMString &file, int index) +ImageBase* AddCacheImage(const CMStringW &file, int index) { - CMString tmpfile(file); tmpfile.AppendFormat(L"#%d", index); + CMStringW tmpfile(file); tmpfile.AppendFormat(L"#%d", index); unsigned id = mir_hash(tmpfile.c_str(), tmpfile.GetLength() * sizeof(wchar_t)); WaitForSingleObject(g_hMutexIm, 3000); @@ -539,7 +539,7 @@ ImageBase* AddCacheImage(const CMString &file, int index) if (ind == -1) return NULL; - CMString ext = file.Mid(ind + 1); + CMStringW ext = file.Mid(ind + 1); ext.MakeLower(); if (ext == L"dll" || ext == L"exe") img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, index, icoDll) : (ImageBase*)new IconType(id, file, index, icoDll); diff --git a/plugins/SmileyAdd/src/imagecache.h b/plugins/SmileyAdd/src/imagecache.h index da019301a9..cc0ef2cf3b 100644 --- a/plugins/SmileyAdd/src/imagecache.h +++ b/plugins/SmileyAdd/src/imagecache.h @@ -66,7 +66,7 @@ private: HICON m_SmileyIcon; public: - IconType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type); + IconType(const unsigned id, const CMStringW &file, const int index, const IcoTypeEnum type); ~IconType(); void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY); @@ -101,8 +101,8 @@ private: public: - ImageType(const unsigned id, const CMString &file, IStream *pStream); - ImageType(const unsigned id, const CMString &file, const int index, const IcoTypeEnum type); + ImageType(const unsigned id, const CMStringW &file, IStream *pStream); + ImageType(const unsigned id, const CMStringW &file, const int index, const IcoTypeEnum type); ~ImageType(); void SelectFrame(int frame); @@ -123,7 +123,7 @@ protected: public: ImageFType(const unsigned id); - ImageFType(const unsigned id, const CMString &file); + ImageFType(const unsigned id, const CMStringW &file); ~ImageFType(); void DrawInternal(HDC dc, int x, int y, int sizeX, int sizeY); @@ -131,7 +131,7 @@ public: void GetSize(SIZE &size); }; -ImageBase* AddCacheImage(const CMString &file, int index); +ImageBase* AddCacheImage(const CMStringW &file, int index); void InitImageCache(void); void DestroyImageCache(void); diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index eca94429b5..e477945e4b 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -206,7 +206,7 @@ void OptionsDialogType::AddCategory(void) { wchar_t cat[30]; GetDlgItemText(m_hwndDialog, IDC_NEWCATEGORY, cat, _countof(cat)); - CMString catd = cat; + CMStringW catd = cat; if (!catd.IsEmpty()) { tmpsmcat.AddCategory(cat, catd, smcCustom); @@ -248,7 +248,7 @@ void OptionsDialogType::UpdateControls(bool force) if (smc == NULL) return; - const CMString &smf = smc->GetFilename(); + const CMStringW &smf = smc->GetFilename(); SetDlgItemText(m_hwndDialog, IDC_FILENAME, smf); if (smPack.GetFilename() != smf || force) @@ -259,7 +259,7 @@ void OptionsDialogType::UpdateControls(bool force) SetDlgItemText(m_hwndDialog, IDC_LIBAUTHOR, smPack.GetAuthor().c_str()); SetDlgItemText(m_hwndDialog, IDC_LIBVERSION, smPack.GetVersion().c_str()); - SetDlgItemText(m_hwndDialog, IDC_LIBNAME, TranslateTS(smPack.GetName().c_str())); + SetDlgItemText(m_hwndDialog, IDC_LIBNAME, TranslateW(smPack.GetName().c_str())); } long OptionsDialogType::GetSelProto(HTREEITEM hItem) @@ -286,17 +286,17 @@ void OptionsDialogType::UpdateVisibleSmPackList(void) bool visible = useOne ? !smc[i].IsProto() : visiblecat; if (!visible && smc[i].IsAcc() && !useOne) { - CMString PhysProtoName = L"AllProto"; - CMString ProtoName = smc[i].GetName(); + CMStringW PhysProtoName = L"AllProto"; + CMStringW ProtoName = smc[i].GetName(); DBVARIANT dbv; - if (db_get_ts(NULL, _T2A(ProtoName.GetBuffer()), "AM_BaseProto", &dbv) == 0) { + if (db_get_ws(NULL, _T2A(ProtoName.GetBuffer()), "AM_BaseProto", &dbv) == 0) { ProtoName = dbv.ptszVal; db_free(&dbv); } else ProtoName.Empty(); - CMString FileName; + CMStringW FileName; if (!ProtoName.IsEmpty()) { PhysProtoName += ProtoName; SmileyCategoryType *scm = tmpsmcat.GetSmileyCategory(PhysProtoName); @@ -443,7 +443,7 @@ void OptionsDialogType::ApplyChanges(void) opt.Save(); // Cleanup database - CMString empty; + CMStringW empty; SmileyCategoryListType::SmileyCategoryVectorType &smc = *g_SmileyCategories.GetSmileyCategoryList(); for (int i = 0; i < smc.getCount(); i++) if (tmpsmcat.GetSmileyCategory(smc[i].GetName()) == NULL) @@ -467,7 +467,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item) ofn.lpstrFile = filename; ofn.nMaxFile = _countof(filename); - CMString inidir; + CMStringW inidir; SmileyCategoryType *smc = tmpsmcat.GetSmileyCategory(item); if (smc->GetFilename().IsEmpty()) pathToAbsolute(L"Smileys", inidir); @@ -499,7 +499,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item) ofn.lpstrDefExt = L"msl"; if (GetOpenFileName(&ofn)) { - CMString relpath; + CMStringW relpath; pathToRelative(filename, relpath); smc->SetFilename(relpath); @@ -516,7 +516,7 @@ void OptionsDialogType::FilenameChanged(void) SmileyCategoryType *smc = tmpsmcat.GetSmileyCategory(GetSelProto()); if (smc->GetFilename() != str) { - CMString temp(str); + CMStringW temp(str); smc->SetFilename(temp); UpdateControls(); } @@ -588,48 +588,48 @@ void OptionsType::Load(void) HorizontalSorting = db_get_b(NULL, "SmileyAdd", "HorizontalSorting", 1) != 0; } -void OptionsType::ReadPackFileName(CMString &filename, const CMString &name, const CMString &defaultFilename) +void OptionsType::ReadPackFileName(CMStringW &filename, const CMStringW &name, const CMStringW &defaultFilename) { - CMString settingKey = name + L"-filename"; + CMStringW settingKey = name + L"-filename"; - ptrW tszValue(db_get_tsa(NULL, "SmileyAdd", _T2A(settingKey.c_str()))); + ptrW tszValue(db_get_wsa(NULL, "SmileyAdd", _T2A(settingKey.c_str()))); filename = (tszValue != NULL) ? (wchar_t*)tszValue : defaultFilename; } -void OptionsType::WritePackFileName(const CMString &filename, const CMString &name) +void OptionsType::WritePackFileName(const CMStringW &filename, const CMStringW &name) { - CMString settingKey = name + L"-filename"; - db_set_ts(NULL, "SmileyAdd", _T2A(settingKey.c_str()), filename.c_str()); + CMStringW settingKey = name + L"-filename"; + db_set_ws(NULL, "SmileyAdd", _T2A(settingKey.c_str()), filename.c_str()); } -void OptionsType::ReadCustomCategories(CMString &cats) +void OptionsType::ReadCustomCategories(CMStringW &cats) { - ptrW tszValue(db_get_tsa(NULL, "SmileyAdd", "CustomCategories")); + ptrW tszValue(db_get_wsa(NULL, "SmileyAdd", "CustomCategories")); if (tszValue != NULL) cats = tszValue; } -void OptionsType::WriteCustomCategories(const CMString &cats) +void OptionsType::WriteCustomCategories(const CMStringW &cats) { if (cats.IsEmpty()) db_unset(NULL, "SmileyAdd", "CustomCategories"); else - db_set_ts(NULL, "SmileyAdd", "CustomCategories", cats.c_str()); + db_set_ws(NULL, "SmileyAdd", "CustomCategories", cats.c_str()); } -void OptionsType::ReadContactCategory(MCONTACT hContact, CMString &cats) +void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats) { - ptrW tszValue(db_get_tsa(hContact, "SmileyAdd", "CustomCategory")); + ptrW tszValue(db_get_wsa(hContact, "SmileyAdd", "CustomCategory")); if (tszValue != NULL) cats = tszValue; } -void OptionsType::WriteContactCategory(MCONTACT hContact, const CMString &cats) +void OptionsType::WriteContactCategory(MCONTACT hContact, const CMStringW &cats) { if (cats.IsEmpty()) db_unset(hContact, "SmileyAdd", "CustomCategory"); else - db_set_ts(hContact, "SmileyAdd", "CustomCategory", cats.c_str()); + db_set_ws(hContact, "SmileyAdd", "CustomCategory", cats.c_str()); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/SmileyAdd/src/options.h b/plugins/SmileyAdd/src/options.h index c4139f1131..adf6da53c8 100644 --- a/plugins/SmileyAdd/src/options.h +++ b/plugins/SmileyAdd/src/options.h @@ -48,12 +48,12 @@ public: void Load(void); void Save(void); - static void ReadPackFileName(CMString &filename, const CMString &name, const CMString &defaultFilename); - static void ReadCustomCategories(CMString &cats); - static void ReadContactCategory(MCONTACT hContact, CMString &cats); - static void WritePackFileName(const CMString &filename, const CMString &name); - static void WriteCustomCategories(const CMString &cats); - static void WriteContactCategory(MCONTACT hContact, const CMString &cats); + static void ReadPackFileName(CMStringW &filename, const CMStringW &name, const CMStringW &defaultFilename); + static void ReadCustomCategories(CMStringW &cats); + static void ReadContactCategory(MCONTACT hContact, CMStringW &cats); + static void WritePackFileName(const CMStringW &filename, const CMStringW &name); + static void WriteCustomCategories(const CMStringW &cats); + static void WriteContactCategory(MCONTACT hContact, const CMStringW &cats); }; extern OptionsType opt; diff --git a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp index 939e347afd..12c1c0d4bd 100644 --- a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp +++ b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp @@ -10,7 +10,7 @@ const int WCMatcher::MATCH_ENTIRE_STRING = 0x01; @version 1.07.00 */ -WCMatcher::WCMatcher(WCPattern *pattern, const CMString &text) +WCMatcher::WCMatcher(WCPattern *pattern, const CMStringW &text) { pat = pattern; str = &text; @@ -48,11 +48,11 @@ void WCMatcher::clearGroups() for (i = 1; i <= ncgc; ++i) groups[0 - i] = starts[0 - i] = ends[0 - i] = -1; } -CMString WCMatcher::replaceWithGroups(const CMString &pStr) +CMStringW WCMatcher::replaceWithGroups(const CMStringW &pStr) { - CMString ret; + CMStringW ret; - CMString t = pStr; + CMStringW t = pStr; while (t.GetLength() > 0) { if (t[0] == '\\') { t.Delete(0); @@ -86,7 +86,7 @@ unsigned long WCMatcher::getFlags() const return flags; } -const CMString& WCMatcher::getText() const +const CMStringW& WCMatcher::getText() const { return *str; } @@ -132,9 +132,9 @@ bool WCMatcher::findNextMatch() return ends[0] >= 0; } -std::vector WCMatcher::findAll() +std::vector WCMatcher::findAll() { - std::vector ret; + std::vector ret; reset(); while (findNextMatch()) ret.push_back(getGroup()); @@ -163,16 +163,16 @@ int WCMatcher::getEndingIndex(const int groupNum) const return ends[groupNum]; } -CMString WCMatcher::getGroup(const int groupNum) const +CMStringW WCMatcher::getGroup(const int groupNum) const { if (groupNum < 0 || groupNum >= gc) return L""; if (starts[groupNum] < 0 || ends[groupNum] < 0) return L""; return str->Mid(starts[groupNum], ends[groupNum] - starts[groupNum]); } -std::vector WCMatcher::getGroups(const bool includeGroupZero) const +std::vector WCMatcher::getGroups(const bool includeGroupZero) const { - std::vector ret; + std::vector ret; for (int i = (includeGroupZero ? 0 : 1); i < gc; ++i) ret.push_back(getGroup(i)); diff --git a/plugins/SmileyAdd/src/regexp/WCMatcher.h b/plugins/SmileyAdd/src/regexp/WCMatcher.h index 3c5df018d7..285a49c349 100644 --- a/plugins/SmileyAdd/src/regexp/WCMatcher.h +++ b/plugins/SmileyAdd/src/regexp/WCMatcher.h @@ -23,7 +23,7 @@ invocation looks like:
   wchar_t buf[10000];
-  CMString str = "\\5 (user name \\1) uses \\7 for his/her shell and \\6 is their home directory";
+  CMStringW str = "\\5 (user name \\1) uses \\7 for his/her shell and \\6 is their home directory";
   FILE * fp = fopen("/etc/passwd", "r");
   WCPattern::registerWCPattern("entry", "[^:]+");
   WCPattern * p = WCPattern::compile("^({entry}):({entry}):({entry}):({entry}):({entry}):({entry}):({entry})$",
@@ -92,24 +92,24 @@ class WCMatcher
       @param pattern  The pattern with which to search
       @param text     The text in which to search
      */
-    WCMatcher(WCPattern * pattern, const CMString & text);
+    WCMatcher(WCPattern *pattern, const CMStringW & ext);
   protected:
     /// The pattern we use to match
-    WCPattern * pat;
+    WCPattern *pat;
     /// The string in which we are matching
-    const CMString * str;
+    const CMStringW *str;
     /// The starting point of our match
     int start;
     /// An array of the starting positions for each group
-    int * starts;
+    int *starts;
     /// An array of the ending positions for each group
-    int * ends;
+    int *ends;
     /// An array of private data used by NFAUNodes during matching
-    int * groups;
+    int *groups;
     /// An array of private data used by NFAUNodes during matching
-    int * groupIndeces;
+    int *groupIndeces;
     /// An array of private data used by NFAUNodes during matching
-    int * groupPos;
+    int *groupPos;
     /// The ending index of the last match
     int lm;
     /// The number of capturing groups we have
@@ -135,7 +135,7 @@ class WCMatcher
       @param str The string in which to replace text
       @return A string with all backreferences appropriately replaced
      */
-    CMString replaceWithGroups(const CMString & str);
+    CMStringW replaceWithGroups(const CMStringW & str);
     /**
       The flags currently being used by the matcher.
       @return Zero
@@ -145,7 +145,7 @@ class WCMatcher
       The text being searched by the matcher.
       @return the text being searched by the matcher.
      */
-    const CMString& getText() const;
+    const CMStringW& getText() const;
 
     /**
       Scans the string from start to finish for a match. The entire string must
@@ -179,7 +179,7 @@ class WCMatcher
 
       @return Every substring in order which matches the given pattern
      */
-    std::vector findAll();
+    std::vector findAll();
     /**
       Resets the internal state of the matcher
      */
@@ -188,12 +188,12 @@ class WCMatcher
       Same as getText. Left n for backwards compatibilty with old source code
       @return Returns the string that is currently being used for matching
      */
-    inline const CMString&  getString()                           const { return *str; }
+    inline const CMStringW&  getString()                           const { return *str; }
     /**
       Sets the string to scan
       @param newStr The string to scan for subsequent matches
      */
-    inline void         setString(const CMString & newStr)       { str = &newStr; reset(); }
+    inline void         setString(const CMStringW & newStr)       { str = &newStr; reset(); }
 
     /**
       Returns the starting index of the specified group.
@@ -217,14 +217,14 @@ class WCMatcher
       @param groupNum The group to query
       @return The text of the group
      */
-    CMString getGroup(const int groupNum = 0) const;
+    CMStringW getGroup(const int groupNum = 0) const;
     /**
       Returns every capture group in a vector
 
       @param includeGroupZero Whether or not include capture group zero
       @return Every capture group
      */
-    std::vector getGroups(const bool includeGroupZero = 0) const;
+    std::vector getGroups(const bool includeGroupZero = 0) const;
 };
 
 #endif
diff --git a/plugins/SmileyAdd/src/regexp/WCPattern.cpp b/plugins/SmileyAdd/src/regexp/WCPattern.cpp
index 22a7b78847..2ce1a1b301 100644
--- a/plugins/SmileyAdd/src/regexp/WCPattern.cpp
+++ b/plugins/SmileyAdd/src/regexp/WCPattern.cpp
@@ -25,8 +25,8 @@
 
 #include "../stdafx.h"
 
-std::map WCPattern::compiledWCPatterns;
-std::map > WCPattern::registeredWCPatterns;
+std::map WCPattern::compiledWCPatterns;
+std::map > WCPattern::registeredWCPatterns;
 
 const int WCPattern::MIN_QMATCH = 0x00000000;
 const int WCPattern::MAX_QMATCH = 0x7FFFFFFF;
@@ -62,7 +62,7 @@ static inline int str_icmp(const wchar_t *a, const wchar_t *b)
 #define str_icmp wcscasecmp
 #endif
 
-WCPattern::WCPattern(const CMString &rhs)
+WCPattern::WCPattern(const CMStringW &rhs)
 {
 	matcher = NULL;
 	pattern = rhs;
@@ -85,29 +85,29 @@ NFAUNode *WCPattern::registerNode(NFAUNode *node)
 	return node;
 }
 
-CMString WCPattern::classUnion(CMString s1, CMString s2) const
+CMStringW WCPattern::classUnion(CMStringW s1, CMStringW s2) const
 {
 	wchar_t *out = new wchar_t[66000];
 	std::sort((LPTSTR)s1.GetString(), (LPTSTR)s1.GetTail());
 	std::sort((LPTSTR)s2.GetString(), (LPTSTR)s2.GetTail());
 	wchar_t *p = std::set_union(s1.GetString(), s1.GetTail(), s2.GetString(), s2.GetTail(), out); *p = 0;
-	CMString ret = out;
+	CMStringW ret = out;
 	delete[] out;
 	return ret;
 }
 
-CMString WCPattern::classIntersect(CMString s1, CMString s2) const
+CMStringW WCPattern::classIntersect(CMStringW s1, CMStringW s2) const
 {
 	wchar_t *out = new wchar_t[66000];
 	std::sort((LPTSTR)s1.GetString(), (LPTSTR)s1.GetTail());
 	std::sort((LPTSTR)s2.GetString(), (LPTSTR)s2.GetTail());
 	*std::set_intersection(s1.GetString(), s1.GetTail(), s2.GetString(), s2.GetTail(), out) = 0;
-	CMString ret = out;
+	CMStringW ret = out;
 	delete[] out;
 	return ret;
 }
 
-CMString WCPattern::classNegate(CMString s1) const
+CMStringW WCPattern::classNegate(CMStringW s1) const
 {
 	wchar_t *out = new wchar_t[66000];
 	int i, ind = 0;
@@ -116,18 +116,18 @@ CMString WCPattern::classNegate(CMString s1) const
 	for (i = 0; i < s1.GetLength(); ++i) m[s1[i]] = 1;
 	for (i = 0xFF; i >= 0; --i) if (m.find((wchar_t)i) == m.end()) out[ind++] = (wchar_t)i;
 	out[ind] = 0;
-	CMString ret(out, ind);
+	CMStringW ret(out, ind);
 	delete[] out;
 	return ret;
 }
 
-CMString WCPattern::classCreateRange(wchar_t low, wchar_t hi) const
+CMStringW WCPattern::classCreateRange(wchar_t low, wchar_t hi) const
 {
 	wchar_t out[300];
 	int ind = 0;
 	while (low != hi) out[ind++] = low++;
 	out[ind++] = low;
-	return CMString(out, ind);
+	return CMStringW(out, ind);
 }
 
 int WCPattern::getInt(int start, int end)
@@ -266,9 +266,9 @@ NFAUNode* WCPattern::quantify(NFAUNode *newNode)
 	return newNode;
 }
 
-CMString WCPattern::parseClass()
+CMStringW WCPattern::parseClass()
 {
-	CMString t, ret;
+	CMStringW t, ret;
 	wchar_t ch, c1, c2;
 	bool inv = 0, neg = 0, quo = 0;
 
@@ -364,9 +364,9 @@ CMString WCPattern::parseClass()
 	return ret;
 }
 
-CMString WCPattern::parsePosix()
+CMStringW WCPattern::parsePosix()
 {
-	CMString s7 = pattern.Mid(curInd, 7);
+	CMStringW s7 = pattern.Mid(curInd, 7);
 	if (s7 == L"{Lower}") { curInd += 7; return L"abcdefghijklmnopqrstuvwxyz"; }
 	if (s7 == L"{Upper}") { curInd += 7; return L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
 	if (s7 == L"{Alpha}") { curInd += 7; return L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
@@ -378,7 +378,7 @@ CMString WCPattern::parsePosix()
 	if (s7 == L"{Blank}") { curInd += 7; return L" \t"; }
 	if (s7 == L"{Space}") { curInd += 7; return L" \t\n\x0B\f\r"; }
 	if (s7 == L"{Cntrl}") {
-		CMString s(' ', 32 + 1);
+		CMStringW s(' ', 32 + 1);
 		for (int i = 0; i <= 0x1F; ++i)
 			s.SetAt(i, i);
 		s.SetAt(0x20, 0x7F);
@@ -386,7 +386,7 @@ CMString WCPattern::parsePosix()
 		return s;
 	}
 	if (s7 == L"{ASCII}") {
-		CMString s(' ', 0x80);
+		CMStringW s(' ', 0x80);
 		for (int i = 0; i <= 0x7f; ++i) s.SetAt(i, i);
 		curInd += 7;
 		return s;
@@ -422,7 +422,7 @@ NFAUNode* WCPattern::parseBackref()
 	#undef to_int
 }
 
-CMString WCPattern::parseOctal()
+CMStringW WCPattern::parseOctal()
 {
 	#define islowoc(x)  ((x) >= '0' && (x) <= '3')
 	#define isoc(x)     ((x) >= '0' && (x) <= '7')
@@ -431,7 +431,7 @@ CMString WCPattern::parseOctal()
 	wchar_t ch1 = (ci + 0 < pattern.GetLength()) ? pattern[ci + 0] : USHRT_MAX;
 	wchar_t ch2 = (ci + 1 < pattern.GetLength()) ? pattern[ci + 1] : USHRT_MAX;
 	wchar_t ch3 = (ci + 2 < pattern.GetLength()) ? pattern[ci + 2] : USHRT_MAX;
-	CMString s = L" ";
+	CMStringW s = L" ";
 
 	if (islowoc(ch1) && isoc(ch2)) {
 		curInd += 2;
@@ -453,7 +453,7 @@ CMString WCPattern::parseOctal()
 	#undef fromoc
 }
 
-CMString WCPattern::parseHex()
+CMStringW WCPattern::parseHex()
 {
 	#define to_low(x)   (((x) >= 'A' && (x) <= 'Z') ? ((x) - 'A' + 'a') : (x))
 	#define is_dig(x)   ((x) >= '0' && (x) <= '9')
@@ -465,7 +465,7 @@ CMString WCPattern::parseHex()
 	wchar_t ch2 = (ci + 1 < pattern.GetLength()) ? pattern[ci + 1] : USHRT_MAX;
 	wchar_t ch3 = (ci + 2 < pattern.GetLength()) ? pattern[ci + 2] : USHRT_MAX;
 	wchar_t ch4 = (ci + 3 < pattern.GetLength()) ? pattern[ci + 3] : USHRT_MAX;
-	CMString s = L" ";
+	CMStringW s = L" ";
 
 	if (is_hex(ch1) && is_hex(ch2) && is_hex(ch3) && is_hex(ch4)) {
 		curInd += 2;
@@ -484,10 +484,10 @@ CMString WCPattern::parseHex()
 	#undef to_int
 }
 
-CMString WCPattern::parseEscape(bool &inv, bool &quo)
+CMStringW WCPattern::parseEscape(bool &inv, bool &quo)
 {
 	wchar_t ch = pattern[curInd++];
-	CMString classes;
+	CMStringW classes;
 
 	if (curInd > pattern.GetLength()) {
 		raiseError();
@@ -530,7 +530,7 @@ CMString WCPattern::parseEscape(bool &inv, bool &quo)
 NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end)
 {
 	int i, j;
-	CMString s;
+	CMStringW s;
 	NFAUNode *ret = NULL;
 	for (i = curInd; i < pattern.GetLength() && pattern[i] != '}'; ++i) {}
 	if (pattern[i] != '}') { raiseError(); return NULL; }
@@ -555,7 +555,7 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end)
 	if (registeredWCPatterns.find(s) == registeredWCPatterns.end()) raiseError();
 	else {
 		unsigned long oflags = flags;
-		CMString op = pattern;
+		CMStringW op = pattern;
 		int ci = i + 1;
 
 		pattern = registeredWCPatterns[s].first;
@@ -577,7 +577,7 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end)
 // pattern must have a concrete length
 NFAUNode* WCPattern::parseBehind(const bool pos, NFAUNode **end)
 {
-	CMString t;
+	CMStringW t;
 	while (curInd < pattern.GetLength() && pattern[curInd] != ')') {
 		wchar_t ch = pattern[curInd++];
 		if (ch == '\\') {
@@ -597,7 +597,7 @@ NFAUNode* WCPattern::parseBehind(const bool pos, NFAUNode **end)
 NFAUNode* WCPattern::parseQuote()
 {
 	bool done = 0;
-	CMString s;
+	CMStringW s;
 
 	while (!done) {
 		if (curInd >= pattern.GetLength()) {
@@ -621,7 +621,7 @@ NFAUNode* WCPattern::parseQuote()
 NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end)
 {
 	NFAUNode *start, *cur, *next = NULL;
-	CMString t;
+	CMStringW t;
 	int grc = groupCount++;
 	bool inv, quo;
 	bool ahead = 0, pos = 0, noncap = 0, indep = 0;
@@ -747,13 +747,13 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end)
 		case '[':
 			if ((flags & WCPattern::CASE_INSENSITIVE) == 0) {
 				NFAClassUNode *clazz = new NFAClassUNode();
-				CMString s = parseClass();
+				CMStringW s = parseClass();
 				for (int i = 0; i < (int)s.GetLength(); ++i) clazz->vals[s[i]] = 1;
 				next = registerNode(clazz);
 			}
 			else {
 				NFACIClassUNode *clazz = new NFACIClassUNode();
-				CMString s = parseClass();
+				CMStringW s = parseClass();
 				for (int i = 0; i < s.GetLength(); ++i) clazz->vals[to_lower(s[i])] = 1;
 				next = registerNode(clazz);
 			}
@@ -845,7 +845,7 @@ NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end)
 	return start;
 }
 
-WCPattern* WCPattern::compile(const CMString &pattern, const unsigned long mode)
+WCPattern* WCPattern::compile(const CMStringW &pattern, const unsigned long mode)
 {
 	WCPattern *p = new WCPattern(pattern);
 	NFAUNode *end;
@@ -879,10 +879,10 @@ WCPattern* WCPattern::compile(const CMString &pattern, const unsigned long mode)
 	return p;
 }
 
-WCPattern* WCPattern::compileAndKeep(const CMString &pattern, const unsigned long mode)
+WCPattern* WCPattern::compileAndKeep(const CMStringW &pattern, const unsigned long mode)
 {
 	WCPattern *ret = NULL;
-	std::map::iterator it = compiledWCPatterns.find(pattern);
+	std::map::iterator it = compiledWCPatterns.find(pattern);
 	if (it != compiledWCPatterns.end())
 		ret = it->second;
 	else {
@@ -893,9 +893,9 @@ WCPattern* WCPattern::compileAndKeep(const CMString &pattern, const unsigned lon
 	return ret;
 }
 
-CMString WCPattern::replace(const CMString &pattern, const CMString &str, const CMString &replacementText, const unsigned long mode)
+CMStringW WCPattern::replace(const CMStringW &pattern, const CMStringW &str, const CMStringW &replacementText, const unsigned long mode)
 {
-	CMString ret;
+	CMStringW ret;
 	WCPattern *p = WCPattern::compile(pattern, mode);
 	if (p) {
 		ret = p->replace(str, replacementText);
@@ -904,9 +904,9 @@ CMString WCPattern::replace(const CMString &pattern, const CMString &str, const
 	return ret;
 }
 
-std::vector WCPattern::split(const CMString &pattern, const CMString &str, const bool keepEmptys, const unsigned long limit, const unsigned long mode)
+std::vector WCPattern::split(const CMStringW &pattern, const CMStringW &str, const bool keepEmptys, const unsigned long limit, const unsigned long mode)
 {
-	std::vector ret;
+	std::vector ret;
 	WCPattern *p = WCPattern::compile(pattern, mode);
 	if (p) {
 		ret = p->split(str, keepEmptys, limit);
@@ -915,9 +915,9 @@ std::vector WCPattern::split(const CMString &pattern, const CMString &
 	return ret;
 }
 
-std::vector WCPattern::findAll(const CMString &pattern, const CMString &str, const unsigned long mode)
+std::vector WCPattern::findAll(const CMStringW &pattern, const CMStringW &str, const unsigned long mode)
 {
-	std::vector ret;
+	std::vector ret;
 	WCPattern *p = WCPattern::compile(pattern, mode);
 	if (p) {
 		ret = p->findAll(str);
@@ -926,7 +926,7 @@ std::vector WCPattern::findAll(const CMString &pattern, const CMString
 	return ret;
 }
 
-bool WCPattern::matches(const CMString &pattern, const CMString &str, const unsigned long mode)
+bool WCPattern::matches(const CMStringW &pattern, const CMStringW &str, const unsigned long mode)
 {
 	bool ret = 0;
 	WCPattern *p = compile(pattern, mode);
@@ -938,7 +938,7 @@ bool WCPattern::matches(const CMString &pattern, const CMString &str, const unsi
 	return ret;
 }
 
-bool WCPattern::registerWCPattern(const CMString &name, const CMString &pattern, const unsigned long mode)
+bool WCPattern::registerWCPattern(const CMStringW &name, const CMStringW &pattern, const unsigned long mode)
 {
 	WCPattern *p = WCPattern::compile(pattern, mode);
 	if (!p)
@@ -956,17 +956,17 @@ void WCPattern::unregisterWCPatterns()
 
 void WCPattern::clearWCPatternCache()
 {
-	std::map::iterator it;
+	std::map::iterator it;
 	for (it = compiledWCPatterns.begin(); it != compiledWCPatterns.end(); ++it)
 		delete it->second;
 
 	compiledWCPatterns.clear();
 }
 
-std::pair  WCPattern::findNthMatch(const CMString &pattern, const CMString &str,
+std::pair  WCPattern::findNthMatch(const CMStringW &pattern, const CMStringW &str,
 	const int matchNum, const unsigned long mode)
 {
-	std::pair ret;
+	std::pair ret;
 	WCPattern *p = WCPattern::compile(pattern, mode);
 
 	ret.second = -1;
@@ -991,10 +991,10 @@ WCPattern::~WCPattern()
 		delete it->first;
 }
 
-CMString WCPattern::replace(const CMString &str, const CMString &replacementText)
+CMStringW WCPattern::replace(const CMStringW &str, const CMStringW &replacementText)
 {
 	int li = 0;
-	CMString ret;
+	CMStringW ret;
 
 	matcher->setString(str);
 	while (matcher->findNextMatch()) {
@@ -1007,11 +1007,11 @@ CMString WCPattern::replace(const CMString &str, const CMString &replacementText
 	return ret;
 }
 
-std::vector WCPattern::split(const CMString &str, const bool keepEmptys, const unsigned long limit)
+std::vector WCPattern::split(const CMStringW &str, const bool keepEmptys, const unsigned long limit)
 {
 	unsigned long lim = (limit == 0 ? MAX_QMATCH : limit);
 	int li = 0;
-	std::vector ret;
+	std::vector ret;
 
 	matcher->setString(str);
 
@@ -1031,13 +1031,13 @@ std::vector WCPattern::split(const CMString &str, const bool keepEmpty
 	return ret;
 }
 
-std::vector WCPattern::findAll(const CMString &str)
+std::vector WCPattern::findAll(const CMStringW &str)
 {
 	matcher->setString(str);
 	return matcher->findAll();
 }
 
-bool WCPattern::matches(const CMString &str)
+bool WCPattern::matches(const CMStringW &str)
 {
 	matcher->setString(str);
 	return matcher->matches();
@@ -1048,12 +1048,12 @@ unsigned long WCPattern::getFlags() const
 	return flags;
 }
 
-CMString WCPattern::getWCPattern() const
+CMStringW WCPattern::getWCPattern() const
 {
 	return pattern;
 }
 
-WCMatcher *WCPattern::createWCMatcher(const CMString &str)
+WCMatcher *WCPattern::createWCMatcher(const CMStringW &str)
 {
 	return new WCMatcher(this, str);
 }
@@ -1072,7 +1072,7 @@ void NFAUNode::findAllNodes(std::map &soFar)
 // NFACharUNode
 
 NFACharUNode::NFACharUNode(const wchar_t c) { ch = c; }
-int NFACharUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACharUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd < str.GetLength() && str[curInd] == ch)
 		return next->match(str, matcher, curInd + 1);
@@ -1082,7 +1082,7 @@ int NFACharUNode::match(const CMString &str, WCMatcher *matcher, const int curIn
 // NFACICharUNode
 
 NFACICharUNode::NFACICharUNode(const wchar_t c) { ch = to_lower(c); }
-int NFACICharUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACICharUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd < str.GetLength() && to_lower(str[curInd]) == ch)
 		return next->match(str, matcher, curInd + 1);
@@ -1092,7 +1092,7 @@ int NFACICharUNode::match(const CMString &str, WCMatcher *matcher, const int cur
 // NFAStartUNode
 
 NFAStartUNode::NFAStartUNode() {}
-int NFAStartUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAStartUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int ret = -1, ci = curInd;
 
@@ -1118,7 +1118,7 @@ int NFAStartUNode::match(const CMString &str, WCMatcher *matcher, const int curI
 // NFAEndUNode
 
 NFAEndUNode::NFAEndUNode() {}
-int NFAEndUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	matcher->ends[0] = curInd;
 	if ((matcher->getFlags() & WCMatcher::MATCH_ENTIRE_STRING) != 0) {
@@ -1147,7 +1147,7 @@ NFAQuantifierUNode::NFAQuantifierUNode(WCPattern *pat, NFAUNode *internal, const
 	max = (maxMatch > WCPattern::MAX_QMATCH) ? WCPattern::MAX_QMATCH : maxMatch;
 }
 
-int NFAQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int i0, i1, i2 = 0;
 
@@ -1168,14 +1168,14 @@ NFAGreedyQuantifierUNode::NFAGreedyQuantifierUNode(WCPattern *pat, NFAUNode *int
 {
 }
 
-int NFAGreedyQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGreedyQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int t = NFAQuantifierUNode::match(str, matcher, curInd);
 	if (t != -1) return matchInternal(str, matcher, t, min);
 	return t;
 }
 
-int NFAGreedyQuantifierUNode::matchInternal(const CMString &str, WCMatcher *matcher, const int curInd, const int soFar) const
+int NFAGreedyQuantifierUNode::matchInternal(const CMStringW &str, WCMatcher *matcher, const int curInd, const int soFar) const
 {
 	if (soFar >= max)
 		return next->match(str, matcher, curInd);
@@ -1196,7 +1196,7 @@ NFALazyQuantifierUNode::NFALazyQuantifierUNode(WCPattern *pat, NFAUNode *interna
 {
 }
 
-int NFALazyQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFALazyQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int m = NFAQuantifierUNode::match(str, matcher, curInd);
 	if (m == -1)
@@ -1225,7 +1225,7 @@ NFAPossessiveQuantifierUNode::NFAPossessiveQuantifierUNode(WCPattern *pat, NFAUN
 {
 }
 
-int NFAPossessiveQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAPossessiveQuantifierUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int m = NFAQuantifierUNode::match(str, matcher, curInd);
 	if (m == -1)
@@ -1246,7 +1246,7 @@ NFAAcceptUNode::NFAAcceptUNode()
 {
 }
 
-int NFAAcceptUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAAcceptUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (!next) return curInd;
 	else return next->match(str, matcher, curInd);
@@ -1259,14 +1259,14 @@ NFAClassUNode::NFAClassUNode(const bool invert)
 	inv = invert;
 }
 
-NFAClassUNode::NFAClassUNode(const CMString &clazz, const bool invert)
+NFAClassUNode::NFAClassUNode(const CMStringW &clazz, const bool invert)
 {
 	inv = invert;
 	for (int i = 0; i < clazz.GetLength(); ++i)
 		vals[clazz[i]] = 1;
 }
 
-int NFAClassUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAClassUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd < str.GetLength() && ((vals.find(str[curInd]) != vals.end()) ^ inv)) {
 		return next->match(str, matcher, curInd + 1);
@@ -1281,14 +1281,14 @@ NFACIClassUNode::NFACIClassUNode(const bool invert)
 	inv = invert;
 }
 
-NFACIClassUNode::NFACIClassUNode(const CMString &clazz, const bool invert)
+NFACIClassUNode::NFACIClassUNode(const CMStringW &clazz, const bool invert)
 {
 	inv = invert;
 	for (int i = 0; i < (int)clazz.GetLength(); ++i)
 		vals[to_lower(clazz[i])] = 1;
 }
 
-int NFACIClassUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACIClassUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd < str.GetLength() && ((vals.find(to_lower(str[curInd])) != vals.end()) ^ inv))
 		return next->match(str, matcher, curInd + 1);
@@ -1302,7 +1302,7 @@ NFASubStartUNode::NFASubStartUNode()
 {
 }
 
-int NFASubStartUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFASubStartUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	return next->match(str, matcher, curInd);
 }
@@ -1320,7 +1320,7 @@ void NFAOrUNode::findAllNodes(std::map &soFar)
 	if (two) two->findAllNodes(soFar);
 	NFAUNode::findAllNodes(soFar);
 }
-int NFAOrUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAOrUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int ci = one->match(str, matcher, curInd);
 
@@ -1333,12 +1333,12 @@ int NFAOrUNode::match(const CMString &str, WCMatcher *matcher, const int curInd)
 
 // NFAQuoteUNode
 
-NFAQuoteUNode::NFAQuoteUNode(const CMString "ed) :
+NFAQuoteUNode::NFAQuoteUNode(const CMStringW "ed) :
 	qStr(quoted)
 {
 }
 
-int NFAQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAQuoteUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd + qStr.GetLength() > str.GetLength()) return -1;
 	if (str.Mid(curInd, qStr.GetLength()) != qStr) return -1;
@@ -1347,12 +1347,12 @@ int NFAQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curI
 
 // NFACIQuoteUNode
 
-NFACIQuoteUNode::NFACIQuoteUNode(const CMString "ed) :
+NFACIQuoteUNode::NFACIQuoteUNode(const CMStringW "ed) :
 	qStr(quoted)
 {
 }
 
-int NFACIQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFACIQuoteUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd + qStr.GetLength() > str.GetLength()) return -1;
 	if (str_icmp(str.Mid(curInd, qStr.GetLength()).c_str(), qStr.c_str())) return -1;
@@ -1372,19 +1372,19 @@ void NFALookAheadUNode::findAllNodes(std::map &soFar)
 	NFAUNode::findAllNodes(soFar);
 }
 
-int NFALookAheadUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFALookAheadUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	return ((inner->match(str, matcher, curInd) == -1) ^ pos) ? next->match(str, matcher, curInd) : -1;
 }
 
 // NFALookBehindUNode
 
-NFALookBehindUNode::NFALookBehindUNode(const CMString &str, const bool positive) :
+NFALookBehindUNode::NFALookBehindUNode(const CMStringW &str, const bool positive) :
 	pos(positive), mStr(str)
 {
 }
 
-int NFALookBehindUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFALookBehindUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (pos) {
 		if (curInd < mStr.GetLength())
@@ -1408,7 +1408,7 @@ NFAStartOfLineUNode::NFAStartOfLineUNode()
 {
 }
 
-int NFAStartOfLineUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAStartOfLineUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd == 0 || str[curInd - 1] == '\n' || str[curInd - 1] == '\r')
 		return next->match(str, matcher, curInd);
@@ -1422,7 +1422,7 @@ NFAEndOfLineUNode::NFAEndOfLineUNode()
 {
 }
 
-int NFAEndOfLineUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndOfLineUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd >= str.GetLength() || str[curInd] == '\n' || str[curInd] == '\r')
 		return next->match(str, matcher, curInd);
@@ -1437,7 +1437,7 @@ NFAReferenceUNode::NFAReferenceUNode(const int groupIndex) :
 {
 }
 
-int NFAReferenceUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAReferenceUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int len = matcher->ends[gi] - matcher->starts[gi];
 	int ni = -1;
@@ -1455,7 +1455,7 @@ NFAStartOfInputUNode::NFAStartOfInputUNode()
 {
 }
 
-int NFAStartOfInputUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAStartOfInputUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd == 0) return next->match(str, matcher, curInd);
 	return -1;
@@ -1468,7 +1468,7 @@ NFAEndOfInputUNode::NFAEndOfInputUNode(const bool lookForTerm) :
 {
 }
 
-int NFAEndOfInputUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndOfInputUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int len = str.GetLength();
 	if (curInd == len) return next->match(str, matcher, curInd);
@@ -1490,7 +1490,7 @@ NFAWordBoundaryUNode::NFAWordBoundaryUNode(const bool positive) :
 {
 }
 
-int NFAWordBoundaryUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAWordBoundaryUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int len = str.GetLength();
 
@@ -1509,7 +1509,7 @@ NFAEndOfMatchUNode::NFAEndOfMatchUNode()
 {
 }
 
-int NFAEndOfMatchUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAEndOfMatchUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	if (curInd == matcher->lm) return next->match(str, matcher, curInd);
 	return -1;
@@ -1522,7 +1522,7 @@ NFAGroupHeadUNode::NFAGroupHeadUNode(const int groupIndex) :
 {
 }
 
-int NFAGroupHeadUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupHeadUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int ret, o = matcher->starts[gi];
 
@@ -1540,7 +1540,7 @@ NFAGroupTailUNode::NFAGroupTailUNode(const int groupIndex) :
 {
 }
 
-int NFAGroupTailUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupTailUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int ret, o = matcher->ends[gi];
 
@@ -1558,7 +1558,7 @@ NFAGroupLoopPrologueUNode::NFAGroupLoopPrologueUNode(const int groupIndex) :
 {
 }
 
-int NFAGroupLoopPrologueUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopPrologueUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int ret, o1 = matcher->groups[gi], o2 = matcher->groupPos[gi], o3 = matcher->groupIndeces[gi];
 
@@ -1593,7 +1593,7 @@ void NFAGroupLoopUNode::findAllNodes(std::map &soFar)
 	NFAUNode::findAllNodes(soFar);
 }
 
-int NFAGroupLoopUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::match(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	bool b = (curInd > matcher->groupIndeces[gi]);
 
@@ -1621,7 +1621,7 @@ int NFAGroupLoopUNode::match(const CMString &str, WCMatcher *matcher, const int
 	return -1;
 }
 
-int NFAGroupLoopUNode::matchGreedy(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::matchGreedy(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int o = matcher->groupIndeces[gi];            // save our info for backtracking
 	matcher->groupIndeces[gi] = curInd;           // move along
@@ -1635,7 +1635,7 @@ int NFAGroupLoopUNode::matchGreedy(const CMString &str, WCMatcher *matcher, cons
 	return ret;
 }
 
-int NFAGroupLoopUNode::matchLazy(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::matchLazy(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int ret = next->match(str, matcher, curInd);  // be lazy, just go on
 	if (ret < 0) {
@@ -1652,7 +1652,7 @@ int NFAGroupLoopUNode::matchLazy(const CMString &str, WCMatcher *matcher, const
 	return ret;
 }
 
-int NFAGroupLoopUNode::matchPossessive(const CMString &str, WCMatcher *matcher, const int curInd) const
+int NFAGroupLoopUNode::matchPossessive(const CMStringW &str, WCMatcher *matcher, const int curInd) const
 {
 	int o = matcher->groupIndeces[gi];            // save info for backtracking
 	matcher->groupPos[gi] = matcher->groups[gi];  // set a flag stating we have matcher at least this much
diff --git a/plugins/SmileyAdd/src/regexp/WCPattern.h b/plugins/SmileyAdd/src/regexp/WCPattern.h
index e3455e8b31..d45f734645 100644
--- a/plugins/SmileyAdd/src/regexp/WCPattern.h
+++ b/plugins/SmileyAdd/src/regexp/WCPattern.h
@@ -974,19 +974,19 @@ private:
 	  @param rhs The pattern to compile
 	  @memo Creates a new pattern from the regular expression in rhs.
 	  */
-	WCPattern(const CMString & rhs);
+	WCPattern(const CMStringW &rhs);
 protected:
 	/**
 	  This currently is not used, so don't try to do anything with it.
 	  @memo Holds all the compiled patterns for quick access.
 	  */
-	static std::map compiledWCPatterns;
+	static std::map compiledWCPatterns;
 	/**
 	  Holds all of the registered patterns as strings. Due to certain problems
 	  with compilation of patterns, especially with capturing groups, this seemed
 	  to be the best way to do it.
 	  */
-	static std::map > registeredWCPatterns;
+	static std::map > registeredWCPatterns;
 protected:
 	/**
 	  Holds all the NFA nodes used. This makes deletion of a pattern, as well as
@@ -1006,7 +1006,7 @@ protected:
 	/**
 	  The actual regular expression we rerpesent
 	  */
-	CMString pattern;
+	CMStringW pattern;
 	/**
 	  Flag used during compilation. Once the pattern is successfully compiled,
 	  error is no longer used.
@@ -1052,7 +1052,7 @@ protected:
 	  must have appeared in one or both of s1 and
 	  s2.
 	  */
-	CMString classUnion(CMString s1, CMString s2)  const;
+	CMStringW classUnion(CMStringW s1, CMStringW s2)  const;
 	/**
 	  Calculates the intersection of two strings. This function will first sort
 	  the strings and then use a simple selection algorithm to find the
@@ -1062,7 +1062,7 @@ protected:
 	  @return A new string containing all unique characters. Each character
 	  must have appeared both s1 and s2.
 	  */
-	CMString classIntersect(CMString s1, CMString s2)  const;
+	CMStringW classIntersect(CMStringW s1, CMStringW s2)  const;
 	/**
 	  Calculates the negation of a string. The negation is the set of all
 	  characters between \x00 and \xFF not
@@ -1072,7 +1072,7 @@ protected:
 	  @return A new string containing all unique characters. Each character
 	  must have appeared both s1 and s2.
 	  */
-	CMString classNegate(CMString s1)                  const;
+	CMStringW classNegate(CMStringW s1)                  const;
 	/**
 	  Creates a new "class" representing the range from low thru
 	  hi. This function will wrap if low >
@@ -1082,7 +1082,7 @@ protected:
 	  @param hi  The ending character
 	  @return A new string containing all the characters from low thru hi.
 	  */
-	CMString classCreateRange(wchar_t low, wchar_t hi)         const;
+	CMStringW classCreateRange(wchar_t low, wchar_t hi)         const;
 
 	/**
 	  Extracts a decimal number from the substring of member-variable
@@ -1132,24 +1132,24 @@ protected:
 	  @return A string of unique characters contained in the current class being
 	  parsed
 	  */
-	CMString parseClass();
+	CMStringW parseClass();
 	/**
 	  Parses the current POSIX class being examined in
 	  {@link pattern pattern}.
 	  @return A string of unique characters representing the POSIX class being
 	  parsed
 	  */
-	CMString parsePosix();
+	CMStringW parsePosix();
 	/**
 	  Returns a string containing the octal character being parsed
 	  @return The string contained the octal value being parsed
 	  */
-	CMString parseOctal();
+	CMStringW parseOctal();
 	/**
 	  Returns a string containing the hex character being parsed
 	  @return The string contained the hex value being parsed
 	  */
-	CMString parseHex();
+	CMStringW parseHex();
 	/**
 	  Returns a new node representing the back reference being parsed
 	  @return The new node representing the back reference being parsed
@@ -1164,7 +1164,7 @@ protected:
 	  quotation.
 	  @return The characters represented by the class
 	  */
-	CMString parseEscape(bool & inv, bool & quo);
+	CMStringW parseEscape(bool & inv, bool & quo);
 	/**
 	  Parses a supposed registered pattern currently under compilation. If the
 	  sequence of characters does point to a registered pattern, then the
@@ -1228,7 +1228,7 @@ public:
 	  pointer. Upon failure, compile returns
 	  NULL
 	  */
-	static WCPattern                    * compile(const CMString & pattern,
+	static WCPattern                    * compile(const CMStringW & pattern,
 		const unsigned long mode = 0);
 	/**
 	  Dont use this function. This function will compile a pattern, and cache
@@ -1243,7 +1243,7 @@ public:
 	  WCPattern pointer. Upon failure, compile
 	  returns NULL.
 	  */
-	static WCPattern                    * compileAndKeep(const CMString & pattern,
+	static WCPattern                    * compileAndKeep(const CMStringW & pattern,
 		const unsigned long mode = 0);
 
 	/**
@@ -1265,9 +1265,9 @@ public:
 	  during the replacement process
 	  @return The text with the replacement string substituted where necessary
 	  */
-	static CMString                  replace(const CMString & pattern,
-		const CMString & str,
-		const CMString & replacementText,
+	static CMStringW                  replace(const CMStringW & pattern,
+		const CMStringW & str,
+		const CMStringW & replacementText,
 		const unsigned long mode = 0);
 
 	/**
@@ -1276,12 +1276,12 @@ public:
 	  configurable. A typical invocation looks like:
 	  

- CMString str(strSize, 0);
+ CMStringW str(strSize, 0);
FILE * fp = fopen(fileName, "r");
fread((char*)str.data(), strSize * 2, 1, fp);
fclose(fp);

- std::vector<CMString> lines = WCPattern::split(L"[\r\n]+", str, true);
+ std::vector<CMStringW> lines = WCPattern::split(L"[\r\n]+", str, true);

@@ -1293,8 +1293,8 @@ public: during the split process @return All substrings of str split across pattern. */ - static std::vector split(const CMString & pattern, - const CMString & str, + static std::vector split(const CMStringW & pattern, + const CMStringW & str, const bool keepEmptys = 0, const unsigned long limit = 0, const unsigned long mode = 0); @@ -1317,8 +1317,8 @@ public: during the find process @return All instances of pattern in str */ - static std::vector findAll(const CMString & pattern, - const CMString & str, + static std::vector findAll(const CMStringW & pattern, + const CMStringW & str, const unsigned long mode = 0); /** @@ -1330,8 +1330,8 @@ public: during the replacement process @return True if str is recognized by pattern */ - static bool matches(const CMString & pattern, - const CMString & str, + static bool matches(const CMStringW & pattern, + const CMStringW & str, const unsigned long mode = 0); /** @@ -1353,8 +1353,8 @@ public: @return Success/Failure. Fails only if pattern has invalid syntax */ - static bool registerWCPattern(const CMString & name, - const CMString & pattern, + static bool registerWCPattern(const CMStringW & name, + const CMStringW & pattern, const unsigned long mode = 0); /** @@ -1372,7 +1372,7 @@ public: A typical invocation looks like this:

- std::pair<CMString, int> match = WCPattern::findNthMatch(L"\\d{1,3}", L"192.168.1.101:22", 1);
+ std::pair<CMStringW, int> match = WCPattern::findNthMatch(L"\\d{1,3}", L"192.168.1.101:22", 1);
wprintf(L"%s %i\n", match.first.c_str(), match.second);

Output: 168 4
@@ -1387,8 +1387,8 @@ public: str. You can check for success/failure by making sure that the integer returned is greater than or equal to zero. */ - static std::pair findNthMatch(const CMString & pattern, - const CMString & str, + static std::pair findNthMatch(const CMStringW & pattern, + const CMStringW & str, const int matchNum, const unsigned long mode = 0); public: @@ -1397,12 +1397,12 @@ public: */ ~WCPattern(); - CMString replace(const CMString & str, - const CMString & replacementText); - std::vector split(const CMString & str, const bool keepEmptys = 0, + CMStringW replace(const CMStringW & str, + const CMStringW & replacementText); + std::vector split(const CMStringW & str, const bool keepEmptys = 0, const unsigned long limit = 0); - std::vector findAll(const CMString & str); - bool matches(const CMString & str); + std::vector findAll(const CMStringW & str); + bool matches(const CMStringW & str); /** Returns the flags used during compilation of this pattern @return The flags used during compilation of this pattern @@ -1412,14 +1412,14 @@ public: Returns the regular expression this pattern represents @return The regular expression this pattern represents */ - CMString getWCPattern() const; + CMStringW getWCPattern() const; /** Creates a matcher object using the specified string and this pattern. @param str The string to match against @return A new matcher using object using this pattern and the specified string */ - WCMatcher * createWCMatcher(const CMString & str); + WCMatcher * createWCMatcher(const CMStringW & str); }; class NFAUNode @@ -1430,7 +1430,7 @@ public: NFAUNode(); virtual ~NFAUNode(); virtual void findAllNodes(std::map & soFar); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const = 0; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const = 0; inline virtual bool isGroupHeadNode() const { return false; } inline virtual bool isStartOfInputNode() const { return false; } }; @@ -1440,7 +1440,7 @@ protected: wchar_t ch; public: NFACharUNode(const wchar_t c); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFACICharUNode : public NFAUNode { @@ -1448,19 +1448,19 @@ protected: wchar_t ch; public: NFACICharUNode(const wchar_t c); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAStartUNode : public NFAUNode { public: NFAStartUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAEndUNode : public NFAUNode { public: NFAEndUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAQuantifierUNode : public NFAUNode { @@ -1471,7 +1471,7 @@ public: NFAQuantifierUNode(WCPattern * pat, NFAUNode * internal, const int minMatch = WCPattern::MIN_QMATCH, const int maxMatch = WCPattern::MAX_QMATCH); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAGreedyQuantifierUNode : public NFAQuantifierUNode { @@ -1479,8 +1479,8 @@ public: NFAGreedyQuantifierUNode(WCPattern * pat, NFAUNode * internal, const int minMatch = WCPattern::MIN_QMATCH, const int maxMatch = WCPattern::MAX_QMATCH); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; - virtual int matchInternal(const CMString & str, WCMatcher * matcher, const int curInd, const int soFar) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int matchInternal(const CMStringW & str, WCMatcher * matcher, const int curInd, const int soFar) const; }; class NFALazyQuantifierUNode : public NFAQuantifierUNode { @@ -1488,7 +1488,7 @@ public: NFALazyQuantifierUNode(WCPattern * pat, NFAUNode * internal, const int minMatch = WCPattern::MIN_QMATCH, const int maxMatch = WCPattern::MAX_QMATCH); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAPossessiveQuantifierUNode : public NFAQuantifierUNode { @@ -1496,13 +1496,13 @@ public: NFAPossessiveQuantifierUNode(WCPattern * pat, NFAUNode * internal, const int minMatch = WCPattern::MIN_QMATCH, const int maxMatch = WCPattern::MAX_QMATCH); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAAcceptUNode : public NFAUNode { public: NFAAcceptUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAClassUNode : public NFAUNode { @@ -1510,8 +1510,8 @@ public: bool inv; std::map vals; NFAClassUNode(const bool invert = 0); - NFAClassUNode(const CMString & clazz, const bool invert); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + NFAClassUNode(const CMStringW & clazz, const bool invert); + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFACIClassUNode : public NFAUNode { @@ -1519,14 +1519,14 @@ public: bool inv; std::map vals; NFACIClassUNode(const bool invert = 0); - NFACIClassUNode(const CMString & clazz, const bool invert); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + NFACIClassUNode(const CMStringW & clazz, const bool invert); + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFASubStartUNode : public NFAUNode { public: NFASubStartUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAOrUNode : public NFAUNode { @@ -1535,21 +1535,21 @@ public: NFAUNode * two; NFAOrUNode(NFAUNode * first, NFAUNode * second); virtual void findAllNodes(std::map & soFar); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAQuoteUNode : public NFAUNode { public: - CMString qStr; - NFAQuoteUNode(const CMString & quoted); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + CMStringW qStr; + NFAQuoteUNode(const CMStringW & quoted); + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFACIQuoteUNode : public NFAUNode { public: - CMString qStr; - NFACIQuoteUNode(const CMString & quoted); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + CMStringW qStr; + NFACIQuoteUNode(const CMStringW & quoted); + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFALookAheadUNode : public NFAUNode { @@ -1558,40 +1558,40 @@ public: NFAUNode * inner; NFALookAheadUNode(NFAUNode * internal, const bool positive); virtual void findAllNodes(std::map & soFar); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFALookBehindUNode : public NFAUNode { public: bool pos; - CMString mStr; - NFALookBehindUNode(const CMString & str, const bool positive); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + CMStringW mStr; + NFALookBehindUNode(const CMStringW & str, const bool positive); + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAStartOfLineUNode : public NFAUNode { public: NFAStartOfLineUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAEndOfLineUNode : public NFAUNode { public: NFAEndOfLineUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAReferenceUNode : public NFAUNode { public: int gi; NFAReferenceUNode(const int groupIndex); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAStartOfInputUNode : public NFAUNode { public: NFAStartOfInputUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; inline virtual bool isStartOfInputNode() const { return false; } }; class NFAEndOfInputUNode : public NFAUNode @@ -1599,27 +1599,27 @@ class NFAEndOfInputUNode : public NFAUNode public: bool term; NFAEndOfInputUNode(const bool lookForTerm); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAWordBoundaryUNode : public NFAUNode { public: bool pos; NFAWordBoundaryUNode(const bool positive); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAEndOfMatchUNode : public NFAUNode { public: NFAEndOfMatchUNode(); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAGroupHeadUNode : public NFAUNode { public: int gi; NFAGroupHeadUNode(const int groupIndex); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; inline virtual bool isGroupHeadNode() const { return false; } }; class NFAGroupTailUNode : public NFAUNode @@ -1627,14 +1627,14 @@ class NFAGroupTailUNode : public NFAUNode public: int gi; NFAGroupTailUNode(const int groupIndex); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAGroupLoopPrologueUNode : public NFAUNode { public: int gi; NFAGroupLoopPrologueUNode(const int groupIndex); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; class NFAGroupLoopUNode : public NFAUNode { @@ -1644,10 +1644,10 @@ public: NFAGroupLoopUNode(NFAUNode * internal, const int minMatch, const int maxMatch, const int groupIndex, const int matchType); virtual void findAllNodes(std::map & soFar); - virtual int match(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; - int matchGreedy(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; - int matchLazy(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; - int matchPossessive(const CMString & str, WCMatcher * matcher, const int curInd = 0) const; + virtual int match(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; + int matchGreedy(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; + int matchLazy(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; + int matchPossessive(const CMStringW & str, WCMatcher * matcher, const int curInd = 0) const; }; #endif diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 1abad18364..84e0034737 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -33,7 +33,7 @@ SmileyPackType* GetSmileyPack(const char *proto, MCONTACT hContact, SmileyPackCT if (proto != NULL && IsBadStringPtrA(proto, 10)) return NULL; - CMString categoryName; + CMStringW categoryName; if (hContact != NULL) { opt.ReadContactCategory(hContact, categoryName); if (categoryName == L"") return NULL; @@ -46,15 +46,15 @@ SmileyPackType* GetSmileyPack(const char *proto, MCONTACT hContact, SmileyPackCT char *protonam = GetContactProto(hContact); if (protonam != NULL) { DBVARIANT dbv; - if (db_get_ts(hContact, protonam, "Transport", &dbv) == 0) { + if (db_get_ws(hContact, protonam, "Transport", &dbv) == 0) { categoryName = dbv.ptszVal; db_free(&dbv); } - else if (opt.UsePhysProto && db_get_ts(NULL, protonam, "AM_BaseProto", &dbv) == 0) { + else if (opt.UsePhysProto && db_get_ws(NULL, protonam, "AM_BaseProto", &dbv) == 0) { categoryName = L"AllProto"; categoryName += dbv.ptszVal; db_free(&dbv); - CMString categoryFileName = g_SmileyCategories.GetSmileyCategory(categoryName) ? g_SmileyCategories.GetSmileyCategory(categoryName)->GetFilename() : L""; + CMStringW categoryFileName = g_SmileyCategories.GetSmileyCategory(categoryName) ? g_SmileyCategories.GetSmileyCategory(categoryName)->GetFilename() : L""; if (categoryFileName.IsEmpty()) categoryName = _A2T(protonam); } @@ -235,8 +235,8 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam) if (IsBadStringPtrA(smre->name, 50) || IsBadStringPtrA(smre->dispname, 50)) return FALSE; - CMString nmd(_A2T(smre->dispname)); - CMString nm(_A2T(smre->name)); + CMStringW nmd(_A2T(smre->dispname)); + CMStringW nm(_A2T(smre->name)); g_SmileyCategories.AddAndLoad(nm, nmd); return TRUE; @@ -249,7 +249,7 @@ INT_PTR CustomCatMenu(WPARAM hContact, LPARAM lParam) if (smct != NULL) opt.WriteContactCategory(hContact, smct->GetName()); else { - CMString empty; + CMStringW empty; if (lParam == 1) empty = L""; opt.WriteContactCategory(hContact, empty); } @@ -284,12 +284,12 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) menuHandleArray.destroy(); if (haveMenu) { - CMString cat; + CMStringW cat; opt.ReadContactCategory(wParam, cat); CMenuItem mi; mi.root = hContactMenuItem; - mi.flags = CMIF_TCHAR | CMIF_SYSTEM; + mi.flags = CMIF_UNICODE | CMIF_SYSTEM; mi.pszService = MS_SMILEYADD_CUSTOMCATMENU; bool nonecheck = true; @@ -340,7 +340,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) INT_PTR ReloadPack(WPARAM, LPARAM lParam) { if (lParam) { - CMString categoryName = _A2T((char*)lParam); + CMStringW categoryName = _A2T((char*)lParam); SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(categoryName); if (smc != NULL) smc->Load(); @@ -382,15 +382,15 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) switch (wParam) { case PRAC_ADDED: if (acc != NULL) { - CMString catname(L"Standard"); - const CMString &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename(); + CMStringW catname(L"Standard"); + const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename(); g_SmileyCategories.AddAccountAsCategory(acc, defaultFile); } break; case PRAC_CHANGED: if (acc != NULL && acc->szModuleName != NULL) { - CMString name(_A2T(acc->szModuleName)); + CMStringW name(_A2T(acc->szModuleName)); SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(name); if (smc != NULL) { if (acc->tszAccountName) name = acc->tszAccountName; @@ -406,8 +406,8 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) case PRAC_CHECKED: if (acc != NULL) { if (acc->bIsEnabled) { - CMString catname(L"Standard"); - const CMString &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename(); + CMStringW catname(L"Standard"); + const CMStringW &defaultFile = g_SmileyCategories.GetSmileyCategory(catname)->GetFilename(); g_SmileyCategories.AddAccountAsCategory(acc, defaultFile); } else g_SmileyCategories.DeleteAccountAsCategory(acc); @@ -427,7 +427,7 @@ int DbSettingChanged(WPARAM hContact, LPARAM lParam) return 0; if (strcmp(cws->szSetting, "Transport") == 0) { - CMString catname(L"Standard"); + CMStringW catname(L"Standard"); SmileyCategoryType *smc = g_SmileyCategories.GetSmileyCategory(catname); if (smc != NULL) g_SmileyCategories.AddContactTransportAsCategory(hContact, smc->GetFilename()); diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp index e6d7dfd7ed..a56be87b9f 100644 --- a/plugins/SmileyAdd/src/smileyroutines.cpp +++ b/plugins/SmileyAdd/src/smileyroutines.cpp @@ -49,7 +49,7 @@ void LookupAllSmileys(SmileyPackType *smileyPack, SmileyPackCType *smileyCPack, SmileyLookup::SmileyLocVecType *smileys = new SmileyLookup::SmileyLocVecType [smlsz]; // Find all possible smileys - CMString tmpstr(lpstrText); + CMStringW tmpstr(lpstrText); int i = 0; if (sml) diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 213e8307d0..e0bb7d8287 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -143,12 +143,12 @@ bool SmileyType::LoadFromImage(IStream *pStream) if (m_xepimg) m_xepimg->Release(); - CMString name; + CMStringW name; m_xepimg = new ImageType(0, name, pStream); return true; } -bool SmileyType::LoadFromResource(const CMString &file, const int index) +bool SmileyType::LoadFromResource(const CMStringW &file, const int index) { m_index = index; m_filepath = file; @@ -226,9 +226,9 @@ void SmileyType::CallSmileyService(MCONTACT hContact) _TMatcher *m0 = srvsplit->createTMatcher(GetTriggerText()); m0->findFirstMatch(); - CMString name = m0->getGroup(1); - CMString par1 = m0->getGroup(2); - CMString par2 = m0->getGroup(3); + CMStringW name = m0->getGroup(1); + CMStringW par1 = m0->getGroup(2); + CMStringW par2 = m0->getGroup(3); delete m0; delete srvsplit; @@ -262,7 +262,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) { _TPattern *p = _TPattern::compile(L"\\s+"); { - CMString emptystr; + CMStringW emptystr; m_SmileyLookup.insert(new SmileyLookup(urlRegEx, true, -1, emptystr)); m_SmileyLookup.insert(new SmileyLookup(pathRegEx, true, -1, emptystr)); m_SmileyLookup.insert(new SmileyLookup(timeRegEx, true, -1, emptystr)); @@ -285,7 +285,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) while (m0->findNextMatch()) { int stind = m0->getStartingIndex(); if (li != stind) { - CMString out; + CMStringW out; ReplaceAllSpecials(m0->getString().Mid(li, stind - li), out); SmileyLookup *dats = new SmileyLookup(out, false, dist, GetFilename()); if (dats->IsValid()) { @@ -301,7 +301,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) int stind = (int)m0->getString().GetLength(); if (li < stind) { - CMString out; + CMStringW out; ReplaceAllSpecials(m0->getString().Mid(li, stind - li), out); SmileyLookup *dats = new SmileyLookup(out, false, dist, GetFilename()); if (dats->IsValid()) { @@ -320,7 +320,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) delete p; } -void SmileyPackType::ReplaceAllSpecials(const CMString &Input, CMString &Output) +void SmileyPackType::ReplaceAllSpecials(const CMStringW &Input, CMStringW &Output) { Output = _TPattern::replace(L"%%_{1,2}%%", Input, L" "); Output = _TPattern::replace(L"%%''%%", Output, L"\""); @@ -341,7 +341,7 @@ void SmileyPackType::Clear(void) errorFound = false; } -bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &packname, bool onlyInfo, bool noerr) +bool SmileyPackType::LoadSmileyFile(const CMStringW &filename, const CMStringW &packname, bool onlyInfo, bool noerr) { Clear(); @@ -350,7 +350,7 @@ bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &pa return false; } - CMString modpath; + CMStringW modpath; pathToAbsolute(filename, modpath); // Load xep file @@ -359,7 +359,7 @@ bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &pa if (!noerr) { 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_snwprintf(msgtxt, TranslateTS(errmsg), modpath.c_str(), packname); + mir_snwprintf(msgtxt, TranslateW(errmsg), modpath.c_str(), packname); ReportError(msgtxt); } @@ -382,7 +382,7 @@ bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &pa // Close file _close(fh); - CMString tbuf; + CMStringW tbuf; if (len > 2 && *(wchar_t*)buf == 0xfeff) tbuf = ((wchar_t*)buf + 1); @@ -405,9 +405,9 @@ bool SmileyPackType::LoadSmileyFile(const CMString &filename, const CMString &pa return res; } -bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &modpath) +bool SmileyPackType::LoadSmileyFileMSL(CMStringW &tbuf, bool onlyInfo, CMStringW &modpath) { - CMString pathstr, packstr; + CMStringW pathstr, packstr; { _TPattern *pathsplit = _TPattern::compile(L"(.*\\\\)(.*)\\.|$"); _TMatcher *m0 = pathsplit->createTMatcher(modpath); @@ -469,7 +469,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString & { _TMatcher *m0 = smiley->createTMatcher(tbuf); while (m0->findNextMatch()) { - CMString resname = m0->getGroup(2); + CMStringW resname = m0->getGroup(2); if (resname.Find(L"http://") != -1) { if (GetSmileyFile(resname, packstr)) continue; @@ -519,7 +519,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString & if (!noerr) { static const wchar_t errmsg[] = LPGENW("Smiley #%u in file %s for smiley pack %s not found."); wchar_t msgtxt[1024]; - mir_snwprintf(msgtxt, TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str()); + mir_snwprintf(msgtxt, TranslateW(errmsg), smnum, resname.c_str(), modpath.c_str()); CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt)); errorFound = true; } @@ -540,11 +540,11 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString & } -static void DecodeHTML(CMString &str) +static void DecodeHTML(CMStringW &str) { if (str.Find('&') != -1) { - str = _TPattern::replace(CMString(L"<"), str, CMString(L"<")); - str = _TPattern::replace(CMString(L">"), str, CMString(L">")); + str = _TPattern::replace(CMStringW(L"<"), str, CMStringW(L"<")); + str = _TPattern::replace(CMStringW(L">"), str, CMStringW(L">")); } } @@ -571,7 +571,7 @@ static IStream* DecodeBase64Data(const char *pData) } -bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&) +bool SmileyPackType::LoadSmileyFileXEP(CMStringW &tbuf, bool onlyInfo, CMStringW&) { _TMatcher *m0, *m1, *m2; @@ -584,7 +584,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&) m0 = settings_re->createTMatcher(tbuf); if (m0->findFirstMatch()) { - CMString settings = m0->getGroup(1); + CMStringW settings = m0->getGroup(1); m1 = author_re->createTMatcher(settings); if (m1->findFirstMatch()) { @@ -622,7 +622,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&) m0 = images_re->createTMatcher(tbuf); if (m0->findFirstMatch()) { - CMString images = m0->getGroup(1); + CMStringW images = m0->getGroup(1); m1 = imagedt_re->createTMatcher(images); if (m1->findFirstMatch()) { @@ -646,7 +646,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&) dat->m_ToolText = m0->getGroup(2); DecodeHTML(dat->m_ToolText); - CMString rec = m0->getGroup(3); + CMStringW rec = m0->getGroup(3); m1 = expression_re->createTMatcher(rec); if (m1->findFirstMatch()) { @@ -665,7 +665,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&) m1 = image_re->createTMatcher(rec); if (m1->findFirstMatch()) { - CMString images = m1->getGroup(1); + CMStringW images = m1->getGroup(1); m2 = imagedt_re->createTMatcher(images); if (m2->findFirstMatch()) { @@ -709,7 +709,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString&) // -bool SmileyPackListType::AddSmileyPack(CMString &filename, CMString &packname) +bool SmileyPackListType::AddSmileyPack(CMStringW &filename, CMStringW &packname) { bool res = true; if (GetSmileyPack(filename) == NULL) { //not exist yet, so add @@ -725,13 +725,13 @@ bool SmileyPackListType::AddSmileyPack(CMString &filename, CMString &packname) } -SmileyPackType* SmileyPackListType::GetSmileyPack(CMString &filename) +SmileyPackType* SmileyPackListType::GetSmileyPack(CMStringW &filename) { - CMString modpath; + CMStringW modpath; pathToAbsolute(filename, modpath); for (int i = 0; i < m_SmileyPacks.getCount(); i++) { - CMString modpath1; + CMStringW modpath1; pathToAbsolute(m_SmileyPacks[i].GetFilename(), modpath1); if (mir_wstrcmpi(modpath.c_str(), modpath1.c_str()) == 0) return &m_SmileyPacks[i]; } @@ -749,8 +749,8 @@ void SmileyPackListType::ClearAndFreeAll() // -SmileyCategoryType::SmileyCategoryType(SmileyPackListType *pSPS, const CMString &name, - const CMString &displayName, const CMString &defaultFilename, SmcType typ) +SmileyCategoryType::SmileyCategoryType(SmileyPackListType *pSPS, const CMStringW &name, + const CMStringW &displayName, const CMStringW &defaultFilename, SmcType typ) { m_pSmileyPackStore = pSPS; type = typ; @@ -800,7 +800,7 @@ void SmileyCategoryListType::ClearAndLoadAll(void) } -SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const CMString &name) +SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const CMStringW &name) { for (int i = 0; i < m_SmileyCategories.getCount(); i++) if (name.CompareNoCase(m_SmileyCategories[i].GetName()) == 0) @@ -816,7 +816,7 @@ SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(unsigned index) } -SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMString &categoryname) +SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMStringW &categoryname) { SmileyCategoryType *smc = GetSmileyCategory(categoryname); return smc != NULL ? smc->GetSmileyPack() : NULL; @@ -825,7 +825,7 @@ SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMString &categoryname) void SmileyCategoryListType::SaveSettings(void) { - CMString catstr; + CMStringW catstr; for (int i = 0; i < m_SmileyCategories.getCount(); i++) { m_SmileyCategories[i].SaveSettings(); if (m_SmileyCategories[i].IsCustom()) { @@ -837,7 +837,7 @@ void SmileyCategoryListType::SaveSettings(void) } -void SmileyCategoryListType::AddAndLoad(const CMString &name, const CMString &displayName) +void SmileyCategoryListType::AddAndLoad(const CMStringW &name, const CMStringW &displayName) { if (GetSmileyCategory(name) != NULL) return; @@ -849,7 +849,7 @@ void SmileyCategoryListType::AddAndLoad(const CMString &name, const CMString &di } -void SmileyCategoryListType::AddCategory(const CMString &name, const CMString &displayName, SmcType typ, const CMString &defaultFilename) +void SmileyCategoryListType::AddCategory(const CMStringW &name, const CMStringW &displayName, SmcType typ, const CMStringW &defaultFilename) { if (GetSmileyCategory(name) == NULL) m_SmileyCategories.insert(new SmileyCategoryType(m_pSmileyPackStore, name, displayName, defaultFilename, typ)); @@ -867,14 +867,14 @@ bool SmileyCategoryListType::DeleteCustomCategory(int index) return false; } -void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMString &defaultFile) +void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStringW &defaultFile) { if (Proto_IsAccountEnabled(acc) && acc->szProtoName && IsSmileyProto(acc->szModuleName)) { - CMString displayName(acc->tszAccountName ? acc->tszAccountName : _A2T(acc->szModuleName)); - CMString PhysProtoName, paths; + CMStringW displayName(acc->tszAccountName ? acc->tszAccountName : _A2T(acc->szModuleName)); + CMStringW PhysProtoName, paths; DBVARIANT dbv; - if (db_get_ts(NULL, acc->szModuleName, "AM_BaseProto", &dbv) == 0) { + if (db_get_ws(NULL, acc->szModuleName, "AM_BaseProto", &dbv) == 0) { PhysProtoName = L"AllProto"; PhysProtoName += dbv.ptszVal; db_free(&dbv); @@ -894,19 +894,19 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr mir_snprintf(path, "Smileys\\nova\\%s.msl", packnam); paths = _A2T(path); - CMString patha; + CMStringW patha; pathToAbsolute(paths, patha); if (_waccess(patha.c_str(), 0) != 0) paths = defaultFile; } - CMString tname(_A2T(acc->szModuleName)); + CMStringW tname(_A2T(acc->szModuleName)); AddCategory(tname, displayName, acc->bIsVirtual ? smcVirtualProto : smcProto, paths); } } -void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString &defaultFile) +void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMStringW &defaultFile) { if (acc == NULL) return; @@ -920,21 +920,21 @@ void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString &defau char path[MAX_PATH]; mir_snprintf(path, "Smileys\\nova\\%s.msl", packnam); - CMString paths = _A2T(path), patha; + CMStringW paths = _A2T(path), patha; pathToAbsolute(paths, patha); if (_waccess(patha.c_str(), 0) != 0) paths = defaultFile; - CMString dName(acc), displayName; + CMStringW dName(acc), displayName; displayName.AppendFormat(TranslateT("%s global smiley pack"), dName.GetBuffer()); - CMString tname("AllProto"); + CMStringW tname("AllProto"); tname += _A2T(acc); AddCategory(tname, displayName, smcPhysProto, paths); } void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) { - CMString tname(_A2T(acc->szModuleName)); + CMStringW tname(_A2T(acc->szModuleName)); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); @@ -942,7 +942,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) continue; DBVARIANT dbv; - if (!db_get_ts(hContact, proto, "Transport", &dbv)) { + if (!db_get_ws(hContact, proto, "Transport", &dbv)) { bool found = (tname.CompareNoCase(dbv.ptszVal) == 0); db_free(&dbv); if (found) @@ -958,14 +958,14 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) } } -void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, const CMString &defaultFile) +void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, const CMStringW &defaultFile) { char *proto = GetContactProto(hContact); if (proto == NULL) return; DBVARIANT dbv; - if (!db_get_ts(hContact, proto, "Transport", &dbv)) { + if (!db_get_ws(hContact, proto, "Transport", &dbv)) { if (dbv.ptszVal[0] == '\0') { db_free(&dbv); return; @@ -987,12 +987,12 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co mir_free(trsp); - CMString displayName = dbv.ptszVal; + CMStringW displayName = dbv.ptszVal; if (packname != NULL) { char path[MAX_PATH]; mir_snprintf(path, "Smileys\\nova\\%s.msl", packname); - CMString paths = _A2T(path), patha; + CMStringW paths = _A2T(path), patha; pathToAbsolute(paths, patha); if (_waccess(patha.c_str(), 0) != 0) @@ -1008,11 +1008,11 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co void SmileyCategoryListType::AddAllProtocolsAsCategory(void) { - CMString displayName = TranslateT("Standard"); - CMString tname = L"Standard"; + CMStringW displayName = TranslateT("Standard"); + CMStringW tname = L"Standard"; AddCategory(tname, displayName, smcStd); - const CMString &defaultFile = GetSmileyCategory(tname)->GetFilename(); + const CMStringW &defaultFile = GetSmileyCategory(tname)->GetFilename(); PROTOCOLDESCRIPTOR **proto; int protoCount = 0; @@ -1032,7 +1032,7 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) AddContactTransportAsCategory(hContact, defaultFile); - CMString cats; + CMStringW cats; opt.ReadCustomCategories(cats); int cppv = 0; @@ -1053,13 +1053,13 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) } -SmileyLookup::SmileyLookup(const CMString &str, const bool regexs, const int ind, const CMString &smpt) +SmileyLookup::SmileyLookup(const CMStringW &str, const bool regexs, const int ind, const CMStringW &smpt) { wchar_t msgtxt[1024]; m_ind = ind; if (regexs) { - static const CMString testString(L"Test String"); + static const CMStringW testString(L"Test String"); m_pattern = _TPattern::compile(str); m_valid = m_pattern != NULL; if (m_valid) { @@ -1068,13 +1068,13 @@ SmileyLookup::SmileyLookup(const CMString &str, const bool regexs, const int ind matcher->getStartingIndex() != matcher->getEndingIndex()); if (!m_valid) { static const wchar_t errmsg[] = LPGENW("Regular expression \"%s\" in smiley pack \"%s\" could produce \"empty matches\"."); - mir_snwprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str()); + mir_snwprintf(msgtxt, TranslateW(errmsg), str.c_str(), smpt.c_str()); } delete matcher; } else { static const wchar_t errmsg[] = LPGENW("Regular expression \"%s\" in smiley pack \"%s\" malformed."); - mir_snwprintf(msgtxt, TranslateTS(errmsg), str.c_str(), smpt.c_str()); + mir_snwprintf(msgtxt, TranslateW(errmsg), str.c_str(), smpt.c_str()); } if (!m_valid) @@ -1094,7 +1094,7 @@ SmileyLookup::~SmileyLookup() } -void SmileyLookup::Find(const CMString &str, SmileyLocVecType &smlcur, bool firstOnly) const +void SmileyLookup::Find(const CMStringW &str, SmileyLocVecType &smlcur, bool firstOnly) const { if (!m_valid) return; diff --git a/plugins/SmileyAdd/src/smileys.h b/plugins/SmileyAdd/src/smileys.h index cba4999442..c69d128618 100644 --- a/plugins/SmileyAdd/src/smileys.h +++ b/plugins/SmileyAdd/src/smileys.h @@ -42,7 +42,7 @@ protected: HICON m_SmileyIcon; ImageBase *m_xepimg; - CMString m_filepath; + CMStringW m_filepath; void SetFlagsBit(unsigned flag, bool set) { @@ -51,17 +51,17 @@ protected: public: - CMString m_TriggerText; - CMString m_ToolText; - CMString m_InsertText; + CMStringW m_TriggerText; + CMStringW m_ToolText; + CMStringW m_InsertText; SmileyType(); ~SmileyType(); - const CMString& GetTriggerText(void) const { return m_TriggerText; } - const CMString& GetToolText(void) const { return m_ToolText; } - const CMString& GetInsertText(void) const { return m_InsertText; } - const CMString& GetFilePath(void) const { return m_filepath; } + const CMStringW& GetTriggerText(void) const { return m_TriggerText; } + const CMStringW& GetToolText(void) const { return m_ToolText; } + const CMStringW& GetInsertText(void) const { return m_InsertText; } + const CMStringW& GetFilePath(void) const { return m_filepath; } bool IsHidden(void) const { return (m_flags & HiddenSmiley) != 0; } bool IsRegEx(void) const { return (m_flags & RegExSmiley) != 0; } @@ -96,7 +96,7 @@ public: void SetImList(HIMAGELIST hImLst, long i); - bool LoadFromResource(const CMString &file, const int index); + bool LoadFromResource(const CMStringW &file, const int index); bool LoadFromImage(IStream *pStream); }; @@ -133,7 +133,7 @@ private: _TPattern *m_pattern; int m_ind; - CMString m_text; + CMStringW m_text; bool m_valid; public: @@ -146,10 +146,10 @@ public: typedef SMOBJLIST SmileyLocVecType; SmileyLookup() { m_ind = 0; m_valid = false; m_pattern = NULL; }; - SmileyLookup(const CMString &str, const bool regexs, const int ind, const CMString &smpt); + SmileyLookup(const CMStringW &str, const bool regexs, const int ind, const CMStringW &smpt); ~SmileyLookup(); - void Find(const CMString &str, SmileyLocVecType &smlcur, bool firstOnly) const; + void Find(const CMStringW &str, SmileyLocVecType &smlcur, bool firstOnly) const; int GetIndex(void) const { return m_ind; } bool IsValid(void) const { return m_valid; } }; @@ -164,12 +164,12 @@ public: POINT selec, win; private: - CMString m_Filename; //used as identification - CMString m_Name; - CMString m_Author; - CMString m_Date; - CMString m_Version; - CMString m_ButtonSmiley; + CMStringW m_Filename; //used as identification + CMStringW m_Name; + CMStringW m_Author; + CMStringW m_Date; + CMStringW m_Version; + CMStringW m_ButtonSmiley; HIMAGELIST m_hSmList; @@ -181,9 +181,9 @@ private: bool errorFound; void AddTriggersToSmileyLookup(void); - void ReplaceAllSpecials(const CMString &Input, CMString &Output); - bool LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &modpath); - bool LoadSmileyFileXEP(CMString &tbuf, bool onlyInfo, CMString &modpath); + void ReplaceAllSpecials(const CMStringW &Input, CMStringW &Output); + bool LoadSmileyFileMSL(CMStringW &tbuf, bool onlyInfo, CMStringW &modpath); + bool LoadSmileyFileXEP(CMStringW &tbuf, bool onlyInfo, CMStringW &modpath); public: SmileyPackType(); @@ -192,11 +192,11 @@ public: SmileyVectorType& GetSmileyList(void) { return m_SmileyList; } SmileyLookupType* GetSmileyLookup(void) { return &m_SmileyLookup; } - const CMString& GetFilename(void) const { return m_Filename; } - const CMString& GetName(void) const { return m_Name; } - const CMString& GetAuthor(void) const { return m_Author; } - const CMString& GetDate(void) const { return m_Date; } - const CMString& GetVersion(void) const { return m_Version; } + const CMStringW& GetFilename(void) const { return m_Filename; } + const CMStringW& GetName(void) const { return m_Name; } + const CMStringW& GetAuthor(void) const { return m_Author; } + const CMStringW& GetDate(void) const { return m_Date; } + const CMStringW& GetVersion(void) const { return m_Version; } int SmileyCount(void) const { return m_SmileyList.getCount(); } int VisibleSmileyCount(void) const { return m_VisibleCount; } @@ -205,7 +205,7 @@ public: const wchar_t* GetButtonSmiley(void) const { return m_ButtonSmiley.c_str(); } - bool LoadSmileyFile(const CMString &filename, const CMString &packname, bool onlyInfo, bool noerr = false); + bool LoadSmileyFile(const CMStringW &filename, const CMStringW &packname, bool onlyInfo, bool noerr = false); void Clear(void); }; @@ -222,9 +222,9 @@ private: public: int NumberOfSmileyPacks(void) { return m_SmileyPacks.getCount(); } - bool AddSmileyPack(CMString &filename, CMString &packname); + bool AddSmileyPack(CMStringW &filename, CMStringW &packname); void ClearAndFreeAll(void); - SmileyPackType* GetSmileyPack(CMString& filename); + SmileyPackType* GetSmileyPack(CMStringW& filename); }; @@ -244,9 +244,9 @@ typedef enum class SmileyCategoryType { private: - CMString m_Name; - CMString m_DisplayName; - CMString m_Filename; //functions as identification + CMStringW m_Name; + CMStringW m_DisplayName; + CMStringW m_Filename; //functions as identification SmcType type; @@ -256,11 +256,11 @@ private: public: SmileyCategoryType() { type = smcNone; m_pSmileyPackStore = NULL; visible = true; }; - SmileyCategoryType(SmileyPackListType *pSPS, const CMString &name, const CMString &displayName, const CMString &defaultFilename, SmcType typ); + SmileyCategoryType(SmileyPackListType *pSPS, const CMStringW &name, const CMStringW &displayName, const CMStringW &defaultFilename, SmcType typ); - const CMString& GetDisplayName(void) const { return m_DisplayName; } - const CMString& GetName(void) const { return m_Name; } - const CMString& GetFilename(void) const { return m_Filename; } + const CMStringW& GetDisplayName(void) const { return m_DisplayName; } + const CMStringW& GetName(void) const { return m_Name; } + const CMStringW& GetFilename(void) const { return m_Filename; } bool IsCustom(void) { return type == smcCustom; } bool IsProto(void) { return type == smcProto || type == smcPhysProto || type == smcTransportProto || type == smcVirtualProto; } @@ -275,8 +275,8 @@ public: SmileyPackType* GetSmileyPack(void); - void SetFilename(CMString& name) { m_Filename = name; } - void SetDisplayName(CMString& name) { m_DisplayName = name; } + void SetFilename(CMStringW& name) { m_Filename = name; } + void SetDisplayName(CMStringW& name) { m_DisplayName = name; } void SetVisible(bool vis) { visible = vis; } void ClearFilename(void) { m_Filename.Empty(); } @@ -298,20 +298,20 @@ private: public: void SetSmileyPackStore(SmileyPackListType *pSPS) { m_pSmileyPackStore = pSPS; } - SmileyCategoryType* GetSmileyCategory(const CMString& name); + SmileyCategoryType* GetSmileyCategory(const CMStringW& name); SmileyCategoryType* GetSmileyCategory(unsigned index); - SmileyPackType* GetSmileyPack(CMString& name); + SmileyPackType* GetSmileyPack(CMStringW& name); SmileyCategoryVectorType* GetSmileyCategoryList(void) { return &m_SmileyCategories; }; int NumberOfSmileyCategories(void) { return m_SmileyCategories.getCount(); } - void AddCategory(const CMString& name, const CMString& displayName, SmcType typ, - const CMString& defaultFilename = CMString(L"Smileys\\nova\\default.msl")); - void AddAndLoad(const CMString& name, const CMString& displayName); + void AddCategory(const CMStringW& name, const CMStringW& displayName, SmcType typ, + const CMStringW& defaultFilename = CMStringW(L"Smileys\\nova\\default.msl")); + void AddAndLoad(const CMStringW& name, const CMStringW& displayName); void AddAllProtocolsAsCategory(void); - void AddAccountAsCategory(PROTOACCOUNT *acc, const CMString& defaultFile); - void AddProtoAsCategory(char *acc, const CMString& defaultFile); - void AddContactTransportAsCategory(MCONTACT hContact, const CMString& defaultFile); + void AddAccountAsCategory(PROTOACCOUNT *acc, const CMStringW& defaultFile); + void AddProtoAsCategory(char *acc, const CMStringW& defaultFile); + void AddContactTransportAsCategory(MCONTACT hContact, const CMStringW& defaultFile); void ClearAndLoadAll(void); void ClearAll(void) diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp index 8db7726c1f..b2284343cd 100644 --- a/plugins/SmileyAdd/src/smltool.cpp +++ b/plugins/SmileyAdd/src/smltool.cpp @@ -196,7 +196,7 @@ void SmileyToolWindowType::InsertSmiley(void) CallFunctionAsync(smileyServiceCallback, p); } else { - CMString insertText; + CMStringW insertText; if (opt.SurroundSmileyWithSpaces) insertText = ' '; insertText += sml->GetInsertText(); @@ -235,7 +235,7 @@ void SmileyToolWindowType::SmileySel(int but) ti.hwnd = m_hwndDialog; ti.uId = (UINT_PTR)m_hwndDialog; - const CMString &toolText = m_pSmileyPack->GetSmiley(m_CurrentHotTrack)->GetToolText(); + const CMStringW &toolText = m_pSmileyPack->GetSmiley(m_CurrentHotTrack)->GetToolText(); ti.lpszText = const_cast(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 4599a5a6f3..bd91bfe5a5 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -120,15 +120,15 @@ int UpdateSrmmDlg(WPARAM wParam, LPARAM lParam); //functions for general use (defined in general.cpp) int CalculateTextHeight(HDC hdc, CHARFORMAT2 *chf); -const wchar_t* GetImageExt(CMString &fname); +const wchar_t* GetImageExt(CMStringW &fname); MCONTACT DecodeMetaContact(MCONTACT hContact); bool IsSmileyProto(char *proto); HICON ImageList_GetIconFixed (HIMAGELIST himl, INT i, UINT fStyle); -void pathToRelative(const CMString &pSrc, CMString &pOut); -void pathToAbsolute(const CMString &pSrc, CMString &pOut); +void pathToRelative(const CMStringW &pSrc, CMStringW &pOut); +void pathToAbsolute(const CMStringW &pSrc, CMStringW &pOut); bool InitGdiPlus(void); void DestroyGdiPlus(void); -- cgit v1.2.3