Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit c708c05

Browse files
committed
[[ VS2015 ]] Ensure skia builds under VS2015
This patch ensures that skia builds using VS2015. It replaces a bespoke header file defining standard integer types with an include for stdint.h and tweaks to thread related primitives.
1 parent e349127 commit c708c05

3 files changed

Lines changed: 5 additions & 56 deletions

File tree

libskia/include/config/sk_stdint.h

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1 @@
1-
#ifndef sk_stdint_DEFINED
2-
#define sk_stdint_DEFINED
3-
4-
#ifndef WIN32
51
#include <stdint.h>
6-
#else
7-
8-
typedef signed char int8_t;
9-
typedef unsigned char uint8_t;
10-
typedef short int16_t;
11-
typedef unsigned short uint16_t;
12-
typedef int int32_t;
13-
typedef unsigned uint32_t;
14-
// MDW-2014-04-05: [[ x64 ]] check 64-bitness before defining
15-
#ifdef __LP64__
16-
typedef long int64_t;
17-
typedef unsigned long uint64_t;
18-
#else
19-
typedef long long int64_t;
20-
typedef unsigned long long uint64_t;
21-
#endif
22-
23-
typedef int64_t intmax_t;
24-
typedef uint64_t uintmax_t;
25-
26-
#ifndef _UINTPTR_T
27-
#define _UINTPTR_T
28-
// MDW-2013-04-15: [[ x64 ]] make 64-bit safe
29-
#ifdef __LP64__
30-
typedef uint64_t uintptr_t;
31-
#else
32-
typedef uint32_t uintptr_t;
33-
#endif
34-
#endif
35-
36-
#ifndef _INTPTR_T
37-
#define _INTPTR_T
38-
// MDW-2013-04-15: [[ x64 ]] make 64-bit safe
39-
#ifdef __LP64__
40-
typedef int64_t intptr_t;
41-
#else
42-
typedef int32_t intptr_t;
43-
#endif
44-
#endif
45-
#endif
46-
47-
#endif

libskia/src/core/SkOnce.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
#ifdef SK_USE_POSIX_THREADS
3333
# define SK_ONCE_INIT { false, { PTHREAD_MUTEX_INITIALIZER } }
3434
#else
35-
# define SK_ONCE_INIT { false, SkBaseMutex() }
35+
# define SK_ONCE_INIT {}
3636
#endif
3737

38-
#define SK_DECLARE_STATIC_ONCE(name) static SkOnceFlag name = SK_ONCE_INIT
38+
#define SK_DECLARE_STATIC_ONCE(name) static SkOnceFlag name SK_ONCE_INIT
3939

4040
struct SkOnceFlag; // If manually created, initialize with SkOnceFlag once = SK_ONCE_INIT
4141

@@ -45,6 +45,7 @@ inline void SkOnce(SkOnceFlag* once, Func f, Arg arg);
4545
// ---------------------- Implementation details below here. -----------------------------
4646

4747
struct SkOnceFlag {
48+
SkOnceFlag() : done(false), mutex() {}
4849
bool done;
4950
SkBaseMutex mutex;
5051
};

libskia/src/core/SkString.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,8 @@
1717
// number of bytes (on the stack) to receive the printf result
1818
static const size_t kBufferSize = 1024;
1919

20-
#ifdef SK_BUILD_FOR_WIN
21-
#define VSNPRINTF(buffer, size, format, args) \
22-
_vsnprintf_s(buffer, size, _TRUNCATE, format, args)
23-
#define SNPRINTF _snprintf
24-
#else
25-
#define VSNPRINTF vsnprintf
26-
#define SNPRINTF snprintf
27-
#endif
20+
#define VSNPRINTF vsnprintf
21+
#define SNPRINTF snprintf
2822

2923
#define ARGS_TO_BUFFER(format, buffer, size) \
3024
do { \

0 commit comments

Comments
 (0)