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
0ef9d2aa
Commit
0ef9d2aa
authored
Jan 03, 2010
by
Ramsay Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some "signed v unsigned comparison" warnings with -Wextra
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
parent
a4f863af
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
src/errors.c
+1
-1
src/odb.c
+6
-6
src/oid.c
+3
-3
src/util.c
+1
-1
No files found.
src/errors.c
View file @
0ef9d2aa
...
...
@@ -40,7 +40,7 @@ static struct {
const
char
*
git_strerror
(
int
num
)
{
in
t
i
;
size_
t
i
;
if
(
num
==
GIT_EOSERR
)
return
strerror
(
errno
);
...
...
src/odb.c
View file @
0ef9d2aa
...
...
@@ -124,14 +124,14 @@ GIT_INLINE(uint64_t) decode64(void *b)
const
char
*
git_obj_type_to_string
(
git_otype
type
)
{
if
(
type
<
0
||
type
>=
ARRAY_SIZE
(
obj_type_table
))
if
(
type
<
0
||
((
size_t
)
type
)
>=
ARRAY_SIZE
(
obj_type_table
))
return
""
;
return
obj_type_table
[
type
].
str
;
}
git_otype
git_obj_string_to_type
(
const
char
*
str
)
{
in
t
i
;
size_
t
i
;
if
(
!
str
||
!*
str
)
return
GIT_OBJ_BAD
;
...
...
@@ -145,7 +145,7 @@ git_otype git_obj_string_to_type(const char *str)
int
git_obj__loose_object_type
(
git_otype
type
)
{
if
(
type
<
0
||
type
>=
ARRAY_SIZE
(
obj_type_table
))
if
(
type
<
0
||
((
size_t
)
type
)
>=
ARRAY_SIZE
(
obj_type_table
))
return
0
;
return
obj_type_table
[
type
].
loose
;
}
...
...
@@ -155,10 +155,10 @@ static int format_object_header(char *hdr, size_t n, git_obj *obj)
const
char
*
type_str
=
git_obj_type_to_string
(
obj
->
type
);
int
len
=
snprintf
(
hdr
,
n
,
"%s %"
PRIuZ
,
type_str
,
obj
->
len
);
assert
(
len
>
0
);
/* otherwise snprintf() is broken
*/
assert
(
len
<
n
);
/* otherwise the caller is broken! */
assert
(
len
>
0
);
/* otherwise snprintf() is broken
*/
assert
(
((
size_t
)
len
)
<
n
);
/* otherwise the caller is broken! */
if
(
len
<
0
||
len
>=
n
)
if
(
len
<
0
||
((
size_t
)
len
)
>=
n
)
return
GIT_ERROR
;
return
len
+
1
;
}
...
...
src/oid.c
View file @
0ef9d2aa
...
...
@@ -49,7 +49,7 @@ static char to_hex[] = "0123456789abcdef";
int
git_oid_mkstr
(
git_oid
*
out
,
const
char
*
str
)
{
in
t
p
;
size_
t
p
;
for
(
p
=
0
;
p
<
sizeof
(
out
->
id
);
p
++
,
str
+=
2
)
{
int
v
=
(
from_hex
[(
unsigned
char
)
str
[
0
]]
<<
4
)
|
from_hex
[(
unsigned
char
)
str
[
1
]];
...
...
@@ -69,7 +69,7 @@ GIT_INLINE(char) *fmt_one(char *str, unsigned int val)
void
git_oid_fmt
(
char
*
str
,
const
git_oid
*
oid
)
{
in
t
i
;
size_
t
i
;
for
(
i
=
0
;
i
<
sizeof
(
oid
->
id
);
i
++
)
str
=
fmt_one
(
str
,
oid
->
id
[
i
]);
...
...
@@ -77,7 +77,7 @@ void git_oid_fmt(char *str, const git_oid *oid)
void
git_oid_pathfmt
(
char
*
str
,
const
git_oid
*
oid
)
{
in
t
i
;
size_
t
i
;
str
=
fmt_one
(
str
,
oid
->
id
[
0
]);
*
str
++
=
'/'
;
...
...
src/util.c
View file @
0ef9d2aa
...
...
@@ -35,7 +35,7 @@ int git__fmt(char *buf, size_t buf_sz, const char *fmt, ...)
va_start
(
va
,
fmt
);
r
=
vsnprintf
(
buf
,
buf_sz
,
fmt
,
va
);
va_end
(
va
);
if
(
r
<
0
||
r
>=
buf_sz
)
if
(
r
<
0
||
((
size_t
)
r
)
>=
buf_sz
)
return
GIT_ERROR
;
return
r
;
}
...
...
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