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
b5e8272f
Commit
b5e8272f
authored
Jan 06, 2019
by
lhchavez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt at fixing the MingW64 compilation
It seems like MingW64's size_t is defined differently than in Linux.
parent
7b453e7e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
21 deletions
+40
-21
deps/zlib/CMakeLists.txt
+1
-0
src/cc-compat.h
+11
-3
src/integer.h
+20
-12
tests/core/vector.c
+5
-3
tests/index/addall.c
+2
-2
tests/path/win32.c
+1
-1
No files found.
deps/zlib/CMakeLists.txt
View file @
b5e8272f
DISABLE_WARNINGS
(
implicit-fallthrough
)
ADD_DEFINITIONS
(
-DNO_VIZ -DSTDC -DNO_GZIP
)
FILE
(
GLOB SRC_ZLIB
"*.c"
"*.h"
)
INCLUDE_DIRECTORIES
(
"."
)
...
...
src/cc-compat.h
View file @
b5e8272f
...
...
@@ -47,9 +47,17 @@
/* Define the printf format specifer to use for size_t output */
#if defined(_MSC_VER) || defined(__MINGW32__)
# define PRIuZ "Iu"
# define PRIxZ "Ix"
# define PRIdZ "Id"
# if (SIZE_MAX == ULLONG_MAX)
# define PRIuZ "I64u"
# define PRIxZ "I64x"
# define PRIdZ "I64d"
# else
# define PRIuZ "Iu"
# define PRIxZ "Ix"
# define PRIdZ "Id"
# endif
#else
# define PRIuZ "zu"
# define PRIxZ "zx"
...
...
src/integer.h
View file @
b5e8272f
...
...
@@ -55,18 +55,26 @@ GIT_INLINE(bool) git__add_uint64_overflow(uint64_t *out, uint64_t one, uint64_t
}
/* Use clang/gcc compiler intrinsics whenever possible */
#if (SIZE_MAX == ULLONG_MAX) && (__has_builtin(__builtin_uaddl_overflow) || \
(defined(__GNUC__) && (__GNUC__ >= 5)))
# define git__add_sizet_overflow(out, one, two) \
__builtin_uaddl_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_umull_overflow(one, two, out)
#elif (__has_builtin(__builtin_add_overflow) || \
(defined(__GNUC__) && (__GNUC__ >= 5)))
# define git__add_sizet_overflow(out, one, two) \
__builtin_add_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_mul_overflow(one, two, out)
#if (__has_builtin(__builtin_add_overflow) || \
(defined(__GNUC__) && (__GNUC__ >= 5)))
# if (ULONG_MAX == ULLONG_MAX) && defined(_WIN64)
# define git__add_sizet_overflow(out, one, two) \
__builtin_uaddll_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_umulll_overflow(one, two, out)
# elif (ULONG_MAX == ULLONG_MAX)
# define git__add_sizet_overflow(out, one, two) \
__builtin_uaddl_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_umull_overflow(one, two, out)
# else
# define git__add_sizet_overflow(out, one, two) \
__builtin_add_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_mul_overflow(one, two, out)
# endif
#else
/**
...
...
tests/core/vector.c
View file @
b5e8272f
#include <stdint.h>
#include "clar_libgit2.h"
#include "vector.h"
...
...
@@ -66,14 +68,14 @@ void test_core_vector__2(void)
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 */
void
test_core_vector__3
(
void
)
{
git_vector
x
;
long
i
;
intptr_t
i
;
git_vector_init
(
&
x
,
1
,
&
compare_them
);
for
(
i
=
0
;
i
<
10
;
i
+=
2
)
{
...
...
@@ -96,7 +98,7 @@ void test_core_vector__3(void)
void
test_core_vector__4
(
void
)
{
git_vector
x
;
long
i
;
intptr_t
i
;
git_vector_init
(
&
x
,
1
,
&
compare_them
);
for
(
i
=
0
;
i
<
10
;
i
+=
2
)
{
...
...
tests/index/addall.c
View file @
b5e8272f
...
...
@@ -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_mtime
==
entry
->
mtime
.
seconds
);
cl_assert
(
st
.
st_size
==
entry
->
file_size
);
cl_assert
(
st
.
st_uid
==
entry
->
uid
);
cl_assert
(
st
.
st_gid
==
entry
->
gid
);
cl_assert
(
st
.
st_uid
==
(
uid_t
)
entry
->
uid
);
cl_assert
(
st
.
st_gid
==
(
gid_t
)
entry
->
gid
);
cl_assert_equal_i_fmt
(
GIT_MODE_TYPE
(
st
.
st_mode
),
GIT_MODE_TYPE
(
entry
->
mode
),
"%07o"
);
if
(
cl_is_chmod_supported
())
...
...
tests/path/win32.c
View file @
b5e8272f
...
...
@@ -150,7 +150,7 @@ static void test_remove_namespace(const wchar_t *in, const wchar_t *expected)
cl_assert
(
wcslen
(
in
)
<
MAX_PATH
);
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
);
#else
GIT_UNUSED
(
in
);
...
...
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