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
e953c160
Commit
e953c160
authored
Mar 14, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1414 from arrbee/more-build-warning-fixes
Fix various build warnings
parents
6950dca4
55e0f53d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
25 deletions
+27
-25
src/refs.c
+12
-7
src/transports/winhttp.c
+10
-15
tests-clar/commit/parse.c
+1
-1
tests-clar/refs/pack.c
+2
-2
tests-clar/trace/trace.c
+2
-0
No files found.
src/refs.c
View file @
e953c160
...
...
@@ -39,10 +39,13 @@ git_reference *git_reference__alloc(
const
char
*
symbolic
)
{
git_reference
*
ref
;
size_t
namelen
;
assert
(
refdb
&&
name
&&
((
oid
&&
!
symbolic
)
||
(
!
oid
&&
symbolic
)));
if
((
ref
=
git__calloc
(
1
,
sizeof
(
git_reference
)
+
strlen
(
name
)
+
1
))
==
NULL
)
namelen
=
strlen
(
name
);
if
((
ref
=
git__calloc
(
1
,
sizeof
(
git_reference
)
+
namelen
+
1
))
==
NULL
)
return
NULL
;
if
(
oid
)
{
...
...
@@ -51,13 +54,15 @@ git_reference *git_reference__alloc(
}
else
{
ref
->
type
=
GIT_REF_SYMBOLIC
;
if
((
ref
->
target
.
symbolic
=
git__strdup
(
symbolic
))
==
NULL
)
if
((
ref
->
target
.
symbolic
=
git__strdup
(
symbolic
))
==
NULL
)
{
git__free
(
ref
);
return
NULL
;
}
}
ref
->
db
=
refdb
;
strcpy
(
ref
->
name
,
name
);
memcpy
(
ref
->
name
,
name
,
namelen
+
1
);
return
ref
;
}
...
...
@@ -70,7 +75,7 @@ void git_reference_free(git_reference *reference)
git__free
(
reference
->
target
.
symbolic
);
reference
->
target
.
symbolic
=
NULL
;
}
reference
->
db
=
NULL
;
reference
->
type
=
GIT_REF_INVALID
;
...
...
src/transports/winhttp.c
View file @
e953c160
...
...
@@ -560,11 +560,11 @@ static int winhttp_stream_write_single(
return
0
;
}
static
int
put_uuid_string
(
LPWSTR
buffer
,
DWORD
buffer_len_cch
)
static
int
put_uuid_string
(
LPWSTR
buffer
,
size_t
buffer_len_cch
)
{
UUID
uuid
;
RPC_STATUS
status
=
UuidCreate
(
&
uuid
);
int
result
;
HRESULT
result
;
if
(
RPC_S_OK
!=
status
&&
RPC_S_UUID_LOCAL_ONLY
!=
status
&&
...
...
@@ -573,17 +573,19 @@ static int put_uuid_string(LPWSTR buffer, DWORD buffer_len_cch)
return
-
1
;
}
if
(
buffer_len_cch
<
(
UUID_LENGTH_CCH
+
1
)
)
{
giterr_set
(
GITERR_NET
,
"Buffer
insufficient to generate temp file nam
e"
);
if
(
buffer_len_cch
<
UUID_LENGTH_CCH
+
1
)
{
giterr_set
(
GITERR_NET
,
"Buffer
too small for name of temp fil
e"
);
return
-
1
;
}
result
=
wsprintfW
(
buffer
,
L"%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x"
,
result
=
StringCbPrintfW
(
buffer
,
buffer_len_cch
,
L"%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x"
,
uuid
.
Data1
,
uuid
.
Data2
,
uuid
.
Data3
,
uuid
.
Data4
[
0
],
uuid
.
Data4
[
1
],
uuid
.
Data4
[
2
],
uuid
.
Data4
[
3
],
uuid
.
Data4
[
4
],
uuid
.
Data4
[
5
],
uuid
.
Data4
[
6
],
uuid
.
Data4
[
7
]);
if
(
result
!=
UUID_LENGTH_CCH
)
{
if
(
FAILED
(
result
)
)
{
giterr_set
(
GITERR_OS
,
"Unable to generate name for temp file"
);
return
-
1
;
}
...
...
@@ -602,17 +604,10 @@ static int get_temp_file(LPWSTR buffer, DWORD buffer_len_cch)
len
=
wcslen
(
buffer
);
/* 1 prefix character for the backslash, 1 postfix for
* the null terminator */
if
(
buffer_len_cch
-
len
<
1
+
UUID_LENGTH_CCH
+
1
)
{
giterr_set
(
GITERR_NET
,
"Buffer insufficient to generate temp file name"
);
return
-
1
;
}
if
(
buffer
[
len
-
1
]
!=
'\\'
)
if
(
buffer
[
len
-
1
]
!=
'\\'
&&
len
<
buffer_len_cch
)
buffer
[
len
++
]
=
'\\'
;
if
(
put_uuid_string
(
&
buffer
[
len
],
UUID_LENGTH_CCH
+
1
)
<
0
)
if
(
put_uuid_string
(
&
buffer
[
len
],
(
size_t
)
buffer_len_cch
-
len
)
<
0
)
return
-
1
;
return
0
;
...
...
tests-clar/commit/parse.c
View file @
e953c160
...
...
@@ -155,7 +155,7 @@ void test_commit_parse__signature(void)
cl_git_pass
(
git_signature__parse
(
&
person
,
&
str
,
str
+
len
,
passcase
->
header
,
'\n'
));
cl_assert_equal_s
(
passcase
->
name
,
person
.
name
);
cl_assert_equal_s
(
passcase
->
email
,
person
.
email
);
cl_assert_equal_i
(
passcase
->
time
,
person
.
when
.
time
);
cl_assert_equal_i
(
(
int
)
passcase
->
time
,
(
int
)
person
.
when
.
time
);
cl_assert_equal_i
(
passcase
->
offset
,
person
.
when
.
offset
);
git__free
(
person
.
name
);
git__free
(
person
.
email
);
}
...
...
tests-clar/refs/pack.c
View file @
e953c160
...
...
@@ -19,10 +19,10 @@ void test_refs_pack__cleanup(void)
cl_git_sandbox_cleanup
();
}
void
packall
(
)
static
void
packall
(
void
)
{
git_refdb
*
refdb
;
cl_git_pass
(
git_repository_refdb
(
&
refdb
,
g_repo
));
cl_git_pass
(
git_refdb_compress
(
refdb
));
}
...
...
tests-clar/trace/trace.c
View file @
e953c160
...
...
@@ -5,6 +5,8 @@ static int written = 0;
static
void
trace_callback
(
git_trace_level_t
level
,
const
char
*
message
)
{
GIT_UNUSED
(
level
);
cl_assert
(
strcmp
(
message
,
"Hello world!"
)
==
0
);
written
=
1
;
...
...
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