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
abe23675
Unverified
Commit
abe23675
authored
Jan 17, 2019
by
Edward Thomson
Committed by
GitHub
Jan 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4925 from lhchavez/fix-a-bunch-of-warnings
Fix a bunch of warnings
parents
cecbe746
c6bfaf14
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
32 additions
and
46 deletions
+32
-46
deps/zlib/CMakeLists.txt
+1
-0
src/cc-compat.h
+15
-3
src/odb.c
+1
-1
src/streams/socket.c
+1
-1
src/transports/winhttp.c
+4
-32
src/win32/posix_w32.c
+0
-1
tests/clar_libgit2.h
+1
-1
tests/core/vector.c
+5
-3
tests/index/addall.c
+2
-2
tests/path/win32.c
+1
-1
tests/revwalk/basic.c
+1
-1
No files found.
deps/zlib/CMakeLists.txt
View file @
abe23675
DISABLE_WARNINGS
(
implicit-fallthrough
)
ADD_DEFINITIONS
(
-DNO_VIZ -DSTDC -DNO_GZIP
)
ADD_DEFINITIONS
(
-DNO_VIZ -DSTDC -DNO_GZIP
)
FILE
(
GLOB SRC_ZLIB
"*.c"
"*.h"
)
FILE
(
GLOB SRC_ZLIB
"*.c"
"*.h"
)
INCLUDE_DIRECTORIES
(
"."
)
INCLUDE_DIRECTORIES
(
"."
)
...
...
src/cc-compat.h
View file @
abe23675
...
@@ -47,12 +47,24 @@
...
@@ -47,12 +47,24 @@
/* Define the printf format specifer to use for size_t output */
/* Define the printf format specifer to use for size_t output */
#if defined(_MSC_VER) || defined(__MINGW32__)
#if defined(_MSC_VER) || defined(__MINGW32__)
# define PRIuZ "Iu"
# define PRIxZ "Ix"
/* The first block is needed to avoid warnings on MingW amd64 */
# define PRIdZ "Id"
# if (SIZE_MAX == ULLONG_MAX)
# define PRIuZ "I64u"
# define PRIxZ "I64x"
# define PRIXZ "I64X"
# define PRIdZ "I64d"
# else
# define PRIuZ "Iu"
# define PRIxZ "Ix"
# define PRIXZ "IX"
# define PRIdZ "Id"
# endif
#else
#else
# define PRIuZ "zu"
# define PRIuZ "zu"
# define PRIxZ "zx"
# define PRIxZ "zx"
# define PRIXZ "zX"
# define PRIdZ "zd"
# define PRIdZ "zd"
#endif
#endif
...
...
src/odb.c
View file @
abe23675
...
@@ -95,7 +95,7 @@ int git_odb__format_object_header(
...
@@ -95,7 +95,7 @@ int git_odb__format_object_header(
int
hdr_max
=
(
hdr_size
>
INT_MAX
-
2
)
?
(
INT_MAX
-
2
)
:
(
int
)
hdr_size
;
int
hdr_max
=
(
hdr_size
>
INT_MAX
-
2
)
?
(
INT_MAX
-
2
)
:
(
int
)
hdr_size
;
int
len
;
int
len
;
len
=
p_snprintf
(
hdr
,
hdr_max
,
"%s %
lld"
,
type_str
,
(
long
long
)
obj_len
);
len
=
p_snprintf
(
hdr
,
hdr_max
,
"%s %
"
PRId64
,
type_str
,
(
int64_t
)
obj_len
);
if
(
len
<
0
||
len
>=
hdr_max
)
{
if
(
len
<
0
||
len
>=
hdr_max
)
{
giterr_set
(
GITERR_OS
,
"object header creation failed"
);
giterr_set
(
GITERR_OS
,
"object header creation failed"
);
...
...
src/streams/socket.c
View file @
abe23675
...
@@ -38,7 +38,7 @@ static void net_set_error(const char *str)
...
@@ -38,7 +38,7 @@ static void net_set_error(const char *str)
giterr_set
(
GITERR_NET
,
"%s: %s"
,
str
,
win32_error
);
giterr_set
(
GITERR_NET
,
"%s: %s"
,
str
,
win32_error
);
git__free
(
win32_error
);
git__free
(
win32_error
);
}
else
{
}
else
{
giterr_set
(
GITERR_NET
,
str
);
giterr_set
(
GITERR_NET
,
"%s"
,
str
);
}
}
}
}
#else
#else
...
...
src/transports/winhttp.c
View file @
abe23675
...
@@ -329,34 +329,6 @@ static void winhttp_stream_close(winhttp_stream *s)
...
@@ -329,34 +329,6 @@ static void winhttp_stream_close(winhttp_stream *s)
s
->
sent_request
=
0
;
s
->
sent_request
=
0
;
}
}
/**
* Extract the url and password from a URL. The outputs are pointers
* into the input.
*/
static
int
userpass_from_url
(
wchar_t
**
user
,
int
*
user_len
,
wchar_t
**
pass
,
int
*
pass_len
,
const
wchar_t
*
url
,
int
url_len
)
{
URL_COMPONENTS
components
=
{
0
};
components
.
dwStructSize
=
sizeof
(
components
);
/* These tell WinHttpCrackUrl that we're interested in the fields */
components
.
dwUserNameLength
=
1
;
components
.
dwPasswordLength
=
1
;
if
(
!
WinHttpCrackUrl
(
url
,
url_len
,
0
,
&
components
))
{
giterr_set
(
GITERR_OS
,
"failed to extract user/pass from url"
);
return
-
1
;
}
*
user
=
components
.
lpszUserName
;
*
user_len
=
components
.
dwUserNameLength
;
*
pass
=
components
.
lpszPassword
;
*
pass_len
=
components
.
dwPasswordLength
;
return
0
;
}
#define SCHEME_HTTP "http://"
#define SCHEME_HTTP "http://"
#define SCHEME_HTTPS "https://"
#define SCHEME_HTTPS "https://"
...
@@ -659,7 +631,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
...
@@ -659,7 +631,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
git_buf
buf
=
GIT_BUF_INIT
;
git_buf
buf
=
GIT_BUF_INIT
;
/* Chunk header */
/* Chunk header */
git_buf_printf
(
&
buf
,
"%
X
\r\n
"
,
len
);
git_buf_printf
(
&
buf
,
"%
"
PRIXZ
"
\r\n
"
,
len
);
if
(
git_buf_oom
(
&
buf
))
if
(
git_buf_oom
(
&
buf
))
return
-
1
;
return
-
1
;
...
@@ -747,7 +719,7 @@ static void CALLBACK winhttp_status(
...
@@ -747,7 +719,7 @@ static void CALLBACK winhttp_status(
else
if
((
status
&
WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR
))
else
if
((
status
&
WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR
))
giterr_set
(
GITERR_NET
,
"security libraries could not be loaded"
);
giterr_set
(
GITERR_NET
,
"security libraries could not be loaded"
);
else
else
giterr_set
(
GITERR_NET
,
"unknown security error %
d
"
,
status
);
giterr_set
(
GITERR_NET
,
"unknown security error %
lu
"
,
status
);
}
}
static
int
winhttp_connect
(
static
int
winhttp_connect
(
...
@@ -870,7 +842,7 @@ static int do_send_request(winhttp_stream *s, size_t len, int ignore_length)
...
@@ -870,7 +842,7 @@ static int do_send_request(winhttp_stream *s, size_t len, int ignore_length)
len
,
0
);
len
,
0
);
}
}
if
(
success
||
GetLastError
()
!=
SEC_E_BUFFER_TOO_SMALL
)
if
(
success
||
GetLastError
()
!=
(
DWORD
)
SEC_E_BUFFER_TOO_SMALL
)
break
;
break
;
}
}
...
@@ -1170,7 +1142,7 @@ replay:
...
@@ -1170,7 +1142,7 @@ replay:
}
}
if
(
HTTP_STATUS_OK
!=
status_code
)
{
if
(
HTTP_STATUS_OK
!=
status_code
)
{
giterr_set
(
GITERR_NET
,
"request failed with status code: %
d
"
,
status_code
);
giterr_set
(
GITERR_NET
,
"request failed with status code: %
lu
"
,
status_code
);
return
-
1
;
return
-
1
;
}
}
...
...
src/win32/posix_w32.c
View file @
abe23675
...
@@ -397,7 +397,6 @@ int p_readlink(const char *path, char *buf, size_t bufsiz)
...
@@ -397,7 +397,6 @@ int p_readlink(const char *path, char *buf, size_t bufsiz)
int
p_symlink
(
const
char
*
target
,
const
char
*
path
)
int
p_symlink
(
const
char
*
target
,
const
char
*
path
)
{
{
git_win32_path
target_w
,
path_w
;
git_win32_path
target_w
,
path_w
;
wchar_t
*
target_p
;
if
(
git_win32_path_from_utf8
(
path_w
,
path
)
<
0
||
if
(
git_win32_path_from_utf8
(
path_w
,
path
)
<
0
||
git__utf8_to_16
(
target_w
,
MAX_PATH
,
target
)
<
0
)
git__utf8_to_16
(
target_w
,
MAX_PATH
,
target
)
<
0
)
...
...
tests/clar_libgit2.h
View file @
abe23675
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
#define cl_win32_pass(expr) do { \
#define cl_win32_pass(expr) do { \
int _win32_res; \
int _win32_res; \
if ((_win32_res = (expr)) == 0) { \
if ((_win32_res = (expr)) == 0) { \
giterr_set(GITERR_OS, "Returned: %d, system error code: %
d
", _win32_res, GetLastError()); \
giterr_set(GITERR_OS, "Returned: %d, system error code: %
lu
", _win32_res, GetLastError()); \
cl_git_report_failure(_win32_res, 0, __FILE__, __LINE__, "System call failed: " #expr); \
cl_git_report_failure(_win32_res, 0, __FILE__, __LINE__, "System call failed: " #expr); \
} \
} \
} while(0)
} while(0)
...
...
tests/core/vector.c
View file @
abe23675
#include <stdint.h>
#include "clar_libgit2.h"
#include "clar_libgit2.h"
#include "vector.h"
#include "vector.h"
...
@@ -66,14 +68,14 @@ void test_core_vector__2(void)
...
@@ -66,14 +68,14 @@ void test_core_vector__2(void)
static
int
compare_them
(
const
void
*
a
,
const
void
*
b
)
static
int
compare_them
(
const
void
*
a
,
const
void
*
b
)
{
{
return
(
int
)((
long
)
a
-
(
long
)
b
);
return
(
int
)((
intptr_t
)
a
-
(
intptr_t
)
b
);
}
}
/* insert_sorted */
/* insert_sorted */
void
test_core_vector__3
(
void
)
void
test_core_vector__3
(
void
)
{
{
git_vector
x
;
git_vector
x
;
long
i
;
intptr_t
i
;
git_vector_init
(
&
x
,
1
,
&
compare_them
);
git_vector_init
(
&
x
,
1
,
&
compare_them
);
for
(
i
=
0
;
i
<
10
;
i
+=
2
)
{
for
(
i
=
0
;
i
<
10
;
i
+=
2
)
{
...
@@ -96,7 +98,7 @@ void test_core_vector__3(void)
...
@@ -96,7 +98,7 @@ void test_core_vector__3(void)
void
test_core_vector__4
(
void
)
void
test_core_vector__4
(
void
)
{
{
git_vector
x
;
git_vector
x
;
long
i
;
intptr_t
i
;
git_vector_init
(
&
x
,
1
,
&
compare_them
);
git_vector_init
(
&
x
,
1
,
&
compare_them
);
for
(
i
=
0
;
i
<
10
;
i
+=
2
)
{
for
(
i
=
0
;
i
<
10
;
i
+=
2
)
{
...
...
tests/index/addall.c
View file @
abe23675
...
@@ -123,8 +123,8 @@ static void check_stat_data(git_index *index, const char *path, bool match)
...
@@ -123,8 +123,8 @@ static void check_stat_data(git_index *index, const char *path, bool match)
cl_assert
(
st
.
st_ctime
==
entry
->
ctime
.
seconds
);
cl_assert
(
st
.
st_ctime
==
entry
->
ctime
.
seconds
);
cl_assert
(
st
.
st_mtime
==
entry
->
mtime
.
seconds
);
cl_assert
(
st
.
st_mtime
==
entry
->
mtime
.
seconds
);
cl_assert
(
st
.
st_size
==
entry
->
file_size
);
cl_assert
(
st
.
st_size
==
entry
->
file_size
);
cl_assert
(
st
.
st_uid
==
entry
->
uid
);
cl_assert
(
(
uint32_t
)
st
.
st_uid
==
entry
->
uid
);
cl_assert
(
st
.
st_gid
==
entry
->
gid
);
cl_assert
(
(
uint32_t
)
st
.
st_gid
==
entry
->
gid
);
cl_assert_equal_i_fmt
(
cl_assert_equal_i_fmt
(
GIT_MODE_TYPE
(
st
.
st_mode
),
GIT_MODE_TYPE
(
entry
->
mode
),
"%07o"
);
GIT_MODE_TYPE
(
st
.
st_mode
),
GIT_MODE_TYPE
(
entry
->
mode
),
"%07o"
);
if
(
cl_is_chmod_supported
())
if
(
cl_is_chmod_supported
())
...
...
tests/path/win32.c
View file @
abe23675
...
@@ -150,7 +150,7 @@ static void test_remove_namespace(const wchar_t *in, const wchar_t *expected)
...
@@ -150,7 +150,7 @@ static void test_remove_namespace(const wchar_t *in, const wchar_t *expected)
cl_assert
(
wcslen
(
in
)
<
MAX_PATH
);
cl_assert
(
wcslen
(
in
)
<
MAX_PATH
);
wcscpy
(
canonical
,
in
);
wcscpy
(
canonical
,
in
);
cl_must_pass
(
git_win32_path_remove_namespace
(
canonical
,
wcslen
(
in
)
));
git_win32_path_remove_namespace
(
canonical
,
wcslen
(
in
));
cl_assert_equal_wcs
(
expected
,
canonical
);
cl_assert_equal_wcs
(
expected
,
canonical
);
#else
#else
GIT_UNUSED
(
in
);
GIT_UNUSED
(
in
);
...
...
tests/revwalk/basic.c
View file @
abe23675
...
@@ -512,7 +512,7 @@ void test_revwalk_basic__big_timestamp(void)
...
@@ -512,7 +512,7 @@ void test_revwalk_basic__big_timestamp(void)
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
tip
,
head
,
GIT_OBJECT_COMMIT
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
tip
,
head
,
GIT_OBJECT_COMMIT
));
/* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */
/* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */
cl_git_pass
(
git_signature_new
(
&
sig
,
"Joe"
,
"joe@example.com"
,
2399662595
,
0
));
cl_git_pass
(
git_signature_new
(
&
sig
,
"Joe"
,
"joe@example.com"
,
2399662595
ll
,
0
));
cl_git_pass
(
git_commit_tree
(
&
tree
,
tip
));
cl_git_pass
(
git_commit_tree
(
&
tree
,
tip
));
cl_git_pass
(
git_commit_create
(
&
id
,
_repo
,
"HEAD"
,
sig
,
sig
,
NULL
,
"some message"
,
tree
,
1
,
cl_git_pass
(
git_commit_create
(
&
id
,
_repo
,
"HEAD"
,
sig
,
sig
,
NULL
,
"some message"
,
tree
,
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