ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/XS.xs
(Generate patch)

Comparing CBOR-XS/XS.xs (file contents):
Revision 1.41 by root, Tue Dec 10 14:01:52 2013 UTC vs.
Revision 1.44 by root, Tue Feb 18 22:12:12 2014 UTC

7#include <stdlib.h> 7#include <stdlib.h>
8#include <stdio.h> 8#include <stdio.h>
9#include <limits.h> 9#include <limits.h>
10#include <float.h> 10#include <float.h>
11 11
12#define ECB_NO_THREADS 1
12#include "ecb.h" 13#include "ecb.h"
13 14
14// compatibility with perl <5.18 15// compatibility with perl <5.18
15#ifndef HvNAMELEN_get 16#ifndef HvNAMELEN_get
16# define HvNAMELEN_get(hv) strlen (HvNAME (hv)) 17# define HvNAMELEN_get(hv) strlen (HvNAME (hv))
736{ 737{
737 // for speed reasons, we specialcase single-string 738 // for speed reasons, we specialcase single-string
738 // byte or utf-8 strings as keys, but only when !stringref 739 // byte or utf-8 strings as keys, but only when !stringref
739 740
740 if (ecb_expect_true (!dec->stringref)) 741 if (ecb_expect_true (!dec->stringref))
741 if (ecb_expect_true ((*dec->cur - MAJOR_BYTES) <= LENGTH_EXT8)) 742 if (ecb_expect_true ((U8)(*dec->cur - MAJOR_BYTES) <= LENGTH_EXT8))
742 { 743 {
743 I32 len = decode_uint (dec); 744 I32 len = decode_uint (dec);
744 char *key = (char *)dec->cur; 745 char *key = (char *)dec->cur;
745 746
746 dec->cur += len; 747 dec->cur += len;
747 748
748 hv_store (hv, key, len, decode_sv (dec), 0); 749 hv_store (hv, key, len, decode_sv (dec), 0);
749 750
750 return; 751 return;
751 } 752 }
752 else if (ecb_expect_true ((*dec->cur - MAJOR_TEXT) <= LENGTH_EXT8)) 753 else if (ecb_expect_true ((U8)(*dec->cur - MAJOR_TEXT) <= LENGTH_EXT8))
753 { 754 {
754 I32 len = decode_uint (dec); 755 I32 len = decode_uint (dec);
755 char *key = (char *)dec->cur; 756 char *key = (char *)dec->cur;
756 757
757 dec->cur += len; 758 dec->cur += len;
1448 PUSHs (sv); 1449 PUSHs (sv);
1449 PUSHs (sv_2mortal (newSVuv (offset - SvPVX (cborstr)))); 1450 PUSHs (sv_2mortal (newSVuv (offset - SvPVX (cborstr))));
1450} 1451}
1451 1452
1452void incr_parse (CBOR *self, SV *cborstr) 1453void incr_parse (CBOR *self, SV *cborstr)
1454 ALIAS:
1455 incr_parse_multiple = 1
1453 PPCODE: 1456 PPCODE:
1454{ 1457{
1455 if (SvUTF8 (cborstr)) 1458 if (SvUTF8 (cborstr))
1456 sv_utf8_downgrade (cborstr, 0); 1459 sv_utf8_downgrade (cborstr, 0);
1457 1460
1487 av_push (self->incr_count, newSViv (1)); 1490 av_push (self->incr_count, newSViv (1));
1488 1491
1489 self->incr_pos = 0; 1492 self->incr_pos = 0;
1490 self->incr_need = self->incr_pos + 1; 1493 self->incr_need = self->incr_pos + 1;
1491 } 1494 }
1492 while (GIMME_V == G_ARRAY); 1495 while (ix);
1493} 1496}
1494 1497
1495void incr_reset (CBOR *self) 1498void incr_reset (CBOR *self)
1496 CODE: 1499 CODE:
1497{ 1500{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines