From 04125be8b12c8d82e3a165ea16dcc2f8715022bc Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 28 Jul 2017 11:38:49 +0200 Subject: [PATCH] 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. --- libretroshare/src/rsserver/rsaccounts.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index 6bd36b04d..45983b5c3 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -56,7 +56,7 @@ RsAccountsDetail *rsAccounts; /* Uses private class - so must be hidden */ -static bool checkAccount(std::string accountdir, AccountDetails &account,std::map >& unsupported_keys); +static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map >& unsupported_keys); AccountDetails::AccountDetails() :mSslId(""), mAccountDir(""), mPgpId(""), mPgpName(""), mPgpEmail(""), @@ -660,7 +660,7 @@ bool RsAccountsDetail::getAvailableAccounts(std::map & -static bool checkAccount(std::string accountdir, AccountDetails &account,std::map >& unsupported_keys) +static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map >& 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 */