aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-02-02 15:39:09 +0000
committerAndreas Schneider <mail@cynapses.org>2009-02-02 15:39:09 +0000
commit5d798f62257b29dbcb7a4bdc37e7585b4c4894a3 (patch)
tree35ef615e016d201764d13626e536826cb1e19bec
parent7250e03f97a46aa8c1229d072b1f6f3a6e13a9a0 (diff)
downloadlibssh-5d798f62257b29dbcb7a4bdc37e7585b4c4894a3.tar.gz
libssh-5d798f62257b29dbcb7a4bdc37e7585b4c4894a3.tar.xz
libssh-5d798f62257b29dbcb7a4bdc37e7585b4c4894a3.zip
Use unsigned values for length in buffer functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@211 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r--include/libssh/libssh.h2
-rw-r--r--include/libssh/priv.h6
-rw-r--r--libssh/buffer.c8
3 files changed, 8 insertions, 8 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 5adfcf7..9bde42e 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -315,7 +315,7 @@ void buffer_free(BUFFER *buffer);
/* buffer_get returns a pointer to the begining of the buffer. no position is taken into account */
void *buffer_get(BUFFER *buffer);
/* same here */
-int buffer_get_len(BUFFER *buffer);
+u32 buffer_get_len(BUFFER *buffer);
/* in auth.c */
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 98b76bb..436c883 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -592,7 +592,7 @@ void buffer_reinit(BUFFER *buffer);
/* buffer_get_rest returns a pointer to the current position into the buffer */
void *buffer_get_rest(BUFFER *buffer);
/* buffer_get_rest_len returns the number of bytes which can be read */
-int buffer_get_rest_len(BUFFER *buffer);
+u32 buffer_get_rest_len(BUFFER *buffer);
/* buffer_read_*() returns the number of bytes read, except for ssh strings */
int buffer_get_u8(BUFFER *buffer,u8 *data);
@@ -605,8 +605,8 @@ STRING *buffer_get_ssh_string(BUFFER *buffer);
/* gets a string out of a SSH-1 mpint */
STRING *buffer_get_mpint(BUFFER *buffer);
/* buffer_pass_bytes acts as if len bytes have been read (used for padding) */
-int buffer_pass_bytes_end(BUFFER *buffer, u32 len);
-int buffer_pass_bytes(BUFFER *buffer, u32 len);
+u32 buffer_pass_bytes_end(BUFFER *buffer, u32 len);
+u32 buffer_pass_bytes(BUFFER *buffer, u32 len);
/* in base64.c */
BUFFER *base64_to_bin(char *source);
diff --git a/libssh/buffer.c b/libssh/buffer.c
index a5d6cc3..73edcf4 100644
--- a/libssh/buffer.c
+++ b/libssh/buffer.c
@@ -174,7 +174,7 @@ void *buffer_get_rest(BUFFER *buffer){
* \return length of the buffer
* \see buffer_get()
*/
-int buffer_get_len(BUFFER *buffer){
+u32 buffer_get_len(BUFFER *buffer){
return buffer->used;
}
@@ -184,7 +184,7 @@ int buffer_get_len(BUFFER *buffer){
* \return length of the buffer
* \see buffer_get_rest()
*/
-int buffer_get_rest_len(BUFFER *buffer){
+u32 buffer_get_rest_len(BUFFER *buffer){
return buffer->used - buffer->pos;
}
@@ -195,7 +195,7 @@ int buffer_get_rest_len(BUFFER *buffer){
* \param len number of bytes to eat
* \return new size of the buffer
*/
-int buffer_pass_bytes(BUFFER *buffer, u32 len){
+u32 buffer_pass_bytes(BUFFER *buffer, u32 len){
if(buffer->used < buffer->pos+len)
return 0;
buffer->pos+=len;
@@ -213,7 +213,7 @@ int buffer_pass_bytes(BUFFER *buffer, u32 len){
* \param len number of bytes to remove from tail
* \return new size of the buffer
*/
-int buffer_pass_bytes_end(BUFFER *buffer, u32 len){
+u32 buffer_pass_bytes_end(BUFFER *buffer, u32 len){
if(buffer->used < buffer->pos + len)
return 0;
buffer->used-=len;