[Orca-checkins] r364 - in trunk/orca: . packages/Storable-2.12 packages/Storable-2.13 packages/Storable-2.13/t

Blair Zajac blair at orcaware.com
Sat Jul 3 10:40:34 PDT 2004


Author: blair
Date: Sat Jul  3 10:38:07 2004
New Revision: 364

Added:
   trunk/orca/packages/Storable-2.13/
      - copied from r363, trunk/orca/packages/Storable-2.12/
   trunk/orca/packages/Storable-2.13/t/make_overload.pl
Removed:
   trunk/orca/packages/Storable-2.12/
Modified:
   trunk/orca/INSTALL
   trunk/orca/configure.in
   trunk/orca/packages/Storable-2.13/ChangeLog
   trunk/orca/packages/Storable-2.13/MANIFEST
   trunk/orca/packages/Storable-2.13/README
   trunk/orca/packages/Storable-2.13/Storable.pm
   trunk/orca/packages/Storable-2.13/Storable.xs
   trunk/orca/packages/Storable-2.13/t/utf8.t
Log:
Upgrade Storable from 2.12 to 2.13 and require the new version for
Orca.

* configure.in:
  Bump Storable's version number to 2.13.

* INSTALL (Determine which Perl modules need compiling and installing):
  Update all references to Storable's version number from 2.12 to
  2.13.

* packages/Storable-2.13:
  Renamed from packages/Storable-2.12.  Directory contents updated
  from Storable-2.13.tar.gz.


Modified: trunk/orca/INSTALL
==============================================================================
--- trunk/orca/INSTALL	(original)
+++ trunk/orca/INSTALL	Sat Jul  3 10:38:07 2004
@@ -176,7 +176,7 @@
     Digest::MD5             >= 2.33        >= 2.33      2.33
     Math::IntervalSearch    >= 1.05        >= 1.05      1.05
     RRDs                    >= 1.000461    >= 1.0.46    1.0.46
-    Storable                >= 2.12        >= 2.12      2.12
+    Storable                >= 2.13        >= 2.13      2.13
     Time::HiRes             Not required by Orca        1.59
     version                 >= 0.39        >= 0.39      0.39
 
@@ -268,10 +268,10 @@
 
     Storable
 
-      http://www.perl.com/CPAN/authors/id/A/AM/AMS/Storable-2.12.tar.gz
+      http://www.perl.com/CPAN/authors/id/A/AM/AMS/Storable-2.13.tar.gz
 
-      % gunzip -c Storable-2.12.tar.gz | tar xvf -
-      % cd Storable-2.12
+      % gunzip -c Storable-2.13.tar.gz | tar xvf -
+      % cd Storable-2.13
       % perl Makefile.PL
       % make
       % make test

Modified: trunk/orca/configure.in
==============================================================================
--- trunk/orca/configure.in	(original)
+++ trunk/orca/configure.in	Sat Jul  3 10:38:07 2004
@@ -39,8 +39,8 @@
 MATH_INTERVALSEARCH_VER=1.05
 RRDTOOL_DIR=rrdtool-1.0.46
 RRDTOOL_VER=1.000461
-STORABLE_DIR=Storable-2.12
-STORABLE_VER=2.12
+STORABLE_DIR=Storable-2.13
+STORABLE_VER=2.13
 TIME_HIRES_DIR=Time-HiRes-1.59
 TIME_HIRES_VER=1.59
 VERSION_DIR=version-0.39

Modified: trunk/orca/packages/Storable-2.13/ChangeLog
==============================================================================
--- trunk/orca/packages/Storable-2.12/ChangeLog	(original)
+++ trunk/orca/packages/Storable-2.13/ChangeLog	Sat Jul  3 10:38:07 2004
@@ -1,3 +1,12 @@
+Thu Jun 17 12:26:43 BST 2004   Nicholas Clark <nick at ccl4.org>
+
+    Version 2.13
+
+        1. Don't change the type of top level overloaded references to RV -
+	   they are perfectly correct as PVMG
+	2. Storable needs to cope with incoming frozen data that happens to be
+	   utf8 encoded.
+
 Wed Mar 17 15:40:29 GMT 2004   Nicholas Clark <nick at ccl4.org>
 
     Version 2.12

Modified: trunk/orca/packages/Storable-2.13/MANIFEST
==============================================================================
--- trunk/orca/packages/Storable-2.12/MANIFEST	(original)
+++ trunk/orca/packages/Storable-2.13/MANIFEST	Sat Jul  3 10:38:07 2004
@@ -23,6 +23,7 @@
 t/lock.t		    See if Storable works
 t/make_56_interwork.pl	    Make test data for interwork56.t
 t/make_downgrade.pl	    Make test data for downgrade.t
+t/make_overload.pl	    Make test data for overload.t
 t/malice.t		    See if Storable copes with corrupt files
 t/overload.t		    See if Storable works
 t/recurse.t		    See if Storable works

Modified: trunk/orca/packages/Storable-2.13/README
==============================================================================
--- trunk/orca/packages/Storable-2.12/README	(original)
+++ trunk/orca/packages/Storable-2.13/README	Sat Jul  3 10:38:07 2004
@@ -1,4 +1,4 @@
-                         Storable 2.12
+                         Storable 2.13
                Copyright (c) 1995-2000, Raphael Manfredi
                Copyright (c) 2001-2004, Larry Wall
 

Modified: trunk/orca/packages/Storable-2.13/Storable.pm
==============================================================================
--- trunk/orca/packages/Storable-2.12/Storable.pm	(original)
+++ trunk/orca/packages/Storable-2.13/Storable.pm	Sat Jul  3 10:38:07 2004
@@ -21,7 +21,7 @@
 use AutoLoader;
 use vars qw($canonical $forgive_me $VERSION);
 
-$VERSION = '2.12';
+$VERSION = '2.13';
 *AUTOLOAD = \&AutoLoader::AUTOLOAD;		# Grrr...
 
 #

Modified: trunk/orca/packages/Storable-2.13/Storable.xs
==============================================================================
--- trunk/orca/packages/Storable-2.12/Storable.xs	(original)
+++ trunk/orca/packages/Storable-2.13/Storable.xs	Sat Jul  3 10:38:07 2004
@@ -4287,9 +4287,8 @@
 	 */
 
 	if (cname) {
-		/* Do not use sv_upgrade to preserve STASH */
-		SvFLAGS(rv) &= ~SVTYPEMASK;
-		SvFLAGS(rv) |= SVt_RV;
+		/* No need to do anything, as rv will already be PVMG.  */
+		assert (SvTYPE(rv) >= SVt_RV);
 	} else {
 		sv_upgrade(rv, SVt_RV);
 	}
@@ -5798,8 +5797,46 @@
 
 	KBUFINIT();			 		/* Allocate hash key reading pool once */
 
-	if (!f && in)
+	if (!f && in) {
+#ifdef SvUTF8_on
+		if (SvUTF8(in)) {
+			STRLEN length;
+			const char *orig = SvPV(in, length);
+			char *asbytes;
+			/* This is quite deliberate. I want the UTF8 routines
+			   to encounter the '\0' which perl adds at the end
+			   of all scalars, so that any new string also has
+			   this.
+			*/
+			STRLEN klen_tmp = length + 1;
+			bool is_utf8 = TRUE;
+
+			/* Just casting the &klen to (STRLEN) won't work
+			   well if STRLEN and I32 are of different widths.
+			   --jhi */
+			asbytes = (char*)bytes_from_utf8((U8*)orig,
+							 &klen_tmp,
+							 &is_utf8);
+			if (is_utf8) {
+				CROAK(("Frozen string corrupt - contains characters outside 0-255"));
+			}
+			if (asbytes != orig) {
+				/* String has been converted.
+				   There is no need to keep any reference to
+				   the old string.  */
+				in = sv_newmortal();
+				/* We donate the SV the malloc()ed string
+				   bytes_from_utf8 returned us.  */
+				SvUPGRADE(in, SVt_PV);
+				SvPOK_on(in);
+				SvPVX(in) = asbytes;
+				SvLEN(in) = klen_tmp;
+				SvCUR(in) = klen_tmp - 1;
+			}
+		}
+#endif
 		MBUF_SAVE_AND_LOAD(in);
+	}
 
 	/*
 	 * Magic number verifications.

Added: trunk/orca/packages/Storable-2.13/t/make_overload.pl
==============================================================================
--- (empty file)
+++ trunk/orca/packages/Storable-2.13/t/make_overload.pl	Sat Jul  3 10:38:07 2004
@@ -0,0 +1,13 @@
+#!/usr/local/bin/perl -w
+use strict;
+
+use Storable qw(nfreeze);
+use HAS_OVERLOAD;
+
+my $o = HAS_OVERLOAD->make("snow");
+my $f = nfreeze \$o;
+
+my $uu = pack 'u', $f;
+
+print $uu;
+

Modified: trunk/orca/packages/Storable-2.13/t/utf8.t
==============================================================================
--- trunk/orca/packages/Storable-2.12/t/utf8.t	(original)
+++ trunk/orca/packages/Storable-2.13/t/utf8.t	Sat Jul  3 10:38:07 2004
@@ -1,3 +1,4 @@
+
 #!./perl -w
 #
 #  Copyright (c) 1995-2000, Raphael Manfredi
@@ -30,7 +31,7 @@
 
 use Storable qw(thaw freeze);
 
-print "1..3\n";
+print "1..6\n";
 
 my $x = chr(1234);
 ok 1, $x eq ${thaw freeze \$x};
@@ -43,3 +44,20 @@
 $x = chr (175) . chr (256);
 chop $x;
 ok 3, $x eq ${thaw freeze \$x};
+
+# Storable needs to cope if a frozen string happens to be internall utf8
+# encoded
+
+$x = chr 256;
+my $data = freeze \$x;
+ok 4, $x eq ${thaw $data};
+
+$data .= chr 256;
+chop $data;
+ok 5, $x eq ${thaw $data};
+
+
+$data .= chr 256;
+# This definately isn't valid
+eval {thaw $data};
+ok 6, $@ =~ /corrupt.*characters outside/;



More information about the Orca-checkins mailing list