From 6ec26d859be239e6db1bb392140db76227a56522 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 27 Nov 2018 14:55:23 +0900 Subject: KPasswordEdit::password() now returns a TQString instead of a const char *. This relates to bug 2961. Signed-off-by: Michele Calgaro --- tdeio/kssl/ksslpemcallback.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'tdeio/kssl/ksslpemcallback.cc') diff --git a/tdeio/kssl/ksslpemcallback.cc b/tdeio/kssl/ksslpemcallback.cc index 207949a0c..584020c0f 100644 --- a/tdeio/kssl/ksslpemcallback.cc +++ b/tdeio/kssl/ksslpemcallback.cc @@ -28,26 +28,23 @@ int KSSLPemCallback(char *buf, int size, int rwflag, void *userdata) { #ifdef KSSL_HAVE_SSL - TQCString pass; + TQString pass2; Q_UNUSED(userdata); Q_UNUSED(rwflag); if (!buf) return -1; - int rc = KPasswordDialog::getPassword(pass, i18n("Certificate password")); + int rc = KPasswordDialog::getPassword(pass2, i18n("Certificate password")); if (rc != KPasswordDialog::Accepted) return -1; + TQCString pass = pass2.utf8(); // utf8 length may differ from TQString length const uint passlen = pass.length(); if (passlen > (unsigned int)size-1) pass.truncate((unsigned int)size-1); - tqstrncpy(buf, pass.data(), size-1); - - 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 < passlen; i++) - pass[i] = pass[i]; - buf[size-1] = 0; + tqstrncpy(buf, pass, size-1); + buf[size-1] = 0; + pass.fill(' '); + pass2.fill(' '); return (int)passlen; #else Q_UNUSED(buf); -- cgit v1.2.1