From e4302ad10ffffed04d4e11bfe9b11d2b389656a1 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 27 Mar 2015 22:25:31 +0000 Subject: IEView: - Fixed HTML encoding - minor bugfixes git-svn-id: http://svn.miranda-ng.org/main/trunk@12533 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/IEView/src/TextToken.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'plugins/IEView/src/TextToken.cpp') 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; } -- cgit v1.2.3