mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 17:20:22 +00:00
netops: Use the size_t, Luke
This commit is contained in:
parent
778e1c739b
commit
0bd594b61c
10
src/netops.c
10
src/netops.c
@ -68,8 +68,9 @@ int gitno_recv(gitno_buffer *buf)
|
|||||||
/* Consume up to ptr and move the rest of the buffer to the beginning */
|
/* Consume up to ptr and move the rest of the buffer to the beginning */
|
||||||
void gitno_consume(gitno_buffer *buf, const char *ptr)
|
void gitno_consume(gitno_buffer *buf, const char *ptr)
|
||||||
{
|
{
|
||||||
int consumed;
|
size_t consumed;
|
||||||
|
|
||||||
|
assert(ptr - buf->data >= 0);
|
||||||
assert(ptr - buf->data <= (int) buf->len);
|
assert(ptr - buf->data <= (int) buf->len);
|
||||||
|
|
||||||
consumed = ptr - buf->data;
|
consumed = ptr - buf->data;
|
||||||
@ -80,7 +81,7 @@ void gitno_consume(gitno_buffer *buf, const char *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Consume const bytes and move the rest of the buffer to the beginning */
|
/* Consume const bytes and move the rest of the buffer to the beginning */
|
||||||
void gitno_consume_n(gitno_buffer *buf, unsigned int cons)
|
void gitno_consume_n(gitno_buffer *buf, size_t cons)
|
||||||
{
|
{
|
||||||
memmove(buf->data, buf->data + cons, buf->len - buf->offset);
|
memmove(buf->data, buf->data + cons, buf->len - buf->offset);
|
||||||
memset(buf->data + cons, 0x0, buf->len - buf->offset);
|
memset(buf->data + cons, 0x0, buf->len - buf->offset);
|
||||||
@ -130,9 +131,10 @@ cleanup:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gitno_send(int s, const char *msg, int len, int flags)
|
int gitno_send(int s, const char *msg, size_t len, int flags)
|
||||||
{
|
{
|
||||||
int ret, off = 0;
|
int ret;
|
||||||
|
size_t off = 0;
|
||||||
|
|
||||||
while (off < len) {
|
while (off < len) {
|
||||||
ret = send(s, msg + off, len - off, flags);
|
ret = send(s, msg + off, len - off, flags);
|
||||||
|
@ -12,18 +12,18 @@ typedef unsigned int GIT_SOCKET;
|
|||||||
|
|
||||||
typedef struct gitno_buffer {
|
typedef struct gitno_buffer {
|
||||||
char *data;
|
char *data;
|
||||||
unsigned int len;
|
size_t len;
|
||||||
unsigned int offset;
|
size_t offset;
|
||||||
GIT_SOCKET fd;
|
GIT_SOCKET fd;
|
||||||
} gitno_buffer;
|
} gitno_buffer;
|
||||||
|
|
||||||
void gitno_buffer_setup(gitno_buffer *buf, char *data, unsigned int len, int fd);
|
void gitno_buffer_setup(gitno_buffer *buf, char *data, unsigned int len, int fd);
|
||||||
int gitno_recv(gitno_buffer *buf);
|
int gitno_recv(gitno_buffer *buf);
|
||||||
void gitno_consume(gitno_buffer *buf, const char *ptr);
|
void gitno_consume(gitno_buffer *buf, const char *ptr);
|
||||||
void gitno_consume_n(gitno_buffer *buf, unsigned int cons);
|
void gitno_consume_n(gitno_buffer *buf, size_t cons);
|
||||||
|
|
||||||
int gitno_connect(const char *host, const char *port);
|
int gitno_connect(const char *host, const char *port);
|
||||||
int gitno_send(int s, const char *msg, int len, int flags);
|
int gitno_send(int s, const char *msg, size_t len, int flags);
|
||||||
int gitno_select_in(gitno_buffer *buf, long int sec, long int usec);
|
int gitno_select_in(gitno_buffer *buf, long int sec, long int usec);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user