removed unused code

This commit is contained in:
vladimir.kuznetsov 2023-02-02 08:36:50 +03:00 committed by Dmitriy Karpushin
parent 115be88e5d
commit 4b0a4aa5d2

View file

@ -29,7 +29,7 @@ namespace libssh {
if (m_session == nullptr) { if (m_session == nullptr) {
m_session = ssh_new(); m_session = ssh_new();
if (m_session == NULL) { if (m_session == nullptr) {
qDebug() << "Failed to create ssh session"; qDebug() << "Failed to create ssh session";
return ErrorCode::InternalError; return ErrorCode::InternalError;
} }
@ -75,7 +75,7 @@ namespace libssh {
void Client::disconnectFromHost() void Client::disconnectFromHost()
{ {
if (m_session != NULL) { if (m_session != nullptr) {
if (ssh_is_connected(m_session)) { if (ssh_is_connected(m_session)) {
ssh_disconnect(m_session); ssh_disconnect(m_session);
} }
@ -90,7 +90,7 @@ namespace libssh {
{ {
m_channel = ssh_channel_new(m_session); m_channel = ssh_channel_new(m_session);
if (m_channel == NULL) { if (m_channel == nullptr) {
return closeChannel(); return closeChannel();
} }
@ -164,7 +164,7 @@ namespace libssh {
ErrorCode Client::writeResponse(const QString &data) ErrorCode Client::writeResponse(const QString &data)
{ {
if (m_channel == NULL) { if (m_channel == nullptr) {
qDebug() << "ssh channel not initialized"; qDebug() << "ssh channel not initialized";
return fromLibsshErrorCode(ssh_get_error_code(m_session)); return fromLibsshErrorCode(ssh_get_error_code(m_session));
} }
@ -179,7 +179,7 @@ namespace libssh {
ErrorCode Client::closeChannel() ErrorCode Client::closeChannel()
{ {
if (m_channel != NULL) { if (m_channel != nullptr) {
if (ssh_channel_is_eof(m_channel)) { if (ssh_channel_is_eof(m_channel)) {
ssh_channel_send_eof(m_channel); ssh_channel_send_eof(m_channel);
} }
@ -197,7 +197,7 @@ namespace libssh {
{ {
m_sftpSession = sftp_new(m_session); m_sftpSession = sftp_new(m_session);
if (m_sftpSession == NULL) { if (m_sftpSession == nullptr) {
return closeSftpSession(); return closeSftpSession();
} }
@ -218,7 +218,7 @@ namespace libssh {
file = sftp_open(m_sftpSession, remotePath.c_str(), accessType, S_IRWXU); file = sftp_open(m_sftpSession, remotePath.c_str(), accessType, S_IRWXU);
if (file == NULL) { if (file == nullptr) {
return closeSftpSession(); return closeSftpSession();
} }
@ -285,7 +285,7 @@ namespace libssh {
ErrorCode Client::closeSftpSession() ErrorCode Client::closeSftpSession()
{ {
auto errorCode = fromLibsshSftpErrorCode(sftp_get_error(m_sftpSession)); auto errorCode = fromLibsshSftpErrorCode(sftp_get_error(m_sftpSession));
if (m_sftpSession != NULL) { if (m_sftpSession != nullptr) {
sftp_free(m_sftpSession); sftp_free(m_sftpSession);
m_sftpSession = nullptr; m_sftpSession = nullptr;
} }