Imported Upstream version 0.37
authorAlexandre Mestiashvili <alex@biotec.tu-dresden.de>
Mon, 16 Sep 2013 08:00:55 +0000 (10:00 +0200)
committerAlexandre Mestiashvili <alex@biotec.tu-dresden.de>
Mon, 16 Sep 2013 08:00:55 +0000 (10:00 +0200)
Changes
MANIFEST
META.json [new file with mode: 0644]
META.yml
author_tools/hobodecoder.pl
const-c.inc
lib/Sereal/Encoder.pm
lib/Sereal/Encoder/Constants.pm
srl_encoder.c
srl_protocol.h
t/020_sort_keys.t

diff --git a/Changes b/Changes
index 27eee8eeb397e41c4f28d6e900327ee76b0e38b3..2c2a378991e933ed8bddd77b8f373bdb2c46ae55 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,16 @@
 Revision history for Perl extension Sereal-Encoder
 
+0.37 Mon Sep 2 07:40 2013 (AMS time)
+  - Windows and C89 fixes
+  - Band-aid: Skip test failing due to hash-randomization [Zefram]
+
+0.36 Tue May 7 12:00 2013 (AMS time)
+  [changelog for encoder and decoder both]
+  - Add "incremental" option to decoder for easier decoding of
+    multiple sereal documents in one buffer.
+  - Make snappy and snappy_incr options mutually exclusive.
+  - Feature: Implement aliasing for deduping (aliased_dedupe_strings)
+
 0.35 Mon Apr 1 11:50 2013 (AMS time)
   - Add new no_bless_objects option from Simon Bertrang.
 
index bb55adbe8c8fcc74d62c19603f507ad5696f949d..190a106382c64490785b27408921926aa3e2c913 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -45,4 +45,5 @@ t/data/corpus
 t/lib/Sereal/BulkTest.pm
 t/lib/Sereal/TestSet.pm
 typemap
-META.yml                                 Module meta-data (added by MakeMaker)
+META.yml                                 Module YAML meta-data (added by MakeMaker)
+META.json                                Module JSON meta-data (added by MakeMaker)
diff --git a/META.json b/META.json
new file mode 100644 (file)
index 0000000..d671f20
--- /dev/null
+++ b/META.json
@@ -0,0 +1,58 @@
+{
+   "abstract" : "Fast, compact, powerful binary serialization",
+   "author" : [
+      "Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>"
+   ],
+   "dynamic_config" : 1,
+   "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921",
+   "license" : [
+      "perl_5"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+      "version" : "2"
+   },
+   "name" : "Sereal-Encoder",
+   "no_index" : {
+      "directory" : [
+         "t",
+         "inc"
+      ]
+   },
+   "prereqs" : {
+      "build" : {
+         "requires" : {
+            "Data::Dumper" : "0",
+            "ExtUtils::ParseXS" : "2.21",
+            "File::Find" : "0",
+            "File::Path" : "0",
+            "File::Spec" : "0",
+            "Scalar::Util" : "0",
+            "Test::LongString" : "0",
+            "Test::More" : "0.88",
+            "Test::Warn" : "0"
+         }
+      },
+      "configure" : {
+         "requires" : {
+            "ExtUtils::MakeMaker" : "0"
+         }
+      },
+      "runtime" : {
+         "requires" : {
+            "XSLoader" : "0",
+            "perl" : "5.008"
+         }
+      }
+   },
+   "release_status" : "stable",
+   "resources" : {
+      "bugtracker" : {
+         "web" : "https://github.com/Sereal/Sereal/issues"
+      },
+      "repository" : {
+         "url" : "git://github.com/Sereal/Sereal.git"
+      }
+   },
+   "version" : "0.37"
+}
index 208d57e1d6a0ead444fc07ac720c196facb464dd..99a666911d0a293e3cbe906e11f6572c4bdf7d4d 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,34 +1,34 @@
---- #YAML:1.0
-name:               Sereal-Encoder
-version:            0.36
-abstract:           Fast, compact, powerful binary serialization
+---
+abstract: 'Fast, compact, powerful binary serialization'
 author:
-    - Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>
-license:            perl
-distribution_type:  module
-configure_requires:
-    ExtUtils::MakeMaker:  0
+  - '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
-    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
+  Test::LongString: 0
+  Test::More: 0.88
+  Test::Warn: 0
+configure_requires:
+  ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921'
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: Sereal-Encoder
+no_index:
+  directory:
+    - t
+    - inc
 requires:
-    perl:      5.008
-    XSLoader:  0
+  XSLoader: 0
+  perl: 5.008
 resources:
-    bugtracker:  https://github.com/Sereal/Sereal/issues
-    repository:  git://github.com/Sereal/Sereal.git
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.56
-meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+  bugtracker: https://github.com/Sereal/Sereal/issues
+  repository: git://github.com/Sereal/Sereal.git
+version: 0.37
index 2c1662881070d87a8058bc4e8709e4e9c6d97351..87fb11ded60e5f6231d9022b751c336725ea6f42 100644 (file)
@@ -50,6 +50,9 @@ sub parse_header {
   my $flags = $2;
   my $len = varint();
   my $hdr = substr($data, 0, $len, '');
+
+  my $proto_version = ord($flags) & SRL_PROTOCOL_VERSION_MASK;
+  print "Sereal protocol version: $proto_version\n";
   if (length($hdr)) {
     print "Header($len): " . join(" ", map ord, split //, $hdr) . "\n";
   }
@@ -59,11 +62,15 @@ sub parse_header {
   my $encoding= ord($flags) & SRL_PROTOCOL_ENCODING_MASK;
 
   if ($encoding == SRL_PROTOCOL_ENCODING_SNAPPY) {
+    print "Header says: Document body is Snappy-compressed.\n";
     require Compress::Snappy;
     my $out = Compress::Snappy::decompress($data);
     $data = $out;
-  } elsif ($encoding) {
-    die "Invalid encoding";
+  } elsif ($encoding == SRL_PROTOCOL_ENCODING_SNAPPY_INCREMENTAL) {
+    die "Incremental Snappy encoding not implemented in hobodecoder. (yet. It's easy to do.)";
+  }
+  elsif ($encoding) {
+    die "Invalid encoding '" . ($encoding >> SRL_PROTOCOL_VERSION_BITS) . "'";
   }
 }
 
index 911c30de59313650f3b6041a3868e85aa3f558ef..705fc3f4f89bdecef5793069bdb883d29a0fba61 100644 (file)
@@ -366,7 +366,7 @@ constant_16 (pTHX_ const char *name, IV *iv_return) {
   /* When generated this function returned values for the list of names given
      here.  However, subsequent manual editing may have added or removed some.
      SRL_HDR_ARRAYREF SRL_HDR_NEG_HIGH SRL_HDR_POS_HIGH SRL_HDR_RESERVED
-     SRL_HDR_STR_UTF8 SRL_NEG_MIN_SIZE SRL_POS_MAX_SIZE */
+     SRL_HDR_STR_UTF8 SRL_MAGIC_STRLEN SRL_NEG_MIN_SIZE SRL_POS_MAX_SIZE */
   /* Offset 8 gives the best switch position.  */
   switch (name[8]) {
   case 'A':
@@ -377,6 +377,17 @@ constant_16 (pTHX_ const char *name, IV *iv_return) {
       return PERL_constant_ISIV;
 #else
       return PERL_constant_NOTDEF;
+#endif
+    }
+    break;
+  case 'C':
+    if (memEQ(name, "SRL_MAGIC_STRLEN", 16)) {
+    /*                       ^              */
+#ifdef SRL_MAGIC_STRLEN
+      *iv_return = SRL_MAGIC_STRLEN;
+      return PERL_constant_ISIV;
+#else
+      return PERL_constant_NOTDEF;
 #endif
     }
     break;
@@ -623,7 +634,7 @@ my @names = (qw(SRL_HDR_ALIAS SRL_HDR_ARRAY SRL_HDR_ARRAYREF
               SRL_HDR_SHORT_BINARY SRL_HDR_SHORT_BINARY_HIGH
               SRL_HDR_SHORT_BINARY_LOW SRL_HDR_STR_UTF8 SRL_HDR_TRACK_FLAG
               SRL_HDR_TRUE SRL_HDR_UNDEF SRL_HDR_VARINT SRL_HDR_WEAKEN
-              SRL_HDR_ZIGZAG SRL_MAGIC_STRING_LILIPUTIAN
+              SRL_HDR_ZIGZAG SRL_MAGIC_STRING_LILIPUTIAN SRL_MAGIC_STRLEN
               SRL_MASK_ARRAYREF_COUNT SRL_MASK_HASHREF_COUNT
               SRL_MASK_SHORT_BINARY_LEN SRL_NEG_MIN_SIZE SRL_POS_MAX_SIZE
               SRL_PROTOCOL_ENCODING_MASK SRL_PROTOCOL_ENCODING_RAW
index fa75a93909b0082f320b19d6124589d1b81e5bfd..58ee05c6b3516b3a620edfaa91336afe6f39df84 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 use Carp qw/croak/;
 use XSLoader;
 
-our $VERSION = '0.36'; # Don't forget to update the TestCompat set for testing against installed decoders!
+our $VERSION = '0.37'; # Don't forget to update the TestCompat set for testing against installed decoders!
 
 # not for public consumption, just for testing.
 my $TestCompat = [ map sprintf("%.2f", $_/100), reverse( 23 .. int($VERSION * 100) ) ]; # compat with 0.23 to ...
@@ -42,9 +42,6 @@ Sereal::Encoder - Fast, compact, powerful binary serialization
 
 =head1 DESCRIPTION
 
-B<This is an experimental module. The interface may change without notice.
-Before using it in production, please get in touch with the authors!>
-
 This library implements an efficient, compact-output, and feature-rich
 serializer using a binary protocol called I<Sereal>.
 Its sister module L<Sereal::Decoder> implements a decoder for this format.
index 5edf80c896769788e6cc4b893cd3540bf2e06349..d0d03df52311953e4c02d446a4d0298f3fbbcf18 100644 (file)
@@ -9,6 +9,7 @@ our @ISA = qw(Exporter);
 require Exporter;
 our @EXPORT_OK;
 BEGIN { @EXPORT_OK = qw(
+    SRL_MAGIC_STRLEN
     SRL_MAGIC_STRING_LILIPUTIAN
     SRL_PROTOCOL_VERSION
     SRL_PROTOCOL_VERSION_BITS
index 914c3327eddcc901180d2522c9d4a6a6cca6b925..24554efdf5292345808e569d5e42220671e7ef4c 100644 (file)
@@ -40,7 +40,9 @@ extern "C" {
 #define MY_CAN_FIND_PLACEHOLDERS
 #define HAS_SV2OBJ
 #endif
-#if (PERL_VERSION >= 10)
+
+/* hv_backreferences_p is not marked as exported in embed.fnc in any perl */
+#if (PERL_VERSION >= 10 && !defined(WIN32) && !defined(_WIN32))
 #define HAS_HV_BACKREFS
 #endif
 
@@ -715,7 +717,7 @@ srl_fixup_weakrefs(pTHX_ srl_encoder_t *enc)
 #    define RX_PRECOMP(re) ((re)->precomp)
 #    define RX_PRELEN(re) ((re)->prelen)
 
-// Maybe this is only on OS X, where SvUTF8(sv) exists but looks at flags that don't exist
+/* Maybe this is only on OS X, where SvUTF8(sv) exists but looks at flags that don't exist */
 #    define RX_UTF8(re) (RX_EXTFLAGS(re) & RXf_UTF8)
 
 #elif defined(SvRX)
@@ -1084,9 +1086,10 @@ srl_dump_sv(pTHX_ srl_encoder_t *enc, SV *src)
     AV *backrefs;
     SV* refsv= NULL;
     UV weakref_ofs= 0;              /* preserved between loops */
+    int nobless;
     SSize_t ref_rewrite_pos= 0;      /* preserved between loops - note SSize_t is a perl define */
     assert(src);
-    int nobless = SRL_ENC_HAVE_OPTION(enc, SRL_F_NO_BLESS_OBJECTS);
+    nobless = SRL_ENC_HAVE_OPTION(enc, SRL_F_NO_BLESS_OBJECTS);
 
     if (++enc->recursion_depth == enc->max_recursion_depth) {
         croak("Hit maximum recursion depth (%lu), aborting serialization",
index 95d9d9d0b50df2f427a8ced9e5495fdf93475c4e..16af658dbaf64338a94bd03003b55ebe717e7ed4 100644 (file)
 
 /* magic string, protocol version and encoding information */
 #define SRL_MAGIC_STRING                "=srl"          /* Magic string for header. Every packet starts with this */
+#define SRL_MAGIC_STRLEN                4               /* Length of SRL_MAGIC_STRING */
 #define SRL_MAGIC_STRING_LILIPUTIAN     0x6c72733d      /* SRL_MAGIC_STRING as a little endian integer */
 
 #define SRL_PROTOCOL_VERSION            ( 1 )           /* this is the first. for some reason we did not use 0 */
index 4ba6d6aea88d53582549ea7e0b2a52e89c5d869c..a69043a6400b92e0c41627d5f24ba998272928ed 100644 (file)
@@ -59,7 +59,10 @@ if ( @keys > 1 ) {
 foreach my $x ( 0 .. $#keys ) {
     foreach my $y ($x + 1 .. $#keys) {
         is($encoded{$keys[$x]}, $encoded{$keys[$y]},"$keys[$x] vs $keys[$y] (same: sort_keys)");
-        isnt($encoded_unsorted{$keys[$x]}, $encoded_unsorted{$keys[$y]},"$keys[$x] vs $keys[$y] (different: no sort_keys)");
+        SKIP: {
+            skip "test causes random false failures", 1;
+            isnt($encoded_unsorted{$keys[$x]}, $encoded_unsorted{$keys[$y]},"$keys[$x] vs $keys[$y] (different: no sort_keys)");
+        }
     }
 }