[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kio/kssl
From: Duncan Mac-Vicar Prett <duncan () kde ! org>
Date: 2005-03-14 22:14:03
Message-ID: 20050314221403.96D3C1487F () office ! kde ! org
[Download RAW message or body]
CVS commit by dmacvicar:
QCString::length() calls strlen on each invocation so it should never be called in a loop
M +7 -4 ksslpemcallback.cc 1.5
--- kdelibs/kio/kssl/ksslpemcallback.cc #1.4:1.5
@@ -30,4 +30,5 @@ int KSSLPemCallback(char *buf, int size,
#ifdef KSSL_HAVE_SSL
QCString pass;
+ uint passlen;
Q_UNUSED(userdata);
Q_UNUSED(rwflag);
@@ -37,15 +38,17 @@ int KSSLPemCallback(char *buf, int size,
if (rc != KPasswordDialog::Accepted) return -1;
- if (pass.length() > (unsigned int)size-1)
+ passlen = pass.length();
+ if (passlen > (unsigned int)size-1)
pass.truncate((unsigned int)size-1);
qstrncpy(buf, pass.data(), size-1);
- for (unsigned int i = 0; i < pass.length(); i++)
+
+ for (unsigned int i = 0; i < passlen; i++)
pass[i] = 0;
// To be sure that it doesn't optimise the previous loop away
- for (unsigned int i = 0; i < pass.length(); i++)
+ for (unsigned int i = 0; i < passlen; i++)
pass[i] = pass[i];
buf[size-1] = 0;
- return (int)pass.length();
+ return (int)passlen;
#else
Q_UNUSED(buf);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic