XS.c

filter: Statementstmt 81.6% 627 / 768 Branchbran 47.8% 266 / 556 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 67.4% 893 / 1324 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/Magic.c ↑ Summary MemoryBuffer.xs »
1 /*
2 * This file was generated automatically by ExtUtils::ParseXS version 3.63 from the
3 * contents of XS.xs. Do not edit this file, edit XS.xs instead.
4 *
5 * ANY CHANGES MADE HERE WILL BE LOST!
6 *
7 */
8  
9 #line 1 "XS.xs"
10 #include "EXTERN.h"
11 #include "perl.h"
12 #include "XSUB.h"
13  
14 #include "ppport.h"
15  
16 #include <stdlib.h>
17 #include <stdint.h>
18 #include <inttypes.h>
19  
20 #include "xs_object_magic.h"
21 #include "common.h"
22 #include "buffer.c"
23 #include "memory_buffer.h"
24 #include "binary_protocol.h"
25  
26 // Include the XS::Object::Magic code inline to simplify things
27 #include "Magic.c"
28  
29 /* Detect Endianness using Perl's configuration */
30 #undef __LITTLE_ENDIAN
31 #undef __BIG_ENDIAN
32 #undef __BYTE_ORDER
33  
34 #define __LITTLE_ENDIAN 1234
35 #define __BIG_ENDIAN 4321
36  
37 #ifdef BYTEORDER
38 # if (BYTEORDER == 0x1234 || BYTEORDER == 0x12345678)
39 # define __BYTE_ORDER __LITTLE_ENDIAN
40 # elif (BYTEORDER == 0x4321 || BYTEORDER == 0x87654321)
41 # define __BYTE_ORDER __BIG_ENDIAN
42 # endif
43 #endif
44  
45 /* Fallback for common platforms if BYTEORDER is missing */
46 #ifndef __BYTE_ORDER
47 # if defined(_WIN32) || defined(__i386__) || defined(__x86_64__) || defined(__alpha__)
48 # define __BYTE_ORDER __LITTLE_ENDIAN
49 # else
50 # error "Cannot determine endianness. Please check your Perl configuration."
51 # endif
52 #endif
53  
54 /* Define a high-performance 64-bit byte swapper */
55 #ifndef bswap_64
56 # if defined(_MSC_VER)
57 # include <stdlib.h>
58 # define bswap_64(n) _byteswap_uint64(n)
59 # elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
60 # define bswap_64(n) __builtin_bswap64(n)
61 # else
62 # define bswap_64(n) \
63 ( (((n) & 0xff00000000000000ull) >> 56) \
64 | (((n) & 0x00ff000000000000ull) >> 40) \
65 | (((n) & 0x0000ff0000000000ull) >> 24) \
66 | (((n) & 0x000000ff00000000ull) >> 8) \
67 | (((n) & 0x00000000ff000000ull) << 8) \
68 | (((n) & 0x0000000000ff0000ull) << 24) \
69 | (((n) & 0x000000000000ff00ull) << 40) \
70 | (((n) & 0x00000000000000ffull) << 56) )
71 # endif
72 #endif
73  
74 /* Define Host/Network macros */
75 #if __BYTE_ORDER == __BIG_ENDIAN
76 # define ntohll(n) (n)
77 # define htonll(n) (n)
78 # define htolell(n) bswap_64(n)
79 # define letohll(n) bswap_64(n)
80 #else
81 # define ntohll(n) bswap_64(n)
82 # define htonll(n) bswap_64(n)
83 # define htolell(n) (n)
84 # define letohll(n) (n)
85 #endif
86  
87 #line 88 "XS.c"
88 #ifndef PERL_UNUSED_VAR
89 # define PERL_UNUSED_VAR(var) if (0) var = var
90 #endif
91  
92 #ifndef dVAR
93 # define dVAR dNOOP
94 #endif
95  
96  
97 /* This stuff is not part of the API! You have been warned. */
98 #ifndef PERL_VERSION_DECIMAL
99 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
100 #endif
101 #ifndef PERL_DECIMAL_VERSION
102 # define PERL_DECIMAL_VERSION \
103 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
104 #endif
105 #ifndef PERL_VERSION_GE
106 # define PERL_VERSION_GE(r,v,s) \
107 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
108 #endif
109 #ifndef PERL_VERSION_LE
110 # define PERL_VERSION_LE(r,v,s) \
111 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
112 #endif
113  
114 /* XS_INTERNAL is the explicit static-linkage variant of the default
115 * XS macro.
116 *
117 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
118 * "static", ie. it exports XSUB symbols. You probably don't want that
119 * for anything but the BOOT XSUB.
120 *
121 * See XSUB.h in core!
122 */
123  
124  
125 /* TODO: This might be compatible further back than 5.10.0. */
126 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
127 # undef XS_EXTERNAL
128 # undef XS_INTERNAL
129 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
130 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
131 # define XS_INTERNAL(name) static XSPROTO(name)
132 # endif
133 # if defined(__SYMBIAN32__)
134 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
135 # define XS_INTERNAL(name) EXPORT_C static XSPROTO(name)
136 # endif
137 # ifndef XS_EXTERNAL
138 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
139 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
140 # define XS_INTERNAL(name) static void name(pTHX_ CV* cv __attribute__unused__)
141 # else
142 # ifdef __cplusplus
143 # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
144 # define XS_INTERNAL(name) static XSPROTO(name)
145 # else
146 # define XS_EXTERNAL(name) XSPROTO(name)
147 # define XS_INTERNAL(name) static XSPROTO(name)
148 # endif
149 # endif
150 # endif
151 #endif
152  
153 /* perl >= 5.10.0 && perl <= 5.15.1 */
154  
155  
156 /* The XS_EXTERNAL macro is used for functions that must not be static
157 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
158 * macro defined, the best we can do is assume XS is the same.
159 * Dito for XS_INTERNAL.
160 */
161 #ifndef XS_EXTERNAL
162 # define XS_EXTERNAL(name) XS(name)
163 #endif
164 #ifndef XS_INTERNAL
165 # define XS_INTERNAL(name) XS(name)
166 #endif
167  
168 /* Now, finally, after all this mess, we want an ExtUtils::ParseXS
169 * internal macro that we're free to redefine for varying linkage due
170 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
171 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
172 */
173  
174 #undef XS_EUPXS
175 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
176 # define XS_EUPXS(name) XS_EXTERNAL(name)
177 #else
178 /* default to internal */
179 # define XS_EUPXS(name) XS_INTERNAL(name)
180 #endif
181  
182 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
183 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
184  
185 /* prototype to pass -Wmissing-prototypes */
186 static void
187 S_croak_xs_usage(const CV *const cv, const char *const params);
188  
189 static void
190 S_croak_xs_usage(const CV *const cv, const char *const params)
191 {
192 const GV *const gv = CvGV(cv);
193  
194 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
195  
196 if (gv) {
197 const char *const gvname = GvNAME(gv);
198 const HV *const stash = GvSTASH(gv);
199 const char *const hvname = stash ? HvNAME(stash) : NULL;
200  
201 if (hvname)
202 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
203 else
204 Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
205 } else {
206 /* Pants. I don't think that it should be possible to get here. */
207 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
208 }
209 }
210 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
211  
212 #define croak_xs_usage S_croak_xs_usage
213  
214 #endif
215  
216 /* NOTE: the prototype of newXSproto() is different in versions of perls,
217 * so we define a portable version of newXSproto()
218 */
219 #ifdef newXS_flags
220 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
221 #else
222 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
223 #endif /* !defined(newXS_flags) */
224  
225 #if PERL_VERSION_LE(5, 21, 5)
226 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
227 #else
228 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
229 #endif
230  
231 /* simple backcompat versions of the TARGx() macros with no optimisation */
232 #ifndef TARGi
233 # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
234 # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
235 # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
236 #endif
237  
238 #line 239 "XS.c"
239  
240 /* INCLUDE: Including 'MemoryBuffer.xs' from 'XS.xs' */
241  
242  
243 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_new); /* prototype to pass -Wmissing-prototypes */
244 3 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_new)
245 {
246 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
247 3 ▶ if (items < 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 1) 0 3 3
248 0 croak_xs_usage(cv, "klass, ...");
249 {
250 SV * RETVAL;
251 3 ▶ char * klass = (char *)SvPV_nolen(ST(0))
Branch: 1 branch
BranchTrueFalseTotal
char * klass = (char *)SvPV_nolen(ST(0)) 3 0 3
252 ;
253 #line 6 "./MemoryBuffer.xs"
254 {
255 int bufsize = 8192;
256 TMemoryBuffer *mbuf;
257 New(0, mbuf, sizeof(TMemoryBuffer), TMemoryBuffer);
258 New(0, mbuf->buffer, sizeof(Buffer), Buffer);
259  
260 MEM_TRACE("new()\n");
261 MEM_TRACE(" New mbuf @ %p\n", mbuf);
262 MEM_TRACE(" New buffer @ %p\n", mbuf->buffer);
263  
264 if (items > 1 && SvIOK_UV(ST(1)))
265 bufsize = SvIV(ST(1));
266  
267 buffer_init(mbuf->buffer, bufsize);
268  
269 RETVAL = xs_object_magic_create(
270 aTHX_
271 (void *)mbuf,
272 gv_stashpv(klass, 0)
273 );
274 }
275 #line 276 "XS.c"
276 3 RETVAL = sv_2mortal(RETVAL);
277 3 ST(0) = RETVAL;
278 }
279 3 XSRETURN(1);
280 }
281  
282  
283 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_isOpen); /* prototype to pass -Wmissing-prototypes */
284 0 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_isOpen)
285 {
286 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
287 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
288 0 croak_xs_usage(cv, "SV *");
289 {
290 int RETVAL;
291 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
292 #line 33 "./MemoryBuffer.xs"
293 {
294 RETVAL = 1;
295 }
296 #line 297 "XS.c"
297 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
298 0 ST(0) = TARG;
299 }
300 0 XSRETURN(1);
301 }
302  
303  
304 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_open); /* prototype to pass -Wmissing-prototypes */
305 0 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_open)
306 {
307 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
308 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
309 0 croak_xs_usage(cv, "SV *");
310 {
311 #line 42 "./MemoryBuffer.xs"
312 { }
313 #line 314 "XS.c"
314 }
315 0 XSRETURN_EMPTY;
316 }
317  
318  
319 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_close); /* prototype to pass -Wmissing-prototypes */
320 0 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_close)
321 {
322 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
323 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
324 0 croak_xs_usage(cv, "SV *");
325 {
326 #line 47 "./MemoryBuffer.xs"
327 { }
328 #line 329 "XS.c"
329 }
330 0 XSRETURN_EMPTY;
331 }
332  
333  
334 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_flush); /* prototype to pass -Wmissing-prototypes */
335 0 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_flush)
336 {
337 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
338 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
339 0 croak_xs_usage(cv, "SV *");
340 {
341 #line 52 "./MemoryBuffer.xs"
342 { }
343 #line 344 "XS.c"
344 }
345 0 XSRETURN_EMPTY;
346 }
347  
348  
349 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_available); /* prototype to pass -Wmissing-prototypes */
350 1 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_available)
351 {
352 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
353 1 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 1 1
354 0 croak_xs_usage(cv, "mbuf");
355 {
356 int RETVAL;
357 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
358 1 TMemoryBuffer * mbuf = (TMemoryBuffer *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "mbuf")
359 ;
360 #line 57 "./MemoryBuffer.xs"
361 {
362 RETVAL = buffer_len(mbuf->buffer);
363 }
364 #line 365 "XS.c"
365 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
366 1 ST(0) = TARG;
367 }
368 1 XSRETURN(1);
369 }
370  
371  
372 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_read); /* prototype to pass -Wmissing-prototypes */
373 56 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_read)
374 {
375 56 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 56 56
376 56 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 56 56
377 0 croak_xs_usage(cv, "mbuf, len");
378 {
379 SV * RETVAL;
380 56 TMemoryBuffer * mbuf = (TMemoryBuffer *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "mbuf")
381 ;
382 56 int len = (int)SvIV(ST(1))
383 ;
384 #line 66 "./MemoryBuffer.xs"
385 {
386 int avail = buffer_len(mbuf->buffer);
387  
388 if (avail == 0) {
389 RETVAL = newSVpvn("", 0);
390 }
391 else {
392 if (avail < len)
393 len = avail;
394  
395 DEBUG_TRACE("read(%d)\n", len);
396 RETVAL = newSVpvn( buffer_ptr(mbuf->buffer), len );
397 buffer_consume(mbuf->buffer, len);
398 }
399 }
400 #line 401 "XS.c"
401 56 RETVAL = sv_2mortal(RETVAL);
402 56 ST(0) = RETVAL;
403 }
404 56 XSRETURN(1);
405 }
406  
407  
408 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_readAll); /* prototype to pass -Wmissing-prototypes */
409 2 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_readAll)
410 {
411 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
412 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
413 0 croak_xs_usage(cv, "mbuf, len");
414 {
415 SV * RETVAL;
416 2 TMemoryBuffer * mbuf = (TMemoryBuffer *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "mbuf")
417 ;
418 2 int len = (int)SvIV(ST(1))
419 ;
420 #line 87 "./MemoryBuffer.xs"
421 {
422 int avail = buffer_len(mbuf->buffer);
423  
424 if (avail < len) {
425 THROW_SV("Thrift::TTransportException", newSVpvf("Attempt to readAll(%d) found only %d available", len, avail));
426 }
427  
428 DEBUG_TRACE("readAll(%d)\n", len);
429 #ifdef XS_DEBUG
430 //buffer_dump(mbuf->buffer, len);
431 #endif
432  
433 RETVAL = newSVpvn( buffer_ptr(mbuf->buffer), len );
434 buffer_consume(mbuf->buffer, len);
435 }
436 #line 437 "XS.c"
437 1 RETVAL = sv_2mortal(RETVAL);
438 1 ST(0) = RETVAL;
439 }
440 1 XSRETURN(1);
441 }
442  
443  
444 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_write); /* prototype to pass -Wmissing-prototypes */
445 3 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_write)
446 {
447 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
448 3 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 0 3 3
449 0 croak_xs_usage(cv, "mbuf, buf, ...");
450 {
451 3 TMemoryBuffer * mbuf = (TMemoryBuffer *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "mbuf")
452 ;
453 3 ▶ SV * buf = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * buf = ST(1) 0 3 3
454 ;
455 #line 108 "./MemoryBuffer.xs"
456 {
457 int len;
458  
459 if (items > 2)
460 len = SvIV(ST(2));
461 else
462 len = sv_len(buf);
463  
464 buffer_append(mbuf->buffer, (void *)SvPVX(buf), len);
465  
466 DEBUG_TRACE("write(%d)\n", len);
467 #ifdef XS_DEBUG
468 //buffer_dump(mbuf->buffer, 0);
469 #endif
470 }
471 #line 472 "XS.c"
472 }
473 3 XSRETURN_EMPTY;
474 }
475  
476  
477 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_DESTROY); /* prototype to pass -Wmissing-prototypes */
478 3 XS_EUPXS(XS_Thrift__XS__MemoryBuffer_DESTROY)
479 {
480 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
481 3 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 3 3
482 0 croak_xs_usage(cv, "mbuf");
483 {
484 3 TMemoryBuffer * mbuf = (TMemoryBuffer *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "mbuf")
485 ;
486 #line 127 "./MemoryBuffer.xs"
487 {
488 MEM_TRACE("DESTROY()\n");
489 MEM_TRACE(" free buffer @ %p\n", mbuf->buffer);
490 MEM_TRACE(" free mbuf @ %p\n", mbuf);
491  
492 buffer_free(mbuf->buffer);
493 Safefree(mbuf->buffer);
494 Safefree(mbuf);
495 }
496 #line 497 "XS.c"
497 }
498 3 XSRETURN_EMPTY;
499 }
500  
501  
502 /* INCLUDE: Returning to 'XS.xs' from 'MemoryBuffer.xs' */
503  
504  
505 /* INCLUDE: Including 'BinaryProtocol.xs' from 'XS.xs' */
506  
507  
508 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_new); /* prototype to pass -Wmissing-prototypes */
509 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_new)
510 {
511 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
512 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
513 0 croak_xs_usage(cv, "klass, transport");
514 {
515 SV * RETVAL;
516 2 ▶ char * klass = (char *)SvPV_nolen(ST(0))
Branch: 1 branch
BranchTrueFalseTotal
char * klass = (char *)SvPV_nolen(ST(0)) 2 0 2
517 ;
518 2 SV * transport = ST(1)
519 ;
520 #line 6 "./BinaryProtocol.xs"
521 {
522 TBinaryProtocol *p;
523 New(0, p, sizeof(TBinaryProtocol), TBinaryProtocol);
524 New(0, p->last_fields, sizeof(struct fieldq), struct fieldq);
525  
526 MEM_TRACE("new()\n");
527 MEM_TRACE(" New p @ %p\n", p);
528 MEM_TRACE(" New last_fields @ %p\n", p->last_fields);
529  
530 if (sv_isa(transport, "Thrift::XS::MemoryBuffer"))
531 p->mbuf = (TMemoryBuffer *)xs_object_magic_get_struct_rv_pretty(aTHX_ transport, "mbuf");
532 else
533 p->mbuf = NULL;
534  
535 p->transport = transport;
536  
537 p->bool_type = -1;
538 p->bool_id = -1;
539 p->bool_value_id = -1;
540 p->last_field_id = 0;
541  
542 SIMPLEQ_INIT(p->last_fields);
543  
544 RETVAL = xs_object_magic_create(
545 aTHX_
546 (void *)p,
547 gv_stashpv(klass, 0)
548 );
549 }
550 #line 551 "XS.c"
551 2 RETVAL = sv_2mortal(RETVAL);
552 2 ST(0) = RETVAL;
553 }
554 2 XSRETURN(1);
555 }
556  
557  
558 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_DESTROY); /* prototype to pass -Wmissing-prototypes */
559 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_DESTROY)
560 {
561 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
562 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
563 0 croak_xs_usage(cv, "p");
564 {
565 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
566 ;
567 #line 41 "./BinaryProtocol.xs"
568 {
569 MEM_TRACE("DESTROY()\n");
570  
571 // clear field queue
572 struct field_entry *entry;
573 while (!SIMPLEQ_EMPTY(p->last_fields)) {
574 entry = SIMPLEQ_FIRST(p->last_fields);
575 SIMPLEQ_REMOVE_HEAD(p->last_fields, entries);
576 MEM_TRACE(" free entry @ %p\n", entry);
577 Safefree(entry);
578 }
579  
580 MEM_TRACE(" free last_fields @ %p\n", p->last_fields);
581 Safefree(p->last_fields);
582 MEM_TRACE(" free p @ %p\n", p);
583 Safefree(p);
584 }
585 #line 586 "XS.c"
586 }
587 2 XSRETURN_EMPTY;
588 }
589  
590  
591 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_getTransport); /* prototype to pass -Wmissing-prototypes */
592 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_getTransport)
593 {
594 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
595 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
596 0 croak_xs_usage(cv, "p");
597 {
598 SV * RETVAL;
599 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
600 ;
601 #line 62 "./BinaryProtocol.xs"
602 {
603 SvREFCNT_inc(p->transport);
604 RETVAL = p->transport;
605 }
606 #line 607 "XS.c"
607 2 RETVAL = sv_2mortal(RETVAL);
608 2 ST(0) = RETVAL;
609 }
610 2 XSRETURN(1);
611 }
612  
613  
614 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMessageBegin); /* prototype to pass -Wmissing-prototypes */
615 3 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMessageBegin)
616 {
617 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
618 3 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 3 3
619 0 croak_xs_usage(cv, "p, name, type, seqid");
620 {
621 int RETVAL;
622 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
623 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
624 ;
625 3 SV * name = ST(1)
626 ;
627 3 int type = (int)SvIV(ST(2))
628 ;
629 3 int seqid = (int)SvIV(ST(3))
630 ;
631 #line 72 "./BinaryProtocol.xs"
632 {
633 DEBUG_TRACE("writeMessageBegin()\n");
634 RETVAL = 0;
635  
636 SV *namecopy = sv_mortalcopy(name); // because we can't modify the original name
637 sv_utf8_encode(namecopy);
638 int namelen = sv_len(namecopy);
639 SV *data = sv_2mortal(newSV(8 + 4+namelen));
640 char i32[4];
641  
642 // i32 type
643 type = VERSION_1 | type;
644 INT_TO_I32(i32, type, 0);
645 sv_setpvn(data, i32, 4);
646 RETVAL += 4;
647  
648 // i32 len + string
649 INT_TO_I32(i32, namelen, 0);
650 sv_catpvn(data, i32, 4);
651 sv_catsv(data, namecopy);
652 RETVAL += 4 + namelen;
653  
654 // i32 seqid
655 INT_TO_I32(i32, seqid, 0);
656 sv_catpvn(data, i32, 4);
657 RETVAL += 4;
658  
659 WRITE_SV(p, data);
660 }
661 #line 662 "XS.c"
662 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 2 3
663 3 ST(0) = TARG;
664 }
665 3 XSRETURN(1);
666 }
667  
668  
669 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMessageEnd); /* prototype to pass -Wmissing-prototypes */
670 0 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMessageEnd)
671 {
672 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
673 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
674 0 croak_xs_usage(cv, "SV *");
675 {
676 int RETVAL;
677 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
678 #line 107 "./BinaryProtocol.xs"
679 {
680 RETVAL = 0;
681 }
682 #line 683 "XS.c"
683 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
684 0 ST(0) = TARG;
685 }
686 0 XSRETURN(1);
687 }
688  
689  
690 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeStructBegin); /* prototype to pass -Wmissing-prototypes */
691 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeStructBegin)
692 {
693 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
694 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
695 0 croak_xs_usage(cv, "SV *, SV *");
696 {
697 int RETVAL;
698 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
699 #line 116 "./BinaryProtocol.xs"
700 {
701 RETVAL = 0;
702 }
703 #line 704 "XS.c"
704 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
705 1 ST(0) = TARG;
706 }
707 1 XSRETURN(1);
708 }
709  
710  
711 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeStructEnd); /* prototype to pass -Wmissing-prototypes */
712 0 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeStructEnd)
713 {
714 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
715 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
716 0 croak_xs_usage(cv, "SV *");
717 {
718 int RETVAL;
719 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
720 #line 125 "./BinaryProtocol.xs"
721 {
722 RETVAL = 0;
723 }
724 #line 725 "XS.c"
725 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
726 0 ST(0) = TARG;
727 }
728 0 XSRETURN(1);
729 }
730  
731  
732 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeFieldBegin); /* prototype to pass -Wmissing-prototypes */
733 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeFieldBegin)
734 {
735 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
736 2 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 2 2
737 0 croak_xs_usage(cv, "p, name, type, id");
738 {
739 int RETVAL;
740 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
741 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
742 ;
743 2 SV * name = ST(1)
744 ;
745 2 int type = (int)SvIV(ST(2))
746 ;
747 2 ▶ int id = (int)SvIV(ST(3))
Branch: 1 branch
BranchTrueFalseTotal
int id = (int)SvIV(ST(3)) 2 0 2
748 ;
749 #line 134 "./BinaryProtocol.xs"
750 {
751 DEBUG_TRACE("writeFieldBegin(type %d, id %d)\n", type, id);
752 char data[3];
753 RETVAL = 0;
754  
755 PERL_UNUSED_VAR(name);
756 data[0] = type & 0xff; // byte
757 data[1] = (id >> 8) & 0xff; // i16
758 data[2] = id & 0xff;
759  
760 WRITE(p, data, 3);
761 RETVAL += 3;
762 }
763 #line 764 "XS.c"
764 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 1 2
765 2 ST(0) = TARG;
766 }
767 2 XSRETURN(1);
768 }
769  
770  
771 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeFieldEnd); /* prototype to pass -Wmissing-prototypes */
772 9 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeFieldEnd)
773 {
774 9 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 9 9
775 9 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 9 9
776 0 croak_xs_usage(cv, "SV *");
777 {
778 int RETVAL;
779 9 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 9 0 9
780 #line 153 "./BinaryProtocol.xs"
781 {
782 RETVAL = 0;
783 }
784 #line 785 "XS.c"
785 9 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 7 9
786 9 ST(0) = TARG;
787 }
788 9 XSRETURN(1);
789 }
790  
791  
792 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeFieldStop); /* prototype to pass -Wmissing-prototypes */
793 5 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeFieldStop)
794 {
795 5 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 5 5
796 5 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 5 5
797 0 croak_xs_usage(cv, "p");
798 {
799 int RETVAL;
800 5 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 5 0 5
801 5 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
802 ;
803 #line 162 "./BinaryProtocol.xs"
804 {
805 DEBUG_TRACE("writeFieldStop()\n");
806 RETVAL = 0;
807  
808 char data[1];
809 data[0] = T_STOP;
810  
811 WRITE(p, data, 1);
812 RETVAL += 1;
813 }
814 #line 815 "XS.c"
815 5 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 3 5
816 5 ST(0) = TARG;
817 }
818 5 XSRETURN(1);
819 }
820  
821  
822 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMapBegin); /* prototype to pass -Wmissing-prototypes */
823 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMapBegin)
824 {
825 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
826 2 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 2 2
827 0 croak_xs_usage(cv, "p, keytype, valtype, size");
828 {
829 int RETVAL;
830 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
831 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
832 ;
833 2 int keytype = (int)SvIV(ST(1))
834 ;
835 2 int valtype = (int)SvIV(ST(2))
836 ;
837 2 ▶ int size = (int)SvIV(ST(3))
Branch: 1 branch
BranchTrueFalseTotal
int size = (int)SvIV(ST(3)) 2 0 2
838 ;
839 #line 178 "./BinaryProtocol.xs"
840 {
841 DEBUG_TRACE("writeMapBegin(keytype %d, valtype %d, size %d)\n", keytype, valtype, size);
842 char data[6];
843 RETVAL = 0;
844  
845 data[0] = keytype & 0xff;
846 data[1] = valtype & 0xff;
847 INT_TO_I32(data, size, 2);
848  
849 WRITE(p, data, 6);
850 RETVAL += 6;
851 }
852 #line 853 "XS.c"
853 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 1 2
854 2 ST(0) = TARG;
855 }
856 2 XSRETURN(1);
857 }
858  
859  
860 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMapEnd); /* prototype to pass -Wmissing-prototypes */
861 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeMapEnd)
862 {
863 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
864 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
865 0 croak_xs_usage(cv, "SV *");
866 {
867 int RETVAL;
868 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
869 #line 196 "./BinaryProtocol.xs"
870 {
871 RETVAL = 0;
872 }
873 #line 874 "XS.c"
874 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 2 2
875 2 ST(0) = TARG;
876 }
877 2 XSRETURN(1);
878 }
879  
880  
881 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeListBegin); /* prototype to pass -Wmissing-prototypes */
882 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeListBegin)
883 {
884 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
885 2 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 2 2
886 0 croak_xs_usage(cv, "p, elemtype, size");
887 {
888 int RETVAL;
889 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
890 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
891 ;
892 2 int elemtype = (int)SvIV(ST(1))
893 ;
894 2 ▶ int size = (int)SvIV(ST(2))
Branch: 1 branch
BranchTrueFalseTotal
int size = (int)SvIV(ST(2)) 2 0 2
895 ;
896 #line 205 "./BinaryProtocol.xs"
897 {
898 DEBUG_TRACE("writeListBegin(elemtype %d, size %d)\n", elemtype, size);
899 char data[5];
900 RETVAL = 0;
901  
902 data[0] = elemtype & 0xff;
903 INT_TO_I32(data, size, 1);
904  
905 WRITE(p, data, 5);
906 RETVAL += 5;
907 }
908 #line 909 "XS.c"
909 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 1 2
910 2 ST(0) = TARG;
911 }
912 2 XSRETURN(1);
913 }
914  
915  
916 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeListEnd); /* prototype to pass -Wmissing-prototypes */
917 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeListEnd)
918 {
919 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
920 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
921 0 croak_xs_usage(cv, "SV *");
922 {
923 int RETVAL;
924 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
925 #line 222 "./BinaryProtocol.xs"
926 {
927 RETVAL = 0;
928 }
929 #line 930 "XS.c"
930 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 1 2
931 2 ST(0) = TARG;
932 }
933 2 XSRETURN(1);
934 }
935  
936  
937 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeSetBegin); /* prototype to pass -Wmissing-prototypes */
938 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeSetBegin)
939 {
940 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
941 2 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 2 2
942 0 croak_xs_usage(cv, "p, elemtype, size");
943 {
944 int RETVAL;
945 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
946 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
947 ;
948 2 int elemtype = (int)SvIV(ST(1))
949 ;
950 2 ▶ int size = (int)SvIV(ST(2))
Branch: 1 branch
BranchTrueFalseTotal
int size = (int)SvIV(ST(2)) 2 0 2
951 ;
952 #line 231 "./BinaryProtocol.xs"
953 {
954 DEBUG_TRACE("writeSetBegin(elemtype %d, size %d)\n", elemtype, size);
955 char data[5];
956 RETVAL = 0;
957  
958 data[0] = elemtype & 0xff;
959 INT_TO_I32(data, size, 1);
960  
961 WRITE(p, data, 5);
962 RETVAL += 5;
963 }
964 #line 965 "XS.c"
965 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 1 2
966 2 ST(0) = TARG;
967 }
968 2 XSRETURN(1);
969 }
970  
971  
972 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeSetEnd); /* prototype to pass -Wmissing-prototypes */
973 0 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeSetEnd)
974 {
975 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
976 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
977 0 croak_xs_usage(cv, "SV *");
978 {
979 int RETVAL;
980 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
981 #line 248 "./BinaryProtocol.xs"
982 {
983 RETVAL = 0;
984 }
985 #line 986 "XS.c"
986 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
987 0 ST(0) = TARG;
988 }
989 0 XSRETURN(1);
990 }
991  
992  
993 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeBool); /* prototype to pass -Wmissing-prototypes */
994 4 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeBool)
995 {
996 4 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 4 4
997 4 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 4 4
998 0 croak_xs_usage(cv, "p, value");
999 {
1000 int RETVAL;
1001 4 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 4 0 4
1002 4 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1003 ;
1004 4 SV * value = ST(1)
1005 ;
1006 #line 257 "./BinaryProtocol.xs"
1007 {
1008 DEBUG_TRACE("writeBool(%d)\n", SvTRUE(value) ? 1 : 0);
1009 char data[1];
1010 RETVAL = 0;
1011  
1012 data[0] = SvTRUE(value) ? 1 : 0;
1013  
1014 WRITE(p, data, 1);
1015 RETVAL += 1;
1016 }
1017 #line 1018 "XS.c"
1018 4 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 2 4
1019 4 ST(0) = TARG;
1020 }
1021 4 XSRETURN(1);
1022 }
1023  
1024  
1025 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeByte); /* prototype to pass -Wmissing-prototypes */
1026 4 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeByte)
1027 {
1028 4 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 4 4
1029 4 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 4 4
1030 0 croak_xs_usage(cv, "p, value");
1031 {
1032 int RETVAL;
1033 4 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 4 0 4
1034 4 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1035 ;
1036 4 SV * value = ST(1)
1037 ;
1038 #line 273 "./BinaryProtocol.xs"
1039 {
1040 DEBUG_TRACE("writeByte(%ld)\n", SvIV(value) & 0xff);
1041 char data[1];
1042 RETVAL = 0;
1043  
1044 data[0] = SvIV(value) & 0xff;
1045  
1046 WRITE(p, data, 1);
1047 RETVAL += 1;
1048 }
1049 #line 1050 "XS.c"
1050 4 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 2 4
1051 4 ST(0) = TARG;
1052 }
1053 4 XSRETURN(1);
1054 }
1055  
1056  
1057 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeI16); /* prototype to pass -Wmissing-prototypes */
1058 3 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeI16)
1059 {
1060 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
1061 3 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 3 3
1062 0 croak_xs_usage(cv, "p, value");
1063 {
1064 int RETVAL;
1065 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
1066 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1067 ;
1068 3 ▶ int value = (int)SvIV(ST(1))
Branch: 1 branch
BranchTrueFalseTotal
int value = (int)SvIV(ST(1)) 3 0 3
1069 ;
1070 #line 289 "./BinaryProtocol.xs"
1071 {
1072 DEBUG_TRACE("writeI16(%d)\n", value);
1073 char data[2];
1074 RETVAL = 0;
1075  
1076 INT_TO_I16(data, value, 0);
1077  
1078 WRITE(p, data, 2);
1079 RETVAL += 2;
1080 }
1081 #line 1082 "XS.c"
1082 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 1 3
1083 3 ST(0) = TARG;
1084 }
1085 3 XSRETURN(1);
1086 }
1087  
1088  
1089 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeI32); /* prototype to pass -Wmissing-prototypes */
1090 3 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeI32)
1091 {
1092 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
1093 3 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 3 3
1094 0 croak_xs_usage(cv, "p, value");
1095 {
1096 int RETVAL;
1097 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
1098 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1099 ;
1100 3 ▶ int value = (int)SvIV(ST(1))
Branch: 1 branch
BranchTrueFalseTotal
int value = (int)SvIV(ST(1)) 3 0 3
1101 ;
1102 #line 305 "./BinaryProtocol.xs"
1103 {
1104 DEBUG_TRACE("writeI32(%d)\n", value);
1105 char data[4];
1106 RETVAL = 0;
1107  
1108 INT_TO_I32(data, value, 0);
1109  
1110 WRITE(p, data, 4);
1111 RETVAL += 4;
1112 }
1113 #line 1114 "XS.c"
1114 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 1 3
1115 3 ST(0) = TARG;
1116 }
1117 3 XSRETURN(1);
1118 }
1119  
1120  
1121 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeI64); /* prototype to pass -Wmissing-prototypes */
1122 3 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeI64)
1123 {
1124 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
1125 3 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 3 3
1126 0 croak_xs_usage(cv, "p, value");
1127 {
1128 int RETVAL;
1129 3 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 3 0 3
1130 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1131 ;
1132 3 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 0 3 3
1133 ;
1134 #line 321 "./BinaryProtocol.xs"
1135 {
1136 char data[8];
1137 RETVAL = 0;
1138  
1139 // Stringify the value, then convert to an int64_t
1140 const char *str = SvPOK(value) ? SvPVX(value) : SvPV_nolen(value);
1141 int64_t i64 = (int64_t)strtoll(str, NULL, 10);
1142  
1143 DEBUG_TRACE("writeI64(%" PRId64 ") (from string %s)\n", i64, str);
1144  
1145 data[7] = i64 & 0xff;
1146 data[6] = (i64 >> 8) & 0xff;
1147 data[5] = (i64 >> 16) & 0xff;
1148 data[4] = (i64 >> 24) & 0xff;
1149 data[3] = (i64 >> 32) & 0xff;
1150 data[2] = (i64 >> 40) & 0xff;
1151 data[1] = (i64 >> 48) & 0xff;
1152 data[0] = (i64 >> 56) & 0xff;
1153  
1154 WRITE(p, data, 8);
1155 RETVAL += 8;
1156 }
1157 #line 1158 "XS.c"
1158 3 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 2 1 3
1159 3 ST(0) = TARG;
1160 }
1161 3 XSRETURN(1);
1162 }
1163  
1164  
1165 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeDouble); /* prototype to pass -Wmissing-prototypes */
1166 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeDouble)
1167 {
1168 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
1169 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
1170 0 croak_xs_usage(cv, "p, value");
1171 {
1172 int RETVAL;
1173 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
1174 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1175 ;
1176 2 SV * value = ST(1)
1177 ;
1178 #line 349 "./BinaryProtocol.xs"
1179 {
1180 DEBUG_TRACE("writeDouble(%f)\n", (double)SvNV(value));
1181 char data[8];
1182 union {
1183 double from;
1184 uint64_t to;
1185 } u;
1186 RETVAL = 0;
1187  
1188 u.from = (double)SvNV(value);
1189 uint64_t bits = u.to;
1190 bits = htonll(bits);
1191  
1192 memcpy(&data, (uint8_t *)&bits, 8);
1193  
1194 WRITE(p, data, 8);
1195 RETVAL += 8;
1196 }
1197 #line 1198 "XS.c"
1198 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 1 2
1199 2 ST(0) = TARG;
1200 }
1201 2 XSRETURN(1);
1202 }
1203  
1204  
1205 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeString); /* prototype to pass -Wmissing-prototypes */
1206 6 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_writeString)
1207 {
1208 6 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 6 6
1209 6 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 6 6
1210 0 croak_xs_usage(cv, "p, value");
1211 {
1212 int RETVAL;
1213 6 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 6 0 6
1214 6 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1215 ;
1216 6 SV * value = ST(1)
1217 ;
1218 #line 373 "./BinaryProtocol.xs"
1219 {
1220 DEBUG_TRACE("writeString(%s)\n", SvPVX(value));
1221 RETVAL = 0;
1222  
1223 SV *valuecopy = sv_mortalcopy(value);
1224 if (SvUTF8(value) != 0) {
1225 sv_utf8_encode(valuecopy);
1226 }
1227 int len = sv_len(valuecopy);
1228 SV *data = sv_2mortal(newSV(4 + len));
1229 char i32[4];
1230  
1231 INT_TO_I32(i32, len, 0);
1232 sv_setpvn(data, i32, 4);
1233 RETVAL += 4;
1234 sv_catsv(data, valuecopy);
1235 RETVAL += len;
1236  
1237 WRITE_SV(p, data);
1238 }
1239 #line 1240 "XS.c"
1240 6 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 4 2 6
1241 6 ST(0) = TARG;
1242 }
1243 6 XSRETURN(1);
1244 }
1245  
1246  
1247 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMessageBegin); /* prototype to pass -Wmissing-prototypes */
1248 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMessageBegin)
1249 {
1250 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1251 1 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 1 1
1252 0 croak_xs_usage(cv, "p, name, type, seqid");
1253 {
1254 int RETVAL;
1255 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1256 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1257 ;
1258 1 SV * name = ST(1)
1259 ;
1260 1 SV * type = ST(2)
1261 ;
1262 1 ▶ SV * seqid = ST(3)
Branch: 1 branch
BranchTrueFalseTotal
SV * seqid = ST(3) 1 0 1
1263 ;
1264 #line 399 "./BinaryProtocol.xs"
1265 {
1266 DEBUG_TRACE("readMessageBegin()\n");
1267 RETVAL = 0;
1268  
1269 SV *tmp;
1270 int version;
1271 char *tmps;
1272  
1273 // read version + type
1274 READ_SV(p, tmp, 4);
1275 tmps = SvPVX(tmp);
1276 I32_TO_INT(version, tmps, 0);
1277 RETVAL += 4;
1278  
1279 if (version < 0) {
1280 if ((version & VERSION_MASK) != VERSION_1) {
1281 THROW("Thrift::TException", "Missing version identifier");
1282 }
1283 // set type
1284 if (SvROK(type))
1285 sv_setiv(SvRV(type), version & 0x000000ff);
1286  
1287 // read string
1288 {
1289 uint32_t len;
1290 READ_SV(p, tmp, 4);
1291 tmps = SvPVX(tmp);
1292 I32_TO_INT(len, tmps, 0);
1293 RETVAL += 4;
1294 if (len) {
1295 READ_SV(p, tmp, len);
1296 sv_utf8_decode(tmp);
1297 RETVAL += len;
1298 if (SvROK(name))
1299 sv_setsv(SvRV(name), tmp);
1300 }
1301 else {
1302 if (SvROK(name))
1303 sv_setpv(SvRV(name), "");
1304 }
1305 }
1306  
1307 // read seqid
1308 {
1309 int s;
1310 READ_SV(p, tmp, 4);
1311 tmps = SvPVX(tmp);
1312 I32_TO_INT(s, tmps, 0);
1313 RETVAL += 4;
1314 if (SvROK(seqid))
1315 sv_setiv(SvRV(seqid), s);
1316 }
1317 }
1318 else {
1319 THROW("Thrift::TException", "Missing version identifier");
1320 }
1321 }
1322 #line 1323 "XS.c"
1323 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1324 1 ST(0) = TARG;
1325 }
1326 1 XSRETURN(1);
1327 }
1328  
1329  
1330 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMessageEnd); /* prototype to pass -Wmissing-prototypes */
1331 0 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMessageEnd)
1332 {
1333 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
1334 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
1335 0 croak_xs_usage(cv, "SV *");
1336 {
1337 int RETVAL;
1338 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1339 #line 462 "./BinaryProtocol.xs"
1340 {
1341 RETVAL = 0;
1342 }
1343 #line 1344 "XS.c"
1344 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1345 0 ST(0) = TARG;
1346 }
1347 0 XSRETURN(1);
1348 }
1349  
1350  
1351 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readStructBegin); /* prototype to pass -Wmissing-prototypes */
1352 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readStructBegin)
1353 {
1354 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1355 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
1356 0 croak_xs_usage(cv, "SV *, name");
1357 {
1358 int RETVAL;
1359 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1360 1 ▶ SV * name = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * name = ST(1) 1 0 1
1361 ;
1362 #line 471 "./BinaryProtocol.xs"
1363 {
1364 DEBUG_TRACE("readStructBegin()\n");
1365 RETVAL = 0;
1366  
1367 if (SvROK(name))
1368 sv_setpv(SvRV(name), "");
1369 }
1370 #line 1371 "XS.c"
1371 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1372 1 ST(0) = TARG;
1373 }
1374 1 XSRETURN(1);
1375 }
1376  
1377  
1378 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readStructEnd); /* prototype to pass -Wmissing-prototypes */
1379 0 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readStructEnd)
1380 {
1381 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
1382 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
1383 0 croak_xs_usage(cv, "SV *");
1384 {
1385 int RETVAL;
1386 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1387 #line 484 "./BinaryProtocol.xs"
1388 {
1389 RETVAL = 0;
1390 }
1391 #line 1392 "XS.c"
1392 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1393 0 ST(0) = TARG;
1394 }
1395 0 XSRETURN(1);
1396 }
1397  
1398  
1399 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readFieldBegin); /* prototype to pass -Wmissing-prototypes */
1400 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readFieldBegin)
1401 {
1402 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1403 1 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 1 1
1404 0 croak_xs_usage(cv, "p, name, fieldtype, fieldid");
1405 {
1406 int RETVAL;
1407 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1408 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1409 ;
1410 1 SV * name = ST(1)
1411 ;
1412 1 SV * fieldtype = ST(2)
1413 ;
1414 1 ▶ SV * fieldid = ST(3)
Branch: 1 branch
BranchTrueFalseTotal
SV * fieldid = ST(3) 1 0 1
1415 ;
1416 #line 493 "./BinaryProtocol.xs"
1417 {
1418 DEBUG_TRACE("readFieldBegin()\n");
1419 SV *tmp;
1420 char *tmps;
1421 RETVAL = 0;
1422  
1423 PERL_UNUSED_VAR(name);
1424 READ_SV(p, tmp, 1);
1425 tmps = SvPVX(tmp);
1426 RETVAL += 1;
1427  
1428 // fieldtype byte
1429 if (SvROK(fieldtype))
1430 sv_setiv(SvRV(fieldtype), tmps[0]);
1431  
1432 if (tmps[0] == T_STOP) {
1433 if (SvROK(fieldid))
1434 sv_setiv(SvRV(fieldid), 0);
1435 }
1436 else {
1437 // fieldid i16
1438 READ_SV(p, tmp, 2);
1439 tmps = SvPVX(tmp);
1440 int fid;
1441 I16_TO_INT(fid, tmps, 0);
1442 RETVAL += 2;
1443 if (SvROK(fieldid))
1444 sv_setiv(SvRV(fieldid), fid);
1445 }
1446 }
1447 #line 1448 "XS.c"
1448 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1449 1 ST(0) = TARG;
1450 }
1451 1 XSRETURN(1);
1452 }
1453  
1454  
1455 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readFieldEnd); /* prototype to pass -Wmissing-prototypes */
1456 6 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readFieldEnd)
1457 {
1458 6 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 6 6
1459 6 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 6 6
1460 0 croak_xs_usage(cv, "SV *");
1461 {
1462 int RETVAL;
1463 6 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 6 0 6
1464 #line 529 "./BinaryProtocol.xs"
1465 {
1466 RETVAL = 0;
1467 }
1468 #line 1469 "XS.c"
1469 6 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 3 3 6
1470 6 ST(0) = TARG;
1471 }
1472 6 XSRETURN(1);
1473 }
1474  
1475  
1476 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMapBegin); /* prototype to pass -Wmissing-prototypes */
1477 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMapBegin)
1478 {
1479 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1480 1 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 1 1
1481 0 croak_xs_usage(cv, "p, keytype, valtype, size");
1482 {
1483 int RETVAL;
1484 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1485 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1486 ;
1487 1 SV * keytype = ST(1)
1488 ;
1489 1 SV * valtype = ST(2)
1490 ;
1491 1 ▶ SV * size = ST(3)
Branch: 1 branch
BranchTrueFalseTotal
SV * size = ST(3) 1 0 1
1492 ;
1493 #line 538 "./BinaryProtocol.xs"
1494 {
1495 DEBUG_TRACE("readMapBegin()\n");
1496 SV *tmp;
1497 char *tmps;
1498 RETVAL = 0;
1499  
1500 READ_SV(p, tmp, 6);
1501 tmps = SvPVX(tmp);
1502 RETVAL += 6;
1503  
1504 // keytype byte
1505 if (SvROK(keytype))
1506 sv_setiv(SvRV(keytype), tmps[0]);
1507  
1508 // valtype byte
1509 if (SvROK(valtype))
1510 sv_setiv(SvRV(valtype), tmps[1]);
1511  
1512 // size i32
1513 int isize;
1514 I32_TO_INT(isize, tmps, 2);
1515 if (SvROK(size))
1516 sv_setiv(SvRV(size), isize);
1517 }
1518 #line 1519 "XS.c"
1519 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1520 1 ST(0) = TARG;
1521 }
1522 1 XSRETURN(1);
1523 }
1524  
1525  
1526 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMapEnd); /* prototype to pass -Wmissing-prototypes */
1527 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readMapEnd)
1528 {
1529 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
1530 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
1531 0 croak_xs_usage(cv, "SV *");
1532 {
1533 int RETVAL;
1534 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
1535 #line 568 "./BinaryProtocol.xs"
1536 {
1537 RETVAL = 0;
1538 }
1539 #line 1540 "XS.c"
1540 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 2 2
1541 2 ST(0) = TARG;
1542 }
1543 2 XSRETURN(1);
1544 }
1545  
1546  
1547 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readListBegin); /* prototype to pass -Wmissing-prototypes */
1548 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readListBegin)
1549 {
1550 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1551 1 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 1 1
1552 0 croak_xs_usage(cv, "p, elemtype, size");
1553 {
1554 int RETVAL;
1555 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1556 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1557 ;
1558 1 SV * elemtype = ST(1)
1559 ;
1560 1 ▶ SV * size = ST(2)
Branch: 1 branch
BranchTrueFalseTotal
SV * size = ST(2) 1 0 1
1561 ;
1562 #line 577 "./BinaryProtocol.xs"
1563 {
1564 DEBUG_TRACE("readListBegin()\n");
1565 SV *tmp;
1566 char *tmps;
1567 RETVAL = 0;
1568  
1569 READ_SV(p, tmp, 5);
1570 tmps = SvPVX(tmp);
1571 RETVAL += 5;
1572  
1573 // elemtype byte
1574 if (SvROK(elemtype))
1575 sv_setiv(SvRV(elemtype), tmps[0]);
1576  
1577 // size i32
1578 int isize;
1579 I32_TO_INT(isize, tmps, 1);
1580 if (SvROK(size))
1581 sv_setiv(SvRV(size), isize);
1582 }
1583 #line 1584 "XS.c"
1584 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1585 1 ST(0) = TARG;
1586 }
1587 1 XSRETURN(1);
1588 }
1589  
1590  
1591 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readListEnd); /* prototype to pass -Wmissing-prototypes */
1592 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readListEnd)
1593 {
1594 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
1595 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
1596 0 croak_xs_usage(cv, "SV *");
1597 {
1598 int RETVAL;
1599 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
1600 #line 603 "./BinaryProtocol.xs"
1601 {
1602 RETVAL = 0;
1603 }
1604 #line 1605 "XS.c"
1605 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 1 1 2
1606 2 ST(0) = TARG;
1607 }
1608 2 XSRETURN(1);
1609 }
1610  
1611  
1612 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readSetBegin); /* prototype to pass -Wmissing-prototypes */
1613 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readSetBegin)
1614 {
1615 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1616 1 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 1 1
1617 0 croak_xs_usage(cv, "p, elemtype, size");
1618 {
1619 int RETVAL;
1620 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1621 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1622 ;
1623 1 SV * elemtype = ST(1)
1624 ;
1625 1 ▶ SV * size = ST(2)
Branch: 1 branch
BranchTrueFalseTotal
SV * size = ST(2) 1 0 1
1626 ;
1627 #line 612 "./BinaryProtocol.xs"
1628 {
1629 DEBUG_TRACE("readSetBegin()\n");
1630 SV *tmp;
1631 char *tmps;
1632 RETVAL = 0;
1633  
1634 READ_SV(p, tmp, 5);
1635 tmps = SvPVX(tmp);
1636 RETVAL += 5;
1637  
1638 // elemtype byte
1639 if (SvROK(elemtype))
1640 sv_setiv(SvRV(elemtype), tmps[0]);
1641  
1642 // size i32
1643 int isize;
1644 I32_TO_INT(isize, tmps, 1);
1645 if (SvROK(size))
1646 sv_setiv(SvRV(size), isize);
1647 }
1648 #line 1649 "XS.c"
1649 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1650 1 ST(0) = TARG;
1651 }
1652 1 XSRETURN(1);
1653 }
1654  
1655  
1656 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readSetEnd); /* prototype to pass -Wmissing-prototypes */
1657 0 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readSetEnd)
1658 {
1659 0 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 0 0
1660 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
1661 0 croak_xs_usage(cv, "SV *");
1662 {
1663 int RETVAL;
1664 0 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 0 0 0
1665 #line 638 "./BinaryProtocol.xs"
1666 {
1667 RETVAL = 0;
1668 }
1669 #line 1670 "XS.c"
1670 0 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 0 0
1671 0 ST(0) = TARG;
1672 }
1673 0 XSRETURN(1);
1674 }
1675  
1676  
1677 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readBool); /* prototype to pass -Wmissing-prototypes */
1678 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readBool)
1679 {
1680 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
1681 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
1682 0 croak_xs_usage(cv, "p, value");
1683 {
1684 int RETVAL;
1685 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
1686 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1687 ;
1688 2 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 2 0 2
1689 ;
1690 #line 647 "./BinaryProtocol.xs"
1691 {
1692 DEBUG_TRACE("readBool()\n");
1693 SV *tmp;
1694 char *tmps;
1695 RETVAL = 0;
1696  
1697 READ_SV(p, tmp, 1);
1698 tmps = SvPVX(tmp);
1699 RETVAL += 1;
1700  
1701 if (SvROK(value))
1702 sv_setiv(SvRV(value), tmps[0] ? 1 : 0);
1703 }
1704 #line 1705 "XS.c"
1705 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 2 2
1706 2 ST(0) = TARG;
1707 }
1708 2 XSRETURN(1);
1709 }
1710  
1711  
1712 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readByte); /* prototype to pass -Wmissing-prototypes */
1713 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readByte)
1714 {
1715 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
1716 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
1717 0 croak_xs_usage(cv, "p, value");
1718 {
1719 int RETVAL;
1720 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
1721 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1722 ;
1723 2 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 2 0 2
1724 ;
1725 #line 666 "./BinaryProtocol.xs"
1726 {
1727 DEBUG_TRACE("readByte()\n");
1728 SV *tmp;
1729 char *tmps;
1730 RETVAL = 0;
1731  
1732 READ_SV(p, tmp, 1);
1733 tmps = SvPVX(tmp);
1734 RETVAL += 1;
1735  
1736 if (SvROK(value))
1737 sv_setiv(SvRV(value), tmps[0]);
1738 }
1739 #line 1740 "XS.c"
1740 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 2 2
1741 2 ST(0) = TARG;
1742 }
1743 2 XSRETURN(1);
1744 }
1745  
1746  
1747 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readI16); /* prototype to pass -Wmissing-prototypes */
1748 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readI16)
1749 {
1750 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1751 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
1752 0 croak_xs_usage(cv, "p, value");
1753 {
1754 int RETVAL;
1755 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1756 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1757 ;
1758 1 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 1 0 1
1759 ;
1760 #line 685 "./BinaryProtocol.xs"
1761 {
1762 DEBUG_TRACE("readI16()\n");
1763 SV *tmp;
1764 char *tmps;
1765 RETVAL = 0;
1766  
1767 READ_SV(p, tmp, 2);
1768 tmps = SvPVX(tmp);
1769 RETVAL += 2;
1770  
1771 int v;
1772 I16_TO_INT(v, tmps, 0);
1773 if (SvROK(value))
1774 sv_setiv(SvRV(value), v);
1775 }
1776 #line 1777 "XS.c"
1777 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1778 1 ST(0) = TARG;
1779 }
1780 1 XSRETURN(1);
1781 }
1782  
1783  
1784 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readI32); /* prototype to pass -Wmissing-prototypes */
1785 2 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readI32)
1786 {
1787 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
1788 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
1789 0 croak_xs_usage(cv, "p, value");
1790 {
1791 int RETVAL;
1792 2 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 2 0 2
1793 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1794 ;
1795 2 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 2 0 2
1796 ;
1797 #line 706 "./BinaryProtocol.xs"
1798 {
1799 DEBUG_TRACE("readI32()\n");
1800 SV *tmp;
1801 char *tmps;
1802 RETVAL = 0;
1803  
1804 READ_SV(p, tmp, 4);
1805 tmps = SvPVX(tmp);
1806 RETVAL += 4;
1807  
1808 int v;
1809 I32_TO_INT(v, tmps, 0);
1810 if (SvROK(value))
1811 sv_setiv(SvRV(value), v);
1812 }
1813 #line 1814 "XS.c"
1814 2 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 2 2
1815 2 ST(0) = TARG;
1816 }
1817 2 XSRETURN(1);
1818 }
1819  
1820  
1821 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readI64); /* prototype to pass -Wmissing-prototypes */
1822 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readI64)
1823 {
1824 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1825 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
1826 0 croak_xs_usage(cv, "p, value");
1827 {
1828 int RETVAL;
1829 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1830 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1831 ;
1832 1 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 1 0 1
1833 ;
1834 #line 727 "./BinaryProtocol.xs"
1835 {
1836 DEBUG_TRACE("readI64()\n");
1837 SV *tmp;
1838 char *tmps;
1839 RETVAL = 0;
1840  
1841 READ_SV(p, tmp, 8);
1842 tmps = SvPVX(tmp);
1843 RETVAL += 8;
1844  
1845 int64_t hi;
1846 uint32_t lo;
1847 I32_TO_INT(hi, tmps, 0);
1848 I32_TO_INT(lo, tmps, 4);
1849  
1850 if (SvROK(value)) {
1851 char string[25];
1852 STRLEN length;
1853 length = sprintf(string, "%" PRId64, (int64_t)(hi << 32) | lo);
1854 sv_setpvn(SvRV(value), string, length);
1855 }
1856 }
1857 #line 1858 "XS.c"
1858 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1859 1 ST(0) = TARG;
1860 }
1861 1 XSRETURN(1);
1862 }
1863  
1864  
1865 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readDouble); /* prototype to pass -Wmissing-prototypes */
1866 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readDouble)
1867 {
1868 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1869 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
1870 0 croak_xs_usage(cv, "p, value");
1871 {
1872 int RETVAL;
1873 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1874 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1875 ;
1876 1 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 1 0 1
1877 ;
1878 #line 755 "./BinaryProtocol.xs"
1879 {
1880 DEBUG_TRACE("readDouble()\n");
1881 SV *tmp;
1882 char *tmps;
1883 uint64_t bits;
1884 RETVAL = 0;
1885  
1886 READ_SV(p, tmp, 8);
1887 tmps = SvPVX(tmp);
1888 RETVAL += 8;
1889  
1890 bits = *(uint64_t *)tmps;
1891 bits = ntohll(bits);
1892  
1893 union {
1894 uint64_t from;
1895 double to;
1896 } u;
1897 u.from = bits;
1898  
1899 if (SvROK(value))
1900 sv_setnv(SvRV(value), u.to);
1901 }
1902 #line 1903 "XS.c"
1903 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1904 1 ST(0) = TARG;
1905 }
1906 1 XSRETURN(1);
1907 }
1908  
1909  
1910 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readString); /* prototype to pass -Wmissing-prototypes */
1911 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readString)
1912 {
1913 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1914 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
1915 0 croak_xs_usage(cv, "p, value");
1916 {
1917 int RETVAL;
1918 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1919 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1920 ;
1921 1 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 1 0 1
1922 ;
1923 #line 784 "./BinaryProtocol.xs"
1924 {
1925 DEBUG_TRACE("readString()\n");
1926 SV *tmp;
1927 char *tmps;
1928 RETVAL = 0;
1929  
1930 uint32_t len;
1931 READ_SV(p, tmp, 4);
1932 tmps = SvPVX(tmp);
1933 I32_TO_INT(len, tmps, 0);
1934 RETVAL += 4;
1935 if (len) {
1936 READ_SV(p, tmp, len);
1937 sv_utf8_decode(tmp);
1938 RETVAL += len;
1939 if (SvROK(value))
1940 sv_setsv(SvRV(value), tmp);
1941 }
1942 else {
1943 if (SvROK(value))
1944 sv_setpv(SvRV(value), "");
1945 }
1946 }
1947 #line 1948 "XS.c"
1948 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1949 1 ST(0) = TARG;
1950 }
1951 1 XSRETURN(1);
1952 }
1953  
1954  
1955 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readStringBody); /* prototype to pass -Wmissing-prototypes */
1956 1 XS_EUPXS(XS_Thrift__XS__BinaryProtocol_readStringBody)
1957 {
1958 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
1959 1 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 1 1
1960 0 croak_xs_usage(cv, "p, value, len");
1961 {
1962 int RETVAL;
1963 1 ▶ dXSTARG;
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; 1 0 1
1964 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
1965 ;
1966 1 SV * value = ST(1)
1967 ;
1968 1 ▶ uint32_t len = (uint32_t)SvUV(ST(2))
Branch: 1 branch
BranchTrueFalseTotal
uint32_t len = (uint32_t)SvUV(ST(2)) 1 0 1
1969 ;
1970 #line 813 "./BinaryProtocol.xs"
1971 {
1972 // This method is never used but is here for compat
1973 SV *tmp;
1974 RETVAL = 0;
1975  
1976 if (len) {
1977 READ_SV(p, tmp, len);
1978 sv_utf8_decode(tmp);
1979 RETVAL += len;
1980 if (SvROK(value))
1981 sv_setsv(SvRV(value), tmp);
1982 }
1983 else {
1984 if (SvROK(value))
1985 sv_setpv(SvRV(value), "");
1986 }
1987 }
1988 #line 1989 "XS.c"
1989 1 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 0 1 1
1990 1 ST(0) = TARG;
1991 }
1992 1 XSRETURN(1);
1993 }
1994  
1995  
1996 /* INCLUDE: Returning to 'XS.xs' from 'BinaryProtocol.xs' */
1997  
1998  
1999 /* INCLUDE: Including 'CompactProtocol.xs' from 'XS.xs' */
2000  
2001  
2002 XS_EUPXS(XS_Thrift__XS__CompactProtocol_resetState); /* prototype to pass -Wmissing-prototypes */
2003 3 XS_EUPXS(XS_Thrift__XS__CompactProtocol_resetState)
2004 {
2005 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
2006 3 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 3 3
2007 0 croak_xs_usage(cv, "p");
2008 {
2009 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2010 ;
2011 #line 9 "./CompactProtocol.xs"
2012 {
2013 DEBUG_TRACE("resetState()\n");
2014  
2015 p->bool_type = -1;
2016 p->bool_id = -1;
2017 p->bool_value_id = -1;
2018 p->last_field_id = 0;
2019  
2020 // clear field queue
2021 struct field_entry *entry;
2022 while (!SIMPLEQ_EMPTY(p->last_fields)) {
2023 entry = SIMPLEQ_FIRST(p->last_fields);
2024 SIMPLEQ_REMOVE_HEAD(p->last_fields, entries);
2025 MEM_TRACE("free entry @ %p\n", entry);
2026 Safefree(entry);
2027 }
2028 }
2029 #line 2030 "XS.c"
2030 }
2031 3 XSRETURN_EMPTY;
2032 }
2033  
2034  
2035 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeMessageBegin); /* prototype to pass -Wmissing-prototypes */
2036 3 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeMessageBegin)
2037 {
2038 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
2039 3 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 3 3
2040 0 croak_xs_usage(cv, "p, name, type, seqid");
2041 {
2042 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2043 ;
2044 3 SV * name = ST(1)
2045 ;
2046 3 int type = (int)SvIV(ST(2))
2047 ;
2048 3 uint32_t seqid = (uint32_t)SvUV(ST(3))
2049 ;
2050 #line 30 "./CompactProtocol.xs"
2051 {
2052 DEBUG_TRACE("writeMessageBegin()\n");
2053  
2054 SV *namecopy = sv_mortalcopy(name); // because we can't modify the original name
2055 sv_utf8_encode(namecopy);
2056 uint32_t namelen = sv_len(namecopy);
2057 SV *data = sv_2mortal(newSV(16 + namelen));
2058 char tmp[5]; // 5 required for varint32
2059  
2060 // byte protocol ID
2061 tmp[0] = PROTOCOL_ID;
2062  
2063 // byte version/type
2064 tmp[1] = (VERSION_N & VERSION_MASK_COMPACT) | ((type << TYPE_SHIFT_AMOUNT) & TYPE_MASK);
2065  
2066 sv_setpvn(data, tmp, 2);
2067  
2068 // varint32 seqid
2069 int varlen;
2070 UINT_TO_VARINT(varlen, tmp, seqid, 0);
2071 sv_catpvn(data, tmp, varlen);
2072  
2073 // varint32 len + string
2074 UINT_TO_VARINT(varlen, tmp, namelen, 0);
2075 sv_catpvn(data, tmp, varlen);
2076 sv_catsv(data, namecopy);
2077  
2078 WRITE_SV(p, data);
2079 }
2080 #line 2081 "XS.c"
2081 }
2082 3 XSRETURN_EMPTY;
2083 }
2084  
2085  
2086 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeStructBegin); /* prototype to pass -Wmissing-prototypes */
2087 5 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeStructBegin)
2088 {
2089 5 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 5 5
2090 5 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 5 5
2091 0 croak_xs_usage(cv, "p, SV *");
2092 {
2093 5 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2094 ;
2095 #line 65 "./CompactProtocol.xs"
2096 {
2097 DEBUG_TRACE("writeStructBegin()\n");
2098  
2099 // No writing here, but we push last_field_id onto the fields stack
2100 // and reset last_field_id to 0
2101 struct field_entry *entry;
2102 New(0, entry, sizeof(struct field_entry), struct field_entry);
2103 MEM_TRACE("New entry @ %p\n", entry);
2104 entry->field_id = p->last_field_id;
2105 SIMPLEQ_INSERT_HEAD(p->last_fields, entry, entries);
2106  
2107 DEBUG_TRACE("writeStructBegin(), insert_head %d\n", entry->field_id);
2108  
2109 p->last_field_id = 0;
2110 }
2111 #line 2112 "XS.c"
2112 }
2113 5 XSRETURN_EMPTY;
2114 }
2115  
2116  
2117 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeStructEnd); /* prototype to pass -Wmissing-prototypes */
2118 4 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeStructEnd)
2119 {
2120 4 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 4 4
2121 4 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 4 4
2122 0 croak_xs_usage(cv, "p");
2123 {
2124 4 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2125 ;
2126 #line 84 "./CompactProtocol.xs"
2127 {
2128 DEBUG_TRACE("writeStructEnd()\n");
2129  
2130 // pop last field off the stack and save it in
2131 // last_field_id
2132 struct field_entry *entry = SIMPLEQ_FIRST(p->last_fields);
2133 p->last_field_id = entry->field_id;
2134 SIMPLEQ_REMOVE_HEAD(p->last_fields, entries);
2135  
2136 DEBUG_TRACE("writeStructEnd(), remove_head %d\n", entry->field_id);
2137  
2138 MEM_TRACE("free entry @ %p\n", entry);
2139 Safefree(entry);
2140 }
2141 #line 2142 "XS.c"
2142 }
2143 4 XSRETURN_EMPTY;
2144 }
2145  
2146  
2147 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeFieldBegin); /* prototype to pass -Wmissing-prototypes */
2148 10 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeFieldBegin)
2149 {
2150 10 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 10 10
2151 10 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 10 10
2152 0 croak_xs_usage(cv, "p, name, type, id");
2153 {
2154 10 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2155 ;
2156 10 SV * name = ST(1)
2157 ;
2158 10 int type = (int)SvIV(ST(2))
2159 ;
2160 10 ▶ int id = (int)SvIV(ST(3))
Branch: 1 branch
BranchTrueFalseTotal
int id = (int)SvIV(ST(3)) 3 7 10
2161 ;
2162 #line 102 "./CompactProtocol.xs"
2163 {
2164 DEBUG_TRACE("writeFieldBegin()\n");
2165  
2166 PERL_UNUSED_VAR(name);
2167 if (unlikely(type == T_BOOL)) {
2168 // Special case, save type/id for use later
2169 p->bool_type = type;
2170 p->bool_id = id;
2171 }
2172 else {
2173 write_field_begin_internal(p, type, id, -1);
2174 }
2175 }
2176 #line 2177 "XS.c"
2177 }
2178 10 XSRETURN_EMPTY;
2179 }
2180  
2181  
2182 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeMapBegin); /* prototype to pass -Wmissing-prototypes */
2183 5 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeMapBegin)
2184 {
2185 5 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 5 5
2186 5 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 5 5
2187 0 croak_xs_usage(cv, "p, keytype, valtype, size");
2188 {
2189 5 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2190 ;
2191 5 int keytype = (int)SvIV(ST(1))
2192 ;
2193 5 int valtype = (int)SvIV(ST(2))
2194 ;
2195 5 ▶ uint32_t size = (uint32_t)SvUV(ST(3))
Branch: 1 branch
BranchTrueFalseTotal
uint32_t size = (uint32_t)SvUV(ST(3)) 1 4 5
2196 ;
2197 #line 123 "./CompactProtocol.xs"
2198 {
2199 DEBUG_TRACE("writeMapBegin()\n");
2200  
2201 char data[6];
2202  
2203 if (size == 0) {
2204 data[0] = 0;
2205 WRITE(p, data, 1);
2206 }
2207 else {
2208 int varlen;
2209 UINT_TO_VARINT(varlen, data, size, 0);
2210 data[varlen] = (get_compact_type(keytype) << 4) | get_compact_type(valtype);
2211 WRITE(p, data, varlen + 1);
2212 }
2213 }
2214 #line 2215 "XS.c"
2215 }
2216 5 XSRETURN_EMPTY;
2217 }
2218  
2219  
2220 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeListBegin); /* prototype to pass -Wmissing-prototypes */
2221 5 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeListBegin)
2222 {
2223 5 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 5 5
2224 5 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 5 5
2225 0 croak_xs_usage(cv, "p, elemtype, size");
2226 {
2227 5 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2228 ;
2229 5 int elemtype = (int)SvIV(ST(1))
2230 ;
2231 5 int size = (int)SvIV(ST(2))
2232 ;
2233 #line 145 "./CompactProtocol.xs"
2234 {
2235 DEBUG_TRACE("writeListBegin()\n");
2236  
2237 write_collection_begin_internal(p, elemtype, size);
2238 }
2239 #line 2240 "XS.c"
2240 }
2241 5 XSRETURN_EMPTY;
2242 }
2243  
2244  
2245 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeSetBegin); /* prototype to pass -Wmissing-prototypes */
2246 2 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeSetBegin)
2247 {
2248 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
2249 2 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 2 2
2250 0 croak_xs_usage(cv, "p, elemtype, size");
2251 {
2252 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2253 ;
2254 2 int elemtype = (int)SvIV(ST(1))
2255 ;
2256 2 int size = (int)SvIV(ST(2))
2257 ;
2258 #line 156 "./CompactProtocol.xs"
2259 {
2260 DEBUG_TRACE("writeSetBegin()\n");
2261  
2262 write_collection_begin_internal(p, elemtype, size);
2263 }
2264 #line 2265 "XS.c"
2265 }
2266 2 XSRETURN_EMPTY;
2267 }
2268  
2269  
2270 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeBool); /* prototype to pass -Wmissing-prototypes */
2271 5 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeBool)
2272 {
2273 5 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 5 5
2274 5 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 5 5
2275 0 croak_xs_usage(cv, "p, value");
2276 {
2277 5 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2278 ;
2279 5 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 3 2 5
2280 ;
2281 #line 167 "./CompactProtocol.xs"
2282 {
2283 DEBUG_TRACE("writeBool()\n");
2284  
2285 if (unlikely(p->bool_type != -1)) {
2286 // we haven't written the field header yet
2287 write_field_begin_internal(p, p->bool_type, p->bool_id, SvTRUE(value) ? CTYPE_BOOLEAN_TRUE: CTYPE_BOOLEAN_FALSE);
2288 p->bool_type = -1;
2289 p->bool_id = -1;
2290 }
2291 else {
2292 // we're not part of a field, so just write the value.
2293 char data[1];
2294 data[0] = SvTRUE(value) ? 1 : 0;
2295  
2296 WRITE(p, data, 1);
2297 }
2298 }
2299 #line 2300 "XS.c"
2300 }
2301 5 XSRETURN_EMPTY;
2302 }
2303  
2304  
2305 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeI16); /* prototype to pass -Wmissing-prototypes */
2306 3 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeI16)
2307 {
2308 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
2309 3 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 3 3
2310 0 croak_xs_usage(cv, "p, value");
2311 {
2312 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2313 ;
2314 3 int value = (int)SvIV(ST(1))
2315 ;
2316 #line 190 "./CompactProtocol.xs"
2317 {
2318 DEBUG_TRACE("writeI16()\n");
2319  
2320 char data[3];
2321 int varlen;
2322  
2323 uint32_t uvalue = int_to_zigzag(value);
2324 UINT_TO_VARINT(varlen, data, uvalue, 0);
2325 WRITE(p, data, varlen);
2326 }
2327 #line 2328 "XS.c"
2328 }
2329 3 XSRETURN_EMPTY;
2330 }
2331  
2332  
2333 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeI32); /* prototype to pass -Wmissing-prototypes */
2334 4 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeI32)
2335 {
2336 4 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 4 4
2337 4 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 4 4
2338 0 croak_xs_usage(cv, "p, value");
2339 {
2340 4 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2341 ;
2342 4 int value = (int)SvIV(ST(1))
2343 ;
2344 #line 204 "./CompactProtocol.xs"
2345 {
2346 DEBUG_TRACE("writeI32()\n");
2347  
2348 char data[5];
2349 int varlen;
2350  
2351 uint32_t uvalue = int_to_zigzag(value);
2352 UINT_TO_VARINT(varlen, data, uvalue, 0);
2353 WRITE(p, data, varlen);
2354 }
2355 #line 2356 "XS.c"
2356 }
2357 4 XSRETURN_EMPTY;
2358 }
2359  
2360  
2361 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeI64); /* prototype to pass -Wmissing-prototypes */
2362 5 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeI64)
2363 {
2364 5 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 5 5
2365 5 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 5 5
2366 0 croak_xs_usage(cv, "p, value");
2367 {
2368 5 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2369 ;
2370 5 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 4 1 5
2371 ;
2372 #line 218 "./CompactProtocol.xs"
2373 {
2374 char data[10];
2375 int varlen = 0;
2376  
2377 // Stringify the value, then convert to an int64_t
2378 const char *str = SvPOK(value) ? SvPVX(value) : SvPV_nolen(value);
2379 int64_t i64 = (int64_t)strtoll(str, NULL, 10);
2380  
2381 DEBUG_TRACE("writeI64(%" PRId64 ")\n", i64);
2382  
2383 uint64_t uvalue = ll_to_zigzag(i64);
2384 UINT_TO_VARINT(varlen, data, uvalue, 0);
2385 WRITE(p, data, varlen);
2386 }
2387 #line 2388 "XS.c"
2388 }
2389 5 XSRETURN_EMPTY;
2390 }
2391  
2392  
2393 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeDouble); /* prototype to pass -Wmissing-prototypes */
2394 2 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeDouble)
2395 {
2396 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
2397 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
2398 0 croak_xs_usage(cv, "p, value");
2399 {
2400 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2401 ;
2402 2 SV * value = ST(1)
2403 ;
2404 #line 236 "./CompactProtocol.xs"
2405 {
2406 DEBUG_TRACE("writeDouble()\n");
2407  
2408 char data[8];
2409 union {
2410 double d;
2411 int64_t i;
2412 } u;
2413  
2414 u.d = (double)SvNV(value);
2415  
2416 data[0] = u.i & 0xff;
2417 data[1] = (u.i >> 8) & 0xff;
2418 data[2] = (u.i >> 16) & 0xff;
2419 data[3] = (u.i >> 24) & 0xff;
2420 data[4] = (u.i >> 32) & 0xff;
2421 data[5] = (u.i >> 40) & 0xff;
2422 data[6] = (u.i >> 48) & 0xff;
2423 data[7] = (u.i >> 56) & 0xff;
2424  
2425 WRITE(p, data, 8);
2426 }
2427 #line 2428 "XS.c"
2428 }
2429 2 XSRETURN_EMPTY;
2430 }
2431  
2432  
2433 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeString); /* prototype to pass -Wmissing-prototypes */
2434 19 XS_EUPXS(XS_Thrift__XS__CompactProtocol_writeString)
2435 {
2436 19 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 19 19
2437 19 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 19 19
2438 0 croak_xs_usage(cv, "p, value");
2439 {
2440 19 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2441 ;
2442 19 SV * value = ST(1)
2443 ;
2444 #line 262 "./CompactProtocol.xs"
2445 {
2446 DEBUG_TRACE("writeString()\n");
2447  
2448 SV *valuecopy = sv_mortalcopy(value);
2449 if (SvUTF8(value) != 0) {
2450 sv_utf8_encode(valuecopy);
2451 }
2452 int len = sv_len(valuecopy);
2453 SV *data = sv_2mortal(newSV(5 + len));
2454 char tmp[5];
2455  
2456 int varlen;
2457 UINT_TO_VARINT(varlen, tmp, len, 0);
2458 sv_setpvn(data, tmp, varlen);
2459 sv_catsv(data, valuecopy);
2460  
2461 WRITE_SV(p, data);
2462 }
2463 #line 2464 "XS.c"
2464 }
2465 19 XSRETURN_EMPTY;
2466 }
2467  
2468  
2469 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readMessageBegin); /* prototype to pass -Wmissing-prototypes */
2470 1 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readMessageBegin)
2471 {
2472 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
2473 1 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 1 1
2474 0 croak_xs_usage(cv, "p, name, type, seqid");
2475 {
2476 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2477 ;
2478 1 SV * name = ST(1)
2479 ;
2480 1 SV * type = ST(2)
2481 ;
2482 1 ▶ SV * seqid = ST(3)
Branch: 1 branch
BranchTrueFalseTotal
SV * seqid = ST(3) 1 0 1
2483 ;
2484 #line 284 "./CompactProtocol.xs"
2485 {
2486 DEBUG_TRACE("readMessageBegin()\n");
2487  
2488 SV *tmp;
2489 char *tmps;
2490 uint32_t tmpui;
2491  
2492 // read protocol id, version, type
2493 READ_SV(p, tmp, 2);
2494 tmps = SvPVX(tmp);
2495  
2496 uint8_t protocol_id = (uint8_t) tmps[0];
2497 if (protocol_id != (uint8_t) PROTOCOL_ID) {
2498 THROW_SV("Thrift::TException", newSVpvf("Expected protocol id %d but got %d", PROTOCOL_ID, protocol_id));
2499 }
2500  
2501 uint8_t version_and_type = (uint8_t) tmps[1];
2502 uint8_t version = version_and_type & VERSION_MASK_COMPACT;
2503 if (version != VERSION_N) {
2504 THROW_SV("Thrift::TException", newSVpvf("Expected version id %d but got %d", VERSION_N, version));
2505 }
2506  
2507 // set type
2508 if (SvROK(type))
2509 sv_setiv(SvRV(type), (version_and_type >> TYPE_SHIFT_AMOUNT) & 0x03);
2510  
2511 // read/set seqid
2512 READ_VARINT(p, tmpui);
2513 if (SvROK(seqid))
2514 sv_setiv(SvRV(seqid), tmpui);
2515  
2516 // read/set name
2517 READ_VARINT(p, tmpui);
2518 if (tmpui) {
2519 READ_SV(p, tmp, tmpui);
2520 sv_utf8_decode(tmp);
2521 if (SvROK(name))
2522 sv_setsv(SvRV(name), tmp);
2523 }
2524 else {
2525 if (SvROK(name))
2526 sv_setpv(SvRV(name), "");
2527 }
2528 }
2529 #line 2530 "XS.c"
2530 }
2531 1 XSRETURN_EMPTY;
2532 }
2533  
2534  
2535 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readStructBegin); /* prototype to pass -Wmissing-prototypes */
2536 4 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readStructBegin)
2537 {
2538 4 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 4 4
2539 4 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 4 4
2540 0 croak_xs_usage(cv, "p, name");
2541 {
2542 4 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2543 ;
2544 4 SV * name = ST(1)
2545 ;
2546 #line 334 "./CompactProtocol.xs"
2547 {
2548 DEBUG_TRACE("readStructBegin()\n");
2549  
2550 // No reading here, but we push last_field_id onto the fields stack
2551 struct field_entry *entry;
2552 New(0, entry, sizeof(struct field_entry), struct field_entry);
2553 MEM_TRACE("New entry @ %p\n", entry);
2554 entry->field_id = p->last_field_id;
2555 SIMPLEQ_INSERT_HEAD(p->last_fields, entry, entries);
2556  
2557 p->last_field_id = 0;
2558  
2559 if (SvROK(name))
2560 sv_setpv(SvRV(name), "");
2561 }
2562 #line 2563 "XS.c"
2563 }
2564 4 XSRETURN_EMPTY;
2565 }
2566  
2567  
2568 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readStructEnd); /* prototype to pass -Wmissing-prototypes */
2569 3 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readStructEnd)
2570 {
2571 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
2572 3 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 3 3
2573 0 croak_xs_usage(cv, "p");
2574 {
2575 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2576 ;
2577 #line 353 "./CompactProtocol.xs"
2578 {
2579 DEBUG_TRACE("readStructEnd()\n");
2580  
2581 // pop last field off the stack
2582 struct field_entry *entry = SIMPLEQ_FIRST(p->last_fields);
2583 SIMPLEQ_REMOVE_HEAD(p->last_fields, entries);
2584 p->last_field_id = entry->field_id;
2585  
2586 MEM_TRACE("free entry @ %p\n", entry);
2587 Safefree(entry);
2588 }
2589 #line 2590 "XS.c"
2590 }
2591 3 XSRETURN_EMPTY;
2592 }
2593  
2594  
2595 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readFieldBegin); /* prototype to pass -Wmissing-prototypes */
2596 10 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readFieldBegin)
2597 {
2598 10 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 10 10
2599 10 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 10 10
2600 0 croak_xs_usage(cv, "p, name, fieldtype, fieldid");
2601 {
2602 10 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2603 ;
2604 10 SV * name = ST(1)
2605 ;
2606 10 SV * fieldtype = ST(2)
2607 ;
2608 10 ▶ SV * fieldid = ST(3)
Branch: 1 branch
BranchTrueFalseTotal
SV * fieldid = ST(3) 10 0 10
2609 ;
2610 #line 368 "./CompactProtocol.xs"
2611 {
2612 DEBUG_TRACE("readFieldBegin()\n");
2613  
2614 SV *tmp;
2615 char *tmps;
2616  
2617 PERL_UNUSED_VAR(name);
2618 // fieldtype byte
2619 READ_SV(p, tmp, 1);
2620 tmps = SvPVX(tmp);
2621 int type = tmps[0];
2622  
2623 if (SvROK(fieldtype))
2624 sv_setiv(SvRV(fieldtype), get_ttype(type & 0x0f));
2625  
2626 if (type == T_STOP) {
2627 if (SvROK(fieldid))
2628 sv_setiv(SvRV(fieldid), 0);
2629 XSRETURN_EMPTY;
2630 }
2631  
2632 // fieldid i16 varint
2633 int fid;
2634  
2635 // mask off the 4 MSB of the type header. it could contain a field id delta.
2636 uint8_t modifier = ((type & 0xf0) >> 4);
2637 if (modifier == 0) {
2638 // pop field
2639 struct field_entry *entry = SIMPLEQ_FIRST(p->last_fields);
2640 SIMPLEQ_REMOVE_HEAD(p->last_fields, entries);
2641 MEM_TRACE("free entry @ %p\n", entry);
2642 Safefree(entry);
2643  
2644 // not a delta. look ahead for the zigzag varint field id.
2645 READ_VARINT(p, fid);
2646 fid = zigzag_to_int(fid);
2647 }
2648 else {
2649 // has a delta. add the delta to the last read field id.
2650 // pop field
2651 struct field_entry *entry = SIMPLEQ_FIRST(p->last_fields);
2652 SIMPLEQ_REMOVE_HEAD(p->last_fields, entries);
2653 int last = entry->field_id;
2654 MEM_TRACE("free entry @ %p\n", entry);
2655 Safefree(entry);
2656  
2657 fid = last + modifier;
2658 }
2659  
2660 // if this happens to be a boolean field, the value is encoded in the type
2661 if (is_bool_type(type)) {
2662 // save the boolean value in a special instance variable.
2663 p->bool_value_id = (type & 0x0f) == CTYPE_BOOLEAN_TRUE ? 1 : 0;
2664 }
2665  
2666 // push the new field onto the field stack so we can keep the deltas going.
2667 struct field_entry *entry;
2668 New(0, entry, sizeof(struct field_entry), struct field_entry);
2669 MEM_TRACE("New entry @ %p\n", entry);
2670 entry->field_id = fid;
2671 SIMPLEQ_INSERT_HEAD(p->last_fields, entry, entries);
2672  
2673 if (SvROK(fieldid))
2674 sv_setiv(SvRV(fieldid), fid);
2675 }
2676 #line 2677 "XS.c"
2677 }
2678 7 XSRETURN_EMPTY;
2679 }
2680  
2681  
2682 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readMapBegin); /* prototype to pass -Wmissing-prototypes */
2683 3 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readMapBegin)
2684 {
2685 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
2686 3 ▶ if (items != 4)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 4) 0 3 3
2687 0 croak_xs_usage(cv, "p, keytype, valtype, size");
2688 {
2689 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2690 ;
2691 3 SV * keytype = ST(1)
2692 ;
2693 3 SV * valtype = ST(2)
2694 ;
2695 3 SV * size = ST(3)
2696 ;
2697 #line 439 "./CompactProtocol.xs"
2698 {
2699 DEBUG_TRACE("readMapBegin()\n");
2700  
2701 SV *tmp;
2702 char *tmps;
2703  
2704 // size
2705 uint32_t isize;
2706 READ_VARINT(p, isize);
2707 if (SvROK(size))
2708 sv_setiv(SvRV(size), isize);
2709  
2710 // key and value type
2711 READ_SV(p, tmp, 1);
2712 tmps = SvPVX(tmp);
2713  
2714 // keytype byte
2715 if (SvROK(keytype))
2716 sv_setiv(SvRV(keytype), get_ttype((tmps[0] >> 4) & 0xf));
2717  
2718 // valtype byte
2719 if (SvROK(valtype))
2720 sv_setiv(SvRV(valtype), get_ttype(tmps[0] & 0xf));
2721 }
2722 #line 2723 "XS.c"
2723 }
2724 3 XSRETURN_EMPTY;
2725 }
2726  
2727  
2728 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readListBegin); /* prototype to pass -Wmissing-prototypes */
2729 3 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readListBegin)
2730 {
2731 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
2732 3 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 3 3
2733 0 croak_xs_usage(cv, "p, elemtype, size");
2734 {
2735 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2736 ;
2737 3 SV * elemtype = ST(1)
2738 ;
2739 3 ▶ SV * size = ST(2)
Branch: 1 branch
BranchTrueFalseTotal
SV * size = ST(2) 3 0 3
2740 ;
2741 #line 469 "./CompactProtocol.xs"
2742 {
2743 DEBUG_TRACE("readListBegin()\n");
2744  
2745 SV *tmp;
2746 char *tmps;
2747  
2748 // size and type may be in the same byte
2749 READ_SV(p, tmp, 1);
2750 tmps = SvPVX(tmp);
2751 int isize = (tmps[0] >> 4) & 0x0f;
2752 if (isize == 15) {
2753 // size is in a varint
2754 READ_VARINT(p, isize);
2755 }
2756 int type = get_ttype(tmps[0] & 0x0f);
2757  
2758 // elemtype byte
2759 if (SvROK(elemtype))
2760 sv_setiv(SvRV(elemtype), type);
2761  
2762 // size
2763 if (SvROK(size))
2764 sv_setiv(SvRV(size), isize);
2765 }
2766 #line 2767 "XS.c"
2767 }
2768 3 XSRETURN_EMPTY;
2769 }
2770  
2771  
2772 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readSetBegin); /* prototype to pass -Wmissing-prototypes */
2773 1 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readSetBegin)
2774 {
2775 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
2776 1 ▶ if (items != 3)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 3) 0 1 1
2777 0 croak_xs_usage(cv, "p, elemtype, size");
2778 {
2779 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2780 ;
2781 1 SV * elemtype = ST(1)
2782 ;
2783 1 ▶ SV * size = ST(2)
Branch: 1 branch
BranchTrueFalseTotal
SV * size = ST(2) 1 0 1
2784 ;
2785 #line 499 "./CompactProtocol.xs"
2786 {
2787 DEBUG_TRACE("readSetBegin()\n");
2788  
2789 SV *tmp;
2790 char *tmps;
2791  
2792 // size and type may be in the same byte
2793 READ_SV(p, tmp, 1);
2794 tmps = SvPVX(tmp);
2795 int isize = (tmps[0] >> 4) & 0x0f;
2796 if (isize == 15) {
2797 // size is in a varint
2798 READ_VARINT(p, isize);
2799 }
2800 int type = get_ttype(tmps[0] & 0x0f);
2801  
2802 // elemtype byte
2803 if (SvROK(elemtype))
2804 sv_setiv(SvRV(elemtype), type);
2805  
2806 // size
2807 if (SvROK(size))
2808 sv_setiv(SvRV(size), isize);
2809 }
2810 #line 2811 "XS.c"
2811 }
2812 1 XSRETURN_EMPTY;
2813 }
2814  
2815  
2816 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readBool); /* prototype to pass -Wmissing-prototypes */
2817 3 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readBool)
2818 {
2819 3 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 3 3
2820 3 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 3 3
2821 0 croak_xs_usage(cv, "p, value");
2822 {
2823 3 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2824 ;
2825 3 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 1 2 3
2826 ;
2827 #line 529 "./CompactProtocol.xs"
2828 {
2829 DEBUG_TRACE("readBool()\n");
2830  
2831 SV *tmp;
2832 char *tmps;
2833  
2834 // Check for bool_value encoded in the fieldBegin type
2835 if (p->bool_value_id != -1) {
2836 if (SvROK(value))
2837 sv_setiv(SvRV(value), p->bool_value_id);
2838 p->bool_value_id = -1;
2839 }
2840 else {
2841 READ_SV(p, tmp, 1);
2842 tmps = SvPVX(tmp);
2843  
2844 if (SvROK(value))
2845 sv_setiv(SvRV(value), tmps[0] ? 1 : 0);
2846 }
2847 }
2848 #line 2849 "XS.c"
2849 }
2850 3 XSRETURN_EMPTY;
2851 }
2852  
2853  
2854 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readI16); /* prototype to pass -Wmissing-prototypes */
2855 1 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readI16)
2856 {
2857 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
2858 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
2859 0 croak_xs_usage(cv, "p, value");
2860 {
2861 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2862 ;
2863 1 SV * value = ST(1)
2864 ;
2865 #line 555 "./CompactProtocol.xs"
2866 {
2867 DEBUG_TRACE("readI16()\n");
2868  
2869 uint32_t varint;
2870 READ_VARINT(p, varint);
2871  
2872 if (SvROK(value))
2873 sv_setiv(SvRV(value), zigzag_to_int(varint));
2874 }
2875 #line 2876 "XS.c"
2876 }
2877 1 XSRETURN_EMPTY;
2878 }
2879  
2880  
2881 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readI32); /* prototype to pass -Wmissing-prototypes */
2882 2 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readI32)
2883 {
2884 2 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 2 2
2885 2 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 2 2
2886 0 croak_xs_usage(cv, "p, value");
2887 {
2888 2 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2889 ;
2890 2 SV * value = ST(1)
2891 ;
2892 #line 568 "./CompactProtocol.xs"
2893 {
2894 DEBUG_TRACE("readI32()\n");
2895  
2896 uint32_t varint;
2897 READ_VARINT(p, varint);
2898  
2899 if (SvROK(value))
2900 sv_setiv(SvRV(value), zigzag_to_int(varint));
2901 }
2902 #line 2903 "XS.c"
2903 }
2904 2 XSRETURN_EMPTY;
2905 }
2906  
2907  
2908 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readI64); /* prototype to pass -Wmissing-prototypes */
2909 1 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readI64)
2910 {
2911 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
2912 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
2913 0 croak_xs_usage(cv, "p, value");
2914 {
2915 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2916 ;
2917 1 SV * value = ST(1)
2918 ;
2919 #line 581 "./CompactProtocol.xs"
2920 {
2921 uint64_t varint;
2922 READ_VARINT(p, varint);
2923  
2924 DEBUG_TRACE("readI64(%" PRId64 ") (from varint %" PRIu64 ")\n", zigzag_to_ll(varint), varint);
2925  
2926 // Store as a string so it works on 32-bit platforms
2927 if (SvROK(value)) {
2928 char string[25];
2929 STRLEN length;
2930 length = sprintf(string, "%" PRId64, zigzag_to_ll(varint));
2931 sv_setpvn(SvRV(value), string, length);
2932 }
2933 }
2934 #line 2935 "XS.c"
2935 }
2936 1 XSRETURN_EMPTY;
2937 }
2938  
2939  
2940 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readDouble); /* prototype to pass -Wmissing-prototypes */
2941 1 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readDouble)
2942 {
2943 1 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 1 1
2944 1 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 1 1
2945 0 croak_xs_usage(cv, "p, value");
2946 {
2947 1 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2948 ;
2949 1 ▶ SV * value = ST(1)
Branch: 1 branch
BranchTrueFalseTotal
SV * value = ST(1) 1 0 1
2950 ;
2951 #line 599 "./CompactProtocol.xs"
2952 {
2953 DEBUG_TRACE("readDouble()\n");
2954  
2955 SV *tmp;
2956 char *tmps;
2957  
2958 READ_SV(p, tmp, 8);
2959 tmps = SvPVX(tmp);
2960  
2961 uint32_t lo = (uint8_t)tmps[0] |
2962 ((uint8_t)tmps[1] << 8) |
2963 ((uint8_t)tmps[2] << 16) |
2964 ((uint8_t)tmps[3] << 24);
2965 uint64_t hi = (uint8_t)tmps[4] |
2966 ((uint8_t)tmps[5] << 8) |
2967 ((uint8_t)tmps[6] << 16) |
2968 ((uint8_t)tmps[7] << 24);
2969  
2970 union {
2971 double d;
2972 int64_t i;
2973 } u;
2974 u.i = (hi << 32) | lo;
2975  
2976 if (SvROK(value))
2977 sv_setnv(SvRV(value), u.d);
2978 }
2979 #line 2980 "XS.c"
2980 }
2981 1 XSRETURN_EMPTY;
2982 }
2983  
2984  
2985 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readString); /* prototype to pass -Wmissing-prototypes */
2986 15 XS_EUPXS(XS_Thrift__XS__CompactProtocol_readString)
2987 {
2988 15 ▶ dVAR; dXSARGS;
Branch: 1 branch
BranchTrueFalseTotal
dVAR; dXSARGS; 0 15 15
2989 15 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 15 15
2990 0 croak_xs_usage(cv, "p, value");
2991 {
2992 15 TBinaryProtocol * p = (TBinaryProtocol *)xs_object_magic_get_struct_rv_pretty(aTHX_ ST(0), "p")
2993 ;
2994 15 SV * value = ST(1)
2995 ;
2996 #line 630 "./CompactProtocol.xs"
2997 {
2998 DEBUG_TRACE("readString()\n");
2999  
3000 SV *tmp;
3001  
3002 uint64_t len;
3003 READ_VARINT(p, len);
3004 if (len) {
3005 READ_SV(p, tmp, len);
3006 sv_utf8_decode(tmp);
3007 if (SvROK(value))
3008 sv_setsv(SvRV(value), tmp);
3009 }
3010 else {
3011 if (SvROK(value))
3012 sv_setpv(SvRV(value), "");
3013 }
3014 }
3015 #line 3016 "XS.c"
3016 }
3017 15 XSRETURN_EMPTY;
3018 }
3019  
3020  
3021 /* INCLUDE: Returning to 'XS.xs' from 'CompactProtocol.xs' */
3022  
3023 #ifdef __cplusplus
3024 extern "C" {
3025 #endif
3026 XS_EXTERNAL(boot_Thrift__XS); /* prototype to pass -Wmissing-prototypes */
3027 4 XS_EXTERNAL(boot_Thrift__XS)
3028 {
3029 #if PERL_VERSION_LE(5, 21, 5)
3030 dVAR; dXSARGS;
3031 #else
3032 4 dVAR; dXSBOOTARGSXSAPIVERCHK;
3033 #endif
3034 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
3035 char* file = __FILE__;
3036 #else
3037 const char* file = __FILE__;
3038 #endif
3039  
3040 PERL_UNUSED_VAR(file);
3041  
3042 PERL_UNUSED_VAR(cv); /* -W */
3043 PERL_UNUSED_VAR(items); /* -W */
3044 #if PERL_VERSION_LE(5, 21, 5)
3045 XS_VERSION_BOOTCHECK;
3046 # ifdef XS_APIVERSION_BOOTCHECK
3047 XS_APIVERSION_BOOTCHECK;
3048 # endif
3049 #endif
3050  
3051 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::new", XS_Thrift__XS__MemoryBuffer_new, file, "$;@");
3052 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::isOpen", XS_Thrift__XS__MemoryBuffer_isOpen, file, "$");
3053 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::open", XS_Thrift__XS__MemoryBuffer_open, file, "$");
3054 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::close", XS_Thrift__XS__MemoryBuffer_close, file, "$");
3055 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::flush", XS_Thrift__XS__MemoryBuffer_flush, file, "$");
3056 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::available", XS_Thrift__XS__MemoryBuffer_available, file, "$");
3057 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::read", XS_Thrift__XS__MemoryBuffer_read, file, "$$");
3058 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::readAll", XS_Thrift__XS__MemoryBuffer_readAll, file, "$$");
3059 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::write", XS_Thrift__XS__MemoryBuffer_write, file, "$$;@");
3060 4 (void)newXSproto_portable("Thrift::XS::MemoryBuffer::DESTROY", XS_Thrift__XS__MemoryBuffer_DESTROY, file, "$");
3061 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::new", XS_Thrift__XS__BinaryProtocol_new, file, "$$");
3062 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::DESTROY", XS_Thrift__XS__BinaryProtocol_DESTROY, file, "$");
3063 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::getTransport", XS_Thrift__XS__BinaryProtocol_getTransport, file, "$");
3064 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeMessageBegin", XS_Thrift__XS__BinaryProtocol_writeMessageBegin, file, "$$$$");
3065 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeMessageEnd", XS_Thrift__XS__BinaryProtocol_writeMessageEnd, file, "$");
3066 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeStructBegin", XS_Thrift__XS__BinaryProtocol_writeStructBegin, file, "$$");
3067 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeStructEnd", XS_Thrift__XS__BinaryProtocol_writeStructEnd, file, "$");
3068 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeFieldBegin", XS_Thrift__XS__BinaryProtocol_writeFieldBegin, file, "$$$$");
3069 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeFieldEnd", XS_Thrift__XS__BinaryProtocol_writeFieldEnd, file, "$");
3070 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeFieldStop", XS_Thrift__XS__BinaryProtocol_writeFieldStop, file, "$");
3071 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeMapBegin", XS_Thrift__XS__BinaryProtocol_writeMapBegin, file, "$$$$");
3072 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeMapEnd", XS_Thrift__XS__BinaryProtocol_writeMapEnd, file, "$");
3073 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeListBegin", XS_Thrift__XS__BinaryProtocol_writeListBegin, file, "$$$");
3074 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeListEnd", XS_Thrift__XS__BinaryProtocol_writeListEnd, file, "$");
3075 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeSetBegin", XS_Thrift__XS__BinaryProtocol_writeSetBegin, file, "$$$");
3076 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeSetEnd", XS_Thrift__XS__BinaryProtocol_writeSetEnd, file, "$");
3077 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeBool", XS_Thrift__XS__BinaryProtocol_writeBool, file, "$$");
3078 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeByte", XS_Thrift__XS__BinaryProtocol_writeByte, file, "$$");
3079 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeI16", XS_Thrift__XS__BinaryProtocol_writeI16, file, "$$");
3080 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeI32", XS_Thrift__XS__BinaryProtocol_writeI32, file, "$$");
3081 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeI64", XS_Thrift__XS__BinaryProtocol_writeI64, file, "$$");
3082 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeDouble", XS_Thrift__XS__BinaryProtocol_writeDouble, file, "$$");
3083 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::writeString", XS_Thrift__XS__BinaryProtocol_writeString, file, "$$");
3084 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readMessageBegin", XS_Thrift__XS__BinaryProtocol_readMessageBegin, file, "$$$$");
3085 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readMessageEnd", XS_Thrift__XS__BinaryProtocol_readMessageEnd, file, "$");
3086 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readStructBegin", XS_Thrift__XS__BinaryProtocol_readStructBegin, file, "$$");
3087 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readStructEnd", XS_Thrift__XS__BinaryProtocol_readStructEnd, file, "$");
3088 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readFieldBegin", XS_Thrift__XS__BinaryProtocol_readFieldBegin, file, "$$$$");
3089 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readFieldEnd", XS_Thrift__XS__BinaryProtocol_readFieldEnd, file, "$");
3090 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readMapBegin", XS_Thrift__XS__BinaryProtocol_readMapBegin, file, "$$$$");
3091 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readMapEnd", XS_Thrift__XS__BinaryProtocol_readMapEnd, file, "$");
3092 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readListBegin", XS_Thrift__XS__BinaryProtocol_readListBegin, file, "$$$");
3093 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readListEnd", XS_Thrift__XS__BinaryProtocol_readListEnd, file, "$");
3094 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readSetBegin", XS_Thrift__XS__BinaryProtocol_readSetBegin, file, "$$$");
3095 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readSetEnd", XS_Thrift__XS__BinaryProtocol_readSetEnd, file, "$");
3096 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readBool", XS_Thrift__XS__BinaryProtocol_readBool, file, "$$");
3097 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readByte", XS_Thrift__XS__BinaryProtocol_readByte, file, "$$");
3098 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readI16", XS_Thrift__XS__BinaryProtocol_readI16, file, "$$");
3099 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readI32", XS_Thrift__XS__BinaryProtocol_readI32, file, "$$");
3100 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readI64", XS_Thrift__XS__BinaryProtocol_readI64, file, "$$");
3101 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readDouble", XS_Thrift__XS__BinaryProtocol_readDouble, file, "$$");
3102 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readString", XS_Thrift__XS__BinaryProtocol_readString, file, "$$");
3103 4 (void)newXSproto_portable("Thrift::XS::BinaryProtocol::readStringBody", XS_Thrift__XS__BinaryProtocol_readStringBody, file, "$$$");
3104 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::resetState", XS_Thrift__XS__CompactProtocol_resetState, file, "$");
3105 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeMessageBegin", XS_Thrift__XS__CompactProtocol_writeMessageBegin, file, "$$$$");
3106 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeStructBegin", XS_Thrift__XS__CompactProtocol_writeStructBegin, file, "$$");
3107 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeStructEnd", XS_Thrift__XS__CompactProtocol_writeStructEnd, file, "$");
3108 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeFieldBegin", XS_Thrift__XS__CompactProtocol_writeFieldBegin, file, "$$$$");
3109 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeMapBegin", XS_Thrift__XS__CompactProtocol_writeMapBegin, file, "$$$$");
3110 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeListBegin", XS_Thrift__XS__CompactProtocol_writeListBegin, file, "$$$");
3111 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeSetBegin", XS_Thrift__XS__CompactProtocol_writeSetBegin, file, "$$$");
3112 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeBool", XS_Thrift__XS__CompactProtocol_writeBool, file, "$$");
3113 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeI16", XS_Thrift__XS__CompactProtocol_writeI16, file, "$$");
3114 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeI32", XS_Thrift__XS__CompactProtocol_writeI32, file, "$$");
3115 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeI64", XS_Thrift__XS__CompactProtocol_writeI64, file, "$$");
3116 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeDouble", XS_Thrift__XS__CompactProtocol_writeDouble, file, "$$");
3117 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::writeString", XS_Thrift__XS__CompactProtocol_writeString, file, "$$");
3118 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readMessageBegin", XS_Thrift__XS__CompactProtocol_readMessageBegin, file, "$$$$");
3119 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readStructBegin", XS_Thrift__XS__CompactProtocol_readStructBegin, file, "$$");
3120 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readStructEnd", XS_Thrift__XS__CompactProtocol_readStructEnd, file, "$");
3121 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readFieldBegin", XS_Thrift__XS__CompactProtocol_readFieldBegin, file, "$$$$");
3122 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readMapBegin", XS_Thrift__XS__CompactProtocol_readMapBegin, file, "$$$$");
3123 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readListBegin", XS_Thrift__XS__CompactProtocol_readListBegin, file, "$$$");
3124 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readSetBegin", XS_Thrift__XS__CompactProtocol_readSetBegin, file, "$$$");
3125 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readBool", XS_Thrift__XS__CompactProtocol_readBool, file, "$$");
3126 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readI16", XS_Thrift__XS__CompactProtocol_readI16, file, "$$");
3127 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readI32", XS_Thrift__XS__CompactProtocol_readI32, file, "$$");
3128 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readI64", XS_Thrift__XS__CompactProtocol_readI64, file, "$$");
3129 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readDouble", XS_Thrift__XS__CompactProtocol_readDouble, file, "$$");
3130 4 (void)newXSproto_portable("Thrift::XS::CompactProtocol::readString", XS_Thrift__XS__CompactProtocol_readString, file, "$$");
3131 #if PERL_VERSION_LE(5, 21, 5)
3132 # if PERL_VERSION_GE(5, 9, 0)
3133 if (PL_unitcheckav)
3134 call_list(PL_scopestack_ix, PL_unitcheckav);
3135 # endif
3136 XSRETURN_YES;
3137 #else
3138 4 Perl_xs_boot_epilog(aTHX_ ax);
3139 #endif
3140 4 }
3141  
3142 #ifdef __cplusplus
3143 }
3144 #endif
« src/Magic.c ↑ Summary MemoryBuffer.xs »