Revision: 7539
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7539&view=rev
Author:   thjc
Date:     2009-03-23 19:09:46 +0000 (Mon, 23 Mar 2009)

Log Message:
-----------
fix for bit manipulation in p20s checksum code

Modified Paths:
--------------
    code/player/branches/release-2-1-patches/server/drivers/mixed/p2os/packet.cc

Modified: 
code/player/branches/release-2-1-patches/server/drivers/mixed/p2os/packet.cc
===================================================================
--- 
code/player/branches/release-2-1-patches/server/drivers/mixed/p2os/packet.cc    
    2009-03-22 01:30:30 UTC (rev 7538)
+++ 
code/player/branches/release-2-1-patches/server/drivers/mixed/p2os/packet.cc    
    2009-03-23 19:09:46 UTC (rev 7539)
@@ -56,14 +56,10 @@
 
 
 bool P2OSPacket::Check() {
-  short chksum;
-  chksum = CalcChkSum();
+  unsigned short recv_chksum = static_cast<unsigned short> (CalcChkSum() & 
0xffff);
+  unsigned short pkt_chksum = (static_cast<unsigned short>(packet[size-2]) << 
8) | packet[size-1];
 
-  if ( chksum == (packet[size-2] << 8 | packet[size-1]))
-    return(true);
-
-
-  return(false);
+  return recv_chksum == pkt_chksum;
 }
 
 int P2OSPacket::CalcChkSum() {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to