1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

buffer: do not use ssh_buffer_get_rest_len()

As ssh_buffer_get_len() actually calls ssh_buffer_get_rest_len(), let's
just use the first one. This is a preparatory step for removing
ssh_buffer_get_rest_len().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Fabiano Fidêncio
2015-09-25 00:34:42 +02:00
parent 25707e9752
commit 05fd0acf45
19 changed files with 94 additions and 94 deletions

View File

@@ -282,20 +282,20 @@ int sftp_packet_write(sftp_session sftp, uint8_t type, ssh_buffer payload){
return -1;
}
size = htonl(ssh_buffer_get_rest_len(payload));
size = htonl(ssh_buffer_get_len(payload));
if (ssh_buffer_prepend_data(payload, &size, sizeof(uint32_t)) < 0) {
ssh_set_error_oom(sftp->session);
return -1;
}
size = ssh_channel_write(sftp->channel, ssh_buffer_get(payload),
ssh_buffer_get_rest_len(payload));
ssh_buffer_get_len(payload));
if (size < 0) {
return -1;
} else if((uint32_t) size != ssh_buffer_get_rest_len(payload)) {
} else if((uint32_t) size != ssh_buffer_get_len(payload)) {
SSH_LOG(SSH_LOG_PACKET,
"Had to write %d bytes, wrote only %d",
ssh_buffer_get_rest_len(payload),
ssh_buffer_get_len(payload),
size);
}
@@ -461,7 +461,7 @@ static sftp_message sftp_get_message(sftp_packet packet) {
msg->packet_type);
if (ssh_buffer_add_data(msg->payload, ssh_buffer_get(packet->payload),
ssh_buffer_get_rest_len(packet->payload)) < 0) {
ssh_buffer_get_len(packet->payload)) < 0) {
ssh_set_error_oom(sftp->session);
sftp_message_free(msg);
return NULL;
@@ -1968,7 +1968,7 @@ ssize_t sftp_write(sftp_file file, const void *buf, size_t count) {
ssh_buffer_free(buffer);
return -1;
}
packetlen=ssh_buffer_get_rest_len(buffer);
packetlen=ssh_buffer_get_len(buffer);
len = sftp_packet_write(file->sftp, SSH_FXP_WRITE, buffer);
ssh_buffer_free(buffer);
if (len < 0) {