summaryrefslogtreecommitdiffstats
path: root/libkpgp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /libkpgp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkpgp')
-rw-r--r--libkpgp/kpgp.cpp2
-rw-r--r--libkpgp/kpgpbase.cpp26
2 files changed, 15 insertions, 13 deletions
diff --git a/libkpgp/kpgp.cpp b/libkpgp/kpgp.cpp
index ec80e6887..8a9c68989 100644
--- a/libkpgp/kpgp.cpp
+++ b/libkpgp/kpgp.cpp
@@ -1007,7 +1007,7 @@ Module::getKpgp()
{
if (!kpgpObject)
{
- kdError(5100) << "there is no instance of kpgp available" << endl;
+ kpgpObject = new Module();
}
return kpgpObject;
}
diff --git a/libkpgp/kpgpbase.cpp b/libkpgp/kpgpbase.cpp
index fa444be7f..157c73e3b 100644
--- a/libkpgp/kpgpbase.cpp
+++ b/libkpgp/kpgpbase.cpp
@@ -149,7 +149,8 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP )
if (!onlyReadFromPGP) {
if (!input.isEmpty()) {
// write to pin[1] one line after the other to prevent dead lock
- for (unsigned int i=0; i<input.length(); i+=len2) {
+ uint input_length = input.length();
+ for (unsigned int i=0; i<input_length; i+=len2) {
len2 = 0;
// check if writing now to pin[1] will not block (5 ms timeout)
@@ -164,12 +165,12 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP )
else if (pollin.revents & POLLOUT) {
// search end of next line
if ((len2 = input.find('\n', i)) == -1)
- len2 = input.length()-i;
+ len2 = input_length - i;
else
- len2 = len2-i+1;
+ len2 = len2 - i + 1;
//kdDebug(5100) << "Trying to write " << len2 << " bytes to pin[1] ..." << endl;
- len2 = write(pin[1], input.mid(i,len2).data(), len2);
+ len2 = write(pin[1], input.data() + i, len2);
//kdDebug(5100) << "Wrote " << len2 << " bytes to pin[1] ..." << endl;
}
}
@@ -353,7 +354,7 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP )
if (WIFEXITED(childExitStatus) != 0) {
// Get the return code of the child
childExitStatus = WEXITSTATUS(childExitStatus);
- kdDebug(5100) << "PGP exited with exit status " << childExitStatus
+ kdDebug(5100) << "PGP exited with exit status " << childExitStatus
<< endl;
}
else {
@@ -524,6 +525,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG )
pid_t waitpidRetVal;
unsigned int input_pos = 0;
+ uint input_length = input.length();
do {
//kdDebug(5100) << "Checking if GnuPG is still running..." << endl;
@@ -585,7 +587,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG )
// disable polling of stderr
poller[STD_ERR].events = 0;
}
-
+
if (num_pollers > 2) {
if (poller[STD_IN].revents & ( POLLERR | POLLHUP ) ) {
kdDebug(5100) << "GnuPG seems to have hung up" << endl;
@@ -597,17 +599,17 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG )
if (!input.isEmpty()) {
// search end of next line
if ((len2 = input.find('\n', input_pos)) == -1)
- len2 = input.length()-input_pos;
+ len2 = input_length - input_pos;
else
- len2 = len2-input_pos+1;
+ len2 = len2 - input_pos + 1;
//kdDebug(5100) << "Trying to write " << len2 << " bytes to pin[1] ..." << endl;
- len2 = write(pin[1], input.mid(input_pos,len2).data(), len2);
+ len2 = write(pin[1], input.data() + input_pos, len2 );
//kdDebug(5100) << "Wrote " << len2 << " bytes to pin[1] ..." << endl;
input_pos += len2;
// We are done.
- if (input_pos >= input.length()) {
+ if (input_pos >= input_length) {
//kdDebug(5100) << "All input was written to pin[1]" << endl;
close (pin[1]);
pin[1] = -1;
@@ -635,7 +637,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG )
} while(waitpidRetVal == 0);
if( 0 <= pin[1] )
- close (pin[1]);
+ close (pin[1]);
close(pout[0]);
close(perr[0]);
@@ -646,7 +648,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG )
if (WIFEXITED(childExitStatus) != 0) {
// Get the return code of the child
childExitStatus = WEXITSTATUS(childExitStatus);
- kdDebug(5100) << "GnuPG exited with exit status " << childExitStatus
+ kdDebug(5100) << "GnuPG exited with exit status " << childExitStatus
<< endl;
}
else {