Fix CppCheck in rsaccounts.cc

/libretroshare/src/rsserver/rsaccounts.cc:808: warning:
Cppcheck(ConfigurationNotChecked): Skipping configuration 'DATA_DIR'
since the value of 'DATA_DIR' is unknown. Use -D if you want to check
it. You can use -U to skip it explicitly.
/libretroshare/src/rsserver/rsaccounts.cc:1057: warning:
Cppcheck(redundantAssignment): Variable 'bio_out' is reassigned a value
before the old one has been used.
/libretroshare/src/rsserver/rsaccounts.cc:674: warning:
Cppcheck(unusedVariable): Unused variable: userName
/libretroshare/src/rsserver/rsaccounts.cc:1005: warning:
Cppcheck(unreadVariable): Variable 'pgp_name' is assigned a value that
is never used.
/libretroshare/src/rsserver/rsaccounts.cc:663: warning:
Cppcheck(passedByValue): Function parameter 'accountdir' should be
passed by reference.
This commit is contained in:
Phenom 2017-07-28 11:38:49 +02:00 committed by csoler
parent da190f544e
commit 04125be8b1

View File

@ -56,7 +56,7 @@
RsAccountsDetail *rsAccounts;
/* Uses private class - so must be hidden */
static bool checkAccount(std::string accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys);
static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys);
AccountDetails::AccountDetails()
:mSslId(""), mAccountDir(""), mPgpId(""), mPgpName(""), mPgpEmail(""),
@ -660,7 +660,7 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
static bool checkAccount(std::string accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys)
static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys)
{
/* check if the cert/key file exists */
@ -671,7 +671,7 @@ static bool checkAccount(std::string accountdir, AccountDetails &account,std::ma
basename += "user";
std::string cert_name = basename + "_cert.pem";
std::string userName;
//std::string userName;
#ifdef AUTHSSL_DEBUG
std::cerr << "checkAccount() dir: " << accountdir << std::endl;
@ -806,6 +806,7 @@ static bool checkAccount(std::string accountdir, AccountDetails &account,std::ma
#elif defined(ANDROID)
dataDirectory = defaultBaseDirectory()+"/usr/share/retroshare";
#elif defined(DATA_DIR)
// cppcheck-suppress ConfigurationNotChecked
dataDirectory = DATA_DIR;
// For all other OS the data directory must be set in libretroshare.pro
#else
@ -1003,7 +1004,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
int nbits = 4096;
std::string pgp_name = AuthGPG::getAuthGPG()->getGPGName(pgp_id);
//std::string pgp_name = AuthGPG::getAuthGPG()->getGPGName(pgp_id);
// Create the filename .....
// Temporary Directory for creating files....
@ -1054,8 +1055,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
bool gen_ok = true;
/* Print the signed Certificate! */
BIO *bio_out = NULL;
bio_out = BIO_new(BIO_s_file());
BIO *bio_out = BIO_new(BIO_s_file());
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
/* Print it out */