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.96 by root, Sat May 30 06:26:05 2009 UTC vs.
Revision 1.98 by root, Fri Jul 17 14:33:45 2009 UTC

471 471
472 // for canonical output we have to sort by keys first 472 // for canonical output we have to sort by keys first
473 // actually, this is mostly due to the stupid so-called 473 // actually, this is mostly due to the stupid so-called
474 // security workaround added somewhere in 5.8.x 474 // security workaround added somewhere in 5.8.x
475 // that randomises hash orderings 475 // that randomises hash orderings
476 if (enc->json.flags & F_CANONICAL) 476 if (enc->json.flags & F_CANONICAL && !SvRMAGICAL (hv))
477 { 477 {
478 int count = hv_iterinit (hv); 478 int count = hv_iterinit (hv);
479 479
480 if (SvMAGICAL (hv)) 480 if (SvMAGICAL (hv))
481 { 481 {
1084 1084
1085 // special case the rather common 1..5-digit-int case 1085 // special case the rather common 1..5-digit-int case
1086 if (*start == '-') 1086 if (*start == '-')
1087 switch (len) 1087 switch (len)
1088 { 1088 {
1089 case 2: return newSViv (-( start [1] - '0' * 1)); 1089 case 2: return newSViv (-(IV)( start [1] - '0' * 1));
1090 case 3: return newSViv (-( start [1] * 10 + start [2] - '0' * 11)); 1090 case 3: return newSViv (-(IV)( start [1] * 10 + start [2] - '0' * 11));
1091 case 4: return newSViv (-( start [1] * 100 + start [2] * 10 + start [3] - '0' * 111)); 1091 case 4: return newSViv (-(IV)( start [1] * 100 + start [2] * 10 + start [3] - '0' * 111));
1092 case 5: return newSViv (-( start [1] * 1000 + start [2] * 100 + start [3] * 10 + start [4] - '0' * 1111)); 1092 case 5: return newSViv (-(IV)( start [1] * 1000 + start [2] * 100 + start [3] * 10 + start [4] - '0' * 1111));
1093 case 6: return newSViv (-(start [1] * 10000 + start [2] * 1000 + start [3] * 100 + start [4] * 10 + start [5] - '0' * 11111)); 1093 case 6: return newSViv (-(IV)(start [1] * 10000 + start [2] * 1000 + start [3] * 100 + start [4] * 10 + start [5] - '0' * 11111));
1094 } 1094 }
1095 else 1095 else
1096 switch (len) 1096 switch (len)
1097 { 1097 {
1098 case 1: return newSViv ( start [0] - '0' * 1); 1098 case 1: return newSViv ( start [0] - '0' * 1);
1099 case 2: return newSViv ( start [0] * 10 + start [1] - '0' * 11); 1099 case 2: return newSViv ( start [0] * 10 + start [1] - '0' * 11);
1100 case 3: return newSViv ( start [0] * 100 + start [1] * 10 + start [2] - '0' * 111); 1100 case 3: return newSViv ( start [0] * 100 + start [1] * 10 + start [2] - '0' * 111);
1101 case 4: return newSViv ( start [0] * 1000 + start [1] * 100 + start [2] * 10 + start [3] - '0' * 1111); 1101 case 4: return newSViv ( start [0] * 1000 + start [1] * 100 + start [2] * 10 + start [3] - '0' * 1111);
1102 case 5: return newSViv ( start [0] * 10000 + start [1] * 1000 + start [2] * 100 + start [3] * 10 + start [4] - '0' * 11111); 1102 case 5: return newSViv ( start [0] * 10000 + start [1] * 1000 + start [2] * 100 + start [3] * 10 + start [4] - '0' * 11111);
1103 } 1103 }
1104 1104
1105 { 1105 {
1106 UV uv; 1106 UV uv;
1107 int numtype = grok_number (start, len, &uv); 1107 int numtype = grok_number (start, len, &uv);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines