Merge pull request #1356 from PhenomRetroShare/Fix_Warnings

Fix warnings
This commit is contained in:
csoler 2018-10-06 18:31:33 +02:00 committed by GitHub
commit 045691855b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 8 deletions

View File

@ -486,7 +486,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
resp.setFail("hidden_port out of range. It must fit into uint16!");
return;
}
hidden_port = p;
hidden_port = static_cast<uint16_t>(p);
}
RsPgpId pgp_id;
@ -527,7 +527,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
RsInit::SetHiddenLocation(hidden_address, hidden_port, false);
}
std::string ssl_password = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;
std::string ssl_password = RSRandom::random_alphaNumericString(static_cast<uint32_t>(RsInit::getSslPwdLen())) ;
/* GenerateSSLCertificate - selects the PGP Account */
//RsInit::SelectGPGAccount(PGPId);
@ -581,7 +581,7 @@ bool RsControlModule::askForDeferredSelfSignature(const void *data, const uint32
}
}
bool RsControlModule::requestShutdown()
void RsControlModule::requestShutdown()
{
RS_STACK_MUTEX(mExitFlagMtx);
mProcessShouldExit = true;

View File

@ -50,7 +50,7 @@ public:
// full_control: set to true if this module should handle rsinit and login
// set to false if rsinit is handled by the Qt gui
RsControlModule(int argc, char **argv, StateTokenServer* sts, ApiServer* apiserver, bool full_control);
~RsControlModule();
~RsControlModule() override;
// returns true if the process should terminate
bool processShouldExit();
@ -62,12 +62,12 @@ public:
virtual bool askForPassword(const std::string &title, const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled) override;
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason = "") override;
virtual bool requestShutdown();
virtual void requestShutdown();
protected:
// from RsThread
// wee need a thread to call into things which block like askForPassword()
virtual void run();
virtual void run() override;
private:
void handleRunState(Request& req, Response& resp);

View File

@ -28,6 +28,11 @@ namespace librs
{
namespace crypto
{
// Forward declare the class
class HashStream;
// Forward declare the template operator
template<class T> HashStream& operator<<(HashStream& u, const T&);
class HashStream
{
public:

View File

@ -71,6 +71,7 @@ struct CRYPTO_dynlock_value
pthread_mutex_t mutex;
};
# if OPENSSL_VERSION_NUMBER < 0x10100000L
/**
* OpenSSL locking function.
*
@ -88,7 +89,9 @@ static void locking_function(int mode, int n, const char */*file*/, int /*line*/
pthread_mutex_unlock(&mutex_buf[n]);
}
}
#endif
# if OPENSSL_VERSION_NUMBER < 0x10100000L
/**
* OpenSSL uniq id function.
*
@ -102,7 +105,9 @@ static unsigned long id_function(void)
return (unsigned long) pthread_self();
#endif
}
#endif
# if OPENSSL_VERSION_NUMBER < 0x10100000L
/**
* OpenSSL allocate and initialize dynamic crypto lock.
*
@ -121,7 +126,9 @@ static struct CRYPTO_dynlock_value *dyn_create_function(const char */*file*/, in
return value;
}
#endif
# if OPENSSL_VERSION_NUMBER < 0x10100000L
/**
* OpenSSL dynamic locking function.
*
@ -139,7 +146,9 @@ static void dyn_lock_function(int mode, struct CRYPTO_dynlock_value *l, const ch
pthread_mutex_unlock(&l->mutex);
}
}
#endif
# if OPENSSL_VERSION_NUMBER < 0x10100000L
/**
* OpenSSL destroy dynamic crypto lock.
*
@ -153,6 +162,7 @@ static void dyn_destroy_function(struct CRYPTO_dynlock_value *l, const char */*f
pthread_mutex_destroy(&l->mutex);
free(l);
}
#endif
/**
* Initialize TLS library.
@ -169,6 +179,7 @@ bool tls_init()
for (int i = 0; i < CRYPTO_num_locks(); i++) {
pthread_mutex_init(&mutex_buf[i], NULL);
}
# if OPENSSL_VERSION_NUMBER < 0x10100000L
/* static locks callbacks */
CRYPTO_set_locking_callback(locking_function);
CRYPTO_set_id_callback(id_function);
@ -176,8 +187,8 @@ bool tls_init()
CRYPTO_set_dynlock_create_callback(dyn_create_function);
CRYPTO_set_dynlock_lock_callback(dyn_lock_function);
CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function);
return true;
#endif
return true;
}
/**