Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
0bd594b6
Commit
0bd594b6
authored
Aug 30, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netops: Use the size_t, Luke
parent
778e1c73
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
src/netops.c
+6
-4
src/netops.h
+4
-4
No files found.
src/netops.c
View file @
0bd594b6
...
...
@@ -68,8 +68,9 @@ int gitno_recv(gitno_buffer *buf)
/* Consume up to ptr and move the rest of the buffer to the beginning */
void
gitno_consume
(
gitno_buffer
*
buf
,
const
char
*
ptr
)
{
in
t
consumed
;
size_
t
consumed
;
assert
(
ptr
-
buf
->
data
>=
0
);
assert
(
ptr
-
buf
->
data
<=
(
int
)
buf
->
len
);
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 */
void
gitno_consume_n
(
gitno_buffer
*
buf
,
unsigned
in
t
cons
)
void
gitno_consume_n
(
gitno_buffer
*
buf
,
size_
t
cons
)
{
memmove
(
buf
->
data
,
buf
->
data
+
cons
,
buf
->
len
-
buf
->
offset
);
memset
(
buf
->
data
+
cons
,
0x0
,
buf
->
len
-
buf
->
offset
);
...
...
@@ -130,9 +131,10 @@ cleanup:
return
error
;
}
int
gitno_send
(
int
s
,
const
char
*
msg
,
in
t
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
)
{
ret
=
send
(
s
,
msg
+
off
,
len
-
off
,
flags
);
...
...
src/netops.h
View file @
0bd594b6
...
...
@@ -12,18 +12,18 @@ typedef unsigned int GIT_SOCKET;
typedef
struct
gitno_buffer
{
char
*
data
;
unsigned
in
t
len
;
unsigned
in
t
offset
;
size_
t
len
;
size_
t
offset
;
GIT_SOCKET
fd
;
}
gitno_buffer
;
void
gitno_buffer_setup
(
gitno_buffer
*
buf
,
char
*
data
,
unsigned
int
len
,
int
fd
);
int
gitno_recv
(
gitno_buffer
*
buf
);
void
gitno_consume
(
gitno_buffer
*
buf
,
const
char
*
ptr
);
void
gitno_consume_n
(
gitno_buffer
*
buf
,
unsigned
in
t
cons
);
void
gitno_consume_n
(
gitno_buffer
*
buf
,
size_
t
cons
);
int
gitno_connect
(
const
char
*
host
,
const
char
*
port
);
int
gitno_send
(
int
s
,
const
char
*
msg
,
in
t
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
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment