Bug 8216: Allow SIP modules to pass critic tests
[koha.git] / C4 / SIP / Sip / Checksum.pm
index e88567a..6932000 100644 (file)
@@ -10,7 +10,7 @@ our $debug = 0;
 
 sub checksum {
     my $pkt = shift;
-    return (-unpack('%16U*', $pkt) & 0xFFFF);
+    return (-unpack('%16C*', $pkt) & 0xFFFF);
 }
 
 sub verify_cksum {
@@ -29,19 +29,13 @@ sub verify_cksum {
     # Convert the checksum back to hex and calculate the sum of the
     # pack without the checksum.
     $cksum = hex($1);
-    $shortsum = unpack("%16U*", substr($pkt, 0, -4));
+    $shortsum = unpack("%16C*", substr($pkt, 0, -4));
 
     # The checksum is valid if the hex sum, plus the checksum of the 
     # base packet short when truncated to 16 bits.
     return (($cksum + $shortsum) & 0xFFFF) == 0;
 }
 
-{
-    no warnings qw(once);
-    eval join('',<main::DATA>) || die $@ unless caller();
-       # FIXME: what the heck is this?
-}
-
 1;
 __END__