Skip to content

Commit 81555b9

Browse files
committed
Need to use RETRO_BEGIN_DECLS/RETRO_END_DECL for MSVC C++
backwards compatibility
1 parent 0e14bba commit 81555b9

3 files changed

Lines changed: 52 additions & 55 deletions

File tree

deps/dr/dr_flac.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ GitHub: https://github.com/mackron/dr_libs
1010
#ifndef DR_FLAC_H
1111
#define DR_FLAC_H
1212

13-
#ifdef __cplusplus
14-
extern "C" {
15-
#endif
16-
1713
#include <stdint.h>
1814
#include <stddef.h> /* For size_t. */
15+
#include <retro_common_api.h>
16+
#include <retro_inline.h>
17+
18+
RETRO_BEGIN_DECLS
1919

2020
#define DRFLAC_STRINGIFY(x) #x
2121
#define DRFLAC_XSTRINGIFY(x) DRFLAC_STRINGIFY(x)
@@ -814,8 +814,6 @@ Set pAllocationCallbacks to the same object that was passed to drflac_open_*_and
814814
*/
815815
void drflac_free(void* p, const drflac_allocation_callbacks* pAllocationCallbacks);
816816

817-
#ifdef __cplusplus
818-
}
819-
#endif
817+
RETRO_END_DECLS
820818

821819
#endif /* DR_FLAC_H */

deps/stb/stb_rect_pack.h

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
* [your name could be here]
3232
*/
3333

34+
#include <stdint.h>
35+
#include <retro_common_api.h>
36+
#include <retro_inline.h>
37+
38+
RETRO_BEGIN_DECLS
39+
3440
#ifndef STB_INCLUDE_STB_RECT_PACK_H
3541
#define STB_INCLUDE_STB_RECT_PACK_H
3642

37-
#include <stdint.h>
38-
3943
#define STB_RECT_PACK_VERSION 1
4044

4145
#ifdef __cplusplus
@@ -46,43 +50,6 @@ typedef struct stbrp_context stbrp_context;
4650
typedef struct stbrp_node stbrp_node;
4751
typedef struct stbrp_rect stbrp_rect;
4852

49-
void stbrp_pack_rects (stbrp_context *context,
50-
stbrp_rect *rects, int num_rects);
51-
52-
/* Assign packed locations to rectangles. The rectangles are of type
53-
* 'stbrp_rect' defined below, stored in the array 'rects', and there
54-
* are 'num_rects' many of them.
55-
*
56-
* Rectangles which are successfully packed have the 'was_packed' flag
57-
* set to a non-zero value and 'x' and 'y' store the minimum location
58-
* on each axis (i.e. bottom-left in cartesian coordinates, top-left
59-
* if you imagine y increasing downwards). Rectangles which do not fit
60-
* have the 'was_packed' flag set to 0.
61-
*
62-
* You should not try to access the 'rects' array from another thread
63-
* while this function is running, as the function temporarily reorders
64-
* the array while it executes.
65-
*
66-
* To pack into another rectangle, you need to call stbrp_init_target
67-
* again. To continue packing into the same rectangle, you can call
68-
* this function again. Calling this multiple times with multiple rect
69-
* arrays will probably produce worse packing results than calling it
70-
* a single time with the full rectangle array, but the option is
71-
* available.
72-
*/
73-
74-
struct stbrp_rect
75-
{
76-
int id; /* reserved for your use: */
77-
uint16_t w, h; /* input: */
78-
uint16_t x, y; /* output: */
79-
int was_packed; /* non-zero if valid packing */
80-
}; /* 16 bytes, nominally */
81-
82-
83-
void stbrp_init_target (stbrp_context *context,
84-
int width, int height, stbrp_node *nodes, int num_nodes);
85-
8653
/* Initialize a rectangle packer to:
8754
* pack a rectangle that is 'width' by 'height' in dimensions
8855
* using temporary storage provided by the array 'nodes', which is 'num_nodes' long
@@ -134,8 +101,42 @@ struct stbrp_context
134101
stbrp_node extra[2]; /* we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' */
135102
};
136103

137-
#ifdef __cplusplus
138-
}
139-
#endif
104+
/* Assign packed locations to rectangles. The rectangles are of type
105+
* 'stbrp_rect' defined below, stored in the array 'rects', and there
106+
* are 'num_rects' many of them.
107+
*
108+
* Rectangles which are successfully packed have the 'was_packed' flag
109+
* set to a non-zero value and 'x' and 'y' store the minimum location
110+
* on each axis (i.e. bottom-left in cartesian coordinates, top-left
111+
* if you imagine y increasing downwards). Rectangles which do not fit
112+
* have the 'was_packed' flag set to 0.
113+
*
114+
* You should not try to access the 'rects' array from another thread
115+
* while this function is running, as the function temporarily reorders
116+
* the array while it executes.
117+
*
118+
* To pack into another rectangle, you need to call stbrp_init_target
119+
* again. To continue packing into the same rectangle, you can call
120+
* this function again. Calling this multiple times with multiple rect
121+
* arrays will probably produce worse packing results than calling it
122+
* a single time with the full rectangle array, but the option is
123+
* available.
124+
*/
125+
126+
struct stbrp_rect
127+
{
128+
int id; /* reserved for your use: */
129+
uint16_t w, h; /* input: */
130+
uint16_t x, y; /* output: */
131+
int was_packed; /* non-zero if valid packing */
132+
}; /* 16 bytes, nominally */
133+
134+
void stbrp_pack_rects (stbrp_context *context,
135+
stbrp_rect *rects, int num_rects);
136+
137+
void stbrp_init_target (stbrp_context *context,
138+
int width, int height, stbrp_node *nodes, int num_nodes);
139+
140+
RETRO_END_DECLS
140141

141142
#endif

deps/stb/stb_truetype.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@
5555
#include <math.h>
5656
#include <stdlib.h>
5757
#include <string.h>
58+
#include <retro_common_api.h>
59+
#include <retro_inline.h>
5860

5961
/* INTERFACE */
6062

6163
#ifndef __STB_INCLUDE_STB_TRUETYPE_H__
6264
#define __STB_INCLUDE_STB_TRUETYPE_H__
6365

64-
#ifdef __cplusplus
65-
extern "C" {
66-
#endif
66+
RETRO_BEGIN_DECLS
6767

6868
/* NEW TEXTURE BAKING API */
6969

@@ -339,8 +339,6 @@ enum
339339
STBTT_MS_EID_UNICODE_FULL =10
340340
};
341341

342-
#ifdef __cplusplus
343-
}
344-
#endif
342+
RETRO_END_DECLS
345343

346344
#endif /* __STB_INCLUDE_STB_TRUETYPE_H__ */

0 commit comments

Comments
 (0)