Subject: | cas value not being converted to perl correctly on 32bit system |
When retrieving the cas value on a 32 bit machine, the value is being incorrectly converted to a
perl uv. Attached is a patch to convert it to a perl string after a gets() and then back to a long
long when calling cas(). Thank you for your work on this module!
Subject: | Fast.xs.patch |
--- Cache-Memcached-Fast-0.19/Fast.xs 2010-04-24 03:25:15.000000000 -0700
+++ /home/jgoldberg/Cache-Memcached-Fast-0.19/Fast.xs 2011-02-01 14:15:31.965175000 -0800
@@ -562,8 +562,10 @@
else
{
AV *cas_val = newAV();
+ char mybuf[21];
+ sprintf(mybuf,"%llu",m->cas);
av_extend(cas_val, 1);
- av_push(cas_val, newSVuv(m->cas));
+ av_push(cas_val, newSVpv(mybuf,0));
av_push(cas_val, value_sv);
value_res->vals = newRV_noinc((SV *) cas_val);
}
@@ -592,8 +594,10 @@
else
{
AV *cas_val = newAV();
+ char mybuf[21];
+ sprintf(mybuf,"%llu",m->cas);
av_extend(cas_val, 1);
- av_push(cas_val, newSVuv(m->cas));
+ av_push(cas_val, newSVpv(mybuf,0));
av_push(cas_val, value_sv);
av_store((AV *) value_res->vals, key_index, newRV_noinc((SV *) cas_val));
}
@@ -718,7 +722,7 @@
++arg;
if (ix == CMD_CAS)
{
- cas = SvUV(ST(arg));
+ cas = atoll(SvPV_nolen(ST(arg)));
++arg;
}
sv = ST(arg);
@@ -807,7 +811,7 @@
++arg;
if (ix == CMD_CAS)
{
- cas = SvUV(*av_fetch(av, arg, 0));
+ cas = atoll(SvPV_nolen(*av_fetch(av, arg, 0)));
++arg;
}
sv = *av_fetch(av, arg, 0);