]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
changes for C++
authoridgay <idgay>
Mon, 2 Jul 2007 20:52:51 +0000 (20:52 +0000)
committeridgay <idgay>
Mon, 2 Jul 2007 20:52:51 +0000 (20:52 +0000)
support/sdk/c/message.h
support/sdk/c/serialsource.h
support/sdk/c/sfsource.c
support/sdk/c/sfsource.h

index 0bceefef0aa50d511871e5f5dc4ac98627d47f6e..8655f7b390957c1a731967e4eea80fbaa834852f 100644 (file)
 #include <stdint.h>
 #include <stdlib.h>
 
+#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
index c144852264bbd5a02b1ac38930ef1c45d0fa9941..28ba5bdc6ccfde284a82729d3e835b1b790754be 100644 (file)
@@ -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
index 0ab01e3a7e81a603c6eae9015812f906def0cd4d..24df9603acc33581dea43bc61c3e60a2169a29c3 100644 (file)
@@ -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;
 }
index 98f7302e13d93f10fea19286b6e2fecdf1f705a8..b6c2b923976d39d585b8829f14ba4f8459af4119 100644 (file)
@@ -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