Subject: | No support for 64 bit integers (i8) |
I found that rtorrent was outputting integers of the type 'i8' which are
not understood by RPC::XML. I have attached a patch that fixes this,
though it essentially just copies the i4 class into a new i8 class.
Subject: | rpc-xml-i8.patch |
diff -ru RPC-XML-0.59/lib/RPC/XML/Parser.pm RPC-XML-0.59-i8/lib/RPC/XML/Parser.pm
--- RPC-XML-0.59/lib/RPC/XML/Parser.pm 2006-06-04 02:44:41.000000000 -0500
+++ RPC-XML-0.59-i8/lib/RPC/XML/Parser.pm 2007-10-29 22:41:36.000000000 -0500
@@ -69,7 +69,7 @@
use constant FAULTSTART => 22;
# This is to identify valid types
-use constant VALIDTYPES => { map { $_, 1 } qw(int i4 string double reference
+use constant VALIDTYPES => { map { $_, 1 } qw(int i4 i8 string double reference
boolean dateTime.iso8601
base64) };
# This maps XML tags to stack-machine tokens
@@ -290,7 +290,7 @@
# Cheaper than the regex that was here, and more locale-portable
$class = 'datetime_iso8601' if ($class eq 'dateTime.iso8601');
# Some minimal data-integrity checking
- if ($class eq 'int' or $class eq 'i4')
+ if ($class eq 'int' or $class eq 'i4' or $class eq 'i8')
{
return error($robj, $self, 'Bad integer data read')
unless ($robj->{cdata} =~ /^[-+]?\d+$/);
diff -ru RPC-XML-0.59/lib/RPC/XML.pm RPC-XML-0.59-i8/lib/RPC/XML.pm
--- RPC-XML-0.59/lib/RPC/XML.pm 2006-06-30 02:36:29.000000000 -0500
+++ RPC-XML-0.59-i8/lib/RPC/XML.pm 2007-10-29 22:46:04.000000000 -0500
@@ -79,6 +79,7 @@
sub RPC_BOOLEAN ( $ ) { RPC::XML::boolean->new($_[0]) }
sub RPC_INT ( $ ) { RPC::XML::int->new($_[0]) }
sub RPC_I4 ( $ ) { RPC::XML::i4->new($_[0]) }
+sub RPC_I8 ( $ ) { RPC::XML::i8->new($_[0]) }
sub RPC_DOUBLE ( $ ) { RPC::XML::double->new($_[0]) }
sub RPC_DATETIME_ISO8601 ( $ ) { RPC::XML::datetime_iso8601->new($_[0]) }
sub RPC_BASE64 ( $ ) { RPC::XML::base64->new($_[0]) }
@@ -296,6 +297,20 @@
###############################################################################
#
+# Package: RPC::XML::i8
+#
+# Description: Data-type class for i8. Forces data into an int object.
+#
+###############################################################################
+package RPC::XML::i8;
+
+use strict;
+use vars qw(@ISA);
+
+@ISA = qw(RPC::XML::simple_type);
+
+###############################################################################
+#
# Package: RPC::XML::double
#
# Description: The "double" type-class