From 158c189e48f0c5f1be24924d9bb71367ae5ade0c Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 31 Mar 2009 09:32:16 +0000 Subject: [PATCH] Remove some unneeded magic from CString::Escape_n() (nothing major) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1465 726aef4b-f618-498e-8847-2d620e286838 --- ZNCString.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ZNCString.cpp b/ZNCString.cpp index 70f6e90d..fbc0bf43 100644 --- a/ZNCString.cpp +++ b/ZNCString.cpp @@ -296,8 +296,7 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const { const unsigned char *p = (const unsigned char*) data(); unsigned int iLength = length(); sRet.reserve(iLength *3); - unsigned int iMaxLen = (eFrom == EHTML) ? 20 : 0; - unsigned char pTmp[iMaxLen +1]; + unsigned char pTmp[21]; unsigned int iCounted = 0; for (unsigned int a = 0; a < iLength; a++, p = pStart + a) { @@ -305,7 +304,7 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const { switch (eFrom) { case EHTML: - if ((*p == '&') && (strnchr((unsigned char*) p, ';', iMaxLen, pTmp, &iCounted))) { + if ((*p == '&') && (strnchr((unsigned char*) p, ';', sizeof(pTmp) - 1, pTmp, &iCounted))) { if ((iCounted >= 3) && (pTmp[1] == '#')) { // do XML and HTML a < int base = 10;