diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-03-27 22:25:31 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-03-27 22:25:31 +0000 |
commit | e4302ad10ffffed04d4e11bfe9b11d2b389656a1 (patch) | |
tree | 62ccd91b84434992e14d108f3e560ae41478f0a6 /plugins/IEView | |
parent | bcd3d5eedda6f93c8846f77848e950b4e78fcd81 (diff) |
IEView:
- Fixed HTML encoding
- minor bugfixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12533 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IEView')
-rw-r--r-- | plugins/IEView/src/ChatHTMLBuilder.cpp | 3 | ||||
-rw-r--r-- | plugins/IEView/src/HTMLBuilder.cpp | 7 | ||||
-rw-r--r-- | plugins/IEView/src/ScriverHTMLBuilder.cpp | 4 | ||||
-rw-r--r-- | plugins/IEView/src/TemplateHTMLBuilder.cpp | 2 | ||||
-rw-r--r-- | plugins/IEView/src/TextToken.cpp | 12 | ||||
-rw-r--r-- | plugins/IEView/src/ieview_main.cpp | 2 |
6 files changed, 14 insertions, 16 deletions
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index d29d519a23..1584907cf4 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -243,8 +243,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) Utils::appendIcon(&output, &outputSize, iconFile);
}
if (dwData & IEEDD_GC_SHOW_TIME) {
- Utils::appendText(&output, &outputSize, "<span class=\"%s\">%s </span>",
- isSent ? "timestamp" : "timestamp", timestampToString(eventData->time));
+ Utils::appendText(&output, &outputSize, "<span class=\"timestamp\">%s </span>", timestampToString(eventData->time));
}
if ((dwData & IEEDD_GC_SHOW_NICK) && eventData->iType == IEED_GC_EVENT_MESSAGE) {
Utils::appendText(&output, &outputSize, "<span class=\"%s\">%s: </span>",
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 9480e4c420..28faa76b1f 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -487,9 +487,10 @@ void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event) void HTMLBuilder::clear(IEView *view, IEVIEWEVENT *event)
{
- if (event != NULL)
+ if (event != NULL) {
setLastIEViewEvent(event);
- if (lastIEViewEvent.pszProto != NULL || event->hContact == NULL)
- buildHead(view, &lastIEViewEvent);
+ if (lastIEViewEvent.pszProto != NULL || event->hContact == NULL)
+ buildHead(view, &lastIEViewEvent);
+ }
}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index e15d709236..9b60e69c5e 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -144,13 +144,13 @@ char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod today = mktime(&tm_today);
if (dwFlags & SMF_LOG_USERELATIVEDATE && check >= today) {
- strcpy(szResult, Translate("Today"));
+ strncpy(szResult, Translate("Today"), SIZEOF(szResult)-1);
if (mode == 0) {
strcat(szResult, ",");
}
}
else if (dwFlags & SMF_LOG_USERELATIVEDATE && check > (today - 86400)) {
- strcpy(szResult, Translate("Yesterday"));
+ strncpy(szResult, Translate("Yesterday"), SIZEOF(szResult)-1);
if (mode == 0) {
strcat(szResult, ",");
}
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 10ce8161c0..32711fbccf 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -176,7 +176,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr return;
strcpy(tempBase, "file://");
- strcat(tempBase, tmpm->getFilename());
+ strncat(tempBase, tmpm->getFilename(), SIZEOF(tempBase)-1);
char *pathrun = tempBase + strlen(tempBase);
while ((*pathrun != '\\' && *pathrun != '/') && (pathrun > tempBase))
pathrun--;
diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index a5d208a199..165bff9889 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -526,10 +526,9 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) if (str == NULL)
return NULL;
int c = 0;
+ bool wasSpace = false;
for (ptr = str; *ptr != '\0'; ptr++) {
- bool wasSpace = false;
if (*ptr == ' ' && wasSpace) {
- wasSpace = true;
c += 6;
}
else {
@@ -542,13 +541,12 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) case '<': c += 4; break;
case '"': c += 6; break;
case ' ': wasSpace = true;
- default: c += 1; break;
+ default: c++;
}
}
}
wchar_t *output = new wchar_t[c + 1];
for (out = output, ptr = str; *ptr != '\0'; ptr++) {
- bool wasSpace = false;
if (*ptr == ' ' && wasSpace) {
wcscpy(out, L" ");
out += 6;
@@ -563,7 +561,7 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) case '<': wcscpy(out, L"<"); out += 4; break;
case '"': wcscpy(out, L"""); out += 6; break;
case ' ': wasSpace = true;
- default: *out = *ptr; out += 1; break;
+ default: *out = *ptr; out++;
}
}
}
@@ -754,6 +752,6 @@ void TextToken::toString(wchar_t **str, int *sizeAlloced) }
break;
}
- if (eText != NULL) delete eText;
- if (eLink != NULL) delete eLink;
+ if (eText != NULL) delete[] eText;
+ if (eLink != NULL) delete[] eLink;
}
diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp index cbafdcd3c1..0c60062db8 100644 --- a/plugins/IEView/src/ieview_main.cpp +++ b/plugins/IEView/src/ieview_main.cpp @@ -65,7 +65,7 @@ extern "C" int __declspec(dllexport) Load(void) GetCurrentDirectory(wdsize, workingDir);
Utils::convertPath(workingDir);
workingDirUtf8 = mir_utf8encodeT(workingDir);
- delete workingDir;
+ delete[] workingDir;
mir_getLP(&pluginInfoEx);
mir_getCLI();
|