static bool stream_pdu(w_jbuffer_t *jr, w_stm_t stm, json_error_t *jerr) { uint32_t bser_version = 1; json_int_t bser_capabilities; json_int_t len; switch (jr->pdu_type) { case is_json_compact: case is_json_pretty: return stream_until_newline(jr, stm); case is_bser: case is_bser_v2: { if (jr->pdu_type == is_bser_v2) { bser_version = 2; } else { bser_version = 1; } jr->rpos += 2; if (!w_bser_decode_pdu_info(jr, stm, bser_version, &len, &bser_capabilities, jerr)) { return false; } return stream_n_bytes(jr, stm, len, jerr); } default: w_log(W_LOG_FATAL, "not streaming for pdu type %d\n", jr->pdu_type); return false; } }
static bool stream_pdu(w_jbuffer_t *jr, w_stm_t stm, json_error_t *jerr) { switch (jr->pdu_type) { case is_json_compact: case is_json_pretty: return stream_until_newline(jr, stm); case is_bser: { json_int_t len; jr->rpos += 2; if (!w_bser_decode_pdu_len(jr, stm, &len, jerr)) { return false; } return stream_n_bytes(jr, stm, len, jerr); } default: w_log(W_LOG_FATAL, "not streaming for pdu type %d\n", jr->pdu_type); return false; } }