diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-19 21:12:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-19 21:12:24 +0000 |
commit | 23da585729242bc135e7a6da0dc5bf699e6c9b54 (patch) | |
tree | d9588a9288ed88c36979d4d92538f3641796e2af /plugins/IEView/src/TemplateHTMLBuilder.cpp | |
parent | 26ec77c0e1b49ac1dc002acc4da767d9de8e9703 (diff) |
- 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
Diffstat (limited to 'plugins/IEView/src/TemplateHTMLBuilder.cpp')
-rw-r--r-- | plugins/IEView/src/TemplateHTMLBuilder.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 32711fbccf..864d37e6fe 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -244,8 +244,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr tmplt = tmpm->getTemplate("HTMLStart");
}
- char *output = NULL;
- int outputSize;
+ CMStringA str;
if (tmplt != NULL) {
for (Token *token = tmplt->getTokens(); token != NULL; token = token->getNext()) {
@@ -291,16 +290,16 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr }
if (tokenVal != NULL) {
if (token->getEscape())
- Utils::appendText(&output, &outputSize, "%s", ptrA(Utils::escapeString(tokenVal)));
+ str.Append(ptrA(Utils::escapeString(tokenVal)));
else
- Utils::appendText(&output, &outputSize, "%s", tokenVal);
+ str.Append(tokenVal);
}
}
}
- if (output != NULL) {
- view->write(output);
- free(output);
- }
+
+ if (!str.IsEmpty())
+ view->write(str);
+
mir_free(szBase);
mir_free(szRealProto);
mir_free(szProto);
@@ -419,9 +418,8 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData != NULL && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
- int outputSize;
- char *output = NULL;
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE || eventData->iType == IEED_EVENT_FILE || eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_SYSTEM) {
+ CMStringA str;
bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
bool isRTL = (eventData->dwFlags & IEEDF_RTL) && tmpm->isRTL();
bool isHistory = (eventData->time < (DWORD)getStartedTime() && (eventData->dwFlags & IEEDF_READ || eventData->dwFlags & IEEDF_SENT));
@@ -596,9 +594,9 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, }
if (tokenVal != NULL) {
if (token->getEscape())
- Utils::appendText(&output, &outputSize, "%s", ptrA(Utils::escapeString(tokenVal)));
+ str.Append(ptrA(Utils::escapeString(tokenVal)));
else
- Utils::appendText(&output, &outputSize, "%s", tokenVal);
+ str.Append(tokenVal);
}
}
}
@@ -608,10 +606,8 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, mir_free(szName);
mir_free(szText);
mir_free(szFileDesc);
- }
- if (output != NULL) {
- view->write(output);
- free(output);
+
+ view->write(str);
}
}
mir_free(szBase);
|