[aravis] gv: make aravis compile as part of a c++ application



commit 63cfe58df34ac832dad44fa3cdf8a6ba82300e9a
Author: Tom Cobb <tom cobb diamond ac uk>
Date:   Thu Jan 6 15:32:40 2011 +0100

    gv: make aravis compile as part of a c++ application
    
    The issue is that doing arithmetic with void * pointers is not allowed.

 src/arvgvcp.h |   18 +++++++++---------
 src/arvgvsp.h |    4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/arvgvcp.h b/src/arvgvcp.h
index a51b558..0856d89 100644
--- a/src/arvgvcp.h
+++ b/src/arvgvcp.h
@@ -141,9 +141,9 @@ arv_gvcp_packet_get_read_memory_cmd_infos (const ArvGvcpPacket *packet, guint32
 	if (packet == NULL)
 		return;
 	if (address != NULL)
-		*address = g_ntohl (*((guint32 *) ((void *) packet + sizeof (ArvGvcpPacket))));
+		*address = g_ntohl (*((guint32 *) ((char *) packet + sizeof (ArvGvcpPacket))));
 	if (size != NULL)
-		*size = (g_ntohl (*((guint32 *) ((void *) packet + sizeof (ArvGvcpPacket) + sizeof (guint32))))) &
+		*size = (g_ntohl (*((guint32 *) ((char *) packet + sizeof (ArvGvcpPacket) + sizeof (guint32))))) &
 			0xffff;
 }
 
@@ -156,7 +156,7 @@ arv_gvcp_packet_get_read_memory_ack_size (guint32 data_size)
 static inline void *
 arv_gvcp_packet_get_read_memory_ack_data (const ArvGvcpPacket *packet)
 {
-	return (void *) packet + sizeof (ArvGvcpHeader) + sizeof (guint32);
+	return (char *) packet + sizeof (ArvGvcpHeader) + sizeof (guint32);
 }
 
 static inline void
@@ -166,7 +166,7 @@ arv_gvcp_packet_get_write_memory_cmd_infos (const ArvGvcpPacket *packet, guint32
 		return;
 
 	if (address != NULL)
-		*address = g_ntohl (*((guint32 *) ((void *) packet + sizeof (ArvGvcpPacket))));
+		*address = g_ntohl (*((guint32 *) ((char *) packet + sizeof (ArvGvcpPacket))));
 	if (size != NULL)
 		*size = g_ntohs (packet->header.size) - sizeof (guint32);
 }
@@ -174,7 +174,7 @@ arv_gvcp_packet_get_write_memory_cmd_infos (const ArvGvcpPacket *packet, guint32
 static inline void *
 arv_gvcp_packet_get_write_memory_cmd_data (const ArvGvcpPacket *packet)
 {
-	return (void *) packet + sizeof (ArvGvcpPacket) + sizeof (guint32);
+	return (char *) packet + sizeof (ArvGvcpPacket) + sizeof (guint32);
 }
 
 static inline size_t
@@ -189,7 +189,7 @@ arv_gvcp_packet_get_read_register_cmd_infos (const ArvGvcpPacket *packet, guint3
 	if (packet == NULL)
 		return;
 	if (address != NULL)
-		*address = g_ntohl (*((guint32 *) ((void *) packet + sizeof (ArvGvcpPacket))));
+		*address = g_ntohl (*((guint32 *) ((char *) packet + sizeof (ArvGvcpPacket))));
 }
 
 static inline guint32
@@ -197,7 +197,7 @@ arv_gvcp_packet_get_read_register_ack_value (const ArvGvcpPacket *packet)
 {
 	if (packet == NULL)
 		return 0;
-	return g_ntohl (*((guint32 *) ((void *) packet + sizeof (ArvGvcpPacket))));
+	return g_ntohl (*((guint32 *) ((char *) packet + sizeof (ArvGvcpPacket))));
 }
 
 static inline void
@@ -206,9 +206,9 @@ arv_gvcp_packet_get_write_register_cmd_infos (const ArvGvcpPacket *packet, guint
 	if (packet == NULL)
 		return;
 	if (address != NULL)
-		*address = g_ntohl (*((guint32 *) ((void *) packet + sizeof (ArvGvcpPacket))));
+		*address = g_ntohl (*((guint32 *) ((char *) packet + sizeof (ArvGvcpPacket))));
 	if (value != NULL)
-		*value = g_ntohl (*((guint32 *) ((void *) packet + sizeof (ArvGvcpPacket) + sizeof (guint32))));
+		*value = g_ntohl (*((guint32 *) ((char *) packet + sizeof (ArvGvcpPacket) + sizeof (guint32))));
 }
 
 G_END_DECLS
diff --git a/src/arvgvsp.h b/src/arvgvsp.h
index ca9c501..b045fee 100644
--- a/src/arvgvsp.h
+++ b/src/arvgvsp.h
@@ -75,7 +75,7 @@ void 			arv_gvsp_packet_debug 			(const ArvGvspPacket *packet, size_t packet_siz
 static inline ArvGvspPacketType
 arv_gvsp_packet_get_packet_type	(const ArvGvspPacket *packet)
 {
-	return g_ntohs (packet->header.packet_type);
+	return (ArvGvspPacketType) g_ntohs (packet->header.packet_type);
 }
 
 static inline guint16
@@ -132,7 +132,7 @@ arv_gvsp_packet_get_pixel_format (const ArvGvspPacket *packet)
 	ArvGvspDataLeader *leader;
 
 	leader = (ArvGvspDataLeader *) &packet->data;
-	return g_ntohl (leader->pixel_format);
+	return (ArvPixelFormat) g_ntohl (leader->pixel_format);
 }
 
 static inline guint64



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]