Make sure nanosvg functions are static so they aren't exported through the SDL_image static library
authorSam Lantinga <slouken@libsdl.org>
Fri, 04 Oct 2019 18:18:53 -0700
changeset 715390d5eed8b2d
parent 714 6bd67fc93794
child 717 f6d6ea662fe2
Make sure nanosvg functions are static so they aren't exported through the SDL_image static library
IMG_svg.c
nanosvg.h
nanosvgrast.h
     1.1 --- a/IMG_svg.c	Fri Oct 04 17:36:15 2019 -0700
     1.2 +++ b/IMG_svg.c	Fri Oct 04 18:18:53 2019 -0700
     1.3 @@ -67,6 +67,7 @@
     1.4  #endif
     1.5  #undef HAVE_STDIO_H
     1.6  
     1.7 +#define NSVG_EXPORT static
     1.8  #define NANOSVG_IMPLEMENTATION
     1.9  #include "nanosvg.h"
    1.10  #define NANOSVGRAST_IMPLEMENTATION
     2.1 --- a/nanosvg.h	Fri Oct 04 17:36:15 2019 -0700
     2.2 +++ b/nanosvg.h	Fri Oct 04 18:18:53 2019 -0700
     2.3 @@ -29,6 +29,10 @@
     2.4  #ifndef NANOSVG_H
     2.5  #define NANOSVG_H
     2.6  
     2.7 +#ifndef NSVG_EXPORT
     2.8 +#define NSVG_EXPORT
     2.9 +#endif
    2.10 +
    2.11  #ifdef __cplusplus
    2.12  extern "C" {
    2.13  #endif
    2.14 @@ -161,14 +165,14 @@
    2.15  } NSVGimage;
    2.16  
    2.17  // Parses SVG file from a file, returns SVG image as paths.
    2.18 -NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi);
    2.19 +NSVG_EXPORT NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi);
    2.20  
    2.21  // Parses SVG file from a null terminated string, returns SVG image as paths.
    2.22  // Important note: changes the string.
    2.23 -NSVGimage* nsvgParse(char* input, const char* units, float dpi);
    2.24 +NSVG_EXPORT NSVGimage* nsvgParse(char* input, const char* units, float dpi);
    2.25  
    2.26  // Deletes list of paths.
    2.27 -void nsvgDelete(NSVGimage* image);
    2.28 +NSVG_EXPORT void nsvgDelete(NSVGimage* image);
    2.29  
    2.30  #ifdef __cplusplus
    2.31  }
    2.32 @@ -1257,7 +1261,7 @@
    2.33  	unsigned int color;
    2.34  } NSVGNamedColor;
    2.35  
    2.36 -NSVGNamedColor nsvg__colors[] = {
    2.37 +static NSVGNamedColor nsvg__colors[] = {
    2.38  
    2.39  	{ "red", NSVG_RGB(255, 0, 0) },
    2.40  	{ "green", NSVG_RGB( 0, 128, 0) },
    2.41 @@ -2961,7 +2965,7 @@
    2.42  	}
    2.43  }
    2.44  
    2.45 -NSVGimage* nsvgParse(char* input, const char* units, float dpi)
    2.46 +NSVG_EXPORT NSVGimage* nsvgParse(char* input, const char* units, float dpi)
    2.47  {
    2.48  	NSVGparser* p;
    2.49  	NSVGimage* ret = 0;
    2.50 @@ -2986,7 +2990,7 @@
    2.51  }
    2.52  
    2.53  #ifdef HAVE_STDIO_H
    2.54 -NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
    2.55 +NSVG_EXPORT NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
    2.56  {
    2.57  	FILE* fp = NULL;
    2.58  	size_t size;
    2.59 @@ -3016,7 +3020,7 @@
    2.60  }
    2.61  #endif /* HAVE_STDIO_H */
    2.62  
    2.63 -void nsvgDelete(NSVGimage* image)
    2.64 +NSVG_EXPORT void nsvgDelete(NSVGimage* image)
    2.65  {
    2.66  	NSVGshape *snext, *shape;
    2.67  	if (image == NULL) return;
     3.1 --- a/nanosvgrast.h	Fri Oct 04 17:36:15 2019 -0700
     3.2 +++ b/nanosvgrast.h	Fri Oct 04 18:18:53 2019 -0700
     3.3 @@ -25,6 +25,10 @@
     3.4  #ifndef NANOSVGRAST_H
     3.5  #define NANOSVGRAST_H
     3.6  
     3.7 +#ifndef NSVG_EXPORT
     3.8 +#define NSVG_EXPORT
     3.9 +#endif
    3.10 +
    3.11  #ifdef __cplusplus
    3.12  extern "C" {
    3.13  #endif
    3.14 @@ -44,7 +48,7 @@
    3.15  */
    3.16  
    3.17  // Allocated rasterizer context.
    3.18 -NSVGrasterizer* nsvgCreateRasterizer(void);
    3.19 +NSVG_EXPORT NSVGrasterizer* nsvgCreateRasterizer(void);
    3.20  
    3.21  // Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
    3.22  //   r - pointer to rasterizer context
    3.23 @@ -55,12 +59,12 @@
    3.24  //   w - width of the image to render
    3.25  //   h - height of the image to render
    3.26  //   stride - number of bytes per scaleline in the destination buffer
    3.27 -void nsvgRasterize(NSVGrasterizer* r,
    3.28 -				   NSVGimage* image, float tx, float ty, float scale,
    3.29 -				   unsigned char* dst, int w, int h, int stride);
    3.30 +NSVG_EXPORT void nsvgRasterize(NSVGrasterizer* r,
    3.31 +				               NSVGimage* image, float tx, float ty, float scale,
    3.32 +				               unsigned char* dst, int w, int h, int stride);
    3.33  
    3.34  // Deletes rasterizer context.
    3.35 -void nsvgDeleteRasterizer(NSVGrasterizer*);
    3.36 +NSVG_EXPORT void nsvgDeleteRasterizer(NSVGrasterizer*);
    3.37  
    3.38  
    3.39  #ifdef __cplusplus
    3.40 @@ -70,6 +74,9 @@
    3.41  #endif // NANOSVGRAST_H
    3.42  
    3.43  #ifdef NANOSVGRAST_IMPLEMENTATION
    3.44 +#ifndef NSVG_EXPORT
    3.45 +#define NSVG_EXPORT
    3.46 +#endif
    3.47  
    3.48  /*
    3.49  #include <math.h>
    3.50 @@ -145,7 +152,7 @@
    3.51  	int width, height, stride;
    3.52  };
    3.53  
    3.54 -NSVGrasterizer* nsvgCreateRasterizer()
    3.55 +NSVG_EXPORT NSVGrasterizer* nsvgCreateRasterizer()
    3.56  {
    3.57  	NSVGrasterizer* r = (NSVGrasterizer*)malloc(sizeof(NSVGrasterizer));
    3.58  	if (r == NULL) goto error;
    3.59 @@ -161,7 +168,7 @@
    3.60  	return NULL;
    3.61  }
    3.62  
    3.63 -void nsvgDeleteRasterizer(NSVGrasterizer* r)
    3.64 +NSVG_EXPORT void nsvgDeleteRasterizer(NSVGrasterizer* r)
    3.65  {
    3.66  	NSVGmemPage* p;
    3.67  
    3.68 @@ -1360,7 +1367,7 @@
    3.69  }
    3.70  */
    3.71  
    3.72 -void nsvgRasterize(NSVGrasterizer* r,
    3.73 +NSVG_EXPORT void nsvgRasterize(NSVGrasterizer* r,
    3.74  				   NSVGimage* image, float tx, float ty, float scale,
    3.75  				   unsigned char* dst, int w, int h, int stride)
    3.76  {