Fix CppCheck Error in p3idservice.cc

/libretroshare/src/services/p3idservice.cc:1216: error:
Cppcheck(eraseDereference): Iterator 'it' used after element has been
erased.
/libretroshare/src/services/p3idservice.cc:1346: error:
Cppcheck(eraseDereference): Iterator 'it' used after element has been
erased.
/libretroshare/src/services/p3idservice.cc:448: error:
Cppcheck(uninitvar): Uninitialized variable: max_keep_time
This commit is contained in:
Phenom 2017-07-21 14:57:43 +02:00
parent aa471e5b2f
commit e5767431e6

View File

@ -425,7 +425,7 @@ public:
bool no_ts = (it == mLastUsageTS.end()) ; bool no_ts = (it == mLastUsageTS.end()) ;
time_t last_usage_ts = no_ts?0:(it->second.TS); time_t last_usage_ts = no_ts?0:(it->second.TS);
time_t max_keep_time ; time_t max_keep_time = 0;
bool should_check = true ; bool should_check = true ;
if(no_ts) if(no_ts)
@ -1213,7 +1213,7 @@ bool p3IdService::encryptData( const uint8_t* decrypted_data,
if(getKey(**it, encryption_key) && !encryption_key.keyId.isNull()) if(getKey(**it, encryption_key) && !encryption_key.keyId.isNull())
{ {
encryption_keys.push_back(encryption_key); encryption_keys.push_back(encryption_key);
keyNotYetFoundIds.erase(it); it = keyNotYetFoundIds.erase(it);
} }
} }
@ -1343,7 +1343,7 @@ bool p3IdService::decryptData( const uint8_t* encrypted_data,
&& !decryption_key.keyId.isNull() ) && !decryption_key.keyId.isNull() )
{ {
decryption_keys.push_back(decryption_key); decryption_keys.push_back(decryption_key);
keyNotYetFoundIds.erase(it); it = keyNotYetFoundIds.erase(it);
} }
} }