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
8a086f87
Commit
8a086f87
authored
Jun 14, 2009
by
Ramsay Jones
Committed by
Andreas Ericsson
Jun 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: Add support for the MS Visual C/C++ compiler
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
parent
2bf93fa1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
5 deletions
+56
-5
src/cc-compat.h
+24
-0
src/common.h
+27
-4
src/git/common.h
+4
-0
src/odb.c
+1
-1
No files found.
src/cc-compat.h
View file @
8a086f87
...
...
@@ -30,4 +30,28 @@
# define GIT_TYPEOF(x)
#endif
/*
* Does our compiler/platform support the C99 <inttypes.h> and
* <stdint.h> header files. (C99 requires that <inttypes.h>
* includes <stdint.h>).
*/
#if !defined(_MSC_VER)
# define GIT_HAVE_INTTYPES_H 1
#endif
/* Define the printf format specifer to use for size_t output */
#if !defined(_MSC_VER)
# define PRIuZ "zu"
#else
# define PRIuZ "Iu"
#endif
/* Micosoft Visual C/C++ */
#if defined(_MSC_VER)
/* no direct support for C99 inline function specifier */
# define inline __inline
/* disable "deprecated function" warnings */
# pragma warning ( disable : 4996 )
#endif
#endif
/* INCLUDE_compat_h__ */
src/common.h
View file @
8a086f87
...
...
@@ -6,11 +6,14 @@
#endif
#include "git/thread-utils.h"
#include "cc-compat.h"
#ifdef GIT_HAS_PTHREAD
# include <pthread.h>
#endif
#include <inttypes.h>
#ifdef GIT_HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#include <assert.h>
#include <errno.h>
#include <limits.h>
...
...
@@ -26,9 +29,21 @@
# include <direct.h>
# include <windows.h>
#define snprintf _snprintf
#
define snprintf _snprintf
typedef
int
ssize_t
;
# if (defined(_MSC_VER) && defined(_WIN64)) || \
(defined(__DMC__) && defined(_M_AMD64))
typedef
long
long
ssize_t
;
# else
typedef
int
ssize_t
;
# endif
# if defined(_MSC_VER)
/* access() mode parameter #defines */
# define F_OK 0
/* existence check */
# define W_OK 2
/* write mode check */
# define R_OK 4
/* read mode check */
# endif
#else
...
...
@@ -37,7 +52,6 @@ typedef int ssize_t;
#endif
#include "cc-compat.h"
#include "git/common.h"
#include "util.h"
#include "thread-utils.h"
...
...
@@ -45,4 +59,13 @@ typedef int ssize_t;
#define GIT_PATH_MAX 4096
#ifndef GIT_HAVE_INTTYPES_H
/* add some missing <stdint.h> typedef's */
typedef
long
int32_t
;
typedef
unsigned
long
uint32_t
;
typedef
long
long
int64_t
;
typedef
unsigned
long
long
uint64_t
;
#endif
#endif
/* INCLUDE_common_h__ */
src/git/common.h
View file @
8a086f87
...
...
@@ -21,7 +21,11 @@
#endif
/** Declare a function as always inlined. */
#if defined(_MSC_VER)
# define GIT_INLINE(type) static __inline type
#else
# define GIT_INLINE(type) static inline type
#endif
/** Declare a function's takes printf style arguments. */
#ifdef __GNUC__
...
...
src/odb.c
View file @
8a086f87
...
...
@@ -153,7 +153,7 @@ int git_obj__loose_object_type(git_otype type)
static
int
format_object_header
(
char
*
hdr
,
size_t
n
,
git_obj
*
obj
)
{
const
char
*
type_str
=
git_obj_type_to_string
(
obj
->
type
);
int
len
=
snprintf
(
hdr
,
n
,
"%s %
zu"
,
type_str
,
obj
->
len
);
int
len
=
snprintf
(
hdr
,
n
,
"%s %
"
PRIuZ
,
type_str
,
obj
->
len
);
assert
(
len
>
0
);
/* otherwise snprintf() is broken */
assert
(
len
<
n
);
/* otherwise the caller is broken! */
...
...
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