diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-06 21:07:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-06 21:07:53 +0000 |
commit | 37f0dfdfac4dc0af578769b02e29efb9926415bb (patch) | |
tree | cadf855bb7a074eb78f45b725e5b9a3e965fa045 /plugins/IEView/src/ChatHTMLBuilder.cpp | |
parent | e7891a7f13d94b6eae7f74f7354e0a3643d1de01 (diff) |
postfix to the standard functions patch by Mataes
git-svn-id: http://svn.miranda-ng.org/main/trunk@4351 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IEView/src/ChatHTMLBuilder.cpp')
-rw-r--r-- | plugins/IEView/src/ChatHTMLBuilder.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index ff441a8642..774f766a0a 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -87,13 +87,12 @@ char *ChatHTMLBuilder::timestampToString(time_t time) char *pszStamp = "[%H:%M]";
//InitSetting( &g_Settings.pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
strftime(str, 79, pszStamp, localtime(&time));
- char *tmp = mir_utf8encode(str);
- lstrcpynA(szResult, tmp, 500);
- mir_free(tmp);
+ lstrcpynA(szResult, mir_ptr<char>(mir_utf8encode(str)), 500);
return szResult;
}
-void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) {
+void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event)
+{
LOGFONTA lf;
COLORREF color;
char *output = NULL;
@@ -158,7 +157,8 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { * The following method is going to be completely rewritten soon. Do not modify or complain for the time being...
*/
-void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
+void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
+{
DWORD iconFlags = db_get_dw(NULL, CHATMOD, CHAT_ICON_FLAGS, 0);
IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
@@ -168,25 +168,26 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) { int isSent = eventData->bIsMe;
int outputSize = 0;
char *output = NULL;
- char *szName = NULL, *szText = NULL;
const char *className = "";
bool showIcon = false;
- if (eventData->dwFlags & IEEDF_UNICODE_TEXT) {
+ mir_ptr<char> szName, szText;
+ if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
szText = encodeUTF8(NULL, event->pszProto, eventData->pszTextW, ENF_ALL | ENF_CHAT_FORMATTING, isSent);
- } else {
+ else
szText = encodeUTF8(NULL, event->pszProto, (char *)eventData->pszText, ENF_ALL | ENF_CHAT_FORMATTING, isSent);
- }
- if (eventData->dwFlags & IEEDF_UNICODE_NICK) {
+
+ if (eventData->dwFlags & IEEDF_UNICODE_NICK)
szName = encodeUTF8(NULL, event->pszProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
- } else {
+ else
szName = encodeUTF8(NULL, event->pszProto, (char *) eventData->pszNick, ENF_NAMESMILEYS, true);
- }
+
if (eventData->iType == IEED_GC_EVENT_MESSAGE) {
iconFile = isSent ? "message_out_chat.gif" : "message_in_chat.gif";
showIcon = iconFlags & (isSent ? GC_EVENT_MESSAGE : GC_EVENT_MESSAGE);
className = isSent ? "messageOut" : "messageIn";
- } else {
+ }
+ else {
if (eventData->iType == IEED_GC_EVENT_ACTION) {
iconFile = "action.gif";
className = "action";
@@ -244,8 +245,6 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) { view->write(output);
free(output);
}
- if (szName!=NULL) delete szName;
- if (szText!=NULL) delete szText;
}
}
|