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

Comparing JSON-XS/XS.xs (file contents):
Revision 1.110 by root, Wed Jun 1 13:01:09 2011 UTC vs.
Revision 1.113 by root, Thu Aug 11 21:37:41 2011 UTC

837 encode_rv (enc, SvRV (sv)); 837 encode_rv (enc, SvRV (sv));
838 else if (!SvOK (sv) || enc->json.flags & F_ALLOW_UNKNOWN) 838 else if (!SvOK (sv) || enc->json.flags & F_ALLOW_UNKNOWN)
839 encode_str (enc, "null", 4, 0); 839 encode_str (enc, "null", 4, 0);
840 else 840 else
841 croak ("encountered perl type (%s,0x%x) that JSON cannot handle, you might want to report this", 841 croak ("encountered perl type (%s,0x%x) that JSON cannot handle, you might want to report this",
842 SvPV_nolen (sv), SvFLAGS (sv)); 842 SvPV_nolen (sv), (unsigned int)SvFLAGS (sv));
843} 843}
844 844
845static SV * 845static SV *
846encode_json (SV *scalar, JSON *json) 846encode_json (SV *scalar, JSON *json)
847{ 847{
1605 pv_uni_display (uni, dec.cur, dec.end - dec.cur, 20, UNI_DISPLAY_QQ); 1605 pv_uni_display (uni, dec.cur, dec.end - dec.cur, 20, UNI_DISPLAY_QQ);
1606 LEAVE; 1606 LEAVE;
1607 1607
1608 croak ("%s, at character offset %d (before \"%s\")", 1608 croak ("%s, at character offset %d (before \"%s\")",
1609 dec.err, 1609 dec.err,
1610 ptr_to_index (string, dec.cur), 1610 (int)ptr_to_index (string, dec.cur),
1611 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)"); 1611 dec.cur != dec.end ? SvPV_nolen (uni) : "(end of string)");
1612 } 1612 }
1613 1613
1614 sv = sv_2mortal (sv); 1614 sv = sv_2mortal (sv);
1615 1615
1992 if (self->incr_pos > self->max_size && self->max_size) 1992 if (self->incr_pos > self->max_size && self->max_size)
1993 croak ("attempted decode of JSON text of %lu bytes size, but max_size is set to %lu", 1993 croak ("attempted decode of JSON text of %lu bytes size, but max_size is set to %lu",
1994 (unsigned long)self->incr_pos, (unsigned long)self->max_size); 1994 (unsigned long)self->incr_pos, (unsigned long)self->max_size);
1995 1995
1996 if (!INCR_DONE (self)) 1996 if (!INCR_DONE (self))
1997 {
1998 // as an optimisation, do not accumulate white space in the incr buffer
1999 if (self->incr_mode == INCR_M_WS && self->incr_pos)
2000 {
2001 self->incr_pos = 0;
2002 SvCUR_set (self->incr_text, 0);
2003 }
2004
1997 break; 2005 break;
2006 }
1998 } 2007 }
1999 2008
2000 XPUSHs (decode_json (self->incr_text, self, &offset)); 2009 XPUSHs (decode_json (self->incr_text, self, &offset));
2001 2010
2002 self->incr_pos -= offset - SvPVX (self->incr_text); 2011 self->incr_pos -= offset - SvPVX (self->incr_text);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines