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
cc427158
Commit
cc427158
authored
Feb 28, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1373 from arrbee/why-cdecl-why
Why cdecl why?
parents
5fa8abb8
f443a72d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
12 deletions
+22
-12
src/common.h
+3
-3
src/hashsig.c
+8
-8
src/win32/msvc-compat.h
+9
-0
src/win32/posix_w32.c
+2
-1
No files found.
src/common.h
View file @
cc427158
...
@@ -33,14 +33,14 @@
...
@@ -33,14 +33,14 @@
# include "win32/pthread.h"
# include "win32/pthread.h"
#endif
#endif
# define snprintf _snprintf
#else
#else
# include <unistd.h>
# include <unistd.h>
# ifdef GIT_THREADS
# ifdef GIT_THREADS
# include <pthread.h>
# include <pthread.h>
# endif
# endif
#define GIT_STDLIB_CALL
#endif
#endif
#include "git2/types.h"
#include "git2/types.h"
...
...
src/hashsig.c
View file @
cc427158
...
@@ -19,7 +19,7 @@ typedef uint64_t hashsig_state;
...
@@ -19,7 +19,7 @@ typedef uint64_t hashsig_state;
#define HASHSIG_HEAP_SIZE ((1 << 7) - 1)
#define HASHSIG_HEAP_SIZE ((1 << 7) - 1)
typedef
int
(
*
hashsig_cmp
)(
const
void
*
a
,
const
void
*
b
);
typedef
int
(
GIT_STDLIB_CALL
*
hashsig_cmp
)(
const
void
*
a
,
const
void
*
b
);
typedef
struct
{
typedef
struct
{
int
size
,
asize
;
int
size
,
asize
;
...
@@ -53,13 +53,13 @@ static void hashsig_heap_init(hashsig_heap *h, hashsig_cmp cmp)
...
@@ -53,13 +53,13 @@ static void hashsig_heap_init(hashsig_heap *h, hashsig_cmp cmp)
h
->
cmp
=
cmp
;
h
->
cmp
=
cmp
;
}
}
static
int
hashsig_cmp_max
(
const
void
*
a
,
const
void
*
b
)
static
int
GIT_STDLIB_CALL
hashsig_cmp_max
(
const
void
*
a
,
const
void
*
b
)
{
{
hashsig_t
av
=
*
(
const
hashsig_t
*
)
a
,
bv
=
*
(
const
hashsig_t
*
)
b
;
hashsig_t
av
=
*
(
const
hashsig_t
*
)
a
,
bv
=
*
(
const
hashsig_t
*
)
b
;
return
(
av
<
bv
)
?
-
1
:
(
av
>
bv
)
?
1
:
0
;
return
(
av
<
bv
)
?
-
1
:
(
av
>
bv
)
?
1
:
0
;
}
}
static
int
hashsig_cmp_min
(
const
void
*
a
,
const
void
*
b
)
static
int
GIT_STDLIB_CALL
hashsig_cmp_min
(
const
void
*
a
,
const
void
*
b
)
{
{
hashsig_t
av
=
*
(
const
hashsig_t
*
)
a
,
bv
=
*
(
const
hashsig_t
*
)
b
;
hashsig_t
av
=
*
(
const
hashsig_t
*
)
a
,
bv
=
*
(
const
hashsig_t
*
)
b
;
return
(
av
>
bv
)
?
-
1
:
(
av
<
bv
)
?
1
:
0
;
return
(
av
>
bv
)
?
-
1
:
(
av
<
bv
)
?
1
:
0
;
...
@@ -183,8 +183,8 @@ static void hashsig_initial_window(
...
@@ -183,8 +183,8 @@ static void hashsig_initial_window(
/* insert initial hash if we just finished */
/* insert initial hash if we just finished */
if
(
win_len
==
HASHSIG_HASH_WINDOW
)
{
if
(
win_len
==
HASHSIG_HASH_WINDOW
)
{
hashsig_heap_insert
(
&
sig
->
mins
,
state
);
hashsig_heap_insert
(
&
sig
->
mins
,
(
hashsig_t
)
state
);
hashsig_heap_insert
(
&
sig
->
maxs
,
state
);
hashsig_heap_insert
(
&
sig
->
maxs
,
(
hashsig_t
)
state
);
sig
->
considered
=
1
;
sig
->
considered
=
1
;
}
}
...
@@ -224,8 +224,8 @@ static int hashsig_add_hashes(
...
@@ -224,8 +224,8 @@ static int hashsig_add_hashes(
state
=
(
state
*
HASHSIG_HASH_SHIFT
)
&
HASHSIG_HASH_MASK
;
state
=
(
state
*
HASHSIG_HASH_SHIFT
)
&
HASHSIG_HASH_MASK
;
state
=
(
state
+
ch
)
&
HASHSIG_HASH_MASK
;
state
=
(
state
+
ch
)
&
HASHSIG_HASH_MASK
;
hashsig_heap_insert
(
&
sig
->
mins
,
state
);
hashsig_heap_insert
(
&
sig
->
mins
,
(
hashsig_t
)
state
);
hashsig_heap_insert
(
&
sig
->
maxs
,
state
);
hashsig_heap_insert
(
&
sig
->
maxs
,
(
hashsig_t
)
state
);
sig
->
considered
++
;
sig
->
considered
++
;
prog
->
window
[
prog
->
win_pos
]
=
ch
;
prog
->
window
[
prog
->
win_pos
]
=
ch
;
...
@@ -307,7 +307,7 @@ int git_hashsig_create_fromfile(
...
@@ -307,7 +307,7 @@ int git_hashsig_create_fromfile(
while
(
!
error
)
{
while
(
!
error
)
{
if
((
buflen
=
p_read
(
fd
,
buf
,
sizeof
(
buf
)))
<=
0
)
{
if
((
buflen
=
p_read
(
fd
,
buf
,
sizeof
(
buf
)))
<=
0
)
{
if
((
error
=
buflen
)
<
0
)
if
((
error
=
(
int
)
buflen
)
<
0
)
giterr_set
(
GITERR_OS
,
giterr_set
(
GITERR_OS
,
"Read error on '%s' calculating similarity hashes"
,
path
);
"Read error on '%s' calculating similarity hashes"
,
path
);
break
;
break
;
...
...
src/win32/msvc-compat.h
View file @
cc427158
...
@@ -37,6 +37,15 @@
...
@@ -37,6 +37,15 @@
/* MSVC doesn't define ssize_t at all */
/* MSVC doesn't define ssize_t at all */
typedef
SSIZE_T
ssize_t
;
typedef
SSIZE_T
ssize_t
;
/* define snprintf using variadic macro support if available */
#if _MSC_VER >= 1400
# define snprintf(BUF, SZ, FMT, ...) _snprintf_s(BUF, SZ, _TRUNCATE, FMT, __VA_ARGS__)
#else
# define snprintf _snprintf
#endif
#endif
#endif
#define GIT_STDLIB_CALL __cdecl
#endif
/* INCLUDE_msvc_compat__ */
#endif
/* INCLUDE_msvc_compat__ */
src/win32/posix_w32.c
View file @
cc427158
...
@@ -375,7 +375,8 @@ int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
...
@@ -375,7 +375,8 @@ int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
#ifdef _MSC_VER
#ifdef _MSC_VER
int
len
;
int
len
;
if
(
count
==
0
||
(
len
=
_vsnprintf
(
buffer
,
count
,
format
,
argptr
))
<
0
)
if
(
count
==
0
||
(
len
=
_vsnprintf_s
(
buffer
,
count
,
_TRUNCATE
,
format
,
argptr
))
<
0
)
return
_vscprintf
(
format
,
argptr
);
return
_vscprintf
(
format
,
argptr
);
return
len
;
return
len
;
...
...
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