diff --git a/common/bitops.h b/common/bitops.h index bdd862a..d1cae0c 100644 --- a/common/bitops.h +++ b/common/bitops.h @@ -23,9 +23,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) static inline int spice_bit_find_msb(unsigned int val) @@ -84,8 +82,6 @@ static INLINE int spice_bit_next_pow2(unsigned int val) return 1 << spice_bit_find_msb(val); } -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/canvas_base.h b/common/canvas_base.h index 861171e..2039ccd 100644 --- a/common/canvas_base.h +++ b/common/canvas_base.h @@ -23,6 +23,8 @@ #error "This header shouldn't be included directly" #endif +#include + #include "pixman_utils.h" #include "lz.h" #include "region.h" @@ -31,9 +33,7 @@ #include #endif -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef void (*spice_destroy_fn_t)(void *data); @@ -320,8 +320,6 @@ struct _SpiceCanvas { SpiceCanvasOps *ops; }; -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/canvas_utils.h b/common/canvas_utils.h index da38e08..ef3f9c5 100644 --- a/common/canvas_utils.h +++ b/common/canvas_utils.h @@ -24,13 +24,12 @@ #endif #include +#include #include "pixman_utils.h" #include "lz.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef struct PixmanData { #ifdef WIN32 @@ -73,8 +72,7 @@ typedef struct LzDecodeUsrData { pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data, pixman_format_code_t pixman_format, int width, int height, int gross_pixels, int top_down); -#ifdef __cplusplus -} -#endif + +SPICE_END_DECLS #endif diff --git a/common/draw.h b/common/draw.h index 8b1206d..cdd57e9 100644 --- a/common/draw.h +++ b/common/draw.h @@ -31,13 +31,12 @@ #ifndef _H_SPICE_DRAW #define _H_SPICE_DRAW +#include #include #include #include "mem.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS #define SPICE_GET_ADDRESS(addr) ((void *)(uintptr_t)(addr)) #define SPICE_SET_ADDRESS(addr, val) ((addr) = (uintptr_t)(val)) @@ -274,8 +273,6 @@ typedef struct SpiceCursorHeader { uint16_t hot_spot_y; } SpiceCursorHeader; -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif /* _H_SPICE_DRAW */ diff --git a/common/gdi_canvas.h b/common/gdi_canvas.h index f92c042..ccccdee 100644 --- a/common/gdi_canvas.h +++ b/common/gdi_canvas.h @@ -24,15 +24,14 @@ #endif #include - -#ifdef __cplusplus -extern "C" { -#endif +#include #include "pixman_utils.h" #include "canvas_base.h" #include "region.h" +SPICE_BEGIN_DECLS + SpiceCanvas *gdi_canvas_create(int width, int height, HDC dc, class RecurciveMutex *lock, uint32_t format, SpiceImageCache *bits_cache, @@ -44,8 +43,6 @@ SpiceCanvas *gdi_canvas_create(int width, int height, void gdi_canvas_init(void); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/gl_canvas.h b/common/gl_canvas.h index 400bedb..b565a9b 100644 --- a/common/gl_canvas.h +++ b/common/gl_canvas.h @@ -16,6 +16,8 @@ License along with this library; if not, see . */ +#include + #include "glc.h" #include "canvas_base.h" #include "region.h" @@ -27,9 +29,7 @@ #ifndef _H__GL_CANVAS #define _H__GL_CANVAS -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format #ifdef SW_CANVAS_CACHE @@ -46,8 +46,6 @@ SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format void gl_canvas_set_textures_lost(SpiceCanvas *canvas, int textures_lost); void gl_canvas_init(void); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/gl_utils.h b/common/gl_utils.h index c576255..5e50400 100644 --- a/common/gl_utils.h +++ b/common/gl_utils.h @@ -20,11 +20,11 @@ #ifndef GL_UTILS_H #define GL_UTILS_H + +#include #include "spice_common.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS #ifdef RED_DEBUG #define GLC_ERROR_TEST_FLUSH { \ @@ -55,8 +55,6 @@ extern "C" { #define find_msb spice_bit_find_msb #define gl_get_to_power_two spice_bit_next_pow2 -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/glc.h b/common/glc.h index d77f003..34b9420 100644 --- a/common/glc.h +++ b/common/glc.h @@ -22,10 +22,9 @@ #define _H_GL_CANVASE #include +#include -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef void * GLCCtx; typedef void * GLCPattern; @@ -160,8 +159,6 @@ void glc_clear(GLCCtx glc); GLCCtx glc_create(int width, int height); void glc_destroy(GLCCtx glc, int textures_lost); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/lines.h b/common/lines.h index 73eef9b..30a2b8c 100644 --- a/common/lines.h +++ b/common/lines.h @@ -52,11 +52,11 @@ SOFTWARE. #include #include #include +#include + #include "draw.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef struct lineGC lineGC; @@ -131,8 +131,6 @@ extern int spice_canvas_clip_spans(pixman_region32_t *clip_region, int *new_widths, int sorted); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif /* LINES_H */ diff --git a/common/lz.h b/common/lz.h index 248ab2a..2393749 100644 --- a/common/lz.h +++ b/common/lz.h @@ -6,14 +6,14 @@ #ifndef __LZ_H #define __LZ_H +#include + #include "lz_common.h" #include "lz_config.h" #include "draw.h" #include "macros.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef void *LzContext; @@ -76,8 +76,6 @@ LzContext *lz_create(LzUsrContext *usr); void lz_destroy(LzContext *lz); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif // __LZ_H diff --git a/common/lz_common.h b/common/lz_common.h index 4156cff..2ec374b 100644 --- a/common/lz_common.h +++ b/common/lz_common.h @@ -23,9 +23,9 @@ #ifndef _LZ_COMMON_H #define _LZ_COMMON_H -#ifdef __cplusplus -extern "C" { -#endif +#include + +SPICE_BEGIN_DECLS //#define DEBUG @@ -62,8 +62,6 @@ static const int RGB_BYTES_PER_PIXEL[] = {0, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4}; #define LZ_VERSION_MINOR 1U #define LZ_VERSION ((LZ_VERSION_MAJOR << 16) | (LZ_VERSION_MINOR & 0xffff)) -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif // _LZ_COMMON_H diff --git a/common/marshaller.h b/common/marshaller.h index 88fbfc4..e19c0f6 100644 --- a/common/marshaller.h +++ b/common/marshaller.h @@ -19,15 +19,14 @@ #ifndef _H_MARSHALLER #define _H_MARSHALLER +#include #include #include "mem.h" #ifndef WIN32 #include #endif -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef struct SpiceMarshaller SpiceMarshaller; typedef void (*spice_marshaller_item_free_func)(uint8_t *data, void *opaque); @@ -67,8 +66,6 @@ void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v); void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/mem.h b/common/mem.h index af89ba6..857e8b0 100644 --- a/common/mem.h +++ b/common/mem.h @@ -26,9 +26,7 @@ # include #endif -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS #ifdef STDC_HEADERS # include @@ -156,7 +154,6 @@ void spice_buffer_append(SpiceBuffer *buffer, const void *data, size_t len); size_t spice_buffer_copy(SpiceBuffer *buffer, void *dest, size_t len); size_t spice_buffer_remove(SpiceBuffer *buffer, size_t len); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS + #endif diff --git a/common/messages.h b/common/messages.h index ec58da5..929768b 100644 --- a/common/messages.h +++ b/common/messages.h @@ -32,11 +32,15 @@ #define _H_MESSAGES #include +#include + +#ifdef USE_SMARTCARD +#include +#endif + #include "draw.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef struct SpiceMsgData { uint32_t data_size; @@ -518,8 +522,6 @@ typedef struct SpiceMsgcTunnelSocketTokens { uint32_t num_tokens; } SpiceMsgcTunnelSocketTokens; -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif /* _H_SPICE_PROTOCOL */ diff --git a/common/mutex.h b/common/mutex.h index 6789b8f..3e2e0de 100644 --- a/common/mutex.h +++ b/common/mutex.h @@ -19,9 +19,9 @@ #ifndef _H_MUTEX #define _H_MUTEX -#ifdef __cplusplus -extern "C" { -#endif +#include + +SPICE_BEGIN_DECLS #ifdef _WIN32 #include @@ -37,8 +37,6 @@ typedef pthread_mutex_t mutex_t; #define MUTEX_UNLOCK(mutex) pthread_mutex_unlock(&mutex) #endif -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif // _H_MUTEX diff --git a/common/ogl_ctx.h b/common/ogl_ctx.h index e7f677a..5a5935e 100644 --- a/common/ogl_ctx.h +++ b/common/ogl_ctx.h @@ -19,9 +19,9 @@ #ifndef _H_GLCTX #define _H_GLCTX -#ifdef __cplusplus -extern "C" { -#endif +#include + +SPICE_BEGIN_DECLS typedef struct OGLCtx OGLCtx; @@ -31,8 +31,6 @@ OGLCtx *pbuf_create(int width, int heigth); OGLCtx *pixmap_create(int width, int heigth); void oglctx_destroy(OGLCtx *ctx); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/pixman_utils.h b/common/pixman_utils.h index 61eaddd..dd565ef 100644 --- a/common/pixman_utils.h +++ b/common/pixman_utils.h @@ -20,15 +20,14 @@ #define _H__PIXMAN_UTILS #include +#include #include #define PIXMAN_DONT_DEFINE_STDINT #include #include "draw.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS /* This lists all possible 2 argument binary raster ops. * This enum has the same values as the X11 GXcopy type @@ -129,8 +128,6 @@ void spice_pixman_copy_rect(pixman_image_t *image, int w, int h, int dest_x, int dest_y); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif /* _H__PIXMAN_UTILS */ diff --git a/common/quic.h b/common/quic.h index 58e68f7..b533f39 100644 --- a/common/quic.h +++ b/common/quic.h @@ -19,12 +19,11 @@ #ifndef __QUIC_H #define __QUIC_H +#include #include "quic_config.h" #include "macros.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef enum { QUIC_IMAGE_TYPE_INVALID, @@ -66,8 +65,6 @@ void quic_destroy(QuicContext *quic); void quic_init(void); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/quic_config.h b/common/quic_config.h index 13c71f1..fe89014 100644 --- a/common/quic_config.h +++ b/common/quic_config.h @@ -22,9 +22,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS #ifdef __GNUC__ #include @@ -41,8 +39,6 @@ extern "C" { #endif // QXLDD #endif //__GNUC__ -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/rect.h b/common/rect.h index ef265cd..a63d785 100644 --- a/common/rect.h +++ b/common/rect.h @@ -19,12 +19,10 @@ #ifndef _H_RECT #define _H_RECT -#include "draw.h" #include +#include "draw.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS static INLINE void rect_sect(SpiceRect* r, const SpiceRect* bounds) { @@ -76,9 +74,7 @@ static INLINE int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2) r1->bottom - r1->top == r2->bottom - r2->top; } -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #ifdef __cplusplus @@ -117,6 +113,6 @@ static inline int rect_is_same_size(const SpiceRect& r1, const SpiceRect& r2) return rect_is_same_size(&r1, &r2); } -#endif +#endif /* __cplusplus */ #endif diff --git a/common/region.h b/common/region.h index 954e06f..3eed547 100644 --- a/common/region.h +++ b/common/region.h @@ -20,12 +20,12 @@ #define _H_REGION #include -#include "draw.h" -#include +#include -#ifdef __cplusplus -extern "C" { -#endif +#include "draw.h" +#include "pixman_utils.h" + +SPICE_BEGIN_DECLS typedef pixman_region32_t QRegion; @@ -63,8 +63,6 @@ void region_offset(QRegion *rgn, int32_t dx, int32_t dy); void region_dump(const QRegion *rgn, const char *prefix); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/ring.h b/common/ring.h index 36ad820..7fba50e 100644 --- a/common/ring.h +++ b/common/ring.h @@ -19,11 +19,10 @@ #ifndef _H_RING2 #define _H_RING2 +#include #include "spice_common.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS typedef struct Ring RingItem; typedef struct Ring { @@ -165,8 +164,6 @@ static inline unsigned int ring_get_length(Ring *ring) return ret; } -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/rop3.h b/common/rop3.h index 91c9207..7e00499 100644 --- a/common/rop3.h +++ b/common/rop3.h @@ -20,13 +20,12 @@ #define _H_ROP3 #include +#include #include "draw.h" #include "pixman_utils.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, pixman_image_t *p, SpicePoint *pat_pos); @@ -35,8 +34,6 @@ void do_rop3_with_color(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, Spic void rop3_init(void); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif diff --git a/common/ssl_verify.h b/common/ssl_verify.h index 8a349b6..37c123e 100644 --- a/common/ssl_verify.h +++ b/common/ssl_verify.h @@ -35,9 +35,9 @@ #endif #include -#ifdef __cplusplus -extern "C" { -#endif +#include + +SPICE_BEGIN_DECLS typedef enum { SPICE_SSL_VERIFY_OP_NONE = 0, @@ -63,7 +63,6 @@ SpiceOpenSSLVerify* spice_openssl_verify_new(SSL *ssl, SPICE_SSL_VERIFY_OP verif const char *subject); void spice_openssl_verify_free(SpiceOpenSSLVerify* verify); -#ifdef __cplusplus -} -#endif // __cplusplus +SPICE_END_DECLS + #endif // SSL_VERIFY_H diff --git a/common/sw_canvas.h b/common/sw_canvas.h index 8667fcc..fe0b99d 100644 --- a/common/sw_canvas.h +++ b/common/sw_canvas.h @@ -24,15 +24,14 @@ #endif #include +#include #include "draw.h" #include "pixman_utils.h" #include "canvas_base.h" #include "region.h" -#ifdef __cplusplus -extern "C" { -#endif +SPICE_BEGIN_DECLS SpiceCanvas *canvas_create(int width, int height, uint32_t format #ifdef SW_CANVAS_CACHE @@ -63,8 +62,6 @@ SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, uint void sw_canvas_init(void); -#ifdef __cplusplus -} -#endif +SPICE_END_DECLS #endif