changeset 2474:19b4cd08e458

[gaim-migrate @ 2487] thanks Nathan Walp and Ben Miller committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 10 Oct 2001 19:58:11 +0000
parents 3860817b32af
children ba7ee4c1908c
files ChangeLog src/protocols/icq/icqpacket.c src/protocols/icq/udp.c
diffstat 3 files changed, 26 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Oct 10 18:12:09 2001 +0000
+++ b/ChangeLog	Wed Oct 10 19:58:11 2001 +0000
@@ -2,6 +2,8 @@
 
 version 0.46:
 	* New applet icons (courtesy David Raeman)
+	* ICQ works on big-endian platforms, e.g. sparc and ppc
+	  (thanks to Nathan Walp and Ben Miller)
 
 version 0.45 (10/04/2001):
 	* New plugin event: event_chat_send_invite
--- a/src/protocols/icq/icqpacket.c	Wed Oct 10 18:12:09 2001 +0000
+++ b/src/protocols/icq/icqpacket.c	Wed Oct 10 19:58:11 2001 +0000
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
 /*
- * $Id: icqpacket.c 2096 2001-07-31 01:00:39Z warmenhoven $
+ * $Id: icqpacket.c 2487 2001-10-10 19:58:11Z warmenhoven $
  *
  * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
  *                          Bill Soudan <soudan@kde.org>
@@ -59,7 +59,8 @@
 {
   DWORD val=i;
 
-  *(unsigned long*)((p->data)+(p->cursor))=htoicql(val);
+  val = htoicql(val);
+  memcpy((p->data)+(p->cursor),&val,sizeof(DWORD));
   icq_PacketAdvance(p, sizeof(DWORD));
 }
 
@@ -67,7 +68,7 @@
 {
   DWORD val=i;
 
-  *(DWORD *)((p->data)+(p->cursor)) = val;
+  memcpy((p->data)+(p->cursor),&val,sizeof(DWORD));
   icq_PacketAdvance(p, sizeof(DWORD));
 }
 
@@ -75,7 +76,8 @@
 {
   DWORD val;
 
-  val = icqtohl(*(DWORD *)((p->data)+(p->cursor)));
+  memcpy(&val,(p->data)+(p->cursor),sizeof(DWORD));
+  val = icqtohl(val);
   icq_PacketAdvance(p, sizeof(DWORD));
 
   return val;
@@ -85,7 +87,7 @@
 {
   DWORD val;
 
-  val = *(DWORD*)((p->data)+(p->cursor));
+  memcpy(&val,(p->data)+(p->cursor),sizeof(DWORD));
   icq_PacketAdvance(p, sizeof(DWORD));
 
   return val;
@@ -95,7 +97,8 @@
 {
   WORD val=i;
 
-  *(WORD *)((p->data)+(p->cursor)) = htoicqs(val);
+  val = htoicqs(val);
+  memcpy((p->data)+(p->cursor),&val,sizeof(WORD));
   icq_PacketAdvance(p, sizeof(WORD));
 }
 
@@ -103,7 +106,7 @@
 {
   WORD val=i;
 
-  *(WORD *)((p->data)+(p->cursor)) = val;
+  memcpy((p->data)+(p->cursor),&val,sizeof(WORD));
   icq_PacketAdvance(p, sizeof(WORD));
 }
 
@@ -111,7 +114,8 @@
 {
   WORD val;
 
-  val = icqtohs(*(WORD *)((p->data)+(p->cursor)));
+  memcpy(&val,(p->data)+(p->cursor),sizeof(WORD));
+  val = icqtohs(val);
   icq_PacketAdvance(p, sizeof(WORD));
 
   return val;
@@ -121,7 +125,7 @@
 {
   WORD val;
 
-  val = *(WORD*)((p->data)+(p->cursor));
+  memcpy(&val,(p->data)+(p->cursor),sizeof(WORD));
   icq_PacketAdvance(p, sizeof(WORD));
 
   return val;
--- a/src/protocols/icq/udp.c	Wed Oct 10 18:12:09 2001 +0000
+++ b/src/protocols/icq/udp.c	Wed Oct 10 19:58:11 2001 +0000
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
 /*
- * $Id: udp.c 2096 2001-07-31 01:00:39Z warmenhoven $
+ * $Id: udp.c 2487 2001-10-10 19:58:11Z warmenhoven $
  *
  * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
  *                          Bill Soudan <soudan@kde.org>
@@ -108,23 +108,29 @@
   DWORD checkcode = icq_UDPCalculateCheckCode(p);
   DWORD code1, code2, code3;
   DWORD pos;
+  DWORD tmp;
 
   memcpy(buffer, p->data, p->length);
 
-  *(DWORD *)(buffer+0x14)=htoicql(checkcode);
+  tmp = htoicql(checkcode);
+  memcpy((buffer+0x14),&tmp,sizeof(DWORD));
   code1 = p->length * 0x68656c6cL;
   code2 = code1 + checkcode;
   pos = 0x0A;
 
   for(; pos < p->length; pos+=4)
   {
-    DWORD data = icqtohl(*(DWORD *)((p->data)+pos));
+    DWORD data;
+    memcpy(&data, (p->data)+pos, sizeof(DWORD));
+    data = icqtohl(data);
     code3 = code2 + icq_UDPTable[pos & 0xFF];
     data ^= code3;
-    *(DWORD*)(buffer+pos)=htoicql(data);
+    data = htoicql(data);
+    memcpy((buffer+pos),&data,sizeof(DWORD));
   }
   checkcode = icq_UDPScramble(checkcode);
-  *(DWORD *)(buffer+0x14)=htoicql(checkcode);
+  tmp = htoicql(checkcode);
+  memcpy((buffer+0x14),&tmp,sizeof(DWORD));
 }
 
 /*********************************************************