Skip to content

Commit 38c7b0e

Browse files
committed
lyb MAINTENANCE explicit value type/print
1 parent 23bc6ea commit 38c7b0e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/parser_lyb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ lyb_read_string(const char *data, char **str, int with_length, struct lyb_state
167167
size_t len = 0, cur_len;
168168

169169
if (with_length) {
170-
ret += (r = lyb_read_number(&len, 2, data, lybs));
170+
ret += (r = lyb_read_number((uint64_t *)&len, 2, data, lybs));
171171
LYB_HAVE_READ_GOTO(r, data, error);
172172
} else {
173173
/* read until the end of this subtree */
@@ -1343,7 +1343,7 @@ lyd_lyb_data_length(const char *data)
13431343
for (i = 0; i < lybs.mod_count; ++i) {
13441344
/* module name length */
13451345
len = 0;
1346-
ret += (r = lyb_read_number(&len, 2, data, &lybs));
1346+
ret += (r = lyb_read_number((uint64_t *)&len, 2, data, &lybs));
13471347
LYB_HAVE_READ_GOTO(r, data, finish);
13481348

13491349
/* model name */

tests/internal/test_lyb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <setjmp.h>
1919
#include <stdarg.h>
2020
#include <cmocka.h>
21+
#include <inttypes.h>
2122

2223
#include "tests/config.h"
2324
#include "libyang.h"
@@ -111,7 +112,7 @@ check_data_tree(struct lyd_node *root1, struct lyd_node *root2)
111112
break;
112113
default:
113114
if ((attr1->value.uint64 != attr2->value.uint64) && !(attr1->value_flags & LY_VALUE_USER)) {
114-
fprintf(stderr, "\"%s\": attr value mismatch (\"%lu\" and \"%lu\").\n", elem1->schema->name, attr1->value.uint64, attr2->value.uint64);
115+
fprintf(stderr, "\"%s\": attr value mismatch (\"%" PRIu64 "\" and \"%" PRIu64 "\").\n", elem1->schema->name, attr1->value.uint64, attr2->value.uint64);
115116
fail();
116117
}
117118
break;
@@ -196,7 +197,7 @@ check_data_tree(struct lyd_node *root1, struct lyd_node *root2)
196197
break;
197198
default:
198199
if ((leaf1->value.uint64 != leaf2->value.uint64) && !(leaf1->value_flags & LY_VALUE_USER)) {
199-
fprintf(stderr, "\"%s\": value mismatch (\"%lu\" and \"%lu\").\n", elem1->schema->name, leaf1->value.uint64, leaf2->value.uint64);
200+
fprintf(stderr, "\"%s\": value mismatch (\"%" PRIu64 "\" and \"%" PRIu64 "\").\n", elem1->schema->name, leaf1->value.uint64, leaf2->value.uint64);
200201
fail();
201202
}
202203
break;

0 commit comments

Comments
 (0)