Imported Upstream version 3.001.012
authorgregor herrmann <gregoa@debian.org>
Sat, 16 Aug 2014 00:02:58 +0000 (02:02 +0200)
committergregor herrmann <gregoa@debian.org>
Sat, 16 Aug 2014 00:02:58 +0000 (02:02 +0200)
16 files changed:
META.json
META.yml
author_tools/hobodecoder.pl
const-c.inc
lib/Sereal/Encoder.pm
srl_common.h
srl_encoder.c
t/700_roundtrip/v1/plain_canon.t
t/700_roundtrip/v1/snappy_canon.t
t/700_roundtrip/v2/plain_canon.t
t/700_roundtrip/v2/snappy_canon.t
t/700_roundtrip/v2/snappy_incr_canon.t
t/700_roundtrip/v3/plain_canon.t
t/700_roundtrip/v3/snappy_canon.t
t/700_roundtrip/v3/snappy_incr_canon.t
t/lib/Sereal/TestSet.pm

index d07a3045ef8fe5f1a818c10a966fd84077960e9a..1deadaed07949afa74a65fc9d72b03ea8fadfe5d 100644 (file)
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.9, CPAN::Meta::Converter version 2.141520",
+   "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120630",
    "license" : [
       "perl_5"
    ],
@@ -55,5 +55,5 @@
          "url" : "git://github.com/Sereal/Sereal.git"
       }
    },
-   "version" : "3.001_011"
+   "version" : "3.001_012"
 }
index 2bb664c59d8200b638236652ca97677229e24ea9..2f0d7aa2363a2dd80be26b1efb1ebd8d58074482 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -3,33 +3,33 @@ abstract: 'Fast, compact, powerful binary serialization'
 author:
   - 'Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>'
 build_requires:
-  Data::Dumper: '0'
-  ExtUtils::ParseXS: '2.21'
-  File::Find: '0'
-  File::Path: '0'
-  File::Spec: '0'
-  Scalar::Util: '0'
-  Sereal::Decoder: '3.00'
-  Test::LongString: '0'
-  Test::More: '0.88'
-  Test::Warn: '0'
+  Data::Dumper: 0
+  ExtUtils::ParseXS: 2.21
+  File::Find: 0
+  File::Path: 0
+  File::Spec: 0
+  Scalar::Util: 0
+  Sereal::Decoder: 3.00
+  Test::LongString: 0
+  Test::More: 0.88
+  Test::Warn: 0
 configure_requires:
-  ExtUtils::MakeMaker: '0'
+  ExtUtils::MakeMaker: 0
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.9, CPAN::Meta::Converter version 2.141520'
+generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120630'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: '1.4'
+  version: 1.4
 name: Sereal-Encoder
 no_index:
   directory:
     - t
     - inc
 requires:
-  XSLoader: '0'
-  perl: '5.008'
+  XSLoader: 0
+  perl: 5.008
 resources:
   bugtracker: https://github.com/Sereal/Sereal/issues
   repository: git://github.com/Sereal/Sereal.git
-version: 3.001_011
+version: 3.001_012
index 6dc4c0ed8eae9671e20e1a40836b0dad1fc697f3..09878a0fa2f86a64c54ebabe660f536cef851ce9 100644 (file)
@@ -92,10 +92,11 @@ sub parse_double {
     return unpack("d",$v);
 }
 sub parse_long_double {
-    $len_D||= eval { length(pack("D",0)) };
+    $len_D ||= eval { length(pack("D",0.0)) };
     die "Long double not supported" unless $len_D;
-    my $v= substr($data,0,$len_D,"");
+    my $v= substr($data, 0, $len_D, "");
     $done .= $v;
+    warn "long double size: " . $len_D;
     return unpack("D",$v);
 }
 
index 1c8e83099f736d0d1318571ba97a566087b5db42..91e964b45cc5b1ca2bbd66cb1f3f5ed49a5ca509 100644 (file)
@@ -763,7 +763,7 @@ constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
      Regenerate these constant functions by feeding this entire source file to
      perl -x
 
-#!/usr/bin/perl -w
+#!/home/yorton/perl5/perlbrew/perls/perl-5.16.3-ld/bin/perl -w
 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
 
 my $types = {map {($_, 1)} qw(IV)};
index 0e71e186ba9d6e703a9e71764d46a4605301a802..7625ac49dd6ac1d4850b07c607f9246f02a69f35 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 use Carp qw/croak/;
 use XSLoader;
 
-our $VERSION = '3.001_011'; # Don't forget to update the TestCompat set for testing against installed decoders!
+our $VERSION = '3.001_012'; # Don't forget to update the TestCompat set for testing against installed decoders!
 our $XS_VERSION = $VERSION; $VERSION= eval $VERSION;
 
 # not for public consumption, just for testing.
index b50199a330026568adbe1d3a2f3f323914ffad63..dd25bc2f834046a4c5f883e41dcffeb5aac64670 100644 (file)
 #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__) || defined(__x86_64)
 /* SRL_X86_OR_X64_CPU is only used to help set the below macros. */
 #define SRL_X86_OR_X64_CPU
+#ifndef SRL_EXTENDED_PRECISION_LONG_DOUBLE
+#define SRL_EXTENDED_PRECISION_LONG_DOUBLE 1
+#endif
+#endif
+
+#ifndef SRL_EXTENDED_PRECISION_LONG_DOUBLE
+#define SRL_EXTENDED_PRECISION_LONG_DOUBLE 0
 #endif
 
 #ifndef SRL_USE_ALIGNED_LOADS_AND_STORES
index 3b7d9a5ff7c9c405df53c739dab5d9400abc9d61..780748fb280cdb4a83146377f5cccafd0f9ab39c 100644 (file)
@@ -715,6 +715,14 @@ srl_dump_nv(pTHX_ srl_encoder_t *enc, SV *src)
         BUF_SIZE_ASSERT(enc, 1 + sizeof(nv)); /* heuristic: header + string + simple value */
         srl_buf_cat_char_nocheck(enc,SRL_HDR_LONG_DOUBLE);
         Copy((char *)&nv, enc->buf.pos, sizeof(nv), char);
+#if SRL_EXTENDED_PRECISION_LONG_DOUBLE
+        /* x86 uses an 80 bit extended precision. on 64 bit machines
+         * this is 16 bytes long, and on 32 bits its is 12 bytes long.
+         * the unused 2/6 bytes are not necessarily zeroed, potentially
+         * allowing internal memory to be exposed. We therefore zero
+         * the unused bytes here. */
+        memset(enc->buf.pos+10, 0, sizeof(nv) - 10);
+#endif
         enc->buf.pos += sizeof(nv);
     }
 }
index e8b9f0486282815e3746531552de7f43f00495b5..f16265eb607bd687d9e5f31198df5792b639fd51 100644 (file)
@@ -14,12 +14,12 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
 else {
-    run_roundtrip_tests("plain_canon",{canonical => 1});
+    run_roundtrip_tests("plain_canon", { canonical => 1 });
 }
 
 pass();
index 605956d60943313d77e122120790eb7ca9f6a8e3..bd673f10ad75ca53a593d1676c09e57dee102e2c 100644 (file)
@@ -14,7 +14,7 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
@@ -22,7 +22,6 @@ else {
     run_roundtrip_tests('snappy_canon', { snappy => 1, canonical => 1 } );
 }
 
-
 pass();
 done_testing();
 
index e8b9f0486282815e3746531552de7f43f00495b5..f16265eb607bd687d9e5f31198df5792b639fd51 100644 (file)
@@ -14,12 +14,12 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
 else {
-    run_roundtrip_tests("plain_canon",{canonical => 1});
+    run_roundtrip_tests("plain_canon", { canonical => 1 });
 }
 
 pass();
index 605956d60943313d77e122120790eb7ca9f6a8e3..bd673f10ad75ca53a593d1676c09e57dee102e2c 100644 (file)
@@ -14,7 +14,7 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
@@ -22,7 +22,6 @@ else {
     run_roundtrip_tests('snappy_canon', { snappy => 1, canonical => 1 } );
 }
 
-
 pass();
 done_testing();
 
index 1cd5327755a7256b7c7ebf3927a9756aade69219..dc1e5b1ab7116428bd2b5f3e356b718622e85459 100644 (file)
@@ -14,17 +14,14 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
 else {
-    run_roundtrip_tests(
-        'snappy_incr_canon',    { snappy_incr => 1, canonical => 1 }
-    );
+    run_roundtrip_tests('snappy_incr_canon', { snappy_incr => 1, canonical => 1 });
 }
 
-
 pass();
 done_testing();
 
index e8b9f0486282815e3746531552de7f43f00495b5..f16265eb607bd687d9e5f31198df5792b639fd51 100644 (file)
@@ -14,12 +14,12 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
 else {
-    run_roundtrip_tests("plain_canon",{canonical => 1});
+    run_roundtrip_tests("plain_canon", { canonical => 1 });
 }
 
 pass();
index 605956d60943313d77e122120790eb7ca9f6a8e3..bd673f10ad75ca53a593d1676c09e57dee102e2c 100644 (file)
@@ -14,7 +14,7 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
@@ -22,7 +22,6 @@ else {
     run_roundtrip_tests('snappy_canon', { snappy => 1, canonical => 1 } );
 }
 
-
 pass();
 done_testing();
 
index 1cd5327755a7256b7c7ebf3927a9756aade69219..dc1e5b1ab7116428bd2b5f3e356b718622e85459 100644 (file)
@@ -14,17 +14,14 @@ use Sereal::TestSet qw(:all);
 use Test::More;
 
 my $ok = have_encoder_and_decoder();
-$ok= 0 if $Sereal::Encoder::VERSION < 3.001006;
+$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006;
 if (not $ok) {
     plan skip_all => 'Did not find right version of encoder (want 3.001006)';
 }
 else {
-    run_roundtrip_tests(
-        'snappy_incr_canon',    { snappy_incr => 1, canonical => 1 }
-    );
+    run_roundtrip_tests('snappy_incr_canon', { snappy_incr => 1, canonical => 1 });
 }
 
-
 pass();
 done_testing();
 
index 6b1841370865d993e1f290e19ae452c9ec4947be..4982ff173e128906e3de624d949a62a4b3283e09 100644 (file)
@@ -638,7 +638,7 @@ our @ScalarRoundtripTests = (
     ["largeish negative int -12345678", -12345678],
 
     (
-        map {["integer: $_", $_]} (
+        map {["integer: $_", 0+$_]} (
             # IV bounds of 8 bits
             -1, 0, 1, -127, -128, -129, 42, 126, 127, 128, 129, 254, 255, 256, 257,
             # IV bounds of 32 bits
@@ -653,8 +653,7 @@ our @ScalarRoundtripTests = (
             $eng0e0, $eng0e1, $eng2,
         )
     ),
-
-    ["float", 0.2],
+    (map { ["float $_", 0+$_] } (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)),
     ["short ascii string", "fooo"],
     ["short latin1 string", "Müller"],
     ["short utf8 string", do {use utf8; " עדיין ח"} ],
@@ -690,8 +689,8 @@ our @ScalarRoundtripTests = (
     ["regexp with modifiers", qr/foo/i],
     ["float", 123013.139],
     ["negative float",-1234.59],
-    ["small float",0.41],
-    ["negative small float",-0.13],
+    ["small float 0.41",0.41],
+    ["negative small float -0.13",-0.13],
     ["small int", 123],
     ["empty string", ''],
     ["simple array", []],
@@ -703,7 +702,16 @@ our @ScalarRoundtripTests = (
     ["deep nest", [1,2,[3,4,{5=>6,7=>{8=>[]},9=>{}},{},[]]]],
     ["complex hash", {
         foo => 123,
-        bar => -159.23 ,
+        bar => -159, pi => 3,
+        'baz' =>"foo",
+        'bop \''=> "\10"
+        ,'bop \'\\'=> "\x{100}" ,
+        'bop \'x\\x'    =>"x\x{100}"   , 'bing' =>   "x\x{100}",
+        x=>'y', z => 'p', i=> '1', l=>" \10", m=>"\10 ", n => " \10 ",
+    }],
+    ["complex hash with float", {
+        foo => 123,
+        bar => -159.23, a_pi => 3.14159,
         'baz' =>"foo",
         'bop \''=> "\10"
         ,'bop \'\\'=> "\x{100}" ,
@@ -712,7 +720,16 @@ our @ScalarRoundtripTests = (
     }],
     ["more complex", {
         foo => [123],
-        "bar" => [-159.23 , { 'baz' => "foo", }, ],
+        "bar" => [-159, n => 3, { 'baz' => "foo", }, ],
+        'bop \''=> { "\10" => { 'bop \'\\'=> "\x{100}", h=>{
+        'bop \'x\\x'    =>"x\x{100}"   , 'bing' =>   "x\x{100}",
+        x=>'y',}, z => 'p' ,   }   ,
+        i    =>  '1' ,}, l=>" \10", m=>"\10 ", n => " \10 ",
+        o => undef ,p=>undef, q=>\undef, r=>\$eng0e0, u => \$eng0e1, w=>\$eng2
+    }],
+    ["more complex with float", {
+        foo => [123],
+        "bar" => [-159.23, a_pi => 3.14159, { 'baz' => "foo", }, ],
         'bop \''=> { "\10" => { 'bop \'\\'=> "\x{100}", h=>{
         'bop \'x\\x'    =>"x\x{100}"   , 'bing' =>   "x\x{100}",
         x=>'y',}, z => 'p' ,   }   ,
@@ -804,6 +821,7 @@ sub _test {
     }
     return;
 }
+
 sub _cmp_str {
     my ($v1, $v2)= @_;
     my $v1_is_utf8= is_utf8($v1);
@@ -819,7 +837,6 @@ sub _cmp_str {
                     and $diff_start < length($v2)
                     and substr($v1, $diff_start,1) eq substr($v2, $diff_start,1);
     my $diff_end= length($v1) < length($v2) ? length($v1) : length($v2);
-    $diff_end-- if $diff_end;
 
     $diff_end-- while $diff_end > $diff_start
                   and $diff_end > $diff_start
@@ -866,8 +883,8 @@ sub _cmp_str {
 
     my $ret= sprintf(  "strings different\n"
                      . "first string difference at octet offset %d%s\n"
-                     . "want-octets = %*s (octets: %*d, utf8-flag: %d)\n"
                      . " got-octets = %*s (octets: %*d, utf8-flag: %d)\n"
+                     . "want-octets = %*s (octets: %*d, utf8-flag: %d)\n"
         ,$diff_start, $issues,
         -$pad, $q1, $lpad, length($v1), $v1_is_utf8,
         -$pad, $q2, $lpad, length($v2), $v2_is_utf8,
@@ -1066,10 +1083,14 @@ sub run_roundtrip_tests_internal {
             deep_cmp($decoded3, $decoded,   "$name ($ename, $mname, decoded3 vs decoded)") or next; #test
             deep_cmp($decoded3, $decoded2,  "$name ($ename, $mname, decoded3 vs decoded2)") or next; #test
 
-            if ( $ename =~ /canon/) {
-                deep_cmp($encoded2, $encoded,  "$name ($ename, $mname, encoded2 vs encoded)") or next; #test
-                deep_cmp($encoded3, $encoded,  "$name ($ename, $mname, encoded3 vs encoded)") or next; #test
+            if ( $ename =~ /canon/ ) {
+                deep_cmp($encoded2, $encoded,  "$name ($ename, $mname, encoded2 vs encoded)") or do {
+                    diag Dumper($encoded2);
+                    diag Dumper($encoded);
+                    next; #test
+                };
                 deep_cmp($encoded3, $encoded2, "$name ($ename, $mname, encoded3 vs encoded2)") or next; #test
+                deep_cmp($encoded3, $encoded,  "$name ($ename, $mname, encoded3 vs encoded)") or next; #test
 
                 if ($ENV{SEREAL_TEST_SAVE_OUTPUT} and $mname eq 'object-oriented') {
                     use File::Path;