common: add extern "C" guards to headers

Since some spice C++ code is using code from common/, the C
functions need to be marked as such for the C++ compiler, otherwise
we'll get linkage issues.
This commit is contained in:
Christophe Fergeau 2011-04-19 22:58:36 +02:00 committed by Alon Levy
parent 3dab7bda53
commit 6bd492fa79
23 changed files with 188 additions and 2 deletions

View File

@ -25,6 +25,10 @@
#include "region.h"
#include "draw.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*spice_destroy_fn_t)(void *data);
typedef struct _SpiceImageCache SpiceImageCache;
@ -310,4 +314,8 @@ struct _SpiceCanvas {
SpiceCanvasOps *ops;
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -24,6 +24,10 @@
#include "pixman_utils.h"
#include "lz.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PixmanData {
#ifdef WIN32
HBITMAP bitmap;
@ -65,4 +69,8 @@ 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
#endif

View File

@ -35,6 +35,10 @@
#include <spice/enums.h>
#include "mem.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SPICE_GET_ADDRESS(addr) ((void *)(unsigned long)(addr))
#define SPICE_SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val))
@ -271,4 +275,8 @@ typedef struct SpiceCursorHeader {
uint16_t hot_spot_y;
} SpiceCursorHeader;
#ifdef __cplusplus
}
#endif
#endif /* _H_SPICE_DRAW */

View File

@ -21,6 +21,10 @@
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "pixman_utils.h"
#include "canvas_base.h"
#include "region.h"
@ -36,4 +40,8 @@ SpiceCanvas *gdi_canvas_create(int width, int height,
void gdi_canvas_init();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -20,6 +20,13 @@
#include "canvas_base.h"
#include "region.h"
#ifndef _H__GL_CANVAS
#define _H__GL_CANVAS
#ifdef __cplusplus
extern "C" {
#endif
SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format
#ifdef SW_CANVAS_CACHE
, SpiceImageCache *bits_cache
@ -35,3 +42,8 @@ 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();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -21,6 +21,10 @@
#ifndef GL_UTILS_H
#define GL_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef RED_DEBUG
#define GLC_ERROR_TEST_FLUSH { \
GLenum gl_err; glFlush(); \
@ -102,4 +106,8 @@ static inline int gl_get_to_power_two(unsigned int val)
return 1 << find_msb(val);
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -23,6 +23,10 @@
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void * GLCCtx;
typedef void * GLCPattern;
typedef void * GLCPath;
@ -156,4 +160,8 @@ void glc_clear(GLCCtx glc);
GLCCtx glc_create(int width, int height);
void glc_destroy(GLCCtx glc, int textures_lost);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -54,6 +54,10 @@ SOFTWARE.
#include <string.h>
#include "draw.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct lineGC lineGC;
typedef struct {
@ -127,4 +131,8 @@ extern int spice_canvas_clip_spans(pixman_region32_t *clip_region,
int *new_widths,
int sorted);
#ifdef __cplusplus
}
#endif
#endif /* LINES_H */

View File

@ -10,6 +10,10 @@
#include "lz_config.h"
#include "draw.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void *LzContext;
typedef struct LzUsrContext LzUsrContext;
@ -71,5 +75,8 @@ LzContext *lz_create(LzUsrContext *usr);
void lz_destroy(LzContext *lz);
#ifdef __cplusplus
}
#endif
#endif // __LZ_H

View File

@ -23,6 +23,10 @@
#ifndef _LZ_COMMON_H
#define _LZ_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
//#define DEBUG
/* change the max window size will require change in the encoding format*/
@ -58,5 +62,8 @@ 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
#endif // _LZ_COMMON_H

View File

@ -25,6 +25,10 @@
#include <sys/uio.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SpiceMarshaller SpiceMarshaller;
typedef void (*spice_marshaller_item_free_func)(uint8_t *data, void *opaque);
@ -63,4 +67,8 @@ 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
#endif

View File

@ -22,6 +22,10 @@
#include <stdlib.h>
#include <spice/macros.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SpiceChunk {
uint8_t *data;
uint32_t len;
@ -120,4 +124,8 @@ 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
#endif

View File

@ -34,6 +34,10 @@
#include <spice/protocol.h>
#include "draw.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SpiceMsgData {
uint32_t data_size;
uint8_t data[0];
@ -494,6 +498,8 @@ typedef struct SpiceMsgcTunnelSocketTokens {
uint32_t num_tokens;
} SpiceMsgcTunnelSocketTokens;
#ifdef __cplusplus
}
#endif
#endif /* _H_SPICE_PROTOCOL */

View File

@ -18,6 +18,11 @@
#ifndef _H_MUTEX
#define _H_MUTEX
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
#include <windows.h>
typedef CRITICAL_SECTION mutex_t;
@ -32,4 +37,8 @@ typedef pthread_mutex_t mutex_t;
#define MUTEX_UNLOCK(mutex) pthread_mutex_unlock(&mutex)
#endif
#ifdef __cplusplus
}
#endif
#endif // _H_MUTEX

View File

@ -19,6 +19,10 @@
#ifndef _H_GLCTX
#define _H_GLCTX
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OGLCtx OGLCtx;
const char *oglctx_type_str(OGLCtx *ctx);
@ -27,5 +31,9 @@ OGLCtx *pbuf_create(int width, int heigth);
OGLCtx *pixmap_create(int width, int heigth);
void oglctx_destroy(OGLCtx *ctx);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -26,6 +26,10 @@
#include "draw.h"
#ifdef __cplusplus
extern "C" {
#endif
/* This lists all possible 2 argument binary raster ops.
* This enum has the same values as the X11 GXcopy type
* and same as the GL constants (GL_AND etc) if you
@ -125,4 +129,8 @@ void spice_pixman_copy_rect(pixman_image_t *image,
int w, int h,
int dest_x, int dest_y);
#ifdef __cplusplus
}
#endif
#endif /* _H__PIXMAN_UTILS */

View File

@ -21,6 +21,10 @@
#include "quic_config.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
QUIC_IMAGE_TYPE_INVALID,
QUIC_IMAGE_TYPE_GRAY,
@ -61,5 +65,9 @@ void quic_destroy(QuicContext *quic);
void quic_init();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -21,6 +21,10 @@
#include <spice/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUC__
#include <string.h>
@ -47,5 +51,9 @@
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -22,6 +22,10 @@
#include "draw.h"
#include <spice/macros.h>
#ifdef __cplusplus
extern "C" {
#endif
static inline void rect_sect(SpiceRect* r, const SpiceRect* bounds)
{
r->left = MAX(r->left, bounds->left);
@ -72,6 +76,10 @@ static inline int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2)
r1->bottom - r1->top == r2->bottom - r2->top;
}
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
static inline void rect_sect(SpiceRect& r, const SpiceRect& bounds)

View File

@ -23,6 +23,10 @@
#include "draw.h"
#include <pixman_utils.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef pixman_region32_t QRegion;
#define REGION_TEST_LEFT_EXCLUSIVE (1 << 0)
@ -59,5 +63,9 @@ void region_offset(QRegion *rgn, int32_t dx, int32_t dy);
void region_dump(const QRegion *rgn, const char *prefix);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -19,6 +19,10 @@
#ifndef _H_RING2
#define _H_RING2
#ifdef __cplusplus
extern "C" {
#endif
typedef struct Ring RingItem;
typedef struct Ring {
RingItem *prev;
@ -129,5 +133,9 @@ static inline RingItem *ring_prev(Ring *ring, RingItem *pos)
return (ret == ring) ? NULL : ret;
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -24,11 +24,20 @@
#include "draw.h"
#include "pixman_utils.h"
#ifdef __cplusplus
extern "C" {
#endif
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);
void do_rop3_with_color(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos,
uint32_t rgb);
void rop3_init();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -26,6 +26,10 @@
#include "canvas_base.h"
#include "region.h"
#ifdef __cplusplus
extern "C" {
#endif
SpiceCanvas *canvas_create(int width, int height, uint32_t format
#ifdef SW_CANVAS_CACHE
, SpiceImageCache *bits_cache
@ -55,4 +59,8 @@ SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, uint
void sw_canvas_init();
#ifdef __cplusplus
}
#endif
#endif