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.50 by root, Thu Feb 25 02:29:22 2016 UTC vs.
Revision 1.51 by root, Sun Apr 24 13:15:19 2016 UTC

100#define F_SHRINK 0x00000001UL 100#define F_SHRINK 0x00000001UL
101#define F_ALLOW_UNKNOWN 0x00000002UL 101#define F_ALLOW_UNKNOWN 0x00000002UL
102#define F_ALLOW_SHARING 0x00000004UL 102#define F_ALLOW_SHARING 0x00000004UL
103#define F_ALLOW_CYCLES 0x00000008UL 103#define F_ALLOW_CYCLES 0x00000008UL
104#define F_PACK_STRINGS 0x00000010UL 104#define F_PACK_STRINGS 0x00000010UL
105#define F_UTF8_STRINGS 0x00000020UL
105#define F_VALIDATE_UTF8 0x00000020UL 106#define F_VALIDATE_UTF8 0x00000040UL
106 107
107#define INIT_SIZE 32 // initial scalar size to be allocated 108#define INIT_SIZE 32 // initial scalar size to be allocated
108 109
109#define SB do { 110#define SB do {
110#define SE } while (0) 111#define SE } while (0)
279} 280}
280 281
281ecb_inline void 282ecb_inline void
282encode_str (enc_t *enc, int utf8, char *str, STRLEN len) 283encode_str (enc_t *enc, int utf8, char *str, STRLEN len)
283{ 284{
285 if (ecb_expect_false (enc->cbor.flags & F_UTF8_STRINGS))
286 if (!utf8)
287 {
288 SV *sv = sv_newmortal ();
289 char *s; STRLEN l;
290
291 sv_setpvn (sv, str, len);
292
293 s = SvPVutf8 (sv, l);
294 encode_str (enc, 1, s, l);
295 return;
296 }
297
284 encode_uint (enc, utf8 ? MAJOR_TEXT : MAJOR_BYTES, len); 298 encode_uint (enc, utf8 ? MAJOR_TEXT : MAJOR_BYTES, len);
285 need (enc, len); 299 need (enc, len);
286 memcpy (enc->cur, str, len); 300 memcpy (enc->cur, str, len);
287 enc->cur += len; 301 enc->cur += len;
288} 302}
1390 shrink = F_SHRINK 1404 shrink = F_SHRINK
1391 allow_unknown = F_ALLOW_UNKNOWN 1405 allow_unknown = F_ALLOW_UNKNOWN
1392 allow_sharing = F_ALLOW_SHARING 1406 allow_sharing = F_ALLOW_SHARING
1393 allow_cycles = F_ALLOW_CYCLES 1407 allow_cycles = F_ALLOW_CYCLES
1394 pack_strings = F_PACK_STRINGS 1408 pack_strings = F_PACK_STRINGS
1409 utf8_strings = F_UTF8_STRINGS
1395 validate_utf8 = F_VALIDATE_UTF8 1410 validate_utf8 = F_VALIDATE_UTF8
1396 PPCODE: 1411 PPCODE:
1397{ 1412{
1398 if (enable) 1413 if (enable)
1399 self->flags |= ix; 1414 self->flags |= ix;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines