@@ -379,7 +379,7 @@ yajl_map_key(void *ctx, const unsigned char * key, size_t len)
379379 if (unlikely (!tp_call_wof (& s_ctx -> tp )))
380380 say_overflow_r_2 (s_ctx );
381381
382- /** Set method binded to this transcoding
382+ /** Set the method to this transcoding
383383 */
384384 if (!s_ctx -> read_method ) {
385385 tp_transcode_t * tc = s_ctx -> tc ;
@@ -488,12 +488,14 @@ yajl_end_map(void *ctx)
488488
489489 if (s_ctx -> size == 0 ) {
490490
491- if (unlikely (!tp_call_wof_add_params (& s_ctx -> tp )))
492- say_overflow_r_2 (s_ctx );
493-
494491 if (!(s_ctx -> been_stages & PARAMS )) {
492+ dd ("ADDING EMPTY PARAMS\n" );
493+
494+ if (unlikely (!tp_call_wof_add_params (& s_ctx -> tp )))
495+ say_overflow_r_2 (s_ctx );
495496
496- if (s_ctx -> tc -> data .pos && s_ctx -> tc -> data .len ) {
497+ if (s_ctx -> tc -> data .pos && s_ctx -> tc -> data .len
498+ /*has data to bind*/ ) {
497499 tp_encode_array (& s_ctx -> tp , 1 );
498500 if (unlikely (!bind_data (s_ctx )))
499501 say_overflow_r_2 (s_ctx );
@@ -548,7 +550,7 @@ yajl_start_array(void *ctx)
548550
549551 stack_grow_array (s_ctx );
550552
551- bool push_ok = false, bind_first_argument = true ;
553+ bool push_ok = false, bind_first_argument = false ;
552554 if (unlikely (s_ctx -> size == 0 )) {
553555 push_ok = stack_push (s_ctx , s_ctx -> tp .p , TYPE_ARRAY | PARAMS );
554556 bind_first_argument = true;
@@ -565,9 +567,11 @@ yajl_start_array(void *ctx)
565567
566568 tp_add (& s_ctx -> tp , 1 + sizeof (uint32_t ));
567569
568- // Binding data [
569- if (unlikely (bind_first_argument )) {
570- if (!bind_data (s_ctx ))
570+ // Here is bind data
571+ // e.g. http request
572+ // [
573+ if (bind_first_argument ) {
574+ if (unlikely (!bind_data (s_ctx )))
571575 say_overflow_r_2 (s_ctx );
572576 }
573577 // ]
@@ -588,19 +592,20 @@ yajl_end_array(void *ctx)
588592
589593 dd ("array close, count %d ']'\n" , item -> count );
590594
595+ size_t item_count = item -> count ;
591596 if (unlikely (item -> type & PARAMS )) {
592597 dd ("PARAMS END\n" );
593598 s_ctx -> stage = WAIT_NEXT ;
594599 s_ctx -> been_stages |= PARAMS ;
595600 // Increase number of args for binded data [
596601 tp_transcode_t * tc = s_ctx -> tc ;
597602 if (tc -> data .pos && tc -> data .len )
598- ++ item -> count ;
603+ ++ item_count ;
599604 // ]
600605 }
601606
602607 * (item -> ptr ++ ) = 0xdd ;
603- * (uint32_t * ) item -> ptr = mp_bswap_u32 (item -> count );
608+ * (uint32_t * ) item -> ptr = mp_bswap_u32 (item_count );
604609
605610 } else {
606611 say_wrong_params (s_ctx );
0 commit comments