libpurple/protocols/mxit/chunk.c

changeset 35680
965839bfe169
parent 34457
a9d3726c3a8f
child 35688
3d727b2e6f82
child 37131
fe9ff76f1c6c
--- a/libpurple/protocols/mxit/chunk.c	Thu Apr 03 04:23:35 2014 +0200
+++ b/libpurple/protocols/mxit/chunk.c	Thu Apr 03 04:33:49 2014 +0200
@@ -170,9 +170,13 @@
  */
 static int get_int16( const char* chunkdata, short* value )
 {
-	*value = ntohs( *( (const short*) chunkdata ) );	/* host byte-order */
+	gint16 value_v;
+
+	memcpy(&value_v, chunkdata, sizeof(value_v));
 
-	return sizeof( short );
+	*value = ntohs(value_v); /* host byte-order */
+
+	return sizeof(value_v);
 }
 
 /*------------------------------------------------------------------------
@@ -184,9 +188,13 @@
  */
 static int get_int32( const char* chunkdata, int* value )
 {
-	*value = ntohl( *( (const int*) chunkdata ) );	/* host byte-order */
+	gint32 value_v;
+
+	memcpy(&value_v, chunkdata, sizeof(value_v));
 
-	return sizeof( int );
+	*value = ntohl(value_v); /* host byte-order */
+
+	return sizeof(value_v);
 }
 
 #if	0

mercurial