Skip to content

Commit 8ff1da5

Browse files
committed
lyb BUGFIX node flag byte order
1 parent af2b95e commit 8ff1da5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/parser_lyb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,9 @@ lyb_parse_node_header(struct lyd_lyb_ctx *lybctx, const struct lysc_node *sparen
969969
if (!lybctx->parse_ctx->shrink) {
970970
/* read flags, fixed bits */
971971
lyb_read(flags, LYB_DATA_NODE_FLAG_BITS, lybctx->parse_ctx);
972+
973+
/* correct byte order */
974+
*flags = le32toh(*flags);
972975
} else {
973976
*flags = LYD_NEW;
974977
}

src/printer_lyb.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,12 +982,17 @@ lyb_print_schema_hash(struct lysc_node *schema, struct ly_ht **sibling_ht, struc
982982
static LY_ERR
983983
lyb_print_node_header(const struct lyd_node *node, struct lyd_lyb_ctx *lybctx)
984984
{
985+
uint32_t buf;
986+
985987
/* write any metadata */
986988
LY_CHECK_RET(lyb_print_metadata(node, lybctx));
987989

988990
if (!lybctx->print_ctx->shrink) {
991+
/* correct byte order */
992+
buf = htole32(node->flags);
993+
989994
/* write node flags, fixed bits */
990-
LY_CHECK_RET(lyb_write(&node->flags, LYB_DATA_NODE_FLAG_BITS, lybctx->print_ctx));
995+
LY_CHECK_RET(lyb_write(&buf, LYB_DATA_NODE_FLAG_BITS, lybctx->print_ctx));
991996
}
992997

993998
return LY_SUCCESS;

0 commit comments

Comments
 (0)