From e6e48eb7012ef7b3a8a225de415f59650b91edc5 Mon Sep 17 00:00:00 2001 From: idgay Date: Mon, 2 Jul 2007 20:52:51 +0000 Subject: [PATCH] changes for C++ --- support/sdk/c/message.h | 8 ++++++++ support/sdk/c/serialsource.h | 8 ++++++++ support/sdk/c/sfsource.c | 4 ++-- support/sdk/c/sfsource.h | 8 ++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/support/sdk/c/message.h b/support/sdk/c/message.h index 0bceefef..8655f7b3 100644 --- a/support/sdk/c/message.h +++ b/support/sdk/c/message.h @@ -15,6 +15,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** The type of message buffers */ typedef struct tmsg tmsg_t; @@ -145,4 +149,8 @@ float tmsg_read_float_be(tmsg_t *msg, size_t offset); */ void tmsg_write_float_be(tmsg_t *msg, size_t offset, float x); +#ifdef __cplusplus +} +#endif + #endif diff --git a/support/sdk/c/serialsource.h b/support/sdk/c/serialsource.h index c1448522..28ba5bdc 100644 --- a/support/sdk/c/serialsource.h +++ b/support/sdk/c/serialsource.h @@ -1,6 +1,10 @@ #ifndef SERIALSOURCE_H #define SERIALSOURCE_H +#ifdef __cplusplus +extern "C" { +#endif + typedef struct serial_source *serial_source; typedef enum { @@ -70,4 +74,8 @@ int platform_baud_rate(char *platform_name); atoi(platform_name). */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/support/sdk/c/sfsource.c b/support/sdk/c/sfsource.c index 0ab01e3a..24df9603 100644 --- a/support/sdk/c/sfsource.c +++ b/support/sdk/c/sfsource.c @@ -26,7 +26,7 @@ int saferead(int fd, void *buffer, int count) count -= n; actual += n; - buffer += n; + buffer = (char*)buffer + n; } return actual; } @@ -46,7 +46,7 @@ int safewrite(int fd, const void *buffer, int count) count -= n; actual += n; - buffer += n; + buffer = (char*)buffer + n; } return actual; } diff --git a/support/sdk/c/sfsource.h b/support/sdk/c/sfsource.h index 98f7302e..b6c2b923 100644 --- a/support/sdk/c/sfsource.h +++ b/support/sdk/c/sfsource.h @@ -1,6 +1,10 @@ #ifndef SFSOURCE_H #define SFSOURCE_H +#ifdef __cplusplus +extern "C" { +#endif + int open_sf_source(const char *host, int port); /* Returns: file descriptor for TinyOS 2.0 serial forwarder at host:port, or -1 for failure @@ -25,4 +29,8 @@ int write_sf_packet(int fd, const void *packet, int len); Returns: 0 if packet successfully written, -1 otherwise */ +#ifdef __cplusplus +} +#endif + #endif -- 2.39.2