diff options
| author | Andreas Schneider <mail@cynapses.org> | 2009-04-22 14:31:43 +0000 |
|---|---|---|
| committer | Andreas Schneider <mail@cynapses.org> | 2009-04-22 14:31:43 +0000 |
| commit | 9766b2f8d2ecbba5be34a21a62c1b7790a8054b2 (patch) | |
| tree | 5b9d54055b760a57092e4ebc5cdf0e640b8b513e /libssh | |
| parent | b875ce15e8bddfe4c0639b1932fb017b57aff996 (diff) | |
| download | libssh-9766b2f8d2ecbba5be34a21a62c1b7790a8054b2.tar.gz libssh-9766b2f8d2ecbba5be34a21a62c1b7790a8054b2.tar.xz libssh-9766b2f8d2ecbba5be34a21a62c1b7790a8054b2.zip | |
Rename buffer_add_data_begin() to buffer_prepend_data().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@571 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
| -rw-r--r-- | libssh/buffer.c | 3 | ||||
| -rw-r--r-- | libssh/packet.c | 8 | ||||
| -rw-r--r-- | libssh/sftp.c | 8 |
3 files changed, 12 insertions, 7 deletions
diff --git a/libssh/buffer.c b/libssh/buffer.c index 32a1f5b2..9b8d6ad9 100644 --- a/libssh/buffer.c +++ b/libssh/buffer.c @@ -184,7 +184,8 @@ int buffer_add_u8(struct buffer_struct *buffer,u8 data){ * \param len length of data * \return 0 on success, -1 on error. */ -int buffer_add_data_begin(struct buffer_struct *buffer, const void *data, u32 len) { +int buffer_prepend_data(struct buffer_struct *buffer, const void *data, + u32 len) { if (buffer->allocated < (buffer->used + len)) { if (realloc_buffer(buffer, buffer->used + len) < 0) { return -1; diff --git a/libssh/packet.c b/libssh/packet.c index c2435eda..0655257d 100644 --- a/libssh/packet.c +++ b/libssh/packet.c @@ -471,10 +471,10 @@ static int packet_send2(SSH_SESSION *session) { "%d bytes after comp + %d padding bytes = %d bytes packet", currentlen, padding, (ntohl(finallen))); - if (buffer_add_data_begin(session->out_buffer, &padding, sizeof(u8)) < 0) { + if (buffer_prepend_data(session->out_buffer, &padding, sizeof(u8)) < 0) { goto error; } - if (buffer_add_data_begin(session->out_buffer, &finallen, sizeof(u32)) < 0) { + if (buffer_prepend_data(session->out_buffer, &finallen, sizeof(u32)) < 0) { goto error; } if (buffer_add_data(session->out_buffer, padstring, padding) < 0) { @@ -536,10 +536,10 @@ static int packet_send1(SSH_SESSION *session) { "%d bytes after comp + %d padding bytes = %d bytes packet", currentlen, padding, ntohl(finallen)); - if (buffer_add_data_begin(session->out_buffer,i &padstring, padding) < 0) { + if (buffer_prepend_data(session->out_buffer,i &padstring, padding) < 0) { goto error; } - if (buffer_add_data_begin(session->out_buffer, &finallen, sizeof(u32)) < 0) { + if (buffer_prepend_data(session->out_buffer, &finallen, sizeof(u32)) < 0) { goto error; } diff --git a/libssh/sftp.c b/libssh/sftp.c index 4098b906..35b20b58 100644 --- a/libssh/sftp.c +++ b/libssh/sftp.c @@ -191,9 +191,13 @@ void sftp_free(SFTP_SESSION *sftp){ int sftp_packet_write(SFTP_SESSION *sftp,u8 type, BUFFER *payload){ int size; - buffer_add_data_begin(payload,&type,sizeof(u8)); + if (buffer_prepend_data(payload, &type, sizeof(u8)) < 0) { + return -1; + } size=htonl(buffer_get_len(payload)); - buffer_add_data_begin(payload,&size,sizeof(u32)); + if (buffer_prepend_data(payload, &size, sizeof(u32)) < 0) { + return -1; + } size=channel_write(sftp->channel,buffer_get(payload),buffer_get_len(payload)); if (size < 0) { return -1; |
