Change 23915 by [EMAIL PROTECTED] on 2005/01/31 23:08:59

        Subject: Re: encoding neutral unpack
        From: perl5-porters[at]ton.iguana.be (Ton Hospel)
        Date: Sat, 29 Jan 2005 12:41:20 +0000 (UTC)
        Message-ID: <ctg09g$j0e$1[at]post.home.lunix>
        
        Forgotten character progress while checksumming over partial
        b or B format. (plus a regression test)

Affected files ...

... //depot/perl/pp_pack.c#64 edit
... //depot/perl/t/op/pack.t#97 edit

Differences ...

==== //depot/perl/pp_pack.c#64 (text) ====
Index: perl/pp_pack.c
--- perl/pp_pack.c#63~23892~    Thu Jan 27 11:26:21 2005
+++ perl/pp_pack.c      Mon Jan 31 15:08:59 2005
@@ -1085,7 +1085,7 @@
                    len -= 8;
                }
                if (len) {
-                   bits = *s;
+                   bits = *s++;
                    if (datumtype == 'b') {
                        while (len-- > 0) {
                            if (bits & 1) cuv++;

==== //depot/perl/t/op/pack.t#97 (xtext) ====
Index: perl/t/op/pack.t
--- perl/t/op/pack.t#96~23888~  Thu Jan 27 08:40:07 2005
+++ perl/t/op/pack.t    Mon Jan 31 15:08:59 2005
@@ -12,7 +12,7 @@
 my $no_signedness = $] > 5.009 ? '' :
   "Signed/unsigned pack modifiers not available on this perl";
 
-plan tests => 13855;
+plan tests => 13856;
 
 use strict;
 use warnings;
@@ -1490,4 +1490,12 @@
     is(scalar @a, 200,       "[perl #15288]");
     is($a[-1], "01234567\n", "[perl #15288]");
     is($a[-2], "X",          "[perl #15288]");
+}
+
+# checksums
+{
+    # verify that unpack advances correctly wrt a checksum
+    my (@x) = unpack("b10a", "abcd");
+    my (@y) = unpack("%b10a", "abcd");
+    is($x[1], $y[1], "checksum advance ok");
 }
End of Patch.

Reply via email to