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
Этот коммит содержится в:
родитель
b875ce15e8
Коммит
9766b2f8d2
@ -617,7 +617,7 @@ int buffer_add_u8(BUFFER *buffer, u8 data);
|
||||
int buffer_add_u32(BUFFER *buffer, u32 data);
|
||||
int buffer_add_u64(BUFFER *buffer, u64 data);
|
||||
int buffer_add_data(BUFFER *buffer, const void *data, u32 len);
|
||||
int buffer_add_data_begin(BUFFER *buffer, const void *data, u32 len);
|
||||
int buffer_prepend_data(BUFFER *buffer, const void *data, u32 len);
|
||||
int buffer_add_buffer(BUFFER *buffer, BUFFER *source);
|
||||
int buffer_reinit(BUFFER *buffer);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user