From 23da585729242bc135e7a6da0dc5bf699e6c9b54 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 19 Apr 2015 21:12:24 +0000 Subject: - all strings operations were rewritten using CMString instead of ugly self-made buffers; - CComPtr<> introduced to simplify COM calls processing; - version bump. git-svn-id: http://svn.miranda-ng.org/main/trunk@12946 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/IEView/src/TextToken.cpp | 77 ++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 46 deletions(-) (limited to 'plugins/IEView/src/TextToken.cpp') diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index 5af554cfb7..14c8b2500b 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -500,13 +500,13 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) return output; } -void TextToken::toString(wchar_t **str, int *sizeAlloced) +void TextToken::toString(CMStringW &str) { wchar_t *eText = NULL, *eLink = NULL; switch (type) { case TEXT: eText = htmlEncode(wtext); - Utils::appendText(str, sizeAlloced, L"%s", eText); + str.Append(eText); break; case WWWLINK: case LINK: @@ -547,7 +547,7 @@ void TextToken::toString(wchar_t **str, int *sizeAlloced) }; - Utils::appendText(str, sizeAlloced, L"
\ + str.AppendFormat(L"
\ \ \ \ @@ -558,126 +558,111 @@ void TextToken::toString(wchar_t **str, int *sizeAlloced) } } } - Utils::appendText(str, sizeAlloced, L"%s", linkPrefix, eLink, eText); + str.AppendFormat(L"%s", linkPrefix, eLink, eText); } break; case SMILEY: eText = htmlEncode(wtext); if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(wlink, L".swf") != NULL)) { - Utils::appendText(str, sizeAlloced, - L"\ ", eText, wlink); } - else { - Utils::appendText(str, sizeAlloced, L"\"%s\"", wlink, eText, eText); - } + else str.AppendFormat(L"\"%s\"", wlink, eText, eText); break; case MATH: eText = htmlEncode(wtext); - Utils::appendText(str, sizeAlloced, L"\"%s\"", wlink, eText, eText); + str.AppendFormat(L"\"%s\"", wlink, eText, eText); break; case BBCODE: if (!end) { switch (tag) { case BB_B: - //Utils::appendText(str, sizeAlloced, L""); - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_I: - //Utils::appendText(str, sizeAlloced, L""); - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_U: - //Utils::appendText(str, sizeAlloced, L""); - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_S: - //Utils::appendText(str, sizeAlloced, L""); - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_CODE: - //Utils::appendText(str, sizeAlloced, L""); - Utils::appendText(str, sizeAlloced, L"
");
+				str.Append(L"
");
 				break;
 			case BB_IMG:
 				eText = htmlEncode(wtext);
 				if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && eText != NULL && (wcsstr(eText, L".swf") != NULL)) {
-					Utils::appendText(str, sizeAlloced,
-						L"
\ ", eText); } else { - if (eText != NULL && wcsncmp(eText, L"http://", 7) && wcsncmp(eText, L"https://", 8)) { - Utils::appendText(str, sizeAlloced, L"
this.width ? 'auto' : maxw);\" src=\"file://%s\" />
", eText); - } - else { - Utils::appendText(str, sizeAlloced, L"
this.width ? 'auto' : maxw);\" src=\"%s\" />
", eText); - } + if (eText != NULL && wcsncmp(eText, L"http://", 7) && wcsncmp(eText, L"https://", 8)) + str.AppendFormat(L"
this.width ? 'auto' : maxw);\" src=\"file://%s\" />
", eText); + else + str.AppendFormat(L"
this.width ? 'auto' : maxw);\" src=\"%s\" />
", eText); } break; case BB_BIMG: eText = htmlEncode(mir_ptr(Utils::toAbsolute(wtext))); if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(eText, L".swf") != NULL)) { - Utils::appendText(str, sizeAlloced, - L"
\ ", eText); } - else { - Utils::appendText(str, sizeAlloced, L"
this.width ? 'auto' : maxw);\" src=\"file://%s\" />
", eText); - } + else str.AppendFormat(L"
this.width ? 'auto' : maxw);\" src=\"file://%s\" />
", eText); break; case BB_URL: eText = htmlEncode(wtext); eLink = htmlEncode(wlink); - Utils::appendText(str, sizeAlloced, L"%s", eLink, eText); + str.AppendFormat(L"%s", eLink, eText); break; case BB_COLOR: eText = htmlEncode(wtext); - //Utils::appendText(str, sizeAlloced, L"", eText); - Utils::appendText(str, sizeAlloced, L"", eText); + str.AppendFormat(L"", eText); break; case BB_BACKGROUND: eText = htmlEncode(wtext); - Utils::appendText(str, sizeAlloced, L"", eText); + str.AppendFormat(L"", eText); break; case BB_SIZE: eText = htmlEncode(wtext); - Utils::appendText(str, sizeAlloced, L"", eText); + str.AppendFormat(L"", eText); break; } } else { switch (tag) { case BB_B: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_I: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_U: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_S: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_CODE: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_COLOR: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_SIZE: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; case BB_BACKGROUND: - Utils::appendText(str, sizeAlloced, L""); + str.Append(L""); break; } } -- cgit v1.2.3