diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-18 11:46:12 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-18 11:46:12 +0000 |
commit | d3b77308122587707580ec1f308dbdda38c806ac (patch) | |
tree | b679ff06efef0772c06fe6b2c9b4d84840324eaf /plugins/SmileyAdd | |
parent | 758cf835f21b2f73da541857afac0f3b226ea20e (diff) |
- naming conflict;
- warning fixes;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14984 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd')
-rw-r--r-- | plugins/SmileyAdd/SmileyAdd.vcxproj | 1 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/AniSmileyObject.cpp | 19 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/dlgboxsubclass.cpp | 16 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/regexp/WCMatcher.cpp | 9 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/regexp/WCPattern.cpp | 474 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smileyroutines.cpp | 16 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smileys.cpp | 411 |
7 files changed, 496 insertions, 450 deletions
diff --git a/plugins/SmileyAdd/SmileyAdd.vcxproj b/plugins/SmileyAdd/SmileyAdd.vcxproj index 49fdc3d353..a89d90ad10 100644 --- a/plugins/SmileyAdd/SmileyAdd.vcxproj +++ b/plugins/SmileyAdd/SmileyAdd.vcxproj @@ -27,6 +27,7 @@ </ImportGroup>
<ItemGroup>
<ClCompile Include="src\regexp\*.cpp">
+ <DisableSpecificWarnings>4458;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PrecompiledHeaderFile>..\stdafx.h</PrecompiledHeaderFile>
</ClCompile>
</ItemGroup>
diff --git a/plugins/SmileyAdd/src/AniSmileyObject.cpp b/plugins/SmileyAdd/src/AniSmileyObject.cpp index c713f41c66..f86c092464 100644 --- a/plugins/SmileyAdd/src/AniSmileyObject.cpp +++ b/plugins/SmileyAdd/src/AniSmileyObject.cpp @@ -128,15 +128,15 @@ public: reObj.cbStruct = sizeof(REOBJECT);
HRESULT hr = RichEditOle->GetObject(m_lastObjNum, &reObj, REO_GETOBJ_NO_INTERFACES);
- if (hr == S_OK && reObj.dwUser == (DWORD)this && reObj.clsid == CLSID_NULL)
+ if (hr == S_OK && reObj.dwUser == (DWORD_PTR)this && reObj.clsid == CLSID_NULL)
m_richFlags = reObj.dwFlags;
else {
long objectCount = RichEditOle->GetObjectCount();
for (long i = objectCount; i--; ) {
- HRESULT hr = RichEditOle->GetObject(i, &reObj, REO_GETOBJ_NO_INTERFACES);
+ hr = RichEditOle->GetObject(i, &reObj, REO_GETOBJ_NO_INTERFACES);
if (FAILED(hr)) continue;
- if (reObj.dwUser == (DWORD)this && reObj.clsid == CLSID_NULL) {
+ if (reObj.dwUser == (DWORD_PTR)this && reObj.clsid == CLSID_NULL) {
m_lastObjNum = i;
m_richFlags = reObj.dwFlags;
break;
@@ -155,7 +155,6 @@ public: }
}
-
void DoDirectDraw(HDC hdc)
{
HBITMAP hBmp = CreateCompatibleBitmap(hdc, m_rectExt.cx, m_rectExt.cy);
@@ -167,12 +166,12 @@ public: rc.top = m_rectExt.cy - m_sizeExtent.cy;
rc.right = rc.left + m_sizeExtent.cx;
rc.bottom = rc.top + m_sizeExtent.cy;
-
- HBRUSH hbr = CreateSolidBrush(m_bkg);
- RECT frc = { 0, 0, m_rectExt.cx, m_rectExt.cy };
- FillRect(hdcMem, &frc, hbr);
- DeleteObject(hbr);
-
+ {
+ HBRUSH hbr = CreateSolidBrush(m_bkg);
+ RECT frc = { 0, 0, m_rectExt.cx, m_rectExt.cy };
+ FillRect(hdcMem, &frc, hbr);
+ DeleteObject(hbr);
+ }
m_img->DrawInternal(hdcMem, rc.left, rc.top, m_sizeExtent.cx - 1, m_sizeExtent.cy - 1);
if (m_richFlags & REO_SELECTED) {
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 05cdc7343e..40fa8166b1 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -145,15 +145,15 @@ public: //helper function
//identifies the message dialog
- bool IsMessageSendDialog(HWND hwnd)
+ bool IsMessageSendDialog(HWND hwndDlg)
{
TCHAR szClassName[32] = _T("");
- GetClassName(hwnd, szClassName, _countof(szClassName));
+ GetClassName(hwndDlg, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("#32770")))
return false;
- if ((REdit = GetDlgItem(hwnd, MI_IDC_LOG)) != NULL) {
+ if ((REdit = GetDlgItem(hwndDlg, MI_IDC_LOG)) != NULL) {
GetClassName(REdit, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20W")) != 0 &&
@@ -162,7 +162,7 @@ public: }
else return false;
- if ((MEdit = GetDlgItem(hwnd, MI_IDC_MESSAGE)) != NULL) {
+ if ((MEdit = GetDlgItem(hwndDlg, MI_IDC_MESSAGE)) != NULL) {
GetClassName(MEdit, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("Edit")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
@@ -172,14 +172,14 @@ public: }
else return false;
- QuoteB = GetDlgItem(hwnd, MI_IDC_QUOTE);
+ QuoteB = GetDlgItem(hwndDlg, MI_IDC_QUOTE);
- if ((LButton = GetDlgItem(hwnd, MI_IDC_ADD)) == NULL)
+ if ((LButton = GetDlgItem(hwndDlg, MI_IDC_ADD)) == NULL)
return false;
- if (GetDlgItem(hwnd, MI_IDC_NAME) == NULL)
+ if (GetDlgItem(hwndDlg, MI_IDC_NAME) == NULL)
return false;
- if ((MOK = GetDlgItem(hwnd, IDOK)) == NULL)
+ if ((MOK = GetDlgItem(hwndDlg, IDOK)) == NULL)
return false;
return true;
diff --git a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp index 3cd0808373..8fd137449d 100644 --- a/plugins/SmileyAdd/src/regexp/WCMatcher.cpp +++ b/plugins/SmileyAdd/src/regexp/WCMatcher.cpp @@ -30,6 +30,7 @@ WCMatcher::WCMatcher(WCPattern * pattern, const CMString & text) groupIndeces = groupIndeces + ncgc;
for (int i = 0; i < gc; ++i) starts[i] = ends[i] = 0;
}
+
WCMatcher::~WCMatcher()
{
delete[](starts - ncgc);
@@ -38,6 +39,7 @@ WCMatcher::~WCMatcher() delete[](groupIndeces - ncgc);
delete[](groupPos - ncgc);
}
+
void WCMatcher::clearGroups()
{
int i;
@@ -45,11 +47,12 @@ void WCMatcher::clearGroups() for (i = 0; i < gc; ++i) groups[i] = starts[i] = ends[i] = -1;
for (i = 1; i <= ncgc; ++i) groups[0 - i] = starts[0 - i] = ends[0 - i] = -1;
}
-CMString WCMatcher::replaceWithGroups(const CMString & str)
+
+CMString WCMatcher::replaceWithGroups(const CMString &pStr)
{
CMString ret;
- CMString t = str;
+ CMString t = pStr;
while (t.GetLength() > 0) {
if (t[0] == '\\') {
t.Delete(0);
@@ -77,10 +80,12 @@ CMString WCMatcher::replaceWithGroups(const CMString & str) return ret;
}
+
unsigned long WCMatcher::getFlags() const
{
return flags;
}
+
const CMString& WCMatcher::getText() const
{
return *str;
diff --git a/plugins/SmileyAdd/src/regexp/WCPattern.cpp b/plugins/SmileyAdd/src/regexp/WCPattern.cpp index f2b128c980..cbb9c7369f 100644 --- a/plugins/SmileyAdd/src/regexp/WCPattern.cpp +++ b/plugins/SmileyAdd/src/regexp/WCPattern.cpp @@ -44,16 +44,14 @@ const unsigned long WCPattern::UNIX_LINE_MODE = 0x10; #define str_icmp mir_wstrcmpi
#elif defined(__CYGWIN__) || defined(__APPLE__)
#include <wctype.h>
-static inline int str_icmp(const wchar_t * a, const wchar_t * b)
+static inline int str_icmp(const wchar_t *a, const wchar_t *b)
{
- while (*a && *b)
- {
+ while (*a && *b) {
const int t = (int)towlower(*a) - (int)tolower(*b);
if (t) return t;
++a; ++b;
}
- if (*a)
- {
+ if (*a) {
if (*b) return (int)towlower(*a) - (int)tolower(*b);
return 1;
}
@@ -95,7 +93,7 @@ void WCPattern::raiseError() }*/
error = 1;
}
-NFAUNode * WCPattern::registerNode(NFAUNode * node)
+NFAUNode *WCPattern::registerNode(NFAUNode *node)
{
nodes[node] = 1;
return node;
@@ -103,7 +101,7 @@ NFAUNode * WCPattern::registerNode(NFAUNode * node) CMString WCPattern::classUnion(CMString s1, CMString s2) const
{
- wchar_t * out = new wchar_t[66000];
+ 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;
@@ -114,7 +112,7 @@ CMString WCPattern::classUnion(CMString s1, CMString s2) const CMString WCPattern::classIntersect(CMString s1, CMString s2) const
{
- wchar_t * out = new wchar_t[66000];
+ 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;
@@ -125,7 +123,7 @@ CMString WCPattern::classIntersect(CMString s1, CMString s2) const CMString WCPattern::classNegate(CMString s1) const
{
- wchar_t * out = new wchar_t[66000];
+ wchar_t *out = new wchar_t[66000];
int i, ind = 0;
std::map<wchar_t, bool> m;
@@ -137,7 +135,7 @@ CMString WCPattern::classNegate(CMString s1) const return ret;
}
-CMString WCPattern::classCreateRange(wchar_t low, wchar_t hi) const
+CMString WCPattern::classCreateRange(wchar_t low, wchar_t hi) const
{
wchar_t out[300];
int ind = 0;
@@ -153,7 +151,7 @@ int WCPattern::getInt(int start, int end) return ret;
}
-bool WCPattern::quantifyCurly(int & sNum, int & eNum)
+bool WCPattern::quantifyCurly(int &sNum, int &eNum)
{
bool good = 1;
int i, ci = curInd + 1;
@@ -169,19 +167,19 @@ bool WCPattern::quantifyCurly(int & sNum, int & eNum) /* so now everything in here is either a comma (and there is at most one comma) or a digit */
if (commaInd == ci) // {,*}
{
- if (endInd == commaInd + 1) { sNum = MIN_QMATCH; eNum = MAX_QMATCH; } // {,} = *
- else { sNum = MIN_QMATCH; eNum = getInt(commaInd + 1, endInd - 1); } // {,+}
+ if (endInd == commaInd + 1) { sNum = MIN_QMATCH; eNum = MAX_QMATCH; } // {,} = *
+ else { sNum = MIN_QMATCH; eNum = getInt(commaInd + 1, endInd - 1); } // {,+}
}
else if (commaInd == endInd - 1) { sNum = getInt(ci, commaInd - 1); eNum = MAX_QMATCH; } // {+,}
- else if (commaInd == endInd) { sNum = getInt(ci, endInd - 1); eNum = sNum; } // {+}
- else { sNum = getInt(ci, commaInd - 1); eNum = getInt(commaInd + 1, endInd - 1); } // {+,+}
+ else if (commaInd == endInd) { sNum = getInt(ci, endInd - 1); eNum = sNum; } // {+}
+ else { sNum = getInt(ci, commaInd - 1); eNum = getInt(commaInd + 1, endInd - 1); } // {+,+}
curInd = endInd + 1;
return 1;
}
-NFAUNode * WCPattern::quantifyGroup(NFAUNode * start, NFAUNode * stop, const int gn)
+NFAUNode* WCPattern::quantifyGroup(NFAUNode *start, NFAUNode *stop, const int gn)
{
- NFAUNode * newNode = NULL;
+ NFAUNode *newNode = NULL;
int type = 0;
if (curInd < pattern.GetLength()) {
@@ -190,8 +188,8 @@ NFAUNode * WCPattern::quantifyGroup(NFAUNode * start, NFAUNode * stop, const int case '*':
++curInd;
switch (ch) {
- case '?': ++curInd; type = 1; break;
- case '+': ++curInd; type = 2; break;
+ case '?': ++curInd; type = 1; break;
+ case '+': ++curInd; type = 2; break;
}
newNode = registerNode(new NFAGroupLoopPrologueUNode(gn));
newNode->next = registerNode(new NFAGroupLoopUNode(start, MIN_QMATCH, MAX_QMATCH, gn, type));
@@ -200,8 +198,8 @@ NFAUNode * WCPattern::quantifyGroup(NFAUNode * start, NFAUNode * stop, const int case '?':
++curInd;
switch (ch) {
- case '?': ++curInd; type = 1; break;
- case '+': ++curInd; type = 2; break;
+ case '?': ++curInd; type = 1; break;
+ case '+': ++curInd; type = 2; break;
}
newNode = registerNode(new NFAGroupLoopPrologueUNode(gn));
newNode->next = registerNode(new NFAGroupLoopUNode(start, MIN_QMATCH, 1, gn, type));
@@ -210,8 +208,8 @@ NFAUNode * WCPattern::quantifyGroup(NFAUNode * start, NFAUNode * stop, const int case '+':
++curInd;
switch (ch) {
- case '?': ++curInd; type = 1; break;
- case '+': ++curInd; type = 2; break;
+ case '?': ++curInd; type = 1; break;
+ case '+': ++curInd; type = 2; break;
}
newNode = registerNode(new NFAGroupLoopPrologueUNode(gn));
newNode->next = registerNode(new NFAGroupLoopUNode(start, 1, MAX_QMATCH, gn, type));
@@ -223,8 +221,8 @@ NFAUNode * WCPattern::quantifyGroup(NFAUNode * start, NFAUNode * stop, const int if (quantifyCurly(s, e)) {
ch = (curInd < pattern.GetLength()) ? pattern[curInd] : USHRT_MAX;
switch (ch) {
- case '?': ++curInd; type = 1; break;
- case '+': ++curInd; type = 2; break;
+ case '?': ++curInd; type = 1; break;
+ case '+': ++curInd; type = 2; break;
}
newNode = registerNode(new NFAGroupLoopPrologueUNode(gn));
newNode->next = registerNode(new NFAGroupLoopUNode(start, s, e, gn, type));
@@ -237,7 +235,7 @@ NFAUNode * WCPattern::quantifyGroup(NFAUNode * start, NFAUNode * stop, const int return NULL;
}
-NFAUNode * WCPattern::quantify(NFAUNode * newNode)
+NFAUNode* WCPattern::quantify(NFAUNode *newNode)
{
if (curInd < pattern.GetLength()) {
wchar_t ch = (curInd + 1 >= pattern.GetLength()) ? USHRT_MAX : pattern[curInd + 1];
@@ -245,25 +243,25 @@ NFAUNode * WCPattern::quantify(NFAUNode * newNode) case '*':
++curInd;
switch (ch) {
- case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, MIN_QMATCH, MAX_QMATCH)); break;
- case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, MIN_QMATCH, MAX_QMATCH)); break;
- default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, MIN_QMATCH, MAX_QMATCH)); break;
+ case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, MIN_QMATCH, MAX_QMATCH)); break;
+ case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, MIN_QMATCH, MAX_QMATCH)); break;
+ default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, MIN_QMATCH, MAX_QMATCH)); break;
}
break;
case '?':
++curInd;
switch (ch) {
- case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, MIN_QMATCH, 1)); break;
- case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, MIN_QMATCH, 1)); break;
- default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, MIN_QMATCH, 1)); break;
+ case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, MIN_QMATCH, 1)); break;
+ case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, MIN_QMATCH, 1)); break;
+ default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, MIN_QMATCH, 1)); break;
}
break;
case '+':
++curInd;
switch (ch) {
- case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, 1, MAX_QMATCH)); break;
- case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, 1, MAX_QMATCH)); break;
- default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, 1, MAX_QMATCH)); break;
+ case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, 1, MAX_QMATCH)); break;
+ case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, 1, MAX_QMATCH)); break;
+ default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, 1, MAX_QMATCH)); break;
}
break;
case '{':
@@ -271,9 +269,9 @@ NFAUNode * WCPattern::quantify(NFAUNode * newNode) if (quantifyCurly(s, e)) {
ch = (curInd < pattern.GetLength()) ? pattern[curInd] : USHRT_MAX;
switch (ch) {
- case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, s, e)); break;
- case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, s, e)); break;
- default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, s, e)); break;
+ case '?': ++curInd; newNode = registerNode(new NFALazyQuantifierUNode(this, newNode, s, e)); break;
+ case '+': ++curInd; newNode = registerNode(new NFAPossessiveQuantifierUNode(this, newNode, s, e)); break;
+ default: newNode = registerNode(new NFAGreedyQuantifierUNode(this, newNode, s, e)); break;
}
}
break;
@@ -281,6 +279,7 @@ NFAUNode * WCPattern::quantify(NFAUNode * newNode) }
return newNode;
}
+
CMString WCPattern::parseClass()
{
CMString t, ret;
@@ -393,7 +392,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);
+ CMString s(' ', 32 + 1);
for (int i = 0; i <= 0x1F; ++i)
s.SetAt(i, i);
s.SetAt(0x20, 0x7F);
@@ -410,10 +409,11 @@ CMString WCPattern::parsePosix() raiseError();
return L"";
}
-NFAUNode * WCPattern::parseBackref()
+
+NFAUNode* WCPattern::parseBackref()
{
-#define is_dig(x) ((x) >= '0' && (x) <= '9')
-#define to_int(x) ((x) - '0')
+ #define is_dig(x) ((x) >= '0' && (x) <= '9')
+ #define to_int(x) ((x) - '0')
int ci = curInd;
int oldRef = 0, ref = 0;
@@ -432,14 +432,15 @@ NFAUNode * WCPattern::parseBackref() curInd = ci;
return registerNode(new NFAReferenceUNode(ref));
-#undef is_dig
-#undef to_int
+ #undef is_dig
+ #undef to_int
}
+
CMString WCPattern::parseOctal()
{
-#define islowoc(x) ((x) >= '0' && (x) <= '3')
-#define isoc(x) ((x) >= '0' && (x) <= '7')
-#define fromoc(x) ((x) - '0')
+ #define islowoc(x) ((x) >= '0' && (x) <= '3')
+ #define isoc(x) ((x) >= '0' && (x) <= '7')
+ #define fromoc(x) ((x) - '0')
int ci = curInd;
wchar_t ch1 = (ci + 0 < pattern.GetLength()) ? pattern[ci + 0] : USHRT_MAX;
wchar_t ch2 = (ci + 1 < pattern.GetLength()) ? pattern[ci + 1] : USHRT_MAX;
@@ -461,16 +462,17 @@ CMString WCPattern::parseOctal() else raiseError();
return s;
-#undef islowoc
-#undef isoc
-#undef fromoc
+ #undef islowoc
+ #undef isoc
+ #undef fromoc
}
+
CMString WCPattern::parseHex()
{
-#define to_low(x) (((x) >= 'A' && (x) <= 'Z') ? ((x) - 'A' + 'a') : (x))
-#define is_dig(x) ((x) >= '0' && (x) <= '9')
-#define is_hex(x) (is_dig(x) || (to_low(x) >= 'a' && to_low(x) <= 'f'))
-#define to_int(x) ((is_dig(x)) ? ((x) - '0') : (to_low(x) - 'a' + 10))
+ #define to_low(x) (((x) >= 'A' && (x) <= 'Z') ? ((x) - 'A' + 'a') : (x))
+ #define is_dig(x) ((x) >= '0' && (x) <= '9')
+ #define is_hex(x) (is_dig(x) || (to_low(x) >= 'a' && to_low(x) <= 'f'))
+ #define to_int(x) ((is_dig(x)) ? ((x) - '0') : (to_low(x) - 'a' + 10))
int ci = curInd;
wchar_t ch1 = (ci + 0 < pattern.GetLength()) ? pattern[ci + 0] : USHRT_MAX;
@@ -490,12 +492,13 @@ CMString WCPattern::parseHex() }
return s;
-#undef to_low
-#undef is_dig
-#undef is_hex
-#undef to_int
+ #undef to_low
+ #undef is_dig
+ #undef is_hex
+ #undef to_int
}
-CMString WCPattern::parseEscape(bool & inv, bool & quo)
+
+CMString WCPattern::parseEscape(bool &inv, bool &quo)
{
wchar_t ch = pattern[curInd++];
CMString classes;
@@ -508,25 +511,27 @@ CMString WCPattern::parseEscape(bool & inv, bool & quo) quo = 0;
inv = 0;
switch (ch) {
- case 'p': classes = parsePosix(); break;
- case 'P': classes = L"!!"; classes += parsePosix(); break;
- case 'd': classes = L"0123456789"; break;
- case 'D': classes = L"!!0123456789"; break;
- case 's': classes = L" \t\r\n\f"; break;
- case 'S': classes = L"!! \t\r\n\f"; break;
- case 'w': classes = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; break;
- case 'W': classes = L"!!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; break;
- case '0': classes = parseOctal(); break;
- case 'x': classes = parseHex(); break;
-
- case 'Q': quo = 1; break;
- case 't': classes = L"\t"; break;
- case 'r': classes = L"\r"; break;
- case 'n': classes = L"\n"; break;
- case 'f': classes = L"\f"; break;
- case 'a': classes = L"\a"; break;
- case 'e': classes = L"\r"; break;
- default: classes.AppendChar(ch); break;
+ case 'p': classes = parsePosix(); break;
+ case 'P': classes = L"!!"; classes += parsePosix(); break;
+ case 'd': classes = L"0123456789"; break;
+ case 'D': classes = L"!!0123456789"; break;
+ case 's': classes = L" \t\r\n\f"; break;
+ case 'S': classes = L"!! \t\r\n\f"; break;
+ case 'w': classes = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; break;
+ case 'W': classes = L"!!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; break;
+ case '0': classes = parseOctal(); break;
+ case 'x': classes = parseHex(); break;
+
+ case 'Q': quo = 1; break;
+ case 't': classes = L"\t"; break;
+ case 'r': classes = L"\r"; break;
+ case 'n': classes = L"\n"; break;
+ case 'f': classes = L"\f"; break;
+ case 'a': classes = L"\a"; break;
+ case 'e': classes = L"\r"; break;
+ default:
+ classes.AppendChar(ch);
+ break;
}
if (classes.Mid(0, 2) == L"!!") {
@@ -540,24 +545,22 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end) {
int i, j;
CMString s;
- NFAUNode * ret = NULL;
+ NFAUNode *ret = NULL;
for (i = curInd; i < pattern.GetLength() && pattern[i] != '}'; ++i) {}
if (pattern[i] != '}') { raiseError(); return NULL; }
- if (i == curInd + 1) { raiseError(); return NULL; } // {}
- if ( !((pattern[curInd] >= 'a' && pattern[curInd] <= 'z') ||
- (pattern[curInd] >= 'A' && pattern[curInd] <= 'Z') ||
- (pattern[curInd] == '_')))
- {
+ if (i == curInd + 1) { raiseError(); return NULL; } // {}
+ if (!((pattern[curInd] >= 'a' && pattern[curInd] <= 'z') ||
+ (pattern[curInd] >= 'A' && pattern[curInd] <= 'Z') ||
+ (pattern[curInd] == '_'))) {
raiseError();
return NULL;
}
for (j = curInd; !error && j < i; ++j) {
- if ( !((pattern[j] >= 'a' && pattern[j] <= 'z') ||
- (pattern[j] >= 'A' && pattern[j] <= 'Z') ||
- (pattern[j] >= '0' && pattern[j] <= '9') ||
- (pattern[j] == '_')))
- {
+ if (!((pattern[j] >= 'a' && pattern[j] <= 'z') ||
+ (pattern[j] >= 'A' && pattern[j] <= 'Z') ||
+ (pattern[j] >= '0' && pattern[j] <= '9') ||
+ (pattern[j] == '_'))) {
raiseError();
return NULL;
}
@@ -586,7 +589,7 @@ NFAUNode* WCPattern::parseRegisteredWCPattern(NFAUNode **end) // look behind should interpret everything as a literal (except \\) since the
// pattern must have a concrete length
-NFAUNode* WCPattern::parseBehind(const bool pos, NFAUNode ** end)
+NFAUNode* WCPattern::parseBehind(const bool pos, NFAUNode **end)
{
CMString t;
while (curInd < pattern.GetLength() && pattern[curInd] != ')') {
@@ -628,9 +631,9 @@ NFAUNode* WCPattern::parseQuote() if ((flags & WCPattern::CASE_INSENSITIVE) != 0) return registerNode(new NFACIQuoteUNode(s));
return registerNode(new NFAQuoteUNode(s));
}
-NFAUNode * WCPattern::parse(const bool inParen, const bool inOr, NFAUNode ** end)
+NFAUNode* WCPattern::parse(const bool inParen, const bool inOr, NFAUNode **end)
{
- NFAUNode * start, *cur, *next = NULL;
+ NFAUNode *start, *cur, *next = NULL;
CMString t;
int grc = groupCount++;
bool inv, quo;
@@ -641,12 +644,12 @@ NFAUNode * WCPattern::parse(const bool inParen, const bool inOr, NFAUNode ** end if (pattern[curInd] == '?') {
++curInd;
--groupCount;
- if (pattern[curInd] == ':') { noncap = 1; ++curInd; grc = --nonCapGroupCount; }
- else if (pattern[curInd] == '=') { ++curInd; ahead = 1; pos = 1; }
- else if (pattern[curInd] == '!') { ++curInd; ahead = 1; pos = 0; }
- else if (pattern.Mid(curInd, 2) == L"<=") { curInd += 2; return parseBehind(1, end); }
- else if (pattern.Mid(curInd, 2) == L"<!") { curInd += 2; return parseBehind(0, end); }
- else if (pattern[curInd] == '>') { ++curInd; indep = 1; }
+ if (pattern[curInd] == ':') { noncap = 1; ++curInd; grc = --nonCapGroupCount; }
+ else if (pattern[curInd] == '=') { ++curInd; ahead = 1; pos = 1; }
+ else if (pattern[curInd] == '!') { ++curInd; ahead = 1; pos = 0; }
+ else if (pattern.Mid(curInd, 2) == L"<=") { curInd += 2; return parseBehind(1, end); }
+ else if (pattern.Mid(curInd, 2) == L"<!") { curInd += 2; return parseBehind(0, end); }
+ else if (pattern[curInd] == '>') { ++curInd; indep = 1; }
else {
bool negate = false, done = false;
while (!done) {
@@ -781,16 +784,16 @@ NFAUNode * WCPattern::parse(const bool inParen, const bool inOr, NFAUNode ** end break;
case '(':
{
- NFAUNode *end, *t1, *t2;
- t1 = parse(1, 0, &end);
+ NFAUNode *pEnd, *t1, *t2;
+ t1 = parse(1, 0, &pEnd);
if (!t1) raiseError();
- else if (t1->isGroupHeadNode() && (t2 = quantifyGroup(t1, end, grc)) != NULL) {
+ else if (t1->isGroupHeadNode() && (t2 = quantifyGroup(t1, pEnd, grc)) != NULL) {
cur->next = t2;
cur = t2->next;
}
else {
cur->next = t1;
- cur = end;
+ cur = pEnd;
}
}
break;
@@ -855,7 +858,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 CMString &pattern, const unsigned long mode)
{
WCPattern *p = new WCPattern(pattern);
NFAUNode *end;
@@ -875,7 +878,7 @@ WCPattern* WCPattern::compile(const CMString & pattern, const unsigned long mode }
else {
if (!(p->head && p->head->isStartOfInputNode())) {
- NFAUNode * n = p->registerNode(new NFAStartUNode);
+ NFAUNode *n = p->registerNode(new NFAStartUNode);
n->next = p->head;
p->head = n;
}
@@ -889,7 +892,7 @@ 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 CMString &pattern, const unsigned long mode)
{
WCPattern *ret = NULL;
std::map<CMString, WCPattern*>::iterator it = compiledWCPatterns.find(pattern);
@@ -902,8 +905,8 @@ WCPattern * WCPattern::compileAndKeep(const CMString & pattern, const unsigned l return ret;
}
-CMString WCPattern::replace(const CMString & pattern, const CMString & str,
- const CMString & replacementText, const unsigned long mode)
+
+CMString WCPattern::replace(const CMString &pattern, const CMString &str, const CMString &replacementText, const unsigned long mode)
{
CMString ret;
WCPattern *p = WCPattern::compile(pattern, mode);
@@ -914,8 +917,7 @@ CMString WCPattern::replace(const CMString & pattern, const CMString & str, return ret;
}
-std::vector<CMString> WCPattern::split(const CMString & pattern, const CMString & str, const bool keepEmptys,
- const unsigned long limit, const unsigned long mode)
+std::vector<CMString> WCPattern::split(const CMString &pattern, const CMString &str, const bool keepEmptys, const unsigned long limit, const unsigned long mode)
{
std::vector<CMString> ret;
WCPattern *p = WCPattern::compile(pattern, mode);
@@ -926,7 +928,7 @@ std::vector<CMString> WCPattern::split(const CMString & pattern, const CMString return ret;
}
-std::vector<CMString> WCPattern::findAll(const CMString & pattern, const CMString & str, const unsigned long mode)
+std::vector<CMString> WCPattern::findAll(const CMString &pattern, const CMString &str, const unsigned long mode)
{
std::vector<CMString> ret;
WCPattern *p = WCPattern::compile(pattern, mode);
@@ -937,7 +939,7 @@ std::vector<CMString> WCPattern::findAll(const CMString & pattern, const CMStrin return ret;
}
-bool WCPattern::matches(const CMString & pattern, const CMString & str, const unsigned long mode)
+bool WCPattern::matches(const CMString &pattern, const CMString &str, const unsigned long mode)
{
bool ret = 0;
WCPattern *p = compile(pattern, mode);
@@ -949,7 +951,7 @@ bool WCPattern::matches(const CMString & pattern, const CMString & str, const un return ret;
}
-bool WCPattern::registerWCPattern(const CMString & name, const CMString & pattern, const unsigned long mode)
+bool WCPattern::registerWCPattern(const CMString &name, const CMString &pattern, const unsigned long mode)
{
WCPattern *p = WCPattern::compile(pattern, mode);
if (!p)
@@ -1002,7 +1004,7 @@ WCPattern::~WCPattern() delete it->first;
}
-CMString WCPattern::replace(const CMString & str, const CMString & replacementText)
+CMString WCPattern::replace(const CMString &str, const CMString &replacementText)
{
int li = 0;
CMString ret;
@@ -1018,7 +1020,7 @@ CMString WCPattern::replace(const CMString & str, const CMString & replacementTe return ret;
}
-std::vector<CMString> WCPattern::split(const CMString & str, const bool keepEmptys, const unsigned long limit)
+std::vector<CMString> WCPattern::split(const CMString &str, const bool keepEmptys, const unsigned long limit)
{
unsigned long lim = (limit == 0 ? MAX_QMATCH : limit);
int li = 0;
@@ -1042,13 +1044,13 @@ std::vector<CMString> WCPattern::split(const CMString & str, const bool keepEmpt return ret;
}
-std::vector<CMString> WCPattern::findAll(const CMString & str)
+std::vector<CMString> WCPattern::findAll(const CMString &str)
{
matcher->setString(str);
return matcher->findAll();
}
-bool WCPattern::matches(const CMString & str)
+bool WCPattern::matches(const CMString &str)
{
matcher->setString(str);
return matcher->matches();
@@ -1064,7 +1066,7 @@ CMString WCPattern::getWCPattern() const return pattern;
}
-WCMatcher * WCPattern::createWCMatcher(const CMString & str)
+WCMatcher *WCPattern::createWCMatcher(const CMString &str)
{
return new WCMatcher(this, str);
}
@@ -1072,8 +1074,8 @@ WCMatcher * WCPattern::createWCMatcher(const CMString & str) // NFAUNode
NFAUNode::NFAUNode() { next = NULL; }
-NFAUNode::~NFAUNode() { }
-void NFAUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
+NFAUNode::~NFAUNode() {}
+void NFAUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar)
{
if (soFar.find(this) == soFar.end()) return;
soFar[this] = 1;
@@ -1083,7 +1085,7 @@ void NFAUNode::findAllNodes(std::map<NFAUNode*, bool> & 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 CMString &str, WCMatcher *matcher, const int curInd) const
{
if (curInd < str.GetLength() && str[curInd] == ch)
return next->match(str, matcher, curInd + 1);
@@ -1093,7 +1095,7 @@ int NFACharUNode::match(const CMString & str, WCMatcher * matcher, const int cur // 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 CMString &str, WCMatcher *matcher, const int curInd) const
{
if (curInd < str.GetLength() && to_lower(str[curInd]) == ch)
return next->match(str, matcher, curInd + 1);
@@ -1102,8 +1104,8 @@ int NFACICharUNode::match(const CMString & str, WCMatcher * matcher, const int c // NFAStartUNode
-NFAStartUNode::NFAStartUNode() { }
-int NFAStartUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAStartUNode::NFAStartUNode() {}
+int NFAStartUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int ret = -1, ci = curInd;
@@ -1128,8 +1130,8 @@ int NFAStartUNode::match(const CMString & str, WCMatcher * matcher, const int cu // NFAEndUNode
-NFAEndUNode::NFAEndUNode() { }
-int NFAEndUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAEndUNode::NFAEndUNode() {}
+int NFAEndUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
matcher->ends[0] = curInd;
if ((matcher->getFlags() & WCMatcher::MATCH_ENTIRE_STRING) != 0) {
@@ -1144,13 +1146,13 @@ int NFAEndUNode::match(const CMString & str, WCMatcher * matcher, const int curI // NFAQuantifierUNode
-void NFAQuantifierUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
+void NFAQuantifierUNode::findAllNodes(std::map<NFAUNode*, bool> &soFar)
{
inner->findAllNodes(soFar);
NFAUNode::findAllNodes(soFar);
}
-NFAQuantifierUNode::NFAQuantifierUNode(WCPattern * pat, NFAUNode * internal, const int minMatch, const int maxMatch)
+NFAQuantifierUNode::NFAQuantifierUNode(WCPattern *pat, NFAUNode *internal, const int minMatch, const int maxMatch)
{
inner = internal;
inner->next = pat->registerNode(new NFAAcceptUNode);
@@ -1158,7 +1160,7 @@ NFAQuantifierUNode::NFAQuantifierUNode(WCPattern * pat, NFAUNode * internal, con 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 CMString &str, WCMatcher *matcher, const int curInd) const
{
int i0, i1, i2 = 0;
@@ -1176,7 +1178,8 @@ int NFAQuantifierUNode::match(const CMString & str, WCMatcher * matcher, const i NFAGreedyQuantifierUNode::NFAGreedyQuantifierUNode(WCPattern *pat, NFAUNode *internal, const int minMatch, const int maxMatch) :
NFAQuantifierUNode(pat, internal, minMatch, maxMatch)
-{}
+{
+}
int NFAGreedyQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
@@ -1185,7 +1188,7 @@ int NFAGreedyQuantifierUNode::match(const CMString &str, WCMatcher *matcher, con return t;
}
-int NFAGreedyQuantifierUNode::matchInternal(const CMString & str, WCMatcher * matcher, const int curInd, const int soFar) const
+int NFAGreedyQuantifierUNode::matchInternal(const CMString &str, WCMatcher *matcher, const int curInd, const int soFar) const
{
if (soFar >= max)
return next->match(str, matcher, curInd);
@@ -1201,9 +1204,12 @@ int NFAGreedyQuantifierUNode::matchInternal(const CMString & str, WCMatcher * ma // NFALazyQuantifierUNode
-NFALazyQuantifierUNode::NFALazyQuantifierUNode(WCPattern * pat, NFAUNode * internal, const int minMatch, const int maxMatch)
-: NFAQuantifierUNode(pat, internal, minMatch, maxMatch) { }
-int NFALazyQuantifierUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFALazyQuantifierUNode::NFALazyQuantifierUNode(WCPattern * pat, NFAUNode *internal, const int minMatch, const int maxMatch) :
+ NFAQuantifierUNode(pat, internal, minMatch, maxMatch)
+{
+}
+
+int NFALazyQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int m = NFAQuantifierUNode::match(str, matcher, curInd);
if (m == -1)
@@ -1227,9 +1233,12 @@ int NFALazyQuantifierUNode::match(const CMString & str, WCMatcher * matcher, con // NFAPossessiveQuantifierUNode
-NFAPossessiveQuantifierUNode::NFAPossessiveQuantifierUNode(WCPattern * pat, NFAUNode * internal, const int minMatch, const int maxMatch)
-: NFAQuantifierUNode(pat, internal, minMatch, maxMatch) { }
-int NFAPossessiveQuantifierUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAPossessiveQuantifierUNode::NFAPossessiveQuantifierUNode(WCPattern *pat, NFAUNode *internal, const int minMatch, const int maxMatch) :
+ NFAQuantifierUNode(pat, internal, minMatch, maxMatch)
+{
+}
+
+int NFAPossessiveQuantifierUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int m = NFAQuantifierUNode::match(str, matcher, curInd);
if (m == -1)
@@ -1246,8 +1255,11 @@ int NFAPossessiveQuantifierUNode::match(const CMString & str, WCMatcher * matche // NFAAcceptUNode
-NFAAcceptUNode::NFAAcceptUNode() { }
-int NFAAcceptUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAAcceptUNode::NFAAcceptUNode()
+{
+}
+
+int NFAAcceptUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
if (!next) return curInd;
else return next->match(str, matcher, curInd);
@@ -1259,16 +1271,17 @@ NFAClassUNode::NFAClassUNode(const bool invert) {
inv = invert;
}
-NFAClassUNode::NFAClassUNode(const CMString & clazz, const bool invert)
+
+NFAClassUNode::NFAClassUNode(const CMString &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 CMString &str, WCMatcher *matcher, const int curInd) const
{
- if (curInd < str.GetLength() && ((vals.find(str[curInd]) != vals.end()) ^ inv))
- {
+ if (curInd < str.GetLength() && ((vals.find(str[curInd]) != vals.end()) ^ inv)) {
return next->match(str, matcher, curInd + 1);
}
return -1;
@@ -1288,7 +1301,7 @@ NFACIClassUNode::NFACIClassUNode(const CMString & clazz, const bool invert) vals[to_lower(clazz[i])] = 1;
}
-int NFACIClassUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+int NFACIClassUNode::match(const CMString &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);
@@ -1298,22 +1311,29 @@ int NFACIClassUNode::match(const CMString & str, WCMatcher * matcher, const int // NFASubStartUNode
-NFASubStartUNode::NFASubStartUNode() { }
-int NFASubStartUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFASubStartUNode::NFASubStartUNode()
+{
+}
+
+int NFASubStartUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
return next->match(str, matcher, curInd);
}
// NFAOrUNode
-NFAOrUNode::NFAOrUNode(NFAUNode * first, NFAUNode * second) : one(first), two(second) { }
+NFAOrUNode::NFAOrUNode(NFAUNode *first, NFAUNode *second) :
+ one(first), two(second)
+{
+}
+
void NFAOrUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
{
if (one) one->findAllNodes(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 CMString &str, WCMatcher *matcher, const int curInd) const
{
int ci = one->match(str, matcher, curInd);
@@ -1326,8 +1346,12 @@ int NFAOrUNode::match(const CMString & str, WCMatcher * matcher, const int curIn // NFAQuoteUNode
-NFAQuoteUNode::NFAQuoteUNode(const CMString & quoted) : qStr(quoted) { }
-int NFAQuoteUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAQuoteUNode::NFAQuoteUNode(const CMString & quoted) :
+ qStr(quoted)
+{
+}
+
+int NFAQuoteUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
if (curInd + qStr.GetLength() > str.GetLength()) return -1;
if (str.Mid(curInd, qStr.GetLength()) != qStr) return -1;
@@ -1336,8 +1360,12 @@ int NFAQuoteUNode::match(const CMString & str, WCMatcher * matcher, const int cu // NFACIQuoteUNode
-NFACIQuoteUNode::NFACIQuoteUNode(const CMString & quoted) : qStr(quoted) { }
-int NFACIQuoteUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFACIQuoteUNode::NFACIQuoteUNode(const CMString & quoted) :
+ qStr(quoted)
+{
+}
+
+int NFACIQuoteUNode::match(const CMString &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;
@@ -1346,21 +1374,30 @@ int NFACIQuoteUNode::match(const CMString & str, WCMatcher * matcher, const int // NFALookAheadUNode
-NFALookAheadUNode::NFALookAheadUNode(NFAUNode * internal, const bool positive) : NFAUNode(), pos(positive), inner(internal) { }
+NFALookAheadUNode::NFALookAheadUNode(NFAUNode *internal, const bool positive) :
+ NFAUNode(), pos(positive), inner(internal)
+{
+}
+
void NFALookAheadUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
{
if (inner) inner->findAllNodes(soFar);
NFAUNode::findAllNodes(soFar);
}
-int NFALookAheadUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+
+int NFALookAheadUNode::match(const CMString &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) : pos(positive), mStr(str) { }
-int NFALookBehindUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFALookBehindUNode::NFALookBehindUNode(const CMString &str, const bool positive) :
+ pos(positive), mStr(str)
+{
+}
+
+int NFALookBehindUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
if (pos) {
if (curInd < mStr.GetLength())
@@ -1380,20 +1417,25 @@ int NFALookBehindUNode::match(const CMString & str, WCMatcher * matcher, const i // NFAStartOfLineUNode
-NFAStartOfLineUNode::NFAStartOfLineUNode() { }
-int NFAStartOfLineUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAStartOfLineUNode::NFAStartOfLineUNode()
+{
+}
+
+int NFAStartOfLineUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
if (curInd == 0 || str[curInd - 1] == '\n' || str[curInd - 1] == '\r')
- {
return next->match(str, matcher, curInd);
- }
+
return -1;
}
// NFAEndOfLineUNode
-NFAEndOfLineUNode::NFAEndOfLineUNode() { }
-int NFAEndOfLineUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAEndOfLineUNode::NFAEndOfLineUNode()
+{
+}
+
+int NFAEndOfLineUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
if (curInd >= str.GetLength() || str[curInd] == '\n' || str[curInd] == '\r')
return next->match(str, matcher, curInd);
@@ -1403,8 +1445,12 @@ int NFAEndOfLineUNode::match(const CMString & str, WCMatcher * matcher, const in // NFAReferenceUNode
-NFAReferenceUNode::NFAReferenceUNode(const int groupIndex) : gi(groupIndex) { }
-int NFAReferenceUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAReferenceUNode::NFAReferenceUNode(const int groupIndex) :
+ gi(groupIndex)
+{
+}
+
+int NFAReferenceUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int len = matcher->ends[gi] - matcher->starts[gi];
int ni = -1;
@@ -1418,8 +1464,11 @@ int NFAReferenceUNode::match(const CMString & str, WCMatcher * matcher, const in // NFAStartOfInputUNode
-NFAStartOfInputUNode::NFAStartOfInputUNode() { }
-int NFAStartOfInputUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAStartOfInputUNode::NFAStartOfInputUNode()
+{
+}
+
+int NFAStartOfInputUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
if (curInd == 0) return next->match(str, matcher, curInd);
return -1;
@@ -1427,19 +1476,20 @@ int NFAStartOfInputUNode::match(const CMString & str, WCMatcher * matcher, const // NFAEndOfInputUNode
-NFAEndOfInputUNode::NFAEndOfInputUNode(const bool lookForTerm) : term(lookForTerm) { }
-int NFAEndOfInputUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAEndOfInputUNode::NFAEndOfInputUNode(const bool lookForTerm) :
+ term(lookForTerm)
+{
+}
+
+int NFAEndOfInputUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int len = str.GetLength();
if (curInd == len) return next->match(str, matcher, curInd);
- else if (term)
- {
- if (curInd == len - 1 && (str[curInd] == '\r' || str[curInd] == '\n'))
- {
+ else if (term) {
+ if (curInd == len - 1 && (str[curInd] == '\r' || str[curInd] == '\n')) {
return next->match(str, matcher, curInd);
}
- else if (curInd == len - 2 && str.Mid(curInd, 2) == L"\r\n")
- {
+ else if (curInd == len - 2 && str.Mid(curInd, 2) == L"\r\n") {
return next->match(str, matcher, curInd);
}
}
@@ -1448,8 +1498,12 @@ int NFAEndOfInputUNode::match(const CMString & str, WCMatcher * matcher, const i // NFAWordBoundaryUNode
-NFAWordBoundaryUNode::NFAWordBoundaryUNode(const bool positive) : pos(positive) { }
-int NFAWordBoundaryUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAWordBoundaryUNode::NFAWordBoundaryUNode(const bool positive) :
+ pos(positive)
+{
+}
+
+int NFAWordBoundaryUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int len = str.GetLength();
@@ -1464,8 +1518,11 @@ int NFAWordBoundaryUNode::match(const CMString & str, WCMatcher * matcher, const // NFAEndOfMatchUNode
-NFAEndOfMatchUNode::NFAEndOfMatchUNode() { }
-int NFAEndOfMatchUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAEndOfMatchUNode::NFAEndOfMatchUNode()
+{
+}
+
+int NFAEndOfMatchUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
if (curInd == matcher->lm) return next->match(str, matcher, curInd);
return -1;
@@ -1473,8 +1530,12 @@ int NFAEndOfMatchUNode::match(const CMString & str, WCMatcher * matcher, const i // NFAGroupHeadUNode
-NFAGroupHeadUNode::NFAGroupHeadUNode(const int groupIndex) : gi(groupIndex) { }
-int NFAGroupHeadUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAGroupHeadUNode::NFAGroupHeadUNode(const int groupIndex) :
+ gi(groupIndex)
+{
+}
+
+int NFAGroupHeadUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int ret, o = matcher->starts[gi];
@@ -1487,8 +1548,12 @@ int NFAGroupHeadUNode::match(const CMString & str, WCMatcher * matcher, const in // NFAGroupTailUNode
-NFAGroupTailUNode::NFAGroupTailUNode(const int groupIndex) : gi(groupIndex) { }
-int NFAGroupTailUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAGroupTailUNode::NFAGroupTailUNode(const int groupIndex) :
+ gi(groupIndex)
+{
+}
+
+int NFAGroupTailUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int ret, o = matcher->ends[gi];
@@ -1501,8 +1566,12 @@ int NFAGroupTailUNode::match(const CMString & str, WCMatcher * matcher, const in // NFAGroupLoopPrologueUNode
-NFAGroupLoopPrologueUNode::NFAGroupLoopPrologueUNode(const int groupIndex) : gi(groupIndex) { }
-int NFAGroupLoopPrologueUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+NFAGroupLoopPrologueUNode::NFAGroupLoopPrologueUNode(const int groupIndex) :
+ gi(groupIndex)
+{
+}
+
+int NFAGroupLoopPrologueUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int ret, o1 = matcher->groups[gi], o2 = matcher->groupPos[gi], o3 = matcher->groupIndeces[gi];
@@ -1510,8 +1579,7 @@ int NFAGroupLoopPrologueUNode::match(const CMString & str, WCMatcher * matcher, matcher->groupPos[gi] = 0;
matcher->groupIndeces[gi] = -1;
ret = next->match(str, matcher, curInd);
- if (ret < 0)
- {
+ if (ret < 0) {
matcher->groups[gi] = o1;
matcher->groupPos[gi] = o2;
matcher->groupIndeces[gi] = o3;
@@ -1522,7 +1590,7 @@ int NFAGroupLoopPrologueUNode::match(const CMString & str, WCMatcher * matcher, // NFAGroupLoopUNode
-NFAGroupLoopUNode::NFAGroupLoopUNode(NFAUNode * internal, const int minMatch, const int maxMatch,
+NFAGroupLoopUNode::NFAGroupLoopUNode(NFAUNode *internal, const int minMatch, const int maxMatch,
const int groupIndex, const int matchType)
{
inner = internal;
@@ -1531,36 +1599,33 @@ NFAGroupLoopUNode::NFAGroupLoopUNode(NFAUNode * internal, const int minMatch, co gi = groupIndex;
type = matchType;
}
+
void NFAGroupLoopUNode::findAllNodes(std::map<NFAUNode*, bool> & soFar)
{
if (inner) inner->findAllNodes(soFar);
NFAUNode::findAllNodes(soFar);
}
-int NFAGroupLoopUNode::match(const CMString & str, WCMatcher * matcher, const int curInd) const
+
+int NFAGroupLoopUNode::match(const CMString &str, WCMatcher *matcher, const int curInd) const
{
bool b = (curInd > matcher->groupIndeces[gi]);
- if (b && matcher->groups[gi] < min)
- {
+ if (b && matcher->groups[gi] < min) {
++matcher->groups[gi];
int o = matcher->groupIndeces[gi];
matcher->groupIndeces[gi] = curInd;
int ret = inner->match(str, matcher, curInd);
- if (ret < 0)
- {
+ if (ret < 0) {
matcher->groupIndeces[gi] = o;
--matcher->groups[gi];
}
return ret;
}
- else if (!b || matcher->groups[gi] >= max)
- {
+ else if (!b || matcher->groups[gi] >= max) {
return next->match(str, matcher, curInd);
}
- else
- {
- switch (type)
- {
+ else {
+ switch (type) {
case 0: return matchGreedy(str, matcher, curInd);
case 1: return matchLazy(str, matcher, curInd);
case 2: return matchPossessive(str, matcher, curInd);
@@ -1568,25 +1633,25 @@ int NFAGroupLoopUNode::match(const CMString & str, WCMatcher * matcher, const in }
return -1;
}
-int NFAGroupLoopUNode::matchGreedy(const CMString & str, WCMatcher * matcher, const int curInd) const
+
+int NFAGroupLoopUNode::matchGreedy(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int o = matcher->groupIndeces[gi]; // save our info for backtracking
matcher->groupIndeces[gi] = curInd; // move along
++matcher->groups[gi];
int ret = inner->match(str, matcher, curInd); // match internally
- if (ret < 0)
- { // if we failed, then restore info and match next
+ if (ret < 0) { // if we failed, then restore info and match next
--matcher->groups[gi];
matcher->groupIndeces[gi] = o;
ret = next->match(str, matcher, curInd);
}
return ret;
}
-int NFAGroupLoopUNode::matchLazy(const CMString & str, WCMatcher * matcher, const int curInd) const
+
+int NFAGroupLoopUNode::matchLazy(const CMString &str, WCMatcher *matcher, const int curInd) const
{
int ret = next->match(str, matcher, curInd); // be lazy, just go on
- if (ret < 0)
- {
+ if (ret < 0) {
int o = matcher->groupIndeces[gi]; // save info for backtracking
matcher->groupIndeces[gi] = curInd; // advance our position
++matcher->groups[gi];
@@ -1599,7 +1664,8 @@ int NFAGroupLoopUNode::matchLazy(const CMString & str, WCMatcher * matcher, cons }
return ret;
}
-int NFAGroupLoopUNode::matchPossessive(const CMString & str, WCMatcher * matcher, const int curInd) const
+
+int NFAGroupLoopUNode::matchPossessive(const CMString &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/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp index 0f337b892a..5c09efd5ff 100644 --- a/plugins/SmileyAdd/src/smileyroutines.cpp +++ b/plugins/SmileyAdd/src/smileyroutines.cpp @@ -312,14 +312,14 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const // Select text analyze
TextSelection->SetRange(smlpos.cpMin, smlpos.cpMax);
- BSTR btxt = NULL;
+ BSTR bstrText = NULL;
if (smlc == NULL && sml->IsText()) {
- btxt = SysAllocString(T2W_SM(sml->GetToolText().c_str()));
- TextSelection->SetText(btxt);
+ bstrText = SysAllocString(T2W_SM(sml->GetToolText().c_str()));
+ TextSelection->SetText(bstrText);
}
else {
- TextSelection->GetText(&btxt);
+ TextSelection->GetText(&bstrText);
// Get font properties
SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&chf);
@@ -398,13 +398,13 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const TextSelection->SetEnd(smlpos.cpMin);
UpdateSelection(oldSel, smlpos.cpMin , 1);
}
- else UpdateSelection(oldSel, smlpos.cpMin, -(int)SysStringLen(btxt)+1);
+ else UpdateSelection(oldSel, smlpos.cpMin, -(int)SysStringLen(bstrText)+1);
ISmileyBase* smileyBase = CreateAniSmileyObject(smlc ? smlc : sml, chf.crBackColor, ishpp);
if (smileyBase == NULL) continue;
smileyBase->SetExtent(DVASPECT_CONTENT, &sizehm);
- smileyBase->SetHint(W2T_SM(btxt));
+ smileyBase->SetHint(W2T_SM(bstrText));
smileyBase->SetPosition(hwnd, NULL);
@@ -419,7 +419,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const reobject.poleobj = smileyBase;
reobject.polesite = pOleClientSite;
reobject.dwFlags = REO_BELOWBASELINE | REO_BLANK;
- reobject.dwUser = (DWORD)smileyBase;
+ reobject.dwUser = (DWORD_PTR)smileyBase;
// Insert the bitmap at the current location in the richedit control
RichEditOle->InsertObject(&reobject);
@@ -433,7 +433,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const UpdateSelection(oldSel, smlpos.cpMin , 1);
}
}
- SysFreeString(btxt);
+ SysFreeString(bstrText);
}
SysFreeString(spaceb);
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index d373dc2190..698e6195a6 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -27,7 +27,6 @@ SmileyCategoryListType g_SmileyCategories; // SmileyType
//
-
SmileyType::SmileyType(void)
{
m_SmileyIcon = NULL;
@@ -35,10 +34,10 @@ SmileyType::SmileyType(void) m_flags = 0;
m_index = 0;
m_size.cx = 0;
- m_size.cy = 0;
+ m_size.cy = 0;
}
-SmileyType::~SmileyType()
+SmileyType::~SmileyType()
{
if (m_xepimg) m_xepimg->Release();
m_xepimg = NULL;
@@ -49,9 +48,8 @@ SmileyType::~SmileyType() HICON SmileyType::GetIcon(void)
-{
- if (m_SmileyIcon == NULL)
- {
+{
+ if (m_SmileyIcon == NULL) {
ImageBase* img = CreateCachedImage();
if (!img) return NULL;
img->SelectFrame(m_index);
@@ -62,8 +60,8 @@ HICON SmileyType::GetIcon(void) }
-HICON SmileyType::GetIconDup(void)
-{
+HICON SmileyType::GetIconDup(void)
+{
ImageBase* img = CreateCachedImage();
img->SelectFrame(m_index);
HICON hIcon = img->GetIcon();
@@ -94,11 +92,9 @@ bool SmileyType::LoadFromResource(const CMString& file, const int index) void SmileyType::GetSize(SIZE& size)
{
- if (m_size.cy == 0)
- {
+ if (m_size.cy == 0) {
ImageBase* img = CreateCachedImage();
- if (img)
- {
+ if (img) {
img->GetSize(m_size);
img->Release();
}
@@ -109,8 +105,7 @@ void SmileyType::GetSize(SIZE& size) ImageBase* SmileyType::CreateCachedImage(void)
{
- if (m_xepimg)
- {
+ if (m_xepimg) {
m_xepimg->AddRef();
return m_xepimg;
}
@@ -120,7 +115,7 @@ ImageBase* SmileyType::CreateCachedImage(void) void SmileyType::SetImList(HIMAGELIST hImLst, long i)
{
- if (m_xepimg) m_xepimg->Release();
+ if (m_xepimg) m_xepimg->Release();
m_xepimg = new ImageListItemType(0, hImLst, i);
}
@@ -147,8 +142,8 @@ SmileyPackType::SmileyPackType() errorFound = false;
}
-SmileyType* SmileyPackType::GetSmiley(unsigned index)
-{
+SmileyType* SmileyPackType::GetSmiley(unsigned index)
+{
return (index < (unsigned)m_SmileyList.getCount()) ? &m_SmileyList[index] : NULL;
}
@@ -171,8 +166,8 @@ static DWORD_PTR ConvertServiceParam(MCONTACT hContact, const TCHAR *param) void SmileyType::CallSmileyService(MCONTACT hContact)
{
- _TPattern * srvsplit = _TPattern::compile(_T("(.*)\\|(.*)\\|(.*)"));
- _TMatcher * m0 = srvsplit->createTMatcher(GetTriggerText());
+ _TPattern *srvsplit = _TPattern::compile(_T("(.*)\\|(.*)\\|(.*)"));
+ _TMatcher *m0 = srvsplit->createTMatcher(GetTriggerText());
m0->findFirstMatch();
CMString name = m0->getGroup(1);
@@ -185,14 +180,13 @@ void SmileyType::CallSmileyService(MCONTACT hContact) char str[MAXMODULELABELLENGTH];
const char *proto = "";
- if (name[0] == '/')
- {
+ if (name[0] == '/') {
proto = (const char*)GetContactProto(hContact);
if (proto == NULL) return;
}
mir_snprintf(str, "%s%s", proto, T2A_SM(name.c_str()));
CallService(str,
- ConvertServiceParam(hContact, par1.c_str()),
+ ConvertServiceParam(hContact, par1.c_str()),
ConvertServiceParam(hContact, par2.c_str()));
}
@@ -203,14 +197,14 @@ SmileyPackType::~SmileyPackType() if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
}
-static const TCHAR urlRegEx[] =
- _T("(?:ftp|https|http|file|aim|webcal|irc|msnim|xmpp|gopher|mailto|news|nntp|telnet|wais|prospero)://?[\\w.?%:/$+;]*");
+static const TCHAR urlRegEx[] =
+_T("(?:ftp|https|http|file|aim|webcal|irc|msnim|xmpp|gopher|mailto|news|nntp|telnet|wais|prospero)://?[\\w.?%:/$+;]*");
static const TCHAR pathRegEx[] = _T("[\\s\"][a-zA-Z]:[\\\\/][\\w.\\-\\\\/]*");
static const TCHAR timeRegEx[] = _T("\\d{1,2}:\\d{2}:\\d{2}|\\d{1,2}:\\d{2}");
void SmileyPackType::AddTriggersToSmileyLookup(void)
{
- _TPattern * p = _TPattern::compile(_T("\\s+"));
+ _TPattern *p = _TPattern::compile(_T("\\s+"));
{
CMString emptystr;
m_SmileyLookup.insert(new SmileyLookup(urlRegEx, true, -1, emptystr));
@@ -223,7 +217,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) SmileyLookup* dats = new SmileyLookup(m_SmileyList[dist].GetTriggerText(), true, dist, GetFilename());
if (dats->IsValid())
m_SmileyLookup.insert(dats);
- else
+ else
errorFound = true;
if (m_SmileyList[dist].m_InsertText.IsEmpty())
m_SmileyList[dist].m_InsertText = m_SmileyList[dist].m_ToolText;
@@ -231,14 +225,13 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) else if (!m_SmileyList[dist].IsService()) {
bool first = true;
int li = 0;
- _TMatcher * m0 = p->createTMatcher(m_SmileyList[dist].GetTriggerText());
- while (m0->findNextMatch())
- {
+ _TMatcher *m0 = p->createTMatcher(m_SmileyList[dist].GetTriggerText());
+ while (m0->findNextMatch()) {
int stind = m0->getStartingIndex();
if (li != stind) {
CMString out;
ReplaceAllSpecials(m0->getString().Mid(li, stind - li), out);
- SmileyLookup *dats = new SmileyLookup(out, false, dist, GetFilename());
+ SmileyLookup *dats = new SmileyLookup(out, false, dist, GetFilename());
if (dats->IsValid()) {
m_SmileyLookup.insert(dats);
if (first) {
@@ -254,7 +247,7 @@ void SmileyPackType::AddTriggersToSmileyLookup(void) if (li < stind) {
CMString out;
ReplaceAllSpecials(m0->getString().Mid(li, stind - li), out);
- SmileyLookup *dats = new SmileyLookup(out, false, dist, GetFilename());
+ SmileyLookup *dats = new SmileyLookup(out, false, dist, GetFilename());
if (dats->IsValid()) {
m_SmileyLookup.insert(dats);
if (first) {
@@ -328,24 +321,24 @@ bool SmileyPackType::LoadSmileyFile(const CMString& filename, const CMString& pa // Read xep file in
int len = _read(fh, buf, flen);
- *(wchar_t*)(buf+len) = 0;
+ *(wchar_t*)(buf + len) = 0;
// Close file
_close(fh);
CMString tbuf;
- if (len>2 && *(wchar_t*)buf == 0xfeff)
- tbuf = W2T_SM((wchar_t*)buf+1);
- else if (len>3 && buf[0]=='\xef' && buf[1]=='\xbb' && buf[2]=='\xbf')
- tbuf = W2T_SM(A2W_SM(buf+3, CP_UTF8));
+ if (len > 2 && *(wchar_t*)buf == 0xfeff)
+ tbuf = W2T_SM((wchar_t*)buf + 1);
+ else if (len > 3 && buf[0] == '\xef' && buf[1] == '\xbb' && buf[2] == '\xbf')
+ tbuf = W2T_SM(A2W_SM(buf + 3, CP_UTF8));
else
tbuf = A2T_SM(buf);
delete[] buf;
bool res;
- if (filename.Find(_T(".xep")) == -1)
+ if (filename.Find(_T(".xep")) == -1)
res = LoadSmileyFileMSL(tbuf, onlyInfo, modpath);
else
res = LoadSmileyFileXEP(tbuf, onlyInfo, modpath);
@@ -356,40 +349,37 @@ bool SmileyPackType::LoadSmileyFile(const CMString& filename, const CMString& pa return res;
}
-bool SmileyPackType::LoadSmileyFileMSL(CMString& tbuf, bool onlyInfo, CMString& modpath)
+bool SmileyPackType::LoadSmileyFileMSL(CMString &tbuf, bool onlyInfo, CMString &modpath)
{
- _TPattern * pathsplit = _TPattern::compile(_T("(.*\\\\)(.*)\\.|$"));
- _TMatcher * m0 = pathsplit->createTMatcher(modpath);
-
- m0->findFirstMatch();
- const CMString pathstr = m0->getGroup(1);
- const CMString packstr = m0->getGroup(2);
-
- delete m0;
- delete pathsplit;
-
- _TPattern * otherf = _TPattern::compile(
- _T("^\\s*(Name|Author|Date|Version|ButtonSmiley)\\s*=\\s*\"(.*)\""),
- _TPattern::MULTILINE_MATCHING);
-
- m0 = otherf->createTMatcher(tbuf);
-
- while (m0->findNextMatch())
+ CMString pathstr, packstr;
{
- if (m0->getGroup(1) == _T("Name")) m_Name = m0->getGroup(2);
- if (m0->getGroup(1) == _T("Author")) m_Author = m0->getGroup(2);
- if (m0->getGroup(1) == _T("Date")) m_Date = m0->getGroup(2);
- if (m0->getGroup(1) == _T("Version")) m_Version = m0->getGroup(2);
- if (m0->getGroup(1) == _T("ButtonSmiley")) m_ButtonSmiley = m0->getGroup(2);
+ _TPattern *pathsplit = _TPattern::compile(_T("(.*\\\\)(.*)\\.|$"));
+ _TMatcher *m0 = pathsplit->createTMatcher(modpath);
+ m0->findFirstMatch();
+ pathstr = m0->getGroup(1);
+ packstr = m0->getGroup(2);
+ delete m0;
+ delete pathsplit;
+ }
+ {
+ _TPattern *otherf = _TPattern::compile(
+ _T("^\\s*(Name|Author|Date|Version|ButtonSmiley)\\s*=\\s*\"(.*)\""),
+ _TPattern::MULTILINE_MATCHING);
+
+ _TMatcher *m0 = otherf->createTMatcher(tbuf);
+ while (m0->findNextMatch()) {
+ if (m0->getGroup(1) == _T("Name")) m_Name = m0->getGroup(2);
+ if (m0->getGroup(1) == _T("Author")) m_Author = m0->getGroup(2);
+ if (m0->getGroup(1) == _T("Date")) m_Date = m0->getGroup(2);
+ if (m0->getGroup(1) == _T("Version")) m_Version = m0->getGroup(2);
+ if (m0->getGroup(1) == _T("ButtonSmiley")) m_ButtonSmiley = m0->getGroup(2);
+ }
+ delete m0;
+ delete otherf;
}
- delete m0;
- delete otherf;
if (!onlyInfo) {
- selec.x = 0;
- selec.y = 0;
- win.x = 0;
- win.y = 0;
+ selec.x = selec.y = win.x = win.y = 0;
{
_TPattern *pat = _TPattern::compile(
_T("^\\s*(Selection|Window)Size\\s*=\\s*(\\d+)\\s*,\\s*(\\d+)"),
@@ -409,7 +399,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString& tbuf, bool onlyInfo, CMString& delete pat;
}
- _TPattern * smiley = _TPattern::compile(
+ _TPattern *smiley = _TPattern::compile(
_T("^\\s*Smiley(\\*)?\\s*=") // Is Hidden
_T("(?:\\s*\"(.*)\")") // Smiley file name
_T("(?:[\\s,]+(\\-?\\d+))") // Icon resource id
@@ -418,69 +408,70 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString& tbuf, bool onlyInfo, CMString& _T("(?:[\\s,]+\"(.*?)\")?"), // Tooltip text
_TPattern::MULTILINE_MATCHING);
- _TMatcher * m0 = smiley->createTMatcher(tbuf);
SmileyVectorType hiddenSmileys;
-
unsigned smnum = 0;
- while (m0->findNextMatch()) {
- CMString resname = m0->getGroup(2);
- if (resname.Find(_T("http://")) != -1) {
- if (GetSmileyFile(resname, packstr))
- continue;
- }
- else if (!resname.IsEmpty())
- resname.Insert(0, pathstr);
-
- SmileyType *dat = new SmileyType;
-
- const int iconIndex = _ttol(m0->getGroup(3).c_str());
+ {
+ _TMatcher *m0 = smiley->createTMatcher(tbuf);
+ while (m0->findNextMatch()) {
+ CMString resname = m0->getGroup(2);
+ if (resname.Find(_T("http://")) != -1) {
+ if (GetSmileyFile(resname, packstr))
+ continue;
+ }
+ else if (!resname.IsEmpty())
+ resname.Insert(0, pathstr);
- dat->SetHidden(m0->getStartingIndex(1) >= 0);
- if (m0->getStartingIndex(4) >= 0) {
- dat->SetRegEx(m0->getGroup(4) == _T("R"));
- dat->SetService(m0->getGroup(4) == _T("S"));
- }
- dat->m_TriggerText = m0->getGroup(5);
- if (dat->IsRegEx()) {
- if (m0->getStartingIndex(6) >= 0)
- ReplaceAllSpecials(m0->getGroup(6), dat->m_InsertText);
+ SmileyType *dat = new SmileyType;
- if (m0->getStartingIndex(7) >= 0)
- ReplaceAllSpecials(m0->getGroup(7), dat->m_ToolText);
- else
- dat->m_ToolText = dat->m_InsertText;
- }
- else {
- if (m0->getStartingIndex(6) >= 0)
- ReplaceAllSpecials(m0->getGroup(6), dat->m_ToolText);
- else
- ReplaceAllSpecials(dat->m_TriggerText, dat->m_ToolText);
- }
+ const int iconIndex = _ttol(m0->getGroup(3).c_str());
- bool noerr;
- if (resname.IsEmpty()) {
- dat->SetHidden(true);
- dat->SetText(true);
- noerr = true;
- }
- else noerr = dat->LoadFromResource(resname, iconIndex);
+ dat->SetHidden(m0->getStartingIndex(1) >= 0);
+ if (m0->getStartingIndex(4) >= 0) {
+ dat->SetRegEx(m0->getGroup(4) == _T("R"));
+ dat->SetService(m0->getGroup(4) == _T("S"));
+ }
+ dat->m_TriggerText = m0->getGroup(5);
+ if (dat->IsRegEx()) {
+ if (m0->getStartingIndex(6) >= 0)
+ ReplaceAllSpecials(m0->getGroup(6), dat->m_InsertText);
+
+ if (m0->getStartingIndex(7) >= 0)
+ ReplaceAllSpecials(m0->getGroup(7), dat->m_ToolText);
+ else
+ dat->m_ToolText = dat->m_InsertText;
+ }
+ else {
+ if (m0->getStartingIndex(6) >= 0)
+ ReplaceAllSpecials(m0->getGroup(6), dat->m_ToolText);
+ else
+ ReplaceAllSpecials(dat->m_TriggerText, dat->m_ToolText);
+ }
- if (dat->IsHidden())
- hiddenSmileys.insert(dat);
- else
- m_SmileyList.insert(dat);
+ bool noerr;
+ if (resname.IsEmpty()) {
+ dat->SetHidden(true);
+ dat->SetText(true);
+ noerr = true;
+ }
+ else noerr = dat->LoadFromResource(resname, iconIndex);
- if (!noerr) {
- static const TCHAR errmsg[] = LPGENT("Smiley #%u in file %s for smiley pack %s not found.");
- TCHAR msgtxt[1024];
- mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
- errorFound = true;
+ if (dat->IsHidden())
+ hiddenSmileys.insert(dat);
+ else
+ m_SmileyList.insert(dat);
+
+ if (!noerr) {
+ static const TCHAR errmsg[] = LPGENT("Smiley #%u in file %s for smiley pack %s not found.");
+ TCHAR msgtxt[1024];
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
+ CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
+ errorFound = true;
+ }
+ smnum++;
}
- smnum++;
+ delete smiley;
+ delete m0;
}
- delete m0;
- delete smiley;
m_VisibleCount = m_SmileyList.getCount();
@@ -524,33 +515,30 @@ static IStream* DecodeBase64Data(const char* pData) }
-bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& )
+bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString&)
{
_TMatcher *m0, *m1, *m2;
- _TPattern * dbname_re = _TPattern::compile(_T("<DataBaseName>\\s*\"(.*?)\"\\s*</DataBaseName>"),
+ _TPattern *dbname_re = _TPattern::compile(_T("<DataBaseName>\\s*\"(.*?)\"\\s*</DataBaseName>"),
_TPattern::MULTILINE_MATCHING);
- _TPattern * author_re = _TPattern::compile(_T("<PackageAuthor>\\s*\"(.*?)\"\\s*</PackageAuthor>"),
+ _TPattern *author_re = _TPattern::compile(_T("<PackageAuthor>\\s*\"(.*?)\"\\s*</PackageAuthor>"),
_TPattern::MULTILINE_MATCHING);
- _TPattern * settings_re = _TPattern::compile(_T("<settings>(.*?)</settings>"),
+ _TPattern *settings_re = _TPattern::compile(_T("<settings>(.*?)</settings>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
m0 = settings_re->createTMatcher(tbuf);
- if (m0->findFirstMatch())
- {
+ if (m0->findFirstMatch()) {
CMString settings = m0->getGroup(1);
m1 = author_re->createTMatcher(settings);
- if (m1->findFirstMatch())
- {
+ if (m1->findFirstMatch()) {
m_Author = m1->getGroup(1);
DecodeHTML(m_Author);
}
delete m1;
m1 = dbname_re->createTMatcher(settings);
- if (m1->findFirstMatch())
- {
+ if (m1->findFirstMatch()) {
m_Name = m1->getGroup(1);
DecodeHTML(m_Name);
}
@@ -562,32 +550,28 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& delete author_re;
delete settings_re;
- if (!onlyInfo)
- {
- _TPattern * record_re = _TPattern::compile(_T("<record.*?ImageIndex=\"(.*?)\".*?>(?:\\s*\"(.*?)\")?(.*?)</record>"),
+ if (!onlyInfo) {
+ _TPattern *record_re = _TPattern::compile(_T("<record.*?ImageIndex=\"(.*?)\".*?>(?:\\s*\"(.*?)\")?(.*?)</record>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
- _TPattern * expression_re = _TPattern::compile(_T("<Expression>\\s*\"(.*?)\"\\s*</Expression>"),
+ _TPattern *expression_re = _TPattern::compile(_T("<Expression>\\s*\"(.*?)\"\\s*</Expression>"),
_TPattern::MULTILINE_MATCHING);
- _TPattern * pastetext_re = _TPattern::compile(_T("<PasteText>\\s*\"(.*?)\"\\s*</PasteText>"),
+ _TPattern *pastetext_re = _TPattern::compile(_T("<PasteText>\\s*\"(.*?)\"\\s*</PasteText>"),
_TPattern::MULTILINE_MATCHING);
- _TPattern * images_re = _TPattern::compile(_T("<images>(.*?)</images>"),
+ _TPattern *images_re = _TPattern::compile(_T("<images>(.*?)</images>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
- _TPattern * image_re = _TPattern::compile(_T("<Image>(.*?)</Image>"),
+ _TPattern *image_re = _TPattern::compile(_T("<Image>(.*?)</Image>"),
_TPattern::MULTILINE_MATCHING | _TPattern::DOT_MATCHES_ALL);
- _TPattern * imagedt_re = _TPattern::compile(_T("<!\\[CDATA\\[(.*?)\\]\\]>"),
- _TPattern::MULTILINE_MATCHING );
+ _TPattern *imagedt_re = _TPattern::compile(_T("<!\\[CDATA\\[(.*?)\\]\\]>"),
+ _TPattern::MULTILINE_MATCHING);
m0 = images_re->createTMatcher(tbuf);
- if (m0->findFirstMatch())
- {
+ if (m0->findFirstMatch()) {
CMString images = m0->getGroup(1);
m1 = imagedt_re->createTMatcher(images);
- if (m1->findFirstMatch())
- {
+ if (m1->findFirstMatch()) {
IStream* pStream = DecodeBase64Data(T2A_SM(m1->getGroup(1).c_str()));
- if (pStream != NULL)
- {
+ if (pStream != NULL) {
if (m_hSmList != NULL) ImageList_Destroy(m_hSmList);
m_hSmList = ImageList_Read(pStream);
pStream->Release();
@@ -598,9 +582,8 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& delete m0;
m0 = record_re->createTMatcher(tbuf);
- while (m0->findNextMatch())
- {
- SmileyType *dat = new SmileyType;
+ while (m0->findNextMatch()) {
+ SmileyType *dat = new SmileyType;
dat->SetRegEx(true);
dat->SetImList(m_hSmList, _ttol(m0->getGroup(1).c_str()));
@@ -610,16 +593,14 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& CMString rec = m0->getGroup(3);
m1 = expression_re->createTMatcher(rec);
- if (m1->findFirstMatch())
- {
+ if (m1->findFirstMatch()) {
dat->m_TriggerText = m1->getGroup(1);
DecodeHTML(dat->m_TriggerText);
}
delete m1;
m1 = pastetext_re->createTMatcher(rec);
- if (m1->findFirstMatch())
- {
+ if (m1->findFirstMatch()) {
dat->m_InsertText = m1->getGroup(1);
DecodeHTML(dat->m_InsertText);
}
@@ -627,16 +608,13 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& dat->SetHidden(dat->m_InsertText.IsEmpty());
m1 = image_re->createTMatcher(rec);
- if (m1->findFirstMatch())
- {
+ if (m1->findFirstMatch()) {
CMString images = m1->getGroup(1);
m2 = imagedt_re->createTMatcher(images);
- if (m2->findFirstMatch())
- {
+ if (m2->findFirstMatch()) {
IStream* pStream = DecodeBase64Data(T2A_SM(m2->getGroup(1).c_str()));
- if (pStream != NULL)
- {
+ if (pStream != NULL) {
dat->LoadFromImage(pStream);
pStream->Release();
}
@@ -663,8 +641,8 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& selec.x = 0;
selec.y = 0;
- win.x = 0;
- win.y = 0;
+ win.x = 0;
+ win.y = 0;
return true;
}
@@ -678,8 +656,7 @@ bool SmileyPackType::LoadSmileyFileXEP(CMString& tbuf, bool onlyInfo, CMString& bool SmileyPackListType::AddSmileyPack(CMString& filename, CMString& packname)
{
bool res = true;
- if (GetSmileyPack(filename) == NULL)
- { //not exist yet, so add
+ if (GetSmileyPack(filename) == NULL) { //not exist yet, so add
SmileyPackType *smileyPack = new SmileyPackType;
res = smileyPack->LoadSmileyFile(filename, packname, FALSE);
@@ -697,7 +674,7 @@ SmileyPackType* SmileyPackListType::GetSmileyPack(CMString& filename) CMString modpath;
pathToAbsolute(filename, modpath);
- for (int i=0; i < m_SmileyPacks.getCount(); i++) {
+ for (int i = 0; i < m_SmileyPacks.getCount(); i++) {
CMString modpath1;
pathToAbsolute(m_SmileyPacks[i].GetFilename(), modpath1);
if (mir_tstrcmpi(modpath.c_str(), modpath1.c_str()) == 0) return &m_SmileyPacks[i];
@@ -716,13 +693,13 @@ void SmileyPackListType::ClearAndFreeAll() //
-SmileyCategoryType::SmileyCategoryType(SmileyPackListType* pSPS, const CMString& name,
- const CMString& displayName,
+SmileyCategoryType::SmileyCategoryType(SmileyPackListType* pSPS, const CMString& name,
+ const CMString& displayName,
const CMString& defaultFilename, SmcType typ)
-{
- m_pSmileyPackStore = pSPS;
- type = typ;
- m_Name = name;
+{
+ m_pSmileyPackStore = pSPS;
+ type = typ;
+ m_Name = name;
m_DisplayName = displayName;
visible = true;
@@ -732,12 +709,11 @@ SmileyCategoryType::SmileyCategoryType(SmileyPackListType* pSPS, const CMString& void SmileyCategoryType::Load(void)
{
- bool visiblecat = opt.UsePhysProto ? !IsAcc() : !IsPhysProto();
- bool visible = opt.UseOneForAll ? !IsProto() : visiblecat;
-
- if (visible && !m_Filename.IsEmpty()){
+ bool bVisibleCat = opt.UsePhysProto ? !IsAcc() : !IsPhysProto();
+ bool bVisible = opt.UseOneForAll ? !IsProto() : bVisibleCat;
+ if (bVisible && !m_Filename.IsEmpty()) {
bool loaded = m_pSmileyPackStore->AddSmileyPack(m_Filename, m_DisplayName);
- if (!loaded){
+ if (!loaded) {
ClearFilename();
SaveSettings();
}
@@ -745,15 +721,15 @@ void SmileyCategoryType::Load(void) }
-SmileyPackType* SmileyCategoryType::GetSmileyPack(void)
-{
- return m_pSmileyPackStore->GetSmileyPack(m_Filename);
+SmileyPackType* SmileyCategoryType::GetSmileyPack(void)
+{
+ return m_pSmileyPackStore->GetSmileyPack(m_Filename);
}
void SmileyCategoryType::SaveSettings(void)
-{
- opt.WritePackFileName(m_Filename, m_Name);
+{
+ opt.WritePackFileName(m_Filename, m_Name);
}
//
@@ -764,14 +740,14 @@ void SmileyCategoryListType::ClearAndLoadAll(void) {
m_pSmileyPackStore->ClearAndFreeAll();
- for (int i=0; i < m_SmileyCategories.getCount(); i++)
+ for (int i = 0; i < m_SmileyCategories.getCount(); i++)
m_SmileyCategories[i].Load();
}
SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(const CMString& name)
{
- for (int i=0; i < m_SmileyCategories.getCount(); i++)
+ for (int i = 0; i < m_SmileyCategories.getCount(); i++)
if (name.CompareNoCase(m_SmileyCategories[i].GetName()) == 0)
return &m_SmileyCategories[i];
@@ -785,17 +761,17 @@ SmileyCategoryType* SmileyCategoryListType::GetSmileyCategory(unsigned index) }
-SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMString& categoryname)
+SmileyPackType* SmileyCategoryListType::GetSmileyPack(CMString& categoryname)
{
SmileyCategoryType* smc = GetSmileyCategory(categoryname);
- return smc != NULL ? smc->GetSmileyPack() : NULL;
+ return smc != NULL ? smc->GetSmileyPack() : NULL;
}
void SmileyCategoryListType::SaveSettings(void)
{
CMString catstr;
- for (int i=0; i < m_SmileyCategories.getCount(); i++) {
+ for (int i = 0; i < m_SmileyCategories.getCount(); i++) {
m_SmileyCategories[i].SaveSettings();
if (m_SmileyCategories[i].IsCustom()) {
if (!catstr.IsEmpty()) catstr += '#';
@@ -814,16 +790,16 @@ void SmileyCategoryListType::AddAndLoad(const CMString& name, const CMString& di AddCategory(name, displayName, smcExt);
// Load only if other smileys have been loaded already
if (m_SmileyCategories.getCount() > 1)
- m_SmileyCategories[m_SmileyCategories.getCount()-1].Load();
+ m_SmileyCategories[m_SmileyCategories.getCount() - 1].Load();
}
-void SmileyCategoryListType::AddCategory(const CMString& name, const CMString& displayName,
+void SmileyCategoryListType::AddCategory(const CMString& name, const CMString& displayName,
SmcType typ, const CMString& defaultFilename)
{
if (GetSmileyCategory(name) == NULL)
- m_SmileyCategories.insert(new SmileyCategoryType(m_pSmileyPackStore, name,
- displayName, defaultFilename, typ));
+ m_SmileyCategories.insert(new SmileyCategoryType(m_pSmileyPackStore, name,
+ displayName, defaultFilename, typ));
}
@@ -840,22 +816,21 @@ bool SmileyCategoryListType::DeleteCustomCategory(int index) void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMString& defaultFile)
{
- if (Proto_IsAccountEnabled(acc) && acc->szProtoName && IsSmileyProto(acc->szModuleName))
- {
+ if (Proto_IsAccountEnabled(acc) && acc->szProtoName && IsSmileyProto(acc->szModuleName)) {
CMString displayName(acc->tszAccountName ? acc->tszAccountName : A2T_SM(acc->szModuleName));
CMString PhysProtoName, paths;
DBVARIANT dbv;
-
- if (db_get_ts(NULL, acc->szModuleName, "AM_BaseProto", &dbv) == 0){
+
+ if (db_get_ts(NULL, acc->szModuleName, "AM_BaseProto", &dbv) == 0) {
PhysProtoName = _T("AllProto");
PhysProtoName += dbv.ptszVal;
- db_free(&dbv);
+ db_free(&dbv);
}
if (!PhysProtoName.IsEmpty())
paths = g_SmileyCategories.GetSmileyCategory(PhysProtoName) ? g_SmileyCategories.GetSmileyCategory(PhysProtoName)->GetFilename() : _T("");
-
- if (paths.IsEmpty()){
+
+ if (paths.IsEmpty()) {
const char* packnam = acc->szProtoName;
if (mir_strcmp(packnam, "JABBER") == 0)
packnam = "JGMail";
@@ -865,7 +840,7 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr char path[MAX_PATH];
mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packnam);
- paths = A2T_SM(path);
+ paths = A2T_SM(path);
CMString patha;
pathToAbsolute(paths, patha);
@@ -882,7 +857,7 @@ void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString& defau {
if (acc == NULL)
return;
-
+
const char* packnam = acc;
if (mir_strcmp(packnam, "JABBER") == 0)
packnam = "JGMail";
@@ -922,7 +897,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) }
}
- for (int i=0; i < m_SmileyCategories.getCount(); i++) {
+ for (int i = 0; i < m_SmileyCategories.getCount(); i++) {
if (tname.CompareNoCase(m_SmileyCategories[i].GetName()) == 0) {
m_SmileyCategories.remove(i);
break;
@@ -946,15 +921,15 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co const char *packname = NULL;
if (strstr(trsp, "msn") != NULL)
- packname = "msn";
+ packname = "msn";
else if (strstr(trsp, "icq") != NULL)
- packname = "icq";
+ packname = "icq";
else if (strstr(trsp, "yahoo") != NULL)
- packname = "yahoo";
+ packname = "yahoo";
else if (strstr(trsp, "aim") != NULL)
- packname = "aim";
+ packname = "aim";
else if (strstr(trsp, "lcs") != NULL)
- packname = "msn";
+ packname = "msn";
mir_free(trsp);
@@ -963,13 +938,13 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co char path[MAX_PATH];
mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packname);
- CMString paths = A2T_SM(path), patha;
+ CMString paths = A2T_SM(path), patha;
pathToAbsolute(paths, patha);
- if (_taccess(patha.c_str(), 0) != 0)
+ if (_taccess(patha.c_str(), 0) != 0)
paths = defaultFile;
- AddCategory(displayName, displayName, smcTransportProto, paths);
+ AddCategory(displayName, displayName, smcTransportProto, paths);
}
else AddCategory(displayName, displayName, smcTransportProto, defaultFile);
@@ -983,19 +958,19 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) CMString tname = _T("Standard");
AddCategory(tname, displayName, smcStd);
- const CMString& defaultFile = GetSmileyCategory(tname)->GetFilename();
+ const CMString &defaultFile = GetSmileyCategory(tname)->GetFilename();
PROTOCOLDESCRIPTOR **proto;
int protoCount = 0;
Proto_EnumProtocols(&protoCount, &proto);
- for (int i = 0; i < protoCount; i++){
- PROTOCOLDESCRIPTOR* pd = proto[i];
+ for (int i = 0; i < protoCount; i++) {
+ PROTOCOLDESCRIPTOR *pd = proto[i];
if (pd->type == PROTOTYPE_PROTOCOL && pd->cbSize == sizeof(*pd))
- AddProtoAsCategory(pd->szName, defaultFile);
+ AddProtoAsCategory(pd->szName, defaultFile);
}
- PROTOACCOUNT **accList;
+ PROTOACCOUNT **accList;
Proto_EnumAccounts(&protoCount, &accList);
for (int i = 0; i < protoCount; i++)
AddAccountAsCategory(accList[i], defaultFile);
@@ -1006,12 +981,12 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) CMString cats;
opt.ReadCustomCategories(cats);
- int cppv = 0;
+ int cppv = 0;
for (;;) {
int cp = cats.Find('#', cppv);
if (cp == -1)
break;
-
+
displayName = cats.Mid(cppv, cp - cppv);
AddCategory(displayName, displayName, smcCustom, defaultFile);
cppv = cp + 1;
@@ -1044,13 +1019,13 @@ SmileyLookup::SmileyLookup(const CMString& str, const bool regexs, const int ind delete matcher;
}
else {
- static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" malformed.") ;
+ static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" malformed.");
mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
if (!m_valid)
CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
- }
+ }
else {
m_text = str;
m_pattern = NULL;
@@ -1071,7 +1046,7 @@ void SmileyLookup::Find(const CMString& str, SmileyLocVecType& smlcur, bool firs if (m_text.IsEmpty()) {
_TMatcher* matcher = m_pattern->createTMatcher(str);
- while( matcher->findNextMatch()) {
+ while (matcher->findNextMatch()) {
int st = matcher->getStartingIndex();
int sz = matcher->getEndingIndex() - st;
if (sz != 0) {
@@ -1084,7 +1059,7 @@ void SmileyLookup::Find(const CMString& str, SmileyLocVecType& smlcur, bool firs }
else {
const TCHAR* pos = str.c_str();
- while( (pos = _tcsstr(pos, m_text.c_str())) != NULL ) {
+ while ((pos = _tcsstr(pos, m_text.c_str())) != NULL) {
smlcur.insert(new SmileyLocType(pos - str.c_str(), m_text.GetLength()));
pos += m_text.GetLength();
if (firstOnly && m_ind != -1)
|