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
fd69c7bf
Commit
fd69c7bf
authored
Feb 17, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1344 from arrbee/fix-static-analyzer-issues
Fix static analyzer issues
parents
1d75acf7
56543a60
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
51 additions
and
43 deletions
+51
-43
examples/general.c
+0
-0
src/checkout.c
+7
-3
src/diff_output.c
+6
-5
src/notes.c
+1
-1
src/posix.c
+23
-26
src/refs.c
+1
-1
src/transports/winhttp.c
+1
-1
tests-clar/clar_libgit2.c
+10
-6
tests-clar/core/env.c
+2
-0
No files found.
examples/general.c
View file @
fd69c7bf
This diff is collapsed.
Click to expand it.
src/checkout.c
View file @
fd69c7bf
...
...
@@ -64,6 +64,7 @@ static int checkout_notify(
{
git_diff_file
wdfile
;
const
git_diff_file
*
baseline
=
NULL
,
*
target
=
NULL
,
*
workdir
=
NULL
;
const
char
*
path
=
NULL
;
if
(
!
data
->
opts
.
notify_cb
)
return
0
;
...
...
@@ -81,6 +82,8 @@ static int checkout_notify(
wdfile
.
mode
=
wditem
->
mode
;
workdir
=
&
wdfile
;
path
=
wditem
->
path
;
}
if
(
delta
)
{
...
...
@@ -101,11 +104,12 @@ static int checkout_notify(
baseline
=
&
delta
->
old_file
;
break
;
}
path
=
delta
->
old_file
.
path
;
}
return
data
->
opts
.
notify_cb
(
why
,
delta
?
delta
->
old_file
.
path
:
wditem
->
path
,
baseline
,
target
,
workdir
,
data
->
opts
.
notify_payload
);
why
,
path
,
baseline
,
target
,
workdir
,
data
->
opts
.
notify_payload
);
}
static
bool
checkout_is_workdir_modified
(
...
...
@@ -683,7 +687,7 @@ static int blob_content_to_file(
{
int
error
=
-
1
,
nb_filters
=
0
;
mode_t
file_mode
=
opts
->
file_mode
;
bool
dont_free_filtered
=
false
;
bool
dont_free_filtered
;
git_buf
unfiltered
=
GIT_BUF_INIT
,
filtered
=
GIT_BUF_INIT
;
git_vector
filters
=
GIT_VECTOR_INIT
;
...
...
src/diff_output.c
View file @
fd69c7bf
...
...
@@ -1280,14 +1280,15 @@ static void set_data_from_buffer(
{
file
->
size
=
(
git_off_t
)
buffer_len
;
file
->
mode
=
0644
;
map
->
len
=
buffer_len
;
if
(
!
buffer
)
if
(
!
buffer
)
{
file
->
flags
|=
GIT_DIFF_FILE_NO_DATA
;
else
map
->
data
=
NULL
;
}
else
{
map
->
data
=
(
char
*
)
buffer
;
git_odb_hash
(
&
file
->
oid
,
buffer
,
buffer_len
,
GIT_OBJ_BLOB
);
map
->
len
=
buffer_len
;
map
->
data
=
(
char
*
)
buffer
;
}
}
typedef
struct
{
...
...
src/notes.c
View file @
fd69c7bf
...
...
@@ -147,7 +147,7 @@ static int manipulate_note_in_tree_r(
int
fanout
,
int
current_error
))
{
int
error
=
-
1
;
int
error
;
git_tree
*
subtree
=
NULL
,
*
new
=
NULL
;
char
subtree_name
[
3
];
...
...
src/posix.c
View file @
fd69c7bf
...
...
@@ -13,25 +13,28 @@
#ifndef GIT_WIN32
#ifdef NO_ADDRINFO
int
p_getaddrinfo
(
const
char
*
host
,
const
char
*
port
,
struct
addrinfo
*
hints
,
struct
addrinfo
**
info
)
{
GIT_UNUSED
(
hints
);
struct
addrinfo
*
ainfo
,
*
ai
;
int
p
=
0
;
GIT_UNUSED
(
hints
);
if
((
ainfo
=
malloc
(
sizeof
(
struct
addrinfo
)))
==
NULL
)
return
-
1
;
if
((
ainfo
->
ai_hostent
=
gethostbyname
(
host
))
==
NULL
)
if
((
ainfo
->
ai_hostent
=
gethostbyname
(
host
))
==
NULL
)
{
free
(
ainfo
);
return
-
2
;
}
ainfo
->
ai_servent
=
getservbyname
(
port
,
0
);
if
(
ainfo
->
ai_servent
)
ainfo
->
ai_port
=
ainfo
->
ai_servent
->
s_port
;
else
...
...
@@ -50,14 +53,14 @@ int p_getaddrinfo(
ainfo
->
ai_addrlen
=
sizeof
(
struct
sockaddr_in
);
*
info
=
ainfo
;
if
(
ainfo
->
ai_hostent
->
h_addr_list
[
1
]
==
NULL
)
{
ainfo
->
ai_next
=
NULL
;
return
0
;
}
ai
=
ainfo
;
for
(
p
=
1
;
ainfo
->
ai_hostent
->
h_addr_list
[
p
]
!=
NULL
;
p
++
)
{
ai
->
ai_next
=
malloc
(
sizeof
(
struct
addrinfo
));
memcpy
(
&
ai
->
ai_next
,
ainfo
,
sizeof
(
struct
addrinfo
));
...
...
@@ -67,7 +70,7 @@ int p_getaddrinfo(
ai
->
ai_next
->
ai_addr
=
(
struct
addrinfo
*
)
&
ai
->
ai_next
->
ai_addr_in
;
ai
=
ai
->
ai_next
;
}
ai
->
ai_next
=
NULL
;
return
0
;
}
...
...
@@ -75,9 +78,9 @@ int p_getaddrinfo(
void
p_freeaddrinfo
(
struct
addrinfo
*
info
)
{
struct
addrinfo
*
p
,
*
next
;
p
=
info
;
while
(
p
!=
NULL
)
{
next
=
p
->
ai_next
;
free
(
p
);
...
...
@@ -88,27 +91,19 @@ void p_freeaddrinfo(struct addrinfo *info)
const
char
*
p_gai_strerror
(
int
ret
)
{
switch
(
ret
)
{
case
-
1
:
return
"Out of memory"
;
break
;
case
-
2
:
return
"Address lookup failed"
;
break
;
default:
return
"Unknown error"
;
break
;
case
-
1
:
return
"Out of memory"
;
break
;
case
-
2
:
return
"Address lookup failed"
;
break
;
default:
return
"Unknown error"
;
break
;
}
}
#endif
/* NO_ADDRINFO */
int
p_open
(
const
char
*
path
,
int
flags
,
...)
{
mode_t
mode
=
0
;
if
(
flags
&
O_CREAT
)
{
if
(
flags
&
O_CREAT
)
{
va_list
arg_list
;
va_start
(
arg_list
,
flags
);
...
...
@@ -159,6 +154,7 @@ int p_rename(const char *from, const char *to)
int
p_read
(
git_file
fd
,
void
*
buf
,
size_t
cnt
)
{
char
*
b
=
buf
;
while
(
cnt
)
{
ssize_t
r
;
#ifdef GIT_WIN32
...
...
@@ -183,6 +179,7 @@ int p_read(git_file fd, void *buf, size_t cnt)
int
p_write
(
git_file
fd
,
const
void
*
buf
,
size_t
cnt
)
{
const
char
*
b
=
buf
;
while
(
cnt
)
{
ssize_t
r
;
#ifdef GIT_WIN32
...
...
src/refs.c
View file @
fd69c7bf
...
...
@@ -1493,7 +1493,7 @@ int git_reference_foreach(
/* list all the packed references first */
if
(
list_flags
&
GIT_REF_PACKED
)
{
const
char
*
ref_name
;
void
*
ref
;
void
*
ref
=
NULL
;
GIT_UNUSED
(
ref
);
if
(
packed_load
(
repo
)
<
0
)
...
...
src/transports/winhttp.c
View file @
fd69c7bf
...
...
@@ -88,7 +88,7 @@ static int apply_basic_credential(HINTERNET request, git_cred *cred)
git_cred_userpass_plaintext
*
c
=
(
git_cred_userpass_plaintext
*
)
cred
;
git_buf
buf
=
GIT_BUF_INIT
,
raw
=
GIT_BUF_INIT
;
wchar_t
*
wide
=
NULL
;
int
error
=
-
1
,
wide_len
;
int
error
=
-
1
,
wide_len
=
0
;
git_buf_printf
(
&
raw
,
"%s:%s"
,
c
->
username
,
c
->
password
);
...
...
tests-clar/clar_libgit2.c
View file @
fd69c7bf
...
...
@@ -86,14 +86,18 @@ int cl_setenv(const char *name, const char *value)
git__utf8_to_16
(
name_utf16
,
GIT_WIN_PATH
,
name
);
if
(
value
!=
NULL
)
if
(
value
)
{
git__utf8_to_16
(
value_utf16
,
GIT_WIN_PATH
,
value
);
cl_assert
(
SetEnvironmentVariableW
(
name_utf16
,
value_utf16
));
}
else
{
/* Windows XP returns 0 (failed) when passing NULL for lpValue when
* lpName does not exist in the environment block. This behavior
* seems to have changed in later versions. Don't check return value
* of SetEnvironmentVariable when passing NULL for lpValue.
*/
SetEnvironmentVariableW
(
name_utf16
,
NULL
);
}
/* Windows XP returns 0 (failed) when passing NULL for lpValue when lpName
* does not exist in the environment block. This behavior seems to have changed
* in later versions. Don't fail when SetEnvironmentVariable fails, if we passed
* NULL for lpValue. */
cl_assert
(
SetEnvironmentVariableW
(
name_utf16
,
value
?
value_utf16
:
NULL
)
||
!
value
);
return
0
;
}
...
...
tests-clar/core/env.c
View file @
fd69c7bf
...
...
@@ -74,6 +74,8 @@ void test_core_env__0(void)
char
**
val
;
memset
(
testfile
,
0
,
sizeof
(
testfile
));
cl_assert_equal_s
(
""
,
testfile
);
memcpy
(
testfile
,
"testfile"
,
8
);
cl_assert_equal_s
(
"testfile"
,
testfile
);
...
...
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