Skip to content

Commit b1ae4c4

Browse files
committed
Compile fixes for C on MSVC
1 parent 79d9eca commit b1ae4c4

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

include/chipmunk/cpMarch.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2013 Howling Moon Software. All rights reserved.
22
// See http://chipmunk2d.net/legal.php for more information.
33

4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
48
/// Function type used as a callback from the marching squares algorithm to sample an image function.
59
/// It passes you the point to sample and your context pointer, and you return the density.
610
typedef cpFloat (*cpMarchSampleFunc)(cpVect point, void *data);
@@ -26,3 +30,7 @@ CP_EXPORT void cpMarchHard(
2630
cpMarchSegmentFunc segment, void *segment_data,
2731
cpMarchSampleFunc sample, void *sample_data
2832
);
33+
34+
#ifdef __cplusplus
35+
}
36+
#endif

include/chipmunk/cpPolyline.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright 2013 Howling Moon Software. All rights reserved.
22
// See http://chipmunk2d.net/legal.php for more information.
33

4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
48
// Polylines are just arrays of vertexes.
59
// They are looped if the first vertex is equal to the last.
610
// cpPolyline structs are intended to be passed by value and destroyed when you are done with them.
@@ -68,3 +72,7 @@ CP_EXPORT void cpPolylineSetCollectSegment(cpVect v0, cpVect v1, cpPolylineSet *
6872
CP_EXPORT cpPolylineSet *cpPolylineConvexDecomposition(cpPolyline *line, cpFloat tol);
6973

7074
#define cpPolylineConvexDecomposition_BETA cpPolylineConvexDecomposition
75+
76+
#ifdef __cplusplus
77+
}
78+
#endif

src/cpBody.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ cpBodyFree(cpBody *body)
103103
#ifdef NDEBUG
104104
#define cpAssertSaneBody(body)
105105
#else
106-
static void cpv_assert_nan(cpVect v, char *message){cpAssertHard(v.x == v.x && v.y == v.y, message);}
107-
static void cpv_assert_infinite(cpVect v, char *message){cpAssertHard(cpfabs(v.x) != INFINITY && cpfabs(v.y) != INFINITY, message);}
108-
static void cpv_assert_sane(cpVect v, char *message){cpv_assert_nan(v, message); cpv_assert_infinite(v, message);}
106+
static void cpv_assert_nan(cpVect v, const char *message){cpAssertHard(v.x == v.x && v.y == v.y, message);}
107+
static void cpv_assert_infinite(cpVect v, const char *message){cpAssertHard(cpfabs(v.x) != INFINITY && cpfabs(v.y) != INFINITY, message);}
108+
static void cpv_assert_sane(cpVect v, const char *message){cpv_assert_nan(v, message); cpv_assert_infinite(v, message);}
109109

110110
static void
111111
cpBodySanityCheck(const cpBody *body)

0 commit comments

Comments
 (0)